@g1cloud/bpmn-modeler-next 5.0.0-beta.54 → 5.0.0-beta.55
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 +6051 -6034
- package/dist/bpmn-modeler.umd.cjs +37 -37
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
(function(te,xe){typeof exports=="object"&&typeof module<"u"?xe(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],xe):(te=typeof globalThis<"u"?globalThis:te||self,xe(te.BpmnModeler={},te.Vue))})(this,(function(te,xe){"use strict";var q3=Object.defineProperty;var Y3=(te,xe,_r)=>xe in te?q3(te,xe,{enumerable:!0,configurable:!0,writable:!0,value:_r}):te[xe]=_r;var $n=(te,xe,_r)=>Y3(te,typeof xe!="symbol"?xe+"":xe,_r);const _r=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],Cc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function Hg(e){return _r.includes(e)}function zg(e){return Cc.includes(e)}const Mc=["timer"],Ac={timer:"bpmn:TimerEventDefinition"};function Gg(e){return typeof e=="string"&&Mc.includes(e)}function Mp(e){if(e.length===1)return Mc.find(t=>Ac[t]===e[0])}const Pc=["ko","en","ja","zh"];function RS(e){return typeof e=="string"&&Pc.includes(e)}const Vg="http://g1project.net/spec/bpmn/bwl/1.0",Ap="bwl",Pp=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Tc="bwl:ReviewRequest",Wg={name:"bwl-hints",uri:Vg,prefix:Ap,xml:{tagAlias:"lowerCase"},types:[{name:"Placement",superClass:["Element"],properties:[{name:"anchor",isAttr:!0,type:"String"},{name:"side",isAttr:!0,type:"String"},{name:"offset",isAttr:!0,type:"Real"}]},{name:"Members",superClass:["Element"],properties:[{name:"refs",isAttr:!0,type:"String"}]},{name:"BandHint",extends:["bpmn:FlowNode"],properties:[{name:"band",isAttr:!0,type:"Integer"}]},{name:"AfterColumnHint",extends:["bpmn:FlowNode"],properties:[{name:"afterColumn",isAttr:!0,type:"String"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]},{name:"ReviewRequest",superClass:["Element"],properties:[{name:"locale",isAttr:!0,type:"String"},{name:"sourceLocale",isAttr:!0,type:"String"},{name:"previous",isBody:!0,type:"String"}]}]},Tp="bwl.undoEpisode",Ug=new WeakSet;function CS(e){Ug.has(e)||(e.register(Tp,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Ug.add(e))}function qg(e,t){CS(e);const n={run:t};if(e.execute(Tp,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function kp(e){return Array.prototype.concat.apply([],e)}const rs=Object.prototype.toString,MS=Object.prototype.hasOwnProperty;function Er(e){return e===void 0}function mn(e){return e!==void 0}function oa(e){return e==null}function Ye(e){return rs.call(e)==="[object Array]"}function yn(e){return rs.call(e)==="[object Object]"}function Ke(e){return rs.call(e)==="[object Number]"}function _n(e){const t=rs.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function ei(e){return rs.call(e)==="[object String]"}function AS(e){if(!Ye(e))throw new Error("must supply array")}function ti(e,t){return!oa(e)&&MS.call(e,t)}function $t(e,t){const n=Oc(t);let i;return W(e,function(o,r){if(n(o,r))return i=o,!1}),i}function Yg(e,t){const n=Oc(t);let i=Ye(e)?-1:void 0;return W(e,function(o,r){if(n(o,r))return i=r,!1}),i}function ct(e,t){const n=Oc(t);let i=[];return W(e,function(o,r){n(o,r)&&i.push(o)}),i}function W(e,t){let n,i;if(Er(e))return;const o=Ye(e)?DS:OS;for(let r in e)if(ti(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function PS(e,t){if(Er(e))return[];AS(e);const n=Oc(t);return e.filter(function(i,o){return!n(i,o)})}function ni(e,t,n){return W(e,function(i,o){n=t(n,i,o)}),n}function Bo(e,t){return!!ni(e,function(n,i,o){return n&&t(i,o)},!0)}function No(e,t){return!!$t(e,t)}function Fn(e,t){let n=[];return W(e,function(i,o){n.push(t(i,o))}),n}function kc(e){return e&&Object.keys(e)||[]}function TS(e){return kc(e).length}function ra(e){return Fn(e,t=>t)}function aa(e,t,n={}){return t=Op(t),W(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function Kg(e,...t){e=Op(e);let n={};return W(t,o=>aa(o,e,n)),Fn(n,function(o,r){return o[0]})}const kS=Kg;function Yi(e,t){t=Op(t);let n=[];return W(e,function(i,o){let r=t(i,o),a={d:r,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(r<c){n.splice(s,0,a);return}}n.push(a)}),Fn(n,i=>i.v)}function sa(e){return function(t){return Bo(e,function(n,i){return t[i]===n})}}function Op(e){return _n(e)?e:t=>t[e]}function Oc(e){return _n(e)?e:t=>t===e}function OS(e){return e}function DS(e){return Number(e)}function Dp(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 Zn(e,t){return e.bind(t)}function q(e,...t){return Object.assign(e,...t)}function LS(e,t,n){let i=e;return W(t,function(o,r){if(typeof o!="number"&&typeof o!="string")throw new Error("illegal key type: "+typeof o+". Key should be of type number or string.");if(o==="constructor")throw new Error("illegal key: constructor");if(o==="__proto__")throw new Error("illegal key: __proto__");let a=t[r+1],s=i[o];mn(a)&&oa(s)&&(s=i[o]=isNaN(+a)?{}:[]),Er(a)?Er(n)?delete i[o]:i[o]=n:i=s}),e}function $i(e,t){let n={},i=Object(e);return W(t,function(o){o in i&&(n[o]=e[o])}),n}function Ki(e,t){let n={},i=Object(e);return W(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function M(e,t){var n=be(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function at(e,t){return No(t,function(n){return M(e,n)})}function be(e){return e&&e.businessObject||e}function yt(e){return e&&e.di}const IS="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Xg="i18n",Sr="i18n:Translation";function Rr(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 $o(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,Sr)})}function Cn(e){return e.get("xml:lang")}function Fo(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,Tc)})}function as(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,o,r)=>i!==t&&r.indexOf(i)===o)]}function Lp(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 Ip(e,t,n){const i=Rr(e);if(!i)return{};const o=i.target[i.key]??"",r=$o(e).filter(u=>Cn(u)),a=u=>u.body??"",s=o?r.filter(u=>a(u)===o).map(Cn):[],c=o?s.length?s:[n??t.designLocale]:[],l={};for(const u of as(t)){if(c.includes(u)){l[u]=o;continue}const p=r.find(f=>Cn(f)===u&&a(f));p&&(l[u]=a(p))}return l}const Dc="bwl.updateTranslation";class Bp{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=Rr(c),u=[];t.undo=u;const p=$o(c).filter(T=>Cn(T)),f=s??(l?l.target[l.key]??"":""),d=a??o,h=(T=>{if(!T)return[];const j=p.filter(F=>F.body===T).map(Cn);return j.length?j:[d]})(f),m=s!==void 0&&f&&!h.includes(t.locale)?h[0]:t.locale,w=T=>{var j;return((j=p.find(F=>Cn(F)===T&&F.body))==null?void 0:j.body)??(h.includes(T)?f:"")},y=T=>Fo(c).some(j=>j.locale===T),v=w(m);if(v===i)return[];const x=!!v&&!y(m),E=x?r.filter(T=>T!==m&&w(T)&&!y(T)):[],A=()=>{let T=c.extensionElements;return T||(T=this.moddle.create("bpmn:ExtensionElements",{values:[]}),T.$parent=c,c.extensionElements=T,u.push(()=>delete c.extensionElements)),T.get("values")},D=(T,j)=>{const F=A();let G=F.find(Z=>{var re;return((re=Z.$instanceOf)==null?void 0:re.call(Z,Sr))&&Cn(Z)===T});if(G){const Z=G.body;G.body=j,u.push(()=>G.body=Z)}else G=this.moddle.create(Sr,{body:j}),G.set("xml:lang",T),G.$parent=c.extensionElements,F.push(G),u.push(()=>F.splice(F.indexOf(G),1))},P=T=>{const j=A(),F=j.indexOf(T);j.splice(F,1),u.push(()=>j.splice(F,0,T))};if(s===void 0){if(m===o&&l){if(f&&!p.some(j=>j.body===f)){const j=a&&a!==o?a:void 0;j&&D(j,f)}const T=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{T?l.target[l.key]=f:delete l.target[l.key]})}D(m,i)}else(p.some(T=>Cn(T)===m)||!f&&m!==d)&&D(m,i);if(!x)for(const T of Fo(c).filter(j=>j.locale===m))P(T);for(const T of E){const j=A(),F=this.moddle.create(Tc,{locale:T,sourceLocale:m,previous:v});F.$parent=c.extensionElements,j.push(F),u.push(()=>j.splice(j.indexOf(F),1))}for(const T of Fo(c).filter(j=>j.sourceLocale===m&&(j.previous??"")===i))P(T);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):[]}}$n(Bp,"$inject",["moddle"]);const Np="bwl.setTranslations",BS=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class $p{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,!Rr(l))return[];const p=()=>{let w=l.extensionElements;return w||(w=this.moddle.create("bpmn:ExtensionElements",{values:[]}),w.$parent=l,l.extensionElements=w,u.push(()=>delete l.extensionElements)),w.get("values")},f=w=>{const y=p(),v=y.indexOf(w);v<0||(y.splice(v,1),u.push(()=>y.splice(v,0,w)))},d=w=>$o(l).find(y=>Cn(y)===w);if(i===null)for(const w of a){const y=d(w);y&&f(y)}else if(i)for(const w of a){const y=i[w];if(y===void 0)continue;const v=d(w);if(v){if(v.body===y)continue;const A=v.body;v.body=y,u.push(()=>v.body=A);continue}if(w===r&&(s??r)===r)continue;const x=p(),E=this.moddle.create(Sr,{body:y});E.set("xml:lang",w),E.$parent=l.extensionElements,x.push(E),u.push(()=>x.splice(x.indexOf(E),1))}const h=[...i===null?[]:c.requests.filter(w=>!o.includes(w.locale)&&!(i&&i[w.locale]!==void 0&&i[w.locale]!==c.texts[w.locale])&&!(i&&w.sourceLocale&&i[w.sourceLocale]===w.previous))];for(const w of Fo(l)){const y=h.findIndex(v=>BS(w,v));y>=0?h.splice(y,1):f(w)}for(const w of h){const y=p(),v=this.moddle.create(Tc,{locale:w.locale,...w.sourceLocale?{sourceLocale:w.sourceLocale}:{},previous:w.previous});v.$parent=l.extensionElements,y.push(v),u.push(()=>y.splice(y.indexOf(v),1))}const m=l.extensionElements;return m&&!m.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=m)),u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}$n($p,"$inject",["moddle"]);function Fp(e){return Fo(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class jp{constructor(t){t.registerHandler(Dc,Bp),t.registerHandler(Np,$p)}}$n(jp,"$inject",["commandStack"]);const Hp={__init__:["translationCommands"],translationCommands:["type",jp]},Zg=["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"],NS={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},$S={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(Pc.map(e=>[e,{type:"string"}])),additionalProperties:!1},FS={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},jS={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},HS={type:"string",enum:[...Mc],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},zS={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Cc]},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},GS={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},VS={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},WS={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},qS={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},YS={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},KS={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},XS={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},ZS={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Pp]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function Pn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const QS={"participant.add":Pn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Pn("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":Pn("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":Pn("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:[...Cc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":Pn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Pn("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":Pn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Pn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":Pn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Pn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":Pn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Pn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Pn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Pn("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":Pn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Pn("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":Pn("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...Pc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":Pn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Qg={anyOf:Zg.map(e=>QS[e])},JS={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:FS,irParticipant:jS,irNode:zS,irFlowCondition:GS,irSequenceFlow:VS,irMessageFlow:WS,irDataStore:US,irDataAssociation:qS,irTextAnnotation:YS,irAssociation:KS,irGroup:XS,bwlPlacement:ZS,eventDefinition:HS,localeTexts:$S,nullableString:NS,symbolicOp:Qg}};function zp(){}zp.prototype.get=function(e){return this.$model.properties.get(this,e)},zp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Jg(e,t){this.model=e,this.properties=t}Jg.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(zp.prototype);W(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var o=e.ns.name;function r(a){n.define(this,"$type",{value:o,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),W(a,Zn(function(s,c){this.set(c,s)},this))}return r.prototype=i,r.hasType=i.$instanceOf=this.model.hasType,n.defineModel(r,t),n.defineDescriptor(r,e),r};var eR=q(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),em=q(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 Gp(e,t){var n=em[e];return n?n(t):t}function Vp(e){return!!eR[e]}function tm(e){return!!em[e]}function jn(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 di(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}di.prototype.build=function(){return $i(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},di.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)},di.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},di.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=jn(o[0],i),a=jn(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},di.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},di.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},di.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},di.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},di.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},di.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")},di.prototype.hasProperty=function(e){return this.propertiesByName[e]},di.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(W(e.properties,Zn(function(r){r=q({},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 jo(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,W(e,Zn(this.registerPackage,this))}jo.prototype.getPackage=function(e){return this.packageMap[e]},jo.prototype.getPackages=function(){return this.packages},jo.prototype.registerPackage=function(e){e=q({},e);var t=this.packageMap;nm(t,e,"prefix"),nm(t,e,"uri"),W(e.types,Zn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},jo.prototype.registerType=function(e,t){e=q({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:q({},e.meta||{})});var n=jn(e.name,t.prefix),i=n.name,o=Object.create(null);W(e.properties,Zn(function(r){var a=jn(r.name,n.prefix),s=a.name;Vp(r.type)||(r.type=jn(r.type,a.prefix).name),q(r,{ns:a,name:s}),o[s]=r},this)),q(e,{ns:n,name:i,propertiesByName:o}),W(e.extends,Zn(function(r){var a=jn(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},jo.prototype.mapTypes=function(e,t,n){var i=Vp(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=jn(c,Vp(c)?"":e.prefix);o.mapTypes(u,t,l)}function a(c){return r(c,!0)}function s(c){return r(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");W(i.superClass,n?a:s),t(i,!n),W(i.traits,a)},jo.prototype.getEffectiveDescriptor=function(e){var t=jn(e),n=new di(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},jo.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function nm(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Cr(e){this.model=e}Cr.prototype.set=function(e,t,n){if(!ei(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),o=i&&i.name;tR(n)?i?delete e[o]:delete e.$attrs[Wp(t)]:i?o in e?e[o]=n:im(e,i,n):e.$attrs[Wp(t)]=n},Cr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Wp(t)];var i=n.name;return!e[i]&&n.isMany&&im(e,n,[]),e[i]},Cr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=q({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Cr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Cr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Cr.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 tR(e){return typeof e>"u"}function im(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Wp(e){return e.replace(/^:/,"")}function xi(e,t={}){this.properties=new Cr(this),this.factory=new Jg(this,this.properties),this.registry=new jo(e,this.properties),this.typeCache=Object.create(null),this.config=t}xi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},xi.prototype.getType=function(e){var t=this.typeCache,n=ei(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},xi.prototype.createAny=function(e,t,n){var i=jn(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){LS(this,[a],s)}},r={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(o,r),this.properties.defineModel(o,this),this.properties.define(o,"get",{enumerable:!1,writable:!0}),this.properties.define(o,"set",{enumerable:!1,writable:!0}),this.properties.define(o,"$parent",{enumerable:!1,writable:!0}),this.properties.define(o,"$instanceOf",{enumerable:!1,writable:!0}),W(n,function(a,s){yn(a)&&a.value!==void 0?o[a.name]=a.value:o[s]=a}),o},xi.prototype.getPackage=function(e){return this.registry.getPackage(e)},xi.prototype.getPackages=function(){return this.registry.getPackages()},xi.prototype.getElementDescriptor=function(e){return e.$descriptor},xi.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},xi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},xi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var om=String.fromCharCode,nR=Object.prototype.hasOwnProperty,iR=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,ss={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(ss).forEach(function(e){ss[e.toUpperCase()]=ss[e]});function oR(e,t,n,i){return i?nR.call(ss,i)?ss[i]:"&"+i+";":om(t||parseInt(n,16))}function Mr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(iR,oR):e}var rm="non-whitespace outside of root node";function Ho(e){return new Error(e)}function rR(e){return"missing namespace for prefix <"+e+">"}function Lc(e){return{get:e,enumerable:!0}}function aR(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var am=Symbol("nameCache");function Up(e){return e+"$uri"}function sR(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Up(i)]=n;return t}function Ic(){return{line:0,column:0}}function cR(e){throw e}function sm(e){if(!this)return new sm(e);var t=e&&e.proxy,n,i,o,r,a=cR,s,c,l,u,p=Ic,f=!1,d=!1,g="",h=!1,m=!1,w=null,y=!1,v,x,E,A;function D(F){F instanceof Error||(F=Ho(F)),w=F,a(F,p)}function P(F){s&&(F instanceof Error||(F=Ho(F)),s(F,p))}this.on=function(F,G){if(typeof G!="function")throw Ho("required args <name, cb>");switch(F){case"openTag":i=G;break;case"text":n=G;break;case"closeTag":o=G;break;case"error":a=G;break;case"warn":s=G;break;case"cdata":r=G;break;case"attention":u=G;break;case"question":l=G;break;case"comment":c=G;break;default:throw Ho("unsupported event: "+F)}return this},this.ns=function(F){if(typeof F>"u"&&(F={}),typeof F!="object")throw Ho("required args <nsMap={}>");var G=Object.create(null),Z;for(Z in F)G[Z]=F[Z];return m=!0,A=G,this};function T(){v=m?[]:null,x=m?sR(A):null,E=[],p=Ic,y=!1,w=null,d=!1,g=""}this.parse=function(F){if(typeof F!="string")throw Ho("required args <xml=string>");if(f)throw Ho("parse during stream; call end() first");return T(),j(F),p=Ic,y=!1,w},this.write=function(F){if(typeof F!="string")throw Ho("required args <xml=string>");return f||(T(),f=!0),w||(g=j(g+F,!0)||""),this},this.end=function(){return f||T(),f=!1,w||j(g),g="",p=Ic,y=!1,w},this.stop=function(){y=!0};function j(F,G=!1){var Z=null,re=null,J,ye=0,ae=!1,we=!1,Ee=0,U=0,ce,Y,X,fe,Se,Ie,N,C,S,V="",K=0,le;function Te(Pt,Ht){var gn=Pt.indexOf(":");if(gn===-1)return Pt;var Nn=x[Pt.substring(0,gn)];return Nn?Ht===Nn?Pt.substr(gn+1):Nn+Pt.substr(gn):(P(rR(Pt.substring(0,gn))),null)}function Ve(){if(le!==null)return le;var Pt,Ht,gn=m&&x.xmlns,Nn=m&&h?[]:null,Nt=K,rn=V,Vn=rn.length,Za,pi,Li,bi,wn,Lo={},bc=new Set,Kn,gt,St;e:for(;Nt<Vn;Nt++)if(Kn=!1,gt=rn.charCodeAt(Nt),!(gt===32||gt<14&>>8)){for((gt<65||gt>122||gt>90&><97)&>!==95&>!==58&&(P("illegal first char attribute name"),Kn=!0),St=Nt+1;St<Vn;St++)if(gt=rn.charCodeAt(St),!(gt>96&><123||gt>64&><91||gt>47&><59||gt===46||gt===45||gt===95)){if(gt===32||gt<14&>>8){P("missing attribute value"),Nt=St;continue e}if(gt===61)break;P("illegal attribute name char"),Kn=!0}if(wn=rn.substring(Nt,St),wn==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),Kn=!0),gt=rn.charCodeAt(St+1),gt===34)St=rn.indexOf('"',Nt=St+2),St===-1&&(St=rn.indexOf("'",Nt),St!==-1&&(P("attribute value quote missmatch"),Kn=!0));else if(gt===39)St=rn.indexOf("'",Nt=St+2),St===-1&&(St=rn.indexOf('"',Nt),St!==-1&&(P("attribute value quote missmatch"),Kn=!0));else for(P("missing attribute value quotes"),Kn=!0,St=St+1;St<Vn&&(gt=rn.charCodeAt(St+1),!(gt===32||gt<14&>>8));St++);for(St===-1&&(P("missing closing quotes"),St=Vn,Kn=!0),Kn||(Li=rn.substring(Nt,St)),Nt=St;St+1<Vn&&(gt=rn.charCodeAt(St+1),!(gt===32||gt<14&>>8));St++)Nt===St&&(P("illegal character after attribute end"),Kn=!0);if(Nt=St+1,Kn)continue e;if(bc.has(wn)){P("attribute <"+wn+"> already defined");continue}if(bc.add(wn),!m){Lo[wn]=Li;continue}if(h){if(pi=wn==="xmlns"?"xmlns":wn.charCodeAt(0)===120&&wn.substr(0,6)==="xmlns:"?wn.substr(6):null,pi!==null){if(Pt=Mr(Li),Ht=Up(pi),bi=A[Pt],!bi){if(pi==="xmlns"||Ht in x&&x[Ht]!==Pt)do bi="ns"+ye++;while(typeof x[bi]<"u");else bi=pi;A[Pt]=bi}x[pi]!==bi&&(Za||(x=aR(x),Za=!0),x[pi]=bi,pi==="xmlns"&&(x[Up(bi)]=Pt,gn=bi),x[Ht]=Pt),Lo[wn]=Li;continue}Nn.push(wn,Li);continue}wn=Te(wn,gn),wn!==null&&(Lo[wn]=Li)}if(h)for(Nt=0,Vn=Nn.length;Nt<Vn;Nt++)wn=Te(Nn[Nt++],gn),Li=Nn[Nt],wn!==null&&(Lo[wn]=Li);return le=Lo}function wt(){for(var Pt=/(\r\n|\r|\n)/g,Ht=0,gn=0,Nn=0,Nt=U,rn,Vn;Ee>=Nn&&(rn=Pt.exec(F),!(!rn||(Nt=rn[0].length+rn.index,Nt>Ee)));)Ht+=1,Nn=Nt;return Ee==-1?(gn=Nt,Vn=F.substring(U)):U===0?Vn=F.substring(U,Ee):(gn=Ee-Nn,Vn=U==-1?F.substring(Ee):F.substring(Ee,U+1)),{data:Vn,line:Ht,column:gn}}for(p=wt,t&&(S=Object.create({},{name:Lc(function(){return N}),originalName:Lc(function(){return C}),attrs:Lc(Ve),ns:Lc(function(){return x})}));U!==-1;){if(F.charCodeAt(U)===60?Ee=U:Ee=F.indexOf("<",U),Ee===-1){if(G)return F.substring(U);if(E.length)return D("unexpected end of file");if(!d)return D("missing start tag");U<F.length&&F.substring(U).trim()&&P(rm);return}if(d||(d=!0),U!==Ee){if(E.length){if(n&&(n(F.substring(U,Ee),Mr,p),y))return}else if(F.substring(U,Ee).trim()&&(P(rm),y))return}if(fe=F.charCodeAt(Ee+1),fe===33){if(X=F.charCodeAt(Ee+2),X===91&&F.substr(Ee+3,6)==="CDATA["){if(U=F.indexOf("]]>",Ee),U===-1)return G?F.substring(Ee):D("unclosed cdata");if(r&&(r(F.substring(Ee+9,U),p),y))return;U+=3;continue}if(X===45&&F.charCodeAt(Ee+3)===45){if(U=F.indexOf("-->",Ee),U===-1)return G?F.substring(Ee):D("unclosed comment");if(c&&(c(F.substring(Ee+4,U),Mr,p),y))return;U+=3;continue}}if(fe===63){if(U=F.indexOf("?>",Ee),U===-1)return G?F.substring(Ee):D("unclosed question");if(l&&(l(F.substring(Ee,U+2),p),y))return;U+=2;continue}for(ce=Ee+1;;ce++){if(Se=F.charCodeAt(ce),isNaN(Se))return G?F.substring(Ee):(U=-1,D("unclosed tag"));if(Se===34)X=F.indexOf('"',ce+1),ce=X!==-1?X:ce;else if(Se===39)X=F.indexOf("'",ce+1),ce=X!==-1?X:ce;else if(Se===62){U=ce;break}}if(fe===33){if(u&&(u(F.substring(Ee,U+1),Mr,p),y))return;U+=1;continue}if(le={},fe===47){if(ae=!1,we=!0,!E.length)return D("missing open tag");if(ce=N=E.pop(),X=Ee+2+ce.length,F.substring(Ee+2,X)!==ce)return D("closing tag mismatch");for(;X<U;X++)if(fe=F.charCodeAt(X),!(fe===32||fe>8&&fe<14))return D("close tag")}else{if(F.charCodeAt(U-1)===47?(ce=N=F.substring(Ee+1,U-1),ae=!0,we=!0):(ce=N=F.substring(Ee+1,U),ae=!0,we=!1),!(fe>96&&fe<123||fe>64&&fe<91||fe===95||fe===58))return D("illegal first char nodeName");for(X=1,Y=ce.length;X<Y;X++)if(fe=ce.charCodeAt(X),!(fe>96&&fe<123||fe>64&&fe<91||fe>47&&fe<59||fe===45||fe===95||fe==46)){if(fe===32||fe<14&&fe>8){N=ce.substring(0,X),le=null;break}return D("invalid nodeName")}we||E.push(N)}if(m){J=x,ae&&(we||v.push(J),le===null&&(h=ce.indexOf("xmlns",X)!==-1)&&(K=X,V=ce,Ve(),h=!1)),C=N,re!==x&&(Z=x[am],Z===void 0&&(Z=x[am]=Object.create(null)),re=x);var Qt=Z[N];if(Qt!==void 0)N=Qt;else{if(fe=N.indexOf(":"),fe!==-1){if(Ie=x[N.substring(0,fe)],!Ie)return D("missing namespace on <"+C+">");N=N.substr(fe+1)}else Ie=x.xmlns;Ie&&(N=Ie+":"+N),Z[C]=N}}if(ae&&(K=X,V=ce,i&&(t?i(S,Mr,we,p):i(N,Ve,Mr,we,p),y)))return;if(we){if(o&&(o(t?S:N,Mr,ae,p),y))return;m&&(ae?x=J:x=v.pop())}U+=1}}}function cm(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var qp={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},lm="property";function um(e){return e.xml&&e.xml.serialize}function lR(e){const t=um(e);return t!==lm&&(t||null)}function uR(e){return e.charAt(0).toUpperCase()+e.slice(1)}function pm(e,t){return cm(t)?e.prefix+":"+uR(e.localName):e.name}function pR(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 fR(e,t,n){const i=jn(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=jn(o);var a=n.getPackage(r.prefix);return pR(r,a)}function zo(e){return new Error(e)}function go(e){return e.$descriptor}function dR(e){q(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw zo("expected element");var n=this.elementsById,i=go(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 zo("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function cs(){}cs.prototype.handleEnd=function(){},cs.prototype.handleText=function(){},cs.prototype.handleNode=function(){};function Yp(){}Yp.prototype=Object.create(cs.prototype),Yp.prototype.handleNode=function(){return this};function ca(){}ca.prototype=Object.create(cs.prototype),ca.prototype.handleText=function(e){this.body=(this.body||"")+e};function ls(e,t){this.property=e,this.context=t}ls.prototype=Object.create(ca.prototype),ls.prototype.handleNode=function(e){if(this.element)throw zo("expected no sub nodes");return this.element=this.createReference(e),this},ls.prototype.handleEnd=function(){this.element.id=this.body},ls.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Kp(e,t){this.element=t,this.propertyDesc=e}Kp.prototype=Object.create(ca.prototype),Kp.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Gp(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Bc(){}Bc.prototype=Object.create(ca.prototype),Bc.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 Un(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Un.prototype=Object.create(Bc.prototype),Un.prototype.addReference=function(e){this.context.addReference(e)},Un.prototype.handleText=function(e){var t=this.element,n=go(t),i=n.bodyProperty;if(!i)throw zo("unexpected body text <"+e+">");ca.prototype.handleText.call(this,e)},Un.prototype.handleEnd=function(){var e=this.body,t=this.element,n=go(t),i=n.bodyProperty;i&&e!==void 0&&(e=Gp(i.type,e),t.set(i.name,e))},Un.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=go(n),o=this.context,r=new n({}),a=this.model,s;return W(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),W(p,function(f){o.addReference({element:r,property:u.ns.name,id:f})})):o.addReference({element:r,property:u.ns.name,id:c}):(u?c=Gp(u.type,c):l==="xmlns"?l=":"+l:(s=jn(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},Un.prototype.getPropertyForNode=function(e){var t=e.name,n=jn(t),i=this.type,o=this.model,r=go(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=lR(s);if(l){const u=e.attributes[l];if(u){const p=fR(u,e.ns,o),f=o.getType(p);return q({},s,{effectiveType:go(f).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=pm(n,c),u=o.getType(l);if(s=$t(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return q({},s,{effectiveType:go(u).name})}else if(s=$t(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw zo("unrecognized element <"+n.name+">")},Un.prototype.toString=function(){return"ElementDescriptor["+go(this.type).name+"]"},Un.prototype.valueHandler=function(e,t){return new Kp(e,t)},Un.prototype.referenceHandler=function(e){return new ls(e,this.context)},Un.prototype.handler=function(e){return e==="Element"?new la(this.model,e,this.context):new Un(this.model,e,this.context)},Un.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,tm(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?(q(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function Xp(e,t,n){Un.call(this,e,t,n)}Xp.prototype=Object.create(Un.prototype),Xp.prototype.createElement=function(e){var t=e.name,n=jn(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&pm(n,r)||t;if(!o.hasType(a))throw zo("unexpected element <"+e.originalName+">");return Un.prototype.createElement.call(this,e)};function la(e,t,n){this.model=e,this.context=n}la.prototype=Object.create(Bc.prototype),la.prototype.createElement=function(e){var t=e.name,n=jn(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},la.prototype.handleChild=function(e){var t=new la(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},la.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Zp(e){e instanceof xi&&(e={model:e}),q(this,{lax:!1},e)}Zp.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Un?(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 dR(q({},t,{rootHandler:i})),s=new sm({proxy:!0}),c=hR();i.context=a,c.push(i);function l(E,A,D){var P=A(),T=P.line,j=P.column,F=P.data;F.charAt(0)==="<"&&F.indexOf(" ")!==-1&&(F=F.slice(0,F.indexOf(" "))+">");var G="unparsable content "+(F?F+" ":"")+`detected
|
|
1
|
+
(function(ne,we){typeof exports=="object"&&typeof module<"u"?we(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],we):(ne=typeof globalThis<"u"?globalThis:ne||self,we(ne.BpmnModeler={},ne.Vue))})(this,(function(ne,we){"use strict";var Z3=Object.defineProperty;var Q3=(ne,we,Rr)=>we in ne?Z3(ne,we,{enumerable:!0,configurable:!0,writable:!0,value:Rr}):ne[we]=Rr;var $n=(ne,we,Rr)=>Q3(ne,typeof we!="symbol"?we+"":we,Rr);const Rr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],Pc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function Gg(e){return Rr.includes(e)}function Vg(e){return Pc.includes(e)}const Tc=["timer"],kc={timer:"bpmn:TimerEventDefinition"};function Wg(e){return typeof e=="string"&&Tc.includes(e)}function Ap(e){if(e.length===1)return Tc.find(t=>kc[t]===e[0])}const Oc=["ko","en","ja","zh"];function AS(e){return typeof e=="string"&&Oc.includes(e)}const Ug="http://g1project.net/spec/bpmn/bwl/1.0",Pp="bwl",Tp=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Dc="bwl:ReviewRequest",qg={name:"bwl-hints",uri:Ug,prefix:Pp,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"}]}]},kp="bwl.undoEpisode",Yg=new WeakSet;function PS(e){Yg.has(e)||(e.register(kp,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Yg.add(e))}function Kg(e,t){PS(e);const n={run:t};if(e.execute(kp,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function Op(e){return Array.prototype.concat.apply([],e)}const ss=Object.prototype.toString,TS=Object.prototype.hasOwnProperty;function Cr(e){return e===void 0}function mn(e){return e!==void 0}function ra(e){return e==null}function Ye(e){return ss.call(e)==="[object Array]"}function yn(e){return ss.call(e)==="[object Object]"}function Ke(e){return ss.call(e)==="[object Number]"}function _n(e){const t=ss.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function ei(e){return ss.call(e)==="[object String]"}function kS(e){if(!Ye(e))throw new Error("must supply array")}function ti(e,t){return!ra(e)&&TS.call(e,t)}function $t(e,t){const n=Ic(t);let i;return W(e,function(o,r){if(n(o,r))return i=o,!1}),i}function Xg(e,t){const n=Ic(t);let i=Ye(e)?-1:void 0;return W(e,function(o,r){if(n(o,r))return i=r,!1}),i}function ct(e,t){const n=Ic(t);let i=[];return W(e,function(o,r){n(o,r)&&i.push(o)}),i}function W(e,t){let n,i;if(Cr(e))return;const o=Ye(e)?BS:IS;for(let r in e)if(ti(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function OS(e,t){if(Cr(e))return[];kS(e);const n=Ic(t);return e.filter(function(i,o){return!n(i,o)})}function ni(e,t,n){return W(e,function(i,o){n=t(n,i,o)}),n}function Bo(e,t){return!!ni(e,function(n,i,o){return n&&t(i,o)},!0)}function No(e,t){return!!$t(e,t)}function Fn(e,t){let n=[];return W(e,function(i,o){n.push(t(i,o))}),n}function Lc(e){return e&&Object.keys(e)||[]}function DS(e){return Lc(e).length}function aa(e){return Fn(e,t=>t)}function sa(e,t,n={}){return t=Dp(t),W(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function Zg(e,...t){e=Dp(e);let n={};return W(t,o=>sa(o,e,n)),Fn(n,function(o,r){return o[0]})}const LS=Zg;function Yi(e,t){t=Dp(t);let n=[];return W(e,function(i,o){let r=t(i,o),a={d:r,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(r<c){n.splice(s,0,a);return}}n.push(a)}),Fn(n,i=>i.v)}function ca(e){return function(t){return Bo(e,function(n,i){return t[i]===n})}}function Dp(e){return _n(e)?e:t=>t[e]}function Ic(e){return _n(e)?e:t=>t===e}function IS(e){return e}function BS(e){return Number(e)}function Lp(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 Zn(e,t){return e.bind(t)}function q(e,...t){return Object.assign(e,...t)}function NS(e,t,n){let i=e;return W(t,function(o,r){if(typeof o!="number"&&typeof o!="string")throw new Error("illegal key type: "+typeof o+". Key should be of type number or string.");if(o==="constructor")throw new Error("illegal key: constructor");if(o==="__proto__")throw new Error("illegal key: __proto__");let a=t[r+1],s=i[o];mn(a)&&ra(s)&&(s=i[o]=isNaN(+a)?{}:[]),Cr(a)?Cr(n)?delete i[o]:i[o]=n:i=s}),e}function $i(e,t){let n={},i=Object(e);return W(t,function(o){o in i&&(n[o]=e[o])}),n}function Ki(e,t){let n={},i=Object(e);return W(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function M(e,t){var n=be(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function at(e,t){return No(t,function(n){return M(e,n)})}function be(e){return e&&e.businessObject||e}function yt(e){return e&&e.di}const $S="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Qg="i18n",Mr="i18n:Translation";function Ar(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 $o(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,Mr)})}function Cn(e){return e.get("xml:lang")}function Fo(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,Dc)})}function cs(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,o,r)=>i!==t&&r.indexOf(i)===o)]}function Ip(e){var n,i;const t=((n=e==null?void 0:e.get)==null?void 0:n.call(e,"xml:lang"))??((i=e==null?void 0:e.$attrs)==null?void 0:i["xml:lang"]);return typeof t=="string"&&t?t:void 0}function Bp(e,t,n){const i=Ar(e);if(!i)return{};const o=i.target[i.key]??"",r=$o(e).filter(u=>Cn(u)),a=u=>u.body??"",s=o?r.filter(u=>a(u)===o).map(Cn):[],c=o?s.length?s:[n??t.designLocale]:[],l={};for(const u of cs(t)){if(c.includes(u)){l[u]=o;continue}const p=r.find(f=>Cn(f)===u&&a(f));p&&(l[u]=a(p))}return l}const Bc="bwl.updateTranslation";class Np{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=Ar(c),u=[];t.undo=u;const p=$o(c).filter(T=>Cn(T)),f=s??(l?l.target[l.key]??"":""),d=a??o,h=(T=>{if(!T)return[];const j=p.filter(F=>F.body===T).map(Cn);return j.length?j:[d]})(f),m=s!==void 0&&f&&!h.includes(t.locale)?h[0]:t.locale,w=T=>{var j;return((j=p.find(F=>Cn(F)===T&&F.body))==null?void 0:j.body)??(h.includes(T)?f:"")},y=T=>Fo(c).some(j=>j.locale===T),v=w(m);if(v===i)return[];const x=!!v&&!y(m),E=x?r.filter(T=>T!==m&&w(T)&&!y(T)):[],A=()=>{let T=c.extensionElements;return T||(T=this.moddle.create("bpmn:ExtensionElements",{values:[]}),T.$parent=c,c.extensionElements=T,u.push(()=>delete c.extensionElements)),T.get("values")},D=(T,j)=>{const F=A();let G=F.find(Q=>{var re;return((re=Q.$instanceOf)==null?void 0:re.call(Q,Mr))&&Cn(Q)===T});if(G){const Q=G.body;G.body=j,u.push(()=>G.body=Q)}else G=this.moddle.create(Mr,{body:j}),G.set("xml:lang",T),G.$parent=c.extensionElements,F.push(G),u.push(()=>F.splice(F.indexOf(G),1))},P=T=>{const j=A(),F=j.indexOf(T);j.splice(F,1),u.push(()=>j.splice(F,0,T))};if(s===void 0){if(m===o&&l){if(f&&!p.some(j=>j.body===f)){const j=a&&a!==o?a:void 0;j&&D(j,f)}const T=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{T?l.target[l.key]=f:delete l.target[l.key]})}D(m,i)}else(p.some(T=>Cn(T)===m)||!f&&m!==d)&&D(m,i);if(!x)for(const T of Fo(c).filter(j=>j.locale===m))P(T);for(const T of E){const j=A(),F=this.moddle.create(Dc,{locale:T,sourceLocale:m,previous:v});F.$parent=c.extensionElements,j.push(F),u.push(()=>j.splice(j.indexOf(F),1))}for(const T of Fo(c).filter(j=>j.sourceLocale===m&&(j.previous??"")===i))P(T);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):[]}}$n(Np,"$inject",["moddle"]);const $p="bwl.setTranslations",FS=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class Fp{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,!Ar(l))return[];const p=()=>{let w=l.extensionElements;return w||(w=this.moddle.create("bpmn:ExtensionElements",{values:[]}),w.$parent=l,l.extensionElements=w,u.push(()=>delete l.extensionElements)),w.get("values")},f=w=>{const y=p(),v=y.indexOf(w);v<0||(y.splice(v,1),u.push(()=>y.splice(v,0,w)))},d=w=>$o(l).find(y=>Cn(y)===w);if(i===null)for(const w of a){const y=d(w);y&&f(y)}else if(i)for(const w of a){const y=i[w];if(y===void 0)continue;const v=d(w);if(v){if(v.body===y)continue;const A=v.body;v.body=y,u.push(()=>v.body=A);continue}if(w===r&&(s??r)===r)continue;const x=p(),E=this.moddle.create(Mr,{body:y});E.set("xml:lang",w),E.$parent=l.extensionElements,x.push(E),u.push(()=>x.splice(x.indexOf(E),1))}const h=[...i===null?[]:c.requests.filter(w=>!o.includes(w.locale)&&!(i&&i[w.locale]!==void 0&&i[w.locale]!==c.texts[w.locale])&&!(i&&w.sourceLocale&&i[w.sourceLocale]===w.previous))];for(const w of Fo(l)){const y=h.findIndex(v=>FS(w,v));y>=0?h.splice(y,1):f(w)}for(const w of h){const y=p(),v=this.moddle.create(Dc,{locale:w.locale,...w.sourceLocale?{sourceLocale:w.sourceLocale}:{},previous:w.previous});v.$parent=l.extensionElements,y.push(v),u.push(()=>y.splice(y.indexOf(v),1))}const m=l.extensionElements;return m&&!m.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=m)),u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}$n(Fp,"$inject",["moddle"]);function jp(e){return Fo(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class Hp{constructor(t){t.registerHandler(Bc,Np),t.registerHandler($p,Fp)}}$n(Hp,"$inject",["commandStack"]);const zp={__init__:["translationCommands"],translationCommands:["type",Hp]},Jg=["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"],jS={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},HS={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(Oc.map(e=>[e,{type:"string"}])),additionalProperties:!1},zS={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},GS={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},VS={type:"string",enum:[...Tc],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},WS={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Pc]},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},US={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},qS={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},YS={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},KS={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},XS={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},ZS={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},QS={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},JS={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},eR={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Tp]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function Pn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const tR={"participant.add":Pn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Pn("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":Pn("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":Pn("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:[...Pc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":Pn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Pn("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":Pn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Pn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":Pn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Pn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":Pn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Pn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Pn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Pn("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":Pn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Pn("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":Pn("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...Oc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":Pn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},em={anyOf:Jg.map(e=>tR[e])},nR={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:zS,irParticipant:GS,irNode:WS,irFlowCondition:US,irSequenceFlow:qS,irMessageFlow:YS,irDataStore:KS,irDataAssociation:XS,irTextAnnotation:ZS,irAssociation:QS,irGroup:JS,bwlPlacement:eR,eventDefinition:VS,localeTexts:HS,nullableString:jS,symbolicOp:em}};function Gp(){}Gp.prototype.get=function(e){return this.$model.properties.get(this,e)},Gp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function tm(e,t){this.model=e,this.properties=t}tm.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Gp.prototype);W(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var o=e.ns.name;function r(a){n.define(this,"$type",{value:o,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),W(a,Zn(function(s,c){this.set(c,s)},this))}return r.prototype=i,r.hasType=i.$instanceOf=this.model.hasType,n.defineModel(r,t),n.defineDescriptor(r,e),r};var iR=q(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),nm=q(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 Vp(e,t){var n=nm[e];return n?n(t):t}function Wp(e){return!!iR[e]}function im(e){return!!nm[e]}function jn(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 di(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}di.prototype.build=function(){return $i(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},di.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)},di.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},di.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=jn(o[0],i),a=jn(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},di.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},di.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},di.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},di.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},di.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},di.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")},di.prototype.hasProperty=function(e){return this.propertiesByName[e]},di.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(W(e.properties,Zn(function(r){r=q({},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 jo(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,W(e,Zn(this.registerPackage,this))}jo.prototype.getPackage=function(e){return this.packageMap[e]},jo.prototype.getPackages=function(){return this.packages},jo.prototype.registerPackage=function(e){e=q({},e);var t=this.packageMap;om(t,e,"prefix"),om(t,e,"uri"),W(e.types,Zn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},jo.prototype.registerType=function(e,t){e=q({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:q({},e.meta||{})});var n=jn(e.name,t.prefix),i=n.name,o=Object.create(null);W(e.properties,Zn(function(r){var a=jn(r.name,n.prefix),s=a.name;Wp(r.type)||(r.type=jn(r.type,a.prefix).name),q(r,{ns:a,name:s}),o[s]=r},this)),q(e,{ns:n,name:i,propertiesByName:o}),W(e.extends,Zn(function(r){var a=jn(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},jo.prototype.mapTypes=function(e,t,n){var i=Wp(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=jn(c,Wp(c)?"":e.prefix);o.mapTypes(u,t,l)}function a(c){return r(c,!0)}function s(c){return r(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");W(i.superClass,n?a:s),t(i,!n),W(i.traits,a)},jo.prototype.getEffectiveDescriptor=function(e){var t=jn(e),n=new di(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},jo.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function om(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Pr(e){this.model=e}Pr.prototype.set=function(e,t,n){if(!ei(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),o=i&&i.name;oR(n)?i?delete e[o]:delete e.$attrs[Up(t)]:i?o in e?e[o]=n:rm(e,i,n):e.$attrs[Up(t)]=n},Pr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Up(t)];var i=n.name;return!e[i]&&n.isMany&&rm(e,n,[]),e[i]},Pr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=q({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Pr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Pr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Pr.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 oR(e){return typeof e>"u"}function rm(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Up(e){return e.replace(/^:/,"")}function xi(e,t={}){this.properties=new Pr(this),this.factory=new tm(this,this.properties),this.registry=new jo(e,this.properties),this.typeCache=Object.create(null),this.config=t}xi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},xi.prototype.getType=function(e){var t=this.typeCache,n=ei(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},xi.prototype.createAny=function(e,t,n){var i=jn(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){NS(this,[a],s)}},r={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(o,r),this.properties.defineModel(o,this),this.properties.define(o,"get",{enumerable:!1,writable:!0}),this.properties.define(o,"set",{enumerable:!1,writable:!0}),this.properties.define(o,"$parent",{enumerable:!1,writable:!0}),this.properties.define(o,"$instanceOf",{enumerable:!1,writable:!0}),W(n,function(a,s){yn(a)&&a.value!==void 0?o[a.name]=a.value:o[s]=a}),o},xi.prototype.getPackage=function(e){return this.registry.getPackage(e)},xi.prototype.getPackages=function(){return this.registry.getPackages()},xi.prototype.getElementDescriptor=function(e){return e.$descriptor},xi.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},xi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},xi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var am=String.fromCharCode,rR=Object.prototype.hasOwnProperty,aR=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,ls={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(ls).forEach(function(e){ls[e.toUpperCase()]=ls[e]});function sR(e,t,n,i){return i?rR.call(ls,i)?ls[i]:"&"+i+";":am(t||parseInt(n,16))}function Tr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(aR,sR):e}var sm="non-whitespace outside of root node";function Ho(e){return new Error(e)}function cR(e){return"missing namespace for prefix <"+e+">"}function Nc(e){return{get:e,enumerable:!0}}function lR(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var cm=Symbol("nameCache");function qp(e){return e+"$uri"}function uR(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[qp(i)]=n;return t}function $c(){return{line:0,column:0}}function pR(e){throw e}function lm(e){if(!this)return new lm(e);var t=e&&e.proxy,n,i,o,r,a=pR,s,c,l,u,p=$c,f=!1,d=!1,g="",h=!1,m=!1,w=null,y=!1,v,x,E,A;function D(F){F instanceof Error||(F=Ho(F)),w=F,a(F,p)}function P(F){s&&(F instanceof Error||(F=Ho(F)),s(F,p))}this.on=function(F,G){if(typeof G!="function")throw Ho("required args <name, cb>");switch(F){case"openTag":i=G;break;case"text":n=G;break;case"closeTag":o=G;break;case"error":a=G;break;case"warn":s=G;break;case"cdata":r=G;break;case"attention":u=G;break;case"question":l=G;break;case"comment":c=G;break;default:throw Ho("unsupported event: "+F)}return this},this.ns=function(F){if(typeof F>"u"&&(F={}),typeof F!="object")throw Ho("required args <nsMap={}>");var G=Object.create(null),Q;for(Q in F)G[Q]=F[Q];return m=!0,A=G,this};function T(){v=m?[]:null,x=m?uR(A):null,E=[],p=$c,y=!1,w=null,d=!1,g=""}this.parse=function(F){if(typeof F!="string")throw Ho("required args <xml=string>");if(f)throw Ho("parse during stream; call end() first");return T(),j(F),p=$c,y=!1,w},this.write=function(F){if(typeof F!="string")throw Ho("required args <xml=string>");return f||(T(),f=!0),w||(g=j(g+F,!0)||""),this},this.end=function(){return f||T(),f=!1,w||j(g),g="",p=$c,y=!1,w},this.stop=function(){y=!0};function j(F,G=!1){var Q=null,re=null,J,ye=0,ae=!1,xe=!1,Ee=0,U=0,ce,Y,Z,de,Se,Ie,N,C,S,V="",X=0,le;function Te(Pt,Ht){var gn=Pt.indexOf(":");if(gn===-1)return Pt;var Nn=x[Pt.substring(0,gn)];return Nn?Ht===Nn?Pt.substr(gn+1):Nn+Pt.substr(gn):(P(cR(Pt.substring(0,gn))),null)}function Ve(){if(le!==null)return le;var Pt,Ht,gn=m&&x.xmlns,Nn=m&&h?[]:null,Nt=X,rn=V,Vn=rn.length,Qa,pi,Li,bi,wn,Lo={},wc=new Set,Kn,gt,St;e:for(;Nt<Vn;Nt++)if(Kn=!1,gt=rn.charCodeAt(Nt),!(gt===32||gt<14&>>8)){for((gt<65||gt>122||gt>90&><97)&>!==95&>!==58&&(P("illegal first char attribute name"),Kn=!0),St=Nt+1;St<Vn;St++)if(gt=rn.charCodeAt(St),!(gt>96&><123||gt>64&><91||gt>47&><59||gt===46||gt===45||gt===95)){if(gt===32||gt<14&>>8){P("missing attribute value"),Nt=St;continue e}if(gt===61)break;P("illegal attribute name char"),Kn=!0}if(wn=rn.substring(Nt,St),wn==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),Kn=!0),gt=rn.charCodeAt(St+1),gt===34)St=rn.indexOf('"',Nt=St+2),St===-1&&(St=rn.indexOf("'",Nt),St!==-1&&(P("attribute value quote missmatch"),Kn=!0));else if(gt===39)St=rn.indexOf("'",Nt=St+2),St===-1&&(St=rn.indexOf('"',Nt),St!==-1&&(P("attribute value quote missmatch"),Kn=!0));else for(P("missing attribute value quotes"),Kn=!0,St=St+1;St<Vn&&(gt=rn.charCodeAt(St+1),!(gt===32||gt<14&>>8));St++);for(St===-1&&(P("missing closing quotes"),St=Vn,Kn=!0),Kn||(Li=rn.substring(Nt,St)),Nt=St;St+1<Vn&&(gt=rn.charCodeAt(St+1),!(gt===32||gt<14&>>8));St++)Nt===St&&(P("illegal character after attribute end"),Kn=!0);if(Nt=St+1,Kn)continue e;if(wc.has(wn)){P("attribute <"+wn+"> already defined");continue}if(wc.add(wn),!m){Lo[wn]=Li;continue}if(h){if(pi=wn==="xmlns"?"xmlns":wn.charCodeAt(0)===120&&wn.substr(0,6)==="xmlns:"?wn.substr(6):null,pi!==null){if(Pt=Tr(Li),Ht=qp(pi),bi=A[Pt],!bi){if(pi==="xmlns"||Ht in x&&x[Ht]!==Pt)do bi="ns"+ye++;while(typeof x[bi]<"u");else bi=pi;A[Pt]=bi}x[pi]!==bi&&(Qa||(x=lR(x),Qa=!0),x[pi]=bi,pi==="xmlns"&&(x[qp(bi)]=Pt,gn=bi),x[Ht]=Pt),Lo[wn]=Li;continue}Nn.push(wn,Li);continue}wn=Te(wn,gn),wn!==null&&(Lo[wn]=Li)}if(h)for(Nt=0,Vn=Nn.length;Nt<Vn;Nt++)wn=Te(Nn[Nt++],gn),Li=Nn[Nt],wn!==null&&(Lo[wn]=Li);return le=Lo}function wt(){for(var Pt=/(\r\n|\r|\n)/g,Ht=0,gn=0,Nn=0,Nt=U,rn,Vn;Ee>=Nn&&(rn=Pt.exec(F),!(!rn||(Nt=rn[0].length+rn.index,Nt>Ee)));)Ht+=1,Nn=Nt;return Ee==-1?(gn=Nt,Vn=F.substring(U)):U===0?Vn=F.substring(U,Ee):(gn=Ee-Nn,Vn=U==-1?F.substring(Ee):F.substring(Ee,U+1)),{data:Vn,line:Ht,column:gn}}for(p=wt,t&&(S=Object.create({},{name:Nc(function(){return N}),originalName:Nc(function(){return C}),attrs:Nc(Ve),ns:Nc(function(){return x})}));U!==-1;){if(F.charCodeAt(U)===60?Ee=U:Ee=F.indexOf("<",U),Ee===-1){if(G)return F.substring(U);if(E.length)return D("unexpected end of file");if(!d)return D("missing start tag");U<F.length&&F.substring(U).trim()&&P(sm);return}if(d||(d=!0),U!==Ee){if(E.length){if(n&&(n(F.substring(U,Ee),Tr,p),y))return}else if(F.substring(U,Ee).trim()&&(P(sm),y))return}if(de=F.charCodeAt(Ee+1),de===33){if(Z=F.charCodeAt(Ee+2),Z===91&&F.substr(Ee+3,6)==="CDATA["){if(U=F.indexOf("]]>",Ee),U===-1)return G?F.substring(Ee):D("unclosed cdata");if(r&&(r(F.substring(Ee+9,U),p),y))return;U+=3;continue}if(Z===45&&F.charCodeAt(Ee+3)===45){if(U=F.indexOf("-->",Ee),U===-1)return G?F.substring(Ee):D("unclosed comment");if(c&&(c(F.substring(Ee+4,U),Tr,p),y))return;U+=3;continue}}if(de===63){if(U=F.indexOf("?>",Ee),U===-1)return G?F.substring(Ee):D("unclosed question");if(l&&(l(F.substring(Ee,U+2),p),y))return;U+=2;continue}for(ce=Ee+1;;ce++){if(Se=F.charCodeAt(ce),isNaN(Se))return G?F.substring(Ee):(U=-1,D("unclosed tag"));if(Se===34)Z=F.indexOf('"',ce+1),ce=Z!==-1?Z:ce;else if(Se===39)Z=F.indexOf("'",ce+1),ce=Z!==-1?Z:ce;else if(Se===62){U=ce;break}}if(de===33){if(u&&(u(F.substring(Ee,U+1),Tr,p),y))return;U+=1;continue}if(le={},de===47){if(ae=!1,xe=!0,!E.length)return D("missing open tag");if(ce=N=E.pop(),Z=Ee+2+ce.length,F.substring(Ee+2,Z)!==ce)return D("closing tag mismatch");for(;Z<U;Z++)if(de=F.charCodeAt(Z),!(de===32||de>8&&de<14))return D("close tag")}else{if(F.charCodeAt(U-1)===47?(ce=N=F.substring(Ee+1,U-1),ae=!0,xe=!0):(ce=N=F.substring(Ee+1,U),ae=!0,xe=!1),!(de>96&&de<123||de>64&&de<91||de===95||de===58))return D("illegal first char nodeName");for(Z=1,Y=ce.length;Z<Y;Z++)if(de=ce.charCodeAt(Z),!(de>96&&de<123||de>64&&de<91||de>47&&de<59||de===45||de===95||de==46)){if(de===32||de<14&&de>8){N=ce.substring(0,Z),le=null;break}return D("invalid nodeName")}xe||E.push(N)}if(m){J=x,ae&&(xe||v.push(J),le===null&&(h=ce.indexOf("xmlns",Z)!==-1)&&(X=Z,V=ce,Ve(),h=!1)),C=N,re!==x&&(Q=x[cm],Q===void 0&&(Q=x[cm]=Object.create(null)),re=x);var Qt=Q[N];if(Qt!==void 0)N=Qt;else{if(de=N.indexOf(":"),de!==-1){if(Ie=x[N.substring(0,de)],!Ie)return D("missing namespace on <"+C+">");N=N.substr(de+1)}else Ie=x.xmlns;Ie&&(N=Ie+":"+N),Q[C]=N}}if(ae&&(X=Z,V=ce,i&&(t?i(S,Tr,xe,p):i(N,Ve,Tr,xe,p),y)))return;if(xe){if(o&&(o(t?S:N,Tr,ae,p),y))return;m&&(ae?x=J:x=v.pop())}U+=1}}}function um(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Yp={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},pm="property";function fm(e){return e.xml&&e.xml.serialize}function fR(e){const t=fm(e);return t!==pm&&(t||null)}function dR(e){return e.charAt(0).toUpperCase()+e.slice(1)}function dm(e,t){return um(t)?e.prefix+":"+dR(e.localName):e.name}function hR(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 gR(e,t,n){const i=jn(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=jn(o);var a=n.getPackage(r.prefix);return hR(r,a)}function zo(e){return new Error(e)}function go(e){return e.$descriptor}function mR(e){q(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw zo("expected element");var n=this.elementsById,i=go(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 zo("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function us(){}us.prototype.handleEnd=function(){},us.prototype.handleText=function(){},us.prototype.handleNode=function(){};function Kp(){}Kp.prototype=Object.create(us.prototype),Kp.prototype.handleNode=function(){return this};function la(){}la.prototype=Object.create(us.prototype),la.prototype.handleText=function(e){this.body=(this.body||"")+e};function ps(e,t){this.property=e,this.context=t}ps.prototype=Object.create(la.prototype),ps.prototype.handleNode=function(e){if(this.element)throw zo("expected no sub nodes");return this.element=this.createReference(e),this},ps.prototype.handleEnd=function(){this.element.id=this.body},ps.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Xp(e,t){this.element=t,this.propertyDesc=e}Xp.prototype=Object.create(la.prototype),Xp.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Vp(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Fc(){}Fc.prototype=Object.create(la.prototype),Fc.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 Un(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Un.prototype=Object.create(Fc.prototype),Un.prototype.addReference=function(e){this.context.addReference(e)},Un.prototype.handleText=function(e){var t=this.element,n=go(t),i=n.bodyProperty;if(!i)throw zo("unexpected body text <"+e+">");la.prototype.handleText.call(this,e)},Un.prototype.handleEnd=function(){var e=this.body,t=this.element,n=go(t),i=n.bodyProperty;i&&e!==void 0&&(e=Vp(i.type,e),t.set(i.name,e))},Un.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=go(n),o=this.context,r=new n({}),a=this.model,s;return W(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),W(p,function(f){o.addReference({element:r,property:u.ns.name,id:f})})):o.addReference({element:r,property:u.ns.name,id:c}):(u?c=Vp(u.type,c):l==="xmlns"?l=":"+l:(s=jn(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},Un.prototype.getPropertyForNode=function(e){var t=e.name,n=jn(t),i=this.type,o=this.model,r=go(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=fR(s);if(l){const u=e.attributes[l];if(u){const p=gR(u,e.ns,o),f=o.getType(p);return q({},s,{effectiveType:go(f).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=dm(n,c),u=o.getType(l);if(s=$t(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return q({},s,{effectiveType:go(u).name})}else if(s=$t(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw zo("unrecognized element <"+n.name+">")},Un.prototype.toString=function(){return"ElementDescriptor["+go(this.type).name+"]"},Un.prototype.valueHandler=function(e,t){return new Xp(e,t)},Un.prototype.referenceHandler=function(e){return new ps(e,this.context)},Un.prototype.handler=function(e){return e==="Element"?new ua(this.model,e,this.context):new Un(this.model,e,this.context)},Un.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,im(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?(q(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function Zp(e,t,n){Un.call(this,e,t,n)}Zp.prototype=Object.create(Un.prototype),Zp.prototype.createElement=function(e){var t=e.name,n=jn(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&dm(n,r)||t;if(!o.hasType(a))throw zo("unexpected element <"+e.originalName+">");return Un.prototype.createElement.call(this,e)};function ua(e,t,n){this.model=e,this.context=n}ua.prototype=Object.create(Fc.prototype),ua.prototype.createElement=function(e){var t=e.name,n=jn(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},ua.prototype.handleChild=function(e){var t=new ua(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},ua.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Qp(e){e instanceof xi&&(e={model:e}),q(this,{lax:!1},e)}Qp.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Un?(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 mR(q({},t,{rootHandler:i})),s=new lm({proxy:!0}),c=yR();i.context=a,c.push(i);function l(E,A,D){var P=A(),T=P.line,j=P.column,F=P.data;F.charAt(0)==="<"&&F.indexOf(" ")!==-1&&(F=F.slice(0,F.indexOf(" "))+">");var G="unparsable content "+(F?F+" ":"")+`detected
|
|
2
2
|
line: `+T+`
|
|
3
3
|
column: `+j+`
|
|
4
|
-
nested error: `+E.message;if(D)return a.addWarning({message:G,error:E}),!0;throw zo(G)}function u(E,A){return l(E,A,!0)}function p(){var E=a.elementsById,A=a.references,D,P;for(D=0;P=A[D];D++){var T=P.element,j=E[P.id],F=go(T).propertiesByName[P.property];if(j||a.addWarning({message:"unresolved reference <"+P.id+">",element:P.element,property:P.property,value:P.id}),F.isMany){var G=T.get(F.name),
|
|
5
|
-
`,
|
|
6
|
-
`),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function kR(e){e=q({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new PR,r=new TR(o,e.format);e.preamble&&r.append(gR);var a=new Ut,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(OR(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function OR(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in qp)n[i]=qp[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 $c(e,t){xi.call(this,e,t)}$c.prototype=Object.create(xi.prototype),$c.prototype.fromXML=function(e,t,n){ei(t)||(n=t,t="bpmn:Definitions");var i=new Zp(q({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},$c.prototype.toXML=function(e,t){var n=new kR(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var DR="BPMN20",LR="http://www.omg.org/spec/BPMN/20100524/MODEL",IR="bpmn",BR=[],NR=[{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"}]}],$R=[{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"}]}],FR={tagAlias:"lowerCase",typePrefix:"t"},jR={name:DR,uri:LR,prefix:IR,associations:BR,types:NR,enumerations:$R,xml:FR},HR="BPMNDI",zR="http://www.omg.org/spec/BPMN/20100524/DI",GR="bpmndi",VR=[{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"]}],WR=[{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=[],qR={name:HR,uri:zR,prefix:GR,types:VR,enumerations:WR,associations:UR},YR="DC",KR="http://www.omg.org/spec/DD/20100524/DC",XR="dc",ZR=[{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}]}],QR=[],JR={name:YR,uri:KR,prefix:XR,types:ZR,associations:QR},eC="DI",tC="http://www.omg.org/spec/DD/20100524/DI",nC="di",iC=[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"}]},{name:"Extension",properties:[{name:"values",isMany:!0,type:"Element"}]}],oC=[],rC={tagAlias:"lowerCase"},aC={name:eC,uri:tC,prefix:nC,types:iC,associations:oC,xml:rC},sC="bpmn.io colors for BPMN",cC="http://bpmn.io/schema/bpmn/biocolor/1.0",lC="bioc",uC=[{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]}],pC=[],fC=[],dC={name:sC,uri:cC,prefix:lC,types:uC,enumerations:pC,associations:fC},hC="BPMN in Color",gC="http://www.omg.org/spec/BPMN/non-normative/color/1.0",mC="color",yC=[{name:"ColoredLabel",extends:["bpmndi:BPMNLabel"],properties:[{name:"color",isAttr:!0,type:"String"}]},{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"background-color",isAttr:!0,type:"String"},{name:"border-color",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"border-color",isAttr:!0,type:"String"}]}],vC=[],bC=[],xC={name:hC,uri:gC,prefix:mC,types:yC,enumerations:vC,associations:bC};const wC={bpmn:jR,bpmndi:qR,dc:JR,di:aC,bioc:dC,color:xC};function mm(e,t){const n=q({},wC,e);return new $c(n,t)}const _C={name:"bpmn-i18n",uri:"http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",prefix:"i18n",types:[{name:"Translation",superClass:["Element"],properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"body",isBody:!0,type:"String"},{name:"target",isAttr:!0,type:"String",default:"@name"},{name:"textFormat",isAttr:"true",type:"String",default:"text/plain"}]}],enumerations:[],associations:[],xml:{tagAlias:"lowerCase",typePrefix:"t"}},Fc={[Xg]:_C,[Ap]:Wg};function ym(){return mm(Fc)}const vm=ym();async function ua(e){const{rootElement:t,warnings:n}=await vm.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function EC(e){const{xml:t}=await vm.toXML(e,{format:!0});return t}function ef(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const pa={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},SC=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function RC(e){const t=pa;return SC.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 fa(e,t){let n=0;for(const i of e)n+=t*RC(i);return n}function bm(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&CC(e),MC(e),AC(e),PC(e)}function CC(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(o){var a;const r=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:fa(o,r),fontBoundingBoxAscent:r*pa.ascentEm,fontBoundingBoxDescent:r*pa.descentEm,actualBoundingBoxAscent:r*pa.ascentEm,actualBoundingBoxDescent:r*pa.descentEm}}};t.getContext=()=>n}function MC(e){if(e.SVGMatrix)return;class t{constructor(){$n(this,"a",1);$n(this,"b",0);$n(this,"c",0);$n(this,"d",1);$n(this,"e",0);$n(this,"f",0)}static of(i,o,r,a,s,c){return Object.assign(new t,{a:i,b:o,c:r,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,o){return this.multiply(t.of(1,0,0,1,i,o))}scale(i,o=i){return this.multiply(t.of(i,0,0,o,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function AC(e){var r;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,l=0){const u=s*Math.PI/180,p=Math.cos(u),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 PC(e){const t=e.SVGElement.prototype;if(!t.getCTM){const n=()=>new e.SVGMatrix;t.getCTM=n,t.getScreenCTM=n}t.getBBox||(t.getBBox=function(){const n=String(this.textContent??"");return{x:0,y:0,width:fa(n,12),height:14}})}const jc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),TC=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),kC=1,Hc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),OC=2;function pt(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"label-over-shape":return`ls|${e.edge}|${e.shape}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"edge-endpoint-detached":return`d|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"edge-along-group-boundary":return`eg|${e.edge}|${e.group}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const xm=20,zc=5,wm=3,DC=8,da=15,tf=50,_m=12,LC=_m*1.2;function nf(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>fa(r,_m))),o=n.length*LC;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-o/2,width:i,height:o}}const Em=1;function sn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],o=e.waypoints[n+1];Math.abs(i.y-o.y)<.5&&Math.abs(i.x-o.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,o.x),hi:Math.max(i.x,o.x),dir:o.x>i.x?1:-1}):Math.abs(i.x-o.x)<.5&&Math.abs(i.y-o.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,o.y),hi:Math.max(i.y,o.y),dir:o.y>i.y?1:-1})}return t}function Pr(e,t){let n=null;const i=e.type!==t.type,r=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of sn(e))for(const s of sn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Em)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>=xm&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function of(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Sm(e,t){const n=Pr(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function IC(e,t){let n=0;for(const i of t)i.id!==e.id&&Sm(e,i)&&n++;return n}function hi(e,t){let n=0;for(const i of t)i.id!==e.id&&Pr(e,i)&&n++;return n}const Rm=15,Cm=20;function BC(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Cm||t.at>n[1]+Cm)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 rf=20;function Gc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Em)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<xm||n.push([o-rf,r+rf])}return n}function Vc(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of sn(e)){const r=BC(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Gc(o,sn(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const NC=10,$C=1,FC=(e,t,n)=>t.x>=e.x-n&&t.y>=e.y-n&&t.x+t.width<=e.x+e.width+n&&t.y+t.height<=e.y+e.height+n;function jC(e,t,n,i){const o=n.x+i,r=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=o||s<=r)return!1;const c=t.x-e.x,l=t.y-e.y;let u=0,p=1;const 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 af(e,t,n){return e.x+n<t.x+t.width-n&&t.x+n<e.x+e.width-n&&e.y+n<t.y+t.height-n&&t.y+n<e.y+e.height-n}const HC=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ha=1;function Fi(e,t){const n=e.x+ha,i=e.x+e.width-ha,o=e.y+ha,r=e.y+e.height-ha;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 ga(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 Mm(e,t){const n=e.label;if(!n)return null;if(sn(e).some(i=>Fi(n,i)))return e.id;for(const i of[...t.edges].filter(o=>o.id!==e.id).sort((o,r)=>o.id.localeCompare(r.id)))if(sn(i).some(o=>Fi(n,o)))return i.id;for(const i of t.shapes.filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(ga(i).some(o=>Fi(n,o)))return i.id;return null}function Vt(e,t){const n=new Set(e.endpoints),i=[];for(const o of t)if(!n.has(o.id)){for(let r=0;r+1<e.waypoints.length;r++)if(jC(e.waypoints[r],e.waypoints[r+1],o,OC)){i.push(o);break}}return i}const us=(e,t,n)=>{const i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,a=r===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*o))},zC=(e,t,n,i)=>Pm(e,t,n,i)?0:Math.min(us(e,n,i),us(t,n,i),us(n,e,t),us(i,e,t)),Am=(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 Tr(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,us({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(Am(e,s)||Am(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,zC(e,t,s[l],s[(l+1)%s.length]));return c}function Pm(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 sf=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Tm(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(Pm(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function ps(e,t){let n=0;for(const i of t)i.id===e.id||sf(e,i)||Tm(e,i)&&n++;return n}function gi(e,t){let n=0;for(const i of t)i.id===e.id||sf(e,i)||ps(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function km(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++)ps(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function mo(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(ps(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 ji(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(sf(n[i],n[o])&&Tm(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 Om(e){const t=mo(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let o=0,r=0;for(const[a,s]of t){const c=i.get(a),l=i.get(s);if(!c||!l)continue;const u=n(c.type),p=n(l.type);u==="solid"&&p==="solid"?o++:u==="dashed"&&p==="dashed"&&r++}return{pairs:t,solidPairs:o,dashedPairs:r,mixedPairs:t.length-o-r,crossPoolMessages:GC(e)}}function GC(e){const t=e.shapes.filter(o=>o.type==="bpmn:Participant");if(t.length<3)return 0;const n=o=>{const r=e.shapes.find(a=>a.id===o);if(r)return t.find(a=>r.x>=a.x&&r.y>=a.y&&r.x+r.width<=a.x+a.width&&r.y+r.height<=a.y+a.height)};let i=0;for(const o of e.edges){if(o.type!=="bpmn:MessageFlow"||o.endpoints.length<2)continue;const r=n(o.endpoints[0]),a=n(o.endpoints[1]);if(!r||!a||r.id===a.id)continue;const s=Math.min(r.y,a.y),c=Math.max(r.y+r.height,a.y+a.height);t.some(l=>l.id!==r.id&&l.id!==a.id&&l.y>s&&l.y+l.height<c)&&i++}return i}function Dm(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!Hc.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 Lm(e){var n;const t=(n=Wt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const o=Wt(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 Im=e=>e?{members:e}:{},Hn=e=>e.shapes.filter(t=>!t.container);function VC(e,t,n){if(e.type==="bpmn:TextAnnotation")for(const i of t.edges){if(!/Association$/.test(i.type)||!i.endpoints.includes(e.id))continue;const o=i.endpoints.find(a=>a!==e.id),r=o?n.get(o):void 0;if(r&&r.type!=="bpmn:Group"){if(r.container)return r.id;if(r.parent)return r.parent}}}function WC(e,t,n){if(e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height)return!0;const o=e.x+e.width/2,r=e.y+e.height/2;return n.shapes.some(a=>a.container&&a.id!==t.id&&a.id!==e.id&&a.type!=="bpmn:Group"&&o>=a.x&&o<=a.x+a.width&&r>=a.y&&r<=a.y+a.height)}function Bm(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((o,r)=>o.id.localeCompare(r.id)))if(sn(i).some(o=>Fi(n,o)))return i.id;for(const i of[...t.shapes].filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(ga(i).some(o=>Fi(n,o)))return i.id;return null}function Go(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 Nm=3;function $m(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 fs(e,t){const n=[];for(const i of t.shapes){if(i.container||Hc.has(i.type))continue;const o=$m(e,i);o>=Nm&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function cf(e){const t=[],n=e.filter(o=>o.type==="bpmn:Participant"),i=(o,r)=>o.x<=r.x&&o.y<=r.y&&o.x+o.width>=r.x+r.width&&o.y+o.height>=r.y+r.height;for(let o=0;o<n.length;o++)for(let r=o+1;r<n.length;r++){const a=n[o],s=n[r];a.x+a.width<=s.x||s.x+s.width<=a.x||a.y+a.height<=s.y||s.y+s.height<=a.y||t.push({pools:[a.id,s.id],contained:i(a,s)||i(s,a)})}return t}function ft(e,t={}){const n=[],i=e.shapes.filter(y=>!y.container);for(const y of e.edges)for(const v of Vt(y,i))n.push({kind:"edge-crosses-shape",edge:y.id,shape:v.id});const o=e.shapes.filter(y=>y.container&&TC.has(y.type));if(o.length){const y=(v,x)=>{const E=e.shapes.find(A=>A.id===x);return!!E&&E.x>=v.x&&E.y>=v.y&&E.x+E.width<=v.x+v.width&&E.y+E.height<=v.y+v.height};for(const v of e.edges)for(const x of Vt(v,o))v.endpoints.includes(x.id)||v.endpoints.some(E=>y(x,E))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:x.id})}for(const y of e.edges){if(y.waypoints.length<2)continue;const v=[[y.source,y.waypoints[0]],[y.target,y.waypoints[y.waypoints.length-1]]];for(const[x,E]of v){if(!x)continue;const A=e.shapes.find(j=>j.id===x);if(!A||A.container)continue;const D=Math.max(A.x-E.x,E.x-(A.x+A.width),0),P=Math.max(A.y-E.y,E.y-(A.y+A.height),0),T=Math.hypot(D,P);T>NC&&n.push({kind:"edge-endpoint-detached",edge:y.id,shape:x,distance:Math.round(T)})}}for(const y of cf(e.shapes))n.push({kind:"pool-overlap",...y});const r=i.filter(y=>!y.attached);for(let y=0;y<r.length;y++)for(let v=y+1;v<r.length;v++){const x=r[y],E=r[v];if(!af(x,E,kC))continue;const A=x.id<E.id?[x.id,E.id]:[E.id,x.id];n.push({kind:"shape-overlap",shapes:A,identical:HC(x,E)})}const a=e.shapes.filter(y=>y.type==="bpmn:Group"&&Array.isArray(y.members)&&y.members.length>0);for(let y=0;y<a.length;y++)for(let v=y+1;v<a.length;v++){const x=a[y],E=a[v],A=Math.min(x.x+x.width,E.x+E.width)-Math.max(x.x,E.x),D=Math.min(x.y+x.height,E.y+E.height)-Math.max(x.y,E.y);if(A<=zc||D<=zc)continue;const P=x.id<E.id?[x.id,E.id]:[E.id,x.id],T=new Set(E.members);if(x.members.some(F=>T.has(F))){const F=Dm(e,a,{x:Math.max(x.x,E.x),y:Math.max(x.y,E.y),right:Math.min(x.x+x.width,E.x+E.width),bottom:Math.min(x.y+x.height,E.y+E.height)});F.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:P,shapes:F});continue}const j=x.x<=E.x&&x.y<=E.y&&x.x+x.width>=E.x+E.width&&x.y+x.height>=E.y+E.height?x.id:E.x<=x.x&&E.y<=x.y&&E.x+E.width>=x.x+x.width&&E.y+E.height>=x.y+x.height?E.id:void 0;n.push({kind:"group-overlap-unintended",groups:P,...j?{container:j}:{}})}const s=new Set(a.flatMap(y=>[...y.members])),c=y=>e.shapes.filter(v=>!v.container&&!Hc.has(v.type)&&v.x>=y.x&&v.y>=y.y&&v.x+v.width<=y.x+y.width&&v.y+v.height<=y.y+y.height);for(const y of a){const v=c(y);if(!v.length)continue;const x=new Set(y.members),E=v.filter(A=>!x.has(A.id));E.some(A=>s.has(A.id))&&(E.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:y.id,shapes:E.map(A=>A.id).sort()}))}for(const y of a){const v=new Set(c(y).map(T=>T.id)),x=new Set(y.members),E=new Set([...v].filter(T=>!x.has(T)&&s.has(T)));if(!E.size)continue;let A=!1,D=!1,P=!1;for(const T of e.edges){if(T.type!=="bpmn:SequenceFlow"||!T.source||!T.target)continue;const j=E.has(T.source),F=E.has(T.target);!j&&F&&!v.has(T.source)?A=!0:j&&!F&&!v.has(T.target)?D=!0:j&&F&&(P=!0)}A&&D&&P&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:y.id,shapes:[...E].sort()})}const l=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<l.length;y++)for(let v=y+1;v<l.length;v++)for(let x=v+1;x<l.length;x++){const E=[l[y],l[v],l[x]],A={x:Math.max(...E.map(T=>T.x)),y:Math.max(...E.map(T=>T.y)),right:Math.min(...E.map(T=>T.x+T.width)),bottom:Math.min(...E.map(T=>T.y+T.height))};if(A.right-A.x<=zc||A.bottom-A.y<=zc)continue;const D=Dm(e,[],A);if(!D.length)continue;const P=E.map(T=>T.id).sort();n.push({kind:"group-stack-unreadable",groups:P,shapes:D})}for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||Hc.has(v.type)||v.width<=0||v.height<=0)continue;const x=[["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[E,A,D,P,T]of x){const j=D==="h"?v.x:v.y,F=D==="h"?v.x+v.width:v.y+v.height;if(!(j<T&&P<F))continue;const G=D==="h"?v.y:v.x,Z=D==="h"?v.y+v.height:v.x+v.width;if(!(G<A&&A<Z))continue;const re=Math.min(A-G,Z-A);re<DC||n.push({kind:"group-cuts-shape",group:y.id,shape:v.id,side:E,depth:re})}}const u=t.includeObservationOnly?e.shapes.filter(y=>y.type==="bpmn:Group"&&y.width>0&&y.height>0):[];if(u.length){const y=new Map(e.shapes.filter(v=>!v.container).map(v=>[v.id,{x:v.x+v.width/2,y:v.y+v.height/2}]));for(const v of e.edges){if(v.type!=="bpmn:SequenceFlow"&&v.type!=="bpmn:MessageFlow")continue;const x=sn(v);if(x.length)for(const E of u){const A=E.x+E.width,D=E.y+E.height,P=v.endpoints.some(j=>{const F=y.get(j);return!!F&&E.x<F.x&&F.x<A&&E.y<F.y&&F.y<D});let T=null;for(const j of x){const[F,G,Z]=j.axis==="v"?[E.y,D,[["left",E.x],["right",A]]]:[E.x,A,[["top",E.y],["bottom",D]]],re=Math.min(j.hi,G)-Math.max(j.lo,F);if(re<tf)continue;const J=j.axis==="v"?E.x<j.at&&j.at<A:E.y<j.at&&j.at<D;if(!(J&&P))for(const[ye,ae]of Z){const we=Math.abs(j.at-ae);we<=da&&(!T||we<T.distance)&&(T={side:ye,inside:J,distance:we,length:re})}}T&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:E.id,side:T.side,inside:T.inside,distance:Math.round(T.distance),length:Math.round(T.length)})}}}const p=e.shapes.filter(y=>y.container&&y.type!=="bpmn:Group"&&y.type!=="bpmn:Lane");for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of p){const x=y.x<v.x+v.width&&v.x<y.x+y.width,E=y.y<v.y+v.height&&v.y<y.y+y.height,A=[["top",y.y,v.y,x],["bottom",y.y+y.height,v.y+v.height,x],["left",y.x,v.x,E],["right",y.x+y.width,v.x+v.width,E]];for(const[D,P,T,j]of A)j&&Math.abs(P-T)<=wm&&n.push({kind:"group-on-container-boundary",group:y.id,container:v.id,side:D})}const f=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<f.length;y++)for(let v=y+1;v<f.length;v++){const x=f[y],E=f[v],A=x.x<E.x+E.width&&E.x<x.x+x.width,D=x.y<E.y+E.height&&E.y<x.y+x.height,P=[["x",x.x+x.width,E.x,D],["x",E.x+E.width,x.x,D],["y",x.y+x.height,E.y,A],["y",E.y+E.height,x.y,A]];for(const[T,j,F,G]of P)if(G&&Math.abs(j-F)<=wm){n.push({kind:"group-on-group-boundary",groups:x.id<E.id?[x.id,E.id]:[E.id,x.id],axis:T});break}}for(let y=0;y<e.edges.length;y++)for(let v=y+1;v<e.edges.length;v++){const x=e.edges[y],E=e.edges[v],A=Pr(x,E);if(!A)continue;const D=x.id<E.id?[x.id,E.id]:[E.id,x.id];n.push({kind:A.kind==="opposite"?"edge-overlap-opposite":A.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:D,axis:A.axis,length:Math.round(A.length)})}for(const y of e.edges){if(!y.label)continue;const v=Vc(y,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:y.id,other:v.other,axis:v.axis})}for(const y of e.edges){if(!y.label)continue;const v=Mm(y,e);v&&n.push({kind:"label-over-line",edge:y.id,line:v})}if(t.includeObservationOnly){for(const y of e.edges)if(!(!y.label||y.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:x}of fs(y.label,e))n.push({kind:"label-over-shape",edge:y.id,shape:v,depth:Math.round(x)})}const d=new Set(i.map(y=>y.id)),g=e.shapes.filter(y=>y.type==="bpmn:Participant"&&y.label);for(const y of[...i,...g.filter(v=>!d.has(v.id))]){if(!y.label)continue;const v=Bm(y,e);v&&n.push({kind:"label-over-line",edge:y.id,line:v})}const h=new Set(e.shapes.filter(y=>y.type==="bpmn:TextAnnotation").map(y=>y.id));for(const y of g)for(const{owner:v,rect:x}of Go(e))v===y.id||h.has(v)||af(y.label,x,ha)&&n.push({kind:"pool-name-over-label",pool:y.id,label:v});const m=Go(e);for(const y of i)if(y.type==="bpmn:TextAnnotation")for(const{owner:v,rect:x}of m)v!==y.id&&af(y,x,ha)&&n.push({kind:"annotation-over-label",annotation:y.id,label:v});const w=new Map(e.shapes.map(y=>[y.id,y]));for(const y of i){const v=y.parent??VC(y,e,w);if(!v)continue;const x=w.get(v);!x||!x.container||FC(x,y,$C)||y.type==="bpmn:TextAnnotation"&&!WC(y,x,e)||n.push({kind:"shape-outside-container",shape:y.id,container:x.id})}return n.sort((y,v)=>pt(y).localeCompare(pt(v)))}const Wt=e=>typeof e=="object"&&e!==null?e:void 0,nn=e=>typeof e=="number"?e:0,yo=e=>{const t=Wt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function UC(e){const t=Wt(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=yo(r);a&&n.push(a)}}return n}function qC(e){const t=Wt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:yo(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:yo(t.targetRef);return n&&i?{source:n,target:i}:{}}function YC(e,t){const n=Wt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=yo(n);return o?t.get(o):void 0}if(jc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return yo(n)}function Fm(e){var a,s,c,l,u;const t=[],n=[],i=((a=Wt(e))==null?void 0:a.diagrams)??[],o=new Map,r=new Set;for(const p of((s=Wt(e))==null?void 0:s.rootElements)??[]){const f=Wt(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=Wt(d),h=yo(g),m=yo(g==null?void 0:g.processRef);h&&m?o.set(m,h):h&&r.add(h)}}for(const p of i){const f=Wt((c=Wt(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=Wt(g);if(!h)continue;const m=Wt(h.bpmnElement),w=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!w)continue;const y=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",v=Wt(h.bounds);if(v){const E=h.isExpanded===!1&&y!=="bpmn:Participant",A=Wt((l=Wt(h.label))==null?void 0:l.bounds),D={id:w,type:y,x:nn(v.x),y:nn(v.y),width:nn(v.width),height:nn(v.height),container:jc.has(y)&&!E,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:YC(m,o)}:{},...A?{label:{x:nn(A.x),y:nn(A.y),width:nn(A.width),height:nn(A.height)}}:{},...y==="bpmn:Group"?Im(Lm(m)):{}},P=h.isHorizontal!==!1,T=typeof(m==null?void 0:m.name)=="string"?m.name:"";r.has(w)&&P&&T&&(D.label=nf(D,T)),t.push(D);continue}const x=h.waypoint;if(Array.isArray(x)){const E=Wt((u=Wt(h.label))==null?void 0:u.bounds);n.push({id:w,type:y,waypoints:x.map(A=>{var D,P;return{x:nn((D=Wt(A))==null?void 0:D.x),y:nn((P=Wt(A))==null?void 0:P.y)}}),endpoints:UC(m),...qC(m),...E?{label:{x:nn(E.x),y:nn(E.y),width:nn(E.width),height:nn(E.height)}}:{}})}}}return{shapes:t,edges:n}}function jm(e){return ft(Fm(e),{includeObservationOnly:!0})}async function KC(e){const{definitions:t,warnings:n}=await ua(e);return{findings:jm(t),warnings:n}}function ze(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=Wt(r.label),m=yo(r.source),w=yo(r.target);n.push({id:r.id,type:a,waypoints:s.map(y=>({x:nn(y.x),y:nn(y.y)})),endpoints:[m,w].filter(y=>!!y),...m&&w?{source:m,target:w}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:nn(h.y),width:nn(h.width),height:nn(h.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=Wt(r.businessObject),l=Wt(r.label);let u=Wt(r.parent);for(;u&&u.type==="bpmn:Lane";)u=Wt(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&jc.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:nn(r.width),height:nn(r.height),container:jc.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:nn(l.y),width:nn(l.width),height:nn(l.height)}}:{},...a==="bpmn:Group"?Im(Lm(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=Wt(r.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=nf(d,g)),t.push(d)}return{shapes:t,edges:n}}const XC={"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 ZC(e,t){const n=XC[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Hm(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function zm(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 ZC(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Hm(i)===n).sort((i,o)=>i.y-o.y).map(i=>i.id),laneDeclarationOrderOf:n=>{var s;const i=e.get(n),o=(s=i==null?void 0:i.businessObject)==null?void 0:s.processRef,r=[],a=c=>{for(const l of c??[])for(const u of l.lanes??[])r.push(u.id),a(u.childLaneSet?[u.childLaneSet]:void 0)};return a(o==null?void 0:o.laneSets),r},participantOf:n=>{const i=e.get(n);return i?Hm(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"?[]:Fo(i.businessObject).map(o=>o.locale)}}}const lf=20,QC=4,Ue=(e,t)=>Math.abs(e-t)<.5;function Wc(e,t,n,i=lf){if(Ue(e.y,t.y)&&!Ue(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(Ue(e.x,t.x)&&!Ue(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 Gm(e,t,n,i=lf){if(n.length<2)return null;if(Ue(e.y,t.y)&&!Ue(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(Ue(e.x,t.x)&&!Ue(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 Vm(e,t,n=lf){if(e.length!==4)return null;const[i,o,r,a]=e;if(Ue(i.y,o.y)&&Ue(o.x,r.x)&&Ue(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(Ue(i.x,o.x)&&Ue(o.y,r.y)&&Ue(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 Uc(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 qc=30,JC=[0,-25,25,-40,40];function eM(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+qc:s-qc,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return JC.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}]).filter(f=>Vt({...e,endpoints:[],waypoints:f},[n]).length===0)}const uf=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],ma=(e,t,n)=>Vt({...e,waypoints:t},n).length;function Yc(e,t,n,i){let o=[...e.waypoints],r=ma(e,o,t);if(r===0)return null;let a=!1;for(const p of Uc(e,t))if(ma(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(sn),c=p=>sn({...e,waypoints:p}).some(f=>Gc(f,s).length>0),l=eM(e,t).filter(p=>ma(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&&Ue(p.y+p.height/2,f.y+f.height/2)){const d=[o[0],o[o.length-1]];if(Ue(d[0].y,d[1].y)&&!Ue(d[0].x,d[1].x)){const g=t.filter(y=>!e.endpoints.includes(y.id)&&Vt({...e,waypoints:d},[y]).length>0),h=g.length>=2?Gm(d[0],d[1],g):null,w=(h?h.map(y=>[d[0],...y,d[1]]):g.length===1?(Wc(d[0],d[1],g[0])??[]).map(y=>[d[0],...y,d[1]]):g.length===0?[d]:[]).filter(y=>ma(e,y,t)===0&&y.length<=o.length).sort((y,v)=>Number(u(v))-Number(u(y)));if(w.length)return w.find(y=>!c(y))??w[0]}}}for(let p=0;p+1<o.length;p++){const f=o[p],d=o[p+1],g=t.filter(w=>!e.endpoints.includes(w.id)&&Vt({...e,waypoints:[f,d]},[w]).length>0);if(g.length<2)continue;const h=Gm(f,d,g);if(!h)continue;const m=h.map(w=>uf(o,p,w)).filter(w=>ma(e,w,t)===0).sort((w,y)=>Number(u(y))-Number(u(w)));if(m.length)return m.find(w=>!c(w))??m[0]}for(let p=0;p<QC&&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)||Vt({...e,waypoints:[g,h]},[m]).length===0)continue;const w=Wc(g,h,m),y=w?w.map(x=>uf(o,d,x)):Vm(o,m)??[];if(!y.length)continue;const v=[...y].sort((x,E)=>Number(u(E))-Number(u(x)));for(const x of v){const E=ma(e,x,t);if(E<r){o=x,r=E,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&r===0?o:null}function pf(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ze(i),a=Hn(r),s=new Set,c=ft(r).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(pt(u)));if(!c.length)return s;const l=new Map;for(const u of c){if(u.kind!=="edge-crosses-shape"||l.has(u.edge))continue;const p=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=Vt(p,a);if(!n&&h.length&&h.every(x=>x.type==="bpmn:TextAnnotation")){s.add(u);continue}const m=Yc(p,a,g,r.edges);if(!m){h.some(x=>x.type==="bpmn:TextAnnotation")&&s.add(u);continue}const w=r.edges.filter(x=>x.id!==u),y=hi(p,w);hi({...p,waypoints:m},w)>y||o.updateWaypoints(f,m)}return s}const tM=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 Kc(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 ff=(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),df=(e,t)=>ps(e,[t])>0;function Wm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ze(i),a=Hn(r);let s=r;const c=new Set(ft(r).map(pt));for(const[l,u]of mo(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(D=>D.id===p),g=s.edges.find(D=>D.id===f);if(!d||!g)continue;const h=i.get(p);if(!h)continue;const m=Kc(h),w=tM(g),y=[...Uc(d,a)??[]],v=Yc(d,[...a,...w],m,r.edges);v&&y.push(v);for(let D=0;D+1<d.waypoints.length;D++)for(const P of w)for(const T of Wc(d.waypoints[D],d.waypoints[D+1],P)??[])y.push(uf(d.waypoints,D,T));const x=s.edges.filter(D=>D.id!==p),E=D=>({...s,edges:s.edges.map(P=>P.id===p?{...P,waypoints:D}:P)}),A=y.find(D=>{const P={...d,waypoints:D};return df(P,g)||!ff(D,m)||x.some(T=>T.id!==f&&!df(d,T)&&df(P,T))?!1:ft(E(D)).every(T=>c.has(pt(T)))});if(A){o.updateWaypoints(h,A),s=E(A);break}}}const nM=["top","bottom","left","right"],Um={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},ds=20,iM=20;function oM(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&&Ue(e.y,t.y)&&o.push("top"),n&&Ue(e.y,t.y+t.height)&&o.push("bottom"),i&&Ue(e.x,t.x)&&o.push("left"),i&&Ue(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const rM=(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 qm(e,t,n,i){const o=Um[t],r=Um[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(Ue(e[f],n[f]))return d===-g&&d*(n[p]-e[p])>=ds?[e,n]:null;let h;if(d===-g){const w=e[p]+d*ds,y=n[p]-d*ds;if(d*(y-w)<0)return null;h=Math.round((e[p]+n[p])/2)}else h=d>0?Math.max(e[p],n[p])+qc:Math.min(e[p],n[p])-qc;const m=(w,y)=>a?{x:y,y:w}:{x:w,y};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>=ds&&u>=ds?[e,c,n]:null}function aM(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?oM(a,r):null;if(!s)return[];const c=[];for(const l of nM){const u=rM(t,l),p=o?qm(u,l,a,s):qm(a,s,u,l);p&&c.push(p)}return c}const Ym=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 sM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ze(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=new Set(ft(r).map(pt));let c=r;for(const[l,u]of ji(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(T=>T.id===l),f=c.edges.find(T=>T.id===u);if(!p||!f||p.type!=="bpmn:SequenceFlow"||f.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!ji({edges:[p,f]}).length)continue;const d=p.endpoints.find(T=>f.endpoints.includes(T)),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 w=T=>n.has(T.id)?[T.waypoints]:[T.waypoints,...aM(T,g,a)],y=T=>T.length-2,v=w(p).flatMap(T=>w(f).map(j=>({pa:T,pb:j}))).filter(({pa:T,pb:j})=>T!==p.waypoints||j!==f.waypoints).map(T=>({...T,cost:Ym(T.pa)+Ym(T.pb)+iM*(y(T.pa)+y(T.pb))})).sort((T,j)=>T.cost-j.cost),x=Kc(h),E=Kc(m),A=ji(c).length,D=new Set(mo(c).map(([T,j])=>`${T}|${j}`)),P=v.find(({pa:T,pb:j})=>{const F={...p,waypoints:T},G={...f,waypoints:j};if(ji({edges:[F,G]}).length||Pr(F,G)||!ff(T,x)||!ff(j,E))return!1;const Z={...c,edges:c.edges.map(re=>re.id===l?F:re.id===u?G:re)};return ji(Z).length>=A||mo(Z).some(([re,J])=>!D.has(`${re}|${J}`))?!1:ft(Z).every(re=>s.has(pt(re)))});P&&(P.pa!==p.waypoints&&o.updateWaypoints(h,P.pa),P.pb!==f.waypoints&&o.updateWaypoints(m,P.pb),c={...c,edges:c.edges.map(T=>T.id===l?{...p,waypoints:P.pa}:T.id===u?{...f,waypoints:P.pb}:T)})}}const cM=40,lM=20;function uM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>{const u=ze(i),p=ji(u);return{keys:new Set(ft(u).map(pt)),crossings:mo(u).length,shared:p.length,mine:p.filter(([f,d])=>f===l||d===l).length}},a=(l,u)=>{const p=ze(i),f=p.edges.find(d=>d.id===l);return f?new Set(Vt({...f,waypoints:u},Hn(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,w=m?d.y+d.height:d.y,y=m?f.y:f.y+f.height,v=Math.round((w+y)/2),x=j=>f===u?[...j].reverse():j,E=(l.waypoints??[]).map(j=>({x:j.x,y:j.y})),A=r(l.id),D=a(l.id,E)??new Set,P=h?f.x+f.width:f.x,T=f.x+f.width/2;for(let j=Math.min(cM,f.width/4);h?P-j>T:P+j<T;j+=lM){const F=Math.round(h?P-j:P+j),G=x([{x:g,y:w},{x:g,y:v},{x:F,y:v},{x:F,y}]),Z=a(l.id,G);if(!Z||[...Z].some(J=>!D.has(J)))continue;o.updateWaypoints(l,G);const re=r(l.id);if(re.crossings<=A.crossings&&re.shared<=A.shared&&re.mine<=A.mine&&[...re.keys].every(J=>A.keys.has(J)))break;o.updateWaypoints(l,E)}}}const pM=10;function Km(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 Xm(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(G=>G.type==="bpmn:Participant"&&G.container),i=t.shapes.find(G=>G.id===e.endpoints[0]),o=t.shapes.find(G=>G.id===e.endpoints[1]);if(!i||!o)return null;const r=Km(i,n),a=Km(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(G=>G.id!==r.id&&G.id!==a.id&&G.y>=c.y+c.height&&G.y+G.height<=l.y).sort((G,Z)=>G.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,w=e.waypoints[0],y=e.waypoints[e.waypoints.length-1],v=Hn(t),x=t.edges.filter(G=>G.id!==e.id),E=gi(e,x),A=Vt(e,v).length;if(E===0&&A===0||A===0&&e.waypoints.length===2)return null;const D=Math.min(...u.map(G=>G.x)),P=Math.max(...u.map(G=>G.x+G.width)),T=(w.x+y.x)/2,j=G=>G.filter((Z,re)=>re===0||!(Ue(Z.x,G[re-1].x)&&Ue(Z.y,G[re-1].y)));let F;for(let G=D;G<=P;G+=pM){const Z=j([w,{x:w.x,y:h},{x:G,y:h},{x:G,y:m},{x:y.x,y:m},y]),re={...e,waypoints:Z};if(Vt(re,v).length>0)continue;const J=gi(re,x),ye=Math.abs(G-T);(!F||J<F.cross||J===F.cross&&ye<F.detour)&&(F={pts:Z,cross:J,detour:ye})}return F&&(A>0?F.cross<=E:F.cross<E)?F.pts:null}const fM=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function dM(e,t,n){var l,u;const{elementRegistry:i}=e,o=e.modeling,r=new Map(t.shapes.map(p=>[p.id,p])),a=ze(i),s=new Map(a.shapes.map(p=>[p.id,p])),c=Hn(a);for(const p of t.edges){if(!fM.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||!Ue(d.width,h.width)||!Ue(d.height,h.height)||!Ue(g.width,m.width)||!Ue(g.height,m.height))continue;const w=h.x-d.x,y=h.y-d.y;if(Ue(w,0)&&Ue(y,0)||!Ue(m.x-g.x,w)||!Ue(m.y-g.y,y))continue;const v=p.waypoints.map(A=>({x:A.x+w,y:A.y+y})),x=f.waypoints.map(A=>({x:A.x,y:A.y}));x.length===v.length&&x.every((A,D)=>Ue(A.x,v[D].x)&&Ue(A.y,v[D].y))||x.length===2&&(Ue(x[0].x,x[1].x)||Ue(x[0].y,x[1].y))&&Vt({...p,waypoints:x},c).length===0||Vt({...p,waypoints:v},c).length>0||o.updateWaypoints(f,v)}}function Zm(e,t){const{elementRegistry:n}=e,i=e.modeling,o=ze(n);for(const r of o.edges){if(r.type!=="bpmn:MessageFlow"||t.has(r.id))continue;const a=ze(n),s=a.edges.find(u=>u.id===r.id);if(!s)continue;const c=Xm(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const hf=20,Qm=10,Hi=10,gf=40,hM=6,gM=40,Jm=50;function mM(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<=hM})}function mf(e,t,n){let i=0;for(let o=1;o<e.length;o++){const r=e[o-1],a=e[o];if(Ue(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 yM(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 yf(e,t,n){if(t>n)return[];const i=[Math.min(Math.max(e,t),n)];for(let o=Qm;o<=n-t;o+=Qm)e+o<=n&&i.push(e+o),e-o>=t&&i.push(e-o);return i}function vM(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=(J,ye)=>ye>J.x+Hi&&ye<J.x+J.width-Hi,g=(J,ye)=>J.width<=2*gf?J.x+J.width/2:Math.min(Math.max(ye,J.x+gf),J.x+J.width-gf),h=Math.max(e.x,t.x)+Hi,m=Math.min(e.x+e.width,t.x+t.width)-Hi;if(h<=m){const J=!a&&d(t,p)?p:!s&&d(e,f)?f:Math.round((h+m)/2);r.push([{x:J,y:l},{x:J,y:u}])}const w=s?g(t,p):f,y=a?g(e,f):p;if(!a&&!d(e,w)){const J=w<e.x?e.x:e.x+e.width;for(const ye of yf(e.y+e.height/2,e.y+Hi,e.y+e.height-Hi))r.push([{x:J,y:ye},{x:w,y:ye},{x:w,y:u}])}if(!s&&!d(t,y)){const J=y<t.x?t.x:t.x+t.width;for(const ye of yf(t.y+t.height/2,t.y+Hi,t.y+t.height-Hi))r.push([{x:y,y:l},{x:y,y:ye},{x:J,y:ye}])}const v=(J,ye)=>{if(Math.abs(ye-J)<2*Hi)return[];const ae=Math.min(J,ye)+Hi,we=Math.max(J,ye)-Hi;return yf(Math.round((J+ye)/2),ae,we)};if(!a&&n)for(const J of v(l,c?n.y+n.height:n.y))r.push([{x:p,y:l},{x:p,y:J},{x:w,y:J},{x:w,y:u}]);if(!s&&i)for(const J of v(u,c?i.y:i.y+i.height))r.push([{x:y,y:l},{x:y,y:J},{x:f,y:J},{x:f,y:u}]);const x=Math.min(y,w),E=Math.max(y,w),A=[];for(const[J,ye]of o.filter(ae=>ae.x<E&&ae.x+ae.width>x).map(ae=>[ae.y,ae.y+ae.height]).sort((ae,we)=>ae[0]-we[0])){const ae=A[A.length-1];ae&&J<=ae[1]?ae[1]=Math.max(ae[1],ye):A.push([J,ye])}const D=[];for(let J=1;J<A.length;J++)A[J][0]-A[J-1][1]>=gM&&D.push(Math.round((A[J-1][1]+A[J][0])/2));A.length&&D.push(A[0][0]-Jm,A[A.length-1][1]+Jm);const P=(J,ye)=>ye<J.y?J.y:ye>J.y+J.height?J.y+J.height:void 0,T=new Set([a?e.id:n==null?void 0:n.id,s?t.id:i==null?void 0:i.id].filter(J=>!!J)),j=e.y+e.height/2,F=t.y+t.height/2,G=F>j?1:-1,Z=(J,ye,ae)=>o.some(we=>!T.has(we.id)&&we.x<J&&J<we.x+we.width&&we.y<Math.max(ye,ae)-1&&we.y+we.height>Math.min(ye,ae)+1),re=[];for(const J of D){const ye=P(e,J),ae=P(t,J);ye===void 0||ae===void 0||(J-j)*G<0&&Z(y,ye,J)||(J-F)*G>0&&Z(w,ae,J)||re.push({pts:[{x:y,y:ye},{x:y,y:J},{x:w,y:J},{x:w,y:ae}],len:Math.abs(J-ye)+(E-x)+Math.abs(ae-J)})}return{inPools:r,outside:re.sort((J,ye)=>J.len-ye.len).map(J=>J.pts)}}function bM(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=ze(i);return{keys:new Set(ft(d).map(pt)),crossings:mo(d).length,shared:ji(d).length}},l=(d,g)=>d.length===g.length&&d.every((h,m)=>Ue(h.x,g[m].x)&&Ue(h.y,g[m].y)),u=d=>{const g=d.source,h=d.target;if(!g||!h)return"skip";const m=ze(i),w=new Map(m.shapes.map(U=>[U.id,U])),y=s(g),v=s(h),x=new Set([y,v].filter(U=>!!U)),E=m.shapes.filter(U=>U.type==="bpmn:Participant"),A=(d.waypoints??[]).map(U=>({x:U.x,y:U.y})),D=mf(A,x,E);if(D<hf)return"skip";if(t.has(d.id)){const U=r.get(d.id);if(U&&l(U,A)||D-(U?mf(U,x,a):0)<hf)return"skip"}const P=w.get(g.id),T=w.get(h.id),j=m.edges.find(U=>U.id===d.id);if(!P||!T||!j)return"skip";const F=Hn(m),G=new Set(Vt(j,F).map(U=>U.id)),Z=Go(m).filter(U=>U.owner!==d.id&&U.owner!==P.id&&U.owner!==T.id),re=[...m.shapes.filter(U=>!U.container&&U.id!==P.id&&U.id!==T.id),...Z.map(U=>U.rect)],J=U=>sn({...j,waypoints:U}).some(ce=>mM(ce,re)),ye=vM(P,T,y?w.get(y):void 0,v?w.get(v):void 0,E),ae=U=>U.map((ce,Y)=>({pts:ce,i:Y,key:ce.length*2+(J(ce)?1:0)})).sort((ce,Y)=>ce.key-Y.key||ce.i-Y.i).map(ce=>ce.pts),we=[...ae(ye.inPools),...ae(ye.outside)],Ee=c();for(const U of we){if(mf(U,x,E)>=hf)continue;const ce={...j,waypoints:U};if(Vt(ce,F).some(fe=>!G.has(fe.id))||sn(ce).some(fe=>yM(fe,m.shapes)||Z.some(Se=>Fi(Se.rect,fe))))continue;o.updateWaypoints(d,U);const X=c();if(X.crossings<=Ee.crossings&&X.shared<=Ee.shared&&[...X.keys].every(fe=>Ee.keys.has(fe)))return"fixed";o.updateWaypoints(d,A)}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 zi=[25,-25,40,-40],ya=35;function xM(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)-ya:Math.max(e.y+e.height,t.y+t.height)+ya,p=_M(e,t,s,u,n),f=p===null?[[u,0]]:[[u,0],[p,wM]];for(const[d,g]of f)for(const h of[0,...zi])if(!(Math.abs(h)>=e.width/2-5))for(const m of[0,...zi]){if(Math.abs(m)>=t.width/2-5)continue;const w=i+h,y=o+m,v=[{x:w,y:c},{x:w,y:d},{x:y,y:d},{x:y,y:l}];g&&Vt({endpoints:[],waypoints:v},a).length||r.push({pts:v,cost:g+Math.abs(m)+Math.abs(h)})}}return r}const wM=45,Xc=20;function _M(e,t,n,i,o){if(!o.length)return null;const r=e.x+e.width/2,a=t.x+t.width/2,s=Math.min(r,a),c=Math.max(r,a),l=n?Math.min(e.y,t.y):Math.max(e.y+e.height,t.y+t.height),u=o.filter(m=>m.container&&(m.type==="bpmn:Lane"||m.type==="bpmn:Participant")&&r>=m.x&&r<=m.x+m.width&&e.y>=m.y&&e.y+e.height<=m.y+m.height).sort((m,w)=>m.width*m.height-w.width*w.height)[0];if(!u)return null;const p=o.filter(m=>!m.container&&m.id!==e.id&&m.id!==t.id),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(y=>y.y));for(let y=!0;y;){y=!1;for(const v of d)v.y<m&&v.y<l&&v.y+v.height>m-Xc&&(m=v.y,y=!0)}const w=Math.max(u.y,...d.filter(y=>y.y+y.height<=m).map(y=>y.y+y.height));return m-w>=Xc?Math.round((m+w)/2):null}let g=Math.max(...f.map(m=>m.y+m.height));for(let m=!0;m;){m=!1;for(const w of d)w.y+w.height>g&&w.y+w.height>l&&w.y<g+Xc&&(g=w.y+w.height,m=!0)}const h=Math.min(u.y+u.height,...d.filter(m=>m.y>=g).map(m=>m.y));return h-g>=Xc?Math.round((g+h)/2):null}function Zc(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 xM(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-ya:n.y+n.height+ya,p=[];for(const y of[0,...zi]){if(Math.abs(y)>=i.width/2-5)continue;const v=r+y;p.push({pts:[{x:n.x,y:o},{x:v,y:o},{x:v,y:c}],cost:Math.abs(y)});for(const x of[0,...zi]){if(Math.abs(x)>=n.width/2-5)continue;const E=a+x;p.push({pts:[{x:E,y:l},{x:E,y:u},{x:v,y:u},{x:v,y:c}],cost:Math.abs(y)+Math.abs(x)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const y of[0,...zi]){if(Math.abs(y)>=n.width/2-5)continue;const v=a+y;p.push({pts:[{x:v,y:g},{x:v,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(y)})}const h=60,m=s?i.y+i.height:i.y,w=s?i.y+i.height+ya:i.y-ya;for(const y of[0,...zi]){if(Math.abs(y)>=i.width/2-5)continue;const v=r+y;for(const x of[0,...zi]){if(Math.abs(x)>=n.width/2-5)continue;const E=a+x;p.push({pts:[{x:E,y:g},{x:E,y:w},{x:v,y:w},{x:v,y:m}],cost:h+Math.abs(y)+Math.abs(x)})}}return p}const Qc=30;function ey(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],o=e[n+1],r=Ue(i.y,o.y)&&!Ue(i.x,o.x),a=Ue(i.x,o.x)&&!Ue(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)<Qc||Math.abs(i.y-(s.y+s.height))<Qc)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)<Qc||Math.abs(i.x-(s.x+s.width))<Qc)return!0}}return!1}const Jc=40;function EM(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-Jc,a=o.x+o.width+Jc,s=o.y-Jc,c=o.y+o.height+Jc;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 ty(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(A=>A.container),i=new Map(t.shapes.map(A=>[A.id,A])),o=Hn(t),r=t.edges.filter(A=>A.id!==e.id),a=hi(e,r),s=gi(e,r),c=A=>EM(A,t.shapes,e.endpoints)+(ey(A,n)?1:0),l=c(e.waypoints),u=A=>{if(!A)return;const D=A.x+A.width/2,P=A.y+A.height/2;return n.find(T=>T.type==="bpmn:Lane"&&D>=T.x&&D<=T.x+T.width&&P>=T.y&&P<=T.y+T.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=A=>{if(!d||!f)return!1;for(let D=1;D<A.length-2;D++){const P=A[D],T=A[D+1];if(Ue(P.y,T.y)&&!Ue(P.x,T.x)&&P.y>f.y&&P.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),w=(A=>{if(!A)return;const D=A.x+A.width/2,P=A.y+A.height/2;return n.filter(T=>T.type==="bpmn:Participant"&&D>=T.x&&D<=T.x+T.width&&P>=T.y&&P<=T.y+T.height).sort((T,j)=>T.width*T.height-j.width*j.height)[0]})(i.get(e.endpoints[0]??"")),y=A=>{if(!w)return 0;let D=0;for(let P=1;P<A.length-1;P++){const T=A[P];(T.x<w.x||T.x>w.x+w.width||T.y<w.y||T.y>w.y+w.height)&&D++}return D},v=y(e.waypoints);if(!ey(e.waypoints,n)&&!(d&&!h)&&v===0)return null;const x=A=>A.reduce((D,P,T)=>T?D+Math.abs(P.x-A[T-1].x)+Math.abs(P.y-A[T-1].y):0,0);let E;for(const{pts:A,cost:D}of Zc(e,i)){const P={...e,waypoints:A};if(Vt(P,o).length>0)continue;const T=hi(P,r);if(T>a)continue;const j=y(A);if(j>v)continue;const F=j<v&&T===0;if(!F&&gi(P,r)>s)continue;const G=c(A),Z=g(A);if(!F&&!(Z&&!h)&&G>=l)continue;const J=Z?0:1,ye=x(A);(!E||j<E.out||j===E.out&&(J<E.lane||J===E.lane&&(T<E.opp||T===E.opp&&(G<E.sc||G===E.sc&&(D<E.cost||D===E.cost&&ye<E.len)))))&&(E={pts:A,out:j,sc:G,lane:J,opp:T,cost:D,len:ye})}return(E==null?void 0:E.pts)??null}function SM(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 RM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ze(i).edges.filter(a=>(!t.has(a.id)||n.has(a.id))&&a.waypoints.length>=4).map(a=>a.id).sort();for(const a of r){const s=ze(i),c=s.edges.find(m=>m.id===a);if(!c||c.waypoints.length<4)continue;const l=Hn(s),u=s.edges.filter(m=>m.id!==a),p=Vt(c,l).length,f=hi(c,u),d=gi(c,u),g=n.has(a)?new Set(ft(s).map(pt)):null,h=Uc(c,s.shapes);h.length===2&&SM(c,s)&&h.reverse();for(const m of h){if(m.length>=c.waypoints.length)continue;const w={...c,waypoints:m};if(Vt(w,l).length>p||hi(w,u)>f||gi(w,u)>d)continue;if(g){const v=new Set(ft({...s,edges:s.edges.map(A=>A.id===a?w:A)}).map(pt)),x=[...v].filter(A=>!g.has(A)).length,E=[...g].filter(A=>!v.has(A)).length;if(x>E)continue}const y=i.get(a);y&&o.updateWaypoints(y,m);break}}}function ny(e,t){const{elementRegistry:n}=e,i=e.modeling,o=ze(n).edges.filter(r=>r.type==="bpmn:SequenceFlow"&&!t.has(r.id)).map(r=>r.id).sort();for(const r of o){const a=ze(n),s=a.edges.find(u=>u.id===r);if(!s)continue;const c=ty(s,a);if(!c)continue;const l=n.get(r);l&&i.updateWaypoints(l,c)}}function vf(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=Ue(n[0].x,n[1].x)&&!Ue(n[0].y,n[1].y),s=Ue(n[n.length-1].x,n[n.length-2].x)&&!Ue(n[n.length-1].y,n[n.length-2].y);for(const c of zi){if(a&&o&&Math.abs(c)<o.width/2-5){const l=n.map(u=>({...u}));l[0].x+=c,l[1].x+=c,i.push({pts:l,cost:Math.abs(c)})}if(s&&r&&Math.abs(c)<r.width/2-5){const l=n.map(u=>({...u}));l[l.length-1].x+=c,l[l.length-2].x+=c,i.push({pts:l,cost:Math.abs(c)})}}return i}const iy=e=>e==="bpmn:SequenceFlow"||e==="bpmn:MessageFlow";function CM(e,t,n){const i=e.waypoints;if(i.length<2||!iy(e.type))return[];const o=i[0],r=i[1],a=Ue(o.y,r.y)&&!Ue(o.x,r.x),s=Ue(o.x,r.x)&&!Ue(o.y,r.y);if(!a&&!s)return[];const c=Math.sign(a?r.x-o.x:r.y-o.y);if(!t.some(g=>{if(!iy(g.type)||g.type===e.type||g.waypoints.length<2)return!1;const h=g.waypoints[0],m=g.waypoints[1];return!Ue(h.x,o.x)||!Ue(h.y,o.y)?!1:a?Ue(h.y,m.y)&&Math.sign(m.x-h.x)===c:Ue(h.x,m.x)&&Math.sign(m.y-h.y)===c}))return[];const u=n.get(e.endpoints[0]??""),p=n.get(e.endpoints[1]??"");if(!u)return[];const f=(g,h)=>a?h>g.y+5&&h<g.y+g.height-5:h>g.x+5&&h<g.x+g.width-5,d=[];for(const g of zi){const h=(a?o.y:o.x)+g;if(!f(u,h)||i.length===2&&(!p||!f(p,h)))continue;const m=i.map(w=>({...w}));for(const w of[m[0],m[1]])a?w.y=h:w.x=h;d.push({pts:m,cost:Math.abs(g)})}return d}function MM(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 w of[0,...zi])Math.abs(w)<i.width/2-5&&m.push({pts:[{x:f,y:l},{x:u+w,y:l},{x:u+w,y:h}],cost:Math.abs(w)}),Math.abs(w)<i.height/2-5&&m.push({pts:[{x:c,y:d},{x:c,y:p+w},{x:g,y:p+w}],cost:Math.abs(w)});return m}const AM=[[1/2,0],[1/3,25],[2/3,25]],oy=20;function PM(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(Math.abs(o-r)<1)return[];const a=[],s=(c,l)=>{for(const[u,p]of AM){const f=Math.round(c+(l-c)*u);a.push({pts:[{x:c,y:o},{x:f,y:o},{x:f,y:r},{x:l,y:r}],cost:p})}};return n.x+n.width+oy<=i.x&&s(n.x+n.width,i.x),i.x+i.width+oy<=n.x&&s(n.x,i.x+i.width),a}function bf(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,...zi]){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 ry(e,t,n={}){const i=new Map(t.shapes.map(g=>[g.id,g])),o=Hn(t),r=t.edges.filter(g=>g.id!==e.id),a=hi(e,r);if(a===0)return null;const s=gi(e,r);let c;const l=g=>g.reduce((h,m,w)=>w?h+Math.abs(m.x-g[w-1].x)+Math.abs(m.y-g[w-1].y):0,0),u=3,p=g=>{const h=g[0],m=g[g.length-1],w=Math.hypot(m.x-h.x,m.y-h.y);return w>=1&&l(g)/w>=u?1:0},f=p(e.waypoints),d=[...Zc(e,i),...bf(e,i),...vf(e,i),...CM(e,r,i),...n.sideEntry?PM(e,i):[]];for(const{pts:g,cost:h}of d){const m={...e,waypoints:g};if(Vt(m,o).length>0)continue;const w=hi(m,r),y=gi(m,r),v=a-w+(f-p(g));if(w>=a||y-s>v)continue;const x=l(g);(!c||w<c.opposite||w===c.opposite&&(y<c.cross||y===c.cross&&(h<c.cost||h===c.cost&&x<c.len)))&&(c={pts:g,opposite:w,cross:y,cost:h,len:x})}return(c==null?void 0:c.pts)??null}function ay(e,t){var i;let n=0;for(const o of t)o.id!==e.id&&((i=Pr(e,o))==null?void 0:i.kind)==="unrelated"&&n++;return n}function TM(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=Hn(t),o=t.edges.filter(f=>f.id!==e.id),r=ay(e,o);if(r===0)return null;const a=hi(e,o),s=gi(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=[...Zc(e,n),...bf(e,n),...MM(e,n),...vf(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(Vt(g,i).length>0)continue;const h=ay(g,o);if(h>=r)continue;const m=hi(g,o);if(m-h>a-r)continue;const w=gi(g,o);if(w-s>(r-h)*l)continue;const y=c(f);(!u||h<u.fake||h===u.fake&&(m<u.unreadable||m===u.unreadable&&(w<u.cross||w===u.cross&&(d<u.cost||d===u.cost&&y<u.length))))&&(u={pts:f,fake:h,unreadable:m,cross:w,cost:d,length:y})}return(u==null?void 0:u.pts)??null}function sy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ft(ze(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(pt(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=ze(i),l=c.edges.find(f=>f.id===s);if(!l)continue;const u=TM(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function cy(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 ly(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Pr(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:cy(e,n)&&cy(t,n)}function uy(e,t,n){let i=0;for(const o of t)o.id!==e.id&&ly(e,o,n)&&i++;return i}function kM(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=Hn(t),o=t.edges.filter(f=>f.id!==e.id),r=uy(e,o,n);if(r===0)return null;const a=hi(e,o),s=gi(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=[...Zc(e,n),...bf(e,n),...vf(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(Vt(g,i).length>0)continue;const h=uy(g,o,n);if(h>=r)continue;const m=hi(g,o);if(m-h>a-r)continue;const w=gi(g,o);if(w-s>(r-h)*l)continue;const y=c(f);(!u||h<u.chain||h===u.chain&&(m<u.unreadable||m===u.unreadable&&(w<u.cross||w===u.cross&&(d<u.cost||d===u.cost&&y<u.length))))&&(u={pts:f,chain:h,unreadable:m,cross:w,cost:d,length:y})}return(u==null?void 0:u.pts)??null}function OM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ze(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=ft(r).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(pt(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,p]=l.edges.map(f=>r.edges.find(d=>d.id===f));if(!(!u||!p||!ly(u,p,a)))for(const f of l.edges)n.has(f)||c.add(f)}for(const l of[...c].sort()){const u=ze(i),p=u.edges.find(g=>g.id===l);if(!p)continue;const f=kM(p,u);if(!f)continue;const d=i.get(l);d&&o.updateWaypoints(d,f)}}function py(e,t,n,i=new Set){const{elementRegistry:o}=e,r=e.modeling,a=new Set,s=ze(o),c=ft(s).filter(f=>of(f)&&!t.has(pt(f)));if(!c.length)return a;const l=new Set;for(const f of c)if(of(f))for(const d of f.edges)n.has(d)||l.add(d);const u=f=>{var d;return((d=s.edges.find(g=>g.id===f))==null?void 0:d.type)??""},p=[...l].sort((f,d)=>{const g=u(f)==="bpmn:SequenceFlow"?0:1,h=u(d)==="bpmn:SequenceFlow"?0:1;return g!==h?g-h:f.localeCompare(d)});for(const f of p){const d=ze(o),g=d.edges.find(w=>w.id===f);if(!g)continue;const h=ry(g,d,{sideEntry:i.has(f)});if(!h)continue;const m=o.get(f);m&&(r.updateWaypoints(m,h),a.add(f))}return a}const DM=10,LM=(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 fy(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Vc(e,i))return null;const o=Hn(t),r=i.flatMap(sn);for(const a of sn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of Gc(a,r))s=s.flatMap(([h,m])=>{const w=[];return d>h&&w.push([h,Math.min(m,d)]),g<m&&w.push([Math.max(h,g),m]),w.filter(([y,v])=>v>y)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,g])=>g-d>=c+DM*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-Rm}:{x:a.at+Tn+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(!Vc({...e,label:f},i)&&!o.some(d=>!e.endpoints.includes(d.id)&&LM(f,d)))return f}return null}const Tn=8;function xf(e,t){const n=e.label;if(!n)return null;const i=sn(e);if(!i.length)return null;const o=n.x+n.width/2,r=n.y+n.height/2,a=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(sn),...t.shapes.filter(f=>f.container).flatMap(ga)],l=f=>!c.some(d=>Fi(f,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+Tn,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const f of[s.at+Tn,s.at-Tn-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-Tn-n.height,s.at+Tn])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 dy=30,IM=(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},hy=(e,t)=>IM({x:e.x+e.width/2,y:e.y+e.height/2},t);function BM(e,t){const n=e.label;if(!n)return null;const i=sn(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(sn),...t.shapes.filter(c=>c.container).flatMap(ga)],r=Go(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=>Fi(c,l))&&!fs(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+Tn,c.at-Tn-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+Tn,c.at-Tn-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 gy(e,t,n=new Set){var s,c;const{elementRegistry:i}=e,o=e.modeling;let r=ze(i),a=new Set(ft(r).map(pt));for(const[l,u]of t){const p=u.wps,f=i.get(l),d=f==null?void 0:f.label;if(!d||!(f!=null&&f.waypoints))continue;const g=f.waypoints[0].x-p[0].x,h=f.waypoints[0].y-p[0].y;if(!(f.waypoints.length===p.length&&f.waypoints.every((D,P)=>D.x-p[P].x===g&&D.y-p[P].y===h))){if(((s=f.source)==null?void 0:s.id)===u.source&&((c=f.target)==null?void 0:c.id)===u.target)continue;const D=r.edges.find(G=>G.id===l);if(!(D!=null&&D.label)||!fs(D.label,r).length&&!n.has(l))continue;let P={...D.label,x:u.label.x,y:u.label.y};if((fs(P,r).length||hy(P,D.waypoints)>dy)&&(P=null),!P&&hy(D.label,D.waypoints)>dy&&(P=BM(D,r)),!P)continue;const T=P;if(T.x===d.x&&T.y===d.y)continue;const j={...r,edges:r.edges.map(G=>G.id===l?{...G,label:T}:G)},F=ft(j);if(F.some(G=>!a.has(pt(G))))continue;o.moveElements([d],{x:T.x-d.x,y:T.y-d.y}),r=j,a=new Set(F.map(pt));continue}const w=u.label.x+g-d.x,y=u.label.y+h-d.y;if(w===0&&y===0)continue;const v=r.edges.find(D=>D.id===l);if(!(v!=null&&v.label))continue;const x={...v.label,x:v.label.x+w,y:v.label.y+y},E={...r,edges:r.edges.map(D=>D.id===l?{...D,label:x}:D)},A=ft(E);A.some(D=>!a.has(pt(D)))||(o.moveElements([d],{x:w,y}),r=E,a=new Set(A.map(pt)))}}function my(e,t,n=new Set){const{elementRegistry:i}=e,o=e.modeling,r=ze(i);for(const a of r.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=xf(a,r);if(!s)continue;const c=i.get(a.id),l=c==null?void 0:c.label;l&&o.moveElements([l],{x:s.x-l.x,y:s.y-l.y})}}function yy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ze(i),a=ft(r).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(pt(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=r.edges.find(f=>f.id===s.edge);if(!c)continue;const l=fy(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 vy(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(sn),...t.shapes.filter(f=>f.container).flatMap(ga)],o=i.filter(f=>Fi(n,f));if(!o.length)return null;const r=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=Go(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Fi(f,d))&&!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-Tn-n.height},{...n,y:f.at+Tn}):l.push({...n,x:f.at-Tn-n.width},{...n,x:f.at+Tn});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+Tn},{...n,x:u-n.width/2,y:e.y-Tn-n.height},{...n,x:e.x+e.width+Tn,y:p-n.height/2},{...n,x:e.x-Tn-n.width,y:p-n.height/2}),l.find(c)??null}function by(e,t){const{elementRegistry:n}=e,i=e.modeling,o=ze(n);for(const r of o.shapes){if(r.container||!r.label||t.has(r.id))continue;const a=vy(r,ze(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 NM(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 xy(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=ze(n),r=new Set(ft(o).map(pt));const a=[...new Set(ft(o).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(pt(s))).map(s=>s.edge))].sort();for(const s of a){const c=o.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[h,m]of u){const w=h?o.shapes.find(v=>v.id===h):void 0;if(!w)continue;const y=NM(w,l[m]);y.x===l[m].x&&y.y===l[m].y||(l[m]=y,p=!0)}if(!p)continue;const f={...o,edges:o.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=ft(f);if(d.some(h=>!r.has(pt(h))))continue;const g=n.get(s);g&&(i.updateWaypoints(g,l),o=f,r=new Set(d.map(pt)))}}const wf=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function wy(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 $M(e,t,n){const i=[],o=n?as(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 wy(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(!wf(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 wi(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function FM(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(wf(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=wy(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,f=wi(c.participant,"name",a(u));c.participant.lanes&&(f.lanes=c.participant.lanes.map((d,g)=>wi(d,"name",a(p[g])))),s.push({...c,participant:f});break}case"participant.update":{const[u,...p]=l,f=wi(c,"name",a(u));c.lanes&&(f.lanes=c.lanes.map((d,g)=>wi(d,"name",a(p[g])))),s.push(f);break}case"node.add":s.push({...c,node:wi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:wi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:wi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:wi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:wi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:wi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(wi(c,"text",a(l[0])));break;default:s.push(wf(l[0].map)?wi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const jM=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,_y=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Ey={"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}]},hs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),el=e=>typeof e=="string"&&e!=="";function HM(e){const t=[];function n(i,o,r,a){if(a===null){el(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!hs(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)el(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!hs(i)||!el(i.kind)||!(i.kind in Ey)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of Ey[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(!hs(f))break;f=f[g]}if(!hs(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;hs(c)&&!el(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"&&!zg(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&&!Gg(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=HM(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(h,m,w){if(!jM.test(m)){o.push({kind:"id-invalid",opIndex:h,id:m});return}if(t.categoryOf(m)!==void 0||r.has(m)){o.push({kind:"id-duplicate",opIndex:h,id:m});return}r.set(m,{...w,opIndex:h})}e.forEach((h,m)=>{var w;switch(h.kind){case"participant.add":s(m,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(y=>y.id)});for(const y of h.participant.lanes??[])s(m,y.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 y of h.associations??[])y.id&&s(m,y.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(m,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(m,h.association.id,{category:"association"});break;case"annotation.add":s(m,h.annotation.id,{category:"annotation"}),(w=h.association)!=null&&w.id&&s(m,h.association.id,{category:"association"});break;case"group.add":s(m,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(y=>y.id));for(const y of h.lanes)t.categoryOf(y.id)===void 0&&s(m,y.id,{category:"lane"})}break}});const c=h=>{var m;return((m=r.get(h))==null?void 0:m.category)??t.categoryOf(h)},l=h=>{const m=r.get(h);return m?m.category==="participant"?h:m.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,m,w,y){const v=c(m);if(v===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:w});return}if(y&&!y.includes(v)){o.push({kind:"ref-category",opIndex:h,ref:m,role:w,expected:y.join("|"),actual:v});return}return v}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 w,y;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:v,lane:x}=h.node;if(v===void 0){(p||x!==void 0)&&o.push({kind:"participant-required",opIndex:m,id:h.node.id});break}if(u(m,v,"participant",["participant"])===void 0)break;x!==void 0&&((((w=r.get(v))==null?void 0:w.lanes)??a.get(v)??t.lanesOf(v)).includes(x)||o.push({kind:"lane-unknown",opIndex:m,lane:x,participant:v}));break}case"sequenceFlow.add":{const{id:v,source:x,target:E,name:A,condition:D}=h.flow,P=u(m,x,"source",["flowNode"]),T=u(m,E,"target",["flowNode"]);P&&T&&l(x)!==l(E)&&o.push({kind:"flow-cross-pool",opIndex:m,id:v}),A!==void 0&&D!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:v});break}case"messageFlow.add":{const{id:v,source:x,target:E}=h.flow,A=u(m,x,"source",["flowNode","participant"]),D=u(m,E,"target",["flowNode","participant"]);if(A&&D){const P=l(x),T=l(E);P!==void 0&&P===T&&o.push({kind:"message-flow-same-pool",opIndex:m,id:v})}for(const P of[x,E])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(A=>A===h.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:m,source:v.source,target:v.target});continue}const E=v.source===h.dataStore.id?v.target:v.source;u(m,E,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:v,target:x}=h.association,E=u(m,v,"source"),A=u(m,x,"target");if(E&&A){const D=new Set([E,A]);D.has("dataStore")&&D.has("flowNode")||o.push({kind:"data-association-ends",opIndex:m,source:v,target:x})}break}case"association.add":{const{id:v,source:x,target:E}=h.association,A=u(m,x,"source"),D=u(m,E,"target");A&&D&&A!=="annotation"&&D!=="annotation"&&o.push({kind:"association-detached",opIndex:m,annotation:v??`${x}->${E}`});break}case"annotation.add":{if(h.association){const{source:v,target:x}=h.association;if(v!==h.annotation.id&&x!==h.annotation.id)o.push({kind:"association-detached",opIndex:m,annotation:h.annotation.id});else{const E=v===h.annotation.id?x:v;u(m,E,"association")}}h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.add":{for(const v of h.group.members??[]){const x=u(m,v,"member");x&&_y.has(x)&&o.push({kind:"ref-category",opIndex:m,ref:v,role:"member",expected:"shape",actual:x})}break}case"participant.update":{if(g(m,h.id,"participant")===void 0)break;if(h.lanes){const v=t.lanesOf(h.id),x=h.lanes.map(P=>P.id);for(const P of v)x.includes(P)||o.push({kind:"lane-shrink-unsupported",opIndex:m,participant:h.id,lane:P});for(const P of x)t.categoryOf(P)!==void 0&&!v.includes(P)&&o.push({kind:"id-duplicate",opIndex:m,id:P});const E=x.filter(P=>v.includes(P)),A=P=>E.every((T,j)=>T===P[j]),D=(((y=t.laneDeclarationOrderOf)==null?void 0:y.call(t,h.id))??v).filter(P=>v.includes(P));E.length===v.length&&!A(v)&&!A(D)&&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,x=h.target===void 0||u(m,h.target,"target",["flowNode"])!==void 0,E=t.endpointsOf(h.id),A=h.source??(E==null?void 0:E.source),D=h.target??(E==null?void 0:E.target);v&&x&&A!==void 0&&D!==void 0&&new Set([l(A),l(D),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 x=u(m,v,"member");x&&_y.has(x)&&o.push({kind:"ref-category",opIndex:m,ref:v,role:"member",expected:"shape",actual:x})}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(...$M(e,t,n.i18n)),o;function g(h,m,w){if(r.has(m)){o.push({kind:"target-added-in-batch",opIndex:h,id:m});return}const y=t.categoryOf(m);if(y===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:"target"});return}if(w&&y!==w){o.push({kind:"ref-category",opIndex:h,ref:m,role:"target",expected:w,actual:y});return}return y}}function Ry(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 tl(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const nl={"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]},kn=10,zM=300,GM=160,Cy=20,_f=100,My=40,VM=10,WM=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function Ay(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 il=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function ol(e,t,n,i,o){const r=n,a=Ay(e,t,i),s=a??i,c=(Z,re,J=s)=>{const[ye,ae]=nl[Z];let we={x:t.x+t.width/2+ye*(t.width/2+r.width/2+re),y:t.y+t.height/2+ae*(t.height/2+r.height/2+re)};const Ee=J.x+kn+r.width/2,U=J.x+J.width-kn-r.width/2,ce=J.y+kn+r.height/2,Y=J.y+J.height-kn-r.height/2,X={x:Math.min(U,Math.max(Ee,we.x)),y:Math.min(Y,Math.max(ce,we.y))};return(X.x!==we.x||X.y!==we.y)&&(we=Math.abs(X.x-(t.x+t.width/2))<(t.width+r.width)/2+kn&&Math.abs(X.y-(t.y+t.height/2))<(t.height+r.height)/2+kn?{x:t.x+t.width+kn+r.width/2,y:X.y}:X),we},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=ze(e),p=Z=>{var J,ye;if(!o.selfId)return!1;const re=e.get(Z);return!!re&&(((J=re.source)==null?void 0:J.id)===o.selfId||((ye=re.target)==null?void 0:ye.id)===o.selfId)},f=u.edges.filter(Z=>!p(Z.id)).flatMap(sn),d=Go(u).filter(Z=>Z.owner!==o.selfId).map(Z=>Z.rect),g=Z=>({x0:Z.x-r.width/2-kn,x1:Z.x+r.width/2+kn,y0:Z.y-r.height/2-kn,y1:Z.y+r.height/2+kn}),h=Z=>{const re=g(Z);return l.some(J=>re.x0<J.x+J.width&&re.x1>J.x&&re.y0<J.y+J.height&&re.y1>J.y)},m=Z=>{const re=g(Z);return f.some(J=>J.axis==="h"?J.at>re.y0&&J.at<re.y1&&J.lo<re.x1&&J.hi>re.x0:J.at>re.x0&&J.at<re.x1&&J.lo<re.y1&&J.hi>re.y0)},w=Z=>{const re=g(Z);return d.some(J=>re.x0<J.x+J.width&&re.x1>J.x&&re.y0<J.y+J.height&&re.y1>J.y)},y=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}]),v=Z=>{const re=g(Z);return y.some(J=>J.axis==="h"?J.at>re.y0&&J.at<re.y1&&J.lo<re.x1&&J.hi>re.x0:J.at>re.x0&&J.at<re.x1&&J.lo<re.y1&&J.hi>re.y0)},x=Z=>h(Z)||m(Z)||w(Z)||v(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,A=Z=>E(Z)&&(!a||il(Z,r,a));if(o.placement){const Z=Ee=>Ee.startsWith("top")?Ee.replace(/^top/,"bottom"):Ee.replace(/^bottom/,"top"),re=Ee=>Ee.endsWith("left")?Ee.replace(/left$/,"right"):Ee.replace(/right$/,"left"),J=o.placement.side,ye=[J,Z(J),re(J),Z(re(J)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],ae=o.placement.offset??50;let we=c(J,ae);if(x(we)||a&&!il(we,r,a)){const Ee=(U,ce)=>{const Y=new Set;for(const X of ye){if(Y.has(X))continue;Y.add(X);const fe=c(X,ae,U);if(ce(fe)&&!x(fe))return we=fe,!0}return!1};!Ee(s,A)&&a&&Ee(i,E)}return we}const D=o.from,P=s.x+kn+r.width/2,T=s.x+s.width-kn-r.width/2,j=s.y+kn+r.height/2,F=s.y+s.height-kn-r.height/2;let G={x:Math.min(T,Math.max(P,D.x)),y:Math.min(F,Math.max(j,D.y))};if(x(G)){const Z=(t.width+r.width)/2+kn,J=[{x:G.x+Z,y:G.y},{x:G.x-Z,y:G.y},{x:G.x,y:G.y-r.height-kn},{x:G.x,y:G.y+r.height+kn}].filter(A).find(ye=>!x(ye));J&&(G=J)}return G}function qt(e,t){return e.filter(n=>n.kind===t)}function Py(e,t){const n=new Map,i=new Set(qt(e,"node.add").map(s=>s.node.id)),o=qt(e,"sequenceFlow.update"),r=new Set(o.flatMap(s=>s.target!==void 0?[s.target]:[])),a=new Set;for(const s of o){const c=s.source;if(s.target!==void 0||c===void 0||!i.has(c)||r.has(c)||a.has(c))continue;const l=t(s.id),u=l&&qt(e,"sequenceFlow.add").find(f=>f.flow.source===l&&f.flow.target===c);if(!u)continue;const p=JSON.stringify(u.flow.id);e.some(f=>f!==u&&JSON.stringify(f).includes(p))||(a.add(c),n.set(s.id,u))}return n}class Ty extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}const ky=new WeakMap;function UM(e){return ky.get(e)??new Set}function Oy(e,t){var eS,tS,nS,iS,oS,rS,aS,sS,cS,lS,uS,pS,fS,dS,hS,gS,mS,yS,vS,bS,xS,wS,_S,ES,SS;const{modeling:n,bpmnFactory:i,elementFactory:o,elementRegistry:r,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=new Set;ky.set(t,u);const p=()=>a.getRootElement(),f=b=>r.get(b),d=b=>{const _=f(b);if(!_)throw new Error(`하강 참조 해소 실패: ${b}`);return _},g=b=>{let _=b.parent;for(;_;){if(_.type==="bpmn:Participant")return _;_=_.parent}},h=new Map;for(const b of r.filter(_=>!("waypoints"in _&&_.waypoints)&&_.type!=="bpmn:Lane"&&_.type!=="label"&&typeof _.x=="number"))h.set(b.id,{x:b.x,y:b.y});const m=qt(e,"participant.add"),w=qt(e,"node.add"),y=qt(e,"sequenceFlow.add"),v=qt(e,"messageFlow.add"),x=qt(e,"dataStore.add"),E=qt(e,"dataAssociation.add"),A=qt(e,"annotation.add"),D=qt(e,"group.add"),P=new Map(w.map(b=>[b.node.id,b])),T=Py(e,b=>{var _,R;return(R=(_=f(b))==null?void 0:_.source)==null?void 0:R.id}),j=new Set([...T.values()].map(b=>b.flow.id)),F=y.filter(b=>!j.has(b.flow.id)),G=new Set([...T.values()].map(b=>b.flow.target)),Z=b=>qt(e,"sequenceFlow.update").filter(_=>_.target===b).length+(G.has(b)?1:0),re=(b,_,R)=>{var I;const O=b.businessObject,L=(((I=O.extensionElements)==null?void 0:I.values)??[]).filter(B=>B.$type!==_),k=R?[...L,i.create(_,R)]:L;if(!k.length){O.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const $=i.create("bpmn:ExtensionElements",{values:k});k.forEach(B=>{B.$parent=$}),n.updateProperties(b,{extensionElements:$})},J=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of qt(e,"element.remove")){const _=f(b.id);if(!_)continue;const R="waypoints"in _?[]:[..._.incoming??[],..._.outgoing??[]];n.removeElements([...R,_])}const ye=b=>r.filter(_=>{var R;return _.type==="bpmn:Lane"&&((R=g(_))==null?void 0:R.id)===b}).sort((_,R)=>_.y-R.y);for(const b of qt(e,"participant.update")){const _=d(b.id);if(b.name!==void 0&&n.updateProperties(_,{name:b.name??void 0}),!b.lanes)continue;const R=ye(b.id);if(!R.length){n.splitLane(_,b.lanes.length),ye(b.id).forEach((k,$)=>{const I=b.lanes[$];I&&n.updateProperties(k,{id:I.id,name:I.name})});continue}const O=new Set(R.map(k=>k.id)),L=b.lanes.reduce((k,$,I)=>O.has($.id)?I:k,-1);b.lanes.forEach((k,$)=>{if(O.has(k.id)){n.updateProperties(d(k.id),{name:k.name});return}const I=$===L+1&&L>=0,B=$===0?n.addLane(ye(b.id)[0],"top"):I?n.addLane(ye(b.id).at(-1),"bottom"):n.addLane(d(b.lanes[$-1].id),"bottom");n.updateProperties(B,{id:k.id,name:k.name})})}const ae=150,we=130,Ee=80,U=90,ce=180,Y=30,X=30,fe=10,Se=300,Ie=5,N=(b,_,R,O,L)=>{const k=R-_.width/2,$=O-_.height/2;return(b.children??[]).find(I=>!("waypoints"in I&&I.waypoints)&&I.type!=="bpmn:Lane"&&I.type!=="label"&&!(L!=null&&L.has(I.id))&&typeof I.x=="number"&&k<I.x+I.width+X&&k+_.width+X>I.x&&$<I.y+I.height&&$+_.height>I.y)},C=new Set;for(const b of m){C.add(`pool:${b.participant.id}`);for(const _ of b.participant.lanes??[])C.add(_.id)}const S=new Map;for(const b of w){const _=b.node.lane??`pool:${b.node.participant??""}`;let R=S.get(_);R||S.set(_,R=new Set([0])),b.band!==void 0&&R.add(b.band)}const V=new Map;for(const[b,_]of S){if(!C.has(b))continue;const R=[..._].sort((k,$)=>k-$),O=R.map((k,$)=>$===0?0:$%2===1?Math.ceil($/2):-($/2)),L=Math.min(...O);V.set(b,new Map(R.map((k,$)=>[k,O[$]-L])))}{const b=new Map;for(const _ of m)(_.participant.lanes??[]).forEach((R,O)=>b.set(R.id,O));for(const[_,R]of V){if(!b.has(_)||R.size<2)continue;const O=b.get(_),L=R.get(0)??0,k=new Set;for(const ne of w){if(ne.node.lane!==_||(ne.band??0)!==0||!ne.node.type.endsWith("Gateway"))continue;const he={in:new Set,out:new Set,cross:new Set};for(const oe of F){const se=oe.flow.source===ne.node.id;if(!se&&oe.flow.target!==ne.node.id)continue;const Me=P.get(se?oe.flow.target:oe.flow.source);if(!Me||Me.node.participant!==ne.node.participant||!Me.node.lane)continue;let de,pe=!1;if(Me.node.lane!==_){const ge=b.get(Me.node.lane);if(ge===void 0)continue;de=ge>O?"down":"up",pe=!0}else{const ge=R.get(Me.band??0)??L;de=ge>L?"down":ge<L?"up":void 0}de&&(he[se?"out":"in"].add(de),pe&&he.cross.add(de))}for(const oe of["up","down"])he.in.has(oe)&&he.out.has(oe)&&he.cross.has(oe)&&k.add(oe)}if(k.size!==1)continue;const[$]=k,I=Math.max(...R.values()),B=$==="down"?I:0;if(L===B)continue;const z=[...R.entries()].filter(([ne])=>ne!==0).sort((ne,he)=>ne[1]-he[1]),H=[...Array(I+1).keys()].filter(ne=>ne!==B),Q=new Map([[0,B]]);z.forEach(([ne],he)=>Q.set(ne,H[he])),V.set(_,Q)}}const K=b=>{var _;return(((_=S.get(b))==null?void 0:_.size)??0)>1},le=b=>b.band??(b.node.lane||!K(`pool:${b.node.participant??""}`)?void 0:0),Te=new Map,Ve=b=>Te.get(b.node.id)??le(b),wt=new Set,Qt=new Set,Pt=new Set;{const b=new Map;for(const O of F)b.set(O.flow.target,(b.get(O.flow.target)??0)+1);const _=O=>{const L=[],k=new Set([O]),$=[O];for(;$.length;){const I=$.shift();L.push(I);for(const B of F)B.flow.source!==I||k.has(B.flow.target)||(b.get(B.flow.target)??0)!==1||(k.add(B.flow.target),$.push(B.flow.target))}return L},R=(O,L)=>{var k;return((k=V.get(O))==null?void 0:k.get(L))??L};for(const O of w){if(!O.node.type.endsWith("Gateway"))continue;const L=O.node.lane??`pool:${O.node.participant??""}`,k=V.get(L);if(!k||k.size<2)continue;const $=Ve(O);if($===void 0||R(L,$)!==R(L,0))continue;const I=R(L,$),B=F.filter(oe=>oe.flow.source===O.node.id).map(oe=>P.get(oe.flow.target)).filter(oe=>!!oe&&(oe.node.lane??`pool:${oe.node.participant??""}`)===L),z=B.filter(oe=>{const se=Ve(oe);return se!==void 0&&R(L,se)===I&&(b.get(oe.node.id)??0)===1}),H=B.some(oe=>{const se=Ve(oe);return se!==void 0&&R(L,se)>I});if(z.length!==1||!H)continue;const Q=new Set(B.flatMap(oe=>_(oe.node.id)));if(!F.some(oe=>oe.flow.target===O.node.id&&Q.has(oe.flow.source)))continue;const he=new Map;for(const[oe,se]of k)he.set(oe,se+1);he.set(-1,0),V.set(L,he);for(const oe of _(z[0].node.id))P.has(oe)&&(Te.set(oe,-1),Qt.add(oe));wt.add(O.node.id)}}{const b=H=>H.node.lane??`pool:${H.node.participant??""}`,_=H=>Ve(H)??0,R=new Map(m.map((H,Q)=>({id:H.participant.id,order:H.order??Number.POSITIVE_INFINITY,declared:Q})).sort((H,Q)=>H.order!==Q.order?H.order-Q.order:H.declared-Q.declared).map((H,Q)=>[H.id,Q])),O=H=>H===void 0?void 0:R.get(H)??-1,L=H=>{var he;const Q=P.get(H);if(Q)return Q.node.participant;if(R.has(H))return H;const ne=f(H);if(ne)return ne.type==="bpmn:Participant"?ne.id:(he=g(ne))==null?void 0:he.id},k=new Map;for(const H of F)k.set(H.flow.target,(k.get(H.flow.target)??0)+1);const $=H=>{const Q=[H],ne=new Set([H.node.id]);for(let he=0;he<Q.length;he++)for(const oe of F){if(oe.flow.source!==Q[he].node.id||ne.has(oe.flow.target)||(k.get(oe.flow.target)??0)!==1)continue;const se=P.get(oe.flow.target);!se||se.node.participant!==H.node.participant||(ne.add(se.node.id),Q.push(se))}return Q},I=H=>{const Q=new Set(H.map(oe=>oe.node.id)),ne=O(H[0].node.participant);if(ne===void 0)return;const he=new Set;for(const oe of v){const se=Q.has(oe.flow.source)?oe.flow.target:Q.has(oe.flow.target)?oe.flow.source:void 0;if(se===void 0)continue;const Me=O(L(se));Me===void 0||Me===ne||he.add(Me<ne?"up":"down")}return he.size===1?[...he][0]:void 0},B=new Map;{const H=new Map;for(const se of F){if(!P.has(se.flow.source)||!P.has(se.flow.target))continue;const Me=H.get(se.flow.source)??[];Me.push(se.flow.target),H.set(se.flow.source,Me)}const Q=new Map,ne=[],he=new Set,oe=se=>{Q.set(se,"open");for(const Me of H.get(se)??[]){const de=Q.get(Me);de==="open"?he.add(`${se}>${Me}`):de||oe(Me)}Q.set(se,"done"),ne.push(se)};for(const se of w)Q.has(se.node.id)||oe(se.node.id);for(const se of ne.reverse()){const Me=B.get(se)??0;B.set(se,Me);for(const de of H.get(se)??[])!he.has(`${se}>${de}`)&&(B.get(de)??-1)<Me+1&&B.set(de,Me+1)}}let z=-1e3;for(const H of w){if(!H.node.type.endsWith("Gateway"))continue;const Q=b(H),ne=V.get(Q);if(!ne)continue;const he=ne.get(_(H))??0,oe=de=>(ne.get(_(de))??0)-he,se=F.filter(de=>de.flow.source===H.node.id).map(de=>P.get(de.flow.target)).filter(de=>!!de&&b(de)===Q&&(k.get(de.node.id)??0)===1&&!Qt.has(de.node.id)).map(de=>{const pe=$(de);return{root:de,subtree:pe,dir:I(pe)}});if(!(se.some(de=>de.dir==="up")&&se.some(de=>de.dir==="down")||!F.some(de=>{const pe=de.flow.source===H.node.id?P.get(de.flow.target):void 0;return!!pe&&b(pe)===Q&&oe(pe)===0})))for(const de of se){const pe=de.dir;if(!pe||se.some(ee=>ee!==de&&ee.dir===pe))continue;const ge=oe(de.root);if(ge===0||(pe==="up"?ge<0:ge>0)||F.some(ee=>{const Ce=ee.flow.target===H.node.id?P.get(ee.flow.source):void 0;if(!Ce||b(Ce)!==Q)return!1;const qe=oe(Ce);return pe==="up"?qe<0:qe>0}))continue;const ue=[...ne].map(([ee,Ce])=>({band:ee,rel:Ce-he})).filter(ee=>pe==="up"?ee.rel<0:ee.rel>0).sort((ee,Ce)=>Math.abs(Ce.rel)-Math.abs(ee.rel));if(!ue.length&&pe==="down")continue;const ke=_(de.root),Qe=de.subtree.filter(ee=>b(ee)===Q&&_(ee)===ke),Mt=new Set(de.subtree.map(ee=>ee.node.id)),et=Qe.map(ee=>B.get(ee.node.id)??0),st=Math.min(...et)-1,Fe=Math.max(...et)+1,_e=ee=>!w.some(Ce=>{if(Mt.has(Ce.node.id)||b(Ce)!==Q||_(Ce)!==ee)return!1;if(!Pt.has(ee))return!0;const qe=B.get(Ce.node.id)??0;return qe>=st&&qe<=Fe});let Re=(eS=ue.find(ee=>_e(ee.band)))==null?void 0:eS.band;if(Re===void 0){if(Re=z--,Pt.add(Re),pe==="up"){const ee=new Map;for(const[Ce,qe]of ne)ee.set(Ce,qe+1);ee.set(Re,0),V.set(Q,ee)}else ne.set(Re,Math.max(...ne.values())+1);(tS=S.get(Q))==null||tS.add(Re)}for(const ee of Qe)Te.set(ee.node.id,Re)}}}const Ht=(b,_)=>{var R;return((R=V.get(b))==null?void 0:R.get(_))??_},gn=(b,_,R,O)=>{const L=b?f(b):_?f(_):void 0;if(!L)return!1;const k=b?L.y+Math.min(L.height/2,U):L.y+Ee;return Math.abs(k+Ht(b??`pool:${_??""}`,R)*ae-O)<=ae/2},Nn=new Map;for(const[b,_]of S){let R=0;for(const O of _)R=Math.max(R,Ht(b,O));Nn.set(b,R)}const Nt=b=>ce+ae*b,rn=(b,_,R)=>{const O=p().children.filter(L=>!("waypoints"in L&&L.waypoints)&&L.type!=="label"&&L.id!==_&&typeof L.y=="number"&&L.y>=b);O.length&&n.moveElements(O,{x:0,y:R})},Vn=(b,_,R)=>{const O=b.type==="bpmn:Participant"?b:void 0;if(!O||O.children.some(I=>I.type==="bpmn:Lane"))return;const L=R+_.height/2+Y-O.y;if(O.height>=L)return;const k=L-O.height,$=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:L}),rn($,O.id,k)},Za=(b,_)=>{const R=_-b.height;if(R<=0)return;const O=g(b)??b,L=[],k=B=>{L.push(B);for(const z of B.children??[])k(z)};k(O);const $=b.y+b.height-10,I=l.calculateAdjustments(L,"y",R,$);l.makeSpace(I.movingShapes,I.resizingShapes,{x:0,y:R},"s",$)},pi=(b,_,R)=>{if(b){const $=d(b),I=Nt(_);if($.height>=I)return;const B=I-$.height,z=g($),H=z?z.y+z.height:$.y+$.height;Za($,I),rn(H,z==null?void 0:z.id,B);return}if(!R)return;const O=ae*(_+1);if(R.height>=O)return;const L=O-R.height,k=R.y+R.height;n.resizeShape(R,{x:R.x,y:R.y,width:R.width,height:O}),rn(k,R.id,L)},Li=new Map;for(const b of F)Li.set(b.flow.target,(Li.get(b.flow.target)??0)+1);const bi=b=>(Li.get(b)??0)<=1,wn=new Set(w.map(b=>b.node.id).filter(b=>Z(b)===1&&!F.some(_=>_.flow.target===b||_.flow.source===b&&P.has(_.flow.target)))),Lo=new Map,bc=(b,_)=>{if(!b)return;const R=f(b);if(!R||R.height>=Nt(_))return;const O=R.y+R.height-10,L=g(R);if(L)return new Set((L.children??[]).filter(k=>k.type!=="bpmn:Lane"&&typeof k.y=="number"&&k.y>O).map(k=>k.id))},Kn=(b,_,R)=>{if(!b)return!0;const O=f(b);return O?R-_.height/2>=O.y&&R+_.height/2<=O.y+O.height:!0},gt=m.map((b,_)=>({op:b,declared:_}));gt.sort((b,_)=>{const R=b.op.order??Number.POSITIVE_INFINITY,O=_.op.order??Number.POSITIVE_INFINITY;return R!==O?R-O:b.declared-_.declared});let St=80;for(const b of r.getAll())b.parent===p()&&"height"in b&&typeof b.y=="number"&&(St=Math.max(St,b.y+b.height+60));const Ag=r.getAll().filter(b=>b.type==="bpmn:Participant"&&b.parent===p()),f3=(()=>{if(!Ag.length)return;const b=Ag.filter(L=>!Ly(L)),_=b.length?b:Ag,R=Math.min(..._.map(L=>L.x)),O=Math.max(..._.map(L=>L.x+L.width));return O>R?{x:R,width:O-R}:void 0})();for(const{op:b}of gt){const _=b.participant,R=w.filter(se=>se.node.participant===_.id).length,O=((nS=_.lanes)==null?void 0:nS.length)??0,L=Math.max(1200,R*160+300),k=(_.lanes??[]).map(se=>Nt(Nn.get(se.id)??0)),$=k.reduce((se,Me)=>se+Me,0);O&&$<300&&(k[O-1]+=300-$);const I=Math.max(300,ae*((Nn.get(`pool:${_.id}`)??0)+1)),B=_.blackBox||R+O===0?120:O?Math.max(300,$):I,z=_.blackBox?f3:void 0,H=(z==null?void 0:z.x)??100,Q=(z==null?void 0:z.width)??L,ne=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:_.id,name:_.name,...b.order!==void 0?{"bwl:poolOrder":b.order}:{},..._.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:Q,height:B,isExpanded:!0}),he=n.createShape(ne,{x:H+Q/2,y:St+B/2},p()),oe=_.lanes??[];if(oe.length&&n.splitLane(he,oe.length),oe.length){const se=r.filter(Me=>{var de;return Me.type==="bpmn:Lane"&&((de=g(Me))==null?void 0:de.id)===_.id}).sort((Me,de)=>Me.y-de.y);if(se.forEach((Me,de)=>{const pe=oe[de];pe&&n.updateProperties(Me,{id:pe.id,name:pe.name})}),k.some(Me=>Me!==he.height/O)){let Me=he.y;se.forEach((de,pe)=>{const ge=k[pe];n.resizeShape(de,{x:de.x,y:Me,width:de.width,height:ge}),Me+=ge})}}St=he.y+he.height+60}const d3=b=>{var O;const _=P.get(b);if(_)return _.node.participant??"";const R=f(b);return R?R.type==="bpmn:Participant"?R.id:((O=g(R))==null?void 0:O.id)??"":""},xc=new Map,S1=b=>{let _=xc.get(b);return _||xc.set(b,_={nodes:[],flows:[]}),_};for(const b of w)S1(b.node.participant??"").nodes.push(b);for(const b of F)S1(d3(b.flow.source)).flows.push(b);const yp=b=>{var _;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((_=b.condition)==null?void 0:_.label)})},Pg=(b,_,R)=>o.createShape({type:tl(b.type),...b.eventDefinition?{eventDefinitionType:Ac[b.eventDefinition]}:{},businessObject:i.create(tl(b.type),{id:b.id,name:b.name,..._!==void 0?{"bwl:band":_}:{},...R!==void 0?{"bwl:afterColumn":R}:{}})}),h3=[...gt.map(({op:b})=>b.participant.id).filter(b=>xc.has(b)),...[...xc.keys()].filter(b=>!m.some(_=>_.participant.id===b))],Tg=b=>b.endsWith("Gateway");for(const b of h3){const _=xc.get(b),R=b?d(b):void 0,O=R?R.x+150:250;let L=R?R.y+80:120;const k=(ie,ue,ke)=>{if(ie){const Qe=d(ie);return Qe.y+Math.min(Qe.height/2,U)+Ht(ie,ue??0)*ae}return ue!==void 0&&R?R.y+Ee+Ht(`pool:${b}`,ue)*ae:ke},$=(ie,ue,ke)=>{if(ie){const Qe=d(ie);return Qe.y+Math.min(Qe.height/2,U)+ue*ae}return R?R.y+Ee+ue*ae:ke},I=ie=>ie.participant?d(ie.participant):p(),B=(ie,ue,ke,Qe,Mt,et,st,Fe)=>{const _e=ke!==void 0||Qe!==void 0,Re=nt=>{const Be=()=>pi(ke,nt,R);Fe?Fe(Be):Be()},ee=Ht(ke??`pool:${b}`,Qe??0);if((Qe===void 0||gn(ke,b,Qe,st??Number.NaN))&&st!==void 0&&Kn(ke,ue,st)&&!N(ie,ue,Mt,st))return{x:Mt,y:st};if(_e)for(let nt=0;nt<4;nt++){const Be=$(ke,ee+nt,et);if(!N(ie,ue,Mt,Be,bc(ke,ee+nt)))return Re(ee+nt),{x:Mt,y:Be}}const Ce=k(ke,Qe,et);_e?Re(ee):Fe?Fe(()=>Vn(ie,ue,ue.y+ue.height/2)):Vn(ie,ue,Ce);let qe=Mt;for(let nt=0;nt<64;nt++){const Be=N(ie,ue,qe,Ce);if(!Be)break;qe=Be.x+Be.width+we+ue.width/2}return{x:qe,y:Ce}},z=(ie,ue,ke)=>{const Qe=r.getAll().filter(et=>{var st;return/Association$/.test(et.type)&&(((st=et.waypoints)==null?void 0:st.length)??0)>=2});if(!Qe.length)return ke;const Mt=et=>{const st={id:ue.id,type:ue.type,x:et-ue.width/2,y:ke.y-ue.height/2,width:ue.width,height:ue.height};return Qe.some(Fe=>Fe.waypoints.some((_e,Re)=>!!Fe.waypoints[Re+1]&&Tr(_e,Fe.waypoints[Re+1],st)<=fe))};if(!Mt(ke.x))return ke;for(let et=Ie;et<=Se;et+=Ie){const st=ke.x+et;if(!Mt(st)&&!N(ie,ue,st,ke.y))return{x:st,y:ke.y}}return ke},H=new Set(_.flows.map(ie=>ie.flow.target)),Q=new Map,ne=ie=>{if(ie===void 0)return;const ue=r.get(ie);if(!(!ue||typeof ue.x!="number"||typeof ue.width!="number"))return ue.x+ue.width+we},he=ie=>{if(Z(ie)>0)return;const ue=_.flows.filter(Qe=>Qe.flow.source===ie);if(ue.length!==1)return;const ke=r.get(ue[0].flow.target);return ke&&typeof ke.y=="number"&&typeof ke.height=="number"?ke.y+ke.height/2:void 0};for(const ie of _.nodes){if(H.has(ie.node.id))continue;const ue=Pg(ie.node,ie.band,ie.afterColumn),ke=le(ie),Qe=ie.node.lane?`${ie.node.lane}|${ke??""}`:ke!==void 0?`band:${ke}`:"",Mt=I(ie.node),et=Q.get(Qe)??O,st=ne(ie.afterColumn),Fe=st===void 0?et:Math.max(et,st);let _e;const Re=B(Mt,ue,ie.node.lane,ke,Fe,L,he(ie.node.id),wn.has(ie.node.id)&&ie.node.participant!==void 0?ee=>_e=ee:void 0);if(_e?n.createShape(ue,Re,Mt,{autoResize:!1}):n.createShape(ue,Re,Mt),_e){const ee=ie.node.lane?d(ie.node.lane):Mt;Lo.set(ie.node.id,{container:ee,relCy:Re.y-ee.y,grow:_e})}Q.set(Qe,Re.x+ue.width+we),!ie.node.lane&&ke===void 0&&(L+=160)}const oe=new Set,se=new Map,Me=new Map,de=new Map;if(b&&C.has(`pool:${b}`)){const ie=new Map;for(const _e of _.flows)ie.set(_e.flow.target,(ie.get(_e.flow.target)??0)+1);const ue=_e=>k(_e.node.lane,Ve(_e),Number.NaN),ke=new Set,Qe=_e=>{var Ce;const Re=(Ce=P.get(_e))==null?void 0:Ce.node.participant;if(Re)return f(Re);const ee=f(_e);if(ee)return ee.type==="bpmn:Participant"?ee:g(ee)},Mt=_e=>{const Re=[],ee=new Set([_e]),Ce=[_e];for(;Ce.length;){const qe=Ce.shift(),nt=P.get(qe);nt&&Re.push(nt);for(const Be of _.flows)Be.flow.source!==qe||ee.has(Be.flow.target)||(ie.get(Be.flow.target)??0)!==1||(ee.add(Be.flow.target),Ce.push(Be.flow.target))}return Re},et=_e=>{if(!R)return;const Re=new Set(_e.map(qe=>qe.node.id));let ee=!1,Ce=!1;for(const qe of v){if(!Re.has(qe.flow.source))continue;const nt=Qe(qe.flow.target);!nt||nt.id===R.id||(nt.y<R.y?ee=!0:Ce=!0)}return ee&&!Ce?"up":Ce&&!ee?"down":void 0};for(const _e of _.nodes){if(!Tg(_e.node.type))continue;const Re=k(_e.node.lane,le(_e),Number.NaN);if(Number.isNaN(Re))continue;const ee=[];for(const Be of _.flows){if(Be.flow.source!==_e.node.id)continue;const lt=P.get(Be.flow.target);if(!lt||lt.node.lane!==_e.node.lane||(ie.get(lt.node.id)??0)!==1)continue;const bt=le(lt);if(bt===void 0)continue;const Gt=k(lt.node.lane,bt,Number.NaN);if(Number.isNaN(Gt))continue;const Sn=Mt(lt.node.id),_t=et(Sn);_t&&ee.push({subtree:Sn,band:bt,row:Gt,dir:_t})}if(!ee.some(Be=>Be.dir==="up")||!ee.some(Be=>Be.dir==="down")||!ee.some(Be=>Be.dir==="up"&&ee.some(lt=>lt.dir==="down"&<.row<Be.row)))continue;const qe=[...ee].sort((Be,lt)=>Be.row-lt.row);[...ee.filter(Be=>Be.dir==="up"),...ee.filter(Be=>Be.dir==="down")].sort((Be,lt)=>Be.dir===lt.dir?Be.row-lt.row:Be.dir==="up"?-1:1).forEach((Be,lt)=>{const bt=qe[lt].band;if(bt!==Be.band){ke.add(_e.node.id);for(const Gt of Be.subtree)le(Gt)===Be.band&&Te.set(Gt.node.id,bt)}})}const st=_e=>{if(!R)return;const Re=new Set(_e.map(qe=>qe.node.id));let ee=!1,Ce=!1;for(const qe of v){if(!Re.has(qe.flow.target))continue;const nt=Qe(qe.flow.source);!nt||nt.id===R.id||(nt.y<R.y?ee=!0:Ce=!0)}return ee&&!Ce?"up":Ce&&!ee?"down":void 0};for(const _e of _.nodes){if(!Tg(_e.node.type))continue;const Re=_e.node.lane??`pool:${b}`,ee=V.get(Re);if(!ee||ee.size<2)continue;const Ce=ee.get(0);if(Ce===void 0)continue;const qe=Math.max(...ee.values()),nt=Ce===qe&&Ce!==0?"down":void 0;if(!nt)continue;const Be=[];for(const _t of _.flows){if(_t.flow.source!==_e.node.id)continue;const Wn=P.get(_t.flow.target);if(!Wn||Wn.node.lane!==_e.node.lane||(ie.get(Wn.node.id)??0)!==1)continue;const ns=Ve(Wn);ns!==void 0&&Be.push({t:Wn,subtree:Mt(Wn.node.id),band:ns})}const lt=Be.find(_t=>(ee.get(_t.band)??_t.band)===Ce);if(!lt||st(lt.subtree)===nt||et(lt.subtree)===nt)continue;const bt=Be.find(_t=>_t!==lt&&st(_t.subtree)===nt);if(!bt)continue;const Gt=lt.band,Sn=bt.band;for(const _t of lt.subtree)Ve(_t)===Gt&&Te.set(_t.node.id,Sn);for(const _t of bt.subtree)Ve(_t)===Sn&&Te.set(_t.node.id,Gt);ke.add(_e.node.id)}for(const _e of _.nodes){if(!Tg(_e.node.type))continue;const Re=ue(_e);if(Number.isNaN(Re)||A.some(Be=>{var lt,bt;return(((lt=Be.placement)==null?void 0:lt.anchor)??(Be.association?Be.association.source===Be.annotation.id?Be.association.target:Be.association.source:void 0))===_e.node.id&&((bt=Be.placement)==null?void 0:bt.side.startsWith("bottom"))}))continue;let Ce,qe=!1,nt;for(const Be of _.flows){if(Be.flow.source!==_e.node.id)continue;const lt=P.get(Be.flow.target);if(!lt||!lt.node.lane&&le(lt)===void 0)continue;const bt=ue(lt);Number.isNaN(bt)||(Math.abs(bt-Re)<.5&&(qe=!0),bt>Re?!Ce||bt>Ce.row?Ce={id:lt.node.id,row:bt,count:1}:bt===Ce.row&&Ce.count++:bt<Re&<.node.lane===_e.node.lane&&(!nt||bt>nt.row?nt={op:lt,row:bt,count:1}:bt===nt.row&&nt.count++))}Ce&&Ce.count===1&&(ie.get(Ce.id)??0)===1&&!ke.has(_e.node.id)&&oe.add(Ce.id),!qe&&nt&&nt.count===1&&(ie.get(nt.op.node.id)??0)===1&&!wt.has(_e.node.id)&&se.set(nt.op.node.id,{lane:_e.node.lane,band:Ve(_e)})}const Fe=new Map;for(const _e of v)Fe.set(_e.flow.target,[...Fe.get(_e.flow.target)??[],_e]);for(const _e of _.nodes){const Re=Fe.get(_e.node.id);if(!Re||Re.length!==1||!ie.get(_e.node.id)||!_e.node.lane&&le(_e)===void 0||Qt.has(_e.node.id))continue;const ee=(iS=P.get(Re[0].flow.source))==null?void 0:iS.node.participant,Ce=ee?f(ee):void 0;if(!Ce||!R||Ce.id===R.id)continue;const qe=_e.node.lane??`pool:${b}`,nt=V.get(qe);if(!nt)continue;const Be=nt.get(0)??0,lt=(nt.get(Ve(_e)??0)??Be)-Be;if(lt===0)continue;const bt=Ce.y<R.y;if(bt&<<0||!bt&<>0)continue;let Gt;for(const[Sn,_t]of nt){if(Pt.has(Sn))continue;const Wn=_t-Be;(bt&&Wn<0&&(!Gt||Wn<Gt.row)||!bt&&Wn>0&&(!Gt||Wn>Gt.row))&&(Gt={band:Sn,row:Wn})}Gt&&Me.set(_e.node.id,{lane:_e.node.lane,band:Gt.band})}}const pe=new Set;let ge=0;for(;ge++<_.nodes.length+2;){for(let ke=0;ke<_.nodes.length+_.flows.length+2;ke++){let Qe=!1;for(const Mt of _.flows){const et=Mt.flow;if(pe.has(et.id))continue;const st=f(et.source);if(!st)continue;const Fe=f(et.target),_e=P.get(et.target);if(!Fe&&_e){const Re=Pg(_e.node,_e.band),ee=Ve(_e);if(_e.node.lane||ee!==void 0){const Ce=I(_e.node),qe=st,nt=qe.x+(de.get(et.source)??0)+qe.width+we,Be=se.get(et.target)??Me.get(et.target),lt=B(Ce,Re,Be?Be.lane:_e.node.lane,Be?Be.band:ee,oe.has(et.target)?qe.x+qe.width/2:nt,Number.NaN,Be||!bi(et.target)?void 0:qe.y+qe.height/2),bt=P.has(et.source)?lt:z(Ce,Re,lt),Gt=n.createShape(Re,bt,Ce);oe.has(et.target)&&de.set(et.target,nt-(Gt.x+Gt.width/2)),n.connect(st,Gt,{type:"bpmn:SequenceFlow",businessObject:yp(et)})}else s.append(st,Re,{connection:{type:"bpmn:SequenceFlow",businessObject:yp(et)}})}else if(Fe)n.connect(st,Fe,{type:"bpmn:SequenceFlow",businessObject:yp(et)});else continue;pe.add(et.id),Qe=!0}if(!Qe)break}const ie=_.nodes.filter(ke=>!f(ke.node.id));if(!ie.length)break;const ue=ie[0];{const ke=Pg(ue.node,ue.band),Qe=I(ue.node),Mt=le(ue);n.createShape(ke,B(Qe,ke,ue.node.lane,Mt,O,L),Qe),!ue.node.lane&&Mt===void 0&&(L+=160)}}}const R1=new Map;for(const[b,_]of T){const R=f(b),O=f(_.flow.target);if(!(R!=null&&R.target)||!O)continue;const L=R.label&&{x:R.label.x,y:R.label.y,width:R.label.width,height:R.label.height};R1.set(b,{waypoints:R.waypoints.map(I=>({x:I.x,y:I.y})),label:L});const k=R.target,$=I=>({x:I.x+I.width/2,y:I.y+I.height/2});n.reconnect(R,O,k,[$(O),$(k)]),n.layoutConnection(R,{waypoints:[]})}const br=40,g3=10,vp=b=>{const _=H=>H.kind==="label-over-line"||H.kind==="label-over-shape"||H.kind==="label-on-shared-segment"?H.edge===b.id:H.kind==="annotation-over-label"||H.kind==="pool-name-over-label"?H.label===b.id:!1,R=()=>new Map(ft(ze(r)).filter(H=>!_(H)).map(H=>[pt(H),H])),O=R(),L=H=>[...H].filter(([Q])=>!O.has(Q)).map(([,Q])=>Q),k=H=>L(H).length<=[...O.keys()].filter(Q=>!H.has(Q)).length,$=b.waypoints.map(H=>({x:H.x,y:H.y})),I=b.label,B=I&&{x:I.x,y:I.y};n.layoutConnection(b,{waypoints:[]});const z=R();if(!k(z)){if(L(z).every(H=>H.kind==="edge-crosses-shape"&&H.edge===b.id)){const H=ze(r),Q=H.edges.find(se=>se.id===b.id),ne=Hn(H),he=Q?Vt(Q,ne):[],oe=Q&&he.length&&!he.every(se=>se.type==="bpmn:TextAnnotation")?Yc(Q,ne,Kc(b),H.edges):null;if(oe&&(n.updateWaypoints(b,oe),k(R())))return}n.updateWaypoints(b,$),I&&B&&(I.x!==B.x||I.y!==B.y)&&n.moveElements([I],{x:B.x-I.x,y:B.y-I.y})}},kg=5,Ii=10,C1=200,wc=new Set([...F.map(b=>b.flow.id),...v.map(b=>b.flow.id),...qt(e,"sequenceFlow.update").map(b=>b.id),...qt(e,"messageFlow.update").map(b=>b.id)].filter(b=>!!b)),m3=(b,_,R,O,L,k)=>{const $=new Set(b.map(pe=>pe.id)),I=Math.min(...b.map(pe=>pe.x))+_-Ii,B=Math.max(...b.map(pe=>pe.x+pe.width))+_+C1+Ii,z=Math.min(...b.map(pe=>pe.y+Math.min(0,...R)))-Ii,H=Math.max(...b.map(pe=>pe.y+pe.height+Math.max(0,...R)))+Ii,Q=r.getAll().filter(pe=>{if(pe.type!=="bpmn:SequenceFlow"&&pe.type!=="bpmn:MessageFlow")return!1;const ge=pe;return wc.has(ge.id)||!ge.waypoints||ge.waypoints.length<2||[ge.source,ge.target].some(ue=>!ue||$.has(ue.id)||ue.x>=O)?!1:ge.waypoints.some((ue,ke)=>{const Qe=ge.waypoints[ke+1];return!!Qe&&Math.max(ue.x,Qe.x)>=I&&Math.min(ue.x,Qe.x)<=B&&Math.max(ue.y,Qe.y)>=z&&Math.min(ue.y,Qe.y)<=H})});if(!Q.length)return 0;const ne=pe=>{const ge=new Map;for(const ie of b)for(const ue of R){const ke={id:ie.id,type:ie.type,x:ie.x+_+pe,y:ie.y+ue,width:ie.width,height:ie.height};for(const Qe of Q){let Mt=1/0;for(let st=0;st+1<Qe.waypoints.length;st++)Mt=Math.min(Mt,Tr(Qe.waypoints[st],Qe.waypoints[st+1],ke));const et=`${Qe.id}|${ie.id}`;ge.set(et,Math.min(ge.get(et)??1/0,Mt))}}return ge},he=[...ne(0)].filter(([,pe])=>pe<=kg).map(([pe])=>pe);if(!he.length)return 0;let oe=0;for(let pe=1;pe<=C1;pe++){const ge=ne(pe);if([...ge.values()].every(ie=>ie>kg)&&he.every(ie=>(ge.get(ie)??1/0)>=Ii)){oe=pe;break}}if(!oe)return 0;const se=Math.min(...b.map(pe=>pe.x))+_+oe,Me=new Set(he.map(pe=>pe.slice(0,pe.indexOf("|"))));return Q.some(pe=>pe.type==="bpmn:SequenceFlow"&&Me.has(pe.id)&&pe.waypoints.some((ge,ie)=>{const ue=pe.waypoints[ie+1];if(!ue||Math.min(ge.y,ue.y)>k||Math.max(ge.y,ue.y)<k||ge.y===ue.y)return!1;const ke=ge.x+(k-ge.y)*(ue.x-ge.x)/(ue.y-ge.y);return ke>L&&ke<se}))?0:oe},Kr=(b,_=()=>!0)=>{const R=f(b);if(!R)return[];const O=[R],L=new Set([b]);for(let k=0;k<O.length;k++){const $=O[k].id;for(const I of F){const B=I.flow.target;if(I.flow.source!==$||L.has(B)||!P.has(B))continue;L.add(B);const z=f(B);z&&_(z)&&O.push(z)}}return O},y3=(b,_=()=>!0)=>{const R=f(b);if(!R)return[];const O=[R],L=new Set([b]);for(let k=0;k<O.length;k++){const $=O[k].id;for(const I of F){const B=I.flow.source;if(I.flow.target!==$||L.has(B)||!P.has(B))continue;L.add(B);const z=f(B);z&&_(z)&&O.push(z)}}return O},Bi=30,Ni=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",Qa=(b,_)=>Sf(n,b,_),Ja=(b,_,R=!1)=>{const O=new Set(b.flatMap(B=>B.subtree.map(z=>z.id)));for(const B of b){const z=(B.pool.children??[]).filter(Ni).filter(Q=>!O.has(Q.id));if(B.subtree.some(Q=>z.some(ne=>Q.x+_<ne.x+ne.width+Bi&&Q.x+_+Q.width+Bi>ne.x&&Q.y<ne.y+ne.height&&Q.y+Q.height>ne.y)))return null}const L=b.map(B=>B.pool.width),k=R?r.filter(B=>Array.isArray(B.waypoints)).map(B=>({c:B,wps:B.waypoints.map(z=>({x:z.x,y:z.y}))})):[],$=r.filter(B=>B.type==="label").map(B=>({label:B,x:B.x,y:B.y}));n.moveElements(b.flatMap(B=>B.subtree),{x:_,y:0});const I=b.map(B=>{const H=Math.max(...B.subtree.map(Q=>Q.x+Q.width))+Dy-(B.pool.x+B.pool.width);return H>0&&Qa(B.pool,B.pool.width+H),H});return()=>{n.moveElements(b.flatMap(B=>B.subtree),{x:-_,y:0}),b.forEach((B,z)=>{I[z]>0&&Qa(B.pool,L[z])});for(const{c:B,wps:z}of k){const H=B.waypoints??[];H.length===z.length&&H.every((ne,he)=>Math.abs(ne.x-z[he].x)<=.5&&Math.abs(ne.y-z[he].y)<=.5)||n.updateWaypoints(B,z.map(ne=>({x:ne.x,y:ne.y})))}for(let B=0;B<3;B++){let z=0;for(const H of $){const Q=H.x-H.label.x,ne=H.y-H.label.y;Math.abs(Q)<=.5&&Math.abs(ne)<=.5||(n.moveElements([H.label],{x:Q,y:ne}),z++)}if(!z)break}}},Og=b=>{var L,k;const _=new Map,R=new Map;for(const $ of r.getAll()){if($.type!=="bpmn:Participant")continue;const I=$;(I.children??[]).length||(_.set(I.id,I),R.set(I.id,[]))}for(const $ of r.getAll()){if($.type!=="bpmn:MessageFlow")continue;const I=$,B=(L=I.source)==null?void 0:L.id,z=(k=I.target)==null?void 0:k.id;B&&z&&R.has(B)&&R.get(B).push(z),B&&z&&R.has(z)&&R.get(z).push(B)}const O=[];for(const[$,I]of R)I.length&&I.every(B=>b.has(B))&&O.push(_.get($));return O},M1=(b,_)=>{if(!b.length)return null;const R=new Set(b.map(H=>H.id)),O=r.getAll().filter(H=>H.type==="bpmn:Participant"&&!R.has(H.id)),L=Math.min(...O.filter(H=>(H.children??[]).length>0).map(H=>H.x)),k=new Set(b.filter(H=>Math.abs(H.x-L)<=2).map(H=>H.id));if(b.some(H=>{const Q=k.has(H.id)?H.x:H.x+_,ne=k.has(H.id)?H.width+_:H.width;return O.some(he=>Q<he.x+he.width+Bi&&Q+ne+Bi>he.x&&H.y<he.y+he.height&&H.y+H.height>he.y)}))return null;const I=r.filter(H=>H.type==="label").map(H=>({label:H,x:H.x,y:H.y})),B=b.filter(H=>!k.has(H.id)),z=b.filter(H=>k.has(H.id)).map(H=>({pool:H,was:{x:H.x,y:H.y,width:H.width,height:H.height}}));B.length&&n.moveElements(B,{x:_,y:0});for(const{pool:H,was:Q}of z)n.resizeShape(H,{...Q,width:Q.width+_});return()=>{for(const{pool:H,was:Q}of z)n.resizeShape(H,Q);B.length&&n.moveElements(B,{x:-_,y:0});for(let H=0;H<3;H++){let Q=0;for(const ne of I){const he=ne.x-ne.label.x,oe=ne.y-ne.label.y;Math.abs(he)<=.5&&Math.abs(oe)<=.5||(n.moveElements([ne.label],{x:he,y:oe}),Q++)}if(!Q)break}}},A1=(b,_,R)=>{const O=R.x+R.width/2,L=_.y>R.y,k=L?R.y+R.height:R.y,$=L?_.y:_.y+_.height,I=b.source===_?[{x:O,y:$},{x:O,y:k}]:[{x:O,y:k},{x:O,y:$}],B=ze(r),z={...B.edges.find(H=>H.id===b.id),waypoints:I};return Vt(z,Hn(B)).length?!1:(n.updateWaypoints(b,I),!0)},v3=()=>{const b=r.filter($=>$.type==="bpmn:Participant"),_=Math.min(...b.filter($=>($.children??[]).length>0).map($=>$.x)),R=$=>m.some(I=>I.participant.id===$.id),O=$=>!!$&&$.type==="bpmn:Participant"&&!($.children??[]).length&&Math.abs($.x-_)<=2&&!R($),L=$=>!!$&&$.type==="bpmn:Participant"&&($.children??[]).length>0&&!R($),k=new Set;for(const $ of r.getAll()){if($.type!=="bpmn:MessageFlow")continue;const I=$;if((I.waypoints??[]).length!==2)continue;const B=[I.source,I.target].find(Q=>O(Q)||L(Q)),z=B===I.source?I.target:I.source;if(!B||!z||z.type==="bpmn:Participant")continue;const H=z.x+z.width/2;L(B)&&(H<B.x||H>B.x+B.width)||k.add(I.id)}return k},b3=b=>{var R;const _=new Map;for(const O of b){const L=r.get(O);if(!L||(L.waypoints??[]).length===2)continue;const k=((R=L.source)==null?void 0:R.type)==="bpmn:Participant"?L.source:L.target,$=k===L.source?L.target:L.source;if($.x+$.width/2<=k.x+k.width)continue;const I=_.get(k.id)??{pool:k,msgs:[]};I.msgs.push({conn:L,other:$}),_.set(k.id,I)}for(const{pool:O,msgs:L}of _.values()){const k=Math.max(...L.map(({other:oe})=>oe.x+oe.width/2))+_f;if(r.getAll().some(oe=>{if(oe.type!=="bpmn:Participant"||oe.id===O.id)return!1;const se=oe;return O.x<se.x+se.width+Bi&&k+Bi>se.x&&O.y<se.y+se.height&&O.y+O.height>se.y}))continue;const I={x:O.x,y:O.y,width:O.width,height:O.height},B=[...O.incoming??[],...O.outgoing??[]],z=B.map(oe=>({c:oe,wps:(oe.waypoints??[]).map(se=>({x:se.x,y:se.y}))})),H=B.flatMap(oe=>{const se=oe.label;return se?[{label:se,x:se.x,y:se.y}]:[]}),Q=xr();Qa(O,k-O.x);const ne=L.filter(({conn:oe,other:se})=>A1(oe,O,se)).length,he=xr();if(!(ne>0&&he.messages>Q.messages&&he.lines>=Q.lines)){Qa(O,I.width);for(const{c:oe,wps:se}of z){const Me=oe.waypoints??[];Me.length===se.length&&Me.every((pe,ge)=>Math.abs(pe.x-se[ge].x)<=.5&&Math.abs(pe.y-se[ge].y)<=.5)||n.updateWaypoints(oe,se.map(pe=>({x:pe.x,y:pe.y})))}for(let oe=0;oe<3;oe++){let se=0;for(const Me of H){const de=Me.x-Me.label.x,pe=Me.y-Me.label.y;Math.abs(de)<=.5&&Math.abs(pe)<=.5||(n.moveElements([Me.label],{x:de,y:pe}),se++)}if(!se)break}}}},P1=()=>{let b=0;for(const _ of r.getAll()){if(_.type!=="bpmn:DataInputAssociation"&&_.type!=="bpmn:DataOutputAssociation")continue;const R=_.waypoints??[];for(let O=1;O<R.length;O++)b+=Math.hypot(R[O].x-R[O-1].x,R[O].y-R[O-1].y)}return b},T1=()=>{let b=0;for(const _ of r.getAll()){if(_.type!=="bpmn:Association")continue;const R=_.waypoints??[];for(let O=1;O<R.length;O++)b+=Math.hypot(R[O].x-R[O-1].x,R[O].y-R[O-1].y)}return b},x3=b=>{const _=[];for(const R of r.getAll()){if(R.type!=="bpmn:TextAnnotation")continue;const O=R;if(b.has(O.id))continue;const k=[...O.incoming??[],...O.outgoing??[]].filter(B=>B.type==="bpmn:Association").map(B=>B.source===O?B.target:B.source);if(!k.length||k.some(B=>B===void 0))continue;const $=B=>{if(!("waypoints"in B&&B.waypoints))return[B.id];const z=B,H=[z.source,z.target];return H.some(Q=>!Q)?[]:H.map(Q=>Q.id)},I=k.flatMap(B=>$(B));I.length&&I.every(B=>b.has(B))&&_.push(O)}return _},k1=()=>ft(ze(r)).filter(b=>b.kind==="edge-crosses-shape").length,O1=b=>{const _=(b.children??[]).filter(Ni);let R=0;for(let O=0;O<_.length;O++)for(let L=O+1;L<_.length;L++){const k=_[O],$=_[L];k.x<$.x+$.width&&k.x+k.width>$.x&&k.y<$.y+$.height&&k.y+k.height>$.y&&R++}return R},xr=()=>{const b=ze(r),_=R=>R.length>=2&&(R.every(O=>Math.abs(O.x-R[0].x)<.01)||R.every(O=>Math.abs(O.y-R[0].y)<.01));return{messages:b.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length,lines:b.edges.filter(R=>_(R.waypoints)).length}},D1=b=>{const _=new Map;for(const O of r.getAll()){if(O.type!=="bpmn:MessageFlow")continue;const L=O;if(!L.waypoints||L.waypoints.length!==2)continue;const k=L.source,$=L.target;if(!k||!$)continue;const I=b.has(k.id);if(I===b.has($.id))continue;const B=I?$:k,z=g(B);if(!z||b.has(B.id))continue;const H=_.get(z.id);H?B.x<H.minX&&(H.minX=B.x):_.set(z.id,{pool:z,minX:B.x})}const R=[];for(const{pool:O,minX:L}of _.values()){const k=(O.children??[]).filter($=>Ni($)&&!b.has($.id)&&$.x>=L);k.length&&R.push({subtree:k,pool:O})}return R},w3=(b,_,R)=>{const O=new Map(_.map($=>[$.pool.id,{subtree:[...$.subtree],pool:$.pool}])),L=new Set(b);for(const $ of _)for(const I of $.subtree)L.add(I.id);let k=!1;for(;;){let $=0;for(const I of D1(L)){if(I.pool===R)continue;const B=O.get(I.pool.id);B?B.subtree.push(...I.subtree):O.set(I.pool.id,{subtree:[...I.subtree],pool:I.pool});for(const z of I.subtree)L.add(z.id);$+=I.subtree.length}if(!$)break;k=!0}return k?[...O.values()]:null},_3=(b,_)=>{const R=new Map;for(const L of r.getAll()){if(L.type!=="bpmn:DataInputAssociation"&&L.type!=="bpmn:DataOutputAssociation")continue;const k=L,$=k.waypoints;if(!$||$.length<2||!$.every(he=>Math.abs(he.x-$[0].x)<1))continue;const I=k.source,B=k.target;if(!I||!B)continue;const z=b.has(I.id);if(z===b.has(B.id))continue;const H=z?B:I,Q=g(H);if(!Q||Q===_||Q===g(z?I:B))continue;const ne=R.get(Q.id);ne?H.x<ne.minX&&(ne.minX=H.x):R.set(Q.id,{pool:Q,minX:H.x})}const O=[];for(const{pool:L,minX:k}of R.values()){const $=(L.children??[]).filter(I=>Ni(I)&&!b.has(I.id)&&I.x>=k);$.length&&O.push({subtree:$,pool:L})}return O},L1=b=>{const _=ze(r),R=_.shapes.filter(L=>b.has(L.id)),O=new Set;for(const L of _.edges)if(!(L.type!=="bpmn:SequenceFlow"&&L.type!=="bpmn:MessageFlow"))for(const k of Vt(L,R))O.add(`${L.id}|${k.id}`);return O},Dg=new Map,E3=qt(e,"sequenceFlow.update").flatMap(b=>{if(b.target!==void 0)return[{id:b.id,target:b.target,source:b.source}];const _=T.get(b.id);return _?[{id:b.id,target:_.flow.target,source:_.flow.source}]:[]});for(const b of E3){if(b.target===void 0)continue;const _=P.get(b.target);if(!_)continue;const R=f(b.target),O=f(b.id);if(!R||!O)continue;const L=b.source!==void 0?f(b.source):O.source,k=O.target;if(!L||!k||k.id===R.id)continue;const $=R1.get(O.id)??{waypoints:O.waypoints,label:O.label},I=$.waypoints&&$.waypoints.length>=3&&Math.abs($.waypoints[0].x-$.waypoints[1].x)<1&&Math.abs($.waypoints[0].y-$.waypoints[1].y)>1?{x:$.waypoints[0].x,y:$.waypoints[0].y}:void 0,B=I?$.waypoints[1].y:void 0,z=I&&$.label?{x:$.label.x,y:$.label.y}:void 0,H=z&&$.label&&Math.abs(z.y+$.label.height/2-B)<=ae/5&&z.x+$.label.width>I.x?z.x+$.label.width+6:void 0,Q=(L.outgoing??[]).filter(Ae=>Ae.type==="bpmn:SequenceFlow"&&Ae.id!==O.id&&Ae.target&&!wc.has(Ae.id)),ne=new Set(Q.map(Ae=>Ae.target.id)),he=Ae=>{const Tt={type:"bpmn:Task",x:Ae.x+2,y:Ae.y+2,width:Ae.width-4,height:Ae.height-4};return Q.find(xt=>(xt.waypoints??[]).some((Jt,Le)=>!!xt.waypoints[Le+1]&&Tr(Jt,xt.waypoints[Le+1],Tt)===0))},oe=Kr(b.target),se=new Set(oe.map(Ae=>Ae.id)),Me=Lo.has(b.target)?{autoResize:!1}:void 0,de=Math.min(...oe.map(Ae=>Ae.x)),pe=Math.max(...oe.map(Ae=>Ae.x+Ae.width)),ge=L.x+L.width,ie=k.x+k.width<=L.x,ue=(()=>{if(!ie)return;const Ae=g(R),Tt=((Ae==null?void 0:Ae.children)??[]).filter($e=>Ni($e)&&!se.has($e.id)&&$e.type!=="bpmn:Group"&&$e.type!=="bpmn:Participant"),xt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Jt=r.getAll().filter($e=>{if(!xt.includes($e.type))return!1;const Ft=$e;return Ft.id===O.id||wc.has(Ft.id)||!Ft.waypoints||Ft.waypoints.length<2?!1:![Ft.source,Ft.target].some(Dt=>!Dt||se.has(Dt.id))}),Le=($e,Ft)=>oe.every(Dt=>{var ea;const Rt={id:Dt.id,type:Dt.type,x:Dt.x+$e,y:Dt.y+Ft,width:Dt.width,height:Dt.height};return Ae&&(Rt.x<Ae.x||Rt.x+Rt.width>Ae.x+Ae.width||Rt.y<Ae.y||Rt.y+Rt.height>Ae.y+Ae.height)||!Kn((ea=P.get(Dt.id))==null?void 0:ea.node.lane,Dt,Dt.y+Ft+Dt.height/2)||Tt.some(Xn=>Rt.x<Xn.x+Xn.width+Ii&&Rt.x+Rt.width+Ii>Xn.x&&Rt.y<Xn.y+Xn.height+Ii&&Rt.y+Rt.height+Ii>Xn.y)?!1:Jt.every(Xn=>{for(let fo=0;fo+1<Xn.waypoints.length;fo++)if(Tr(Xn.waypoints[fo],Xn.waypoints[fo+1],Rt)<Ii)return!1;return!0})}),We=L.x+L.width/2,mt=L.y+L.height/2,tt=$.waypoints??[],Ot=tt.length>=2&&Math.abs(tt[0].y-tt[1].y)<1&&tt[1].x<tt[0].x;return[...B!==void 0?[{cx:We,cy:B}]:[],...Ot?[{cx:L.x-br-R.width/2,cy:tt[0].y}]:[],{cx:We,cy:mt+ae},{cx:We,cy:mt-ae}].find($e=>Le($e.cx-(R.x+R.width/2),$e.cy-(R.y+R.height/2)))})(),ke=ie&&!ue?ge:k.x,Qe=(()=>{var mt;if(I||ie)return 0;const Ae=$.label,Tt=((mt=O.businessObject)==null?void 0:mt.name)??"";if(!Ae||Ae.width==null||!Tt.trim())return 0;const xt=ge+br,Jt=L.y+L.height/2-R.height/2;if(Math.min(Ae.y+Ae.height,Jt+R.height)-Math.max(Ae.y,Jt)<3||Ae.x+Ae.width-xt<3)return 0;const We=Ae.x+Ae.width+g3-xt;return We<=R.width?We:0})();Qe>0&&u.add(O.id);const Mt=R.y+R.height/2,et=m3(oe,ge+br+Qe-de,[0,L.y+L.height/2-Mt,k.y+k.height/2-Mt],ke,ge,L.y+L.height/2),st=ge+br+Qe+et,Fe=(()=>{if(H===void 0)return 0;const Ae=ge+br,Tt=L.y+L.height/2-R.height/2,xt={x:Ae,y:Tt,width:pe-de,height:R.height},Jt=g(L);return((Jt==null?void 0:Jt.children)??[]).some(We=>Ni(We)&&!se.has(We.id)&&We.id!==L.id&&We.id!==k.id&&We.type!=="bpmn:Group"&&We.type!=="bpmn:Participant"&&We.x<xt.x+xt.width&&We.x+We.width>xt.x&&We.y<xt.y+xt.height&&We.y+We.height>xt.y)||he(xt)?Math.max(0,H-Ae):0})(),_e=ue?0:pe-de+br*2+et+Fe+Qe-(ie?0:k.x-ge);let Re=[];if(_e>0){const Ae=g(R),Tt=(Ae==null?void 0:Ae.children)??[],xt=tt=>tt.type==="bpmn:Lane";Re=(()=>{const tt=new Set;for(const He of Tt)Ni(He)&&!se.has(He.id)&&He.id!==L.id&&He.x>=ke&&tt.add(He.id);const Ot=[];for(const He of Tt){if(He.type!=="bpmn:DataStoreReference"&&He.type!=="bpmn:DataObjectReference")continue;const $e=He,Dt=[...$e.incoming??[],...$e.outgoing??[]].filter(Rt=>Rt.type==="bpmn:DataInputAssociation"||Rt.type==="bpmn:DataOutputAssociation").map(Rt=>Rt.source===$e?Rt.target:Rt.source);Dt.length&&Dt.every(Rt=>Rt!==void 0&&tt.has(Rt.id))&&Ot.push($e)}return Ot})();const Le=Tt.filter(tt=>!("waypoints"in tt&&tt.waypoints)&&!xt(tt)&&tt.type!=="label"&&!se.has(tt.id)&&tt.id!==L.id&&tt.x>=ke),We=Le.flatMap(tt=>tt.labels??[]),mt=Ae?[Ae,...Tt.filter(tt=>xt(tt))]:[];if(Le.length){const tt=new Set(Le.map(ot=>ot.id)),Ot=D1(tt),He=Ot.length?w3(tt,Ot,Ae):null,$e=ot=>{const Ct=new Set(tt);for(const jt of ot)for(const Io of jt.subtree)Ct.add(Io.id);return x3(Ct)},Ft=$e(Ot),Dt=He?$e(He):Ft,Rt=Og(tt),ea=new Set(tt);for(const ot of Ot)for(const Ct of ot.subtree)ea.add(Ct.id);const Xn=Ot.length?Og(ea):Rt,fo=(()=>{if(!He)return[];const ot=new Set(tt);for(const Ct of He)for(const jt of Ct.subtree)ot.add(jt.id);return Og(ot)})(),is=He??Ot,ta=(()=>{const ot=new Set(tt);for(const Ct of is)for(const jt of Ct.subtree)ot.add(jt.id);return _3(ot,Ae)})(),jg=ta.length?$e([...is,...ta]):Ft,qi=new Set([...Le,...mt].map(ot=>ot.id)),Et=Tt.filter(ot=>{const Ct=ot.labelTarget;return ot.type==="label"&&!!Ct&&"waypoints"in Ct&&!!Ct.source&&!!Ct.target&&qi.has(Ct.source.id)&&qi.has(Ct.target.id)}),Rn=v3();n.createSpace([...Le,...We,...Et],mt,{x:_e,y:0},"e",ke-1);const en=(ot,Ct,jt)=>{const Io=xr(),Sp=jt?L1(jt):null,Rp=Ja(ot,_e,!!jt);if(!Rp)return!1;const Sc=Ct.length?M1(Ct,_e):null,Cp=xr(),tn=!!jt&&!!Sp&&[...L1(jt)].some(ia=>!Sp.has(ia));return Cp.messages>Io.messages&&Cp.lines>=Io.lines&&!tn?!0:(Sc==null||Sc(),Rp(),!1)},fi=ta.length>0&&en([...is,...ta],He?fo:Xn,new Set(ta.flatMap(ot=>ot.subtree.map(Ct=>Ct.id)))),na=!fi&&He?en(He,fo):!1;let ho=fi||na;!ho&&Ot.length&&(ho=en(Ot,Xn));const os=fi?jg:na?Dt:Ft;if(!ho){for(const ot of Ot){const Ct=xr(),jt=Ja([ot],_e);if(!jt)continue;const Io=xr();(Io.messages<=Ct.messages||Io.lines<Ct.lines)&&jt()}if(Rt.length){const ot=xr(),Ct=M1(Rt,_e);if(Ct){const jt=xr();(jt.messages<=ot.messages||jt.lines<ot.lines)&&Ct()}}}if(b3(Rn),os.length){const ot=()=>new Set(ft(ze(r)).map(jt=>pt(jt))),Ct=jt=>{const Io=T1(),Sp=ot(),Rp=jt.map(tn=>({a:tn,x:tn.x,y:tn.y})),Sc=r.filter(tn=>tn.type==="label").map(tn=>({label:tn,x:tn.x,y:tn.y}));n.moveElements(jt,{x:_e,y:0});const Cp=[...ot()].filter(tn=>!Sp.has(tn));if(T1()<Io&&Cp.length===0)return!0;for(const{a:tn,x:ia,y:Rc}of Rp)(tn.x!==ia||tn.y!==Rc)&&n.moveElements([tn],{x:ia-tn.x,y:Rc-tn.y});for(const tn of Sc){const ia=tn.x-tn.label.x,Rc=tn.y-tn.label.y;(ia!==0||Rc!==0)&&n.moveElements([tn.label],{x:ia,y:Rc})}return!1};if(!Ct(os)&&os.length>1)for(const jt of os)Ct([jt])}}}const ee=_.node.lane!==void 0?f(_.node.lane):_.node.participant!==void 0?f(_.node.participant):void 0,Ce=Ae=>{if(!ee)return!0;const Tt=Ae.y+Ae.height/2;return Tt>=ee.y&&Tt<=ee.y+ee.height},qe=!Ce(L)&&Ce(k),nt=Ae=>Ae.y+Ae.height/2,Be=()=>{const Ae=L.x+L.width,Tt=k.x,xt=nt(k)-R.height/2,Jt=nt(k)+R.height/2;return!r.getAll().some(Le=>Ni(Le)&&Le.type!=="bpmn:Participant"&&Le.type!=="bpmn:Group"&&Le.type!=="bpmn:TextAnnotation"&&Le.id!==L.id&&Le.id!==k.id&&Le.id!==R.id&&Le.x<Tt&&Le.x+Le.width>Ae&&Le.y<Jt&&Le.y+Le.height>xt)},lt=!qe&&_.band!==void 0&&Ce(k)&&!gn(_.node.lane,_.node.participant,_.band,nt(L))&&gn(_.node.lane,_.node.participant,_.band,nt(k))&&k.x>=L.x+L.width&&Be(),bt=qe||lt?k:L,Gt=bt.y+bt.height/2,Sn=Gt-(R.y+R.height/2),_t=_.band!==void 0,Wn=_t?[R]:oe,ns=(_.band===void 0||gn(_.node.lane,_.node.participant,_.band,Gt))&&bi(b.target)&&Wn.every(Ae=>{var Tt;return Kn((Tt=P.get(Ae.id))==null?void 0:Tt.node.lane,Ae,Ae.y+Ae.height/2+Sn)}),U3=Ae=>Math.abs(Ae.y+Ae.height/2-(R.y+R.height/2))<=ae/2;if(ns&&_t){const Ae=Math.abs(Sn)<=ae/2?oe.filter(Le=>Le.id!==R.id&&U3(Le)):[],Tt=R.y+R.height/2,Jt=_.band!==void 0&&!gn(_.node.lane,_.node.participant,_.band,Tt)?oe.filter(Le=>{var We,mt;return Le.id!==R.id&&!Ae.includes(Le)&&((We=P.get(Le.id))==null?void 0:We.band)===_.band&&((mt=P.get(Le.id))==null?void 0:mt.node.lane)===_.node.lane&&(Math.abs(Le.y+Le.height/2-Tt)<=ae/2||gn(_.node.lane,_.node.participant,_.band,Le.y+Le.height/2))}).map(Le=>({t:Le,dy:Gt-(Le.y+Le.height/2)})).filter(({dy:Le})=>Le!==0):[];if(n.moveElements(oe,{x:st-de,y:0},void 0,Me),n.moveElements([R],{x:0,y:Sn},void 0,Me),Ae.length){const Le=()=>new Set(ft(ze(r)).map($e=>pt($e))),We=Le(),mt=r.filter($e=>$e.type==="label").map($e=>({label:$e,x:$e.x,y:$e.y}));n.moveElements(Ae,{x:0,y:Sn});const tt=Le(),Ot=[...tt].filter($e=>!We.has($e)).length,He=[...We].filter($e=>!tt.has($e)).length;if(Ot>He){n.moveElements(Ae,{x:0,y:-Sn});for(const $e of mt){const Ft=$e.x-$e.label.x,Dt=$e.y-$e.label.y;(Ft!==0||Dt!==0)&&n.moveElements([$e.label],{x:Ft,y:Dt})}}}if(Jt.length){const Le=new Set(oe.map(We=>We.id));for(const{t:We,dy:mt}of Jt)N(We.parent,We,We.x+We.width/2,We.y+We.height/2+mt,Le)||n.moveElements([We],{x:0,y:mt})}}else n.moveElements(oe,{x:st-de,y:ns?Sn:0},void 0,Me);const Ui=g(R);if(!ns&&_.node.lane===void 0&&_.band!==void 0&&Ui){const Ae=Ui.y+Ee+Ht(`pool:${_.node.participant??""}`,_.band)*ae,Tt=Ae-(R.y+R.height/2);Tt!==0&&!N(Ui,R,R.x+R.width/2,Ae,se)&&n.moveElements([R],{x:0,y:Tt},void 0,Me)}if(ue)n.moveElements(oe,{x:ue.cx-(R.x+R.width/2),y:ue.cy-(R.y+R.height/2)},void 0,Me);else if(Ui){const Ae=(Ui.children??[]).filter(Le=>Ni(Le)&&!se.has(Le.id)&&Le.type!=="bpmn:Group"&&Le.type!=="bpmn:Participant"),Tt=(Le,We,mt,tt,Ot)=>Le.x+We<Ot.x+Ot.width+tt&&Le.x+We+Le.width+tt>Ot.x&&Le.y+mt<Ot.y+Ot.height+tt&&Le.y+mt+Le.height+tt>Ot.y,xt=Ae.find(Le=>Tt(R,0,0,0,Le)),Jt=xt?void 0:he(R);if(xt||Jt){const Le=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],We=r.getAll().filter(Et=>{if(!Le.includes(Et.type))return!1;const Rn=Et;return wc.has(Rn.id)||!Rn.waypoints||Rn.waypoints.length<2?!1:![Rn.source,Rn.target].some(en=>!en||se.has(en.id))}),mt=(Et,Rn,en)=>{var fi;return Kn((fi=P.get(Et.id))==null?void 0:fi.node.lane,Et,Et.y+en+Et.height/2)&&Et.x+Rn>=Ui.x&&Et.x+Rn+Et.width<=Ui.x+Ui.width&&Et.y+en>=Ui.y&&Et.y+en+Et.height<=Ui.y+Ui.height},tt=(Et,Rn)=>oe.every(en=>mt(en,Et,Rn)&&!Ae.some(fi=>Tt(en,Et,Rn,Ii,fi))&&We.every(fi=>{const na={id:en.id,type:en.type,x:en.x+Et,y:en.y+Rn,width:en.width,height:en.height};for(let ho=0;ho+1<fi.waypoints.length;ho++)if(Tr(fi.waypoints[ho],fi.waypoints[ho+1],na)<Ii)return!1;return!0})),Ot=R.y+R.height/2,He=[B,k.y+k.height/2].filter(Et=>Et!==void 0&&Math.abs(Et-Ot)>=1),$e=xt&&ne.has(xt.id)?xt:Jt==null?void 0:Jt.target,Ft=$e?$e.x-R.x:0,Dt=Math.max(...oe.map(Et=>Et.x+Et.width)),Rt=[...Ft!==0?[Ft]:[],...et!==0?[-et]:[],0],ea=H===void 0?[]:Rt.map(Et=>Math.max(Et,H-R.x)),Xn=Et=>Dt+Et+br<=k.x,fo=[...new Set([...ea,...Rt])].filter(Xn),is=xt&&ne.has(xt.id)?[xt.x+xt.width+br-R.x]:[],ta=H===void 0?[]:is.map(Et=>Math.max(Et,H-R.x)),jg=[...new Set([...ta,...is])].filter(Et=>Xn(Et)&&!fo.includes(Et));let qi;for(const Et of[fo,jg]){for(const Rn of He){for(const en of Et)if(tt(en,Rn-Ot)){qi={dx:en,dy:Rn-Ot};break}if(qi)break}if(qi)break}if(qi){const Et=ot=>{const Ct=ot;return[Ct.edge,Ct.other,...Array.isArray(Ct.edges)?Ct.edges:[]].some(jt=>typeof jt=="string"&&wc.has(jt))},Rn=()=>new Set(ft(ze(r)).filter(ot=>!Et(ot)).map(ot=>pt(ot))),en=Rn(),fi=r.filter(ot=>ot.type==="label").map(ot=>({label:ot,x:ot.x,y:ot.y}));n.moveElements(oe,{x:qi.dx,y:qi.dy},void 0,Me);const na=Rn(),ho=[...na].filter(ot=>!en.has(ot)).length,os=[...en].filter(ot=>!na.has(ot)).length;if(ho>os){n.moveElements(oe,{x:-qi.dx,y:-qi.dy},void 0,Me);for(const ot of fi){const Ct=ot.x-ot.label.x,jt=ot.y-ot.label.y;(Ct!==0||jt!==0)&&n.moveElements([ot.label],{x:Ct,y:jt})}}else I&&Dg.set(O.id,{exit:I,channelY:B,label:z})}}}{const Ae=new Set(oe.map(We=>We.id)),Tt=new Set(F.map(We=>We.flow.id)),xt=20,Jt=We=>{const mt=We.source,tt=We.target,Ot=Math.min(mt.x,tt.x)-xt,He=Math.max(mt.x+mt.width,tt.x+tt.width)+xt,$e=Math.min(mt.y,tt.y)-xt,Ft=Math.max(mt.y+mt.height,tt.y+tt.height)+xt;return We.waypoints.some(Dt=>Dt.x<Ot||Dt.x>He||Dt.y<$e||Dt.y>Ft)},Le=new Map;for(const We of oe)for(const mt of[...We.incoming??[],...We.outgoing??[]])(T.has(mt.id)||mt.id!==b.id&&Tt.has(mt.id))&&!(Ae.has(mt.source.id)&&Ae.has(mt.target.id))&&Le.set(mt.id,mt);for(const We of Le.values())Jt(We)&&vp(We)}const po=Re.length?g(Re[0]):void 0;if(po){const Ae={assoc:P1(),overlaps:O1(po),crosses:k1()},Tt=Re.map(He=>({st:He,x:He.x})),xt=r.filter(He=>He.type==="label").map(He=>({label:He,x:He.x,y:He.y})),Jt=Math.min(...Re.flatMap(He=>[...He.incoming??[],...He.outgoing??[]].filter($e=>$e.type==="bpmn:DataInputAssociation"||$e.type==="bpmn:DataOutputAssociation").map($e=>($e.source===He?$e.target:$e.source).x))),Le=new Set(Re.map(He=>He.id)),We=(po.children??[]).filter(Ni).filter(He=>!Le.has(He.id));let mt=Jt;for(const He of[...Re].sort(($e,Ft)=>$e.x-Ft.x)){let $e=mt;for(let Ft=0;Ft<100;Ft++){const Dt=We.find(Rt=>$e<Rt.x+Rt.width+Bi&&$e+He.width+Bi>Rt.x&&He.y<Rt.y+Rt.height&&He.y+He.height>Rt.y);if(!Dt)break;$e=Dt.x+Dt.width+Bi}$e!==He.x&&n.moveElements([He],{x:$e-He.x,y:0}),mt=$e+He.width+Bi}const tt=mt+150-(po.x+po.width);tt>0&&Qa(po,po.width+tt);const Ot={assoc:P1(),overlaps:O1(po),crosses:k1()};if(Ot.assoc>=Ae.assoc||Ot.overlaps>Ae.overlaps||Ot.crosses>Ae.crosses){for(const{st:He,x:$e}of Tt)He.x!==$e&&n.moveElements([He],{x:$e-He.x,y:0});tt>0&&Qa(po,po.width-tt);for(const He of xt){const $e=He.x-He.label.x,Ft=He.y-He.label.y;($e!==0||Ft!==0)&&n.moveElements([He.label],{x:$e,y:Ft})}}}}for(const[b,_]of Lo){const R=f(b);if(!R)continue;const O=_.container,L=Math.abs(R.y+R.height/2-O.y-_.relCy)>=.5,k=R.label,$=Math.min(R.y,k&&!k.hidden?k.y:R.y),I=Math.max(R.y+R.height,k&&!k.hidden?k.y+k.height:0);if(L&&$>=O.y&&I<=O.y+O.height)continue;const B=R.y;_.grow(),R.y!==B&&n.moveElements([R],{x:0,y:B-R.y},void 0,{autoResize:!1})}const I1=(b,_)=>{const R=_.target===b,O=d(_.source),L=d(_.target),k=R?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,L,_.id?{type:k,businessObject:i.create(k,{id:_.id})}:{type:k})},B1=b=>{for(const _ of m){if(!_.participant.blackBox)continue;const R=f(_.participant.id);if(!R)continue;const O=[];for(const k of v){const $=k.flow.source===_.participant.id?k.flow.target:k.flow.target===_.participant.id?k.flow.source:void 0,I=$?f($):void 0;I&&typeof I.x=="number"&&I.type!=="bpmn:Participant"&&O.push(I)}if(!O.length)continue;if(!b&&_.order===void 0){const k=(()=>{var I;const $=new Map;for(const B of O){const z=g(B);if(!z)continue;const H=$.get(z.id);H?H.n+=1:$.set(z.id,{shape:z,n:1})}return(I=[...$.values()].sort((B,z)=>z.n-B.n)[0])==null?void 0:I.shape})();if(k){const $=z=>z.reduce((H,Q)=>H+Q,0)/z.length,I=$(O.map(z=>z.y+z.height/2))<k.y+k.height/2,B=r.filter(z=>z.type==="bpmn:Participant"&&z.id!==_.participant.id&&z.id!==k.id).filter(z=>I?z.y+z.height<=k.y+5:z.y>=k.y+k.height-5);if(B.length){const z=[...B.reduce((ie,ue)=>ie.set(ue.y,(ie.get(ue.y)??0)+1),new Map)].sort((ie,ue)=>ue[1]-ie[1]||(I?ue[0]-ie[0]:ie[0]-ue[0]))[0][0],H=Math.min(R.width,zM),Q=GM,ne=O.map(ie=>ie.x+ie.width/2),he=Math.round($(ne)-H/2),oe=Math.max(...ne)+_f,se=ie=>({x:ie,width:Math.max(H,oe-ie)}),Me=B.filter(ie=>Math.min(ie.y+ie.height,z+Q)-Math.max(ie.y,z)>0),de=ie=>{const ue=se(ie);return Me.some(ke=>ke.x<ue.x+ue.width&&ue.x<ke.x+ke.width)},pe=ie=>{const ue=se(ie);return ne.filter(ke=>ke>=ue.x+10&&ke<=ue.x+ue.width-10).length},ge=(()=>{if(!de(he))return he;const ie=pe(he);return Me.flatMap(ue=>[ue.x+ue.width+Cy,ue.x-Cy-H]).map(ue=>Math.round(ue)).filter(ue=>!de(ue)&&pe(ue)>=ie).sort((ue,ke)=>Math.abs(ue-he)-Math.abs(ke-he))[0]??he})();if(ge!==R.x||z!==R.y||H!==R.width||Q!==R.height){const ie=()=>new Set(ft(ze(r)).map(st=>pt(st))),ue=ie(),ke={x:R.x,y:R.y,width:R.width,height:R.height};n.resizeShape(R,{x:ge,y:z,width:H,height:Q});const Qe=ie(),Mt=[...Qe].filter(st=>!ue.has(st)).length,et=[...ue].filter(st=>!Qe.has(st)).length;Mt>et&&n.resizeShape(R,ke)}}}}const L=Math.max(...O.map(k=>k.x+k.width/2))+_f;if(L>R.x+R.width&&n.resizeShape(R,{x:R.x,y:R.y,width:L-R.x,height:R.height}),!!b)for(const k of v){const $=f(k.flow.id),I=k.flow.source===_.participant.id?k.flow.target:k.flow.target===_.participant.id?k.flow.source:void 0,B=I?f(I):void 0;if(!$||!B||B.type==="bpmn:Participant")continue;const z=B.x+B.width/2;z<R.x+10||z>R.x+R.width-10||A1($,R,B)}}};B1(!1);for(const b of v){const _=b.flow;n.connect(d(_.source),d(_.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:_.id,name:_.name})})}{const R=new Set([...F.map(B=>B.flow.id),...v.map(B=>B.flow.id)].filter(B=>!!B)),O=r.filter(B=>!!B.waypoints),L=(B,z)=>Math.abs(z.x-B.x)<2?"L":Math.abs(z.x-(B.x+B.width))<2?"R":Math.abs(z.y-B.y)<2?"T":Math.abs(z.y-(B.y+B.height))<2?"B":void 0,k=new Map,$=(B,z,H)=>{if(!B||!z||typeof B.x!="number")return;const Q=L(B,z);if(!Q)return;let ne=k.get(B.id);ne||k.set(B.id,ne=new Map),ne.set(Q,[...ne.get(Q)??[],H])};for(const B of O){const z=B.waypoints;!z||z.length<2||($(B.source,z[0],{id:B.id,dir:"out"}),$(B.target,z[z.length-1],{id:B.id,dir:"in"}))}const I=new Set;for(const[B,z]of k){const H=f(B);if(!H||typeof H.x!="number")continue;const Q=pe=>{var ie;const ge=(ie=f(pe.id))==null?void 0:ie.source;return!!ge&&typeof ge.x=="number"&&ge.x+ge.width/2>H.x+H.width/2};if(![...z.values()].some(pe=>pe.length>=3&&pe.some(ge=>ge.dir==="out")&&pe.some(ge=>ge.dir==="in"&&R.has(ge.id)&&Q(ge))))continue;const he=g(H);if(!he||I.has(he.id)||(he.children??[]).some(pe=>pe.type==="bpmn:Lane"))continue;const oe=(oS=z.get("T"))!=null&&oS.length?(rS=z.get("B"))!=null&&rS.length?void 0:"B":"T";if(!oe||(oe==="T"?H.y-he.y:he.y+he.height-(H.y+H.height))>=ae)continue;const Me=(he.children??[]).filter(pe=>!("waypoints"in pe&&pe.waypoints)&&pe.type!=="label"&&typeof pe.x=="number"),de=he.y+he.height;n.resizeShape(he,{x:he.x,y:he.y,width:he.width,height:he.height+ae}),rn(de,he.id,ae),oe==="T"&&Me.length&&n.moveElements(Me,{x:0,y:ae}),I.add(he.id)}}const Lg=20,N1=4,S3=3,R3=2,C3=[10,30,80],Xr=()=>{const b=ze(r);return{bad:ft(b).filter(_=>_.kind==="edge-crosses-shape"||_.kind==="edge-overlap-opposite"||_.kind==="edge-overlap-mixed").length,crossings:km(b),straight:b.edges.filter(_=>_.type==="bpmn:MessageFlow"&&_.waypoints.length===2).length}},es=b=>{const _=ze(r),R=_.edges.find(O=>O.id===b);return R?Vt(R,Hn(_)).length:0},bp=b=>es(b)>0,xp=b=>ze(r).edges.filter(_=>_.type==="bpmn:MessageFlow"&&_.id!==b&&_.waypoints.length===2).length,$1=(b,_,R)=>Ja([{subtree:b,pool:_}],R),F1=(b,_)=>_.bad>b.bad||_.crossings>b.crossings&&_.straight<=b.straight&&_.bad>=b.bad,ts=(b,_)=>F1(b,_)||_.straight<b.straight,Zr=(b,_,R=()=>!0,O=F1,L=!1)=>{const k=Xr(),$=Ja(b,_,L);if(!$)return!1;const I=Xr();return O(k,I)||!R()?($(),!1):!0},M3=(b,_,R,O=()=>!0)=>Zr([{subtree:b,pool:_}],R,O),Qr=b=>{var _;return!!((_=P.get(b))!=null&&_.node.participant)},_c=new Map;for(const b of v){if(!Qr(b.flow.target))continue;const _=_c.get(b.flow.target)??[];_.push(b),_c.set(b.flow.target,_)}const wp=[..._c.keys()],Ig=new Set(F.map(b=>b.flow.target)),j1=b=>gt.findIndex(({op:_})=>_.participant.id===b);wp.sort((b,_)=>{var L,k;const R=Ig.has(b)?1:0,O=Ig.has(_)?1:0;return R!==O?R-O:j1((L=P.get(b))==null?void 0:L.node.participant)-j1((k=P.get(_))==null?void 0:k.node.participant)});const wr=b=>b.x+b.width/2,A3=b=>{const _=new Map;for(const L of r.getAll()){const k=L;if(!k.waypoints||!k.source||!k.target)continue;(_.get(k.source.id)??_.set(k.source.id,[]).get(k.source.id)).push(k.target.id)}const R=new Set([b]),O=[b];for(let L=0;L<O.length;L++)for(const k of _.get(O[L])??[])R.has(k)||(R.add(k),O.push(k));return R},P3=(b,_)=>{const R=A3(_);let O;for(const L of r.getAll()){const k=L;if(k.type!=="bpmn:MessageFlow"||!k.source||!k.target||k.target.id!==b||R.has(k.source.id))continue;const $=k.source;if(typeof $.x!="number"||$.type==="bpmn:Participant")continue;const I=wr($);(O===void 0||I>O)&&(O=I)}return O},Bg=(b,_)=>{const R=f(b.flow.source);if(R)return R.type==="bpmn:Participant"?P3(R.id,_):wr(R)},H1=b=>{let _;for(const R of _c.get(b)??[]){const O=Bg(R,b);O!==void 0&&(!_||O>_.cx)&&(_={op:R,cx:O})}return _==null?void 0:_.op},T3=b=>{const _=H1(b),R=f(b),O=_?Bg(_,b):void 0;return R&&O!==void 0?O-wr(R):void 0},k3=b=>{const _=T3(b);return _!==void 0&&Math.abs(_)<Lg},_p=(b,_,R,O,L)=>{var k;for(let $=!0;$;){$=!1;for(const I of v){if(I.flow.id===R)continue;const B=_.has(I.flow.source),z=_.has(I.flow.target);if(B===z||O(B?I.flow.source:I.flow.target))continue;const H=B?I.flow.target:I.flow.source;if(L(H)||!Qr(H))continue;const Q=f(I.flow.id);if(!(Q!=null&&Q.waypoints)||Q.waypoints.length!==2)continue;const ne=f(H),he=(k=P.get(H))==null?void 0:k.node.participant;if(!ne||!he)continue;const oe=Kr(H,se=>se.x>=ne.x).filter(se=>!_.has(se.id));if(!(!oe.length||oe.some(se=>L(se.id)))){for(const se of oe)_.add(se.id);b.set(he,[...b.get(he)??[],...oe]),$=!0}}}return[...b].map(([$,I])=>({subtree:I,pool:d($)}))},z1=(b,_,R,O,L)=>_p(new Map([[_,[...b]]]),new Set(b.map(k=>k.id)),O,k=>k===R,k=>k===L),Ng=b=>{const _=H1(b);if(!_)return null;const R=f(b),O=f(_.flow.source),L=Bg(_,b);if(!R||!O||L===void 0)return null;const k=L-wr(R);if(k>=Lg){const $=P.get(b).node.participant,I=Kr(b,B=>B.x>=R.x);return{groups:z1(I,$,b,_.flow.id,_.flow.source),dx:k}}if(-k>=Lg&&Qr(_.flow.source)){const $=P.get(_.flow.source).node.participant,I=Kr(_.flow.source,B=>B.x>=O.x&&!k3(B.id));return{groups:z1(I,$,_.flow.source,_.flow.id,b),dx:-k}}return null},G1=()=>wp.map(b=>({id:b,plan:Ng(b)})).filter(b=>!!b.plan).sort((b,_)=>Math.min(...b.plan.groups.flatMap(R=>R.subtree.map(O=>O.x)))-Math.min(..._.plan.groups.flatMap(R=>R.subtree.map(O=>O.x)))).map(b=>b.id);for(let b=0;b<3;b++){const _=Xr(),R=[];for(const L of G1()){const k=Ng(L);if(!k)continue;const $=Ja(k.groups,k.dx);$&&R.push($)}if(!R.length)break;if(!ts(_,Xr()))continue;for(const L of R.reverse())L();let O=!1;for(const L of G1()){const k=Ng(L);k&&Zr(k.groups,k.dx,()=>!0,ts)&&(O=!0)}if(!O)break}for(const b of wp){if(Ig.has(b))continue;const _=P.get(b);if(!_||_.node.lane!==void 0)continue;const R=le(_);if(R===void 0)continue;const O=f(b),L=O?g(O):void 0;if(!O||!L)continue;const k=L.y+Ee+Ht(`pool:${_.node.participant??""}`,R)*ae,$=k-(O.y+O.height/2);$!==0&&!N(L,O,O.x+O.width/2,k)&&n.moveElements([O],{x:0,y:$})}const V1=()=>{const b=r.filter(O=>O.type==="bpmn:Participant"),_=new Map(b.map(O=>[O.id,O]));let R=0;for(const{pools:[O,L]}of cf(b)){const k=_.get(O),$=_.get(L);R+=(Math.min(k.x+k.width,$.x+$.width)-Math.max(k.x,$.x))*(Math.min(k.y+k.height,$.y+$.height)-Math.max(k.y,$.y))}return R},W1=new Set;for(let b=0,_=!0;_&&b<S3;b++){_=!1;for(const R of wp.flatMap(O=>_c.get(O)??[])){if(W1.has(R.flow.id)||!bp(R.flow.id))continue;const O=f(R.flow.target);if(!O)continue;const L=d(P.get(R.flow.target).node.participant),k=Kr(R.flow.target,H=>H.x>=O.x),$=O.width+we,I=es(R.flow.id),B=xp(R.flow.id),z=V1();for(let H=1;H<=N1;H++){const Q=()=>es(R.flow.id)<I&&xp(R.flow.id)>=B&&V1()<=z;if(M3(k,L,$*H,Q)){W1.add(R.flow.id),_=!0;break}}}}const $g=v.map(b=>({id:b.flow.id,source:b.flow.source,target:b.flow.target,preexisting:!1})),U1=new Set($g.map(b=>b.id));for(const b of r.filter(_=>_.type==="bpmn:MessageFlow"))U1.has(b.id)||!b.source||!b.target||b.source.type==="bpmn:Participant"!=(b.target.type==="bpmn:Participant")&&$g.push({id:b.id,source:b.source.id,target:b.target.id,preexisting:!0});for(const b of $g){if(!bp(b.id))continue;const _=f(b.source),R=f(b.target);if(!_||!R)continue;let O,L,k;if(b.preexisting){const[I,B]=_.type==="bpmn:Participant"?[R,_]:[_,R];if(O=wr(I),O<B.x||O>B.x+B.width)continue;[L,k]=I.y<B.y?[I.y+I.height,B.y]:[B.y+B.height,I.y]}else{if(_.type==="bpmn:Participant"||R.type==="bpmn:Participant"||(O=_.x+_.width/2,Math.abs(O-(R.x+R.width/2))>15))continue;[L,k]=_.y<R.y?[_.y+_.height,R.y]:[R.y+R.height,_.y]}const $=[...P.values()].map(I=>f(I.node.id)).filter(I=>!!I&&I.id!==_.id&&I.id!==R.id).filter(I=>I.x<=O&&O<=I.x+I.width&&I.y+I.height>L&&I.y<k).sort((I,B)=>I.x-B.x);for(const I of $){const B=(aS=P.get(I.id))==null?void 0:aS.node.participant,z=B?f(B):void 0;if(!B||!z)continue;const H=[...P.values()].filter(ge=>ge.node.participant===B).map(ge=>ge.node.id),Q=ge=>ge.map(ie=>f(ie)).filter(ie=>!!ie),he=[y3(I.id,ge=>{var ie;return((ie=P.get(ge.id))==null?void 0:ie.node.participant)===B}),Q(H)].filter(ge=>ge.length).map(ge=>[{subtree:ge,pool:z}]);if(b.preexisting){const ge=Q(H);ge.length&&he.push(_p(new Map([[B,[...ge]]]),new Set(ge.map(ie=>ie.id)),b.id,()=>!1,ie=>ie===_.id||ie===R.id))}const oe=I.width+we,se=es(b.id),Me=xp(b.id),de=()=>es(b.id)<se&&xp(b.id)>=Me;let pe=!1;for(const ge of he){for(let ie=1;ie<=N1;ie++)if(Zr(ge,oe*ie,de)){pe=!0;break}if(pe)break}if(!bp(b.id))break}}const Ep=()=>{var _;const b=new Set;for(const R of ft(ze(r)))R.kind!=="edge-crosses-shape"||U1.has(R.edge)||((_=f(R.edge))==null?void 0:_.type)==="bpmn:MessageFlow"&&b.add(`${R.edge}>${R.shape}`);return b},O3=(b,_)=>Xr().bad>=b&&[...Ep()].some(R=>!_.has(R)),q1=b=>{var _,R;return es(b)===0&&((R=(_=f(b))==null?void 0:_.waypoints)==null?void 0:R.length)===2},D3=(b,_,R)=>{const O=new Set(b.flatMap(k=>k.subtree.map($=>$.id))),L=[...Ep()].filter(k=>!R.has(k)).map(k=>k.split(">")[1]);return[...new Set(L)].filter(k=>O.has(k)&&k!==_.source&&k!==_.target)},L3=(b,_,R,O,L)=>{const k=b.map(z=>({...z,subtree:z.subtree.filter(H=>!L.includes(H.id))})).filter(z=>z.subtree.length),$=new Set(k.flatMap(z=>z.subtree.map(H=>H.id))),I=()=>L.every(z=>{const H=f(z);return!!H&&F.filter(Q=>Q.flow.target===z&&$.has(Q.flow.source)).every(Q=>{const ne=f(Q.flow.source);return!!ne&&ne.x+ne.width<=H.x})});return Zr(k,_,()=>q1(R.id)&&[...Ep()].every(z=>O.has(z))&&I(),ts,!0)};for(const b of v){if(!bp(b.flow.id))continue;const _=f(b.flow.id);if(((sS=_==null?void 0:_.waypoints)==null?void 0:sS.length)!==2)continue;const R=f(b.flow.source),O=f(b.flow.target);if(!R||!O||R.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!Qr(b.flow.source)||!Qr(b.flow.target)||Math.abs(wr(R)-wr(O))>R3)continue;const L=wr(R),k=_.waypoints.map(se=>se.y),[$,I]=[Math.min(...k),Math.max(...k)],B=Hn(ze(r)).filter(se=>se.id!==R.id&&se.id!==O.id&&se.x<L&&L<se.x+se.width&&$<se.y+se.height&&se.y<I);if(!B.length)continue;const z=(cS=P.get(b.flow.source))==null?void 0:cS.node.participant,H=(lS=P.get(b.flow.target))==null?void 0:lS.node.participant;if(!z||!H)continue;const Q=new Map;for(const[se,Me,de]of[[b.flow.source,R,z],[b.flow.target,O,H]]){const pe=Q.get(de)??[],ge=Kr(se,ie=>ie.x>=Me.x).filter(ie=>!pe.some(ue=>ue.id===ie.id));Q.set(de,[...pe,...ge])}const ne=new Set([...Q.values()].flat().map(se=>se.id)),he=_p(Q,ne,b.flow.id,se=>se===b.flow.source||se===b.flow.target,()=>!1),oe=Math.max(...B.map(se=>se.x+se.width));for(const se of C3){const Me=oe+se-L;if(Me<=0)continue;const de=Xr().bad,pe=Ep();let ge=[],ie=!0;const ue=()=>!q1(b.flow.id)||ie&&(ge=D3(he,b.flow,pe),ge.length)?!1:!O3(de,pe);if(Zr(he,Me,ue,ts))break;if(ge.length&&(L3(he,Me,b.flow,pe,ge)||(ie=!1,Zr(he,Me,ue,ts))))break}}{const b=k=>k.y+k.height/2,_=/(Task|Event|Gateway|CallActivity|SubProcess)$/,R=()=>{const k=ze(r),$=new Set(ft(k).flatMap(z=>z.kind==="edge-crosses-shape"?[`${z.edge}|${z.shape}`]:[])),I=k.shapes.filter(z=>!z.container&&_.test(z.type)),B=new Set;for(const z of k.edges){if(z.type!=="bpmn:SequenceFlow"&&z.type!=="bpmn:MessageFlow")continue;const H=new Set(z.endpoints);for(const Q of[z.waypoints[0],z.waypoints[z.waypoints.length-1]])for(const ne of I)ne.x-4<=Q.x&&Q.x<=ne.x+ne.width+4&&ne.y-4<=Q.y&&Q.y<=ne.y+ne.height+4&&H.add(ne.id);for(const Q of I)if(!(H.has(Q.id)||$.has(`${z.id}|${Q.id}`))){for(let ne=0;ne+1<z.waypoints.length;ne++)if(Tr(z.waypoints[ne],z.waypoints[ne+1],Q)<=kg){B.add(`${z.id}|${Q.id}`);break}}}return B},O=()=>({...Xr(),grazes:R()}),L=[];for(const k of P.keys()){if(!Qr(k))continue;const $=F.filter(z=>z.flow.target===k);if($.length!==1)continue;const I=f($[0].flow.source),B=f(k);!I||!B||!P.has(I.id)||Math.abs(b(I)-b(B))>1||B.x-(I.x+I.width)<=we+1||L.push({id:k,pred:I,node:B})}L.sort((k,$)=>k.node.x-$.node.x);for(const{id:k}of L){const $=P.get(k),I=f(k),B=f(F.find(ge=>ge.flow.target===k).flow.source);if(!I||!B)continue;const z=I.x-(B.x+B.width);if(z<=we+1)continue;const H=d($.node.participant),Q=Kr(k,ge=>ge.x>=I.x),ne=-(z-we),he=(ge,ie)=>ie.bad>ge.bad||ie.crossings>=ge.crossings||ie.straight<ge.straight||[...ie.grazes].some(ue=>!ge.grazes.has(ue)),oe=_p(new Map([[$.node.participant,[...Q]]]),new Set(Q.map(ge=>ge.id)),"",()=>!1,()=>!1),se=oe.some(ge=>ge.pool!==H)||oe.reduce((ge,ie)=>ge+ie.subtree.length,0)>Q.length,Me=O(),de=$1(Q,H,ne);if(!de)continue;const pe=O();if(se&&!he(Me,pe)){de();const ge=Ja(oe,ne);if(ge){const ie=O();if(!he(Me,ie)&&ie.bad<=pe.bad&&ie.crossings<=pe.crossings)continue;ge()}$1(Q,H,ne);continue}he(Me,pe)&&de()}}B1(!0);const I3=10,B3=400,N3=b=>[...b.incoming??[],...b.outgoing??[]].filter(_=>_.type==="bpmn:DataInputAssociation"||_.type==="bpmn:DataOutputAssociation").map(_=>_.source===b?_.target:_.source).filter(_=>!!_&&typeof _.y=="number"),$3=r.filter(b=>b.type==="bpmn:DataStoreReference"&&h.has(b.id)),F3=(b,_)=>{const R=b.x+b.width/2,O=b.y+b.height/2;let L;for(const k of $3){if((g(k)??p())!==_||k.y<b.y+b.height)continue;const $=Math.abs(k.x+k.width/2-R);$>B3||$<k.width||!N3(k).some(B=>B.height===b.height&&Math.abs(B.y+B.height/2-O)<=I3&&k.y>=B.y+B.height)||(!L||$<L.dx||$===L.dx&&k.id<L.id)&&(L={dx:$,id:k.id,cy:k.y+k.height/2})}return L==null?void 0:L.cy};for(const b of x){const _=b.associations??[],R=_.map(k=>k.source===b.dataStore.id?k.target:k.source).map(f).find(Boolean),O=R?g(R)??p():p(),L=R?{x:R.x+R.width/2,y:F3(R,O)??R.y+R.height+110}:{x:200,y:St+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:b.dataStore.id,name:b.dataStore.name})},L,O);for(const k of _)I1(b.dataStore.id,k)}for(const b of E){const R=d(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;I1(R,b.association)}let Y1=0;const Jr=10,K1=40,j3=(b,_)=>{const R=_.map(B=>g(B)).filter(B=>!!B);for(const B of R){const z=Jr,H=B.y,Q=B.y+B.height,ne=B.x,he=B.x+B.width;if(Math.abs(b.y-H)<z){const oe=H+z-b.y;b.y+=oe,b.height-=oe}if(Math.abs(b.y+b.height-Q)<z&&(b.height=Q-z-b.y),Math.abs(b.x-ne)<z){const oe=ne+z-b.x;b.x+=oe,b.width-=oe}Math.abs(b.x+b.width-he)<z&&(b.width=he-z-b.x)}if(!R.length)return;const O=Math.min(...R.map(B=>B.y)),L=Math.max(...R.map(B=>B.y+B.height)),k=O-b.y,$=b.y+b.height-L,I=K1-Jr;if(k>0!=$>0)if(k>0&&k<I){const B=k+Jr;b.y+=B,b.height-=B}else $>0&&$<I&&(b.height-=$+Jr)},H3=(b,_)=>{const R=Jr,O=30,L=r.filter(k=>k.type==="bpmn:Group"&&k.id!==_);for(const k of L){const $=k.x,I=k.x+k.width,B=k.y,z=k.y+k.height,H=b.y<z&&B<b.y+b.height,Q=b.x<I&&$<b.x+b.width;if(H){if(Math.abs(b.x-I)<R){const ne=Math.min(I+R-b.x,O);ne>0&&b.width-ne>0&&(b.x+=ne,b.width-=ne)}if(Math.abs(b.x+b.width-$)<R){const ne=Math.min(b.x+b.width-($-R),O);ne>0&&b.width-ne>0&&(b.width-=ne)}}if(Q){if(Math.abs(b.y-z)<R){const ne=Math.min(z+R-b.y,O);ne>0&&b.height-ne>0&&(b.y+=ne,b.height-=ne)}if(Math.abs(b.y+b.height-B)<R){const ne=Math.min(b.y+b.height-(B-R),O);ne>0&&b.height-ne>0&&(b.height-=ne)}}}},Fg=(b,_)=>{const R=K1,O=Math.min(...b.map(B=>B.x))-R,L=Math.min(...b.map(B=>B.y))-R,k=Math.max(...b.map(B=>B.x+B.width))+R,$=Math.max(...b.map(B=>B.y+B.height))+R,I={x:O,y:L,width:k-O,height:$-L};return j3(I,b),H3(I,_),I};for(const b of D){const _=(b.group.members??[]).map(f).filter(L=>!!L);let R;_.length?R=Fg(_,b.group.id):(R={x:300+Y1*350,y:40,width:300,height:200},Y1++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:R.width,height:R.height},{x:R.x+R.width/2,y:R.y+R.height/2},p());b.group.name&&n.updateLabel(O,b.group.name),(uS=b.group.members)!=null&&uS.length&&re(O,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=r.filter(L=>!!L.waypoints),_=new Map,R=(L,k)=>{!L||!k||(_.has(L)||_.set(L,new Set),_.get(L).add(k))};for(const L of b){const k=(pS=L.source)==null?void 0:pS.id,$=(fS=L.target)==null?void 0:fS.id;R(k,$),((dS=L.type)!=null&&dS.includes("DataOutputAssociation")||(hS=L.type)!=null&&hS.includes("DataInputAssociation")||L.type==="bpmn:Association")&&R($,k)}const O=r.filter(L=>L.type==="bpmn:Group");for(const L of O){const $=(((gS=L.businessObject.extensionElements)==null?void 0:gS.values)??[]).find(de=>de.$type==="bwl:Members"),I=(($==null?void 0:$.refs)??"").split(" ").filter(Boolean);if(!I.length)continue;const B=new Set(I),z=[...I];for(;z.length;){const de=z.shift();for(const pe of _.get(de)??[])B.has(pe)||(B.add(pe),z.push(pe))}const H=L.x,Q=L.x+L.width,ne=L.y,he=L.y+L.height,oe=de=>F.filter(pe=>pe.flow.target===de).length,se=de=>{var ge;const pe=((ge=f(de))==null?void 0:ge.type)??"";if(pe==="bpmn:StartEvent"&&oe(de)===0)return!1;if(pe.endsWith("Gateway")){const ie=F.filter(ue=>ue.flow.target===de).map(ue=>ue.flow.source);if(ie.length&&ie.every(ue=>{var ke;return((ke=f(ue))==null?void 0:ke.type)==="bpmn:StartEvent"&&oe(ue)===0}))return!1}return!0},Me=r.filter(de=>Ni(de)).filter(de=>de.type!=="bpmn:Group"&&de.type!=="bpmn:Participant"&&de.type!=="bpmn:TextAnnotation"&&!B.has(de.id)&&Qr(de.id)&&se(de.id)&&de.x<Q&&de.x+de.width>H&&de.y<he&&de.y+de.height>ne);if(Me.length)for(const de of[-1,1]){const pe=Me.filter(Fe=>(Fe.x+Fe.width-H<=Q-Fe.x?-1:1)===de);if(!pe.length)continue;const ge=[];for(const Fe of pe){const _e=ge.find(Re=>Re.some(ee=>Fe.y<ee.y+ee.height&&Fe.y+Fe.height>ee.y));_e?_e.push(Fe):ge.push([Fe])}const ie=new Map;for(const Fe of ge){let _e=de<0?H-Jr:Q+Jr;for(const Re of[...Fe].sort((ee,Ce)=>de<0?Ce.x-ee.x:ee.x-Ce.x)){const ee=de<0?Math.min(Re.x,_e-Re.width):Math.max(Re.x,_e);_e=de<0?ee-Bi:ee+Re.width+Bi,ee!==Re.x&&Math.sign(ee-Re.x)===de&&ie.set(Re.id,ee-Re.x)}}const ue=new Map,ke=Fe=>ue.get(Fe)===Fe||!ue.get(Fe)?Fe:ke(ue.get(Fe));for(const Fe of pe)ue.set(Fe.id,Fe.id);for(const Fe of v){const _e=ie.has(Fe.flow.source)?Fe.flow.source:void 0,Re=ie.has(Fe.flow.target)?Fe.flow.target:void 0;if(!_e||!Re)continue;const ee=f(Fe.flow.id);((mS=ee==null?void 0:ee.waypoints)==null?void 0:mS.length)===2&&ue.set(ke(_e),ke(Re))}const Qe=new Map;for(const Fe of pe){if(!ie.has(Fe.id))continue;const _e=ke(Fe.id);Qe.set(_e,[...Qe.get(_e)??[],Fe])}const Mt=[...Qe.values()].sort((Fe,_e)=>de<0?Math.min(...Fe.map(Re=>Re.x))-Math.min(..._e.map(Re=>Re.x)):Math.max(..._e.map(Re=>Re.x))-Math.max(...Fe.map(Re=>Re.x))),et=[];let st=!0;for(const Fe of Mt){const _e=Fe.map(Ce=>ie.get(Ce.id)??0).reduce((Ce,qe)=>Math.abs(qe)>Math.abs(Ce)?qe:Ce,0),Re=new Map;let ee=!0;for(const Ce of Fe){const qe=g(Ce);if(!qe){ee=!1;break}Re.has(qe.id)||Re.set(qe.id,{subtree:[],pool:qe}),Re.get(qe.id).subtree.push(Ce)}ee&&Zr([...Re.values()],_e,()=>!0,ts)?et.push({shapes:Fe,dx:_e}):st=!1}if(!st)for(const Fe of et.reverse())n.moveElements(Fe.shapes,{x:-Fe.dx,y:0})}}}{const b=new Set([...D.map(_=>_.group.id),...qt(e,"group.update").map(_=>_.id)]);for(const _ of r.filter(R=>R.type==="bpmn:Group")){if(b.has(_.id))continue;const O=(((yS=_.businessObject.extensionElements)==null?void 0:yS.values)??[]).find(I=>I.$type==="bwl:Members"),L=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(f).filter(I=>!!I);!L.length||!L.some(I=>{const B=h.get(I.id);return!B||B.x!==I.x||B.y!==I.y})||!L.some(I=>I.x<_.x||I.y<_.y||I.x+I.width>_.x+_.width||I.y+I.height>_.y+_.height)||n.resizeShape(_,Fg(L,_.id))}}{const _=new Map(Go(ze(r)).map(I=>[I.owner,I.rect])),R=r.filter(I=>!!I.waypoints),O=new Map,L=(I,B)=>{!I||!B||(O.has(I)||O.set(I,new Set),O.get(I).add(B))};for(const I of R){const B=(vS=I.source)==null?void 0:vS.id,z=(bS=I.target)==null?void 0:bS.id;L(B,z),((xS=I.type)!=null&&xS.includes("DataOutputAssociation")||(wS=I.type)!=null&&wS.includes("DataInputAssociation")||I.type==="bpmn:Association")&&L(z,B)}const k=I=>F.filter(B=>B.flow.target===I).length,$=I=>{var z;const B=((z=f(I))==null?void 0:z.type)??"";if(B==="bpmn:StartEvent"&&k(I)===0)return!1;if(B.endsWith("Gateway")){const H=F.filter(Q=>Q.flow.target===I).map(Q=>Q.flow.source);if(H.length&&H.every(Q=>{var ne;return((ne=f(Q))==null?void 0:ne.type)==="bpmn:StartEvent"&&k(Q)===0}))return!1}return!0};for(const I of r.filter(B=>B.type==="bpmn:Group")){const z=(((_S=I.businessObject.extensionElements)==null?void 0:_S.values)??[]).find(ee=>ee.$type==="bwl:Members"),H=((z==null?void 0:z.refs)??"").split(" ").filter(Boolean);if(!H.length)continue;const Q=H.map(f).filter(ee=>!!ee);if(!Q.length||!(D.some(ee=>ee.group.id===I.id)||qt(e,"group.update").some(ee=>ee.id===I.id)||Q.some(ee=>{const Ce=h.get(ee.id);return!Ce||Ce.x!==ee.x||Ce.y!==ee.y})))continue;const he=new Set(H),oe=[...H];for(;oe.length;){const ee=oe.shift();for(const Ce of O.get(ee)??[])he.has(Ce)||(he.add(Ce),oe.push(Ce))}const se=I.x,Me=I.x+I.width,de=I.y,pe=I.y+I.height,ge=ee=>{const Ce=_.get(ee.id),qe={x:ee.x,y:ee.y,width:ee.width,height:ee.height};return Ce?[qe,{x:Ce.x,y:Ce.y,width:Ce.width,height:Ce.height}]:[qe]},ie=Q.flatMap(ge),ue=Math.min(...ie.map(ee=>ee.x)),ke=Math.max(...ie.map(ee=>ee.x+ee.width)),Qe=Math.min(...ie.map(ee=>ee.y)),Mt=Math.max(...ie.map(ee=>ee.y+ee.height)),et={L:ue-se,R:Me-ke,T:Qe-de,B:pe-Mt},st=new Set(H),Fe=ee=>ee.x>=se&&ee.x+ee.width<=Me&&ee.y>=de&&ee.y+ee.height<=pe,_e=r.filter(ee=>Ni(ee)).filter(ee=>ee.type!=="bpmn:Group"&&ee.type!=="bpmn:Participant"&&ee.type!=="bpmn:TextAnnotation"&&!st.has(ee.id)&&(!he.has(ee.id)||!Fe(ee))&&$(ee.id)&&ee.x<Me&&ee.x+ee.width>se&&ee.y<pe&&ee.y+ee.height>de);if(!_e.length)continue;const Re={L:0,R:0,T:0,B:0};for(const ee of _e){const Ce=ge(ee),qe=Math.min(...Ce.map(_t=>_t.x)),nt=Math.max(...Ce.map(_t=>_t.x+_t.width)),Be=Math.min(...Ce.map(_t=>_t.y)),lt=Math.max(...Ce.map(_t=>_t.y+_t.height)),bt={L:nt-se,R:Me-qe,T:lt-de,B:pe-Be},Gt=["L","R","T","B"].filter(_t=>bt[_t]<=et[_t]+.001);if(!Gt.length)continue;const Sn=Gt.reduce((_t,Wn)=>bt[Wn]<bt[_t]?Wn:_t,Gt[0]);Re[Sn]=Math.max(Re[Sn],Math.min(bt[Sn]+10,et[Sn]))}!Re.L&&!Re.R&&!Re.T&&!Re.B||n.resizeShape(I,{x:I.x+Re.L,y:I.y+Re.T,width:I.width-Re.L-Re.R,height:I.height-Re.T-Re.B})}}const X1=b=>{const _=b.waypoints;if(_!=null&&_.length){const O=_[Math.floor((_.length-1)/2)];return{x:O.x,y:O.y,width:0,height:0}}const R=b;return{x:R.x,y:R.y,width:R.width,height:R.height}};let Ec=0;const Z1=12,Q1=14,z3=15,G3=300,V3=b=>{const _=b.split(`
|
|
7
|
-
`),R=Math.max(..._.map(k=>fa(k,Z1))),O=Math.max(100,Math.min(G3,Math.ceil(R)+Q1)),L=_.reduce((k,$)=>k+Math.max(1,Math.ceil((fa($,Z1)+Q1)/O)),0);return{width:O,height:Math.max(30,L*z3+10)}};for(const b of A){const _=b.association,R=((ES=b.placement)==null?void 0:ES.anchor)??(_?_.source===b.annotation.id?_.target:_.source:void 0),O=R?f(R):void 0,L=O?X1(O):void 0,k=V3(b.annotation.text??"");let $;if(L&&b.placement){const[H,Q]=nl[b.placement.side],ne=b.placement.offset??50;$={x:L.x+L.width/2+H*(L.width/2+k.width/2+ne),y:L.y+L.height/2+Q*(L.height/2+k.height/2+ne)}}else L?($={x:L.x+L.width/2+180+Ec%3*260,y:L.y-110-Ec%2*95},Ec++):($={x:300+Ec*260,y:60},Ec++);const I=O?g(O)??p():p(),B=I;L&&typeof B.x=="number"&&typeof B.width=="number"&&B.type==="bpmn:Participant"&&($=ol(r,L,k,B,b.placement?{placement:b.placement}:{from:$}));const z=n.createShape({type:"bpmn:TextAnnotation",width:k.width,height:k.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},$,I);if(_){const H=Q=>Q===b.annotation.id?z:d(Q);n.connect(H(_.source),H(_.target),_.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:_.id})}:{type:"bpmn:Association"})}b.placement&&re(z,"bwl:Placement",J(b.placement))}for(const b of qt(e,"association.add")){const _=b.association;n.connect(d(_.source),d(_.target),_.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:_.id})}:{type:"bpmn:Association"})}const W3=(b,_,R,O)=>{const L=b.parent;if(!L)return O;const k=b.x+b.width/2,$=new Set([b.id]);if(!N(L,b,k,O,$))return O;const I=_?_.y+Math.min(_.height/2,U):R?R.y+Ee:void 0;if(I===void 0)return O;const B=Math.floor((O-I)/ae+1e-6);for(let z=1;z<=3;z++){const H=B+z,Q=I+H*ae,ne=bc(_==null?void 0:_.id,H);if(!N(L,b,k,Q,ne?new Set([...$,...ne]):$))return pi(_==null?void 0:_.id,H,R),Q}return O},J1=()=>new Set(r.getAll().filter(b=>b.type!=="label").map(b=>b.id));for(const b of qt(e,"node.update")){let _=d(b.id);if(b.type&&tl(b.type)!==_.type){const R=_.x+_.width/2,O=_.y+_.height/2,L=J1();_=c.replaceElement(_,{type:tl(b.type),...b.eventDefinition?{eventDefinitionType:Ac[b.eventDefinition]}:{}});const k=J1(),$=[...L].filter(z=>z!==b.id&&!k.has(z));if($.length)throw new Ty({kind:"type-change-drops-elements",opIndex:e.indexOf(b),id:b.id,type:b.type,dropped:$});const I=Math.round(R-(_.x+_.width/2)),B=Math.round(O-(_.y+_.height/2));if(I!==0||B!==0){n.moveShape(_,{x:I,y:B});for(const z of[..._.incoming??[],..._.outgoing??[]])vp(z)}}if(b.name!==void 0&&n.updateProperties(_,{name:b.name??void 0}),b.lane||b.band!==void 0){b.band!==void 0&&n.updateProperties(_,{"bwl:band":b.band});const R=_.y+_.height/2,O=g(_),L=b.lane?d(b.lane):((O==null?void 0:O.children)??[]).find($=>$.type==="bpmn:Lane"&&R>=$.y&&R<=$.y+$.height);b.band!==void 0&&pi(L==null?void 0:L.id,b.band,O);const k=L?L.y+(b.band===void 0?L.height/2:Math.min(L.height/2,U)+Ht(L.id,b.band)*ae):b.band!==void 0&&O?O.y+Ee+Ht(`pool:${O.id}`,b.band)*ae:void 0;if(k!==void 0){const $=W3(_,L,O,k),I=$===k?k-R:$-(_.y+_.height/2);I!==0&&n.moveElements([_],{x:0,y:I})}}}for(const b of qt(e,"sequenceFlow.update")){const _=d(b.id),R=T.get(b.id);if(R){const O=z=>({x:z.x+z.width/2,y:z.y+z.height/2}),L=d(R.flow.source),k=d(R.flow.target),$=n.connect(L,k,{type:"bpmn:SequenceFlow",businessObject:yp(R.flow)}),I=Dg.get(b.id),B=k.y+k.height/2;I&&k.x>I.exit.x&&Math.abs(B-I.exit.y)>1?n.updateWaypoints($,[I.exit,{x:I.exit.x,y:B},{x:k.x,y:B}]):(n.reconnect($,L,k,[O(L),O(k)]),Math.abs(B-(L.y+L.height/2))>1&&vp($))}else if(b.source!==void 0||b.target!==void 0){const O=_,L=b.source!==void 0?d(b.source):O.source,k=b.target!==void 0?d(b.target):O.target,$=z=>({x:z.x+z.width/2,y:z.y+z.height/2});n.reconnect(O,L,k,[$(L),$(k)]);const I=Dg.get(O.id),B=k.y+k.height/2;if(I&&k.x>I.exit.x&&Math.abs(B-I.exit.y)>1){n.updateWaypoints(O,[I.exit,{x:I.exit.x,y:B},{x:k.x,y:B}]);const z=O.label;if(z&&I.label){const Q=Math.abs(I.label.y+z.height/2-I.channelY)<=ae/5&&I.label.x+z.width>I.exit.x,ne=I.exit.x+6,he=k.x-6-z.width,oe=Q?he>=ne?{x:Math.max(ne,Math.min(I.label.x,he)),y:I.label.y+(B-I.channelY)}:void 0:I.label;oe&&(oe.x!==z.x||oe.y!==z.y)&&n.moveElements([z],{x:oe.x-z.x,y:oe.y-z.y})}}else Math.abs(B-(L.y+L.height/2))>1&&vp(O)}b.name!==void 0&&n.updateProperties(_,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(_,{name:((SS=b.condition)==null?void 0:SS.label)??void 0})}for(const b of qt(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(d(b.id),{name:b.name??void 0});for(const b of qt(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(d(b.id),{name:b.name??void 0});for(const b of qt(e,"annotation.update")){const _=d(b.id);if(b.text!==void 0&&n.updateProperties(_,{text:b.text}),b.placement===null)re(_,"bwl:Placement",null);else if(b.placement){const R=d(b.placement.anchor),O=X1(R),L=g(R)??p(),k=typeof L.x=="number"&&typeof L.width=="number"&&L.type==="bpmn:Participant",[$,I]=nl[b.placement.side],B=b.placement.offset??50,z={x:O.x+O.width/2+$*(O.width/2+_.width/2+B),y:O.y+O.height/2+I*(O.height/2+_.height/2+B)},H=k?ol(r,O,{width:_.width,height:_.height},L,{placement:b.placement,selfId:b.id}):z;n.moveElements([_],{x:H.x-(_.x+_.width/2),y:H.y-(_.y+_.height/2)}),re(_,"bwl:Placement",J(b.placement))}}for(const b of qt(e,"group.update")){const _=d(b.id);if(b.name!==void 0&&n.updateLabel(_,b.name??""),b.members){const R=b.members.map(f).filter(O=>!!O);R.length&&n.resizeShape(_,Fg(R,b.id)),re(_,"bwl:Members",{refs:b.members.join(" ")})}}}function Ef(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 qM(e,t,n,i){const{elementRegistry:o}=e,r=e.modeling,a=[...t.incoming??[],...t.outgoing??[]].filter(d=>d.type==="bpmn:Association");if(!a.length)return 0;const s=d=>d.map(g=>g.original?{x:g.x,y:g.y,original:{x:g.original.x,y:g.original.y}}:{x:g.x,y:g.y}),c=(d,g)=>d.length===g.length&&d.every((h,m)=>{var w,y,v,x;return h.x===g[m].x&&h.y===g[m].y&&((w=h.original)==null?void 0:w.x)===((y=g[m].original)==null?void 0:y.x)&&((v=h.original)==null?void 0:v.y)===((x=g[m].original)==null?void 0:x.y)}),l=a.map(d=>s(d.waypoints)),u=new Set(a.map(d=>d.id));r.moveElements([t],{x:n,y:i});const p=ze(o),f=[...mo(p),...ji(p)].filter(([d,g])=>u.has(d)!==u.has(g)).length;return r.moveElements([t],{x:-n,y:-i}),a.forEach((d,g)=>{c(d.waypoints,l[g])||r.updateWaypoints(d,l[g])}),f}function YM(e,t,n){var u,p;const{elementRegistry:i}=e,o=e.modeling,r=f=>ft(f).filter(d=>!t.has(pt(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=ze(i),c=r(s),l=[...new Set(c.flatMap(Ef))].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 ye=d.x+d.width/2,ae=d.y+d.height/2;h=i.getAll().find(we=>{if(we.type!=="bpmn:Participant")return!1;const Ee=we;return typeof Ee.x=="number"&&typeof Ee.width=="number"&&ye>=Ee.x&&ye<=Ee.x+Ee.width&&ae>=Ee.y&&ae<=Ee.y+Ee.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const w=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(ye=>ye.$type==="bwl:Placement"),y=[...d.incoming??[],...d.outgoing??[]].find(ye=>ye.type==="bpmn:Association"),v=(w!=null&&w.anchor?i.get(w.anchor):void 0)??(y?((p=y.source)==null?void 0:p.id)===f?y.target:y.source:void 0);if(!v)continue;const x=v.waypoints,E=x!=null&&x.length?{x:x[Math.floor((x.length-1)/2)].x,y:x[Math.floor((x.length-1)/2)].y,width:0,height:0}:{x:v.x,y:v.y,width:v.width,height:v.height},A={width:d.width,height:d.height},D={x:d.x+d.width/2,y:d.y+d.height/2},P=w==null?void 0:w.side,T=Ay(i,E,h),j=[];if(P&&P in nl&&j.push(ol(i,E,A,h,{placement:{side:P,offset:(w==null?void 0:w.offset)??null},selfId:f})),T&&!il(D,A,T))for(const ye of WM)j.push(ol(i,E,A,h,{placement:{side:ye,offset:null},selfId:f}));for(const[ye,ae]of[[-1,0],[1,0],[0,-1],[0,1]])for(let we=1;we<=VM;we++)j.push({x:D.x+ye*My*we,y:D.y+ae*My*we});const F={...s,edges:s.edges.filter(ye=>ye.id!==(y==null?void 0:y.id))},G=r(F),Z=G.filter(ye=>Ef(ye).includes(f)).length;if(!Z)continue;let re,J=!1;for(const ye of j){const ae=ye.x-D.x,we=ye.y-D.y;if(!ae&&!we||ye.x-A.width/2<h.x||ye.x+A.width/2>h.x+h.width||ye.y-A.height/2<h.y||ye.y+A.height/2>h.y+h.height||T&&!il(ye,A,T))continue;const Ee={...F,shapes:F.shapes.map(X=>X.id===f?{...X,x:X.x+ae,y:X.y+we}:X)},U=r(Ee),ce=U.filter(X=>Ef(X).includes(f)).length;if(ce>=Z||U.length>G.length)continue;const Y=Math.abs(ae)+Math.abs(we);if(J||((!re||ce<re.mine||ce===re.mine&&(U.length<re.all||U.length===re.all&&Y<re.dist))&&(re={x:ye.x,y:ye.y,mine:ce,all:U.length,dist:Y}),re.mine===0&&re.all<G.length&&(J=!0)),ce===0&&U.length<G.length&&qM(e,d,ae,we)===0){re={x:ye.x,y:ye.y,mine:ce,all:U.length,dist:Y};break}}re&&o.moveElements([d],{x:re.x-D.x,y:re.y-D.y})}}const KM=60;function Sf(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 XM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=w=>ft(w).filter(y=>!t.has(pt(y))),a=w=>w.filter(y=>y.kind==="pool-overlap"),s=new Map(n.shapes.map(w=>[w.id,w])),c=(w,y)=>y.x>=w.x&&y.y>=w.y&&y.x+y.width<=w.x+w.width&&y.y+y.height<=w.y+w.height,l=w=>{if(!s.get(w))return[w];const v=new Set,x=new Set([w]);for(let A=0;A<4;A++){let D=!1;for(const P of n.shapes)P.type!=="bpmn:Group"||v.has(P.id)||[...x].some(T=>{const j=s.get(T);return j&&c(P,j)})&&(v.add(P.id),D=!0);for(const P of n.shapes)P.type!=="bpmn:Participant"||x.has(P.id)||[...v].some(T=>{const j=s.get(T);return j&&c(j,P)})&&(x.add(P.id),D=!0);if(!D)break}const E=n.shapes.filter(A=>!A.parent&&!x.has(A.id)&&!v.has(A.id)&&A.type!=="bpmn:Group"&&A.type!=="bpmn:Participant").filter(A=>[...v].some(D=>{const P=s.get(D);return P&&c(P,A)})).map(A=>A.id);return[...x,...v,...E]},u=r(ze(i)),p=a(u).length;if(!p)return;const f=u.length,d=[];let g=0,h=p,m=f;for(let w=0;w<6;w++){const y=ze(i),v=a(r(y));if(!v.length)break;const x=new Map(y.shapes.map(T=>[T.id,T]));let E=null;for(const T of v){if(T.kind!=="pool-overlap")continue;const[j,F]=T.pools,G=x.get(j),Z=x.get(F);if(!G||!Z)continue;const[re,J]=G.x<=Z.x?[G,Z]:[Z,G];if(T.contained)continue;const ye=s.get(re.id),ae=s.get(J.id),we=ye&&ae?Math.max(ae.x-(ye.x+ye.width),0):KM,Ee=re.x+re.width+we-J.x;if(Ee<=0)continue;const U=l(J.id).filter(ce=>i.get(ce));U.length&&(!E||Ee>E.dx)&&(E={movers:U,dx:Ee})}if(!E)break;const A=E.movers.map(T=>i.get(T)).filter(T=>!!T&&typeof T.x=="number");if(!A.length)break;o.moveElements(A,{x:E.dx,y:0}),d.push({els:A,dx:E.dx});const D=r(ze(i)),P=a(D).length;P<p&&D.length<=f&&(P<h||P===h&&D.length<m||g===0)&&(g=d.length,h=P,m=D.length)}for(const{els:w,dx:y}of d.slice(g).reverse())o.moveElements(w,{x:-y,y:0})}const gs=.5,Dy=150;function ZM(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of QM(n))i.length<n.length&&i.some(r=>Ly(e.elementRegistry.get(r.id)))||JM(e,i)}function QM(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)<=gs?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function Ly(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 JM(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(y=>y.x+y.width),r=Math.max(...o);if(r-Math.min(...o)>gs)return;const a=t.map(y=>n.get(y.id)).filter(y=>!!y&&typeof y.x=="number");if(a.length<2)return;const s=new Map(t.map(y=>[y.id,y.x]));if(a.some(y=>Math.abs(y.x-s.get(y.id))>gs))return;const c=a.map(y=>y.x+y.width);if(Math.max(...c)-Math.min(...c)<=gs)return;const l=y=>y.x+y.width,u=y=>!!y&&typeof y.width=="number",p=y=>{const v={shapes:[],edges:[],lanes:[]},x=E=>{for(const A of E.children??[]){if("waypoints"in A&&A.waypoints){v.edges.push(A);continue}A.type!=="label"&&(A.type==="bpmn:Lane"?v.lanes.push(A):v.shapes.push(A),x(A))}};return x(y),v},f=new Map(a.map(y=>[y.id,p(y)]));let d=r;for(const y of a){const{shapes:v}=f.get(y.id),x=v.flatMap(E=>[l(E),...u(E.label)?[l(E.label)]:[]]);x.length&&(d=Math.max(d,Math.max(...x)+Dy))}const g=a.filter(y=>Math.abs(l(y)-d)>gs);if(!g.length)return;for(const y of g){const v=l(y),{shapes:x,edges:E,lanes:A}=f.get(y.id);if([...x.flatMap(T=>[l(T),...u(T.label)?[l(T.label)]:[]]),...E.flatMap(T=>[...T.waypoints.map(j=>j.x),...u(T.label)?[l(T.label)]:[]])].some(T=>T>d)||[...(y.incoming??[]).map(T=>T.waypoints[T.waypoints.length-1]),...(y.outgoing??[]).map(T=>T.waypoints[0])].some(T=>!T||T.x>d||Math.abs(T.x-v)<1))return;if(d>v){const T={x:v,y:y.y,width:d-v,height:y.height},j=new Set([y.id,...x.map(G=>G.id),...E.map(G=>G.id),...A.map(G=>G.id)]);if(n.getAll().some(G=>{var J;if("waypoints"in G&&G.waypoints||G.type==="bpmn:Group"||!u(G))return!1;const Z=G.type==="label"?(J=G.labelTarget)==null?void 0:J.id:G.id;if(!Z||j.has(Z)||j.has(G.id))return!1;const re=G;return re.x<T.x+T.width&&re.x+re.width>T.x&&re.y<T.y+T.height&&re.y+re.height>T.y}))return}}const h=()=>new Set(ft(ze(n)).map(pt)),m=h(),w=g.map(y=>y.width);for(const y of g)Sf(i,y,d-y.x,{layout:!1});[...h()].every(y=>m.has(y))||g.forEach((y,v)=>Sf(i,y,w[v],{layout:!1}))}function eA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>ft(l).filter(u=>!t.has(pt(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const p=n.shapes.filter(A=>A.id!==l.id&&A.type!=="bpmn:Group"&&a(l,A));if(!p.length)continue;const f=p.map(A=>i.get(A.id)).filter(A=>!!A&&typeof A.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),w=g.r+(l.x+l.width-d.r),y=g.b+(l.y+l.height-d.b),v={x:h,y:m,width:w-h,height:y-m};if(v.width<=0||v.height<=0||Math.abs(v.x-u.x)<1&&Math.abs(v.y-u.y)<1&&Math.abs(v.width-u.width)<1&&Math.abs(v.height-u.height)<1)continue;const x=r(ze(i)).length,E={x:u.x,y:u.y,width:u.width,height:u.height};o.resizeShape(u,v),r(ze(i)).length>x&&o.resizeShape(u,E)}}const rl=20,al=10;function tA(e,t,n,i){var p,f;const{elementRegistry:o}=e,r=e.modeling,a=d=>new Set(ft(d,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(pt)),s=ze(o),c=ft(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(pt(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,g]of u){const h=s.shapes.find(Ie=>Ie.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 y=h.members.map(Ie=>o.get(Ie)).filter(Ie=>!!Ie&&typeof Ie.x=="number");if(!y.length)continue;const v=Math.min(...y.map(Ie=>Ie.x)),x=Math.min(...y.map(Ie=>Ie.y)),E=Math.max(...y.map(Ie=>Ie.x+Ie.width)),A=Math.max(...y.map(Ie=>Ie.y+Ie.height)),D=h.x,P=h.y,T=h.x+h.width,j=h.y+h.height;let F=D,G=P,Z=T,re=j;for(const Ie of g){const N=s.edges.find(S=>S.id===Ie.edge);if(!N)continue;const C=N.endpoints.some(S=>{const V=s.shapes.find(Te=>Te.id===S);if(!V||V.container)return!1;const K=V.x+V.width/2,le=V.y+V.height/2;return D<K&&K<T&&P<le&&le<j});for(const S of sn(N)){const V=S.axis==="v"?[P,j]:[D,T];Math.min(S.hi,V[1])-Math.max(S.lo,V[0])<tf||(S.axis==="v"?D<S.at&&S.at<T:P<S.at&&S.at<j)&&C||(S.axis==="v"?(Math.abs(S.at-D)<=da&&(F=Math.max(F,S.at+rl)),Math.abs(S.at-T)<=da&&(Z=Math.min(Z,S.at-rl))):(Math.abs(S.at-P)<=da&&(G=Math.max(G,S.at+rl)),Math.abs(S.at-j)<=da&&(re=Math.min(re,S.at-rl))))}}if(F>v-al&&(F=D),G>x-al&&(G=P),Z<E+al&&(Z=T),re<A+al&&(re=j),F===D&&G===P&&Z===T&&re===j)continue;const J=o.get(d),ye={x:J.x,y:J.y,width:J.width,height:J.height},ae=ze(o),we=new Set(ft(ae).map(pt)),Ee=a(ae);r.resizeShape(J,{x:F,y:G,width:Z-F,height:re-G});let U=ze(o),ce=ft(U).filter(Ie=>!we.has(pt(Ie)));const Y=[];if(ce.length>0&&ce.every(Ie=>Ie.kind==="label-over-line"&&!i.has(Ie.edge)&&U.edges.some(N=>N.id===Ie.edge))){for(const Ie of ce){if(Ie.kind!=="label-over-line")continue;const N=U.edges.find(le=>le.id===Ie.edge),C=N&&xf(N,U),S=(f=o.get(Ie.edge))==null?void 0:f.label;if(!C||!S)continue;const V=C.x-S.x,K=C.y-S.y;r.moveElements([S],{x:V,y:K}),Y.push({label:S,dx:V,dy:K})}U=ze(o),ce=ft(U).filter(Ie=>!we.has(pt(Ie)))}const fe=a(U),Se=[...fe].some(Ie=>!Ee.has(Ie));if(ce.length||Se||fe.size>=Ee.size){for(const Ie of Y.reverse())r.moveElements([Ie.label],{x:-Ie.dx,y:-Ie.dy});r.resizeShape(J,ye)}}}function nA(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=Lp((o==null?void 0:o.$parent)??o),a=as(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:Ip(u,i,r),requests:Fp(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 Iy(e,t,n={}){var J,ye;const{i18n:i,lower:o=Oy}=n,r=Ry(e),a=zm(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=FM(t,a,i),u=i&&l.writes.size?nA(l.writes,r.elementRegistry,r.canvas,i):void 0,p=ze(r.elementRegistry),f=new Set(ft(p).map(pt)),d=new Set(ft(p,{includeObservationOnly:!0}).map(pt)),g=new Set(Py(l.ops,ae=>{var we,Ee;return(Ee=(we=r.elementRegistry.get(ae))==null?void 0:we.source)==null?void 0:Ee.id}).keys()),h=new Set(p.edges.map(ae=>ae.id).filter(ae=>!g.has(ae))),m=new Set(t.flatMap(ae=>ae.kind==="sequenceFlow.update"&&(ae.source!==void 0||ae.target!==void 0)?[ae.id]:[])),w=()=>new Set(p.edges.filter(ae=>{var Ee;const we=(Ee=r.elementRegistry.get(ae.id))==null?void 0:Ee.waypoints;return we?!(we.length===ae.waypoints.length&&ae.waypoints.every((U,ce)=>Math.round(U.x)===Math.round(we[ce].x)&&Math.round(U.y)===Math.round(we[ce].y))):!1}).map(ae=>ae.id)),y=(ae,we)=>new Set([...ae].filter(Ee=>!we.has(Ee))),v=new Set(p.shapes.map(ae=>ae.id)),x=mo(p),E=x.length,A=new Set(x.map(([ae,we])=>`${ae}|${we}`)),D=ji(p),P=new Set(D.map(([ae,we])=>`${ae}|${we}`)),T=new Map;for(const ae of r.elementRegistry.filter(we=>"waypoints"in we&&!!we.waypoints))ae.label&&T.set(ae.id,{wps:ae.waypoints.map(we=>({x:we.x,y:we.y})),label:{x:ae.label.x,y:ae.label.y},source:(J=ae.source)==null?void 0:J.id,target:(ye=ae.target)==null?void 0:ye.id});const j=e.get("commandStack");try{qg(j,()=>{o(l.ops,r);for(const U of(u==null?void 0:u.contexts())??[])j.execute(Np,U);XM(r,f,p),ZM(r,p),eA(r,f,p),dM(r,p,m),uM(r,h,v),Zm(r,h);const ae=pf(r,f);Wm(r,A,h);const we=w(),Ee=py(r,f,y(h,we),we);ny(r,h),RM(r,h,m),sy(r,f,h),OM(r,f,h),sM(r,P,h),bM(r,h,p),yy(r,f,y(h,w())),my(r,h,new Set([...m,...Ee])),by(r,v),YM(r,f,v),pf(r,f,ae),tA(r,d,p,h),xy(r,f),gy(r,T,UM(r))})}catch(ae){return{ok:!1,issues:[ae instanceof Ty?ae.issue:{kind:"lower-failed",message:ae instanceof Error?ae.message:String(ae)}],findings:[],stats:c}}const F=ze(r.elementRegistry),G=ft(F,{includeObservationOnly:!0}).filter(ae=>!d.has(pt(ae))),Z=Om(F),re=ji(F);return{ok:!0,issues:[],findings:G,stats:{edgeCrossings:{before:E,after:Z.pairs.length,pairs:Z.pairs,solidPairs:Z.solidPairs,dashedPairs:Z.dashedPairs,mixedPairs:Z.mixedPairs,crossPoolMessages:Z.crossPoolMessages},sharedEndpointCrossings:{before:D.length,after:re.length,pairs:re}}}}function iA(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function By(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Ny(e,t){const n=By(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function $y(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function oA(e){return typeof e=="string"&&Pp.includes(e)}function Gi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Fy(e,t={}){const n=e.rootElements??[],i=n.find(U=>U.$type==="bpmn:Collaboration"),o=new Map(n.filter(U=>U.$type==="bpmn:Process").map(U=>[U.id,U])),r=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],d=[],g=[],h=[],m=[],w=[],y=[],v=new Map,x=new Set,E=new Set,A=U=>{U&&x.add(U)},D=U=>{x.add(U),E.add(U)},P=U=>{const ce=$y(U,"bwl:Placement");if(!ce)return;const Y=typeof ce.anchor=="string"?ce.anchor:void 0;if(!Y||!oA(ce.side))return;const X=typeof ce.offset=="number"?ce.offset:void 0;m.push({owner:U.id,anchor:Y,side:ce.side,...X!==void 0?{offset:X}:{}})},T=U=>{const ce=$y(U,"bwl:Members"),Y=typeof(ce==null?void 0:ce.refs)=="string"?ce.refs.split(/\s+/).filter(Boolean):[];Y.length&&y.push({owner:U.id,refs:Y})},j=U=>{var ce;for(const Y of U)switch(A(Y.id),Y.$type){case"bpmn:TextAnnotation":D(Y.id),v.set(Y.id,Y),c.push({id:Y.id,text:typeof Y.text=="string"?Y.text:""}),P(Y);break;case"bpmn:Association":g.push({id:Y.id,type:Y.$type,source:Gi(Y.sourceRef),target:Gi(Y.targetRef)});break;case"bpmn:Group":{D(Y.id),v.set(Y.id,Y);const X=(ce=Y.categoryValueRef)==null?void 0:ce.value;l.push({id:Y.id,...typeof X=="string"&&X?{name:X}:{}}),T(Y);break}default:u.push({id:Y.id,type:Y.$type,reason:"type-outside-mvp"})}},F=U=>{for(const ce of U.flowElements??[])A(ce.id),u.push({id:ce.id,type:ce.$type,reason:"inside-container"}),(ce.flowElements??[]).length&&F(ce);for(const ce of U.artifacts??[])A(ce.id),u.push({id:ce.id,type:ce.$type,reason:"inside-container"})},G=(U,ce)=>{const Y=U.flowElements??[],X=(U.laneSets??[]).flatMap(Se=>Se.lanes??[]),fe=new Map;for(const Se of X){A(Se.id),v.set(Se.id,Se);for(const Ie of Se.flowNodeRef??[]){const N=Gi(Ie);N&&fe.set(N,Se.id)}}for(const Se of Y){if(A(Se.id),v.set(Se.id,Se),Se.$type==="bpmn:SequenceFlow"){f.push({id:Se.id,source:Gi(Se.sourceRef),target:Gi(Se.targetRef),...typeof Se.name=="string"&&Se.name?{name:Se.name}:{}});continue}if(Se.$type==="bpmn:DataStoreReference"){D(Se.id),s.push({id:Se.id,...Se.name?{name:Se.name}:{}});continue}const Ie=iA(Se.$type),N=Ie==="intermediateCatchEvent"?Mp((Se.eventDefinitions??[]).map(K=>K.$type)):void 0;if(!Hg(Ie)||Ie==="intermediateCatchEvent"&&!N){u.push({id:Se.id,type:Se.$type,reason:"type-outside-mvp"});continue}D(Se.id);const C=Ie==="boundaryEvent"?Gi(Se.attachedToRef):void 0;a.push({id:Se.id,type:Ie,...Se.name?{name:Se.name}:{},...ce?{participant:ce}:{},...fe.has(Se.id)?{lane:fe.get(Se.id)}:{},...C?{attachedTo:C}:{},...N?{eventDefinition:N}:{}}),Ie==="subProcess"&&F(Se);const S=Ny(Se,"bwl:band");S!==void 0&&(p.bands[Se.id]=S);const V=By(Se,"bwl:afterColumn");typeof V=="string"&&V!==""&&w.push([Se.id,V]);for(const K of Se.dataOutputAssociations??[])A(K.id),h.push({id:K.id,type:K.$type,source:Se.id,target:Gi(K.targetRef)});for(const K of Se.dataInputAssociations??[])A(K.id),h.push({id:K.id,type:K.$type,source:Gi((K.sourceRef??[])[0]),target:Se.id})}j(U.artifacts??[])};if(i){const U=new Set;for(const ce of i.participants??[]){D(ce.id),v.set(ce.id,ce);const Y=Gi(ce.processRef);Y&&U.add(Y);const X=Y?o.get(Y):void 0,fe=((X==null?void 0:X.laneSets)??[]).flatMap(C=>C.lanes??[]),Se=fe.map(C=>({id:C.id,...C.name?{name:C.name}:{}}));for(const C of Se)D(C.id);const Ie=!X||(X.flowElements??[]).length===0&&fe.length===0&&(X.artifacts??[]).length===0;r.push({id:ce.id,...ce.name?{name:ce.name}:{},...Ie?{blackBox:!0}:{},...Se.length?{lanes:Se}:{}});const N=Ny(ce,"bwl:poolOrder");N!==void 0&&(p.poolOrders[ce.id]=N),X&&G(X,ce.id)}for(const ce of i.messageFlows??[])A(ce.id),v.set(ce.id,ce),d.push({id:ce.id,source:Gi(ce.sourceRef),target:Gi(ce.targetRef),...typeof ce.name=="string"&&ce.name?{name:ce.name}:{}});j(i.artifacts??[]);for(const[ce,Y]of o)!U.has(ce)&&(Y.flowElements??[]).length>0&&u.push({id:ce,type:Y.$type,reason:"unreachable-process"})}else for(const U of o.values())G(U);const Z=[],re=[],J=[],ye=[],ae=(U,ce)=>!!U&&!!ce&&E.has(U)&&E.has(ce);for(const U of f){if(!ae(U.source,U.target)){u.push({id:U.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}Z.push({id:U.id,source:U.source,target:U.target,...U.name?{name:U.name}:{}}),E.add(U.id)}for(const U of d){if(!ae(U.source,U.target)){u.push({id:U.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}re.push({id:U.id,source:U.source,target:U.target,...U.name?{name:U.name}:{}}),E.add(U.id)}for(const U of h){if(!ae(U.source,U.target)){u.push({id:U.id??"",type:U.type,reason:"endpoint-outside-mvp"});continue}ye.push({...U.id?{id:U.id}:{},source:U.source,target:U.target}),U.id&&E.add(U.id)}for(const U of g){if(!ae(U.source,U.target)){u.push({id:U.id??"",type:U.type,reason:"endpoint-outside-mvp"});continue}J.push({...U.id?{id:U.id}:{},source:U.source,target:U.target})}const we=new Map(l.map(U=>[U.id,U]));for(const{owner:U,refs:ce}of y){const Y=ce.filter(fe=>x.has(fe)),X=we.get(U);X&&Y.length&&(X.members=Y)}for(const U of m)x.has(U.anchor)&&(p.placements[U.owner]={anchor:U.anchor,side:U.side,...U.offset!==void 0?{offset:U.offset}:{}});for(const[U,ce]of w)x.has(ce)&&(p.afterColumns[U]=ce);const Ee={...r.length?{participants:r}:{},nodes:a,sequenceFlows:Z,...re.length?{messageFlows:re}:{},...s.length?{dataStores:s}:{},...ye.length?{dataAssociations:ye}:{},...c.length?{annotations:c}:{},...J.length?{associations:J}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:Ee,hints:p,omitted:u,i18n:rA(Ee,v,e,t.i18n)}:{definition:Ee,hints:p,omitted:u}}function rA(e,t,n,i){const o=Lp(n),r=as(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=Ip(u,i,o);Object.keys(p).length&&(c[l]=p);for(const f of Fp(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 aA(e,t={}){const{definitions:n,warnings:i}=await ua(e);return{...Fy(n,t),warnings:i}}const sA=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Rf(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function cA(e){return Rf(e.processRef)!==void 0}function lA(e){const t=new Set,n=o=>{const r=Rf(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 uA(e){const t=[],n=i=>{for(const o of i.flowElements??[])sA.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 pA(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 Cf(e){const t=[],n=e.rootElements??[],i=lA(e);for(const r of uA(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??[])cA(s)&&pA(r.get(Rf(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 fA(e){const{definitions:t,warnings:n}=await ua(e);return{issues:Cf(t),warnings:n}}const dA=.5,hA=8,gA=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),va=e=>typeof e=="number"?e:Number(e??NaN),sl=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function mA(e){const t=e,n=[],i=typeof t.name=="string"?t.name:typeof t.text=="string"?t.text:"";n.push(`n=${i.replace(/\s+/g," ").trim()}`);for(const r of["sourceRef","targetRef","attachedToRef","processRef","default"])t[r]!==void 0&&n.push(`${r}=${sl(t[r])}`);if(String(e.$type)==="bpmn:Group"){const r=t.categoryValueRef,a=Array.isArray(r)?r:r==null?[]:[r];n.push(`cat=[${a.map(s=>`${sl(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(sl).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function yA(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?[va(s.x),va(s.y),va(s.width),va(s.height)]:[]},r=a=>{if(Array.isArray(a))return a.forEach(r);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=sl(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,o(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(f=>[va(f.x),va(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 jy(e){const t=yA(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:")&&!gA.has(s)&&n.set(c,{type:s,props:mA(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 Hy(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 zy(e,t,n={}){const i=n.moveTolerance??dA,o=jy(e),r=jy(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||Hy(p.geometry,u.geometry,i)||Hy(p.label,u.label,n.labelTolerance??hA))&&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 vA(e,t,n={}){const[i,o]=await Promise.all([ua(e),ua(t)]);return{...zy(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function bA(e){return new Set([...e.added,...e.modified])}function xA(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Gy(e,t,{currentVersion:n,i18n:i}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const o=Iy(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 wA=new Set(["lasso","lasso.selection","hand","hand.move"]),Vy=1e4,_A="bwl-edit-locked",Wy=new WeakMap;function EA(e){const t=Wy.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",Vy,()=>{var s;if(o)return wA.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"],Vy,()=>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(_A,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 Wy.set(e,a),a}const SA=Symbol("bpmn-editor"),Mf={geometry:[],semantic:[]};function RA(){const e=xe.ref(!1),t=xe.ref(!0),n=xe.ref(!1),i=xe.shallowRef(Mf),o=xe.shallowRef(void 0),r=xe.shallowRef(void 0);let a,s,c;const l=()=>{if(p(),!c){i.value=Mf;return}const w=ft(ze(c.get("elementRegistry")),{includeObservationOnly:!0}),y=c.getDefinitions();i.value={geometry:w,semantic:y?Cf(y):[]}};function u(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function p(){const w=u();if(!w||!a){r.value=void 0;return}const y=w.locales(),v={};for(const x of y)v[x]={untranslated:w.untranslatedCount(x),reviewRequested:w.reviewRequestedCount(x)};r.value={designLocale:a.designLocale,locales:y,displayLocale:w.getDisplayLocale()??a.designLocale,counts:v}}function f(){const w=u();w&&(w.configure(a),a&&s&&(s=w.setDisplayLocale(s)))}const d=()=>{e.value=!0,l()};function g(w,y){EA(w).set(!y)}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(w){a=w,f(),p()},setDisplayLocale(w){var v;s=w;const y=(v=u())==null?void 0:v.setDisplayLocale(w);y&&(s=y),p()},setChangeScope(w){o.value=w===void 0?void 0:new Set(w)},requestFocus(w){if(!c)return;const y=c.get("elementRegistry").get(w);y&&(c.get("canvas").scrollToElement(y,180),c.get("selection").select(y))},describeElement(w){const y=c==null?void 0:c.get("elementRegistry").get(w),v=y==null?void 0:y.businessObject;if(!v)return;const x=typeof v.name=="string"&&v.name.trim()!==""?v.name:v.text;return{name:typeof x=="string"&&x.trim()!==""?x.trim():void 0,type:typeof v.$type=="string"?v.$type:""}},attach(w){c&&this.detach(),c=w,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=Mf,o.value=void 0,r.value=void 0},setEditable(w){t.value=w,c&&g(c,w)},async applyAgentBatch(w,y){const v=h();n.value=!0;try{const x=await Gy(v,w,{currentVersion:y,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return x.status==="applied"&&(e.value=!1),x}finally{n.value=!1}},async importXml(w){const{warnings:y}=await h().importXML(w);return e.value=!1,o.value=void 0,l(),{warnings:ef(y)}},async saveXml(){const{xml:w}=await h().saveXML({format:!0});return e.value=!1,w??""},undo:()=>{var w;return(w=m())==null?void 0:w.undo()},redo:()=>{var w;return(w=m())==null?void 0:w.redo()},canUndo:()=>{var w;return((w=m())==null?void 0:w.canUndo())??!1},canRedo:()=>{var w;return((w=m())==null?void 0:w.canRedo())??!1}}}const CA=new RegExp("\\p{Script=Hangul}","u"),MA=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,AA=new RegExp("\\p{Script=Han}","u");function cl(e){const t=CA.test(e),n=MA.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:AA.test(e)?"han":"other"}}function Uy(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 qy(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=Rr(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:$o(a).filter(l=>Cn(l))})}return n}const ms=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function PA(e,t={}){const n=Uy(e),i=qy(e);let o;const r={},a=[],s=[],c=[];for(const h of i){const m=h.trs.filter(w=>(w.body??"")===h.name).map(Cn);if(m.length){const w=[...m].sort().join("+");r[w]=(r[w]??0)+1,o=o?new Set([...o].filter(y=>m.includes(y))):new Set(m)}else h.trs.some(w=>w.body)?a.push(ms(h)):c.push({e:h,inference:cl(h.name)});for(const w of h.trs){const y=Cn(w),v=w.body??"",x=cl(v);x.locale&&x.locale!==y?s.push({...ms(h),locale:y,script:x.script}):y==="ko"&&x.script==="han"&&h.trs.some(E=>E!==w&&E.body===v)&&s.push({...ms(h),locale:y,script:"han"})}}const l=new Set(c.map(h=>h.inference.locale).filter(Boolean));let u,p;if(n)p="kept";else if(o&&o.size===1)[u,p]=[[...o][0],"matched"];else if(o&&o.size>1){const h=l.size===1?[...l][0]:void 0;h&&o.has(h)?[u,p]=[h,"matched"]:p="ambiguous"}else o?p="mixed":l.size===1?[u,p]=[[...l][0],"script"]:p=l.size>1?"mixed":"no-evidence";u&&t.designLocale&&u!==t.designLocale&&([u,p]=[void 0,"non-design"]);const f=n??u,d=[],g=[];for(const{e:h,inference:m}of c)m.locale?m.locale!==f&&d.push({...ms(h),locale:m.locale}):g.push({...ms(h),script:m.script});return{root:{current:n,proposed:u,reason:p},additions:d,undecided:g,drift:a,matchedBy:r,scriptMismatch:s}}function TA(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!Uy(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(qy(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=>Cn(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(Sr,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Yy(e){var i;const t=new Set,n=[];for(const o of(e==null?void 0:e.diagrams)??[])for(const r of((i=o==null?void 0:o.plane)==null?void 0:i.planeElement)??[]){const a=r==null?void 0:r.bpmnElement;!(a!=null&&a.id)||t.has(a)||(t.add(a),n.push(a))}return n}const Af=e=>Cn(e)||void 0,Ky=e=>e.body??"";function Xy(e){const t=new Map;for(const n of Yy(e)){const i=$o(n);i.length&&t.set(n.id,{type:n.$type,cells:i.map(o=>({locale:Af(o),body:Ky(o)}))})}return t}const Zy=e=>JSON.stringify(e.map(t=>t.body).sort());class kA{constructor(){$n(this,"byId",new Map);$n(this,"byBodies",new Map)}add(t,n,i){for(const[o,r]of i){if(!r.cells.some(s=>s.locale))continue;const a={doc:t,version:n,id:o,state:r};Qy(this.byId,o,a),Qy(this.byBodies,Zy(r.cells),a)}}sameId(t){return this.byId.get(t)??[]}sameBodies(t){return this.byBodies.get(Zy(t))??[]}}function Qy(e,t,n){const i=e.get(t);i?i.push(n):e.set(t,[n])}function OA(e,t,n){var s;const i=new Set(t.cells.filter(c=>c.locale).map(c=>c.body)),o=new Map,r=(c,l)=>(c??[]).filter(u=>!u.locale&&u.body===l).length,a=t.cells.every(c=>!c.locale);for(const c of t.cells){if(c.locale||i.has(c.body)||o.has(c.body))continue;const l=r(t.cells,c.body)-(a?0:n?r((s=n.get(e))==null?void 0:s.cells,c.body):1/0);l>0&&o.set(c.body,l)}return o}function Pf(e,t){return[...t.keys()].every(n=>e.cells.some(i=>i.body===n))&&e.cells.some(n=>n.locale&&t.has(n.body))}function DA(e,t,n){const i=new Set(e.cells.filter(r=>r.locale).map(r=>r.locale)),o={cells:[],stale:[],overflow:!1};for(const[r,a]of n){const s=[...new Set(t.cells.filter(l=>l.body===r&&l.locale).map(l=>l.locale))],c=s.filter(l=>!i.has(l));for(const l of s)i.has(l)&&o.stale.push({body:r,locale:l});c.length>a&&(o.overflow=!0);for(const l of c.slice(0,a))o.cells.push({body:r,locale:l}),i.add(l)}return o}const LA=e=>JSON.stringify([...e.cells].sort((t,n)=>(t.body+t.locale).localeCompare(n.body+n.locale)));function IA(e,t){const n={restores:[],ambiguous:[],stale:[],unresolved:[]},i=Xy(e),o=new Set([...i.values()].flatMap(a=>a.cells.map(s=>s.locale).filter(s=>!!s))),r=a=>!o.size||[...o].some(s=>!a.cells.some(c=>c.locale===s));for(const[a,s]of i){const c=OA(a,s,t.baseline);if(!c.size)continue;const l={id:a,type:s.type},p=[["history",t.index.sameId(a).filter(m=>m.doc===t.doc&&Pf(m.state,c)).sort((m,w)=>w.version-m.version).slice(0,1).map(m=>m.state)],["lineage",t.index.sameId(a).filter(m=>m.doc!==t.doc&&Pf(m.state,c)).map(m=>m.state)],["bodies",t.index.sameBodies(s.cells).filter(m=>!(m.doc===t.doc&&m.id===a)&&Pf(m.state,c)).map(m=>m.state)]].find(([,m])=>m.length);if(!p){if(!r(s))continue;for(const[m,w]of c)for(let y=0;y<w;y++)n.unresolved.push({...l,body:m,script:cl(m).script});continue}const[f,d]=p,g=d.map(m=>DA(s,m,c));if(g.some(m=>m.overflow)||new Set(g.map(LA)).size>1){n.ambiguous.push({...l,source:f});continue}const[h]=g;for(const m of h.stale)n.stale.push({...l,...m});h.cells.length&&n.restores.push({...l,source:f,cells:h.cells})}return n}function BA(e,t){if(!t.restores.length)return 0;const n=new Map(Yy(e).map(o=>[o.id,o]));let i=0;for(const o of t.restores){const r=n.get(o.id);if(!r)continue;const a=$o(r),s=new Set(a.map(Af).filter(Boolean));for(const{body:c,locale:l}of o.cells){if(s.has(l))continue;const u=a.find(p=>!Af(p)&&Ky(p)===c);u&&(u.set("xml:lang",l),s.add(l),i++)}}return i}function De(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function NA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tf={exports:{}},Jy;function $A(){if(Jy)return Tf.exports;Jy=1;var e=Tf.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},Tf.exports}var FA=$A(),jA=NA(FA);function Zi(e){if(!(this instanceof Zi))return new Zi(e);e=e||[128,36,1],this._seed=e.length?jA.rack(e[0],e[1],e[2]):e}Zi.prototype.next=function(e){return this._seed(e||!0)},Zi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Zi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Zi.prototype.assigned=function(e){return this._seed.get(e)||!1},Zi.prototype.unclaim=function(e){delete this._seed.hats[e]},Zi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const vn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};vn.td=vn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],vn.option=vn.optgroup=[1,'<select multiple="multiple">',"</select>"],vn.thead=vn.tbody=vn.colgroup=vn.caption=vn.tfoot=[1,"<table>","</table>"],vn.polyline=vn.ellipse=vn.polygon=vn.circle=vn.text=vn.line=vn.path=vn.rect=vn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function zt(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:p}=u;return p.remove(),p}let[o,r,a]=Object.hasOwn(vn,i)?vn[i]:vn._default,s=t.createElement("div");for(s.innerHTML=r+e+a;o--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function HA(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 qn(e,...t){const n=e.style;return W(t,function(i){i&&W(i,function(o,r){n[r]=o})}),e}function Mn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const zA=Object.prototype.toString;function kt(e){return new Vo(e)}function Vo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Vo.prototype.add=function(e){return this.list.add(e),this},Vo.prototype.remove=function(e){return zA.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Vo.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},Vo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Vo.prototype.array=function(){return Array.from(this.list)},Vo.prototype.has=Vo.prototype.contains=function(e){return this.list.contains(e)};function ll(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function kr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function GA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ul={},ev;function VA(){if(ev)return ul;ev=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return ul.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},ul.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},ul}var tv=VA(),WA=GA(tv),je=HA({__proto__:null,default:WA},[tv]),nv=["focus","blur"];function UA(e,t,n,i,o){return nv.indexOf(n)!==-1&&(o=!0),je.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=kr(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function qA(e,t,n,i){return nv.indexOf(t)!==-1&&(i=!0),je.unbind(e,t,n,i)}var ii={bind:UA,unbind:qA};function kf(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function At(e,t){return t=t||document,t.querySelector(e)}function ys(e,t){return t=t||document,t.querySelectorAll(e)}function Qi(e){e.parentNode&&e.parentNode.removeChild(e)}function YA(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function KA(e,t){return t.appendChild(YA(e,t))}function Je(e,t){return KA(t,e),e}var Of=2,iv={"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":Of,"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":Of,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function XA(e,t){return iv[t]?e.style[t]:e.getAttributeNS(null,t)}function ov(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=iv[i];o?(o===Of&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function ZA(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)ov(e,o,t[o])}function Pe(e,t,n){if(typeof t=="string")if(n!==void 0)ov(e,t,n);else return XA(e,t);else ZA(e,t);return e}const QA=Object.prototype.toString;function dt(e){return new Wo(e)}function Wo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Wo.prototype.add=function(e){return this.list.add(e),this},Wo.prototype.remove=function(e){return QA.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Wo.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},Wo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Wo.prototype.array=function(){return Array.from(this.list)},Wo.prototype.has=Wo.prototype.contains=function(e){return this.list.contains(e)};function vs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Df(e){return e.cloneNode(!0)}var Lf={svg:"http://www.w3.org/2000/svg"},rv='<svg xmlns="'+Lf.svg+'"';function JA(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Lf.svg)===-1&&(e=rv+e.substring(4)):(e=rv+">"+e+"</svg>",t=!0);var n=eP(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function eP(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Ne(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=JA(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Lf.svg,e),t&&Pe(n,t),n}var If=null;function av(){return If===null&&(If=Ne("svg")),If}function sv(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function tP(e,t,n,i,o,r){var a=av().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return sv(a,e);case 6:return sv(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function bs(e){return av().createSVGTransform()}var cv=/([&<>]{1})/g,nP=/([&<>\n\r"]{1})/g,iP={"&":"&","<":"<",">":">",'"':"'"};function Bf(e,t){function n(i,o){return iP[o]||o}return e.replace(t,n)}function lv(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(Bf(e.textContent,cv));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,'="',Bf(r.value,nP),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)lv(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Bf(e.nodeValue,cv),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function oP(e){for(var t=e.firstChild,n=[];t;)lv(t,n),t=t.nextSibling;return n.join("")}function uv(e,t){return oP(e)}function cn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function rP(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function aP(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(rP(e,i))}function xs(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),aP(n,t)),n.consolidate()}const sP=/^class[ {]/;function cP(e){return sP.test(e.toString())}function Nf(e){return Array.isArray(e)}function $f(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function pl(...e){e.length===1&&Nf(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const lP=/constructor\s*[^(]*\(\s*([^)]*)\)/m,uP=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,pP=/\/\*([^*]*)\*\//m;function fP(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(cP(e)?lP:uP);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(pP);return(o&&o[1]||i).trim()})||[]}function pv(e,t){const n=t||{get:function(v,x){if(i.push(v),x===!1)return null;throw s(`No provider for "${v}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),a=r.injector=this,s=function(v){const x=i.join(" -> ");return i.length=0,new Error(x?`${v} (Resolving: ${x})`:v)};function c(v,x){if(!o[v]&&v.includes(".")){const E=v.split(".");let A=c(E.shift());for(;E.length;)A=A[E.shift()];return A}if($f(r,v))return r[v];if($f(o,v)){if(i.indexOf(v)!==-1)throw i.push(v),s("Cannot resolve circular dependency!");return i.push(v),r[v]=o[v][0](o[v][1]),i.pop(),r[v]}return n.get(v,x)}function l(v,x){if(typeof x>"u"&&(x={}),typeof v!="function")if(Nf(v))v=pl(v.slice());else throw s(`Cannot invoke "${v}". Expected a function!`);const A=(v.$inject||fP(v)).map(D=>$f(x,D)?x[D]:c(D));return{fn:v,dependencies:A}}function u(v){const{fn:x,dependencies:E}=l(v),A=Function.prototype.bind.call(x,null,...E);return new A}function p(v,x,E){const{fn:A,dependencies:D}=l(v,E);return A.apply(x,D)}function f(v){return pl(x=>v.get(x))}function d(v,x){if(x&&x.length){const E=Object.create(null),A=Object.create(null),D=[],P=[],T=[];let j,F,G,Z;for(let re in o)j=o[re],x.indexOf(re)!==-1&&(j[2]==="private"?(F=D.indexOf(j[3]),F===-1?(G=j[3].createChild([],x),Z=f(G),D.push(j[3]),P.push(G),T.push(Z),E[re]=[Z,re,"private",G]):E[re]=[T[F],re,"private",P[F]]):E[re]=[j[2],j[1]],A[re]=!0),(j[2]==="factory"||j[2]==="type")&&j[1].$scope&&x.forEach(J=>{j[1].$scope.indexOf(J)!==-1&&(E[re]=[j[2],j[1]],A[J]=!0)});x.forEach(re=>{if(!A[re])throw new Error('No provider for "'+re+'". Cannot use provider from the parent!')}),v.unshift(E)}return new pv(v,a)}const g={factory:p,type:u,value:function(v){return v}};function h(v,x){const E=v.__init__||[];return function(){E.forEach(A=>{typeof A=="string"?x.get(A):x.invoke(A)})}}function m(v){const x=v.__exports__;if(x){const E=v.__modules__,A=Object.keys(v).reduce((F,G)=>(G!=="__exports__"&&G!=="__modules__"&&G!=="__init__"&&G!=="__depends__"&&(F[G]=v[G]),F),Object.create(null)),D=(E||[]).concat(A),P=d(D),T=pl(function(F){return P.get(F)});x.forEach(function(F){o[F]=[T,F,"private",P]});const j=(v.__init__||[]).slice();return j.unshift(function(){P.init()}),v=Object.assign({},v,{__init__:j}),h(v,P)}return Object.keys(v).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const A=v[E];if(A[2]==="private"){o[E]=A;return}const D=A[0],P=A[1];o[E]=[g[D],dP(D,P),D]}),h(v,a)}function w(v,x){return v.indexOf(x)!==-1||(v=(x.__depends__||[]).reduce(w,v),v.indexOf(x)!==-1)?v:v.concat(x)}function y(v){const x=v.reduce(w,[]).map(m);let E=!1;return function(){E||(E=!0,x.forEach(A=>A()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=y(e)}function dP(e,t){return e!=="value"&&Nf(t)&&(t=pl(t.slice())),t}var hP=1e3;function vo(e,t){var n=this;t=t||hP,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)})}vo.prototype.canRender=function(e){},vo.prototype.drawShape=function(e,t){},vo.prototype.drawConnection=function(e,t){},vo.prototype.getShapePath=function(e){},vo.prototype.getConnectionPath=function(e){};function Or(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function gP(e){return["M",e.x,e.y]}function Ff(e){return["L",e.x,e.y]}function mP(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function yP(e,t){const n=e.length,i=[gP(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(Ff(a));continue}const c=Math.min(t,jf(a.x-r.x,a.y-r.y),jf(s.x-a.x,s.y-a.y));if(!c){i.push(Ff(a));continue}const l=fl(a,r,c),u=fl(a,r,c*.5),p=fl(a,s,c),f=fl(a,s,c*.5);i.push(Ff(l)),i.push(mP(u,f,p))}return i}function fl(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=jf(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function jf(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function ws(e,t,n){Ke(t)&&(n=t,t=null),t||(t={});const i=Ne("path",t);return Ke(n)&&(i.dataset.cornerRadius=String(n)),Hf(i,e)}function Hf(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Pe(e,{d:Or(yP(t,n))}),e}function dl(e){var t=new Set(e);return ct(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Dr(e,t,n){n=n||0,Ye(e)||(e=[e]),W(e,function(i,o){var r=t(i,o,n);Ye(r)&&r.length&&Dr(r,t,n+1)})}function zf(e,t,n){var i=new Set,o=new Set;return Dr(e,function(r,a,s){i.add(r);var c=r.children;if(c&&!o.has(c))return o.add(c),c}),Array.from(i)}function _s(e,t){return zf(e)}function vP(e,t,n){Er(t)&&(t=!0),yn(t)&&(n=t,t=!0),n=n||{};var i=Es(n.allShapes),o=Es(n.allConnections),r=Es(n.enclosedElements),a=Es(n.enclosedConnections),s=Es(n.topLevel,t&&aa(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=r[u.id]=u),o[u.id]=u}function l(u){if(r[u.id]=u,u.waypoints)a[u.id]=o[u.id]=u;else return i[u.id]=u,W(u.incoming,c),W(u.outgoing,c),u.children}return Dr(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function ln(e,t){t=!!t,Ye(e)||(e=[e]);var n,i,o,r;return W(e,function(a){var s=a;a.waypoints&&!t&&(s=ln(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+p>o||o===void 0)&&(o=c+p),(l+u>r||r===void 0)&&(r=l+u)}),{x:n,y:i,height:r-i,width:o-n}}function ba(e,t){var n={};return W(e,function(i){var o=i;o.waypoints&&(o=ln(o)),!Ke(t.y)&&o.x>t.x&&(n[i.id]=i),!Ke(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(Ke(t.width)&&Ke(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!Ke(t.width)||!Ke(t.height))&&(n[i.id]=i)}),n}function fv(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function dv(e){return!!(e&&e.isFrame)}function Es(e,t){return q({},e||{},t||{})}var bP=1;function Uo(e,t){vo.call(this,e,bP),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})}De(Uo,vo),Uo.prototype.canRender=function(){return!0},Uo.prototype.drawShape=function(t,n,i){var o=Ne("rect");return Pe(o,{x:0,y:0,width:n.width||0,height:n.height||0}),dv(n)?Pe(o,q({},this.FRAME_STYLE,i||{})):Pe(o,q({},this.SHAPE_STYLE,i||{})),Je(t,o),o},Uo.prototype.drawConnection=function(t,n,i){var o=ws(n.waypoints,q({},this.CONNECTION_STYLE,i||{}));return Je(t,o),o},Uo.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 Or(a)},Uo.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 Or(r)},Uo.$inject=["eventBus","styles"];function xP(){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 q(r,{class:n})},this.style=function(n,i){!Ye(n)&&!i&&(i=n,n=[]);var o=ni(n,function(r,a){return q(r,e[a]||{})},{});return i?q(o,i):o},this.computeStyle=function(n,i,o){return Ye(i)||(o=i,i=[]),t.style(i||[],q({},o,n||{}))}}const wP={__init__:["defaultRenderer"],defaultRenderer:["type",Uo],styles:["type",xP]};function on(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function an(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 Gf(e,t){return!e||!t?-1:e.indexOf(t)}function Ss(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Vf(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var o=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),r=Ss(e,t);return Math.abs(o/r)<=i}var _P=2;function bo(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(EP(o,n))return r;return!1}function EP(e,t){const n=t[0];return Bo(t,function(i){return Math.abs(n[e]-i[e])<=_P})}function hv(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 Wf(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var SP=/,?([a-z]),?/gi,gv=parseFloat,un=Math,qo=un.PI,Ji=un.min,eo=un.max,mv=un.pow,Yo=un.abs,RP=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,CP=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,yv=Array.isArray||function(e){return e instanceof Array};function MP(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function AP(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 PP(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 MP(o,i)?(AP(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function TP(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(RP,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(CP,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=qf,n}function kP(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 OP(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(i!=="M"&&i!=="C")return!1}return!0}function Uf(e,t,n,i){return arguments.length===1&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function qf(){return this.join(",").replace(SP,"$1")}function DP(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=qf,t}function vv(e,t,n,i,o,r,a,s,c){var l=1-c,u=mv(l,3),p=mv(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:hl(g),y:hl(h)}}function bv(e){var t=FP(...e);return Uf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Ko(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function LP(e,t){return e=Uf(e),t=Uf(t),Ko(t,e.x,e.y)||Ko(t,e.x2,e.y)||Ko(t,e.x,e.y2)||Ko(t,e.x2,e.y2)||Ko(e,t.x,t.y)||Ko(e,t.x2,t.y)||Ko(e,t.x,t.y2)||Ko(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 xv(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 wv(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=xv(h,e,n,o,a),w=xv(h,t,i,r,s),y=m*m+w*w;d+=f[g]*un.sqrt(y)}return l*d}function IP(e,t,n,i,o,r,a,s){if(!(eo(e,n)<Ji(o,a)||Ji(e,n)>eo(o,a)||eo(t,i)<Ji(r,s)||Ji(t,i)>eo(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=hl(c/u),f=hl(l/u),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+Ji(e,n).toFixed(2)||d>+eo(e,n).toFixed(2)||d<+Ji(o,a).toFixed(2)||d>+eo(o,a).toFixed(2)||g<+Ji(t,i).toFixed(2)||g>+eo(t,i).toFixed(2)||g<+Ji(r,s).toFixed(2)||g>+eo(r,s).toFixed(2)))return{x:p,y:f}}}}function hl(e){return Math.round(e*1e11)/1e11}function BP(e,t,n){var i=bv(e),o=bv(t);if(!LP(i,o))return[];var r=wv(...e),a=wv(...t),s=Ev(e)?1:~~(r/5)||1,c=Ev(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=vv(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=vv(...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],w=l[d+1],y=u[g],v=u[g+1],x=Yo(w.x-m.x)<.01?"y":"x",E=Yo(v.x-y.x)<.01?"y":"x",A=IP(m.x,m.y,w.x,w.y,y.x,y.y,v.x,v.y),D;if(A){if(D=A.x.toFixed(9)+"#"+A.y.toFixed(9),p[D])continue;p[D]=!0;var P=m.t+Yo((A[x]-m[x])/(w[x]-m[x]))*(w.t-m.t),T=y.t+Yo((A[E]-y[E])/(v[E]-y[E]))*(v.t-y.t);P>=0&&P<=1&&T>=0&&T<=1&&f.push({x:A.x,y:A.y,t1:P,t2:T})}}return f}function _v(e,t,n){e=Cv(e),t=Cv(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 w=0,y=t.length;w<y;w++){var v=t[w];if(v[0]=="M")r=l=v[1],a=u=v[2];else{v[0]=="C"?(f=[r,a,...v.slice(1)],r=f[6],a=f[7]):(f=[r,a,r,a,l,u,l,u],r=l,a=u);var x=BP(p,f);{for(var E=0,A=x.length;E<A;E++)x[E].segment1=g,x[E].segment2=w,x[E].bez1=p,x[E].bez2=f;d=d.concat(x)}}}}}return d}function NP(e){return yv(e)&&yv(e[0])}function $P(e){if(kP(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=qf,t}function Ev(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function gl(e,t,n,i){return[e,t,n,i,n,i]}function Sv(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 Rv(e,t,n,i,o,r,a,s,c,l){var u=qo*120/180,p=qo/180*(+o||0),f=[],d,g=PP(function(N,C,S){var V=N*un.cos(S)-C*un.sin(S),K=N*un.sin(S)+C*un.cos(S);return{x:V,y:K}});if(l)D=l[0],P=l[1],E=l[2],A=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,w=h*h/(n*n)+m*m/(i*i);w>1&&(w=un.sqrt(w),n=w*n,i=w*i);var y=n*n,v=i*i,x=(r==a?-1:1)*un.sqrt(Yo((y*v-y*m*m-v*h*h)/(y*m*m+v*h*h))),E=x*n*m/i+(e+s)/2,A=x*-i*h/n+(t+c)/2,D=un.asin(((t-A)/i).toFixed(9)),P=un.asin(((c-A)/i).toFixed(9));D=e<E?qo-D:D,P=s<E?qo-P:P,D<0&&(D=qo*2+D),P<0&&(P=qo*2+P),a&&D>P&&(D=D-qo*2),!a&&P>D&&(P=P-qo*2)}var T=P-D;if(Yo(T)>u){var j=P,F=s,G=c;P=D+u*(a&&P>D?1:-1),s=E+n*un.cos(P),c=A+i*un.sin(P),f=Rv(s,c,n,i,o,0,a,F,G,[P,j,E,A])}T=P-D;var Z=un.cos(D),re=un.sin(D),J=un.cos(P),ye=un.sin(P),ae=un.tan(T/4),we=4/3*n*ae,Ee=4/3*i*ae,U=[e,t],ce=[e+we*re,t-Ee*Z],Y=[s+we*ye,c-Ee*J],X=[s,c];if(ce[0]=2*U[0]-ce[0],ce[1]=2*U[1]-ce[1],l)return[ce,Y,X].concat(f);f=[ce,Y,X].concat(f).join().split(",");for(var fe=[],Se=0,Ie=f.length;Se<Ie;Se++)fe[Se]=Se%2?g(f[Se-1],f[Se],p).y:g(f[Se],f[Se+1],p).x;return fe}function FP(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,f,d,g,h,m,w,y=0;y<2;++y){if(y==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),Yo(u)<1e-12){if(Yo(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}m=p*p-4*f*u,w=un.sqrt(m),!(m<0)&&(g=(-p+w)/(2*u),0<g&&g<1&&c.push(g),h=(-p-w)/(2*u),0<h&&h<1&&c.push(h))}for(var v=c.length,x=v,E;v--;)d=c[v],E=1-d,l[0][v]=E*E*E*e+3*E*E*d*n+3*E*d*d*o+d*d*d*a,l[1][v]=E*E*E*t+3*E*E*d*i+3*E*d*d*r+d*d*d*s;return l[0][x]=e,l[1][x]=t,l[0][x+1]=a,l[1][x+1]=s,l[0].length=l[1].length=x+2,{x0:Ji(...l[0]),y0:Ji(...l[1]),x1:eo(...l[0]),y1:eo(...l[1])}}function Cv(e){if(NP(e)||(e=TP(e)),OP(e))return e;for(var t=DP($P(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",...Rv(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",...Sv(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",...Sv(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...gl(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...gl(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...gl(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...gl(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=gv(u[p-4])||n.x,n.by=gv(u[p-3])||n.y}return t}function Lt(e){return yn(e)&&ti(e,"waypoints")}function rt(e){return yn(e)&&ti(e,"labelTarget")}function jP(e){return yn(e)&&oa(e.parent)}function Mv(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function xo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ge(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function ml(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function HP(e){return xo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function zP(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=WP(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 Xe(e){return Lt(e)?zP(e):HP(e)}function On(e,t,n){n=n||0,yn(n)||(n={x:n,y:n});var i=Ge(e),o=Ge(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 Rs(e,t,n){var i=GP(e,t);return i.length===1||i.length===2&&Ss(i[0],i[1])<1?xo(i[0]):i.length>1?(i=Yi(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),xo(i[n?0:i.length-1])):null}function GP(e,t){return _v(e,t)}function VP(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],Ss(n,o)===0||Vf(i,o,n)?e.splice(t,1):t++;return e}function WP(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function yl(e,t){return Math.round(e*t)/t}function Av(e){return Ke(e)?e+"px":e}function UP(e){for(;e.parent;)e=e.parent;return e}function qP(e){e=q({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),qn(n,{position:"relative",overflow:"hidden",width:Av(e.width),height:Av(e.height)}),t.appendChild(n),n}function Pv(e,t,n){const i=Ne("g");dt(i).add(t);const o=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const YP="base",Tv=0,KP=1,XP={shape:["x","y","width","height"],connection:["waypoints"]};function Ze(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||{})}Ze.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Ze.prototype._init=function(e){const t=this._eventBus,n=this._container=qP(e),i=this._svg=Ne("svg");Pe(i,{width:"100%",height:"100%"}),Mn(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,r=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),Je(n,i);const o=this._viewport=Pv(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Dp(this._viewboxChanged,300)),this._restoreFocus=Dp(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)},Ze.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},Ze.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Ze.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=fv(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Ze.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Ze.prototype.restoreFocus=function(){this._restoreFocus()},Ze.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Ze.prototype.isFocused=function(){return this._focused},Ze.prototype.getDefaultLayer=function(){return this.getLayer(YP,Tv)},Ze.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},Ze.prototype._getChildIndex=function(e){return ni(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Ze.prototype._createLayer=function(e,t){typeof t>"u"&&(t=KP);const n=this._getChildIndex(t);return{group:Pv(this._viewport,"layer-"+e,n),index:t,visible:!0}},Ze.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},Ze.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(cn(n),t.visible=!1),n},Ze.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],cn(t.group))},Ze.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Ze.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const o=this._findPlaneForRoot(UP(i));if(!o||n&&o.rootElement!==n)return;n=o.rootElement}return n},Ze.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Ze.prototype._findPlaneForRoot=function(e){return $t(this._planes,function(t){return t.rootElement===e})},Ze.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Ze.prototype._resolveElements=function(e){return Ye(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Ze.prototype.getContainer=function(){return this._container},Ze.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(W([i.gfx,i.secondaryGfx],function(o){o&&(n?(e.markers.add(t),dt(o).add(t)):(e.markers.delete(t),dt(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Ze.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Ze.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Ze.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Ze.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Ze.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Ze.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,Tv);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Ze.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},Ze.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},Ze.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)},Ze.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})},Ze.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})},Ze.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=XP[e];if(!Bo(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Ze.prototype._setParent=function(e,t,n){an(t.children,e,n),e.parent=t},Ze.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},Ze.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Ze.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Ze.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),on(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},Ze.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Ze.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Ze.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Ze.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Ze.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Ze.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);xs(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=xs(t),o=a?a.matrix:tP(),s=yl(o.a,1e3),c=yl(-o.e||0,1e3),l=yl(-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},Ze.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=q({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),kv(t,n)}),{x:n.e,y:n.f}},Ze.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=ln(r),s=Ge(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=Ge(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),w=Math.min(0,s.top-f.top);u=g||h,p=m||w}this.scroll({dx:-u*l,dy:-p*l})},Ze.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)}),yl(i.a,1e3)};function kv(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Ze.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},Ze.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=q(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),kv(this._viewport,u),u},Ze.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Ze.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}},Ze.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var xa="data-element-id";function mi(e){this._elements={},this._eventBus=e}mi.$inject=["eventBus"],mi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Pe(t,xa,i),n&&Pe(n,xa,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},mi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Pe(i.gfx,xa,""),i.secondaryGfx&&Pe(i.secondaryGfx,xa,""),delete t[n])},mi.prototype.updateId=function(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},mi.prototype.updateGraphics=function(e,t,n){var i=e.id||e,o=this._elements[i];return n?o.secondaryGfx=t:o.gfx=t,t&&Pe(t,xa,i),t},mi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Pe(e,xa);var n=this._elements[t];return n&&n.element},mi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},mi.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var o=n[i],r=t[o],a=r.element,s=r.gfx;if(e(a,s))return a}},mi.prototype.getAll=function(){return this.filter(function(e){return e})},mi.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],o=i.element,r=i.gfx;return e(o,r)})},mi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},mi.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};function ZP(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 QP(e){return e.__refs_collection===!0}function JP(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Ov(e,t,n){var i=ZP(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 eT(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 _i(e,t){if(!(this instanceof _i))return new _i(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}_i.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?Ov(this,t,e):eT(this,t,e)},_i.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return QP(n)||Ov(this,t,e),n},_i.prototype.ensureBound=function(e,t){JP(e,t)||this.bind(e,t)},_i.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},_i.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Yf=new _i({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Dv=new _i({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Lv=new _i({name:"attachers",collection:!0},{name:"host"}),Iv=new _i({name:"outgoing",collection:!0},{name:"source"}),Bv=new _i({name:"incoming",collection:!0},{name:"target"});function wa(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),Yf.bind(this,"parent"),Dv.bind(this,"labels"),Iv.bind(this,"outgoing"),Bv.bind(this,"incoming")}function Cs(){wa.call(this),Yf.bind(this,"children"),Lv.bind(this,"host"),Lv.bind(this,"attachers")}De(Cs,wa);function Nv(){wa.call(this),Yf.bind(this,"children")}De(Nv,Cs);function $v(){Cs.call(this),Dv.bind(this,"labelTarget")}De($v,Cs);function Fv(){wa.call(this),Iv.bind(this,"source"),Bv.bind(this,"target")}De(Fv,wa);var tT={connection:Fv,shape:Cs,label:$v,root:Nv};function nT(e,t){var n=tT[e];if(!n)throw new Error("unknown type: <"+e+">");return q(new n,t)}function iT(e){return e instanceof wa}function wo(){this._uid=12}wo.prototype.createRoot=function(e){return this.create("root",e)},wo.prototype.createLabel=function(e){return this.create("label",e)},wo.prototype.createShape=function(e){return this.create("shape",e)},wo.prototype.createConnection=function(e){return this.create("connection",e)},wo.prototype.create=function(e,t){return t=q({},t||{}),t.id||(t.id=e+"_"+this._uid++),nT(e,t)};var vl="__fn",jv=1e3,oT=Array.prototype.slice;function oi(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}oi.prototype.on=function(e,t,n,i){if(e=Ye(e)?e:[e],_n(t)&&(i=n,n=t,t=jv),!Ke(t))throw new Error("priority must be a number");var o=n;i&&(o=Zn(n,i),o[vl]=n[vl]||n);var r=this;e.forEach(function(a){r._addListener(a,{priority:t,callback:o,next:null})})},oi.prototype.once=function(e,t,n,i){var o=this;if(_n(t)&&(i=n,n=t,t=jv),!Ke(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[vl]=n,this.on(e,t,r)},oi.prototype.off=function(e,t){e=Ye(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},oi.prototype.createEvent=function(e){var t=new Ms;return t.init(e),t},oi.prototype.fire=function(e,t){var n,i,o,r;if(r=oT.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof Ms?n=t:n=this.createEvent(t),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}},oi.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},oi.prototype._destroy=function(){this._listeners={}},oi.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},oi.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=rT(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},oi.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},oi.prototype._getListeners=function(e){return this._listeners[e]},oi.prototype._setListeners=function(e,t){this._listeners[e]=t},oi.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[vl]===t)&&(o?o.next=i:this._setListeners(e,i)),o=n,n=i};function Ms(){}Ms.prototype.stopPropagation=function(){this.cancelBubble=!0},Ms.prototype.preventDefault=function(){this.defaultPrevented=!0},Ms.prototype.init=function(e){q(this,e||{})};function rT(e,t){return e.apply(null,t)}function Xo(e){return e.childNodes[0]}function aT(e){return e.parentNode.childNodes[1]}function bl(e,t,n,i,o){var r=bs();r.setTranslate(t,n);var a=bs();a.setRotate(i||0,0,0);var s=bs();s.setScale(1,1),xs(e,[r,a,s])}function Dn(e,t,n){var i=bs();i.setTranslate(t,n),xs(e,i)}function Hv(e,t){var n=bs();n.setRotate(t,0,0),xs(e,n)}function yi(e,t){this._eventBus=e,this._elementRegistry=t}yi.$inject=["eventBus","elementRegistry"],yi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=aT(t),n||(n=Ne("g"),dt(n).add("djs-children"),Je(t.parentNode,n))):n=t,n},yi.prototype._clear=function(e){var t=Xo(e);return ll(t),t},yi.prototype._createContainer=function(e,t,n,i){var o=Ne("g");dt(o).add("djs-group"),typeof n<"u"?sT(o,t,t.childNodes[n]):Je(t,o);var r=Ne("g");dt(r).add("djs-element"),dt(r).add("djs-"+e),i&&dt(r).add("djs-frame"),Je(o,r);var a=Ne("g");return dt(a).add("djs-visual"),Je(r,a),r},yi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,dv(t))},yi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=ni(e,function(o,r){return r.parent&&(o[r.parent.id]=r.parent),o},{}),W(i,function(o){var r=o.children;if(r){var a=t._getChildrenContainer(o),s=a.firstChild;W(r,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},yi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},yi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},yi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},yi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},yi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Dn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Pe(n,"display","none"):Pe(n,"display","block")}},yi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);cn(t.parentNode)};function sT(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const cT={__depends__:[wP],__init__:["canvas"],canvas:["type",Ze],elementRegistry:["type",mi],elementFactory:["type",wo],eventBus:["type",oi],graphicsFactory:["type",yi]};function lT(e){var t=new pv(e);return t.init(),t}function uT(e){e=e||{};var t={config:["value",e]},n=[t,cT].concat(e.modules||[]);return lT(n)}function Zo(e,t){this._injector=t||uT(e),this.get("eventBus").fire("diagram.init")}Zo.prototype.get=function(e,t){return this._injector.get(e,t)},Zo.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Zo.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Zo.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function zn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Qn(e,t){return e.$instanceOf(t)}function pT(e){return $t(e.rootElements,function(t){return Qn(t,"bpmn:Process")||Qn(t,"bpmn:Collaboration")})}function fT(e){var t={},n=[],i={};function o(Y,X){return function(fe){Y(fe,X)}}function r(Y){t[Y.id]=Y}function a(Y){return t[Y.id]}function s(Y,X){var fe=Y.gfx;if(fe)throw new Error(`already rendered ${zn(Y)}`);return e.element(Y,i[Y.id],X)}function c(Y,X){return e.root(Y,i[Y.id],X)}function l(Y,X){try{var fe=i[Y.id]&&s(Y,X);return r(Y),fe}catch(Se){u(Se.message,{element:Y,error:Se}),console.error(`failed to import ${zn(Y)}`,Se)}}function u(Y,X){e.error(Y,X)}var p=this.registerDi=function(X){var fe=X.bpmnElement;fe?i[fe.id]?u(`multiple DI elements defined for ${zn(fe)}`,{element:fe}):i[fe.id]=X:u(`no bpmnElement referenced in ${zn(X)}`,{element:X})};function f(Y){d(Y.plane)}function d(Y){p(Y),W(Y.planeElement,g)}function g(Y){p(Y)}this.handleDefinitions=function(X,fe){var Se=X.diagrams;if(fe&&Se.indexOf(fe)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!fe&&Se&&Se.length&&(fe=Se[0]),!fe)throw new Error("no diagram to display");i={},f(fe);var Ie=fe.plane;if(!Ie)throw new Error(`no plane for ${zn(fe)}`);var N=Ie.bpmnElement;if(!N)if(N=pT(X),N)u(`correcting missing bpmnElement on ${zn(Ie)} to ${zn(N)}`),Ie.bpmnElement=N,p(Ie);else throw new Error("no process or collaboration to display");var C=c(N,Ie);if(Qn(N,"bpmn:Process")||Qn(N,"bpmn:SubProcess"))m(N,C);else if(Qn(N,"bpmn:Collaboration"))U(N,C),w(X.rootElements,C);else throw new Error(`unsupported bpmnElement for ${zn(Ie)}: ${zn(N)}`);h(n)};var h=this.handleDeferred=function(){for(var X;n.length;)X=n.shift(),X()};function m(Y,X){ae(Y,X),T(Y.ioSpecification,X),P(Y.artifacts,X),r(Y)}function w(Y,X){var fe=ct(Y,function(Se){return!a(Se)&&Qn(Se,"bpmn:Process")&&Se.laneSets});fe.forEach(o(m,X))}function y(Y,X){l(Y,X)}function v(Y,X){W(Y,o(y,X))}function x(Y,X){l(Y,X)}function E(Y,X){l(Y,X)}function A(Y,X){l(Y,X)}function D(Y,X){l(Y,X)}function P(Y,X){W(Y,function(fe){Qn(fe,"bpmn:Association")?n.push(function(){D(fe,X)}):D(fe,X)})}function T(Y,X){Y&&(W(Y.dataInputs,o(E,X)),W(Y.dataOutputs,o(A,X)))}var j=this.handleSubProcess=function(X,fe){ae(X,fe),P(X.artifacts,fe)};function F(Y,X){var fe=l(Y,X);Qn(Y,"bpmn:SubProcess")&&j(Y,fe||X),Qn(Y,"bpmn:Activity")&&T(Y.ioSpecification,X),n.push(function(){W(Y.dataInputAssociations,o(x,X)),W(Y.dataOutputAssociations,o(x,X))})}function G(Y,X){l(Y,X)}function Z(Y,X){l(Y,X)}function re(Y,X){n.push(function(){var fe=l(Y,X);Y.childLaneSet&&J(Y.childLaneSet,fe||X),ce(Y)})}function J(Y,X){W(Y.lanes,o(re,X))}function ye(Y,X){W(Y,o(J,X))}function ae(Y,X){we(Y.flowElements,X),Y.laneSets&&ye(Y.laneSets,X)}function we(Y,X){W(Y,function(fe){Qn(fe,"bpmn:SequenceFlow")?n.push(function(){G(fe,X)}):Qn(fe,"bpmn:BoundaryEvent")?n.unshift(function(){F(fe,X)}):Qn(fe,"bpmn:FlowNode")?F(fe,X):Qn(fe,"bpmn:DataObject")||(Qn(fe,"bpmn:DataStoreReference")||Qn(fe,"bpmn:DataObjectReference")?Z(fe,X):u(`unrecognized flowElement ${zn(fe)} in context ${zn(X&&X.businessObject)}`,{element:fe,context:X}))})}function Ee(Y,X){var fe=l(Y,X),Se=Y.processRef;Se&&m(Se,fe||X)}function U(Y,X){W(Y.participants,o(Ee,X)),n.push(function(){v(Y.messageFlows,X)}),P(Y.artifacts,X)}function ce(Y){W(Y.flowNodeRef,function(X){var fe=X.get("lanes");fe&&fe.push(Y)})}}function dT(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(h,m){return i.add(h,m)},element:function(h,m,w){return i.add(h,m,w)},error:function(h,m){s.push({message:h,context:m})}},f=new fT(p);u=u||l.diagrams&&l.diagrams[0];var d=hT(l,u);if(!d)throw new Error("no diagram to display");W(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 hT(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!M(n,"bpmn:Process")&&!M(n,"bpmn:Collaboration")&&(i=gT(n));var o;M(i,"bpmn:Collaboration")?o=i:o=$t(e.rootElements,function(l){if(M(l,"bpmn:Collaboration"))return $t(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=Fn(o.participants,function(l){return l.processRef}),r.push(o));var a=zv(r),s=[t],c=[n];return W(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function zv(e){var t=[];return W(e,function(n){n&&(t.push(n),t=t.concat(zv(n.flowElements)))}),t}function gT(e){for(var t=e;t;){if(M(t,"bpmn:Process"))return t;t=t.$parent}}var mT='<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>',Gv=mT,Vv={verticalAlign:"middle"},Wv={color:"#404040"},yT={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},vT={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},bT={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"},xT='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Gv+'</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>',to;function wT(){to=zt(xT),qn(to,yT),qn(At("svg",to),Vv),qn(At(".backdrop",to),vT),qn(At(".notice",to),bT),qn(At(".link",to),Wv,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function _T(){to||(wT(),ii.bind(to,".backdrop","click",function(e){document.body.removeChild(to)})),document.body.appendChild(to)}const xl=5,Uv="djs-outline-hidden";function Yt(e){e=q({},ST,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),CT(this._container)}De(Yt,Zo),Yt.prototype.importXML=async function(t,n){const i=this;function o(a){return i.get("eventBus").createEvent(a)}let r=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(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||[]),wl(s,r),s=ET(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Yt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Yt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw wl(r,[]),r}if(typeof t=="string"&&(i=RT(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw wl(r,[]),r}try{this.clear()}catch(r){throw wl(r,[]),r}const{warnings:o}=await dT(this,n,i);return{warnings:o}},Yt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,o;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,o=(await this._moddle.toXML(n,t)).xml,o=this._emit("saveXML.serialized",{xml:o})||o}catch(a){i=a}const r=i?{error:i}:{xml:o};if(this._emit("saveXML.done",r),i)throw i;return r},Yt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=At(":scope > defs",i._svg),a=uv(o),s=r?"<defs>"+uv(r)+"</defs>":"",c=i.getContainer();kt(c).add(Uv);let l;try{l=o.getBBox()}finally{kt(c).remove(Uv)}const u=l.x-xl,p=l.y-xl,f=l.width+xl*2,d=l.height+xl*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
4
|
+
nested error: `+E.message;if(D)return a.addWarning({message:G,error:E}),!0;throw zo(G)}function u(E,A){return l(E,A,!0)}function p(){var E=a.elementsById,A=a.references,D,P;for(D=0;P=A[D];D++){var T=P.element,j=E[P.id],F=go(T).propertiesByName[P.property];if(j||a.addWarning({message:"unresolved reference <"+P.id+">",element:P.element,property:P.property,value:P.id}),F.isMany){var G=T.get(F.name),Q=G.indexOf(P);Q===-1&&(Q=G.length),j?G[Q]=j:G.splice(Q,1)}else T.set(F.name,j)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,g=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function m(E){if(d.test(E)){var A=g.exec(E),D=A&&A[1];!D||h.test(D)||a.addWarning({message:"unsupported document encoding <"+D+">, falling back to UTF-8"})}}function w(E,A){var D=c.peek();try{c.push(D.handleNode(E))}catch(P){l(P,A,r)&&c.push(new Kp)}}function y(E,A){try{c.peek().handleText(E)}catch(D){u(D,A)}}function v(E,A){E.trim()&&y(E,A)}var x=o.getPackages().reduce(function(E,A){return E[A.uri]=A.prefix,E},Object.entries(Yp).reduce(function(E,[A,D]){return E[D]=A,E},o.config&&o.config.nsMap||{}));return s.ns(x).on("openTag",function(E,A,D,P){var T=E.attrs||{},j=Object.keys(T).reduce(function(G,Q){var re=A(T[Q]);return G[Q]=re,G},{}),F={name:E.name,originalName:E.originalName,attributes:j,ns:E.ns};w(F,P)}).on("question",m).on("closeTag",f).on("cdata",y).on("text",function(E,A,D){v(A(E),D)}).on("error",l).on("warn",u),new Promise(function(E,A){var D;try{s.parse(e),p()}catch(G){D=G}var P=i.element;!D&&!P&&(D=zo("failed to parse document as <"+i.type.$descriptor.name+">"));var T=a.warnings,j=a.references,F=a.elementsById;return D?(D.warnings=T,A(D)):E({rootElement:P,elementsById:F,references:j,warnings:T})})},Qp.prototype.handler=function(e){return new Zp(this.model,e)};function yR(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var vR=`<?xml version="1.0" encoding="UTF-8"?>
|
|
5
|
+
`,bR=/<|>|'|"|&|\n\r|\n/g,hm=/<|>|&/g;function Xi(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Xi.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Xi.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Xi.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Xi.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)},Xi.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Xi.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Xi.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Xi.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Xi.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 xR(e){return e.charAt(0).toLowerCase()+e.slice(1)}function wR(e,t){return um(t)?xR(e):e}function gm(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function mm(e){return ei(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function _R(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 ER(e,t){return t.isGeneric?q({localName:t.ns.localName},e):q({localName:wR(t.ns.localName,t.$pkg)},e)}function SR(e,t){return q({localName:t.ns.localName},e)}function RR(e){var t=e.$descriptor;return ct(t.properties,function(n){var i=n.name;if(n.isVirtual||!ti(e,i))return!1;var o=e[i];return o===n.default||o===null?!1:n.isMany?o.length:!0})}var CR={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},MR={"<":"lt",">":"gt","&":"amp"};function ym(e,t,n){return e=ei(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function AR(e){return ym(e,bR,CR)}function PR(e){return ym(e,hm,MR)}function TR(e){return ct(e,function(t){return t.isAttr})}function kR(e){return ct(e,function(t){return!t.isAttr})}function Jp(e){this.tagName=e}Jp.prototype.build=function(e){return this.element=e,this},Jp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function kr(){}kr.prototype.serializeValue=kr.prototype.serializeTo=function(e){e.append(this.escape?PR(this.value):this.value)},kr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(hm)!==-1&&(this.escape=!0),this};function ef(e){this.tagName=e}gm(ef,kr),ef.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Ut(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Ut.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=RR(e),this.parseAttributes(TR(o)),this.parseContainments(kR(o))),this.parseGenericAttributes(e,i),this},Ut.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return ER(t,e)},Ut.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return SR(t,e)},Ut.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Ut.prototype.nsAttributeName=function(e){var t;if(ei(e)?t=jn(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}:q({localName:t.localName},n)},Ut.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}))},Ut.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new kr().build({type:"String"},t));var n=e.$children;n&&W(n,i=>{this.body.push(new Ut(this).build(i))})},Ut.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,o=jn(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)}},Ut.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return W(n,function(o,r){var a=t.parseNsAttribute(e,r,o);a&&i.push(a)}),i},Ut.prototype.parseGenericAttributes=function(e,t){var n=this;W(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(o){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,o)}})},Ut.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;W(e,function(o){var r=i.get(o.name),a=o.isReference,s=o.isMany;if(s||(r=[r]),o.isBody)n.push(new kr().build(o,r[0]));else if(im(o.type))W(r,function(l){n.push(new ef(t.addTagName(t.nsPropertyTagName(o))).build(o,l))});else if(a)W(r,function(l){n.push(new Jp(t.addTagName(t.nsPropertyTagName(o))).build(l))});else{var c=fm(o);W(r,function(l){var u;c?c===pm?u=new Ut(t,o):u=new jc(t,o,c):u=new Ut(t),n.push(u.build(l))})}})},Ut.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Xi(i):t=i),t},Ut.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},Ut.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},Ut.prototype.parseAttributes=function(e){var t=this,n=this.element;W(e,function(i){var o=n.get(i.name);if(i.isReference)if(!i.isMany)o=o.id;else{var r=[];W(o,function(a){r.push(a.id)}),o=r.join(" ")}t.addAttribute(t.nsAttributeName(i),o)})},Ut.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),mm(e)},Ut.prototype.addAttribute=function(e,t){var n=this.attrs;ei(t)&&(t=AR(t));var i=Xg(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)},Ut.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=_R(n).concat(t)),W(t,function(i){e.append(" ").append(mm(i.name)).append('="').append(i.value).append('"')})},Ut.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==kr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),W(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function jc(e,t,n){Ut.call(this,e,t),this.serialization=n}gm(jc,Ut),jc.prototype.parseNsAttributes=function(e){var t=Ut.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},jc.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function OR(){this.value="",this.write=function(e){this.value+=e}}function DR(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 LR(e){e=q({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new OR,r=new DR(o,e.format);e.preamble&&r.append(vR);var a=new Ut,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(IR(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function IR(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Yp)n[i]=Yp[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 Hc(e,t){xi.call(this,e,t)}Hc.prototype=Object.create(xi.prototype),Hc.prototype.fromXML=function(e,t,n){ei(t)||(n=t,t="bpmn:Definitions");var i=new Qp(q({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},Hc.prototype.toXML=function(e,t){var n=new LR(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var BR="BPMN20",NR="http://www.omg.org/spec/BPMN/20100524/MODEL",$R="bpmn",FR=[],jR=[{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"}]}],HR=[{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"}]}],zR={tagAlias:"lowerCase",typePrefix:"t"},GR={name:BR,uri:NR,prefix:$R,associations:FR,types:jR,enumerations:HR,xml:zR},VR="BPMNDI",WR="http://www.omg.org/spec/BPMN/20100524/DI",UR="bpmndi",qR=[{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"]}],YR=[{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"}]}],KR=[],XR={name:VR,uri:WR,prefix:UR,types:qR,enumerations:YR,associations:KR},ZR="DC",QR="http://www.omg.org/spec/DD/20100524/DC",JR="dc",eC=[{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}]}],tC=[],nC={name:ZR,uri:QR,prefix:JR,types:eC,associations:tC},iC="DI",oC="http://www.omg.org/spec/DD/20100524/DI",rC="di",aC=[{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"}]}],sC=[],cC={tagAlias:"lowerCase"},lC={name:iC,uri:oC,prefix:rC,types:aC,associations:sC,xml:cC},uC="bpmn.io colors for BPMN",pC="http://bpmn.io/schema/bpmn/biocolor/1.0",fC="bioc",dC=[{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]}],hC=[],gC=[],mC={name:uC,uri:pC,prefix:fC,types:dC,enumerations:hC,associations:gC},yC="BPMN in Color",vC="http://www.omg.org/spec/BPMN/non-normative/color/1.0",bC="color",xC=[{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"}]}],wC=[],_C=[],EC={name:yC,uri:vC,prefix:bC,types:xC,enumerations:wC,associations:_C};const SC={bpmn:GR,bpmndi:XR,dc:nC,di:lC,bioc:mC,color:EC};function vm(e,t){const n=q({},SC,e);return new Hc(n,t)}const RC={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"}},zc={[Qg]:RC,[Pp]:qg};function bm(){return vm(zc)}const xm=bm();async function pa(e){const{rootElement:t,warnings:n}=await xm.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function CC(e){const{xml:t}=await xm.toXML(e,{format:!0});return t}function tf(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const fa={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},MC=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function AC(e){const t=fa;return MC.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 da(e,t){let n=0;for(const i of e)n+=t*AC(i);return n}function wm(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&PC(e),TC(e),kC(e),OC(e)}function PC(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:da(o,r),fontBoundingBoxAscent:r*fa.ascentEm,fontBoundingBoxDescent:r*fa.descentEm,actualBoundingBoxAscent:r*fa.ascentEm,actualBoundingBoxDescent:r*fa.descentEm}}};t.getContext=()=>n}function TC(e){if(e.SVGMatrix)return;class t{constructor(){$n(this,"a",1);$n(this,"b",0);$n(this,"c",0);$n(this,"d",1);$n(this,"e",0);$n(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 kC(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 OC(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:da(n,12),height:14}})}const Gc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),DC=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),LC=1,Vc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),IC=2;function pt(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"label-over-shape":return`ls|${e.edge}|${e.shape}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"edge-endpoint-detached":return`d|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"edge-along-group-boundary":return`eg|${e.edge}|${e.group}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const _m=20,Wc=5,Em=3,BC=8,ha=15,nf=50,Sm=12,NC=Sm*1.2;function of(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>da(r,Sm))),o=n.length*NC;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-o/2,width:i,height:o}}const Rm=1;function sn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],o=e.waypoints[n+1];Math.abs(i.y-o.y)<.5&&Math.abs(i.x-o.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,o.x),hi:Math.max(i.x,o.x),dir:o.x>i.x?1:-1}):Math.abs(i.x-o.x)<.5&&Math.abs(i.y-o.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,o.y),hi:Math.max(i.y,o.y),dir:o.y>i.y?1:-1})}return t}function Or(e,t){let n=null;const i=e.type!==t.type,r=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of sn(e))for(const s of sn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Rm)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>=_m&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function rf(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Cm(e,t){const n=Or(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function $C(e,t){let n=0;for(const i of t)i.id!==e.id&&Cm(e,i)&&n++;return n}function hi(e,t){let n=0;for(const i of t)i.id!==e.id&&Or(e,i)&&n++;return n}const Mm=15,Am=20;function FC(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Am||t.at>n[1]+Am)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 af=20;function Uc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Rm)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<_m||n.push([o-af,r+af])}return n}function qc(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of sn(e)){const r=FC(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Uc(o,sn(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const jC=10,HC=1,zC=(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 GC(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 sf(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 VC=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ga=1;function Fi(e,t){const n=e.x+ga,i=e.x+e.width-ga,o=e.y+ga,r=e.y+e.height-ga;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 ma(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 Pm(e,t){const n=e.label;if(!n)return null;if(sn(e).some(i=>Fi(n,i)))return e.id;for(const i of[...t.edges].filter(o=>o.id!==e.id).sort((o,r)=>o.id.localeCompare(r.id)))if(sn(i).some(o=>Fi(n,o)))return i.id;for(const i of t.shapes.filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(ma(i).some(o=>Fi(n,o)))return i.id;return null}function Vt(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(GC(e.waypoints[r],e.waypoints[r+1],o,IC)){i.push(o);break}}return i}const fs=(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))},WC=(e,t,n,i)=>km(e,t,n,i)?0:Math.min(fs(e,n,i),fs(t,n,i),fs(n,e,t),fs(i,e,t)),Tm=(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 Dr(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,fs({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(Tm(e,s)||Tm(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,WC(e,t,s[l],s[(l+1)%s.length]));return c}function km(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 cf=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Om(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(km(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function ds(e,t){let n=0;for(const i of t)i.id===e.id||cf(e,i)||Om(e,i)&&n++;return n}function gi(e,t){let n=0;for(const i of t)i.id===e.id||cf(e,i)||ds(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Dm(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++)ds(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function mo(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(ds(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 ji(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(cf(n[i],n[o])&&Om(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 Lm(e){const t=mo(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:UC(e)}}function UC(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 Im(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!Vc.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=Wt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const o=Wt(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 Nm=e=>e?{members:e}:{},Hn=e=>e.shapes.filter(t=>!t.container);function qC(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 YC(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(sn(i).some(o=>Fi(n,o)))return i.id;for(const i of[...t.shapes].filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(ma(i).some(o=>Fi(n,o)))return i.id;return null}function Go(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 Fm=3;function jm(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 hs(e,t){const n=[];for(const i of t.shapes){if(i.container||Vc.has(i.type))continue;const o=jm(e,i);o>=Fm&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function lf(e){const t=[],n=e.filter(o=>o.type==="bpmn:Participant"),i=(o,r)=>o.x<=r.x&&o.y<=r.y&&o.x+o.width>=r.x+r.width&&o.y+o.height>=r.y+r.height;for(let o=0;o<n.length;o++)for(let r=o+1;r<n.length;r++){const a=n[o],s=n[r];a.x+a.width<=s.x||s.x+s.width<=a.x||a.y+a.height<=s.y||s.y+s.height<=a.y||t.push({pools:[a.id,s.id],contained:i(a,s)||i(s,a)})}return t}function ft(e,t={}){const n=[],i=e.shapes.filter(y=>!y.container);for(const y of e.edges)for(const v of Vt(y,i))n.push({kind:"edge-crosses-shape",edge:y.id,shape:v.id});const o=e.shapes.filter(y=>y.container&&DC.has(y.type));if(o.length){const y=(v,x)=>{const E=e.shapes.find(A=>A.id===x);return!!E&&E.x>=v.x&&E.y>=v.y&&E.x+E.width<=v.x+v.width&&E.y+E.height<=v.y+v.height};for(const v of e.edges)for(const x of Vt(v,o))v.endpoints.includes(x.id)||v.endpoints.some(E=>y(x,E))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:x.id})}for(const y of e.edges){if(y.waypoints.length<2)continue;const v=[[y.source,y.waypoints[0]],[y.target,y.waypoints[y.waypoints.length-1]]];for(const[x,E]of v){if(!x)continue;const A=e.shapes.find(j=>j.id===x);if(!A||A.container)continue;const D=Math.max(A.x-E.x,E.x-(A.x+A.width),0),P=Math.max(A.y-E.y,E.y-(A.y+A.height),0),T=Math.hypot(D,P);T>jC&&n.push({kind:"edge-endpoint-detached",edge:y.id,shape:x,distance:Math.round(T)})}}for(const y of lf(e.shapes))n.push({kind:"pool-overlap",...y});const r=i.filter(y=>!y.attached);for(let y=0;y<r.length;y++)for(let v=y+1;v<r.length;v++){const x=r[y],E=r[v];if(!sf(x,E,LC))continue;const A=x.id<E.id?[x.id,E.id]:[E.id,x.id];n.push({kind:"shape-overlap",shapes:A,identical:VC(x,E)})}const a=e.shapes.filter(y=>y.type==="bpmn:Group"&&Array.isArray(y.members)&&y.members.length>0);for(let y=0;y<a.length;y++)for(let v=y+1;v<a.length;v++){const x=a[y],E=a[v],A=Math.min(x.x+x.width,E.x+E.width)-Math.max(x.x,E.x),D=Math.min(x.y+x.height,E.y+E.height)-Math.max(x.y,E.y);if(A<=Wc||D<=Wc)continue;const P=x.id<E.id?[x.id,E.id]:[E.id,x.id],T=new Set(E.members);if(x.members.some(F=>T.has(F))){const F=Im(e,a,{x:Math.max(x.x,E.x),y:Math.max(x.y,E.y),right:Math.min(x.x+x.width,E.x+E.width),bottom:Math.min(x.y+x.height,E.y+E.height)});F.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:P,shapes:F});continue}const j=x.x<=E.x&&x.y<=E.y&&x.x+x.width>=E.x+E.width&&x.y+x.height>=E.y+E.height?x.id:E.x<=x.x&&E.y<=x.y&&E.x+E.width>=x.x+x.width&&E.y+E.height>=x.y+x.height?E.id:void 0;n.push({kind:"group-overlap-unintended",groups:P,...j?{container:j}:{}})}const s=new Set(a.flatMap(y=>[...y.members])),c=y=>e.shapes.filter(v=>!v.container&&!Vc.has(v.type)&&v.x>=y.x&&v.y>=y.y&&v.x+v.width<=y.x+y.width&&v.y+v.height<=y.y+y.height);for(const y of a){const v=c(y);if(!v.length)continue;const x=new Set(y.members),E=v.filter(A=>!x.has(A.id));E.some(A=>s.has(A.id))&&(E.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:y.id,shapes:E.map(A=>A.id).sort()}))}for(const y of a){const v=new Set(c(y).map(T=>T.id)),x=new Set(y.members),E=new Set([...v].filter(T=>!x.has(T)&&s.has(T)));if(!E.size)continue;let A=!1,D=!1,P=!1;for(const T of e.edges){if(T.type!=="bpmn:SequenceFlow"||!T.source||!T.target)continue;const j=E.has(T.source),F=E.has(T.target);!j&&F&&!v.has(T.source)?A=!0:j&&!F&&!v.has(T.target)?D=!0:j&&F&&(P=!0)}A&&D&&P&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:y.id,shapes:[...E].sort()})}const l=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<l.length;y++)for(let v=y+1;v<l.length;v++)for(let x=v+1;x<l.length;x++){const E=[l[y],l[v],l[x]],A={x:Math.max(...E.map(T=>T.x)),y:Math.max(...E.map(T=>T.y)),right:Math.min(...E.map(T=>T.x+T.width)),bottom:Math.min(...E.map(T=>T.y+T.height))};if(A.right-A.x<=Wc||A.bottom-A.y<=Wc)continue;const D=Im(e,[],A);if(!D.length)continue;const P=E.map(T=>T.id).sort();n.push({kind:"group-stack-unreadable",groups:P,shapes:D})}for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||Vc.has(v.type)||v.width<=0||v.height<=0)continue;const x=[["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[E,A,D,P,T]of x){const j=D==="h"?v.x:v.y,F=D==="h"?v.x+v.width:v.y+v.height;if(!(j<T&&P<F))continue;const G=D==="h"?v.y:v.x,Q=D==="h"?v.y+v.height:v.x+v.width;if(!(G<A&&A<Q))continue;const re=Math.min(A-G,Q-A);re<BC||n.push({kind:"group-cuts-shape",group:y.id,shape:v.id,side:E,depth:re})}}const u=t.includeObservationOnly?e.shapes.filter(y=>y.type==="bpmn:Group"&&y.width>0&&y.height>0):[];if(u.length){const y=new Map(e.shapes.filter(v=>!v.container).map(v=>[v.id,{x:v.x+v.width/2,y:v.y+v.height/2}]));for(const v of e.edges){if(v.type!=="bpmn:SequenceFlow"&&v.type!=="bpmn:MessageFlow")continue;const x=sn(v);if(x.length)for(const E of u){const A=E.x+E.width,D=E.y+E.height,P=v.endpoints.some(j=>{const F=y.get(j);return!!F&&E.x<F.x&&F.x<A&&E.y<F.y&&F.y<D});let T=null;for(const j of x){const[F,G,Q]=j.axis==="v"?[E.y,D,[["left",E.x],["right",A]]]:[E.x,A,[["top",E.y],["bottom",D]]],re=Math.min(j.hi,G)-Math.max(j.lo,F);if(re<nf)continue;const J=j.axis==="v"?E.x<j.at&&j.at<A:E.y<j.at&&j.at<D;if(!(J&&P))for(const[ye,ae]of Q){const xe=Math.abs(j.at-ae);xe<=ha&&(!T||xe<T.distance)&&(T={side:ye,inside:J,distance:xe,length:re})}}T&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:E.id,side:T.side,inside:T.inside,distance:Math.round(T.distance),length:Math.round(T.length)})}}}const p=e.shapes.filter(y=>y.container&&y.type!=="bpmn:Group"&&y.type!=="bpmn:Lane");for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of p){const x=y.x<v.x+v.width&&v.x<y.x+y.width,E=y.y<v.y+v.height&&v.y<y.y+y.height,A=[["top",y.y,v.y,x],["bottom",y.y+y.height,v.y+v.height,x],["left",y.x,v.x,E],["right",y.x+y.width,v.x+v.width,E]];for(const[D,P,T,j]of A)j&&Math.abs(P-T)<=Em&&n.push({kind:"group-on-container-boundary",group:y.id,container:v.id,side:D})}const f=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<f.length;y++)for(let v=y+1;v<f.length;v++){const x=f[y],E=f[v],A=x.x<E.x+E.width&&E.x<x.x+x.width,D=x.y<E.y+E.height&&E.y<x.y+x.height,P=[["x",x.x+x.width,E.x,D],["x",E.x+E.width,x.x,D],["y",x.y+x.height,E.y,A],["y",E.y+E.height,x.y,A]];for(const[T,j,F,G]of P)if(G&&Math.abs(j-F)<=Em){n.push({kind:"group-on-group-boundary",groups:x.id<E.id?[x.id,E.id]:[E.id,x.id],axis:T});break}}for(let y=0;y<e.edges.length;y++)for(let v=y+1;v<e.edges.length;v++){const x=e.edges[y],E=e.edges[v],A=Or(x,E);if(!A)continue;const D=x.id<E.id?[x.id,E.id]:[E.id,x.id];n.push({kind:A.kind==="opposite"?"edge-overlap-opposite":A.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:D,axis:A.axis,length:Math.round(A.length)})}for(const y of e.edges){if(!y.label)continue;const v=qc(y,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:y.id,other:v.other,axis:v.axis})}for(const y of e.edges){if(!y.label)continue;const v=Pm(y,e);v&&n.push({kind:"label-over-line",edge:y.id,line:v})}if(t.includeObservationOnly){for(const y of e.edges)if(!(!y.label||y.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:x}of hs(y.label,e))n.push({kind:"label-over-shape",edge:y.id,shape:v,depth:Math.round(x)})}const d=new Set(i.map(y=>y.id)),g=e.shapes.filter(y=>y.type==="bpmn:Participant"&&y.label);for(const y of[...i,...g.filter(v=>!d.has(v.id))]){if(!y.label)continue;const v=$m(y,e);v&&n.push({kind:"label-over-line",edge:y.id,line:v})}const h=new Set(e.shapes.filter(y=>y.type==="bpmn:TextAnnotation").map(y=>y.id));for(const y of g)for(const{owner:v,rect:x}of Go(e))v===y.id||h.has(v)||sf(y.label,x,ga)&&n.push({kind:"pool-name-over-label",pool:y.id,label:v});const m=Go(e);for(const y of i)if(y.type==="bpmn:TextAnnotation")for(const{owner:v,rect:x}of m)v!==y.id&&sf(y,x,ga)&&n.push({kind:"annotation-over-label",annotation:y.id,label:v});const w=new Map(e.shapes.map(y=>[y.id,y]));for(const y of i){const v=y.parent??qC(y,e,w);if(!v)continue;const x=w.get(v);!x||!x.container||zC(x,y,HC)||y.type==="bpmn:TextAnnotation"&&!YC(y,x,e)||n.push({kind:"shape-outside-container",shape:y.id,container:x.id})}return n.sort((y,v)=>pt(y).localeCompare(pt(v)))}const Wt=e=>typeof e=="object"&&e!==null?e:void 0,nn=e=>typeof e=="number"?e:0,yo=e=>{const t=Wt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function KC(e){const t=Wt(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=yo(r);a&&n.push(a)}}return n}function XC(e){const t=Wt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:yo(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:yo(t.targetRef);return n&&i?{source:n,target:i}:{}}function ZC(e,t){const n=Wt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=yo(n);return o?t.get(o):void 0}if(Gc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return yo(n)}function Hm(e){var a,s,c,l,u;const t=[],n=[],i=((a=Wt(e))==null?void 0:a.diagrams)??[],o=new Map,r=new Set;for(const p of((s=Wt(e))==null?void 0:s.rootElements)??[]){const f=Wt(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=Wt(d),h=yo(g),m=yo(g==null?void 0:g.processRef);h&&m?o.set(m,h):h&&r.add(h)}}for(const p of i){const f=Wt((c=Wt(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=Wt(g);if(!h)continue;const m=Wt(h.bpmnElement),w=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!w)continue;const y=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",v=Wt(h.bounds);if(v){const E=h.isExpanded===!1&&y!=="bpmn:Participant",A=Wt((l=Wt(h.label))==null?void 0:l.bounds),D={id:w,type:y,x:nn(v.x),y:nn(v.y),width:nn(v.width),height:nn(v.height),container:Gc.has(y)&&!E,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:ZC(m,o)}:{},...A?{label:{x:nn(A.x),y:nn(A.y),width:nn(A.width),height:nn(A.height)}}:{},...y==="bpmn:Group"?Nm(Bm(m)):{}},P=h.isHorizontal!==!1,T=typeof(m==null?void 0:m.name)=="string"?m.name:"";r.has(w)&&P&&T&&(D.label=of(D,T)),t.push(D);continue}const x=h.waypoint;if(Array.isArray(x)){const E=Wt((u=Wt(h.label))==null?void 0:u.bounds);n.push({id:w,type:y,waypoints:x.map(A=>{var D,P;return{x:nn((D=Wt(A))==null?void 0:D.x),y:nn((P=Wt(A))==null?void 0:P.y)}}),endpoints:KC(m),...XC(m),...E?{label:{x:nn(E.x),y:nn(E.y),width:nn(E.width),height:nn(E.height)}}:{}})}}}return{shapes:t,edges:n}}function zm(e){return ft(Hm(e),{includeObservationOnly:!0})}async function QC(e){const{definitions:t,warnings:n}=await pa(e);return{findings:zm(t),warnings:n}}function ze(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=Wt(r.label),m=yo(r.source),w=yo(r.target);n.push({id:r.id,type:a,waypoints:s.map(y=>({x:nn(y.x),y:nn(y.y)})),endpoints:[m,w].filter(y=>!!y),...m&&w?{source:m,target:w}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:nn(h.y),width:nn(h.width),height:nn(h.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=Wt(r.businessObject),l=Wt(r.label);let u=Wt(r.parent);for(;u&&u.type==="bpmn:Lane";)u=Wt(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&Gc.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:nn(r.width),height:nn(r.height),container:Gc.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:nn(l.y),width:nn(l.width),height:nn(l.height)}}:{},...a==="bpmn:Group"?Nm(Bm(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=Wt(r.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=of(d,g)),t.push(d)}return{shapes:t,edges:n}}const JC={"bpmn:Participant":"participant","bpmn:Lane":"lane","bpmn:SequenceFlow":"sequenceFlow","bpmn:MessageFlow":"messageFlow","bpmn:DataStoreReference":"dataStore","bpmn:DataInputAssociation":"dataAssociation","bpmn:DataOutputAssociation":"dataAssociation","bpmn:TextAnnotation":"annotation","bpmn:Association":"association","bpmn:Group":"group"};function eM(e,t){const n=JC[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Gm(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Vm(e){const t=()=>e.getAll().filter(n=>n.type!=="label"&&!("labelTarget"in n&&n.labelTarget));return{isCollaboration:()=>t().some(n=>n.type==="bpmn:Participant"),categoryOf:n=>{const i=e.get(n);if(!(!i||i.type==="label"))return eM(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Gm(i)===n).sort((i,o)=>i.y-o.y).map(i=>i.id),laneDeclarationOrderOf:n=>{var s;const i=e.get(n),o=(s=i==null?void 0:i.businessObject)==null?void 0:s.processRef,r=[],a=c=>{for(const l of c??[])for(const u of l.lanes??[])r.push(u.id),a(u.childLaneSet?[u.childLaneSet]:void 0)};return a(o==null?void 0:o.laneSets),r},participantOf:n=>{const i=e.get(n);return i?Gm(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 Ap(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:Fo(i.businessObject).map(o=>o.locale)}}}const uf=20,tM=4,Ue=(e,t)=>Math.abs(e-t)<.5;function Yc(e,t,n,i=uf){if(Ue(e.y,t.y)&&!Ue(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(Ue(e.x,t.x)&&!Ue(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 Wm(e,t,n,i=uf){if(n.length<2)return null;if(Ue(e.y,t.y)&&!Ue(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(Ue(e.x,t.x)&&!Ue(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 Um(e,t,n=uf){if(e.length!==4)return null;const[i,o,r,a]=e;if(Ue(i.y,o.y)&&Ue(o.x,r.x)&&Ue(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(Ue(i.x,o.x)&&Ue(o.y,r.y)&&Ue(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 Kc(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 Xc=30,nM=[0,-25,25,-40,40];function iM(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+Xc:s-Xc,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return nM.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}]).filter(f=>Vt({...e,endpoints:[],waypoints:f},[n]).length===0)}const pf=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],ya=(e,t,n)=>Vt({...e,waypoints:t},n).length;function Zc(e,t,n,i){let o=[...e.waypoints],r=ya(e,o,t);if(r===0)return null;let a=!1;for(const p of Kc(e,t))if(ya(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(sn),c=p=>sn({...e,waypoints:p}).some(f=>Uc(f,s).length>0),l=iM(e,t).filter(p=>ya(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&&Ue(p.y+p.height/2,f.y+f.height/2)){const d=[o[0],o[o.length-1]];if(Ue(d[0].y,d[1].y)&&!Ue(d[0].x,d[1].x)){const g=t.filter(y=>!e.endpoints.includes(y.id)&&Vt({...e,waypoints:d},[y]).length>0),h=g.length>=2?Wm(d[0],d[1],g):null,w=(h?h.map(y=>[d[0],...y,d[1]]):g.length===1?(Yc(d[0],d[1],g[0])??[]).map(y=>[d[0],...y,d[1]]):g.length===0?[d]:[]).filter(y=>ya(e,y,t)===0&&y.length<=o.length).sort((y,v)=>Number(u(v))-Number(u(y)));if(w.length)return w.find(y=>!c(y))??w[0]}}}for(let p=0;p+1<o.length;p++){const f=o[p],d=o[p+1],g=t.filter(w=>!e.endpoints.includes(w.id)&&Vt({...e,waypoints:[f,d]},[w]).length>0);if(g.length<2)continue;const h=Wm(f,d,g);if(!h)continue;const m=h.map(w=>pf(o,p,w)).filter(w=>ya(e,w,t)===0).sort((w,y)=>Number(u(y))-Number(u(w)));if(m.length)return m.find(w=>!c(w))??m[0]}for(let p=0;p<tM&&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)||Vt({...e,waypoints:[g,h]},[m]).length===0)continue;const w=Yc(g,h,m),y=w?w.map(x=>pf(o,d,x)):Um(o,m)??[];if(!y.length)continue;const v=[...y].sort((x,E)=>Number(u(E))-Number(u(x)));for(const x of v){const E=ya(e,x,t);if(E<r){o=x,r=E,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&r===0?o:null}function ff(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ze(i),a=Hn(r),s=new Set,c=ft(r).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(pt(u)));if(!c.length)return s;const l=new Map;for(const u of c){if(u.kind!=="edge-crosses-shape"||l.has(u.edge))continue;const p=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=Vt(p,a);if(!n&&h.length&&h.every(x=>x.type==="bpmn:TextAnnotation")){s.add(u);continue}const m=Zc(p,a,g,r.edges);if(!m){h.some(x=>x.type==="bpmn:TextAnnotation")&&s.add(u);continue}const w=r.edges.filter(x=>x.id!==u),y=hi(p,w);hi({...p,waypoints:m},w)>y||o.updateWaypoints(f,m)}return s}const oM=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 Qc(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 df=(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),hf=(e,t)=>ds(e,[t])>0;function qm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ze(i),a=Hn(r);let s=r;const c=new Set(ft(r).map(pt));for(const[l,u]of mo(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(D=>D.id===p),g=s.edges.find(D=>D.id===f);if(!d||!g)continue;const h=i.get(p);if(!h)continue;const m=Qc(h),w=oM(g),y=[...Kc(d,a)??[]],v=Zc(d,[...a,...w],m,r.edges);v&&y.push(v);for(let D=0;D+1<d.waypoints.length;D++)for(const P of w)for(const T of Yc(d.waypoints[D],d.waypoints[D+1],P)??[])y.push(pf(d.waypoints,D,T));const x=s.edges.filter(D=>D.id!==p),E=D=>({...s,edges:s.edges.map(P=>P.id===p?{...P,waypoints:D}:P)}),A=y.find(D=>{const P={...d,waypoints:D};return hf(P,g)||!df(D,m)||x.some(T=>T.id!==f&&!hf(d,T)&&hf(P,T))?!1:ft(E(D)).every(T=>c.has(pt(T)))});if(A){o.updateWaypoints(h,A),s=E(A);break}}}const rM=["top","bottom","left","right"],Ym={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},gs=20,aM=20;function sM(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&&Ue(e.y,t.y)&&o.push("top"),n&&Ue(e.y,t.y+t.height)&&o.push("bottom"),i&&Ue(e.x,t.x)&&o.push("left"),i&&Ue(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const cM=(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 Km(e,t,n,i){const o=Ym[t],r=Ym[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(Ue(e[f],n[f]))return d===-g&&d*(n[p]-e[p])>=gs?[e,n]:null;let h;if(d===-g){const w=e[p]+d*gs,y=n[p]-d*gs;if(d*(y-w)<0)return null;h=Math.round((e[p]+n[p])/2)}else h=d>0?Math.max(e[p],n[p])+Xc:Math.min(e[p],n[p])-Xc;const m=(w,y)=>a?{x:y,y:w}:{x:w,y};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>=gs&&u>=gs?[e,c,n]:null}function lM(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?sM(a,r):null;if(!s)return[];const c=[];for(const l of rM){const u=cM(t,l),p=o?Km(u,l,a,s):Km(a,s,u,l);p&&c.push(p)}return c}const Xm=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 uM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ze(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=new Set(ft(r).map(pt));let c=r;for(const[l,u]of ji(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(T=>T.id===l),f=c.edges.find(T=>T.id===u);if(!p||!f||p.type!=="bpmn:SequenceFlow"||f.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!ji({edges:[p,f]}).length)continue;const d=p.endpoints.find(T=>f.endpoints.includes(T)),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 w=T=>n.has(T.id)?[T.waypoints]:[T.waypoints,...lM(T,g,a)],y=T=>T.length-2,v=w(p).flatMap(T=>w(f).map(j=>({pa:T,pb:j}))).filter(({pa:T,pb:j})=>T!==p.waypoints||j!==f.waypoints).map(T=>({...T,cost:Xm(T.pa)+Xm(T.pb)+aM*(y(T.pa)+y(T.pb))})).sort((T,j)=>T.cost-j.cost),x=Qc(h),E=Qc(m),A=ji(c).length,D=new Set(mo(c).map(([T,j])=>`${T}|${j}`)),P=v.find(({pa:T,pb:j})=>{const F={...p,waypoints:T},G={...f,waypoints:j};if(ji({edges:[F,G]}).length||Or(F,G)||!df(T,x)||!df(j,E))return!1;const Q={...c,edges:c.edges.map(re=>re.id===l?F:re.id===u?G:re)};return ji(Q).length>=A||mo(Q).some(([re,J])=>!D.has(`${re}|${J}`))?!1:ft(Q).every(re=>s.has(pt(re)))});P&&(P.pa!==p.waypoints&&o.updateWaypoints(h,P.pa),P.pb!==f.waypoints&&o.updateWaypoints(m,P.pb),c={...c,edges:c.edges.map(T=>T.id===l?{...p,waypoints:P.pa}:T.id===u?{...f,waypoints:P.pb}:T)})}}const pM=40,fM=20;function dM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>{const u=ze(i),p=ji(u);return{keys:new Set(ft(u).map(pt)),crossings:mo(u).length,shared:p.length,mine:p.filter(([f,d])=>f===l||d===l).length}},a=(l,u)=>{const p=ze(i),f=p.edges.find(d=>d.id===l);return f?new Set(Vt({...f,waypoints:u},Hn(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,w=m?d.y+d.height:d.y,y=m?f.y:f.y+f.height,v=Math.round((w+y)/2),x=j=>f===u?[...j].reverse():j,E=(l.waypoints??[]).map(j=>({x:j.x,y:j.y})),A=r(l.id),D=a(l.id,E)??new Set,P=h?f.x+f.width:f.x,T=f.x+f.width/2;for(let j=Math.min(pM,f.width/4);h?P-j>T:P+j<T;j+=fM){const F=Math.round(h?P-j:P+j),G=x([{x:g,y:w},{x:g,y:v},{x:F,y:v},{x:F,y}]),Q=a(l.id,G);if(!Q||[...Q].some(J=>!D.has(J)))continue;o.updateWaypoints(l,G);const re=r(l.id);if(re.crossings<=A.crossings&&re.shared<=A.shared&&re.mine<=A.mine&&[...re.keys].every(J=>A.keys.has(J)))break;o.updateWaypoints(l,E)}}}const hM=10;function Zm(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 Qm(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(G=>G.type==="bpmn:Participant"&&G.container),i=t.shapes.find(G=>G.id===e.endpoints[0]),o=t.shapes.find(G=>G.id===e.endpoints[1]);if(!i||!o)return null;const r=Zm(i,n),a=Zm(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(G=>G.id!==r.id&&G.id!==a.id&&G.y>=c.y+c.height&&G.y+G.height<=l.y).sort((G,Q)=>G.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,w=e.waypoints[0],y=e.waypoints[e.waypoints.length-1],v=Hn(t),x=t.edges.filter(G=>G.id!==e.id),E=gi(e,x),A=Vt(e,v).length;if(E===0&&A===0||A===0&&e.waypoints.length===2)return null;const D=Math.min(...u.map(G=>G.x)),P=Math.max(...u.map(G=>G.x+G.width)),T=(w.x+y.x)/2,j=G=>G.filter((Q,re)=>re===0||!(Ue(Q.x,G[re-1].x)&&Ue(Q.y,G[re-1].y)));let F;for(let G=D;G<=P;G+=hM){const Q=j([w,{x:w.x,y:h},{x:G,y:h},{x:G,y:m},{x:y.x,y:m},y]),re={...e,waypoints:Q};if(Vt(re,v).length>0)continue;const J=gi(re,x),ye=Math.abs(G-T);(!F||J<F.cross||J===F.cross&&ye<F.detour)&&(F={pts:Q,cross:J,detour:ye})}return F&&(A>0?F.cross<=E:F.cross<E)?F.pts:null}const gM=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function mM(e,t,n){var l,u;const{elementRegistry:i}=e,o=e.modeling,r=new Map(t.shapes.map(p=>[p.id,p])),a=ze(i),s=new Map(a.shapes.map(p=>[p.id,p])),c=Hn(a);for(const p of t.edges){if(!gM.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||!Ue(d.width,h.width)||!Ue(d.height,h.height)||!Ue(g.width,m.width)||!Ue(g.height,m.height))continue;const w=h.x-d.x,y=h.y-d.y;if(Ue(w,0)&&Ue(y,0)||!Ue(m.x-g.x,w)||!Ue(m.y-g.y,y))continue;const v=p.waypoints.map(A=>({x:A.x+w,y:A.y+y})),x=f.waypoints.map(A=>({x:A.x,y:A.y}));x.length===v.length&&x.every((A,D)=>Ue(A.x,v[D].x)&&Ue(A.y,v[D].y))||x.length===2&&(Ue(x[0].x,x[1].x)||Ue(x[0].y,x[1].y))&&Vt({...p,waypoints:x},c).length===0||Vt({...p,waypoints:v},c).length>0||o.updateWaypoints(f,v)}}function Jm(e,t){const{elementRegistry:n}=e,i=e.modeling,o=ze(n);for(const r of o.edges){if(r.type!=="bpmn:MessageFlow"||t.has(r.id))continue;const a=ze(n),s=a.edges.find(u=>u.id===r.id);if(!s)continue;const c=Qm(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const gf=20,ey=10,Hi=10,mf=40,yM=6,vM=40,ty=50;function bM(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<=yM})}function yf(e,t,n){let i=0;for(let o=1;o<e.length;o++){const r=e[o-1],a=e[o];if(Ue(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 xM(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 vf(e,t,n){if(t>n)return[];const i=[Math.min(Math.max(e,t),n)];for(let o=ey;o<=n-t;o+=ey)e+o<=n&&i.push(e+o),e-o>=t&&i.push(e-o);return i}function wM(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=(J,ye)=>ye>J.x+Hi&&ye<J.x+J.width-Hi,g=(J,ye)=>J.width<=2*mf?J.x+J.width/2:Math.min(Math.max(ye,J.x+mf),J.x+J.width-mf),h=Math.max(e.x,t.x)+Hi,m=Math.min(e.x+e.width,t.x+t.width)-Hi;if(h<=m){const J=!a&&d(t,p)?p:!s&&d(e,f)?f:Math.round((h+m)/2);r.push([{x:J,y:l},{x:J,y:u}])}const w=s?g(t,p):f,y=a?g(e,f):p;if(!a&&!d(e,w)){const J=w<e.x?e.x:e.x+e.width;for(const ye of vf(e.y+e.height/2,e.y+Hi,e.y+e.height-Hi))r.push([{x:J,y:ye},{x:w,y:ye},{x:w,y:u}])}if(!s&&!d(t,y)){const J=y<t.x?t.x:t.x+t.width;for(const ye of vf(t.y+t.height/2,t.y+Hi,t.y+t.height-Hi))r.push([{x:y,y:l},{x:y,y:ye},{x:J,y:ye}])}const v=(J,ye)=>{if(Math.abs(ye-J)<2*Hi)return[];const ae=Math.min(J,ye)+Hi,xe=Math.max(J,ye)-Hi;return vf(Math.round((J+ye)/2),ae,xe)};if(!a&&n)for(const J of v(l,c?n.y+n.height:n.y))r.push([{x:p,y:l},{x:p,y:J},{x:w,y:J},{x:w,y:u}]);if(!s&&i)for(const J of v(u,c?i.y:i.y+i.height))r.push([{x:y,y:l},{x:y,y:J},{x:f,y:J},{x:f,y:u}]);const x=Math.min(y,w),E=Math.max(y,w),A=[];for(const[J,ye]of o.filter(ae=>ae.x<E&&ae.x+ae.width>x).map(ae=>[ae.y,ae.y+ae.height]).sort((ae,xe)=>ae[0]-xe[0])){const ae=A[A.length-1];ae&&J<=ae[1]?ae[1]=Math.max(ae[1],ye):A.push([J,ye])}const D=[];for(let J=1;J<A.length;J++)A[J][0]-A[J-1][1]>=vM&&D.push(Math.round((A[J-1][1]+A[J][0])/2));A.length&&D.push(A[0][0]-ty,A[A.length-1][1]+ty);const P=(J,ye)=>ye<J.y?J.y:ye>J.y+J.height?J.y+J.height:void 0,T=new Set([a?e.id:n==null?void 0:n.id,s?t.id:i==null?void 0:i.id].filter(J=>!!J)),j=e.y+e.height/2,F=t.y+t.height/2,G=F>j?1:-1,Q=(J,ye,ae)=>o.some(xe=>!T.has(xe.id)&&xe.x<J&&J<xe.x+xe.width&&xe.y<Math.max(ye,ae)-1&&xe.y+xe.height>Math.min(ye,ae)+1),re=[];for(const J of D){const ye=P(e,J),ae=P(t,J);ye===void 0||ae===void 0||(J-j)*G<0&&Q(y,ye,J)||(J-F)*G>0&&Q(w,ae,J)||re.push({pts:[{x:y,y:ye},{x:y,y:J},{x:w,y:J},{x:w,y:ae}],len:Math.abs(J-ye)+(E-x)+Math.abs(ae-J)})}return{inPools:r,outside:re.sort((J,ye)=>J.len-ye.len).map(J=>J.pts)}}function _M(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=ze(i);return{keys:new Set(ft(d).map(pt)),crossings:mo(d).length,shared:ji(d).length}},l=(d,g)=>d.length===g.length&&d.every((h,m)=>Ue(h.x,g[m].x)&&Ue(h.y,g[m].y)),u=d=>{const g=d.source,h=d.target;if(!g||!h)return"skip";const m=ze(i),w=new Map(m.shapes.map(U=>[U.id,U])),y=s(g),v=s(h),x=new Set([y,v].filter(U=>!!U)),E=m.shapes.filter(U=>U.type==="bpmn:Participant"),A=(d.waypoints??[]).map(U=>({x:U.x,y:U.y})),D=yf(A,x,E);if(D<gf)return"skip";if(t.has(d.id)){const U=r.get(d.id);if(U&&l(U,A)||D-(U?yf(U,x,a):0)<gf)return"skip"}const P=w.get(g.id),T=w.get(h.id),j=m.edges.find(U=>U.id===d.id);if(!P||!T||!j)return"skip";const F=Hn(m),G=new Set(Vt(j,F).map(U=>U.id)),Q=Go(m).filter(U=>U.owner!==d.id&&U.owner!==P.id&&U.owner!==T.id),re=[...m.shapes.filter(U=>!U.container&&U.id!==P.id&&U.id!==T.id),...Q.map(U=>U.rect)],J=U=>sn({...j,waypoints:U}).some(ce=>bM(ce,re)),ye=wM(P,T,y?w.get(y):void 0,v?w.get(v):void 0,E),ae=U=>U.map((ce,Y)=>({pts:ce,i:Y,key:ce.length*2+(J(ce)?1:0)})).sort((ce,Y)=>ce.key-Y.key||ce.i-Y.i).map(ce=>ce.pts),xe=[...ae(ye.inPools),...ae(ye.outside)],Ee=c();for(const U of xe){if(yf(U,x,E)>=gf)continue;const ce={...j,waypoints:U};if(Vt(ce,F).some(de=>!G.has(de.id))||sn(ce).some(de=>xM(de,m.shapes)||Q.some(Se=>Fi(Se.rect,de))))continue;o.updateWaypoints(d,U);const Z=c();if(Z.crossings<=Ee.crossings&&Z.shared<=Ee.shared&&[...Z.keys].every(de=>Ee.keys.has(de)))return"fixed";o.updateWaypoints(d,A)}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 zi=[25,-25,40,-40],va=35;function EM(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)-va:Math.max(e.y+e.height,t.y+t.height)+va,p=RM(e,t,s,u,n),f=p===null?[[u,0]]:[[u,0],[p,SM]];for(const[d,g]of f)for(const h of[0,...zi])if(!(Math.abs(h)>=e.width/2-5))for(const m of[0,...zi]){if(Math.abs(m)>=t.width/2-5)continue;const w=i+h,y=o+m,v=[{x:w,y:c},{x:w,y:d},{x:y,y:d},{x:y,y:l}];g&&Vt({endpoints:[],waypoints:v},a).length||r.push({pts:v,cost:g+Math.abs(m)+Math.abs(h)})}}return r}const SM=45,Jc=20;function RM(e,t,n,i,o){if(!o.length)return null;const r=e.x+e.width/2,a=t.x+t.width/2,s=Math.min(r,a),c=Math.max(r,a),l=n?Math.min(e.y,t.y):Math.max(e.y+e.height,t.y+t.height),u=o.filter(m=>m.container&&(m.type==="bpmn:Lane"||m.type==="bpmn:Participant")&&r>=m.x&&r<=m.x+m.width&&e.y>=m.y&&e.y+e.height<=m.y+m.height).sort((m,w)=>m.width*m.height-w.width*w.height)[0];if(!u)return null;const p=o.filter(m=>!m.container&&m.id!==e.id&&m.id!==t.id),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(y=>y.y));for(let y=!0;y;){y=!1;for(const v of d)v.y<m&&v.y<l&&v.y+v.height>m-Jc&&(m=v.y,y=!0)}const w=Math.max(u.y,...d.filter(y=>y.y+y.height<=m).map(y=>y.y+y.height));return m-w>=Jc?Math.round((m+w)/2):null}let g=Math.max(...f.map(m=>m.y+m.height));for(let m=!0;m;){m=!1;for(const w of d)w.y+w.height>g&&w.y+w.height>l&&w.y<g+Jc&&(g=w.y+w.height,m=!0)}const h=Math.min(u.y+u.height,...d.filter(m=>m.y>=g).map(m=>m.y));return h-g>=Jc?Math.round((g+h)/2):null}function el(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 EM(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-va:n.y+n.height+va,p=[];for(const y of[0,...zi]){if(Math.abs(y)>=i.width/2-5)continue;const v=r+y;p.push({pts:[{x:n.x,y:o},{x:v,y:o},{x:v,y:c}],cost:Math.abs(y)});for(const x of[0,...zi]){if(Math.abs(x)>=n.width/2-5)continue;const E=a+x;p.push({pts:[{x:E,y:l},{x:E,y:u},{x:v,y:u},{x:v,y:c}],cost:Math.abs(y)+Math.abs(x)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const y of[0,...zi]){if(Math.abs(y)>=n.width/2-5)continue;const v=a+y;p.push({pts:[{x:v,y:g},{x:v,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(y)})}const h=60,m=s?i.y+i.height:i.y,w=s?i.y+i.height+va:i.y-va;for(const y of[0,...zi]){if(Math.abs(y)>=i.width/2-5)continue;const v=r+y;for(const x of[0,...zi]){if(Math.abs(x)>=n.width/2-5)continue;const E=a+x;p.push({pts:[{x:E,y:g},{x:E,y:w},{x:v,y:w},{x:v,y:m}],cost:h+Math.abs(y)+Math.abs(x)})}}return p}const tl=30;function ny(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],o=e[n+1],r=Ue(i.y,o.y)&&!Ue(i.x,o.x),a=Ue(i.x,o.x)&&!Ue(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)<tl||Math.abs(i.y-(s.y+s.height))<tl)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)<tl||Math.abs(i.x-(s.x+s.width))<tl)return!0}}return!1}const nl=40;function CM(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-nl,a=o.x+o.width+nl,s=o.y-nl,c=o.y+o.height+nl;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 iy(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(A=>A.container),i=new Map(t.shapes.map(A=>[A.id,A])),o=Hn(t),r=t.edges.filter(A=>A.id!==e.id),a=hi(e,r),s=gi(e,r),c=A=>CM(A,t.shapes,e.endpoints)+(ny(A,n)?1:0),l=c(e.waypoints),u=A=>{if(!A)return;const D=A.x+A.width/2,P=A.y+A.height/2;return n.find(T=>T.type==="bpmn:Lane"&&D>=T.x&&D<=T.x+T.width&&P>=T.y&&P<=T.y+T.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=A=>{if(!d||!f)return!1;for(let D=1;D<A.length-2;D++){const P=A[D],T=A[D+1];if(Ue(P.y,T.y)&&!Ue(P.x,T.x)&&P.y>f.y&&P.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),w=(A=>{if(!A)return;const D=A.x+A.width/2,P=A.y+A.height/2;return n.filter(T=>T.type==="bpmn:Participant"&&D>=T.x&&D<=T.x+T.width&&P>=T.y&&P<=T.y+T.height).sort((T,j)=>T.width*T.height-j.width*j.height)[0]})(i.get(e.endpoints[0]??"")),y=A=>{if(!w)return 0;let D=0;for(let P=1;P<A.length-1;P++){const T=A[P];(T.x<w.x||T.x>w.x+w.width||T.y<w.y||T.y>w.y+w.height)&&D++}return D},v=y(e.waypoints);if(!ny(e.waypoints,n)&&!(d&&!h)&&v===0)return null;const x=A=>A.reduce((D,P,T)=>T?D+Math.abs(P.x-A[T-1].x)+Math.abs(P.y-A[T-1].y):0,0);let E;for(const{pts:A,cost:D}of el(e,i)){const P={...e,waypoints:A};if(Vt(P,o).length>0)continue;const T=hi(P,r);if(T>a)continue;const j=y(A);if(j>v)continue;const F=j<v&&T===0;if(!F&&gi(P,r)>s)continue;const G=c(A),Q=g(A);if(!F&&!(Q&&!h)&&G>=l)continue;const J=Q?0:1,ye=x(A);(!E||j<E.out||j===E.out&&(J<E.lane||J===E.lane&&(T<E.opp||T===E.opp&&(G<E.sc||G===E.sc&&(D<E.cost||D===E.cost&&ye<E.len)))))&&(E={pts:A,out:j,sc:G,lane:J,opp:T,cost:D,len:ye})}return(E==null?void 0:E.pts)??null}function MM(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 AM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ze(i).edges.filter(a=>(!t.has(a.id)||n.has(a.id))&&a.waypoints.length>=4).map(a=>a.id).sort();for(const a of r){const s=ze(i),c=s.edges.find(m=>m.id===a);if(!c||c.waypoints.length<4)continue;const l=Hn(s),u=s.edges.filter(m=>m.id!==a),p=Vt(c,l).length,f=hi(c,u),d=gi(c,u),g=n.has(a)?new Set(ft(s).map(pt)):null,h=Kc(c,s.shapes);h.length===2&&MM(c,s)&&h.reverse();for(const m of h){if(m.length>=c.waypoints.length)continue;const w={...c,waypoints:m};if(Vt(w,l).length>p||hi(w,u)>f||gi(w,u)>d)continue;if(g){const v=new Set(ft({...s,edges:s.edges.map(A=>A.id===a?w:A)}).map(pt)),x=[...v].filter(A=>!g.has(A)).length,E=[...g].filter(A=>!v.has(A)).length;if(x>E)continue}const y=i.get(a);y&&o.updateWaypoints(y,m);break}}}function oy(e,t){const{elementRegistry:n}=e,i=e.modeling,o=ze(n).edges.filter(r=>r.type==="bpmn:SequenceFlow"&&!t.has(r.id)).map(r=>r.id).sort();for(const r of o){const a=ze(n),s=a.edges.find(u=>u.id===r);if(!s)continue;const c=iy(s,a);if(!c)continue;const l=n.get(r);l&&i.updateWaypoints(l,c)}}function bf(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=Ue(n[0].x,n[1].x)&&!Ue(n[0].y,n[1].y),s=Ue(n[n.length-1].x,n[n.length-2].x)&&!Ue(n[n.length-1].y,n[n.length-2].y);for(const c of zi){if(a&&o&&Math.abs(c)<o.width/2-5){const l=n.map(u=>({...u}));l[0].x+=c,l[1].x+=c,i.push({pts:l,cost:Math.abs(c)})}if(s&&r&&Math.abs(c)<r.width/2-5){const l=n.map(u=>({...u}));l[l.length-1].x+=c,l[l.length-2].x+=c,i.push({pts:l,cost:Math.abs(c)})}}return i}const ry=e=>e==="bpmn:SequenceFlow"||e==="bpmn:MessageFlow";function PM(e,t,n){const i=e.waypoints;if(i.length<2||!ry(e.type))return[];const o=i[0],r=i[1],a=Ue(o.y,r.y)&&!Ue(o.x,r.x),s=Ue(o.x,r.x)&&!Ue(o.y,r.y);if(!a&&!s)return[];const c=Math.sign(a?r.x-o.x:r.y-o.y);if(!t.some(g=>{if(!ry(g.type)||g.type===e.type||g.waypoints.length<2)return!1;const h=g.waypoints[0],m=g.waypoints[1];return!Ue(h.x,o.x)||!Ue(h.y,o.y)?!1:a?Ue(h.y,m.y)&&Math.sign(m.x-h.x)===c:Ue(h.x,m.x)&&Math.sign(m.y-h.y)===c}))return[];const u=n.get(e.endpoints[0]??""),p=n.get(e.endpoints[1]??"");if(!u)return[];const f=(g,h)=>a?h>g.y+5&&h<g.y+g.height-5:h>g.x+5&&h<g.x+g.width-5,d=[];for(const g of zi){const h=(a?o.y:o.x)+g;if(!f(u,h)||i.length===2&&(!p||!f(p,h)))continue;const m=i.map(w=>({...w}));for(const w of[m[0],m[1]])a?w.y=h:w.x=h;d.push({pts:m,cost:Math.abs(g)})}return d}function TM(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 w of[0,...zi])Math.abs(w)<i.width/2-5&&m.push({pts:[{x:f,y:l},{x:u+w,y:l},{x:u+w,y:h}],cost:Math.abs(w)}),Math.abs(w)<i.height/2-5&&m.push({pts:[{x:c,y:d},{x:c,y:p+w},{x:g,y:p+w}],cost:Math.abs(w)});return m}const kM=[[1/2,0],[1/3,25],[2/3,25]],ay=20;function OM(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(Math.abs(o-r)<1)return[];const a=[],s=(c,l)=>{for(const[u,p]of kM){const f=Math.round(c+(l-c)*u);a.push({pts:[{x:c,y:o},{x:f,y:o},{x:f,y:r},{x:l,y:r}],cost:p})}};return n.x+n.width+ay<=i.x&&s(n.x+n.width,i.x),i.x+i.width+ay<=n.x&&s(n.x,i.x+i.width),a}function xf(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,...zi]){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 sy(e,t,n={}){const i=new Map(t.shapes.map(g=>[g.id,g])),o=Hn(t),r=t.edges.filter(g=>g.id!==e.id),a=hi(e,r);if(a===0)return null;const s=gi(e,r);let c;const l=g=>g.reduce((h,m,w)=>w?h+Math.abs(m.x-g[w-1].x)+Math.abs(m.y-g[w-1].y):0,0),u=3,p=g=>{const h=g[0],m=g[g.length-1],w=Math.hypot(m.x-h.x,m.y-h.y);return w>=1&&l(g)/w>=u?1:0},f=p(e.waypoints),d=[...el(e,i),...xf(e,i),...bf(e,i),...PM(e,r,i),...n.sideEntry?OM(e,i):[]];for(const{pts:g,cost:h}of d){const m={...e,waypoints:g};if(Vt(m,o).length>0)continue;const w=hi(m,r),y=gi(m,r),v=a-w+(f-p(g));if(w>=a||y-s>v)continue;const x=l(g);(!c||w<c.opposite||w===c.opposite&&(y<c.cross||y===c.cross&&(h<c.cost||h===c.cost&&x<c.len)))&&(c={pts:g,opposite:w,cross:y,cost:h,len:x})}return(c==null?void 0:c.pts)??null}function cy(e,t){var i;let n=0;for(const o of t)o.id!==e.id&&((i=Or(e,o))==null?void 0:i.kind)==="unrelated"&&n++;return n}function DM(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=Hn(t),o=t.edges.filter(f=>f.id!==e.id),r=cy(e,o);if(r===0)return null;const a=hi(e,o),s=gi(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=[...el(e,n),...xf(e,n),...TM(e,n),...bf(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(Vt(g,i).length>0)continue;const h=cy(g,o);if(h>=r)continue;const m=hi(g,o);if(m-h>a-r)continue;const w=gi(g,o);if(w-s>(r-h)*l)continue;const y=c(f);(!u||h<u.fake||h===u.fake&&(m<u.unreadable||m===u.unreadable&&(w<u.cross||w===u.cross&&(d<u.cost||d===u.cost&&y<u.length))))&&(u={pts:f,fake:h,unreadable:m,cross:w,cost:d,length:y})}return(u==null?void 0:u.pts)??null}function ly(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ft(ze(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(pt(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=ze(i),l=c.edges.find(f=>f.id===s);if(!l)continue;const u=DM(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function uy(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 py(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Or(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:uy(e,n)&&uy(t,n)}function fy(e,t,n){let i=0;for(const o of t)o.id!==e.id&&py(e,o,n)&&i++;return i}function LM(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=Hn(t),o=t.edges.filter(f=>f.id!==e.id),r=fy(e,o,n);if(r===0)return null;const a=hi(e,o),s=gi(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=[...el(e,n),...xf(e,n),...bf(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(Vt(g,i).length>0)continue;const h=fy(g,o,n);if(h>=r)continue;const m=hi(g,o);if(m-h>a-r)continue;const w=gi(g,o);if(w-s>(r-h)*l)continue;const y=c(f);(!u||h<u.chain||h===u.chain&&(m<u.unreadable||m===u.unreadable&&(w<u.cross||w===u.cross&&(d<u.cost||d===u.cost&&y<u.length))))&&(u={pts:f,chain:h,unreadable:m,cross:w,cost:d,length:y})}return(u==null?void 0:u.pts)??null}function IM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ze(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=ft(r).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(pt(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,p]=l.edges.map(f=>r.edges.find(d=>d.id===f));if(!(!u||!p||!py(u,p,a)))for(const f of l.edges)n.has(f)||c.add(f)}for(const l of[...c].sort()){const u=ze(i),p=u.edges.find(g=>g.id===l);if(!p)continue;const f=LM(p,u);if(!f)continue;const d=i.get(l);d&&o.updateWaypoints(d,f)}}function dy(e,t,n,i=new Set){const{elementRegistry:o}=e,r=e.modeling,a=new Set,s=ze(o),c=ft(s).filter(f=>rf(f)&&!t.has(pt(f)));if(!c.length)return a;const l=new Set;for(const f of c)if(rf(f))for(const d of f.edges)n.has(d)||l.add(d);const u=f=>{var d;return((d=s.edges.find(g=>g.id===f))==null?void 0:d.type)??""},p=[...l].sort((f,d)=>{const g=u(f)==="bpmn:SequenceFlow"?0:1,h=u(d)==="bpmn:SequenceFlow"?0:1;return g!==h?g-h:f.localeCompare(d)});for(const f of p){const d=ze(o),g=d.edges.find(w=>w.id===f);if(!g)continue;const h=sy(g,d,{sideEntry:i.has(f)});if(!h)continue;const m=o.get(f);m&&(r.updateWaypoints(m,h),a.add(f))}return a}const BM=10,NM=(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 hy(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!qc(e,i))return null;const o=Hn(t),r=i.flatMap(sn);for(const a of sn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of Uc(a,r))s=s.flatMap(([h,m])=>{const w=[];return d>h&&w.push([h,Math.min(m,d)]),g<m&&w.push([Math.max(h,g),m]),w.filter(([y,v])=>v>y)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,g])=>g-d>=c+BM*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-Mm}:{x:a.at+Tn+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(!qc({...e,label:f},i)&&!o.some(d=>!e.endpoints.includes(d.id)&&NM(f,d)))return f}return null}const Tn=8;function wf(e,t){const n=e.label;if(!n)return null;const i=sn(e);if(!i.length)return null;const o=n.x+n.width/2,r=n.y+n.height/2,a=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(sn),...t.shapes.filter(f=>f.container).flatMap(ma)],l=f=>!c.some(d=>Fi(f,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+Tn,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const f of[s.at+Tn,s.at-Tn-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-Tn-n.height,s.at+Tn])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 gy=30,$M=(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},my=(e,t)=>$M({x:e.x+e.width/2,y:e.y+e.height/2},t);function FM(e,t){const n=e.label;if(!n)return null;const i=sn(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(sn),...t.shapes.filter(c=>c.container).flatMap(ma)],r=Go(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=>Fi(c,l))&&!hs(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+Tn,c.at-Tn-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+Tn,c.at-Tn-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 yy(e,t,n=new Set){var s,c;const{elementRegistry:i}=e,o=e.modeling;let r=ze(i),a=new Set(ft(r).map(pt));for(const[l,u]of t){const p=u.wps,f=i.get(l),d=f==null?void 0:f.label;if(!d||!(f!=null&&f.waypoints))continue;const g=f.waypoints[0].x-p[0].x,h=f.waypoints[0].y-p[0].y;if(!(f.waypoints.length===p.length&&f.waypoints.every((D,P)=>D.x-p[P].x===g&&D.y-p[P].y===h))){if(((s=f.source)==null?void 0:s.id)===u.source&&((c=f.target)==null?void 0:c.id)===u.target)continue;const D=r.edges.find(G=>G.id===l);if(!(D!=null&&D.label)||!hs(D.label,r).length&&!n.has(l))continue;let P={...D.label,x:u.label.x,y:u.label.y};if((hs(P,r).length||my(P,D.waypoints)>gy)&&(P=null),!P&&my(D.label,D.waypoints)>gy&&(P=FM(D,r)),!P)continue;const T=P;if(T.x===d.x&&T.y===d.y)continue;const j={...r,edges:r.edges.map(G=>G.id===l?{...G,label:T}:G)},F=ft(j);if(F.some(G=>!a.has(pt(G))))continue;o.moveElements([d],{x:T.x-d.x,y:T.y-d.y}),r=j,a=new Set(F.map(pt));continue}const w=u.label.x+g-d.x,y=u.label.y+h-d.y;if(w===0&&y===0)continue;const v=r.edges.find(D=>D.id===l);if(!(v!=null&&v.label))continue;const x={...v.label,x:v.label.x+w,y:v.label.y+y},E={...r,edges:r.edges.map(D=>D.id===l?{...D,label:x}:D)},A=ft(E);A.some(D=>!a.has(pt(D)))||(o.moveElements([d],{x:w,y}),r=E,a=new Set(A.map(pt)))}}function vy(e,t,n=new Set){const{elementRegistry:i}=e,o=e.modeling,r=ze(i);for(const a of r.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=wf(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 by(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ze(i),a=ft(r).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(pt(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=r.edges.find(f=>f.id===s.edge);if(!c)continue;const l=hy(c,r);if(!l)continue;const u=i.get(s.edge),p=u==null?void 0:u.label;p&&o.moveElements([p],{x:l.x-p.x,y:l.y-p.y})}}function xy(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(sn),...t.shapes.filter(f=>f.container).flatMap(ma)],o=i.filter(f=>Fi(n,f));if(!o.length)return null;const r=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=Go(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Fi(f,d))&&!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-Tn-n.height},{...n,y:f.at+Tn}):l.push({...n,x:f.at-Tn-n.width},{...n,x:f.at+Tn});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+Tn},{...n,x:u-n.width/2,y:e.y-Tn-n.height},{...n,x:e.x+e.width+Tn,y:p-n.height/2},{...n,x:e.x-Tn-n.width,y:p-n.height/2}),l.find(c)??null}function wy(e,t){const{elementRegistry:n}=e,i=e.modeling,o=ze(n);for(const r of o.shapes){if(r.container||!r.label||t.has(r.id))continue;const a=xy(r,ze(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 jM(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 _y(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=ze(n),r=new Set(ft(o).map(pt));const a=[...new Set(ft(o).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(pt(s))).map(s=>s.edge))].sort();for(const s of a){const c=o.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[h,m]of u){const w=h?o.shapes.find(v=>v.id===h):void 0;if(!w)continue;const y=jM(w,l[m]);y.x===l[m].x&&y.y===l[m].y||(l[m]=y,p=!0)}if(!p)continue;const f={...o,edges:o.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=ft(f);if(d.some(h=>!r.has(pt(h))))continue;const g=n.get(s);g&&(i.updateWaypoints(g,l),o=f,r=new Set(d.map(pt)))}}const _f=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Ey(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 HM(e,t,n){const i=[],o=n?cs(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 Ey(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(!_f(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 wi(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function zM(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(_f(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=Ey(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,f=wi(c.participant,"name",a(u));c.participant.lanes&&(f.lanes=c.participant.lanes.map((d,g)=>wi(d,"name",a(p[g])))),s.push({...c,participant:f});break}case"participant.update":{const[u,...p]=l,f=wi(c,"name",a(u));c.lanes&&(f.lanes=c.lanes.map((d,g)=>wi(d,"name",a(p[g])))),s.push(f);break}case"node.add":s.push({...c,node:wi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:wi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:wi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:wi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:wi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:wi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(wi(c,"text",a(l[0])));break;default:s.push(_f(l[0].map)?wi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const GM=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Sy=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Ry={"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}]},ms=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),il=e=>typeof e=="string"&&e!=="";function VM(e){const t=[];function n(i,o,r,a){if(a===null){il(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!ms(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)il(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!ms(i)||!il(i.kind)||!(i.kind in Ry)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of Ry[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(!ms(f))break;f=f[g]}if(!ms(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;ms(c)&&!il(c.text)&&c.texts===void 0&&t.push({kind:"payload-invalid",opIndex:o,field:"annotation.text"})}if(i.kind==="node.add"||i.kind==="node.update"){const c=i.band;c!==void 0&&(!Number.isInteger(c)||c<0)&&t.push({kind:"payload-invalid",opIndex:o,field:"band"});const l=i.kind==="node.add"?(r=i.node)==null?void 0:r.type:i.type,u=(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"";if(typeof l=="string"&&!Vg(l)){t.push({kind:"node-type-unsupported",opIndex:o,id:u,type:l});return}const p=i.kind==="node.add"?(s=i.node)==null?void 0:s.eventDefinition:i.eventDefinition;if(p!==void 0&&!Wg(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 Cy(e,t,n={}){const i=VM(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(h,m,w){if(!GM.test(m)){o.push({kind:"id-invalid",opIndex:h,id:m});return}if(t.categoryOf(m)!==void 0||r.has(m)){o.push({kind:"id-duplicate",opIndex:h,id:m});return}r.set(m,{...w,opIndex:h})}e.forEach((h,m)=>{var w;switch(h.kind){case"participant.add":s(m,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(y=>y.id)});for(const y of h.participant.lanes??[])s(m,y.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 y of h.associations??[])y.id&&s(m,y.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(m,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(m,h.association.id,{category:"association"});break;case"annotation.add":s(m,h.annotation.id,{category:"annotation"}),(w=h.association)!=null&&w.id&&s(m,h.association.id,{category:"association"});break;case"group.add":s(m,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(y=>y.id));for(const y of h.lanes)t.categoryOf(y.id)===void 0&&s(m,y.id,{category:"lane"})}break}});const c=h=>{var m;return((m=r.get(h))==null?void 0:m.category)??t.categoryOf(h)},l=h=>{const m=r.get(h);return m?m.category==="participant"?h:m.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,m,w,y){const v=c(m);if(v===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:w});return}if(y&&!y.includes(v)){o.push({kind:"ref-category",opIndex:h,ref:m,role:w,expected:y.join("|"),actual:v});return}return v}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 w,y;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:v,lane:x}=h.node;if(v===void 0){(p||x!==void 0)&&o.push({kind:"participant-required",opIndex:m,id:h.node.id});break}if(u(m,v,"participant",["participant"])===void 0)break;x!==void 0&&((((w=r.get(v))==null?void 0:w.lanes)??a.get(v)??t.lanesOf(v)).includes(x)||o.push({kind:"lane-unknown",opIndex:m,lane:x,participant:v}));break}case"sequenceFlow.add":{const{id:v,source:x,target:E,name:A,condition:D}=h.flow,P=u(m,x,"source",["flowNode"]),T=u(m,E,"target",["flowNode"]);P&&T&&l(x)!==l(E)&&o.push({kind:"flow-cross-pool",opIndex:m,id:v}),A!==void 0&&D!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:v});break}case"messageFlow.add":{const{id:v,source:x,target:E}=h.flow,A=u(m,x,"source",["flowNode","participant"]),D=u(m,E,"target",["flowNode","participant"]);if(A&&D){const P=l(x),T=l(E);P!==void 0&&P===T&&o.push({kind:"message-flow-same-pool",opIndex:m,id:v})}for(const P of[x,E])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(A=>A===h.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:m,source:v.source,target:v.target});continue}const E=v.source===h.dataStore.id?v.target:v.source;u(m,E,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:v,target:x}=h.association,E=u(m,v,"source"),A=u(m,x,"target");if(E&&A){const D=new Set([E,A]);D.has("dataStore")&&D.has("flowNode")||o.push({kind:"data-association-ends",opIndex:m,source:v,target:x})}break}case"association.add":{const{id:v,source:x,target:E}=h.association,A=u(m,x,"source"),D=u(m,E,"target");A&&D&&A!=="annotation"&&D!=="annotation"&&o.push({kind:"association-detached",opIndex:m,annotation:v??`${x}->${E}`});break}case"annotation.add":{if(h.association){const{source:v,target:x}=h.association;if(v!==h.annotation.id&&x!==h.annotation.id)o.push({kind:"association-detached",opIndex:m,annotation:h.annotation.id});else{const E=v===h.annotation.id?x:v;u(m,E,"association")}}h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.add":{for(const v of h.group.members??[]){const x=u(m,v,"member");x&&Sy.has(x)&&o.push({kind:"ref-category",opIndex:m,ref:v,role:"member",expected:"shape",actual:x})}break}case"participant.update":{if(g(m,h.id,"participant")===void 0)break;if(h.lanes){const v=t.lanesOf(h.id),x=h.lanes.map(P=>P.id);for(const P of v)x.includes(P)||o.push({kind:"lane-shrink-unsupported",opIndex:m,participant:h.id,lane:P});for(const P of x)t.categoryOf(P)!==void 0&&!v.includes(P)&&o.push({kind:"id-duplicate",opIndex:m,id:P});const E=x.filter(P=>v.includes(P)),A=P=>E.every((T,j)=>T===P[j]),D=(((y=t.laneDeclarationOrderOf)==null?void 0:y.call(t,h.id))??v).filter(P=>v.includes(P));E.length===v.length&&!A(v)&&!A(D)&&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,x=h.target===void 0||u(m,h.target,"target",["flowNode"])!==void 0,E=t.endpointsOf(h.id),A=h.source??(E==null?void 0:E.source),D=h.target??(E==null?void 0:E.target);v&&x&&A!==void 0&&D!==void 0&&new Set([l(A),l(D),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 x=u(m,v,"member");x&&Sy.has(x)&&o.push({kind:"ref-category",opIndex:m,ref:v,role:"member",expected:"shape",actual:x})}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(...HM(e,t,n.i18n)),o;function g(h,m,w){if(r.has(m)){o.push({kind:"target-added-in-batch",opIndex:h,id:m});return}const y=t.categoryOf(m);if(y===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:"target"});return}if(w&&y!==w){o.push({kind:"ref-category",opIndex:h,ref:m,role:"target",expected:w,actual:y});return}return y}}function My(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 ol(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const rl={"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]},kn=10,WM=300,UM=160,Ay=20,Ef=100,Py=40,qM=10,YM=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function Ty(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 al=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function sl(e,t,n,i,o){const r=n,a=Ty(e,t,i),s=a??i,c=(Q,re,J=s)=>{const[ye,ae]=rl[Q];let xe={x:t.x+t.width/2+ye*(t.width/2+r.width/2+re),y:t.y+t.height/2+ae*(t.height/2+r.height/2+re)};const Ee=J.x+kn+r.width/2,U=J.x+J.width-kn-r.width/2,ce=J.y+kn+r.height/2,Y=J.y+J.height-kn-r.height/2,Z={x:Math.min(U,Math.max(Ee,xe.x)),y:Math.min(Y,Math.max(ce,xe.y))};return(Z.x!==xe.x||Z.y!==xe.y)&&(xe=Math.abs(Z.x-(t.x+t.width/2))<(t.width+r.width)/2+kn&&Math.abs(Z.y-(t.y+t.height/2))<(t.height+r.height)/2+kn?{x:t.x+t.width+kn+r.width/2,y:Z.y}:Z),xe},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=ze(e),p=Q=>{var J,ye;if(!o.selfId)return!1;const re=e.get(Q);return!!re&&(((J=re.source)==null?void 0:J.id)===o.selfId||((ye=re.target)==null?void 0:ye.id)===o.selfId)},f=u.edges.filter(Q=>!p(Q.id)).flatMap(sn),d=Go(u).filter(Q=>Q.owner!==o.selfId).map(Q=>Q.rect),g=Q=>({x0:Q.x-r.width/2-kn,x1:Q.x+r.width/2+kn,y0:Q.y-r.height/2-kn,y1:Q.y+r.height/2+kn}),h=Q=>{const re=g(Q);return l.some(J=>re.x0<J.x+J.width&&re.x1>J.x&&re.y0<J.y+J.height&&re.y1>J.y)},m=Q=>{const re=g(Q);return f.some(J=>J.axis==="h"?J.at>re.y0&&J.at<re.y1&&J.lo<re.x1&&J.hi>re.x0:J.at>re.x0&&J.at<re.x1&&J.lo<re.y1&&J.hi>re.y0)},w=Q=>{const re=g(Q);return d.some(J=>re.x0<J.x+J.width&&re.x1>J.x&&re.y0<J.y+J.height&&re.y1>J.y)},y=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}]),v=Q=>{const re=g(Q);return y.some(J=>J.axis==="h"?J.at>re.y0&&J.at<re.y1&&J.lo<re.x1&&J.hi>re.x0:J.at>re.x0&&J.at<re.x1&&J.lo<re.y1&&J.hi>re.y0)},x=Q=>h(Q)||m(Q)||w(Q)||v(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,A=Q=>E(Q)&&(!a||al(Q,r,a));if(o.placement){const Q=Ee=>Ee.startsWith("top")?Ee.replace(/^top/,"bottom"):Ee.replace(/^bottom/,"top"),re=Ee=>Ee.endsWith("left")?Ee.replace(/left$/,"right"):Ee.replace(/right$/,"left"),J=o.placement.side,ye=[J,Q(J),re(J),Q(re(J)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],ae=o.placement.offset??50;let xe=c(J,ae);if(x(xe)||a&&!al(xe,r,a)){const Ee=(U,ce)=>{const Y=new Set;for(const Z of ye){if(Y.has(Z))continue;Y.add(Z);const de=c(Z,ae,U);if(ce(de)&&!x(de))return xe=de,!0}return!1};!Ee(s,A)&&a&&Ee(i,E)}return xe}const D=o.from,P=s.x+kn+r.width/2,T=s.x+s.width-kn-r.width/2,j=s.y+kn+r.height/2,F=s.y+s.height-kn-r.height/2;let G={x:Math.min(T,Math.max(P,D.x)),y:Math.min(F,Math.max(j,D.y))};if(x(G)){const Q=(t.width+r.width)/2+kn,J=[{x:G.x+Q,y:G.y},{x:G.x-Q,y:G.y},{x:G.x,y:G.y-r.height-kn},{x:G.x,y:G.y+r.height+kn}].filter(A).find(ye=>!x(ye));J&&(G=J)}return G}function qt(e,t){return e.filter(n=>n.kind===t)}function ky(e,t){const n=new Map,i=new Set(qt(e,"node.add").map(s=>s.node.id)),o=qt(e,"sequenceFlow.update"),r=new Set(o.flatMap(s=>s.target!==void 0?[s.target]:[])),a=new Set;for(const s of o){const c=s.source;if(s.target!==void 0||c===void 0||!i.has(c)||r.has(c)||a.has(c))continue;const l=t(s.id),u=l&&qt(e,"sequenceFlow.add").find(f=>f.flow.source===l&&f.flow.target===c);if(!u)continue;const p=JSON.stringify(u.flow.id);e.some(f=>f!==u&&JSON.stringify(f).includes(p))||(a.add(c),n.set(s.id,u))}return n}class Oy extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}const Dy=new WeakMap;function KM(e){return Dy.get(e)??new Set}function Ly(e,t){var tS,nS,iS,oS,rS,aS,sS,cS,lS,uS,pS,fS,dS,hS,gS,mS,yS,vS,bS,xS,wS,_S,ES,SS,RS,CS,MS;const{modeling:n,bpmnFactory:i,elementFactory:o,elementRegistry:r,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=new Set;Dy.set(t,u);const p=()=>a.getRootElement(),f=b=>r.get(b),d=b=>{const _=f(b);if(!_)throw new Error(`하강 참조 해소 실패: ${b}`);return _},g=b=>{let _=b.parent;for(;_;){if(_.type==="bpmn:Participant")return _;_=_.parent}},h=new Map;for(const b of r.filter(_=>!("waypoints"in _&&_.waypoints)&&_.type!=="bpmn:Lane"&&_.type!=="label"&&typeof _.x=="number"))h.set(b.id,{x:b.x,y:b.y});const m=qt(e,"participant.add"),w=qt(e,"node.add"),y=qt(e,"sequenceFlow.add"),v=qt(e,"messageFlow.add"),x=qt(e,"dataStore.add"),E=qt(e,"dataAssociation.add"),A=qt(e,"annotation.add"),D=qt(e,"group.add"),P=new Map(w.map(b=>[b.node.id,b])),T=ky(e,b=>{var _,R;return(R=(_=f(b))==null?void 0:_.source)==null?void 0:R.id}),j=new Set([...T.values()].map(b=>b.flow.id)),F=y.filter(b=>!j.has(b.flow.id)),G=new Set([...T.values()].map(b=>b.flow.target)),Q=b=>qt(e,"sequenceFlow.update").filter(_=>_.target===b).length+(G.has(b)?1:0),re=(b,_,R)=>{var I;const O=b.businessObject,L=(((I=O.extensionElements)==null?void 0:I.values)??[]).filter(B=>B.$type!==_),k=R?[...L,i.create(_,R)]:L;if(!k.length){O.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const $=i.create("bpmn:ExtensionElements",{values:k});k.forEach(B=>{B.$parent=$}),n.updateProperties(b,{extensionElements:$})},J=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of qt(e,"element.remove")){const _=f(b.id);if(!_)continue;const R="waypoints"in _?[]:[..._.incoming??[],..._.outgoing??[]];n.removeElements([...R,_])}const ye=b=>r.filter(_=>{var R;return _.type==="bpmn:Lane"&&((R=g(_))==null?void 0:R.id)===b}).sort((_,R)=>_.y-R.y);for(const b of qt(e,"participant.update")){const _=d(b.id);if(b.name!==void 0&&n.updateProperties(_,{name:b.name??void 0}),!b.lanes)continue;const R=ye(b.id);if(!R.length){n.splitLane(_,b.lanes.length),ye(b.id).forEach((k,$)=>{const I=b.lanes[$];I&&n.updateProperties(k,{id:I.id,name:I.name})});continue}const O=new Set(R.map(k=>k.id)),L=b.lanes.reduce((k,$,I)=>O.has($.id)?I:k,-1);b.lanes.forEach((k,$)=>{if(O.has(k.id)){n.updateProperties(d(k.id),{name:k.name});return}const I=$===L+1&&L>=0,B=$===0?n.addLane(ye(b.id)[0],"top"):I?n.addLane(ye(b.id).at(-1),"bottom"):n.addLane(d(b.lanes[$-1].id),"bottom");n.updateProperties(B,{id:k.id,name:k.name})})}const ae=150,xe=130,Ee=80,U=90,ce=180,Y=30,Z=30,de=10,Se=300,Ie=5,N=(b,_,R,O,L)=>{const k=R-_.width/2,$=O-_.height/2;return(b.children??[]).find(I=>!("waypoints"in I&&I.waypoints)&&I.type!=="bpmn:Lane"&&I.type!=="label"&&!(L!=null&&L.has(I.id))&&typeof I.x=="number"&&k<I.x+I.width+Z&&k+_.width+Z>I.x&&$<I.y+I.height&&$+_.height>I.y)},C=new Set;for(const b of m){C.add(`pool:${b.participant.id}`);for(const _ of b.participant.lanes??[])C.add(_.id)}const S=new Map;for(const b of w){const _=b.node.lane??`pool:${b.node.participant??""}`;let R=S.get(_);R||S.set(_,R=new Set([0])),b.band!==void 0&&R.add(b.band)}const V=new Map;for(const[b,_]of S){if(!C.has(b))continue;const R=[..._].sort((k,$)=>k-$),O=R.map((k,$)=>$===0?0:$%2===1?Math.ceil($/2):-($/2)),L=Math.min(...O);V.set(b,new Map(R.map((k,$)=>[k,O[$]-L])))}{const b=new Map;for(const _ of m)(_.participant.lanes??[]).forEach((R,O)=>b.set(R.id,O));for(const[_,R]of V){if(!b.has(_)||R.size<2)continue;const O=b.get(_),L=R.get(0)??0,k=new Set;for(const ee of w){if(ee.node.lane!==_||(ee.band??0)!==0||!ee.node.type.endsWith("Gateway"))continue;const fe={in:new Set,out:new Set,cross:new Set};for(const oe of F){const se=oe.flow.source===ee.node.id;if(!se&&oe.flow.target!==ee.node.id)continue;const Me=P.get(se?oe.flow.target:oe.flow.source);if(!Me||Me.node.participant!==ee.node.participant||!Me.node.lane)continue;let he,pe=!1;if(Me.node.lane!==_){const ge=b.get(Me.node.lane);if(ge===void 0)continue;he=ge>O?"down":"up",pe=!0}else{const ge=R.get(Me.band??0)??L;he=ge>L?"down":ge<L?"up":void 0}he&&(fe[se?"out":"in"].add(he),pe&&fe.cross.add(he))}for(const oe of["up","down"])fe.in.has(oe)&&fe.out.has(oe)&&fe.cross.has(oe)&&k.add(oe)}if(k.size!==1)continue;const[$]=k,I=Math.max(...R.values()),B=$==="down"?I:0;if(L===B)continue;const z=[...R.entries()].filter(([ee])=>ee!==0).sort((ee,fe)=>ee[1]-fe[1]),H=[...Array(I+1).keys()].filter(ee=>ee!==B),K=new Map([[0,B]]);z.forEach(([ee],fe)=>K.set(ee,H[fe])),V.set(_,K)}}const X=b=>{var _;return(((_=S.get(b))==null?void 0:_.size)??0)>1},le=b=>b.band??(b.node.lane||!X(`pool:${b.node.participant??""}`)?void 0:0),Te=new Map,Ve=b=>Te.get(b.node.id)??le(b),wt=new Set,Qt=new Set,Pt=new Set;{const b=new Map;for(const O of F)b.set(O.flow.target,(b.get(O.flow.target)??0)+1);const _=O=>{const L=[],k=new Set([O]),$=[O];for(;$.length;){const I=$.shift();L.push(I);for(const B of F)B.flow.source!==I||k.has(B.flow.target)||(b.get(B.flow.target)??0)!==1||(k.add(B.flow.target),$.push(B.flow.target))}return L},R=(O,L)=>{var k;return((k=V.get(O))==null?void 0:k.get(L))??L};for(const O of w){if(!O.node.type.endsWith("Gateway"))continue;const L=O.node.lane??`pool:${O.node.participant??""}`,k=V.get(L);if(!k||k.size<2)continue;const $=Ve(O);if($===void 0||R(L,$)!==R(L,0))continue;const I=R(L,$),B=F.filter(oe=>oe.flow.source===O.node.id).map(oe=>P.get(oe.flow.target)).filter(oe=>!!oe&&(oe.node.lane??`pool:${oe.node.participant??""}`)===L),z=B.filter(oe=>{const se=Ve(oe);return se!==void 0&&R(L,se)===I&&(b.get(oe.node.id)??0)===1}),H=B.some(oe=>{const se=Ve(oe);return se!==void 0&&R(L,se)>I});if(z.length!==1||!H)continue;const K=new Set(B.flatMap(oe=>_(oe.node.id)));if(!F.some(oe=>oe.flow.target===O.node.id&&K.has(oe.flow.source)))continue;const fe=new Map;for(const[oe,se]of k)fe.set(oe,se+1);fe.set(-1,0),V.set(L,fe);for(const oe of _(z[0].node.id))P.has(oe)&&(Te.set(oe,-1),Qt.add(oe));wt.add(O.node.id)}}{const b=H=>H.node.lane??`pool:${H.node.participant??""}`,_=H=>Ve(H)??0,R=new Map(m.map((H,K)=>({id:H.participant.id,order:H.order??Number.POSITIVE_INFINITY,declared:K})).sort((H,K)=>H.order!==K.order?H.order-K.order:H.declared-K.declared).map((H,K)=>[H.id,K])),O=H=>H===void 0?void 0:R.get(H)??-1,L=H=>{var fe;const K=P.get(H);if(K)return K.node.participant;if(R.has(H))return H;const ee=f(H);if(ee)return ee.type==="bpmn:Participant"?ee.id:(fe=g(ee))==null?void 0:fe.id},k=new Map;for(const H of F)k.set(H.flow.target,(k.get(H.flow.target)??0)+1);const $=H=>{const K=[H],ee=new Set([H.node.id]);for(let fe=0;fe<K.length;fe++)for(const oe of F){if(oe.flow.source!==K[fe].node.id||ee.has(oe.flow.target)||(k.get(oe.flow.target)??0)!==1)continue;const se=P.get(oe.flow.target);!se||se.node.participant!==H.node.participant||(ee.add(se.node.id),K.push(se))}return K},I=H=>{const K=new Set(H.map(oe=>oe.node.id)),ee=O(H[0].node.participant);if(ee===void 0)return;const fe=new Set;for(const oe of v){const se=K.has(oe.flow.source)?oe.flow.target:K.has(oe.flow.target)?oe.flow.source:void 0;if(se===void 0)continue;const Me=O(L(se));Me===void 0||Me===ee||fe.add(Me<ee?"up":"down")}return fe.size===1?[...fe][0]:void 0},B=new Map;{const H=new Map;for(const se of F){if(!P.has(se.flow.source)||!P.has(se.flow.target))continue;const Me=H.get(se.flow.source)??[];Me.push(se.flow.target),H.set(se.flow.source,Me)}const K=new Map,ee=[],fe=new Set,oe=se=>{K.set(se,"open");for(const Me of H.get(se)??[]){const he=K.get(Me);he==="open"?fe.add(`${se}>${Me}`):he||oe(Me)}K.set(se,"done"),ee.push(se)};for(const se of w)K.has(se.node.id)||oe(se.node.id);for(const se of ee.reverse()){const Me=B.get(se)??0;B.set(se,Me);for(const he of H.get(se)??[])!fe.has(`${se}>${he}`)&&(B.get(he)??-1)<Me+1&&B.set(he,Me+1)}}let z=-1e3;for(const H of w){if(!H.node.type.endsWith("Gateway"))continue;const K=b(H),ee=V.get(K);if(!ee)continue;const fe=ee.get(_(H))??0,oe=he=>(ee.get(_(he))??0)-fe,se=F.filter(he=>he.flow.source===H.node.id).map(he=>P.get(he.flow.target)).filter(he=>!!he&&b(he)===K&&(k.get(he.node.id)??0)===1&&!Qt.has(he.node.id)).map(he=>{const pe=$(he);return{root:he,subtree:pe,dir:I(pe)}});if(!(se.some(he=>he.dir==="up")&&se.some(he=>he.dir==="down")||!F.some(he=>{const pe=he.flow.source===H.node.id?P.get(he.flow.target):void 0;return!!pe&&b(pe)===K&&oe(pe)===0})))for(const he of se){const pe=he.dir;if(!pe||se.some(te=>te!==he&&te.dir===pe))continue;const ge=oe(he.root);if(ge===0||(pe==="up"?ge<0:ge>0)||F.some(te=>{const Ce=te.flow.target===H.node.id?P.get(te.flow.source):void 0;if(!Ce||b(Ce)!==K)return!1;const qe=oe(Ce);return pe==="up"?qe<0:qe>0}))continue;const ue=[...ee].map(([te,Ce])=>({band:te,rel:Ce-fe})).filter(te=>pe==="up"?te.rel<0:te.rel>0).sort((te,Ce)=>Math.abs(Ce.rel)-Math.abs(te.rel));if(!ue.length&&pe==="down")continue;const ke=_(he.root),Qe=he.subtree.filter(te=>b(te)===K&&_(te)===ke),Mt=new Set(he.subtree.map(te=>te.node.id)),et=Qe.map(te=>B.get(te.node.id)??0),st=Math.min(...et)-1,Fe=Math.max(...et)+1,_e=te=>!w.some(Ce=>{if(Mt.has(Ce.node.id)||b(Ce)!==K||_(Ce)!==te)return!1;if(!Pt.has(te))return!0;const qe=B.get(Ce.node.id)??0;return qe>=st&&qe<=Fe});let Re=(tS=ue.find(te=>_e(te.band)))==null?void 0:tS.band;if(Re===void 0){if(Re=z--,Pt.add(Re),pe==="up"){const te=new Map;for(const[Ce,qe]of ee)te.set(Ce,qe+1);te.set(Re,0),V.set(K,te)}else ee.set(Re,Math.max(...ee.values())+1);(nS=S.get(K))==null||nS.add(Re)}for(const te of Qe)Te.set(te.node.id,Re)}}}const Ht=(b,_)=>{var R;return((R=V.get(b))==null?void 0:R.get(_))??_},gn=(b,_,R,O)=>{const L=b?f(b):_?f(_):void 0;if(!L)return!1;const k=b?L.y+Math.min(L.height/2,U):L.y+Ee;return Math.abs(k+Ht(b??`pool:${_??""}`,R)*ae-O)<=ae/2},Nn=new Map;for(const[b,_]of S){let R=0;for(const O of _)R=Math.max(R,Ht(b,O));Nn.set(b,R)}const Nt=b=>ce+ae*b,rn=(b,_,R)=>{const O=p().children.filter(L=>!("waypoints"in L&&L.waypoints)&&L.type!=="label"&&L.id!==_&&typeof L.y=="number"&&L.y>=b);O.length&&n.moveElements(O,{x:0,y:R})},Vn=(b,_,R)=>{const O=b.type==="bpmn:Participant"?b:void 0;if(!O||O.children.some(I=>I.type==="bpmn:Lane"))return;const L=R+_.height/2+Y-O.y;if(O.height>=L)return;const k=L-O.height,$=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:L}),rn($,O.id,k)},Qa=(b,_)=>{const R=_-b.height;if(R<=0)return;const O=g(b)??b,L=[],k=B=>{L.push(B);for(const z of B.children??[])k(z)};k(O);const $=b.y+b.height-10,I=l.calculateAdjustments(L,"y",R,$);l.makeSpace(I.movingShapes,I.resizingShapes,{x:0,y:R},"s",$)},pi=(b,_,R)=>{if(b){const $=d(b),I=Nt(_);if($.height>=I)return;const B=I-$.height,z=g($),H=z?z.y+z.height:$.y+$.height;Qa($,I),rn(H,z==null?void 0:z.id,B);return}if(!R)return;const O=ae*(_+1);if(R.height>=O)return;const L=O-R.height,k=R.y+R.height;n.resizeShape(R,{x:R.x,y:R.y,width:R.width,height:O}),rn(k,R.id,L)},Li=new Map;for(const b of F)Li.set(b.flow.target,(Li.get(b.flow.target)??0)+1);const bi=b=>(Li.get(b)??0)<=1,wn=new Set(w.map(b=>b.node.id).filter(b=>Q(b)===1&&!F.some(_=>_.flow.target===b||_.flow.source===b&&P.has(_.flow.target)))),Lo=new Map,wc=(b,_)=>{if(!b)return;const R=f(b);if(!R||R.height>=Nt(_))return;const O=R.y+R.height-10,L=g(R);if(L)return new Set((L.children??[]).filter(k=>k.type!=="bpmn:Lane"&&typeof k.y=="number"&&k.y>O).map(k=>k.id))},Kn=(b,_,R)=>{if(!b)return!0;const O=f(b);return O?R-_.height/2>=O.y&&R+_.height/2<=O.y+O.height:!0},gt=m.map((b,_)=>({op:b,declared:_}));gt.sort((b,_)=>{const R=b.op.order??Number.POSITIVE_INFINITY,O=_.op.order??Number.POSITIVE_INFINITY;return R!==O?R-O:b.declared-_.declared});let St=80;for(const b of r.getAll())b.parent===p()&&"height"in b&&typeof b.y=="number"&&(St=Math.max(St,b.y+b.height+60));const Pg=r.getAll().filter(b=>b.type==="bpmn:Participant"&&b.parent===p()),g3=(()=>{if(!Pg.length)return;const b=Pg.filter(L=>!By(L)),_=b.length?b:Pg,R=Math.min(..._.map(L=>L.x)),O=Math.max(..._.map(L=>L.x+L.width));return O>R?{x:R,width:O-R}:void 0})();for(const{op:b}of gt){const _=b.participant,R=w.filter(se=>se.node.participant===_.id).length,O=((iS=_.lanes)==null?void 0:iS.length)??0,L=Math.max(1200,R*160+300),k=(_.lanes??[]).map(se=>Nt(Nn.get(se.id)??0)),$=k.reduce((se,Me)=>se+Me,0);O&&$<300&&(k[O-1]+=300-$);const I=Math.max(300,ae*((Nn.get(`pool:${_.id}`)??0)+1)),B=_.blackBox||R+O===0?120:O?Math.max(300,$):I,z=_.blackBox?g3:void 0,H=(z==null?void 0:z.x)??100,K=(z==null?void 0:z.width)??L,ee=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:_.id,name:_.name,...b.order!==void 0?{"bwl:poolOrder":b.order}:{},..._.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:K,height:B,isExpanded:!0}),fe=n.createShape(ee,{x:H+K/2,y:St+B/2},p()),oe=_.lanes??[];if(oe.length&&n.splitLane(fe,oe.length),oe.length){const se=r.filter(Me=>{var he;return Me.type==="bpmn:Lane"&&((he=g(Me))==null?void 0:he.id)===_.id}).sort((Me,he)=>Me.y-he.y);if(se.forEach((Me,he)=>{const pe=oe[he];pe&&n.updateProperties(Me,{id:pe.id,name:pe.name})}),k.some(Me=>Me!==fe.height/O)){let Me=fe.y;se.forEach((he,pe)=>{const ge=k[pe];n.resizeShape(he,{x:he.x,y:Me,width:he.width,height:ge}),Me+=ge})}}St=fe.y+fe.height+60}const m3=b=>{var O;const _=P.get(b);if(_)return _.node.participant??"";const R=f(b);return R?R.type==="bpmn:Participant"?R.id:((O=g(R))==null?void 0:O.id)??"":""},_c=new Map,C1=b=>{let _=_c.get(b);return _||_c.set(b,_={nodes:[],flows:[]}),_};for(const b of w)C1(b.node.participant??"").nodes.push(b);for(const b of F)C1(m3(b.flow.source)).flows.push(b);const xp=b=>{var _;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((_=b.condition)==null?void 0:_.label)})},Tg=(b,_,R)=>o.createShape({type:ol(b.type),...b.eventDefinition?{eventDefinitionType:kc[b.eventDefinition]}:{},businessObject:i.create(ol(b.type),{id:b.id,name:b.name,..._!==void 0?{"bwl:band":_}:{},...R!==void 0?{"bwl:afterColumn":R}:{}})}),y3=[...gt.map(({op:b})=>b.participant.id).filter(b=>_c.has(b)),...[..._c.keys()].filter(b=>!m.some(_=>_.participant.id===b))],kg=b=>b.endsWith("Gateway");for(const b of y3){const _=_c.get(b),R=b?d(b):void 0,O=R?R.x+150:250;let L=R?R.y+80:120;const k=(ie,ue,ke)=>{if(ie){const Qe=d(ie);return Qe.y+Math.min(Qe.height/2,U)+Ht(ie,ue??0)*ae}return ue!==void 0&&R?R.y+Ee+Ht(`pool:${b}`,ue)*ae:ke},$=(ie,ue,ke)=>{if(ie){const Qe=d(ie);return Qe.y+Math.min(Qe.height/2,U)+ue*ae}return R?R.y+Ee+ue*ae:ke},I=ie=>ie.participant?d(ie.participant):p(),B=(ie,ue,ke,Qe,Mt,et,st,Fe)=>{const _e=ke!==void 0||Qe!==void 0,Re=nt=>{const Be=()=>pi(ke,nt,R);Fe?Fe(Be):Be()},te=Ht(ke??`pool:${b}`,Qe??0);if((Qe===void 0||gn(ke,b,Qe,st??Number.NaN))&&st!==void 0&&Kn(ke,ue,st)&&!N(ie,ue,Mt,st))return{x:Mt,y:st};if(_e)for(let nt=0;nt<4;nt++){const Be=$(ke,te+nt,et);if(!N(ie,ue,Mt,Be,wc(ke,te+nt)))return Re(te+nt),{x:Mt,y:Be}}const Ce=k(ke,Qe,et);_e?Re(te):Fe?Fe(()=>Vn(ie,ue,ue.y+ue.height/2)):Vn(ie,ue,Ce);let qe=Mt;for(let nt=0;nt<64;nt++){const Be=N(ie,ue,qe,Ce);if(!Be)break;qe=Be.x+Be.width+xe+ue.width/2}return{x:qe,y:Ce}},z=(ie,ue,ke)=>{const Qe=r.getAll().filter(et=>{var st;return/Association$/.test(et.type)&&(((st=et.waypoints)==null?void 0:st.length)??0)>=2});if(!Qe.length)return ke;const Mt=et=>{const st={id:ue.id,type:ue.type,x:et-ue.width/2,y:ke.y-ue.height/2,width:ue.width,height:ue.height};return Qe.some(Fe=>Fe.waypoints.some((_e,Re)=>!!Fe.waypoints[Re+1]&&Dr(_e,Fe.waypoints[Re+1],st)<=de))};if(!Mt(ke.x))return ke;for(let et=Ie;et<=Se;et+=Ie){const st=ke.x+et;if(!Mt(st)&&!N(ie,ue,st,ke.y))return{x:st,y:ke.y}}return ke},H=new Set(_.flows.map(ie=>ie.flow.target)),K=new Map,ee=ie=>{if(ie===void 0)return;const ue=r.get(ie);if(!(!ue||typeof ue.x!="number"||typeof ue.width!="number"))return ue.x+ue.width+xe},fe=ie=>{if(Q(ie)>0)return;const ue=_.flows.filter(Qe=>Qe.flow.source===ie);if(ue.length!==1)return;const ke=r.get(ue[0].flow.target);return ke&&typeof ke.y=="number"&&typeof ke.height=="number"?ke.y+ke.height/2:void 0};for(const ie of _.nodes){if(H.has(ie.node.id))continue;const ue=Tg(ie.node,ie.band,ie.afterColumn),ke=le(ie),Qe=ie.node.lane?`${ie.node.lane}|${ke??""}`:ke!==void 0?`band:${ke}`:"",Mt=I(ie.node),et=K.get(Qe)??O,st=ee(ie.afterColumn),Fe=st===void 0?et:Math.max(et,st);let _e;const Re=B(Mt,ue,ie.node.lane,ke,Fe,L,fe(ie.node.id),wn.has(ie.node.id)&&ie.node.participant!==void 0?te=>_e=te:void 0);if(_e?n.createShape(ue,Re,Mt,{autoResize:!1}):n.createShape(ue,Re,Mt),_e){const te=ie.node.lane?d(ie.node.lane):Mt;Lo.set(ie.node.id,{container:te,relCy:Re.y-te.y,grow:_e})}K.set(Qe,Re.x+ue.width+xe),!ie.node.lane&&ke===void 0&&(L+=160)}const oe=new Set,se=new Map,Me=new Map,he=new Map;if(b&&C.has(`pool:${b}`)){const ie=new Map;for(const _e of _.flows)ie.set(_e.flow.target,(ie.get(_e.flow.target)??0)+1);const ue=_e=>k(_e.node.lane,Ve(_e),Number.NaN),ke=new Set,Qe=_e=>{var Ce;const Re=(Ce=P.get(_e))==null?void 0:Ce.node.participant;if(Re)return f(Re);const te=f(_e);if(te)return te.type==="bpmn:Participant"?te:g(te)},Mt=_e=>{const Re=[],te=new Set([_e]),Ce=[_e];for(;Ce.length;){const qe=Ce.shift(),nt=P.get(qe);nt&&Re.push(nt);for(const Be of _.flows)Be.flow.source!==qe||te.has(Be.flow.target)||(ie.get(Be.flow.target)??0)!==1||(te.add(Be.flow.target),Ce.push(Be.flow.target))}return Re},et=_e=>{if(!R)return;const Re=new Set(_e.map(qe=>qe.node.id));let te=!1,Ce=!1;for(const qe of v){if(!Re.has(qe.flow.source))continue;const nt=Qe(qe.flow.target);!nt||nt.id===R.id||(nt.y<R.y?te=!0:Ce=!0)}return te&&!Ce?"up":Ce&&!te?"down":void 0};for(const _e of _.nodes){if(!kg(_e.node.type))continue;const Re=k(_e.node.lane,le(_e),Number.NaN);if(Number.isNaN(Re))continue;const te=[];for(const Be of _.flows){if(Be.flow.source!==_e.node.id)continue;const lt=P.get(Be.flow.target);if(!lt||lt.node.lane!==_e.node.lane||(ie.get(lt.node.id)??0)!==1)continue;const bt=le(lt);if(bt===void 0)continue;const Gt=k(lt.node.lane,bt,Number.NaN);if(Number.isNaN(Gt))continue;const Sn=Mt(lt.node.id),_t=et(Sn);_t&&te.push({subtree:Sn,band:bt,row:Gt,dir:_t})}if(!te.some(Be=>Be.dir==="up")||!te.some(Be=>Be.dir==="down")||!te.some(Be=>Be.dir==="up"&&te.some(lt=>lt.dir==="down"&<.row<Be.row)))continue;const qe=[...te].sort((Be,lt)=>Be.row-lt.row);[...te.filter(Be=>Be.dir==="up"),...te.filter(Be=>Be.dir==="down")].sort((Be,lt)=>Be.dir===lt.dir?Be.row-lt.row:Be.dir==="up"?-1:1).forEach((Be,lt)=>{const bt=qe[lt].band;if(bt!==Be.band){ke.add(_e.node.id);for(const Gt of Be.subtree)le(Gt)===Be.band&&Te.set(Gt.node.id,bt)}})}const st=_e=>{if(!R)return;const Re=new Set(_e.map(qe=>qe.node.id));let te=!1,Ce=!1;for(const qe of v){if(!Re.has(qe.flow.target))continue;const nt=Qe(qe.flow.source);!nt||nt.id===R.id||(nt.y<R.y?te=!0:Ce=!0)}return te&&!Ce?"up":Ce&&!te?"down":void 0};for(const _e of _.nodes){if(!kg(_e.node.type))continue;const Re=_e.node.lane??`pool:${b}`,te=V.get(Re);if(!te||te.size<2)continue;const Ce=te.get(0);if(Ce===void 0)continue;const qe=Math.max(...te.values()),nt=Ce===qe&&Ce!==0?"down":void 0;if(!nt)continue;const Be=[];for(const _t of _.flows){if(_t.flow.source!==_e.node.id)continue;const Wn=P.get(_t.flow.target);if(!Wn||Wn.node.lane!==_e.node.lane||(ie.get(Wn.node.id)??0)!==1)continue;const os=Ve(Wn);os!==void 0&&Be.push({t:Wn,subtree:Mt(Wn.node.id),band:os})}const lt=Be.find(_t=>(te.get(_t.band)??_t.band)===Ce);if(!lt||st(lt.subtree)===nt||et(lt.subtree)===nt)continue;const bt=Be.find(_t=>_t!==lt&&st(_t.subtree)===nt);if(!bt)continue;const Gt=lt.band,Sn=bt.band;for(const _t of lt.subtree)Ve(_t)===Gt&&Te.set(_t.node.id,Sn);for(const _t of bt.subtree)Ve(_t)===Sn&&Te.set(_t.node.id,Gt);ke.add(_e.node.id)}for(const _e of _.nodes){if(!kg(_e.node.type))continue;const Re=ue(_e);if(Number.isNaN(Re)||A.some(Be=>{var lt,bt;return(((lt=Be.placement)==null?void 0:lt.anchor)??(Be.association?Be.association.source===Be.annotation.id?Be.association.target:Be.association.source:void 0))===_e.node.id&&((bt=Be.placement)==null?void 0:bt.side.startsWith("bottom"))}))continue;let Ce,qe=!1,nt;for(const Be of _.flows){if(Be.flow.source!==_e.node.id)continue;const lt=P.get(Be.flow.target);if(!lt||!lt.node.lane&&le(lt)===void 0)continue;const bt=ue(lt);Number.isNaN(bt)||(Math.abs(bt-Re)<.5&&(qe=!0),bt>Re?!Ce||bt>Ce.row?Ce={id:lt.node.id,row:bt,count:1}:bt===Ce.row&&Ce.count++:bt<Re&<.node.lane===_e.node.lane&&(!nt||bt>nt.row?nt={op:lt,row:bt,count:1}:bt===nt.row&&nt.count++))}Ce&&Ce.count===1&&(ie.get(Ce.id)??0)===1&&!ke.has(_e.node.id)&&oe.add(Ce.id),!qe&&nt&&nt.count===1&&(ie.get(nt.op.node.id)??0)===1&&!wt.has(_e.node.id)&&se.set(nt.op.node.id,{lane:_e.node.lane,band:Ve(_e)})}const Fe=new Map;for(const _e of v)Fe.set(_e.flow.target,[...Fe.get(_e.flow.target)??[],_e]);for(const _e of _.nodes){const Re=Fe.get(_e.node.id);if(!Re||Re.length!==1||!ie.get(_e.node.id)||!_e.node.lane&&le(_e)===void 0||Qt.has(_e.node.id))continue;const te=(oS=P.get(Re[0].flow.source))==null?void 0:oS.node.participant,Ce=te?f(te):void 0;if(!Ce||!R||Ce.id===R.id)continue;const qe=_e.node.lane??`pool:${b}`,nt=V.get(qe);if(!nt)continue;const Be=nt.get(0)??0,lt=(nt.get(Ve(_e)??0)??Be)-Be;if(lt===0)continue;const bt=Ce.y<R.y;if(bt&<<0||!bt&<>0)continue;let Gt;for(const[Sn,_t]of nt){if(Pt.has(Sn))continue;const Wn=_t-Be;(bt&&Wn<0&&(!Gt||Wn<Gt.row)||!bt&&Wn>0&&(!Gt||Wn>Gt.row))&&(Gt={band:Sn,row:Wn})}Gt&&Me.set(_e.node.id,{lane:_e.node.lane,band:Gt.band})}}const pe=new Set;let ge=0;for(;ge++<_.nodes.length+2;){for(let ke=0;ke<_.nodes.length+_.flows.length+2;ke++){let Qe=!1;for(const Mt of _.flows){const et=Mt.flow;if(pe.has(et.id))continue;const st=f(et.source);if(!st)continue;const Fe=f(et.target),_e=P.get(et.target);if(!Fe&&_e){const Re=Tg(_e.node,_e.band),te=Ve(_e);if(_e.node.lane||te!==void 0){const Ce=I(_e.node),qe=st,nt=qe.x+(he.get(et.source)??0)+qe.width+xe,Be=se.get(et.target)??Me.get(et.target),lt=B(Ce,Re,Be?Be.lane:_e.node.lane,Be?Be.band:te,oe.has(et.target)?qe.x+qe.width/2:nt,Number.NaN,Be||!bi(et.target)?void 0:qe.y+qe.height/2),bt=P.has(et.source)?lt:z(Ce,Re,lt),Gt=n.createShape(Re,bt,Ce);oe.has(et.target)&&he.set(et.target,nt-(Gt.x+Gt.width/2)),n.connect(st,Gt,{type:"bpmn:SequenceFlow",businessObject:xp(et)})}else s.append(st,Re,{connection:{type:"bpmn:SequenceFlow",businessObject:xp(et)}})}else if(Fe)n.connect(st,Fe,{type:"bpmn:SequenceFlow",businessObject:xp(et)});else continue;pe.add(et.id),Qe=!0}if(!Qe)break}const ie=_.nodes.filter(ke=>!f(ke.node.id));if(!ie.length)break;const ue=ie[0];{const ke=Tg(ue.node,ue.band),Qe=I(ue.node),Mt=le(ue);n.createShape(ke,B(Qe,ke,ue.node.lane,Mt,O,L),Qe),!ue.node.lane&&Mt===void 0&&(L+=160)}}}const M1=new Map;for(const[b,_]of T){const R=f(b),O=f(_.flow.target);if(!(R!=null&&R.target)||!O)continue;const L=R.label&&{x:R.label.x,y:R.label.y,width:R.label.width,height:R.label.height};M1.set(b,{waypoints:R.waypoints.map(I=>({x:I.x,y:I.y})),label:L});const k=R.target,$=I=>({x:I.x+I.width/2,y:I.y+I.height/2});n.reconnect(R,O,k,[$(O),$(k)]),n.layoutConnection(R,{waypoints:[]})}const br=40,v3=10,wp=b=>{const _=H=>H.kind==="label-over-line"||H.kind==="label-over-shape"||H.kind==="label-on-shared-segment"?H.edge===b.id:H.kind==="annotation-over-label"||H.kind==="pool-name-over-label"?H.label===b.id:!1,R=()=>new Map(ft(ze(r)).filter(H=>!_(H)).map(H=>[pt(H),H])),O=R(),L=H=>[...H].filter(([K])=>!O.has(K)).map(([,K])=>K),k=H=>L(H).length<=[...O.keys()].filter(K=>!H.has(K)).length,$=b.waypoints.map(H=>({x:H.x,y:H.y})),I=b.label,B=I&&{x:I.x,y:I.y};n.layoutConnection(b,{waypoints:[]});const z=R();if(!k(z)){if(L(z).every(H=>H.kind==="edge-crosses-shape"&&H.edge===b.id)){const H=ze(r),K=H.edges.find(se=>se.id===b.id),ee=Hn(H),fe=K?Vt(K,ee):[],oe=K&&fe.length&&!fe.every(se=>se.type==="bpmn:TextAnnotation")?Zc(K,ee,Qc(b),H.edges):null;if(oe&&(n.updateWaypoints(b,oe),k(R())))return}n.updateWaypoints(b,$),I&&B&&(I.x!==B.x||I.y!==B.y)&&n.moveElements([I],{x:B.x-I.x,y:B.y-I.y})}},Og=5,Ii=10,A1=200,Ec=new Set([...F.map(b=>b.flow.id),...v.map(b=>b.flow.id),...qt(e,"sequenceFlow.update").map(b=>b.id),...qt(e,"messageFlow.update").map(b=>b.id)].filter(b=>!!b)),b3=(b,_,R,O,L,k)=>{const $=new Set(b.map(pe=>pe.id)),I=Math.min(...b.map(pe=>pe.x))+_-Ii,B=Math.max(...b.map(pe=>pe.x+pe.width))+_+A1+Ii,z=Math.min(...b.map(pe=>pe.y+Math.min(0,...R)))-Ii,H=Math.max(...b.map(pe=>pe.y+pe.height+Math.max(0,...R)))+Ii,K=r.getAll().filter(pe=>{if(pe.type!=="bpmn:SequenceFlow"&&pe.type!=="bpmn:MessageFlow")return!1;const ge=pe;return Ec.has(ge.id)||!ge.waypoints||ge.waypoints.length<2||[ge.source,ge.target].some(ue=>!ue||$.has(ue.id)||ue.x>=O)?!1:ge.waypoints.some((ue,ke)=>{const Qe=ge.waypoints[ke+1];return!!Qe&&Math.max(ue.x,Qe.x)>=I&&Math.min(ue.x,Qe.x)<=B&&Math.max(ue.y,Qe.y)>=z&&Math.min(ue.y,Qe.y)<=H})});if(!K.length)return 0;const ee=pe=>{const ge=new Map;for(const ie of b)for(const ue of R){const ke={id:ie.id,type:ie.type,x:ie.x+_+pe,y:ie.y+ue,width:ie.width,height:ie.height};for(const Qe of K){let Mt=1/0;for(let st=0;st+1<Qe.waypoints.length;st++)Mt=Math.min(Mt,Dr(Qe.waypoints[st],Qe.waypoints[st+1],ke));const et=`${Qe.id}|${ie.id}`;ge.set(et,Math.min(ge.get(et)??1/0,Mt))}}return ge},fe=[...ee(0)].filter(([,pe])=>pe<=Og).map(([pe])=>pe);if(!fe.length)return 0;let oe=0;for(let pe=1;pe<=A1;pe++){const ge=ee(pe);if([...ge.values()].every(ie=>ie>Og)&&fe.every(ie=>(ge.get(ie)??1/0)>=Ii)){oe=pe;break}}if(!oe)return 0;const se=Math.min(...b.map(pe=>pe.x))+_+oe,Me=new Set(fe.map(pe=>pe.slice(0,pe.indexOf("|"))));return K.some(pe=>pe.type==="bpmn:SequenceFlow"&&Me.has(pe.id)&&pe.waypoints.some((ge,ie)=>{const ue=pe.waypoints[ie+1];if(!ue||Math.min(ge.y,ue.y)>k||Math.max(ge.y,ue.y)<k||ge.y===ue.y)return!1;const ke=ge.x+(k-ge.y)*(ue.x-ge.x)/(ue.y-ge.y);return ke>L&&ke<se}))?0:oe},xr=(b,_=()=>!0)=>{const R=f(b);if(!R)return[];const O=[R],L=new Set([b]);for(let k=0;k<O.length;k++){const $=O[k].id;for(const I of F){const B=I.flow.target;if(I.flow.source!==$||L.has(B)||!P.has(B))continue;L.add(B);const z=f(B);z&&_(z)&&O.push(z)}}return O},x3=(b,_=()=>!0)=>{const R=f(b);if(!R)return[];const O=[R],L=new Set([b]);for(let k=0;k<O.length;k++){const $=O[k].id;for(const I of F){const B=I.flow.source;if(I.flow.target!==$||L.has(B)||!P.has(B))continue;L.add(B);const z=f(B);z&&_(z)&&O.push(z)}}return O},Bi=30,Ni=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",Ja=(b,_)=>Rf(n,b,_),es=(b,_,R=!1)=>{const O=new Set(b.flatMap(B=>B.subtree.map(z=>z.id)));for(const B of b){const z=(B.pool.children??[]).filter(Ni).filter(K=>!O.has(K.id));if(B.subtree.some(K=>z.some(ee=>K.x+_<ee.x+ee.width+Bi&&K.x+_+K.width+Bi>ee.x&&K.y<ee.y+ee.height&&K.y+K.height>ee.y)))return null}const L=b.map(B=>B.pool.width),k=R?r.filter(B=>Array.isArray(B.waypoints)).map(B=>({c:B,wps:B.waypoints.map(z=>({x:z.x,y:z.y}))})):[],$=r.filter(B=>B.type==="label").map(B=>({label:B,x:B.x,y:B.y}));n.moveElements(b.flatMap(B=>B.subtree),{x:_,y:0});const I=b.map(B=>{const H=Math.max(...B.subtree.map(K=>K.x+K.width))+Iy-(B.pool.x+B.pool.width);return H>0&&Ja(B.pool,B.pool.width+H),H});return()=>{n.moveElements(b.flatMap(B=>B.subtree),{x:-_,y:0}),b.forEach((B,z)=>{I[z]>0&&Ja(B.pool,L[z])});for(const{c:B,wps:z}of k){const H=B.waypoints??[];H.length===z.length&&H.every((ee,fe)=>Math.abs(ee.x-z[fe].x)<=.5&&Math.abs(ee.y-z[fe].y)<=.5)||n.updateWaypoints(B,z.map(ee=>({x:ee.x,y:ee.y})))}for(let B=0;B<3;B++){let z=0;for(const H of $){const K=H.x-H.label.x,ee=H.y-H.label.y;Math.abs(K)<=.5&&Math.abs(ee)<=.5||(n.moveElements([H.label],{x:K,y:ee}),z++)}if(!z)break}}},Dg=b=>{var L,k;const _=new Map,R=new Map;for(const $ of r.getAll()){if($.type!=="bpmn:Participant")continue;const I=$;(I.children??[]).length||(_.set(I.id,I),R.set(I.id,[]))}for(const $ of r.getAll()){if($.type!=="bpmn:MessageFlow")continue;const I=$,B=(L=I.source)==null?void 0:L.id,z=(k=I.target)==null?void 0:k.id;B&&z&&R.has(B)&&R.get(B).push(z),B&&z&&R.has(z)&&R.get(z).push(B)}const O=[];for(const[$,I]of R)I.length&&I.every(B=>b.has(B))&&O.push(_.get($));return O},P1=(b,_)=>{if(!b.length)return null;const R=new Set(b.map(H=>H.id)),O=r.getAll().filter(H=>H.type==="bpmn:Participant"&&!R.has(H.id)),L=Math.min(...O.filter(H=>(H.children??[]).length>0).map(H=>H.x)),k=new Set(b.filter(H=>Math.abs(H.x-L)<=2).map(H=>H.id));if(b.some(H=>{const K=k.has(H.id)?H.x:H.x+_,ee=k.has(H.id)?H.width+_:H.width;return O.some(fe=>K<fe.x+fe.width+Bi&&K+ee+Bi>fe.x&&H.y<fe.y+fe.height&&H.y+H.height>fe.y)}))return null;const I=r.filter(H=>H.type==="label").map(H=>({label:H,x:H.x,y:H.y})),B=b.filter(H=>!k.has(H.id)),z=b.filter(H=>k.has(H.id)).map(H=>({pool:H,was:{x:H.x,y:H.y,width:H.width,height:H.height}}));B.length&&n.moveElements(B,{x:_,y:0});for(const{pool:H,was:K}of z)n.resizeShape(H,{...K,width:K.width+_});return()=>{for(const{pool:H,was:K}of z)n.resizeShape(H,K);B.length&&n.moveElements(B,{x:-_,y:0});for(let H=0;H<3;H++){let K=0;for(const ee of I){const fe=ee.x-ee.label.x,oe=ee.y-ee.label.y;Math.abs(fe)<=.5&&Math.abs(oe)<=.5||(n.moveElements([ee.label],{x:fe,y:oe}),K++)}if(!K)break}}},T1=(b,_,R)=>{const O=R.x+R.width/2,L=_.y>R.y,k=L?R.y+R.height:R.y,$=L?_.y:_.y+_.height,I=b.source===_?[{x:O,y:$},{x:O,y:k}]:[{x:O,y:k},{x:O,y:$}],B=ze(r),z={...B.edges.find(H=>H.id===b.id),waypoints:I};return Vt(z,Hn(B)).length?!1:(n.updateWaypoints(b,I),!0)},w3=()=>{const b=r.filter($=>$.type==="bpmn:Participant"),_=Math.min(...b.filter($=>($.children??[]).length>0).map($=>$.x)),R=$=>m.some(I=>I.participant.id===$.id),O=$=>!!$&&$.type==="bpmn:Participant"&&!($.children??[]).length&&Math.abs($.x-_)<=2&&!R($),L=$=>!!$&&$.type==="bpmn:Participant"&&($.children??[]).length>0&&!R($),k=new Set;for(const $ of r.getAll()){if($.type!=="bpmn:MessageFlow")continue;const I=$;if((I.waypoints??[]).length!==2)continue;const B=[I.source,I.target].find(K=>O(K)||L(K)),z=B===I.source?I.target:I.source;if(!B||!z||z.type==="bpmn:Participant")continue;const H=z.x+z.width/2;L(B)&&(H<B.x||H>B.x+B.width)||k.add(I.id)}return k},_3=b=>{var R;const _=new Map;for(const O of b){const L=r.get(O);if(!L||(L.waypoints??[]).length===2)continue;const k=((R=L.source)==null?void 0:R.type)==="bpmn:Participant"?L.source:L.target,$=k===L.source?L.target:L.source;if($.x+$.width/2<=k.x+k.width)continue;const I=_.get(k.id)??{pool:k,msgs:[]};I.msgs.push({conn:L,other:$}),_.set(k.id,I)}for(const{pool:O,msgs:L}of _.values()){const k=Math.max(...L.map(({other:oe})=>oe.x+oe.width/2))+Ef;if(r.getAll().some(oe=>{if(oe.type!=="bpmn:Participant"||oe.id===O.id)return!1;const se=oe;return O.x<se.x+se.width+Bi&&k+Bi>se.x&&O.y<se.y+se.height&&O.y+O.height>se.y}))continue;const I={x:O.x,y:O.y,width:O.width,height:O.height},B=[...O.incoming??[],...O.outgoing??[]],z=B.map(oe=>({c:oe,wps:(oe.waypoints??[]).map(se=>({x:se.x,y:se.y}))})),H=B.flatMap(oe=>{const se=oe.label;return se?[{label:se,x:se.x,y:se.y}]:[]}),K=wr();Ja(O,k-O.x);const ee=L.filter(({conn:oe,other:se})=>T1(oe,O,se)).length,fe=wr();if(!(ee>0&&fe.messages>K.messages&&fe.lines>=K.lines)){Ja(O,I.width);for(const{c:oe,wps:se}of z){const Me=oe.waypoints??[];Me.length===se.length&&Me.every((pe,ge)=>Math.abs(pe.x-se[ge].x)<=.5&&Math.abs(pe.y-se[ge].y)<=.5)||n.updateWaypoints(oe,se.map(pe=>({x:pe.x,y:pe.y})))}for(let oe=0;oe<3;oe++){let se=0;for(const Me of H){const he=Me.x-Me.label.x,pe=Me.y-Me.label.y;Math.abs(he)<=.5&&Math.abs(pe)<=.5||(n.moveElements([Me.label],{x:he,y:pe}),se++)}if(!se)break}}}},k1=()=>{let b=0;for(const _ of r.getAll()){if(_.type!=="bpmn:DataInputAssociation"&&_.type!=="bpmn:DataOutputAssociation")continue;const R=_.waypoints??[];for(let O=1;O<R.length;O++)b+=Math.hypot(R[O].x-R[O-1].x,R[O].y-R[O-1].y)}return b},O1=()=>{let b=0;for(const _ of r.getAll()){if(_.type!=="bpmn:Association")continue;const R=_.waypoints??[];for(let O=1;O<R.length;O++)b+=Math.hypot(R[O].x-R[O-1].x,R[O].y-R[O-1].y)}return b},E3=b=>{const _=[];for(const R of r.getAll()){if(R.type!=="bpmn:TextAnnotation")continue;const O=R;if(b.has(O.id))continue;const k=[...O.incoming??[],...O.outgoing??[]].filter(B=>B.type==="bpmn:Association").map(B=>B.source===O?B.target:B.source);if(!k.length||k.some(B=>B===void 0))continue;const $=B=>{if(!("waypoints"in B&&B.waypoints))return[B.id];const z=B,H=[z.source,z.target];return H.some(K=>!K)?[]:H.map(K=>K.id)},I=k.flatMap(B=>$(B));I.length&&I.every(B=>b.has(B))&&_.push(O)}return _},D1=()=>ft(ze(r)).filter(b=>b.kind==="edge-crosses-shape").length,L1=b=>{const _=(b.children??[]).filter(Ni);let R=0;for(let O=0;O<_.length;O++)for(let L=O+1;L<_.length;L++){const k=_[O],$=_[L];k.x<$.x+$.width&&k.x+k.width>$.x&&k.y<$.y+$.height&&k.y+k.height>$.y&&R++}return R},wr=()=>{const b=ze(r),_=R=>R.length>=2&&(R.every(O=>Math.abs(O.x-R[0].x)<.01)||R.every(O=>Math.abs(O.y-R[0].y)<.01));return{messages:b.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length,lines:b.edges.filter(R=>_(R.waypoints)).length}},I1=b=>{const _=new Map;for(const O of r.getAll()){if(O.type!=="bpmn:MessageFlow")continue;const L=O;if(!L.waypoints||L.waypoints.length!==2)continue;const k=L.source,$=L.target;if(!k||!$)continue;const I=b.has(k.id);if(I===b.has($.id))continue;const B=I?$:k,z=g(B);if(!z||b.has(B.id))continue;const H=_.get(z.id);H?B.x<H.minX&&(H.minX=B.x):_.set(z.id,{pool:z,minX:B.x})}const R=[];for(const{pool:O,minX:L}of _.values()){const k=(O.children??[]).filter($=>Ni($)&&!b.has($.id)&&$.x>=L);k.length&&R.push({subtree:k,pool:O})}return R},S3=(b,_,R)=>{const O=new Map(_.map($=>[$.pool.id,{subtree:[...$.subtree],pool:$.pool}])),L=new Set(b);for(const $ of _)for(const I of $.subtree)L.add(I.id);let k=!1;for(;;){let $=0;for(const I of I1(L)){if(I.pool===R)continue;const B=O.get(I.pool.id);B?B.subtree.push(...I.subtree):O.set(I.pool.id,{subtree:[...I.subtree],pool:I.pool});for(const z of I.subtree)L.add(z.id);$+=I.subtree.length}if(!$)break;k=!0}return k?[...O.values()]:null},R3=(b,_)=>{const R=new Map;for(const L of r.getAll()){if(L.type!=="bpmn:DataInputAssociation"&&L.type!=="bpmn:DataOutputAssociation")continue;const k=L,$=k.waypoints;if(!$||$.length<2||!$.every(fe=>Math.abs(fe.x-$[0].x)<1))continue;const I=k.source,B=k.target;if(!I||!B)continue;const z=b.has(I.id);if(z===b.has(B.id))continue;const H=z?B:I,K=g(H);if(!K||K===_||K===g(z?I:B))continue;const ee=R.get(K.id);ee?H.x<ee.minX&&(ee.minX=H.x):R.set(K.id,{pool:K,minX:H.x})}const O=[];for(const{pool:L,minX:k}of R.values()){const $=(L.children??[]).filter(I=>Ni(I)&&!b.has(I.id)&&I.x>=k);$.length&&O.push({subtree:$,pool:L})}return O},B1=b=>{const _=ze(r),R=_.shapes.filter(L=>b.has(L.id)),O=new Set;for(const L of _.edges)if(!(L.type!=="bpmn:SequenceFlow"&&L.type!=="bpmn:MessageFlow"))for(const k of Vt(L,R))O.add(`${L.id}|${k.id}`);return O},Lg=new Map,C3=qt(e,"sequenceFlow.update").flatMap(b=>{if(b.target!==void 0)return[{id:b.id,target:b.target,source:b.source}];const _=T.get(b.id);return _?[{id:b.id,target:_.flow.target,source:_.flow.source}]:[]});for(const b of C3){if(b.target===void 0)continue;const _=P.get(b.target);if(!_)continue;const R=f(b.target),O=f(b.id);if(!R||!O)continue;const L=b.source!==void 0?f(b.source):O.source,k=O.target;if(!L||!k||k.id===R.id)continue;const $=M1.get(O.id)??{waypoints:O.waypoints,label:O.label},I=$.waypoints&&$.waypoints.length>=3&&Math.abs($.waypoints[0].x-$.waypoints[1].x)<1&&Math.abs($.waypoints[0].y-$.waypoints[1].y)>1?{x:$.waypoints[0].x,y:$.waypoints[0].y}:void 0,B=I?$.waypoints[1].y:void 0,z=I&&$.label?{x:$.label.x,y:$.label.y}:void 0,H=z&&$.label&&Math.abs(z.y+$.label.height/2-B)<=ae/5&&z.x+$.label.width>I.x?z.x+$.label.width+6:void 0,K=(L.outgoing??[]).filter(Ae=>Ae.type==="bpmn:SequenceFlow"&&Ae.id!==O.id&&Ae.target&&!Ec.has(Ae.id)),ee=new Set(K.map(Ae=>Ae.target.id)),fe=Ae=>{const Tt={type:"bpmn:Task",x:Ae.x+2,y:Ae.y+2,width:Ae.width-4,height:Ae.height-4};return K.find(xt=>(xt.waypoints??[]).some((Jt,Le)=>!!xt.waypoints[Le+1]&&Dr(Jt,xt.waypoints[Le+1],Tt)===0))},oe=xr(b.target),se=new Set(oe.map(Ae=>Ae.id)),Me=Lo.has(b.target)?{autoResize:!1}:void 0,he=Math.min(...oe.map(Ae=>Ae.x)),pe=Math.max(...oe.map(Ae=>Ae.x+Ae.width)),ge=L.x+L.width,ie=k.x+k.width<=L.x,ue=(()=>{if(!ie)return;const Ae=g(R),Tt=((Ae==null?void 0:Ae.children)??[]).filter($e=>Ni($e)&&!se.has($e.id)&&$e.type!=="bpmn:Group"&&$e.type!=="bpmn:Participant"),xt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Jt=r.getAll().filter($e=>{if(!xt.includes($e.type))return!1;const Ft=$e;return Ft.id===O.id||Ec.has(Ft.id)||!Ft.waypoints||Ft.waypoints.length<2?!1:![Ft.source,Ft.target].some(Dt=>!Dt||se.has(Dt.id))}),Le=($e,Ft)=>oe.every(Dt=>{var ta;const Rt={id:Dt.id,type:Dt.type,x:Dt.x+$e,y:Dt.y+Ft,width:Dt.width,height:Dt.height};return Ae&&(Rt.x<Ae.x||Rt.x+Rt.width>Ae.x+Ae.width||Rt.y<Ae.y||Rt.y+Rt.height>Ae.y+Ae.height)||!Kn((ta=P.get(Dt.id))==null?void 0:ta.node.lane,Dt,Dt.y+Ft+Dt.height/2)||Tt.some(Xn=>Rt.x<Xn.x+Xn.width+Ii&&Rt.x+Rt.width+Ii>Xn.x&&Rt.y<Xn.y+Xn.height+Ii&&Rt.y+Rt.height+Ii>Xn.y)?!1:Jt.every(Xn=>{for(let fo=0;fo+1<Xn.waypoints.length;fo++)if(Dr(Xn.waypoints[fo],Xn.waypoints[fo+1],Rt)<Ii)return!1;return!0})}),We=L.x+L.width/2,mt=L.y+L.height/2,tt=$.waypoints??[],Ot=tt.length>=2&&Math.abs(tt[0].y-tt[1].y)<1&&tt[1].x<tt[0].x;return[...B!==void 0?[{cx:We,cy:B}]:[],...Ot?[{cx:L.x-br-R.width/2,cy:tt[0].y}]:[],{cx:We,cy:mt+ae},{cx:We,cy:mt-ae}].find($e=>Le($e.cx-(R.x+R.width/2),$e.cy-(R.y+R.height/2)))})(),ke=ie&&!ue?ge:k.x,Qe=(()=>{var mt;if(I||ie)return 0;const Ae=$.label,Tt=((mt=O.businessObject)==null?void 0:mt.name)??"";if(!Ae||Ae.width==null||!Tt.trim())return 0;const xt=ge+br,Jt=L.y+L.height/2-R.height/2;if(Math.min(Ae.y+Ae.height,Jt+R.height)-Math.max(Ae.y,Jt)<3||Ae.x+Ae.width-xt<3)return 0;const We=Ae.x+Ae.width+v3-xt;return We<=R.width?We:0})();Qe>0&&u.add(O.id);const Mt=R.y+R.height/2,et=b3(oe,ge+br+Qe-he,[0,L.y+L.height/2-Mt,k.y+k.height/2-Mt],ke,ge,L.y+L.height/2),st=ge+br+Qe+et,Fe=(()=>{if(H===void 0)return 0;const Ae=ge+br,Tt=L.y+L.height/2-R.height/2,xt={x:Ae,y:Tt,width:pe-he,height:R.height},Jt=g(L);return((Jt==null?void 0:Jt.children)??[]).some(We=>Ni(We)&&!se.has(We.id)&&We.id!==L.id&&We.id!==k.id&&We.type!=="bpmn:Group"&&We.type!=="bpmn:Participant"&&We.x<xt.x+xt.width&&We.x+We.width>xt.x&&We.y<xt.y+xt.height&&We.y+We.height>xt.y)||fe(xt)?Math.max(0,H-Ae):0})(),_e=ue?0:pe-he+br*2+et+Fe+Qe-(ie?0:k.x-ge);let Re=[];if(_e>0){const Ae=g(R),Tt=(Ae==null?void 0:Ae.children)??[],xt=tt=>tt.type==="bpmn:Lane";Re=(()=>{const tt=new Set;for(const He of Tt)Ni(He)&&!se.has(He.id)&&He.id!==L.id&&He.x>=ke&&tt.add(He.id);const Ot=[];for(const He of Tt){if(He.type!=="bpmn:DataStoreReference"&&He.type!=="bpmn:DataObjectReference")continue;const $e=He,Dt=[...$e.incoming??[],...$e.outgoing??[]].filter(Rt=>Rt.type==="bpmn:DataInputAssociation"||Rt.type==="bpmn:DataOutputAssociation").map(Rt=>Rt.source===$e?Rt.target:Rt.source);Dt.length&&Dt.every(Rt=>Rt!==void 0&&tt.has(Rt.id))&&Ot.push($e)}return Ot})();const Le=Tt.filter(tt=>!("waypoints"in tt&&tt.waypoints)&&!xt(tt)&&tt.type!=="label"&&!se.has(tt.id)&&tt.id!==L.id&&tt.x>=ke),We=Le.flatMap(tt=>tt.labels??[]),mt=Ae?[Ae,...Tt.filter(tt=>xt(tt))]:[];if(Le.length){const tt=new Set(Le.map(ot=>ot.id)),Ot=I1(tt),He=Ot.length?S3(tt,Ot,Ae):null,$e=ot=>{const Ct=new Set(tt);for(const jt of ot)for(const Io of jt.subtree)Ct.add(Io.id);return E3(Ct)},Ft=$e(Ot),Dt=He?$e(He):Ft,Rt=Dg(tt),ta=new Set(tt);for(const ot of Ot)for(const Ct of ot.subtree)ta.add(Ct.id);const Xn=Ot.length?Dg(ta):Rt,fo=(()=>{if(!He)return[];const ot=new Set(tt);for(const Ct of He)for(const jt of Ct.subtree)ot.add(jt.id);return Dg(ot)})(),rs=He??Ot,na=(()=>{const ot=new Set(tt);for(const Ct of rs)for(const jt of Ct.subtree)ot.add(jt.id);return R3(ot,Ae)})(),zg=na.length?$e([...rs,...na]):Ft,qi=new Set([...Le,...mt].map(ot=>ot.id)),Et=Tt.filter(ot=>{const Ct=ot.labelTarget;return ot.type==="label"&&!!Ct&&"waypoints"in Ct&&!!Ct.source&&!!Ct.target&&qi.has(Ct.source.id)&&qi.has(Ct.target.id)}),Rn=w3();n.createSpace([...Le,...We,...Et],mt,{x:_e,y:0},"e",ke-1);const en=(ot,Ct,jt)=>{const Io=wr(),Rp=jt?B1(jt):null,Cp=es(ot,_e,!!jt);if(!Cp)return!1;const Mc=Ct.length?P1(Ct,_e):null,Mp=wr(),tn=!!jt&&!!Rp&&[...B1(jt)].some(oa=>!Rp.has(oa));return Mp.messages>Io.messages&&Mp.lines>=Io.lines&&!tn?!0:(Mc==null||Mc(),Cp(),!1)},fi=na.length>0&&en([...rs,...na],He?fo:Xn,new Set(na.flatMap(ot=>ot.subtree.map(Ct=>Ct.id)))),ia=!fi&&He?en(He,fo):!1;let ho=fi||ia;!ho&&Ot.length&&(ho=en(Ot,Xn));const as=fi?zg:ia?Dt:Ft;if(!ho){for(const ot of Ot){const Ct=wr(),jt=es([ot],_e);if(!jt)continue;const Io=wr();(Io.messages<=Ct.messages||Io.lines<Ct.lines)&&jt()}if(Rt.length){const ot=wr(),Ct=P1(Rt,_e);if(Ct){const jt=wr();(jt.messages<=ot.messages||jt.lines<ot.lines)&&Ct()}}}if(_3(Rn),as.length){const ot=()=>new Set(ft(ze(r)).map(jt=>pt(jt))),Ct=jt=>{const Io=O1(),Rp=ot(),Cp=jt.map(tn=>({a:tn,x:tn.x,y:tn.y})),Mc=r.filter(tn=>tn.type==="label").map(tn=>({label:tn,x:tn.x,y:tn.y}));n.moveElements(jt,{x:_e,y:0});const Mp=[...ot()].filter(tn=>!Rp.has(tn));if(O1()<Io&&Mp.length===0)return!0;for(const{a:tn,x:oa,y:Ac}of Cp)(tn.x!==oa||tn.y!==Ac)&&n.moveElements([tn],{x:oa-tn.x,y:Ac-tn.y});for(const tn of Mc){const oa=tn.x-tn.label.x,Ac=tn.y-tn.label.y;(oa!==0||Ac!==0)&&n.moveElements([tn.label],{x:oa,y:Ac})}return!1};if(!Ct(as)&&as.length>1)for(const jt of as)Ct([jt])}}}const te=_.node.lane!==void 0?f(_.node.lane):_.node.participant!==void 0?f(_.node.participant):void 0,Ce=Ae=>{if(!te)return!0;const Tt=Ae.y+Ae.height/2;return Tt>=te.y&&Tt<=te.y+te.height},qe=!Ce(L)&&Ce(k),nt=Ae=>Ae.y+Ae.height/2,Be=()=>{const Ae=L.x+L.width,Tt=k.x,xt=nt(k)-R.height/2,Jt=nt(k)+R.height/2;return!r.getAll().some(Le=>Ni(Le)&&Le.type!=="bpmn:Participant"&&Le.type!=="bpmn:Group"&&Le.type!=="bpmn:TextAnnotation"&&Le.id!==L.id&&Le.id!==k.id&&Le.id!==R.id&&Le.x<Tt&&Le.x+Le.width>Ae&&Le.y<Jt&&Le.y+Le.height>xt)},lt=!qe&&_.band!==void 0&&Ce(k)&&!gn(_.node.lane,_.node.participant,_.band,nt(L))&&gn(_.node.lane,_.node.participant,_.band,nt(k))&&k.x>=L.x+L.width&&Be(),bt=qe||lt?k:L,Gt=bt.y+bt.height/2,Sn=Gt-(R.y+R.height/2),_t=_.band!==void 0,Wn=_t?[R]:oe,os=(_.band===void 0||gn(_.node.lane,_.node.participant,_.band,Gt))&&bi(b.target)&&Wn.every(Ae=>{var Tt;return Kn((Tt=P.get(Ae.id))==null?void 0:Tt.node.lane,Ae,Ae.y+Ae.height/2+Sn)}),X3=Ae=>Math.abs(Ae.y+Ae.height/2-(R.y+R.height/2))<=ae/2;if(os&&_t){const Ae=Math.abs(Sn)<=ae/2?oe.filter(Le=>Le.id!==R.id&&X3(Le)):[],Tt=R.y+R.height/2,Jt=_.band!==void 0&&!gn(_.node.lane,_.node.participant,_.band,Tt)?oe.filter(Le=>{var We,mt;return Le.id!==R.id&&!Ae.includes(Le)&&((We=P.get(Le.id))==null?void 0:We.band)===_.band&&((mt=P.get(Le.id))==null?void 0:mt.node.lane)===_.node.lane&&(Math.abs(Le.y+Le.height/2-Tt)<=ae/2||gn(_.node.lane,_.node.participant,_.band,Le.y+Le.height/2))}).map(Le=>({t:Le,dy:Gt-(Le.y+Le.height/2)})).filter(({dy:Le})=>Le!==0):[];if(n.moveElements(oe,{x:st-he,y:0},void 0,Me),n.moveElements([R],{x:0,y:Sn},void 0,Me),Ae.length){const Le=()=>new Set(ft(ze(r)).map($e=>pt($e))),We=Le(),mt=r.filter($e=>$e.type==="label").map($e=>({label:$e,x:$e.x,y:$e.y}));n.moveElements(Ae,{x:0,y:Sn});const tt=Le(),Ot=[...tt].filter($e=>!We.has($e)).length,He=[...We].filter($e=>!tt.has($e)).length;if(Ot>He){n.moveElements(Ae,{x:0,y:-Sn});for(const $e of mt){const Ft=$e.x-$e.label.x,Dt=$e.y-$e.label.y;(Ft!==0||Dt!==0)&&n.moveElements([$e.label],{x:Ft,y:Dt})}}}if(Jt.length){const Le=new Set(oe.map(We=>We.id));for(const{t:We,dy:mt}of Jt)N(We.parent,We,We.x+We.width/2,We.y+We.height/2+mt,Le)||n.moveElements([We],{x:0,y:mt})}}else n.moveElements(oe,{x:st-he,y:os?Sn:0},void 0,Me);const Ui=g(R);if(!os&&_.node.lane===void 0&&_.band!==void 0&&Ui){const Ae=Ui.y+Ee+Ht(`pool:${_.node.participant??""}`,_.band)*ae,Tt=Ae-(R.y+R.height/2);Tt!==0&&!N(Ui,R,R.x+R.width/2,Ae,se)&&n.moveElements([R],{x:0,y:Tt},void 0,Me)}if(ue)n.moveElements(oe,{x:ue.cx-(R.x+R.width/2),y:ue.cy-(R.y+R.height/2)},void 0,Me);else if(Ui){const Ae=(Ui.children??[]).filter(Le=>Ni(Le)&&!se.has(Le.id)&&Le.type!=="bpmn:Group"&&Le.type!=="bpmn:Participant"),Tt=(Le,We,mt,tt,Ot)=>Le.x+We<Ot.x+Ot.width+tt&&Le.x+We+Le.width+tt>Ot.x&&Le.y+mt<Ot.y+Ot.height+tt&&Le.y+mt+Le.height+tt>Ot.y,xt=Ae.find(Le=>Tt(R,0,0,0,Le)),Jt=xt?void 0:fe(R);if(xt||Jt){const Le=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],We=r.getAll().filter(Et=>{if(!Le.includes(Et.type))return!1;const Rn=Et;return Ec.has(Rn.id)||!Rn.waypoints||Rn.waypoints.length<2?!1:![Rn.source,Rn.target].some(en=>!en||se.has(en.id))}),mt=(Et,Rn,en)=>{var fi;return Kn((fi=P.get(Et.id))==null?void 0:fi.node.lane,Et,Et.y+en+Et.height/2)&&Et.x+Rn>=Ui.x&&Et.x+Rn+Et.width<=Ui.x+Ui.width&&Et.y+en>=Ui.y&&Et.y+en+Et.height<=Ui.y+Ui.height},tt=(Et,Rn)=>oe.every(en=>mt(en,Et,Rn)&&!Ae.some(fi=>Tt(en,Et,Rn,Ii,fi))&&We.every(fi=>{const ia={id:en.id,type:en.type,x:en.x+Et,y:en.y+Rn,width:en.width,height:en.height};for(let ho=0;ho+1<fi.waypoints.length;ho++)if(Dr(fi.waypoints[ho],fi.waypoints[ho+1],ia)<Ii)return!1;return!0})),Ot=R.y+R.height/2,He=[B,k.y+k.height/2].filter(Et=>Et!==void 0&&Math.abs(Et-Ot)>=1),$e=xt&&ee.has(xt.id)?xt:Jt==null?void 0:Jt.target,Ft=$e?$e.x-R.x:0,Dt=Math.max(...oe.map(Et=>Et.x+Et.width)),Rt=[...Ft!==0?[Ft]:[],...et!==0?[-et]:[],0],ta=H===void 0?[]:Rt.map(Et=>Math.max(Et,H-R.x)),Xn=Et=>Dt+Et+br<=k.x,fo=[...new Set([...ta,...Rt])].filter(Xn),rs=xt&&ee.has(xt.id)?[xt.x+xt.width+br-R.x]:[],na=H===void 0?[]:rs.map(Et=>Math.max(Et,H-R.x)),zg=[...new Set([...na,...rs])].filter(Et=>Xn(Et)&&!fo.includes(Et));let qi;for(const Et of[fo,zg]){for(const Rn of He){for(const en of Et)if(tt(en,Rn-Ot)){qi={dx:en,dy:Rn-Ot};break}if(qi)break}if(qi)break}if(qi){const Et=ot=>{const Ct=ot;return[Ct.edge,Ct.other,...Array.isArray(Ct.edges)?Ct.edges:[]].some(jt=>typeof jt=="string"&&Ec.has(jt))},Rn=()=>new Set(ft(ze(r)).filter(ot=>!Et(ot)).map(ot=>pt(ot))),en=Rn(),fi=r.filter(ot=>ot.type==="label").map(ot=>({label:ot,x:ot.x,y:ot.y}));n.moveElements(oe,{x:qi.dx,y:qi.dy},void 0,Me);const ia=Rn(),ho=[...ia].filter(ot=>!en.has(ot)).length,as=[...en].filter(ot=>!ia.has(ot)).length;if(ho>as){n.moveElements(oe,{x:-qi.dx,y:-qi.dy},void 0,Me);for(const ot of fi){const Ct=ot.x-ot.label.x,jt=ot.y-ot.label.y;(Ct!==0||jt!==0)&&n.moveElements([ot.label],{x:Ct,y:jt})}}else I&&Lg.set(O.id,{exit:I,channelY:B,label:z})}}}{const Ae=new Set(oe.map(We=>We.id)),Tt=new Set(F.map(We=>We.flow.id)),xt=20,Jt=We=>{const mt=We.source,tt=We.target,Ot=Math.min(mt.x,tt.x)-xt,He=Math.max(mt.x+mt.width,tt.x+tt.width)+xt,$e=Math.min(mt.y,tt.y)-xt,Ft=Math.max(mt.y+mt.height,tt.y+tt.height)+xt;return We.waypoints.some(Dt=>Dt.x<Ot||Dt.x>He||Dt.y<$e||Dt.y>Ft)},Le=new Map;for(const We of oe)for(const mt of[...We.incoming??[],...We.outgoing??[]])(T.has(mt.id)||mt.id!==b.id&&Tt.has(mt.id))&&!(Ae.has(mt.source.id)&&Ae.has(mt.target.id))&&Le.set(mt.id,mt);for(const We of Le.values())Jt(We)&&wp(We)}const po=Re.length?g(Re[0]):void 0;if(po){const Ae={assoc:k1(),overlaps:L1(po),crosses:D1()},Tt=Re.map(He=>({st:He,x:He.x})),xt=r.filter(He=>He.type==="label").map(He=>({label:He,x:He.x,y:He.y})),Jt=Math.min(...Re.flatMap(He=>[...He.incoming??[],...He.outgoing??[]].filter($e=>$e.type==="bpmn:DataInputAssociation"||$e.type==="bpmn:DataOutputAssociation").map($e=>($e.source===He?$e.target:$e.source).x))),Le=new Set(Re.map(He=>He.id)),We=(po.children??[]).filter(Ni).filter(He=>!Le.has(He.id));let mt=Jt;for(const He of[...Re].sort(($e,Ft)=>$e.x-Ft.x)){let $e=mt;for(let Ft=0;Ft<100;Ft++){const Dt=We.find(Rt=>$e<Rt.x+Rt.width+Bi&&$e+He.width+Bi>Rt.x&&He.y<Rt.y+Rt.height&&He.y+He.height>Rt.y);if(!Dt)break;$e=Dt.x+Dt.width+Bi}$e!==He.x&&n.moveElements([He],{x:$e-He.x,y:0}),mt=$e+He.width+Bi}const tt=mt+150-(po.x+po.width);tt>0&&Ja(po,po.width+tt);const Ot={assoc:k1(),overlaps:L1(po),crosses:D1()};if(Ot.assoc>=Ae.assoc||Ot.overlaps>Ae.overlaps||Ot.crosses>Ae.crosses){for(const{st:He,x:$e}of Tt)He.x!==$e&&n.moveElements([He],{x:$e-He.x,y:0});tt>0&&Ja(po,po.width-tt);for(const He of xt){const $e=He.x-He.label.x,Ft=He.y-He.label.y;($e!==0||Ft!==0)&&n.moveElements([He.label],{x:$e,y:Ft})}}}}for(const[b,_]of Lo){const R=f(b);if(!R)continue;const O=_.container,L=Math.abs(R.y+R.height/2-O.y-_.relCy)>=.5,k=R.label,$=Math.min(R.y,k&&!k.hidden?k.y:R.y),I=Math.max(R.y+R.height,k&&!k.hidden?k.y+k.height:0);if(L&&$>=O.y&&I<=O.y+O.height)continue;const B=R.y;_.grow(),R.y!==B&&n.moveElements([R],{x:0,y:B-R.y},void 0,{autoResize:!1})}const N1=(b,_)=>{const R=_.target===b,O=d(_.source),L=d(_.target),k=R?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,L,_.id?{type:k,businessObject:i.create(k,{id:_.id})}:{type:k})},$1=b=>{for(const _ of m){if(!_.participant.blackBox)continue;const R=f(_.participant.id);if(!R)continue;const O=[];for(const k of v){const $=k.flow.source===_.participant.id?k.flow.target:k.flow.target===_.participant.id?k.flow.source:void 0,I=$?f($):void 0;I&&typeof I.x=="number"&&I.type!=="bpmn:Participant"&&O.push(I)}if(!O.length)continue;if(!b&&_.order===void 0){const k=(()=>{var I;const $=new Map;for(const B of O){const z=g(B);if(!z)continue;const H=$.get(z.id);H?H.n+=1:$.set(z.id,{shape:z,n:1})}return(I=[...$.values()].sort((B,z)=>z.n-B.n)[0])==null?void 0:I.shape})();if(k){const $=z=>z.reduce((H,K)=>H+K,0)/z.length,I=$(O.map(z=>z.y+z.height/2))<k.y+k.height/2,B=r.filter(z=>z.type==="bpmn:Participant"&&z.id!==_.participant.id&&z.id!==k.id).filter(z=>I?z.y+z.height<=k.y+5:z.y>=k.y+k.height-5);if(B.length){const z=[...B.reduce((ie,ue)=>ie.set(ue.y,(ie.get(ue.y)??0)+1),new Map)].sort((ie,ue)=>ue[1]-ie[1]||(I?ue[0]-ie[0]:ie[0]-ue[0]))[0][0],H=Math.min(R.width,WM),K=UM,ee=O.map(ie=>ie.x+ie.width/2),fe=Math.round($(ee)-H/2),oe=Math.max(...ee)+Ef,se=ie=>({x:ie,width:Math.max(H,oe-ie)}),Me=B.filter(ie=>Math.min(ie.y+ie.height,z+K)-Math.max(ie.y,z)>0),he=ie=>{const ue=se(ie);return Me.some(ke=>ke.x<ue.x+ue.width&&ue.x<ke.x+ke.width)},pe=ie=>{const ue=se(ie);return ee.filter(ke=>ke>=ue.x+10&&ke<=ue.x+ue.width-10).length},ge=(()=>{if(!he(fe))return fe;const ie=pe(fe);return Me.flatMap(ue=>[ue.x+ue.width+Ay,ue.x-Ay-H]).map(ue=>Math.round(ue)).filter(ue=>!he(ue)&&pe(ue)>=ie).sort((ue,ke)=>Math.abs(ue-fe)-Math.abs(ke-fe))[0]??fe})();if(ge!==R.x||z!==R.y||H!==R.width||K!==R.height){const ie=()=>new Set(ft(ze(r)).map(st=>pt(st))),ue=ie(),ke={x:R.x,y:R.y,width:R.width,height:R.height};n.resizeShape(R,{x:ge,y:z,width:H,height:K});const Qe=ie(),Mt=[...Qe].filter(st=>!ue.has(st)).length,et=[...ue].filter(st=>!Qe.has(st)).length;Mt>et&&n.resizeShape(R,ke)}}}}const L=Math.max(...O.map(k=>k.x+k.width/2))+Ef;if(L>R.x+R.width&&n.resizeShape(R,{x:R.x,y:R.y,width:L-R.x,height:R.height}),!!b)for(const k of v){const $=f(k.flow.id),I=k.flow.source===_.participant.id?k.flow.target:k.flow.target===_.participant.id?k.flow.source:void 0,B=I?f(I):void 0;if(!$||!B||B.type==="bpmn:Participant")continue;const z=B.x+B.width/2;z<R.x+10||z>R.x+R.width-10||T1($,R,B)}}};$1(!1);for(const b of v){const _=b.flow;n.connect(d(_.source),d(_.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:_.id,name:_.name})})}{const R=new Set([...F.map(B=>B.flow.id),...v.map(B=>B.flow.id)].filter(B=>!!B)),O=r.filter(B=>!!B.waypoints),L=(B,z)=>Math.abs(z.x-B.x)<2?"L":Math.abs(z.x-(B.x+B.width))<2?"R":Math.abs(z.y-B.y)<2?"T":Math.abs(z.y-(B.y+B.height))<2?"B":void 0,k=new Map,$=(B,z,H)=>{if(!B||!z||typeof B.x!="number")return;const K=L(B,z);if(!K)return;let ee=k.get(B.id);ee||k.set(B.id,ee=new Map),ee.set(K,[...ee.get(K)??[],H])};for(const B of O){const z=B.waypoints;!z||z.length<2||($(B.source,z[0],{id:B.id,dir:"out"}),$(B.target,z[z.length-1],{id:B.id,dir:"in"}))}const I=new Set;for(const[B,z]of k){const H=f(B);if(!H||typeof H.x!="number")continue;const K=pe=>{var ie;const ge=(ie=f(pe.id))==null?void 0:ie.source;return!!ge&&typeof ge.x=="number"&&ge.x+ge.width/2>H.x+H.width/2};if(![...z.values()].some(pe=>pe.length>=3&&pe.some(ge=>ge.dir==="out")&&pe.some(ge=>ge.dir==="in"&&R.has(ge.id)&&K(ge))))continue;const fe=g(H);if(!fe||I.has(fe.id)||(fe.children??[]).some(pe=>pe.type==="bpmn:Lane"))continue;const oe=(rS=z.get("T"))!=null&&rS.length?(aS=z.get("B"))!=null&&aS.length?void 0:"B":"T";if(!oe||(oe==="T"?H.y-fe.y:fe.y+fe.height-(H.y+H.height))>=ae)continue;const Me=(fe.children??[]).filter(pe=>!("waypoints"in pe&&pe.waypoints)&&pe.type!=="label"&&typeof pe.x=="number"),he=fe.y+fe.height;n.resizeShape(fe,{x:fe.x,y:fe.y,width:fe.width,height:fe.height+ae}),rn(he,fe.id,ae),oe==="T"&&Me.length&&n.moveElements(Me,{x:0,y:ae}),I.add(fe.id)}}const Ig=20,F1=4,M3=3,A3=2,P3=2,T3=[10,30,80],Qr=()=>{const b=ze(r);return{bad:ft(b).filter(_=>_.kind==="edge-crosses-shape"||_.kind==="edge-overlap-opposite"||_.kind==="edge-overlap-mixed").length,crossings:Dm(b),straight:b.edges.filter(_=>_.type==="bpmn:MessageFlow"&&_.waypoints.length===2).length}},_r=b=>{const _=ze(r),R=_.edges.find(O=>O.id===b);return R?Vt(R,Hn(_)).length:0},Sc=b=>_r(b)>0,ts=b=>ze(r).edges.filter(_=>_.type==="bpmn:MessageFlow"&&_.id!==b&&_.waypoints.length===2).length,j1=(b,_,R)=>es([{subtree:b,pool:_}],R),H1=(b,_)=>_.bad>b.bad||_.crossings>b.crossings&&_.straight<=b.straight&&_.bad>=b.bad,ns=(b,_)=>H1(b,_)||_.straight<b.straight,Er=(b,_,R=()=>!0,O=H1,L=!1)=>{const k=Qr(),$=es(b,_,L);if(!$)return!1;const I=Qr();return O(k,I)||!R()?($(),!1):!0},k3=(b,_,R,O=()=>!0)=>Er([{subtree:b,pool:_}],R,O),Jr=b=>{var _;return!!((_=P.get(b))!=null&&_.node.participant)},is=new Map;for(const b of v){if(!Jr(b.flow.target))continue;const _=is.get(b.flow.target)??[];_.push(b),is.set(b.flow.target,_)}const Rc=[...is.keys()],Bg=new Set(F.map(b=>b.flow.target)),z1=b=>gt.findIndex(({op:_})=>_.participant.id===b);Rc.sort((b,_)=>{var L,k;const R=Bg.has(b)?1:0,O=Bg.has(_)?1:0;return R!==O?R-O:z1((L=P.get(b))==null?void 0:L.node.participant)-z1((k=P.get(_))==null?void 0:k.node.participant)});const Sr=b=>b.x+b.width/2,O3=b=>{const _=new Map;for(const L of r.getAll()){const k=L;if(!k.waypoints||!k.source||!k.target)continue;(_.get(k.source.id)??_.set(k.source.id,[]).get(k.source.id)).push(k.target.id)}const R=new Set([b]),O=[b];for(let L=0;L<O.length;L++)for(const k of _.get(O[L])??[])R.has(k)||(R.add(k),O.push(k));return R},D3=(b,_)=>{const R=O3(_);let O;for(const L of r.getAll()){const k=L;if(k.type!=="bpmn:MessageFlow"||!k.source||!k.target||k.target.id!==b||R.has(k.source.id))continue;const $=k.source;if(typeof $.x!="number"||$.type==="bpmn:Participant")continue;const I=Sr($);(O===void 0||I>O)&&(O=I)}return O},Ng=(b,_)=>{const R=f(b.flow.source);if(R)return R.type==="bpmn:Participant"?D3(R.id,_):Sr(R)},G1=b=>{let _;for(const R of is.get(b)??[]){const O=Ng(R,b);O!==void 0&&(!_||O>_.cx)&&(_={op:R,cx:O})}return _==null?void 0:_.op},L3=b=>{const _=G1(b),R=f(b),O=_?Ng(_,b):void 0;return R&&O!==void 0?O-Sr(R):void 0},I3=b=>{const _=L3(b);return _!==void 0&&Math.abs(_)<Ig},_p=(b,_,R,O,L)=>{var k;for(let $=!0;$;){$=!1;for(const I of v){if(I.flow.id===R)continue;const B=_.has(I.flow.source),z=_.has(I.flow.target);if(B===z||O(B?I.flow.source:I.flow.target))continue;const H=B?I.flow.target:I.flow.source;if(L(H)||!Jr(H))continue;const K=f(I.flow.id);if(!(K!=null&&K.waypoints)||K.waypoints.length!==2)continue;const ee=f(H),fe=(k=P.get(H))==null?void 0:k.node.participant;if(!ee||!fe)continue;const oe=xr(H,se=>se.x>=ee.x).filter(se=>!_.has(se.id));if(!(!oe.length||oe.some(se=>L(se.id)))){for(const se of oe)_.add(se.id);b.set(fe,[...b.get(fe)??[],...oe]),$=!0}}}return[...b].map(([$,I])=>({subtree:I,pool:d($)}))},V1=(b,_,R,O,L)=>_p(new Map([[_,[...b]]]),new Set(b.map(k=>k.id)),O,k=>k===R,k=>k===L),$g=b=>{const _=G1(b);if(!_)return null;const R=f(b),O=f(_.flow.source),L=Ng(_,b);if(!R||!O||L===void 0)return null;const k=L-Sr(R);if(k>=Ig){const $=P.get(b).node.participant,I=xr(b,B=>B.x>=R.x);return{groups:V1(I,$,b,_.flow.id,_.flow.source),dx:k}}if(-k>=Ig&&Jr(_.flow.source)){const $=P.get(_.flow.source).node.participant,I=xr(_.flow.source,B=>B.x>=O.x&&!I3(B.id));return{groups:V1(I,$,_.flow.source,_.flow.id,b),dx:-k}}return null},W1=()=>Rc.map(b=>({id:b,plan:$g(b)})).filter(b=>!!b.plan).sort((b,_)=>Math.min(...b.plan.groups.flatMap(R=>R.subtree.map(O=>O.x)))-Math.min(..._.plan.groups.flatMap(R=>R.subtree.map(O=>O.x)))).map(b=>b.id);for(let b=0;b<3;b++){const _=Qr(),R=[];for(const L of W1()){const k=$g(L);if(!k)continue;const $=es(k.groups,k.dx);$&&R.push($)}if(!R.length)break;if(!ns(_,Qr()))continue;for(const L of R.reverse())L();let O=!1;for(const L of W1()){const k=$g(L);k&&Er(k.groups,k.dx,()=>!0,ns)&&(O=!0)}if(!O)break}for(const b of Rc){if(Bg.has(b))continue;const _=P.get(b);if(!_||_.node.lane!==void 0)continue;const R=le(_);if(R===void 0)continue;const O=f(b),L=O?g(O):void 0;if(!O||!L)continue;const k=L.y+Ee+Ht(`pool:${_.node.participant??""}`,R)*ae,$=k-(O.y+O.height/2);$!==0&&!N(L,O,O.x+O.width/2,k)&&n.moveElements([O],{x:0,y:$})}const Ep=()=>{const b=r.filter(O=>O.type==="bpmn:Participant"),_=new Map(b.map(O=>[O.id,O]));let R=0;for(const{pools:[O,L]}of lf(b)){const k=_.get(O),$=_.get(L);R+=(Math.min(k.x+k.width,$.x+$.width)-Math.max(k.x,$.x))*(Math.min(k.y+k.height,$.y+$.height)-Math.max(k.y,$.y))}return R},Fg=new Set,U1=new Set;for(let b=0,_=!0;_&&b<M3;b++){_=!1;for(const R of Rc.flatMap(O=>is.get(O)??[])){if(Fg.has(R.flow.id)||!Sc(R.flow.id))continue;const O=f(R.flow.target);if(!O)continue;const L=d(P.get(R.flow.target).node.participant),k=xr(R.flow.target,H=>H.x>=O.x),$=O.width+xe,I=_r(R.flow.id),B=ts(R.flow.id),z=Ep();for(let H=1;H<=F1;H++){const K=()=>_r(R.flow.id)>=I||Ep()>z?!1:ts(R.flow.id)>=B?!0:(U1.add(R.flow.id),!1);if(k3(k,L,$*H,K)){Fg.add(R.flow.id),_=!0;break}}}}for(const b of Rc.flatMap(_=>is.get(_)??[])){if(Fg.has(b.flow.id)||!U1.has(b.flow.id)||!Sc(b.flow.id))continue;const _=f(b.flow.target);if(!_)continue;const R=d(P.get(b.flow.target).node.participant),O=xr(b.flow.target,K=>K.x>=_.x),L=new Set(O.map(K=>K.id)),k=new Map;for(const K of r.filter(ee=>ee.type==="bpmn:MessageFlow")){if(((sS=K.waypoints)==null?void 0:sS.length)!==2||!K.source||!K.target)continue;const ee=L.has(K.source.id);if(ee===L.has(K.target.id))continue;const fe=ee?K.target:K.source,oe=(cS=P.get(fe.id))==null?void 0:cS.node.participant;!oe||k.has(fe.id)||k.set(fe.id,{subtree:[fe],pool:d(oe)})}if(!k.size)continue;const $=_.width+xe,I=_r(b.flow.id),B=ts(b.flow.id),z=Ep(),H=()=>_r(b.flow.id)<I&&ts(b.flow.id)>=B&&Ep()<=z;for(let K=1;K<=A3&&!Er([{subtree:O,pool:R},...k.values()],$*K,H);K++);}const jg=v.map(b=>({id:b.flow.id,source:b.flow.source,target:b.flow.target,preexisting:!1})),q1=new Set(jg.map(b=>b.id));for(const b of r.filter(_=>_.type==="bpmn:MessageFlow"))q1.has(b.id)||!b.source||!b.target||b.source.type==="bpmn:Participant"!=(b.target.type==="bpmn:Participant")&&jg.push({id:b.id,source:b.source.id,target:b.target.id,preexisting:!0});for(const b of jg){if(!Sc(b.id))continue;const _=f(b.source),R=f(b.target);if(!_||!R)continue;let O,L,k;if(b.preexisting){const[I,B]=_.type==="bpmn:Participant"?[R,_]:[_,R];if(O=Sr(I),O<B.x||O>B.x+B.width)continue;[L,k]=I.y<B.y?[I.y+I.height,B.y]:[B.y+B.height,I.y]}else{if(_.type==="bpmn:Participant"||R.type==="bpmn:Participant"||(O=_.x+_.width/2,Math.abs(O-(R.x+R.width/2))>15))continue;[L,k]=_.y<R.y?[_.y+_.height,R.y]:[R.y+R.height,_.y]}const $=[...P.values()].map(I=>f(I.node.id)).filter(I=>!!I&&I.id!==_.id&&I.id!==R.id).filter(I=>I.x<=O&&O<=I.x+I.width&&I.y+I.height>L&&I.y<k).sort((I,B)=>I.x-B.x);for(const I of $){const B=(lS=P.get(I.id))==null?void 0:lS.node.participant,z=B?f(B):void 0;if(!B||!z)continue;const H=[...P.values()].filter(ge=>ge.node.participant===B).map(ge=>ge.node.id),K=ge=>ge.map(ie=>f(ie)).filter(ie=>!!ie),fe=[x3(I.id,ge=>{var ie;return((ie=P.get(ge.id))==null?void 0:ie.node.participant)===B}),K(H)].filter(ge=>ge.length).map(ge=>[{subtree:ge,pool:z}]);if(b.preexisting){const ge=K(H);ge.length&&fe.push(_p(new Map([[B,[...ge]]]),new Set(ge.map(ie=>ie.id)),b.id,()=>!1,ie=>ie===_.id||ie===R.id))}const oe=I.width+xe,se=_r(b.id),Me=ts(b.id),he=()=>_r(b.id)<se&&ts(b.id)>=Me;let pe=!1;for(const ge of fe){for(let ie=1;ie<=F1;ie++)if(Er(ge,oe*ie,he)){pe=!0;break}if(pe)break}if(!Sc(b.id))break}}const Sp=()=>{var _;const b=new Set;for(const R of ft(ze(r)))R.kind!=="edge-crosses-shape"||q1.has(R.edge)||((_=f(R.edge))==null?void 0:_.type)==="bpmn:MessageFlow"&&b.add(`${R.edge}>${R.shape}`);return b},B3=(b,_)=>Qr().bad>=b&&[...Sp()].some(R=>!_.has(R)),Y1=b=>{var _,R;return _r(b)===0&&((R=(_=f(b))==null?void 0:_.waypoints)==null?void 0:R.length)===2},N3=(b,_,R)=>{const O=new Set(b.flatMap(k=>k.subtree.map($=>$.id))),L=[...Sp()].filter(k=>!R.has(k)).map(k=>k.split(">")[1]);return[...new Set(L)].filter(k=>O.has(k)&&k!==_.source&&k!==_.target)},$3=(b,_,R,O,L)=>{const k=b.map(z=>({...z,subtree:z.subtree.filter(H=>!L.includes(H.id))})).filter(z=>z.subtree.length),$=new Set(k.flatMap(z=>z.subtree.map(H=>H.id))),I=()=>L.every(z=>{const H=f(z);return!!H&&F.filter(K=>K.flow.target===z&&$.has(K.flow.source)).every(K=>{const ee=f(K.flow.source);return!!ee&&ee.x+ee.width<=H.x})});return Er(k,_,()=>Y1(R.id)&&[...Sp()].every(z=>O.has(z))&&I(),ns,!0)};for(const b of v){if(!Sc(b.flow.id))continue;const _=f(b.flow.id);if(((uS=_==null?void 0:_.waypoints)==null?void 0:uS.length)!==2)continue;const R=f(b.flow.source),O=f(b.flow.target);if(!R||!O||R.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!Jr(b.flow.source)||!Jr(b.flow.target)||Math.abs(Sr(R)-Sr(O))>P3)continue;const L=Sr(R),k=_.waypoints.map(se=>se.y),[$,I]=[Math.min(...k),Math.max(...k)],B=Hn(ze(r)).filter(se=>se.id!==R.id&&se.id!==O.id&&se.x<L&&L<se.x+se.width&&$<se.y+se.height&&se.y<I);if(!B.length)continue;const z=(pS=P.get(b.flow.source))==null?void 0:pS.node.participant,H=(fS=P.get(b.flow.target))==null?void 0:fS.node.participant;if(!z||!H)continue;const K=new Map;for(const[se,Me,he]of[[b.flow.source,R,z],[b.flow.target,O,H]]){const pe=K.get(he)??[],ge=xr(se,ie=>ie.x>=Me.x).filter(ie=>!pe.some(ue=>ue.id===ie.id));K.set(he,[...pe,...ge])}const ee=new Set([...K.values()].flat().map(se=>se.id)),fe=_p(K,ee,b.flow.id,se=>se===b.flow.source||se===b.flow.target,()=>!1),oe=Math.max(...B.map(se=>se.x+se.width));for(const se of T3){const Me=oe+se-L;if(Me<=0)continue;const he=Qr().bad,pe=Sp();let ge=[],ie=!0;const ue=()=>!Y1(b.flow.id)||ie&&(ge=N3(fe,b.flow,pe),ge.length)?!1:!B3(he,pe);if(Er(fe,Me,ue,ns))break;if(ge.length&&($3(fe,Me,b.flow,pe,ge)||(ie=!1,Er(fe,Me,ue,ns))))break}}{const b=k=>k.y+k.height/2,_=/(Task|Event|Gateway|CallActivity|SubProcess)$/,R=()=>{const k=ze(r),$=new Set(ft(k).flatMap(z=>z.kind==="edge-crosses-shape"?[`${z.edge}|${z.shape}`]:[])),I=k.shapes.filter(z=>!z.container&&_.test(z.type)),B=new Set;for(const z of k.edges){if(z.type!=="bpmn:SequenceFlow"&&z.type!=="bpmn:MessageFlow")continue;const H=new Set(z.endpoints);for(const K of[z.waypoints[0],z.waypoints[z.waypoints.length-1]])for(const ee of I)ee.x-4<=K.x&&K.x<=ee.x+ee.width+4&&ee.y-4<=K.y&&K.y<=ee.y+ee.height+4&&H.add(ee.id);for(const K of I)if(!(H.has(K.id)||$.has(`${z.id}|${K.id}`))){for(let ee=0;ee+1<z.waypoints.length;ee++)if(Dr(z.waypoints[ee],z.waypoints[ee+1],K)<=Og){B.add(`${z.id}|${K.id}`);break}}}return B},O=()=>({...Qr(),grazes:R()}),L=[];for(const k of P.keys()){if(!Jr(k))continue;const $=F.filter(z=>z.flow.target===k);if($.length!==1)continue;const I=f($[0].flow.source),B=f(k);!I||!B||!P.has(I.id)||Math.abs(b(I)-b(B))>1||B.x-(I.x+I.width)<=xe+1||L.push({id:k,pred:I,node:B})}L.sort((k,$)=>k.node.x-$.node.x);for(const{id:k}of L){const $=P.get(k),I=f(k),B=f(F.find(ge=>ge.flow.target===k).flow.source);if(!I||!B)continue;const z=I.x-(B.x+B.width);if(z<=xe+1)continue;const H=d($.node.participant),K=xr(k,ge=>ge.x>=I.x),ee=-(z-xe),fe=(ge,ie)=>ie.bad>ge.bad||ie.crossings>=ge.crossings||ie.straight<ge.straight||[...ie.grazes].some(ue=>!ge.grazes.has(ue)),oe=_p(new Map([[$.node.participant,[...K]]]),new Set(K.map(ge=>ge.id)),"",()=>!1,()=>!1),se=oe.some(ge=>ge.pool!==H)||oe.reduce((ge,ie)=>ge+ie.subtree.length,0)>K.length,Me=O(),he=j1(K,H,ee);if(!he)continue;const pe=O();if(se&&!fe(Me,pe)){he();const ge=es(oe,ee);if(ge){const ie=O();if(!fe(Me,ie)&&ie.bad<=pe.bad&&ie.crossings<=pe.crossings)continue;ge()}j1(K,H,ee);continue}fe(Me,pe)&&he()}}$1(!0);const F3=10,j3=400,H3=b=>[...b.incoming??[],...b.outgoing??[]].filter(_=>_.type==="bpmn:DataInputAssociation"||_.type==="bpmn:DataOutputAssociation").map(_=>_.source===b?_.target:_.source).filter(_=>!!_&&typeof _.y=="number"),z3=r.filter(b=>b.type==="bpmn:DataStoreReference"&&h.has(b.id)),G3=(b,_)=>{const R=b.x+b.width/2,O=b.y+b.height/2;let L;for(const k of z3){if((g(k)??p())!==_||k.y<b.y+b.height)continue;const $=Math.abs(k.x+k.width/2-R);$>j3||$<k.width||!H3(k).some(B=>B.height===b.height&&Math.abs(B.y+B.height/2-O)<=F3&&k.y>=B.y+B.height)||(!L||$<L.dx||$===L.dx&&k.id<L.id)&&(L={dx:$,id:k.id,cy:k.y+k.height/2})}return L==null?void 0:L.cy};for(const b of x){const _=b.associations??[],R=_.map(k=>k.source===b.dataStore.id?k.target:k.source).map(f).find(Boolean),O=R?g(R)??p():p(),L=R?{x:R.x+R.width/2,y:G3(R,O)??R.y+R.height+110}:{x:200,y:St+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:b.dataStore.id,name:b.dataStore.name})},L,O);for(const k of _)N1(b.dataStore.id,k)}for(const b of E){const R=d(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;N1(R,b.association)}let K1=0;const ea=10,X1=40,V3=(b,_)=>{const R=_.map(B=>g(B)).filter(B=>!!B);for(const B of R){const z=ea,H=B.y,K=B.y+B.height,ee=B.x,fe=B.x+B.width;if(Math.abs(b.y-H)<z){const oe=H+z-b.y;b.y+=oe,b.height-=oe}if(Math.abs(b.y+b.height-K)<z&&(b.height=K-z-b.y),Math.abs(b.x-ee)<z){const oe=ee+z-b.x;b.x+=oe,b.width-=oe}Math.abs(b.x+b.width-fe)<z&&(b.width=fe-z-b.x)}if(!R.length)return;const O=Math.min(...R.map(B=>B.y)),L=Math.max(...R.map(B=>B.y+B.height)),k=O-b.y,$=b.y+b.height-L,I=X1-ea;if(k>0!=$>0)if(k>0&&k<I){const B=k+ea;b.y+=B,b.height-=B}else $>0&&$<I&&(b.height-=$+ea)},W3=(b,_)=>{const R=ea,O=30,L=r.filter(k=>k.type==="bpmn:Group"&&k.id!==_);for(const k of L){const $=k.x,I=k.x+k.width,B=k.y,z=k.y+k.height,H=b.y<z&&B<b.y+b.height,K=b.x<I&&$<b.x+b.width;if(H){if(Math.abs(b.x-I)<R){const ee=Math.min(I+R-b.x,O);ee>0&&b.width-ee>0&&(b.x+=ee,b.width-=ee)}if(Math.abs(b.x+b.width-$)<R){const ee=Math.min(b.x+b.width-($-R),O);ee>0&&b.width-ee>0&&(b.width-=ee)}}if(K){if(Math.abs(b.y-z)<R){const ee=Math.min(z+R-b.y,O);ee>0&&b.height-ee>0&&(b.y+=ee,b.height-=ee)}if(Math.abs(b.y+b.height-B)<R){const ee=Math.min(b.y+b.height-(B-R),O);ee>0&&b.height-ee>0&&(b.height-=ee)}}}},Hg=(b,_)=>{const R=X1,O=Math.min(...b.map(B=>B.x))-R,L=Math.min(...b.map(B=>B.y))-R,k=Math.max(...b.map(B=>B.x+B.width))+R,$=Math.max(...b.map(B=>B.y+B.height))+R,I={x:O,y:L,width:k-O,height:$-L};return V3(I,b),W3(I,_),I};for(const b of D){const _=(b.group.members??[]).map(f).filter(L=>!!L);let R;_.length?R=Hg(_,b.group.id):(R={x:300+K1*350,y:40,width:300,height:200},K1++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:R.width,height:R.height},{x:R.x+R.width/2,y:R.y+R.height/2},p());b.group.name&&n.updateLabel(O,b.group.name),(dS=b.group.members)!=null&&dS.length&&re(O,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=r.filter(L=>!!L.waypoints),_=new Map,R=(L,k)=>{!L||!k||(_.has(L)||_.set(L,new Set),_.get(L).add(k))};for(const L of b){const k=(hS=L.source)==null?void 0:hS.id,$=(gS=L.target)==null?void 0:gS.id;R(k,$),((mS=L.type)!=null&&mS.includes("DataOutputAssociation")||(yS=L.type)!=null&&yS.includes("DataInputAssociation")||L.type==="bpmn:Association")&&R($,k)}const O=r.filter(L=>L.type==="bpmn:Group");for(const L of O){const $=(((vS=L.businessObject.extensionElements)==null?void 0:vS.values)??[]).find(he=>he.$type==="bwl:Members"),I=(($==null?void 0:$.refs)??"").split(" ").filter(Boolean);if(!I.length)continue;const B=new Set(I),z=[...I];for(;z.length;){const he=z.shift();for(const pe of _.get(he)??[])B.has(pe)||(B.add(pe),z.push(pe))}const H=L.x,K=L.x+L.width,ee=L.y,fe=L.y+L.height,oe=he=>F.filter(pe=>pe.flow.target===he).length,se=he=>{var ge;const pe=((ge=f(he))==null?void 0:ge.type)??"";if(pe==="bpmn:StartEvent"&&oe(he)===0)return!1;if(pe.endsWith("Gateway")){const ie=F.filter(ue=>ue.flow.target===he).map(ue=>ue.flow.source);if(ie.length&&ie.every(ue=>{var ke;return((ke=f(ue))==null?void 0:ke.type)==="bpmn:StartEvent"&&oe(ue)===0}))return!1}return!0},Me=r.filter(he=>Ni(he)).filter(he=>he.type!=="bpmn:Group"&&he.type!=="bpmn:Participant"&&he.type!=="bpmn:TextAnnotation"&&!B.has(he.id)&&Jr(he.id)&&se(he.id)&&he.x<K&&he.x+he.width>H&&he.y<fe&&he.y+he.height>ee);if(Me.length)for(const he of[-1,1]){const pe=Me.filter(Fe=>(Fe.x+Fe.width-H<=K-Fe.x?-1:1)===he);if(!pe.length)continue;const ge=[];for(const Fe of pe){const _e=ge.find(Re=>Re.some(te=>Fe.y<te.y+te.height&&Fe.y+Fe.height>te.y));_e?_e.push(Fe):ge.push([Fe])}const ie=new Map;for(const Fe of ge){let _e=he<0?H-ea:K+ea;for(const Re of[...Fe].sort((te,Ce)=>he<0?Ce.x-te.x:te.x-Ce.x)){const te=he<0?Math.min(Re.x,_e-Re.width):Math.max(Re.x,_e);_e=he<0?te-Bi:te+Re.width+Bi,te!==Re.x&&Math.sign(te-Re.x)===he&&ie.set(Re.id,te-Re.x)}}const ue=new Map,ke=Fe=>ue.get(Fe)===Fe||!ue.get(Fe)?Fe:ke(ue.get(Fe));for(const Fe of pe)ue.set(Fe.id,Fe.id);for(const Fe of v){const _e=ie.has(Fe.flow.source)?Fe.flow.source:void 0,Re=ie.has(Fe.flow.target)?Fe.flow.target:void 0;if(!_e||!Re)continue;const te=f(Fe.flow.id);((bS=te==null?void 0:te.waypoints)==null?void 0:bS.length)===2&&ue.set(ke(_e),ke(Re))}const Qe=new Map;for(const Fe of pe){if(!ie.has(Fe.id))continue;const _e=ke(Fe.id);Qe.set(_e,[...Qe.get(_e)??[],Fe])}const Mt=[...Qe.values()].sort((Fe,_e)=>he<0?Math.min(...Fe.map(Re=>Re.x))-Math.min(..._e.map(Re=>Re.x)):Math.max(..._e.map(Re=>Re.x))-Math.max(...Fe.map(Re=>Re.x))),et=[];let st=!0;for(const Fe of Mt){const _e=Fe.map(Ce=>ie.get(Ce.id)??0).reduce((Ce,qe)=>Math.abs(qe)>Math.abs(Ce)?qe:Ce,0),Re=new Map;let te=!0;for(const Ce of Fe){const qe=g(Ce);if(!qe){te=!1;break}Re.has(qe.id)||Re.set(qe.id,{subtree:[],pool:qe}),Re.get(qe.id).subtree.push(Ce)}te&&Er([...Re.values()],_e,()=>!0,ns)?et.push({shapes:Fe,dx:_e}):st=!1}if(!st)for(const Fe of et.reverse())n.moveElements(Fe.shapes,{x:-Fe.dx,y:0})}}}{const b=new Set([...D.map(_=>_.group.id),...qt(e,"group.update").map(_=>_.id)]);for(const _ of r.filter(R=>R.type==="bpmn:Group")){if(b.has(_.id))continue;const O=(((xS=_.businessObject.extensionElements)==null?void 0:xS.values)??[]).find(I=>I.$type==="bwl:Members"),L=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(f).filter(I=>!!I);!L.length||!L.some(I=>{const B=h.get(I.id);return!B||B.x!==I.x||B.y!==I.y})||!L.some(I=>I.x<_.x||I.y<_.y||I.x+I.width>_.x+_.width||I.y+I.height>_.y+_.height)||n.resizeShape(_,Hg(L,_.id))}}{const _=new Map(Go(ze(r)).map(I=>[I.owner,I.rect])),R=r.filter(I=>!!I.waypoints),O=new Map,L=(I,B)=>{!I||!B||(O.has(I)||O.set(I,new Set),O.get(I).add(B))};for(const I of R){const B=(wS=I.source)==null?void 0:wS.id,z=(_S=I.target)==null?void 0:_S.id;L(B,z),((ES=I.type)!=null&&ES.includes("DataOutputAssociation")||(SS=I.type)!=null&&SS.includes("DataInputAssociation")||I.type==="bpmn:Association")&&L(z,B)}const k=I=>F.filter(B=>B.flow.target===I).length,$=I=>{var z;const B=((z=f(I))==null?void 0:z.type)??"";if(B==="bpmn:StartEvent"&&k(I)===0)return!1;if(B.endsWith("Gateway")){const H=F.filter(K=>K.flow.target===I).map(K=>K.flow.source);if(H.length&&H.every(K=>{var ee;return((ee=f(K))==null?void 0:ee.type)==="bpmn:StartEvent"&&k(K)===0}))return!1}return!0};for(const I of r.filter(B=>B.type==="bpmn:Group")){const z=(((RS=I.businessObject.extensionElements)==null?void 0:RS.values)??[]).find(te=>te.$type==="bwl:Members"),H=((z==null?void 0:z.refs)??"").split(" ").filter(Boolean);if(!H.length)continue;const K=H.map(f).filter(te=>!!te);if(!K.length||!(D.some(te=>te.group.id===I.id)||qt(e,"group.update").some(te=>te.id===I.id)||K.some(te=>{const Ce=h.get(te.id);return!Ce||Ce.x!==te.x||Ce.y!==te.y})))continue;const fe=new Set(H),oe=[...H];for(;oe.length;){const te=oe.shift();for(const Ce of O.get(te)??[])fe.has(Ce)||(fe.add(Ce),oe.push(Ce))}const se=I.x,Me=I.x+I.width,he=I.y,pe=I.y+I.height,ge=te=>{const Ce=_.get(te.id),qe={x:te.x,y:te.y,width:te.width,height:te.height};return Ce?[qe,{x:Ce.x,y:Ce.y,width:Ce.width,height:Ce.height}]:[qe]},ie=K.flatMap(ge),ue=Math.min(...ie.map(te=>te.x)),ke=Math.max(...ie.map(te=>te.x+te.width)),Qe=Math.min(...ie.map(te=>te.y)),Mt=Math.max(...ie.map(te=>te.y+te.height)),et={L:ue-se,R:Me-ke,T:Qe-he,B:pe-Mt},st=new Set(H),Fe=te=>te.x>=se&&te.x+te.width<=Me&&te.y>=he&&te.y+te.height<=pe,_e=r.filter(te=>Ni(te)).filter(te=>te.type!=="bpmn:Group"&&te.type!=="bpmn:Participant"&&te.type!=="bpmn:TextAnnotation"&&!st.has(te.id)&&(!fe.has(te.id)||!Fe(te))&&$(te.id)&&te.x<Me&&te.x+te.width>se&&te.y<pe&&te.y+te.height>he);if(!_e.length)continue;const Re={L:0,R:0,T:0,B:0};for(const te of _e){const Ce=ge(te),qe=Math.min(...Ce.map(_t=>_t.x)),nt=Math.max(...Ce.map(_t=>_t.x+_t.width)),Be=Math.min(...Ce.map(_t=>_t.y)),lt=Math.max(...Ce.map(_t=>_t.y+_t.height)),bt={L:nt-se,R:Me-qe,T:lt-he,B:pe-Be},Gt=["L","R","T","B"].filter(_t=>bt[_t]<=et[_t]+.001);if(!Gt.length)continue;const Sn=Gt.reduce((_t,Wn)=>bt[Wn]<bt[_t]?Wn:_t,Gt[0]);Re[Sn]=Math.max(Re[Sn],Math.min(bt[Sn]+10,et[Sn]))}!Re.L&&!Re.R&&!Re.T&&!Re.B||n.resizeShape(I,{x:I.x+Re.L,y:I.y+Re.T,width:I.width-Re.L-Re.R,height:I.height-Re.T-Re.B})}}const Z1=b=>{const _=b.waypoints;if(_!=null&&_.length){const O=_[Math.floor((_.length-1)/2)];return{x:O.x,y:O.y,width:0,height:0}}const R=b;return{x:R.x,y:R.y,width:R.width,height:R.height}};let Cc=0;const Q1=12,J1=14,U3=15,q3=300,Y3=b=>{const _=b.split(`
|
|
7
|
+
`),R=Math.max(..._.map(k=>da(k,Q1))),O=Math.max(100,Math.min(q3,Math.ceil(R)+J1)),L=_.reduce((k,$)=>k+Math.max(1,Math.ceil((da($,Q1)+J1)/O)),0);return{width:O,height:Math.max(30,L*U3+10)}};for(const b of A){const _=b.association,R=((CS=b.placement)==null?void 0:CS.anchor)??(_?_.source===b.annotation.id?_.target:_.source:void 0),O=R?f(R):void 0,L=O?Z1(O):void 0,k=Y3(b.annotation.text??"");let $;if(L&&b.placement){const[H,K]=rl[b.placement.side],ee=b.placement.offset??50;$={x:L.x+L.width/2+H*(L.width/2+k.width/2+ee),y:L.y+L.height/2+K*(L.height/2+k.height/2+ee)}}else L?($={x:L.x+L.width/2+180+Cc%3*260,y:L.y-110-Cc%2*95},Cc++):($={x:300+Cc*260,y:60},Cc++);const I=O?g(O)??p():p(),B=I;L&&typeof B.x=="number"&&typeof B.width=="number"&&B.type==="bpmn:Participant"&&($=sl(r,L,k,B,b.placement?{placement:b.placement}:{from:$}));const z=n.createShape({type:"bpmn:TextAnnotation",width:k.width,height:k.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},$,I);if(_){const H=K=>K===b.annotation.id?z:d(K);n.connect(H(_.source),H(_.target),_.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:_.id})}:{type:"bpmn:Association"})}b.placement&&re(z,"bwl:Placement",J(b.placement))}for(const b of qt(e,"association.add")){const _=b.association;n.connect(d(_.source),d(_.target),_.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:_.id})}:{type:"bpmn:Association"})}const K3=(b,_,R,O)=>{const L=b.parent;if(!L)return O;const k=b.x+b.width/2,$=new Set([b.id]);if(!N(L,b,k,O,$))return O;const I=_?_.y+Math.min(_.height/2,U):R?R.y+Ee:void 0;if(I===void 0)return O;const B=Math.floor((O-I)/ae+1e-6);for(let z=1;z<=3;z++){const H=B+z,K=I+H*ae,ee=wc(_==null?void 0:_.id,H);if(!N(L,b,k,K,ee?new Set([...$,...ee]):$))return pi(_==null?void 0:_.id,H,R),K}return O},eS=()=>new Set(r.getAll().filter(b=>b.type!=="label").map(b=>b.id));for(const b of qt(e,"node.update")){let _=d(b.id);if(b.type&&ol(b.type)!==_.type){const R=_.x+_.width/2,O=_.y+_.height/2,L=eS();_=c.replaceElement(_,{type:ol(b.type),...b.eventDefinition?{eventDefinitionType:kc[b.eventDefinition]}:{}});const k=eS(),$=[...L].filter(z=>z!==b.id&&!k.has(z));if($.length)throw new Oy({kind:"type-change-drops-elements",opIndex:e.indexOf(b),id:b.id,type:b.type,dropped:$});const I=Math.round(R-(_.x+_.width/2)),B=Math.round(O-(_.y+_.height/2));if(I!==0||B!==0){n.moveShape(_,{x:I,y:B});for(const z of[..._.incoming??[],..._.outgoing??[]])wp(z)}}if(b.name!==void 0&&n.updateProperties(_,{name:b.name??void 0}),b.lane||b.band!==void 0){b.band!==void 0&&n.updateProperties(_,{"bwl:band":b.band});const R=_.y+_.height/2,O=g(_),L=b.lane?d(b.lane):((O==null?void 0:O.children)??[]).find($=>$.type==="bpmn:Lane"&&R>=$.y&&R<=$.y+$.height);b.band!==void 0&&pi(L==null?void 0:L.id,b.band,O);const k=L?L.y+(b.band===void 0?L.height/2:Math.min(L.height/2,U)+Ht(L.id,b.band)*ae):b.band!==void 0&&O?O.y+Ee+Ht(`pool:${O.id}`,b.band)*ae:void 0;if(k!==void 0){const $=K3(_,L,O,k),I=$===k?k-R:$-(_.y+_.height/2);I!==0&&n.moveElements([_],{x:0,y:I})}}}for(const b of qt(e,"sequenceFlow.update")){const _=d(b.id),R=T.get(b.id);if(R){const O=z=>({x:z.x+z.width/2,y:z.y+z.height/2}),L=d(R.flow.source),k=d(R.flow.target),$=n.connect(L,k,{type:"bpmn:SequenceFlow",businessObject:xp(R.flow)}),I=Lg.get(b.id),B=k.y+k.height/2;I&&k.x>I.exit.x&&Math.abs(B-I.exit.y)>1?n.updateWaypoints($,[I.exit,{x:I.exit.x,y:B},{x:k.x,y:B}]):(n.reconnect($,L,k,[O(L),O(k)]),Math.abs(B-(L.y+L.height/2))>1&&wp($))}else if(b.source!==void 0||b.target!==void 0){const O=_,L=b.source!==void 0?d(b.source):O.source,k=b.target!==void 0?d(b.target):O.target,$=z=>({x:z.x+z.width/2,y:z.y+z.height/2});n.reconnect(O,L,k,[$(L),$(k)]);const I=Lg.get(O.id),B=k.y+k.height/2;if(I&&k.x>I.exit.x&&Math.abs(B-I.exit.y)>1){n.updateWaypoints(O,[I.exit,{x:I.exit.x,y:B},{x:k.x,y:B}]);const z=O.label;if(z&&I.label){const K=Math.abs(I.label.y+z.height/2-I.channelY)<=ae/5&&I.label.x+z.width>I.exit.x,ee=I.exit.x+6,fe=k.x-6-z.width,oe=K?fe>=ee?{x:Math.max(ee,Math.min(I.label.x,fe)),y:I.label.y+(B-I.channelY)}:void 0:I.label;oe&&(oe.x!==z.x||oe.y!==z.y)&&n.moveElements([z],{x:oe.x-z.x,y:oe.y-z.y})}}else Math.abs(B-(L.y+L.height/2))>1&&wp(O)}b.name!==void 0&&n.updateProperties(_,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(_,{name:((MS=b.condition)==null?void 0:MS.label)??void 0})}for(const b of qt(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(d(b.id),{name:b.name??void 0});for(const b of qt(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(d(b.id),{name:b.name??void 0});for(const b of qt(e,"annotation.update")){const _=d(b.id);if(b.text!==void 0&&n.updateProperties(_,{text:b.text}),b.placement===null)re(_,"bwl:Placement",null);else if(b.placement){const R=d(b.placement.anchor),O=Z1(R),L=g(R)??p(),k=typeof L.x=="number"&&typeof L.width=="number"&&L.type==="bpmn:Participant",[$,I]=rl[b.placement.side],B=b.placement.offset??50,z={x:O.x+O.width/2+$*(O.width/2+_.width/2+B),y:O.y+O.height/2+I*(O.height/2+_.height/2+B)},H=k?sl(r,O,{width:_.width,height:_.height},L,{placement:b.placement,selfId:b.id}):z;n.moveElements([_],{x:H.x-(_.x+_.width/2),y:H.y-(_.y+_.height/2)}),re(_,"bwl:Placement",J(b.placement))}}for(const b of qt(e,"group.update")){const _=d(b.id);if(b.name!==void 0&&n.updateLabel(_,b.name??""),b.members){const R=b.members.map(f).filter(O=>!!O);R.length&&n.resizeShape(_,Hg(R,b.id)),re(_,"bwl:Members",{refs:b.members.join(" ")})}}}function Sf(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 XM(e,t,n,i){const{elementRegistry:o}=e,r=e.modeling,a=[...t.incoming??[],...t.outgoing??[]].filter(d=>d.type==="bpmn:Association");if(!a.length)return 0;const s=d=>d.map(g=>g.original?{x:g.x,y:g.y,original:{x:g.original.x,y:g.original.y}}:{x:g.x,y:g.y}),c=(d,g)=>d.length===g.length&&d.every((h,m)=>{var w,y,v,x;return h.x===g[m].x&&h.y===g[m].y&&((w=h.original)==null?void 0:w.x)===((y=g[m].original)==null?void 0:y.x)&&((v=h.original)==null?void 0:v.y)===((x=g[m].original)==null?void 0:x.y)}),l=a.map(d=>s(d.waypoints)),u=new Set(a.map(d=>d.id));r.moveElements([t],{x:n,y:i});const p=ze(o),f=[...mo(p),...ji(p)].filter(([d,g])=>u.has(d)!==u.has(g)).length;return r.moveElements([t],{x:-n,y:-i}),a.forEach((d,g)=>{c(d.waypoints,l[g])||r.updateWaypoints(d,l[g])}),f}function ZM(e,t,n){var u,p;const{elementRegistry:i}=e,o=e.modeling,r=f=>ft(f).filter(d=>!t.has(pt(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=ze(i),c=r(s),l=[...new Set(c.flatMap(Sf))].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 ye=d.x+d.width/2,ae=d.y+d.height/2;h=i.getAll().find(xe=>{if(xe.type!=="bpmn:Participant")return!1;const Ee=xe;return typeof Ee.x=="number"&&typeof Ee.width=="number"&&ye>=Ee.x&&ye<=Ee.x+Ee.width&&ae>=Ee.y&&ae<=Ee.y+Ee.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const w=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(ye=>ye.$type==="bwl:Placement"),y=[...d.incoming??[],...d.outgoing??[]].find(ye=>ye.type==="bpmn:Association"),v=(w!=null&&w.anchor?i.get(w.anchor):void 0)??(y?((p=y.source)==null?void 0:p.id)===f?y.target:y.source:void 0);if(!v)continue;const x=v.waypoints,E=x!=null&&x.length?{x:x[Math.floor((x.length-1)/2)].x,y:x[Math.floor((x.length-1)/2)].y,width:0,height:0}:{x:v.x,y:v.y,width:v.width,height:v.height},A={width:d.width,height:d.height},D={x:d.x+d.width/2,y:d.y+d.height/2},P=w==null?void 0:w.side,T=Ty(i,E,h),j=[];if(P&&P in rl&&j.push(sl(i,E,A,h,{placement:{side:P,offset:(w==null?void 0:w.offset)??null},selfId:f})),T&&!al(D,A,T))for(const ye of YM)j.push(sl(i,E,A,h,{placement:{side:ye,offset:null},selfId:f}));for(const[ye,ae]of[[-1,0],[1,0],[0,-1],[0,1]])for(let xe=1;xe<=qM;xe++)j.push({x:D.x+ye*Py*xe,y:D.y+ae*Py*xe});const F={...s,edges:s.edges.filter(ye=>ye.id!==(y==null?void 0:y.id))},G=r(F),Q=G.filter(ye=>Sf(ye).includes(f)).length;if(!Q)continue;let re,J=!1;for(const ye of j){const ae=ye.x-D.x,xe=ye.y-D.y;if(!ae&&!xe||ye.x-A.width/2<h.x||ye.x+A.width/2>h.x+h.width||ye.y-A.height/2<h.y||ye.y+A.height/2>h.y+h.height||T&&!al(ye,A,T))continue;const Ee={...F,shapes:F.shapes.map(Z=>Z.id===f?{...Z,x:Z.x+ae,y:Z.y+xe}:Z)},U=r(Ee),ce=U.filter(Z=>Sf(Z).includes(f)).length;if(ce>=Q||U.length>G.length)continue;const Y=Math.abs(ae)+Math.abs(xe);if(J||((!re||ce<re.mine||ce===re.mine&&(U.length<re.all||U.length===re.all&&Y<re.dist))&&(re={x:ye.x,y:ye.y,mine:ce,all:U.length,dist:Y}),re.mine===0&&re.all<G.length&&(J=!0)),ce===0&&U.length<G.length&&XM(e,d,ae,xe)===0){re={x:ye.x,y:ye.y,mine:ce,all:U.length,dist:Y};break}}re&&o.moveElements([d],{x:re.x-D.x,y:re.y-D.y})}}const QM=60;function Rf(e,t,n,i){const o=t.x+t.width,r=[],a=c=>{for(const l of c.children??[])l.type==="bpmn:Lane"&&(r.push(l),a(l))};a(t),e.resizeShape(t,{x:t.x,y:t.y,width:n,height:t.height},void 0,i);const s=t.x+n;for(const c of r)Math.abs(c.x+c.width-o)<1&&e.resizeShape(c,{x:c.x,y:c.y,width:s-c.x,height:c.height},void 0,i)}function JM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=w=>ft(w).filter(y=>!t.has(pt(y))),a=w=>w.filter(y=>y.kind==="pool-overlap"),s=new Map(n.shapes.map(w=>[w.id,w])),c=(w,y)=>y.x>=w.x&&y.y>=w.y&&y.x+y.width<=w.x+w.width&&y.y+y.height<=w.y+w.height,l=w=>{if(!s.get(w))return[w];const v=new Set,x=new Set([w]);for(let A=0;A<4;A++){let D=!1;for(const P of n.shapes)P.type!=="bpmn:Group"||v.has(P.id)||[...x].some(T=>{const j=s.get(T);return j&&c(P,j)})&&(v.add(P.id),D=!0);for(const P of n.shapes)P.type!=="bpmn:Participant"||x.has(P.id)||[...v].some(T=>{const j=s.get(T);return j&&c(j,P)})&&(x.add(P.id),D=!0);if(!D)break}const E=n.shapes.filter(A=>!A.parent&&!x.has(A.id)&&!v.has(A.id)&&A.type!=="bpmn:Group"&&A.type!=="bpmn:Participant").filter(A=>[...v].some(D=>{const P=s.get(D);return P&&c(P,A)})).map(A=>A.id);return[...x,...v,...E]},u=r(ze(i)),p=a(u).length;if(!p)return;const f=u.length,d=[];let g=0,h=p,m=f;for(let w=0;w<6;w++){const y=ze(i),v=a(r(y));if(!v.length)break;const x=new Map(y.shapes.map(T=>[T.id,T]));let E=null;for(const T of v){if(T.kind!=="pool-overlap")continue;const[j,F]=T.pools,G=x.get(j),Q=x.get(F);if(!G||!Q)continue;const[re,J]=G.x<=Q.x?[G,Q]:[Q,G];if(T.contained)continue;const ye=s.get(re.id),ae=s.get(J.id),xe=ye&&ae?Math.max(ae.x-(ye.x+ye.width),0):QM,Ee=re.x+re.width+xe-J.x;if(Ee<=0)continue;const U=l(J.id).filter(ce=>i.get(ce));U.length&&(!E||Ee>E.dx)&&(E={movers:U,dx:Ee})}if(!E)break;const A=E.movers.map(T=>i.get(T)).filter(T=>!!T&&typeof T.x=="number");if(!A.length)break;o.moveElements(A,{x:E.dx,y:0}),d.push({els:A,dx:E.dx});const D=r(ze(i)),P=a(D).length;P<p&&D.length<=f&&(P<h||P===h&&D.length<m||g===0)&&(g=d.length,h=P,m=D.length)}for(const{els:w,dx:y}of d.slice(g).reverse())o.moveElements(w,{x:-y,y:0})}const ys=.5,Iy=150;function eA(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of tA(n))i.length<n.length&&i.some(r=>By(e.elementRegistry.get(r.id)))||nA(e,i)}function tA(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)<=ys?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function By(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 nA(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(y=>y.x+y.width),r=Math.max(...o);if(r-Math.min(...o)>ys)return;const a=t.map(y=>n.get(y.id)).filter(y=>!!y&&typeof y.x=="number");if(a.length<2)return;const s=new Map(t.map(y=>[y.id,y.x]));if(a.some(y=>Math.abs(y.x-s.get(y.id))>ys))return;const c=a.map(y=>y.x+y.width);if(Math.max(...c)-Math.min(...c)<=ys)return;const l=y=>y.x+y.width,u=y=>!!y&&typeof y.width=="number",p=y=>{const v={shapes:[],edges:[],lanes:[]},x=E=>{for(const A of E.children??[]){if("waypoints"in A&&A.waypoints){v.edges.push(A);continue}A.type!=="label"&&(A.type==="bpmn:Lane"?v.lanes.push(A):v.shapes.push(A),x(A))}};return x(y),v},f=new Map(a.map(y=>[y.id,p(y)]));let d=r;for(const y of a){const{shapes:v}=f.get(y.id),x=v.flatMap(E=>[l(E),...u(E.label)?[l(E.label)]:[]]);x.length&&(d=Math.max(d,Math.max(...x)+Iy))}const g=a.filter(y=>Math.abs(l(y)-d)>ys);if(!g.length)return;for(const y of g){const v=l(y),{shapes:x,edges:E,lanes:A}=f.get(y.id);if([...x.flatMap(T=>[l(T),...u(T.label)?[l(T.label)]:[]]),...E.flatMap(T=>[...T.waypoints.map(j=>j.x),...u(T.label)?[l(T.label)]:[]])].some(T=>T>d)||[...(y.incoming??[]).map(T=>T.waypoints[T.waypoints.length-1]),...(y.outgoing??[]).map(T=>T.waypoints[0])].some(T=>!T||T.x>d||Math.abs(T.x-v)<1))return;if(d>v){const T={x:v,y:y.y,width:d-v,height:y.height},j=new Set([y.id,...x.map(G=>G.id),...E.map(G=>G.id),...A.map(G=>G.id)]);if(n.getAll().some(G=>{var J;if("waypoints"in G&&G.waypoints||G.type==="bpmn:Group"||!u(G))return!1;const Q=G.type==="label"?(J=G.labelTarget)==null?void 0:J.id:G.id;if(!Q||j.has(Q)||j.has(G.id))return!1;const re=G;return re.x<T.x+T.width&&re.x+re.width>T.x&&re.y<T.y+T.height&&re.y+re.height>T.y}))return}}const h=()=>new Set(ft(ze(n)).map(pt)),m=h(),w=g.map(y=>y.width);for(const y of g)Rf(i,y,d-y.x,{layout:!1});[...h()].every(y=>m.has(y))||g.forEach((y,v)=>Rf(i,y,w[v],{layout:!1}))}function iA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>ft(l).filter(u=>!t.has(pt(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const p=n.shapes.filter(A=>A.id!==l.id&&A.type!=="bpmn:Group"&&a(l,A));if(!p.length)continue;const f=p.map(A=>i.get(A.id)).filter(A=>!!A&&typeof A.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),w=g.r+(l.x+l.width-d.r),y=g.b+(l.y+l.height-d.b),v={x:h,y:m,width:w-h,height:y-m};if(v.width<=0||v.height<=0||Math.abs(v.x-u.x)<1&&Math.abs(v.y-u.y)<1&&Math.abs(v.width-u.width)<1&&Math.abs(v.height-u.height)<1)continue;const x=r(ze(i)).length,E={x:u.x,y:u.y,width:u.width,height:u.height};o.resizeShape(u,v),r(ze(i)).length>x&&o.resizeShape(u,E)}}const cl=20,ll=10;function oA(e,t,n,i){var p,f;const{elementRegistry:o}=e,r=e.modeling,a=d=>new Set(ft(d,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(pt)),s=ze(o),c=ft(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(pt(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,g]of u){const h=s.shapes.find(Ie=>Ie.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 y=h.members.map(Ie=>o.get(Ie)).filter(Ie=>!!Ie&&typeof Ie.x=="number");if(!y.length)continue;const v=Math.min(...y.map(Ie=>Ie.x)),x=Math.min(...y.map(Ie=>Ie.y)),E=Math.max(...y.map(Ie=>Ie.x+Ie.width)),A=Math.max(...y.map(Ie=>Ie.y+Ie.height)),D=h.x,P=h.y,T=h.x+h.width,j=h.y+h.height;let F=D,G=P,Q=T,re=j;for(const Ie of g){const N=s.edges.find(S=>S.id===Ie.edge);if(!N)continue;const C=N.endpoints.some(S=>{const V=s.shapes.find(Te=>Te.id===S);if(!V||V.container)return!1;const X=V.x+V.width/2,le=V.y+V.height/2;return D<X&&X<T&&P<le&&le<j});for(const S of sn(N)){const V=S.axis==="v"?[P,j]:[D,T];Math.min(S.hi,V[1])-Math.max(S.lo,V[0])<nf||(S.axis==="v"?D<S.at&&S.at<T:P<S.at&&S.at<j)&&C||(S.axis==="v"?(Math.abs(S.at-D)<=ha&&(F=Math.max(F,S.at+cl)),Math.abs(S.at-T)<=ha&&(Q=Math.min(Q,S.at-cl))):(Math.abs(S.at-P)<=ha&&(G=Math.max(G,S.at+cl)),Math.abs(S.at-j)<=ha&&(re=Math.min(re,S.at-cl))))}}if(F>v-ll&&(F=D),G>x-ll&&(G=P),Q<E+ll&&(Q=T),re<A+ll&&(re=j),F===D&&G===P&&Q===T&&re===j)continue;const J=o.get(d),ye={x:J.x,y:J.y,width:J.width,height:J.height},ae=ze(o),xe=new Set(ft(ae).map(pt)),Ee=a(ae);r.resizeShape(J,{x:F,y:G,width:Q-F,height:re-G});let U=ze(o),ce=ft(U).filter(Ie=>!xe.has(pt(Ie)));const Y=[];if(ce.length>0&&ce.every(Ie=>Ie.kind==="label-over-line"&&!i.has(Ie.edge)&&U.edges.some(N=>N.id===Ie.edge))){for(const Ie of ce){if(Ie.kind!=="label-over-line")continue;const N=U.edges.find(le=>le.id===Ie.edge),C=N&&wf(N,U),S=(f=o.get(Ie.edge))==null?void 0:f.label;if(!C||!S)continue;const V=C.x-S.x,X=C.y-S.y;r.moveElements([S],{x:V,y:X}),Y.push({label:S,dx:V,dy:X})}U=ze(o),ce=ft(U).filter(Ie=>!xe.has(pt(Ie)))}const de=a(U),Se=[...de].some(Ie=>!Ee.has(Ie));if(ce.length||Se||de.size>=Ee.size){for(const Ie of Y.reverse())r.moveElements([Ie.label],{x:-Ie.dx,y:-Ie.dy});r.resizeShape(J,ye)}}}function rA(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=Ip((o==null?void 0:o.$parent)??o),a=cs(i),s=new Map;for(const l of e.keys()){const u=(c=t.get(l))==null?void 0:c.businessObject;s.set(l,u?{texts:Bp(u,i,r),requests:jp(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 Ny(e,t,n={}){var J,ye;const{i18n:i,lower:o=Ly}=n,r=My(e),a=Vm(r.elementRegistry),s=Cy(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=zM(t,a,i),u=i&&l.writes.size?rA(l.writes,r.elementRegistry,r.canvas,i):void 0,p=ze(r.elementRegistry),f=new Set(ft(p).map(pt)),d=new Set(ft(p,{includeObservationOnly:!0}).map(pt)),g=new Set(ky(l.ops,ae=>{var xe,Ee;return(Ee=(xe=r.elementRegistry.get(ae))==null?void 0:xe.source)==null?void 0:Ee.id}).keys()),h=new Set(p.edges.map(ae=>ae.id).filter(ae=>!g.has(ae))),m=new Set(t.flatMap(ae=>ae.kind==="sequenceFlow.update"&&(ae.source!==void 0||ae.target!==void 0)?[ae.id]:[])),w=()=>new Set(p.edges.filter(ae=>{var Ee;const xe=(Ee=r.elementRegistry.get(ae.id))==null?void 0:Ee.waypoints;return xe?!(xe.length===ae.waypoints.length&&ae.waypoints.every((U,ce)=>Math.round(U.x)===Math.round(xe[ce].x)&&Math.round(U.y)===Math.round(xe[ce].y))):!1}).map(ae=>ae.id)),y=(ae,xe)=>new Set([...ae].filter(Ee=>!xe.has(Ee))),v=new Set(p.shapes.map(ae=>ae.id)),x=mo(p),E=x.length,A=new Set(x.map(([ae,xe])=>`${ae}|${xe}`)),D=ji(p),P=new Set(D.map(([ae,xe])=>`${ae}|${xe}`)),T=new Map;for(const ae of r.elementRegistry.filter(xe=>"waypoints"in xe&&!!xe.waypoints))ae.label&&T.set(ae.id,{wps:ae.waypoints.map(xe=>({x:xe.x,y:xe.y})),label:{x:ae.label.x,y:ae.label.y},source:(J=ae.source)==null?void 0:J.id,target:(ye=ae.target)==null?void 0:ye.id});const j=e.get("commandStack");try{Kg(j,()=>{o(l.ops,r);for(const U of(u==null?void 0:u.contexts())??[])j.execute($p,U);JM(r,f,p),eA(r,p),iA(r,f,p),mM(r,p,m),dM(r,h,v),Jm(r,h);const ae=ff(r,f);qm(r,A,h);const xe=w(),Ee=dy(r,f,y(h,xe),xe);oy(r,h),AM(r,h,m),ly(r,f,h),IM(r,f,h),uM(r,P,h),_M(r,h,p),by(r,f,y(h,w())),vy(r,h,new Set([...m,...Ee])),wy(r,v),ZM(r,f,v),ff(r,f,ae),oA(r,d,p,h),_y(r,f),yy(r,T,KM(r))})}catch(ae){return{ok:!1,issues:[ae instanceof Oy?ae.issue:{kind:"lower-failed",message:ae instanceof Error?ae.message:String(ae)}],findings:[],stats:c}}const F=ze(r.elementRegistry),G=ft(F,{includeObservationOnly:!0}).filter(ae=>!d.has(pt(ae))),Q=Lm(F),re=ji(F);return{ok:!0,issues:[],findings:G,stats:{edgeCrossings:{before:E,after:Q.pairs.length,pairs:Q.pairs,solidPairs:Q.solidPairs,dashedPairs:Q.dashedPairs,mixedPairs:Q.mixedPairs,crossPoolMessages:Q.crossPoolMessages},sharedEndpointCrossings:{before:D.length,after:re.length,pairs:re}}}}function aA(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function $y(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Fy(e,t){const n=$y(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function jy(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function sA(e){return typeof e=="string"&&Tp.includes(e)}function Gi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Hy(e,t={}){const n=e.rootElements??[],i=n.find(U=>U.$type==="bpmn:Collaboration"),o=new Map(n.filter(U=>U.$type==="bpmn:Process").map(U=>[U.id,U])),r=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],d=[],g=[],h=[],m=[],w=[],y=[],v=new Map,x=new Set,E=new Set,A=U=>{U&&x.add(U)},D=U=>{x.add(U),E.add(U)},P=U=>{const ce=jy(U,"bwl:Placement");if(!ce)return;const Y=typeof ce.anchor=="string"?ce.anchor:void 0;if(!Y||!sA(ce.side))return;const Z=typeof ce.offset=="number"?ce.offset:void 0;m.push({owner:U.id,anchor:Y,side:ce.side,...Z!==void 0?{offset:Z}:{}})},T=U=>{const ce=jy(U,"bwl:Members"),Y=typeof(ce==null?void 0:ce.refs)=="string"?ce.refs.split(/\s+/).filter(Boolean):[];Y.length&&y.push({owner:U.id,refs:Y})},j=U=>{var ce;for(const Y of U)switch(A(Y.id),Y.$type){case"bpmn:TextAnnotation":D(Y.id),v.set(Y.id,Y),c.push({id:Y.id,text:typeof Y.text=="string"?Y.text:""}),P(Y);break;case"bpmn:Association":g.push({id:Y.id,type:Y.$type,source:Gi(Y.sourceRef),target:Gi(Y.targetRef)});break;case"bpmn:Group":{D(Y.id),v.set(Y.id,Y);const Z=(ce=Y.categoryValueRef)==null?void 0:ce.value;l.push({id:Y.id,...typeof Z=="string"&&Z?{name:Z}:{}}),T(Y);break}default:u.push({id:Y.id,type:Y.$type,reason:"type-outside-mvp"})}},F=U=>{for(const ce of U.flowElements??[])A(ce.id),u.push({id:ce.id,type:ce.$type,reason:"inside-container"}),(ce.flowElements??[]).length&&F(ce);for(const ce of U.artifacts??[])A(ce.id),u.push({id:ce.id,type:ce.$type,reason:"inside-container"})},G=(U,ce)=>{const Y=U.flowElements??[],Z=(U.laneSets??[]).flatMap(Se=>Se.lanes??[]),de=new Map;for(const Se of Z){A(Se.id),v.set(Se.id,Se);for(const Ie of Se.flowNodeRef??[]){const N=Gi(Ie);N&&de.set(N,Se.id)}}for(const Se of Y){if(A(Se.id),v.set(Se.id,Se),Se.$type==="bpmn:SequenceFlow"){f.push({id:Se.id,source:Gi(Se.sourceRef),target:Gi(Se.targetRef),...typeof Se.name=="string"&&Se.name?{name:Se.name}:{}});continue}if(Se.$type==="bpmn:DataStoreReference"){D(Se.id),s.push({id:Se.id,...Se.name?{name:Se.name}:{}});continue}const Ie=aA(Se.$type),N=Ie==="intermediateCatchEvent"?Ap((Se.eventDefinitions??[]).map(X=>X.$type)):void 0;if(!Gg(Ie)||Ie==="intermediateCatchEvent"&&!N){u.push({id:Se.id,type:Se.$type,reason:"type-outside-mvp"});continue}D(Se.id);const C=Ie==="boundaryEvent"?Gi(Se.attachedToRef):void 0;a.push({id:Se.id,type:Ie,...Se.name?{name:Se.name}:{},...ce?{participant:ce}:{},...de.has(Se.id)?{lane:de.get(Se.id)}:{},...C?{attachedTo:C}:{},...N?{eventDefinition:N}:{}}),Ie==="subProcess"&&F(Se);const S=Fy(Se,"bwl:band");S!==void 0&&(p.bands[Se.id]=S);const V=$y(Se,"bwl:afterColumn");typeof V=="string"&&V!==""&&w.push([Se.id,V]);for(const X of Se.dataOutputAssociations??[])A(X.id),h.push({id:X.id,type:X.$type,source:Se.id,target:Gi(X.targetRef)});for(const X of Se.dataInputAssociations??[])A(X.id),h.push({id:X.id,type:X.$type,source:Gi((X.sourceRef??[])[0]),target:Se.id})}j(U.artifacts??[])};if(i){const U=new Set;for(const ce of i.participants??[]){D(ce.id),v.set(ce.id,ce);const Y=Gi(ce.processRef);Y&&U.add(Y);const Z=Y?o.get(Y):void 0,de=((Z==null?void 0:Z.laneSets)??[]).flatMap(C=>C.lanes??[]),Se=de.map(C=>({id:C.id,...C.name?{name:C.name}:{}}));for(const C of Se)D(C.id);const Ie=!Z||(Z.flowElements??[]).length===0&&de.length===0&&(Z.artifacts??[]).length===0;r.push({id:ce.id,...ce.name?{name:ce.name}:{},...Ie?{blackBox:!0}:{},...Se.length?{lanes:Se}:{}});const N=Fy(ce,"bwl:poolOrder");N!==void 0&&(p.poolOrders[ce.id]=N),Z&&G(Z,ce.id)}for(const ce of i.messageFlows??[])A(ce.id),v.set(ce.id,ce),d.push({id:ce.id,source:Gi(ce.sourceRef),target:Gi(ce.targetRef),...typeof ce.name=="string"&&ce.name?{name:ce.name}:{}});j(i.artifacts??[]);for(const[ce,Y]of o)!U.has(ce)&&(Y.flowElements??[]).length>0&&u.push({id:ce,type:Y.$type,reason:"unreachable-process"})}else for(const U of o.values())G(U);const Q=[],re=[],J=[],ye=[],ae=(U,ce)=>!!U&&!!ce&&E.has(U)&&E.has(ce);for(const U of f){if(!ae(U.source,U.target)){u.push({id:U.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}Q.push({id:U.id,source:U.source,target:U.target,...U.name?{name:U.name}:{}}),E.add(U.id)}for(const U of d){if(!ae(U.source,U.target)){u.push({id:U.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}re.push({id:U.id,source:U.source,target:U.target,...U.name?{name:U.name}:{}}),E.add(U.id)}for(const U of h){if(!ae(U.source,U.target)){u.push({id:U.id??"",type:U.type,reason:"endpoint-outside-mvp"});continue}ye.push({...U.id?{id:U.id}:{},source:U.source,target:U.target}),U.id&&E.add(U.id)}for(const U of g){if(!ae(U.source,U.target)){u.push({id:U.id??"",type:U.type,reason:"endpoint-outside-mvp"});continue}J.push({...U.id?{id:U.id}:{},source:U.source,target:U.target})}const xe=new Map(l.map(U=>[U.id,U]));for(const{owner:U,refs:ce}of y){const Y=ce.filter(de=>x.has(de)),Z=xe.get(U);Z&&Y.length&&(Z.members=Y)}for(const U of m)x.has(U.anchor)&&(p.placements[U.owner]={anchor:U.anchor,side:U.side,...U.offset!==void 0?{offset:U.offset}:{}});for(const[U,ce]of w)x.has(ce)&&(p.afterColumns[U]=ce);const Ee={...r.length?{participants:r}:{},nodes:a,sequenceFlows:Q,...re.length?{messageFlows:re}:{},...s.length?{dataStores:s}:{},...ye.length?{dataAssociations:ye}:{},...c.length?{annotations:c}:{},...J.length?{associations:J}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:Ee,hints:p,omitted:u,i18n:cA(Ee,v,e,t.i18n)}:{definition:Ee,hints:p,omitted:u}}function cA(e,t,n,i){const o=Ip(n),r=cs(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=Bp(u,i,o);Object.keys(p).length&&(c[l]=p);for(const f of jp(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 lA(e,t={}){const{definitions:n,warnings:i}=await pa(e);return{...Hy(n,t),warnings:i}}const uA=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Cf(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function pA(e){return Cf(e.processRef)!==void 0}function fA(e){const t=new Set,n=o=>{const r=Cf(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 dA(e){const t=[],n=i=>{for(const o of i.flowElements??[])uA.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 hA(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=fA(e);for(const r of dA(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??[])pA(s)&&hA(r.get(Cf(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 gA(e){const{definitions:t,warnings:n}=await pa(e);return{issues:Mf(t),warnings:n}}const mA=.5,yA=8,vA=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),ba=e=>typeof e=="number"?e:Number(e??NaN),ul=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function bA(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}=${ul(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=>`${ul(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(ul).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function xA(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?[ba(s.x),ba(s.y),ba(s.width),ba(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=ul(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=>[ba(f.x),ba(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 zy(e){const t=xA(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:")&&!vA.has(s)&&n.set(c,{type:s,props:bA(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 Gy(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 Vy(e,t,n={}){const i=n.moveTolerance??mA,o=zy(e),r=zy(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||Gy(p.geometry,u.geometry,i)||Gy(p.label,u.label,n.labelTolerance??yA))&&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 wA(e,t,n={}){const[i,o]=await Promise.all([pa(e),pa(t)]);return{...Vy(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function _A(e){return new Set([...e.added,...e.modified])}function EA(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Wy(e,t,{currentVersion:n,i18n:i}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const o=Ny(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 SA=new Set(["lasso","lasso.selection","hand","hand.move"]),Uy=1e4,RA="bwl-edit-locked",qy=new WeakMap;function CA(e){const t=qy.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",Uy,()=>{var s;if(o)return SA.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"],Uy,()=>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(RA,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 qy.set(e,a),a}const MA=Symbol("bpmn-editor"),Af={geometry:[],semantic:[]};function AA(){const e=we.ref(!1),t=we.ref(!0),n=we.ref(!1),i=we.shallowRef(Af),o=we.shallowRef(void 0),r=we.shallowRef(void 0);let a,s,c;const l=()=>{if(p(),!c){i.value=Af;return}const w=ft(ze(c.get("elementRegistry")),{includeObservationOnly:!0}),y=c.getDefinitions();i.value={geometry:w,semantic:y?Mf(y):[]}};function u(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function p(){const w=u();if(!w||!a){r.value=void 0;return}const y=w.locales(),v={};for(const x of y)v[x]={untranslated:w.untranslatedCount(x),reviewRequested:w.reviewRequestedCount(x)};r.value={designLocale:a.designLocale,locales:y,displayLocale:w.getDisplayLocale()??a.designLocale,counts:v}}function f(){const w=u();w&&(w.configure(a),a&&s&&(s=w.setDisplayLocale(s)))}const d=()=>{e.value=!0,l()};function g(w,y){CA(w).set(!y)}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(w){a=w,f(),p()},setDisplayLocale(w){var v;s=w;const y=(v=u())==null?void 0:v.setDisplayLocale(w);y&&(s=y),p()},setChangeScope(w){o.value=w===void 0?void 0:new Set(w)},requestFocus(w){if(!c)return;const y=c.get("elementRegistry").get(w);y&&(c.get("canvas").scrollToElement(y,180),c.get("selection").select(y))},describeElement(w){const y=c==null?void 0:c.get("elementRegistry").get(w),v=y==null?void 0:y.businessObject;if(!v)return;const x=typeof v.name=="string"&&v.name.trim()!==""?v.name:v.text;return{name:typeof x=="string"&&x.trim()!==""?x.trim():void 0,type:typeof v.$type=="string"?v.$type:""}},attach(w){c&&this.detach(),c=w,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=Af,o.value=void 0,r.value=void 0},setEditable(w){t.value=w,c&&g(c,w)},async applyAgentBatch(w,y){const v=h();n.value=!0;try{const x=await Wy(v,w,{currentVersion:y,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return x.status==="applied"&&(e.value=!1),x}finally{n.value=!1}},async importXml(w){const{warnings:y}=await h().importXML(w);return e.value=!1,o.value=void 0,l(),{warnings:tf(y)}},async saveXml(){const{xml:w}=await h().saveXML({format:!0});return e.value=!1,w??""},undo:()=>{var w;return(w=m())==null?void 0:w.undo()},redo:()=>{var w;return(w=m())==null?void 0:w.redo()},canUndo:()=>{var w;return((w=m())==null?void 0:w.canUndo())??!1},canRedo:()=>{var w;return((w=m())==null?void 0:w.canRedo())??!1}}}const PA=new RegExp("\\p{Script=Hangul}","u"),TA=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,kA=new RegExp("\\p{Script=Han}","u");function pl(e){const t=PA.test(e),n=TA.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:kA.test(e)?"han":"other"}}function Yy(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 Ky(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=Ar(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:$o(a).filter(l=>Cn(l))})}return n}const vs=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function OA(e,t={}){const n=Yy(e),i=Ky(e);let o;const r={},a=[],s=[],c=[];for(const h of i){const m=h.trs.filter(w=>(w.body??"")===h.name).map(Cn);if(m.length){const w=[...m].sort().join("+");r[w]=(r[w]??0)+1,o=o?new Set([...o].filter(y=>m.includes(y))):new Set(m)}else h.trs.some(w=>w.body)?a.push(vs(h)):c.push({e:h,inference:pl(h.name)});for(const w of h.trs){const y=Cn(w),v=w.body??"",x=pl(v);x.locale&&x.locale!==y?s.push({...vs(h),locale:y,script:x.script}):y==="ko"&&x.script==="han"&&h.trs.some(E=>E!==w&&E.body===v)&&s.push({...vs(h),locale:y,script:"han"})}}const l=new Set(c.map(h=>h.inference.locale).filter(Boolean));let u,p;if(n)p="kept";else if(o&&o.size===1)[u,p]=[[...o][0],"matched"];else if(o&&o.size>1){const h=l.size===1?[...l][0]:void 0;h&&o.has(h)?[u,p]=[h,"matched"]:p="ambiguous"}else o?p="mixed":l.size===1?[u,p]=[[...l][0],"script"]:p=l.size>1?"mixed":"no-evidence";u&&t.designLocale&&u!==t.designLocale&&([u,p]=[void 0,"non-design"]);const f=n??u,d=[],g=[];for(const{e:h,inference:m}of c)m.locale?m.locale!==f&&d.push({...vs(h),locale:m.locale}):g.push({...vs(h),script:m.script});return{root:{current:n,proposed:u,reason:p},additions:d,undecided:g,drift:a,matchedBy:r,scriptMismatch:s}}function DA(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!Yy(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(Ky(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=>Cn(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(Mr,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Xy(e){var i;const t=new Set,n=[];for(const o of(e==null?void 0:e.diagrams)??[])for(const r of((i=o==null?void 0:o.plane)==null?void 0:i.planeElement)??[]){const a=r==null?void 0:r.bpmnElement;!(a!=null&&a.id)||t.has(a)||(t.add(a),n.push(a))}return n}const Pf=e=>Cn(e)||void 0,Zy=e=>e.body??"";function Qy(e){const t=new Map;for(const n of Xy(e)){const i=$o(n);i.length&&t.set(n.id,{type:n.$type,cells:i.map(o=>({locale:Pf(o),body:Zy(o)}))})}return t}const Jy=e=>JSON.stringify(e.map(t=>t.body).sort());class LA{constructor(){$n(this,"byId",new Map);$n(this,"byBodies",new Map)}add(t,n,i){for(const[o,r]of i){if(!r.cells.some(s=>s.locale))continue;const a={doc:t,version:n,id:o,state:r};ev(this.byId,o,a),ev(this.byBodies,Jy(r.cells),a)}}sameId(t){return this.byId.get(t)??[]}sameBodies(t){return this.byBodies.get(Jy(t))??[]}}function ev(e,t,n){const i=e.get(t);i?i.push(n):e.set(t,[n])}function IA(e,t,n){var s;const i=new Set(t.cells.filter(c=>c.locale).map(c=>c.body)),o=new Map,r=(c,l)=>(c??[]).filter(u=>!u.locale&&u.body===l).length,a=t.cells.every(c=>!c.locale);for(const c of t.cells){if(c.locale||i.has(c.body)||o.has(c.body))continue;const l=r(t.cells,c.body)-(a?0:n?r((s=n.get(e))==null?void 0:s.cells,c.body):1/0);l>0&&o.set(c.body,l)}return o}function Tf(e,t){return[...t.keys()].every(n=>e.cells.some(i=>i.body===n))&&e.cells.some(n=>n.locale&&t.has(n.body))}function BA(e,t,n){const i=new Set(e.cells.filter(r=>r.locale).map(r=>r.locale)),o={cells:[],stale:[],overflow:!1};for(const[r,a]of n){const s=[...new Set(t.cells.filter(l=>l.body===r&&l.locale).map(l=>l.locale))],c=s.filter(l=>!i.has(l));for(const l of s)i.has(l)&&o.stale.push({body:r,locale:l});c.length>a&&(o.overflow=!0);for(const l of c.slice(0,a))o.cells.push({body:r,locale:l}),i.add(l)}return o}const NA=e=>JSON.stringify([...e.cells].sort((t,n)=>(t.body+t.locale).localeCompare(n.body+n.locale)));function $A(e,t){const n={restores:[],ambiguous:[],stale:[],unresolved:[]},i=Qy(e),o=new Set([...i.values()].flatMap(a=>a.cells.map(s=>s.locale).filter(s=>!!s))),r=a=>!o.size||[...o].some(s=>!a.cells.some(c=>c.locale===s));for(const[a,s]of i){const c=IA(a,s,t.baseline);if(!c.size)continue;const l={id:a,type:s.type},p=[["history",t.index.sameId(a).filter(m=>m.doc===t.doc&&Tf(m.state,c)).sort((m,w)=>w.version-m.version).slice(0,1).map(m=>m.state)],["lineage",t.index.sameId(a).filter(m=>m.doc!==t.doc&&Tf(m.state,c)).map(m=>m.state)],["bodies",t.index.sameBodies(s.cells).filter(m=>!(m.doc===t.doc&&m.id===a)&&Tf(m.state,c)).map(m=>m.state)]].find(([,m])=>m.length);if(!p){if(!r(s))continue;for(const[m,w]of c)for(let y=0;y<w;y++)n.unresolved.push({...l,body:m,script:pl(m).script});continue}const[f,d]=p,g=d.map(m=>BA(s,m,c));if(g.some(m=>m.overflow)||new Set(g.map(NA)).size>1){n.ambiguous.push({...l,source:f});continue}const[h]=g;for(const m of h.stale)n.stale.push({...l,...m});h.cells.length&&n.restores.push({...l,source:f,cells:h.cells})}return n}function FA(e,t){if(!t.restores.length)return 0;const n=new Map(Xy(e).map(o=>[o.id,o]));let i=0;for(const o of t.restores){const r=n.get(o.id);if(!r)continue;const a=$o(r),s=new Set(a.map(Pf).filter(Boolean));for(const{body:c,locale:l}of o.cells){if(s.has(l))continue;const u=a.find(p=>!Pf(p)&&Zy(p)===c);u&&(u.set("xml:lang",l),s.add(l),i++)}}return i}function De(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function jA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kf={exports:{}},tv;function HA(){if(tv)return kf.exports;tv=1;var e=kf.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},kf.exports}var zA=HA(),GA=jA(zA);function Zi(e){if(!(this instanceof Zi))return new Zi(e);e=e||[128,36,1],this._seed=e.length?GA.rack(e[0],e[1],e[2]):e}Zi.prototype.next=function(e){return this._seed(e||!0)},Zi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Zi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Zi.prototype.assigned=function(e){return this._seed.get(e)||!1},Zi.prototype.unclaim=function(e){delete this._seed.hats[e]},Zi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const vn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};vn.td=vn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],vn.option=vn.optgroup=[1,'<select multiple="multiple">',"</select>"],vn.thead=vn.tbody=vn.colgroup=vn.caption=vn.tfoot=[1,"<table>","</table>"],vn.polyline=vn.ellipse=vn.polygon=vn.circle=vn.text=vn.line=vn.path=vn.rect=vn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function zt(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:p}=u;return p.remove(),p}let[o,r,a]=Object.hasOwn(vn,i)?vn[i]:vn._default,s=t.createElement("div");for(s.innerHTML=r+e+a;o--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function VA(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 qn(e,...t){const n=e.style;return W(t,function(i){i&&W(i,function(o,r){n[r]=o})}),e}function Mn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const WA=Object.prototype.toString;function kt(e){return new Vo(e)}function Vo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Vo.prototype.add=function(e){return this.list.add(e),this},Vo.prototype.remove=function(e){return WA.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Vo.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},Vo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Vo.prototype.array=function(){return Array.from(this.list)},Vo.prototype.has=Vo.prototype.contains=function(e){return this.list.contains(e)};function fl(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Lr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function UA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var dl={},nv;function qA(){if(nv)return dl;nv=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return dl.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},dl.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},dl}var iv=qA(),YA=UA(iv),je=VA({__proto__:null,default:YA},[iv]),ov=["focus","blur"];function KA(e,t,n,i,o){return ov.indexOf(n)!==-1&&(o=!0),je.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=Lr(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function XA(e,t,n,i){return ov.indexOf(t)!==-1&&(i=!0),je.unbind(e,t,n,i)}var ii={bind:KA,unbind:XA};function Of(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function At(e,t){return t=t||document,t.querySelector(e)}function bs(e,t){return t=t||document,t.querySelectorAll(e)}function Qi(e){e.parentNode&&e.parentNode.removeChild(e)}function ZA(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function QA(e,t){return t.appendChild(ZA(e,t))}function Je(e,t){return QA(t,e),e}var Df=2,rv={"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":Df,"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":Df,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function JA(e,t){return rv[t]?e.style[t]:e.getAttributeNS(null,t)}function av(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=rv[i];o?(o===Df&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function eP(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)av(e,o,t[o])}function Pe(e,t,n){if(typeof t=="string")if(n!==void 0)av(e,t,n);else return JA(e,t);else eP(e,t);return e}const tP=Object.prototype.toString;function dt(e){return new Wo(e)}function Wo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Wo.prototype.add=function(e){return this.list.add(e),this},Wo.prototype.remove=function(e){return tP.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Wo.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},Wo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Wo.prototype.array=function(){return Array.from(this.list)},Wo.prototype.has=Wo.prototype.contains=function(e){return this.list.contains(e)};function xs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Lf(e){return e.cloneNode(!0)}var If={svg:"http://www.w3.org/2000/svg"},sv='<svg xmlns="'+If.svg+'"';function nP(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(If.svg)===-1&&(e=sv+e.substring(4)):(e=sv+">"+e+"</svg>",t=!0);var n=iP(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function iP(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Ne(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=nP(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(If.svg,e),t&&Pe(n,t),n}var Bf=null;function cv(){return Bf===null&&(Bf=Ne("svg")),Bf}function lv(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function oP(e,t,n,i,o,r){var a=cv().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return lv(a,e);case 6:return lv(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function ws(e){return cv().createSVGTransform()}var uv=/([&<>]{1})/g,rP=/([&<>\n\r"]{1})/g,aP={"&":"&","<":"<",">":">",'"':"'"};function Nf(e,t){function n(i,o){return aP[o]||o}return e.replace(t,n)}function pv(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(Nf(e.textContent,uv));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,'="',Nf(r.value,rP),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)pv(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Nf(e.nodeValue,uv),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function sP(e){for(var t=e.firstChild,n=[];t;)pv(t,n),t=t.nextSibling;return n.join("")}function fv(e,t){return sP(e)}function cn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function cP(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function lP(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(cP(e,i))}function _s(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),lP(n,t)),n.consolidate()}const uP=/^class[ {]/;function pP(e){return uP.test(e.toString())}function $f(e){return Array.isArray(e)}function Ff(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function hl(...e){e.length===1&&$f(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const fP=/constructor\s*[^(]*\(\s*([^)]*)\)/m,dP=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,hP=/\/\*([^*]*)\*\//m;function gP(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(pP(e)?fP:dP);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(hP);return(o&&o[1]||i).trim()})||[]}function dv(e,t){const n=t||{get:function(v,x){if(i.push(v),x===!1)return null;throw s(`No provider for "${v}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),a=r.injector=this,s=function(v){const x=i.join(" -> ");return i.length=0,new Error(x?`${v} (Resolving: ${x})`:v)};function c(v,x){if(!o[v]&&v.includes(".")){const E=v.split(".");let A=c(E.shift());for(;E.length;)A=A[E.shift()];return A}if(Ff(r,v))return r[v];if(Ff(o,v)){if(i.indexOf(v)!==-1)throw i.push(v),s("Cannot resolve circular dependency!");return i.push(v),r[v]=o[v][0](o[v][1]),i.pop(),r[v]}return n.get(v,x)}function l(v,x){if(typeof x>"u"&&(x={}),typeof v!="function")if($f(v))v=hl(v.slice());else throw s(`Cannot invoke "${v}". Expected a function!`);const A=(v.$inject||gP(v)).map(D=>Ff(x,D)?x[D]:c(D));return{fn:v,dependencies:A}}function u(v){const{fn:x,dependencies:E}=l(v),A=Function.prototype.bind.call(x,null,...E);return new A}function p(v,x,E){const{fn:A,dependencies:D}=l(v,E);return A.apply(x,D)}function f(v){return hl(x=>v.get(x))}function d(v,x){if(x&&x.length){const E=Object.create(null),A=Object.create(null),D=[],P=[],T=[];let j,F,G,Q;for(let re in o)j=o[re],x.indexOf(re)!==-1&&(j[2]==="private"?(F=D.indexOf(j[3]),F===-1?(G=j[3].createChild([],x),Q=f(G),D.push(j[3]),P.push(G),T.push(Q),E[re]=[Q,re,"private",G]):E[re]=[T[F],re,"private",P[F]]):E[re]=[j[2],j[1]],A[re]=!0),(j[2]==="factory"||j[2]==="type")&&j[1].$scope&&x.forEach(J=>{j[1].$scope.indexOf(J)!==-1&&(E[re]=[j[2],j[1]],A[J]=!0)});x.forEach(re=>{if(!A[re])throw new Error('No provider for "'+re+'". Cannot use provider from the parent!')}),v.unshift(E)}return new dv(v,a)}const g={factory:p,type:u,value:function(v){return v}};function h(v,x){const E=v.__init__||[];return function(){E.forEach(A=>{typeof A=="string"?x.get(A):x.invoke(A)})}}function m(v){const x=v.__exports__;if(x){const E=v.__modules__,A=Object.keys(v).reduce((F,G)=>(G!=="__exports__"&&G!=="__modules__"&&G!=="__init__"&&G!=="__depends__"&&(F[G]=v[G]),F),Object.create(null)),D=(E||[]).concat(A),P=d(D),T=hl(function(F){return P.get(F)});x.forEach(function(F){o[F]=[T,F,"private",P]});const j=(v.__init__||[]).slice();return j.unshift(function(){P.init()}),v=Object.assign({},v,{__init__:j}),h(v,P)}return Object.keys(v).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const A=v[E];if(A[2]==="private"){o[E]=A;return}const D=A[0],P=A[1];o[E]=[g[D],mP(D,P),D]}),h(v,a)}function w(v,x){return v.indexOf(x)!==-1||(v=(x.__depends__||[]).reduce(w,v),v.indexOf(x)!==-1)?v:v.concat(x)}function y(v){const x=v.reduce(w,[]).map(m);let E=!1;return function(){E||(E=!0,x.forEach(A=>A()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=y(e)}function mP(e,t){return e!=="value"&&$f(t)&&(t=hl(t.slice())),t}var yP=1e3;function vo(e,t){var n=this;t=t||yP,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)})}vo.prototype.canRender=function(e){},vo.prototype.drawShape=function(e,t){},vo.prototype.drawConnection=function(e,t){},vo.prototype.getShapePath=function(e){},vo.prototype.getConnectionPath=function(e){};function Ir(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function vP(e){return["M",e.x,e.y]}function jf(e){return["L",e.x,e.y]}function bP(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function xP(e,t){const n=e.length,i=[vP(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(jf(a));continue}const c=Math.min(t,Hf(a.x-r.x,a.y-r.y),Hf(s.x-a.x,s.y-a.y));if(!c){i.push(jf(a));continue}const l=gl(a,r,c),u=gl(a,r,c*.5),p=gl(a,s,c),f=gl(a,s,c*.5);i.push(jf(l)),i.push(bP(u,f,p))}return i}function gl(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=Hf(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function Hf(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Es(e,t,n){Ke(t)&&(n=t,t=null),t||(t={});const i=Ne("path",t);return Ke(n)&&(i.dataset.cornerRadius=String(n)),zf(i,e)}function zf(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Pe(e,{d:Ir(xP(t,n))}),e}function ml(e){var t=new Set(e);return ct(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Br(e,t,n){n=n||0,Ye(e)||(e=[e]),W(e,function(i,o){var r=t(i,o,n);Ye(r)&&r.length&&Br(r,t,n+1)})}function Gf(e,t,n){var i=new Set,o=new Set;return Br(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 Ss(e,t){return Gf(e)}function wP(e,t,n){Cr(t)&&(t=!0),yn(t)&&(n=t,t=!0),n=n||{};var i=Rs(n.allShapes),o=Rs(n.allConnections),r=Rs(n.enclosedElements),a=Rs(n.enclosedConnections),s=Rs(n.topLevel,t&&sa(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=r[u.id]=u),o[u.id]=u}function l(u){if(r[u.id]=u,u.waypoints)a[u.id]=o[u.id]=u;else return i[u.id]=u,W(u.incoming,c),W(u.outgoing,c),u.children}return Br(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function ln(e,t){t=!!t,Ye(e)||(e=[e]);var n,i,o,r;return W(e,function(a){var s=a;a.waypoints&&!t&&(s=ln(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+p>o||o===void 0)&&(o=c+p),(l+u>r||r===void 0)&&(r=l+u)}),{x:n,y:i,height:r-i,width:o-n}}function xa(e,t){var n={};return W(e,function(i){var o=i;o.waypoints&&(o=ln(o)),!Ke(t.y)&&o.x>t.x&&(n[i.id]=i),!Ke(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(Ke(t.width)&&Ke(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!Ke(t.width)||!Ke(t.height))&&(n[i.id]=i)}),n}function hv(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function gv(e){return!!(e&&e.isFrame)}function Rs(e,t){return q({},e||{},t||{})}var _P=1;function Uo(e,t){vo.call(this,e,_P),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})}De(Uo,vo),Uo.prototype.canRender=function(){return!0},Uo.prototype.drawShape=function(t,n,i){var o=Ne("rect");return Pe(o,{x:0,y:0,width:n.width||0,height:n.height||0}),gv(n)?Pe(o,q({},this.FRAME_STYLE,i||{})):Pe(o,q({},this.SHAPE_STYLE,i||{})),Je(t,o),o},Uo.prototype.drawConnection=function(t,n,i){var o=Es(n.waypoints,q({},this.CONNECTION_STYLE,i||{}));return Je(t,o),o},Uo.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 Ir(a)},Uo.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 Ir(r)},Uo.$inject=["eventBus","styles"];function EP(){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 q(r,{class:n})},this.style=function(n,i){!Ye(n)&&!i&&(i=n,n=[]);var o=ni(n,function(r,a){return q(r,e[a]||{})},{});return i?q(o,i):o},this.computeStyle=function(n,i,o){return Ye(i)||(o=i,i=[]),t.style(i||[],q({},o,n||{}))}}const SP={__init__:["defaultRenderer"],defaultRenderer:["type",Uo],styles:["type",EP]};function on(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function an(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 Vf(e,t){return!e||!t?-1:e.indexOf(t)}function Cs(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Wf(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=Cs(e,t);return Math.abs(o/r)<=i}var RP=2;function bo(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(CP(o,n))return r;return!1}function CP(e,t){const n=t[0];return Bo(t,function(i){return Math.abs(n[e]-i[e])<=RP})}function mv(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 Uf(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var MP=/,?([a-z]),?/gi,yv=parseFloat,un=Math,qo=un.PI,Ji=un.min,eo=un.max,vv=un.pow,Yo=un.abs,AP=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,PP=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,bv=Array.isArray||function(e){return e instanceof Array};function TP(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function kP(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 OP(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 TP(o,i)?(kP(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function DP(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(AP,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(PP,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=Yf,n}function LP(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 IP(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 qf(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 Yf(){return this.join(",").replace(MP,"$1")}function BP(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=Yf,t}function xv(e,t,n,i,o,r,a,s,c){var l=1-c,u=vv(l,3),p=vv(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:yl(g),y:yl(h)}}function wv(e){var t=zP(...e);return qf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Ko(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function NP(e,t){return e=qf(e),t=qf(t),Ko(t,e.x,e.y)||Ko(t,e.x2,e.y)||Ko(t,e.x,e.y2)||Ko(t,e.x2,e.y2)||Ko(e,t.x,t.y)||Ko(e,t.x2,t.y)||Ko(e,t.x,t.y2)||Ko(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 _v(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 Ev(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=_v(h,e,n,o,a),w=_v(h,t,i,r,s),y=m*m+w*w;d+=f[g]*un.sqrt(y)}return l*d}function $P(e,t,n,i,o,r,a,s){if(!(eo(e,n)<Ji(o,a)||Ji(e,n)>eo(o,a)||eo(t,i)<Ji(r,s)||Ji(t,i)>eo(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=yl(c/u),f=yl(l/u),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+Ji(e,n).toFixed(2)||d>+eo(e,n).toFixed(2)||d<+Ji(o,a).toFixed(2)||d>+eo(o,a).toFixed(2)||g<+Ji(t,i).toFixed(2)||g>+eo(t,i).toFixed(2)||g<+Ji(r,s).toFixed(2)||g>+eo(r,s).toFixed(2)))return{x:p,y:f}}}}function yl(e){return Math.round(e*1e11)/1e11}function FP(e,t,n){var i=wv(e),o=wv(t);if(!NP(i,o))return[];var r=Ev(...e),a=Ev(...t),s=Rv(e)?1:~~(r/5)||1,c=Rv(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=xv(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=xv(...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],w=l[d+1],y=u[g],v=u[g+1],x=Yo(w.x-m.x)<.01?"y":"x",E=Yo(v.x-y.x)<.01?"y":"x",A=$P(m.x,m.y,w.x,w.y,y.x,y.y,v.x,v.y),D;if(A){if(D=A.x.toFixed(9)+"#"+A.y.toFixed(9),p[D])continue;p[D]=!0;var P=m.t+Yo((A[x]-m[x])/(w[x]-m[x]))*(w.t-m.t),T=y.t+Yo((A[E]-y[E])/(v[E]-y[E]))*(v.t-y.t);P>=0&&P<=1&&T>=0&&T<=1&&f.push({x:A.x,y:A.y,t1:P,t2:T})}}return f}function Sv(e,t,n){e=Av(e),t=Av(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 w=0,y=t.length;w<y;w++){var v=t[w];if(v[0]=="M")r=l=v[1],a=u=v[2];else{v[0]=="C"?(f=[r,a,...v.slice(1)],r=f[6],a=f[7]):(f=[r,a,r,a,l,u,l,u],r=l,a=u);var x=FP(p,f);{for(var E=0,A=x.length;E<A;E++)x[E].segment1=g,x[E].segment2=w,x[E].bez1=p,x[E].bez2=f;d=d.concat(x)}}}}}return d}function jP(e){return bv(e)&&bv(e[0])}function HP(e){if(LP(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=Yf,t}function Rv(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function vl(e,t,n,i){return[e,t,n,i,n,i]}function Cv(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 Mv(e,t,n,i,o,r,a,s,c,l){var u=qo*120/180,p=qo/180*(+o||0),f=[],d,g=OP(function(N,C,S){var V=N*un.cos(S)-C*un.sin(S),X=N*un.sin(S)+C*un.cos(S);return{x:V,y:X}});if(l)D=l[0],P=l[1],E=l[2],A=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,w=h*h/(n*n)+m*m/(i*i);w>1&&(w=un.sqrt(w),n=w*n,i=w*i);var y=n*n,v=i*i,x=(r==a?-1:1)*un.sqrt(Yo((y*v-y*m*m-v*h*h)/(y*m*m+v*h*h))),E=x*n*m/i+(e+s)/2,A=x*-i*h/n+(t+c)/2,D=un.asin(((t-A)/i).toFixed(9)),P=un.asin(((c-A)/i).toFixed(9));D=e<E?qo-D:D,P=s<E?qo-P:P,D<0&&(D=qo*2+D),P<0&&(P=qo*2+P),a&&D>P&&(D=D-qo*2),!a&&P>D&&(P=P-qo*2)}var T=P-D;if(Yo(T)>u){var j=P,F=s,G=c;P=D+u*(a&&P>D?1:-1),s=E+n*un.cos(P),c=A+i*un.sin(P),f=Mv(s,c,n,i,o,0,a,F,G,[P,j,E,A])}T=P-D;var Q=un.cos(D),re=un.sin(D),J=un.cos(P),ye=un.sin(P),ae=un.tan(T/4),xe=4/3*n*ae,Ee=4/3*i*ae,U=[e,t],ce=[e+xe*re,t-Ee*Q],Y=[s+xe*ye,c-Ee*J],Z=[s,c];if(ce[0]=2*U[0]-ce[0],ce[1]=2*U[1]-ce[1],l)return[ce,Y,Z].concat(f);f=[ce,Y,Z].concat(f).join().split(",");for(var de=[],Se=0,Ie=f.length;Se<Ie;Se++)de[Se]=Se%2?g(f[Se-1],f[Se],p).y:g(f[Se],f[Se+1],p).x;return de}function zP(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,f,d,g,h,m,w,y=0;y<2;++y){if(y==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),Yo(u)<1e-12){if(Yo(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}m=p*p-4*f*u,w=un.sqrt(m),!(m<0)&&(g=(-p+w)/(2*u),0<g&&g<1&&c.push(g),h=(-p-w)/(2*u),0<h&&h<1&&c.push(h))}for(var v=c.length,x=v,E;v--;)d=c[v],E=1-d,l[0][v]=E*E*E*e+3*E*E*d*n+3*E*d*d*o+d*d*d*a,l[1][v]=E*E*E*t+3*E*E*d*i+3*E*d*d*r+d*d*d*s;return l[0][x]=e,l[1][x]=t,l[0][x+1]=a,l[1][x+1]=s,l[0].length=l[1].length=x+2,{x0:Ji(...l[0]),y0:Ji(...l[1]),x1:eo(...l[0]),y1:eo(...l[1])}}function Av(e){if(jP(e)||(e=DP(e)),IP(e))return e;for(var t=BP(HP(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",...Mv(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",...Cv(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",...Cv(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...vl(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...vl(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...vl(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...vl(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=yv(u[p-4])||n.x,n.by=yv(u[p-3])||n.y}return t}function Lt(e){return yn(e)&&ti(e,"waypoints")}function rt(e){return yn(e)&&ti(e,"labelTarget")}function GP(e){return yn(e)&&ra(e.parent)}function Pv(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function xo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ge(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function bl(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function VP(e){return xo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function WP(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=YP(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 Xe(e){return Lt(e)?WP(e):VP(e)}function On(e,t,n){n=n||0,yn(n)||(n={x:n,y:n});var i=Ge(e),o=Ge(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 Ms(e,t,n){var i=UP(e,t);return i.length===1||i.length===2&&Cs(i[0],i[1])<1?xo(i[0]):i.length>1?(i=Yi(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),xo(i[n?0:i.length-1])):null}function UP(e,t){return Sv(e,t)}function qP(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],Cs(n,o)===0||Wf(i,o,n)?e.splice(t,1):t++;return e}function YP(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function xl(e,t){return Math.round(e*t)/t}function Tv(e){return Ke(e)?e+"px":e}function KP(e){for(;e.parent;)e=e.parent;return e}function XP(e){e=q({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),qn(n,{position:"relative",overflow:"hidden",width:Tv(e.width),height:Tv(e.height)}),t.appendChild(n),n}function kv(e,t,n){const i=Ne("g");dt(i).add(t);const o=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const ZP="base",Ov=0,QP=1,JP={shape:["x","y","width","height"],connection:["waypoints"]};function Ze(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||{})}Ze.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Ze.prototype._init=function(e){const t=this._eventBus,n=this._container=XP(e),i=this._svg=Ne("svg");Pe(i,{width:"100%",height:"100%"}),Mn(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,r=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),Je(n,i);const o=this._viewport=kv(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Lp(this._viewboxChanged,300)),this._restoreFocus=Lp(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)},Ze.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},Ze.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Ze.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=hv(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Ze.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Ze.prototype.restoreFocus=function(){this._restoreFocus()},Ze.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Ze.prototype.isFocused=function(){return this._focused},Ze.prototype.getDefaultLayer=function(){return this.getLayer(ZP,Ov)},Ze.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},Ze.prototype._getChildIndex=function(e){return ni(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Ze.prototype._createLayer=function(e,t){typeof t>"u"&&(t=QP);const n=this._getChildIndex(t);return{group:kv(this._viewport,"layer-"+e,n),index:t,visible:!0}},Ze.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},Ze.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(cn(n),t.visible=!1),n},Ze.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],cn(t.group))},Ze.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Ze.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const o=this._findPlaneForRoot(KP(i));if(!o||n&&o.rootElement!==n)return;n=o.rootElement}return n},Ze.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Ze.prototype._findPlaneForRoot=function(e){return $t(this._planes,function(t){return t.rootElement===e})},Ze.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Ze.prototype._resolveElements=function(e){return Ye(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Ze.prototype.getContainer=function(){return this._container},Ze.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(W([i.gfx,i.secondaryGfx],function(o){o&&(n?(e.markers.add(t),dt(o).add(t)):(e.markers.delete(t),dt(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Ze.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Ze.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Ze.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Ze.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Ze.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Ze.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,Ov);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Ze.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},Ze.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},Ze.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)},Ze.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})},Ze.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})},Ze.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=JP[e];if(!Bo(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Ze.prototype._setParent=function(e,t,n){an(t.children,e,n),e.parent=t},Ze.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},Ze.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Ze.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Ze.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),on(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},Ze.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Ze.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Ze.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Ze.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Ze.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Ze.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);_s(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=_s(t),o=a?a.matrix:oP(),s=xl(o.a,1e3),c=xl(-o.e||0,1e3),l=xl(-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},Ze.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=q({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Dv(t,n)}),{x:n.e,y:n.f}},Ze.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=ln(r),s=Ge(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=Ge(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),w=Math.min(0,s.top-f.top);u=g||h,p=m||w}this.scroll({dx:-u*l,dy:-p*l})},Ze.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)}),xl(i.a,1e3)};function Dv(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Ze.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},Ze.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=q(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),Dv(this._viewport,u),u},Ze.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Ze.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}},Ze.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var wa="data-element-id";function mi(e){this._elements={},this._eventBus=e}mi.$inject=["eventBus"],mi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Pe(t,wa,i),n&&Pe(n,wa,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},mi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Pe(i.gfx,wa,""),i.secondaryGfx&&Pe(i.secondaryGfx,wa,""),delete t[n])},mi.prototype.updateId=function(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},mi.prototype.updateGraphics=function(e,t,n){var i=e.id||e,o=this._elements[i];return n?o.secondaryGfx=t:o.gfx=t,t&&Pe(t,wa,i),t},mi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Pe(e,wa);var n=this._elements[t];return n&&n.element},mi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},mi.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var o=n[i],r=t[o],a=r.element,s=r.gfx;if(e(a,s))return a}},mi.prototype.getAll=function(){return this.filter(function(e){return e})},mi.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],o=i.element,r=i.gfx;return e(o,r)})},mi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},mi.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};function eT(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 tT(e){return e.__refs_collection===!0}function nT(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Lv(e,t,n){var i=eT(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 iT(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 _i(e,t){if(!(this instanceof _i))return new _i(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}_i.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?Lv(this,t,e):iT(this,t,e)},_i.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return tT(n)||Lv(this,t,e),n},_i.prototype.ensureBound=function(e,t){nT(e,t)||this.bind(e,t)},_i.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},_i.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Kf=new _i({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Iv=new _i({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Bv=new _i({name:"attachers",collection:!0},{name:"host"}),Nv=new _i({name:"outgoing",collection:!0},{name:"source"}),$v=new _i({name:"incoming",collection:!0},{name:"target"});function _a(){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)}}),Kf.bind(this,"parent"),Iv.bind(this,"labels"),Nv.bind(this,"outgoing"),$v.bind(this,"incoming")}function As(){_a.call(this),Kf.bind(this,"children"),Bv.bind(this,"host"),Bv.bind(this,"attachers")}De(As,_a);function Fv(){_a.call(this),Kf.bind(this,"children")}De(Fv,As);function jv(){As.call(this),Iv.bind(this,"labelTarget")}De(jv,As);function Hv(){_a.call(this),Nv.bind(this,"source"),$v.bind(this,"target")}De(Hv,_a);var oT={connection:Hv,shape:As,label:jv,root:Fv};function rT(e,t){var n=oT[e];if(!n)throw new Error("unknown type: <"+e+">");return q(new n,t)}function aT(e){return e instanceof _a}function wo(){this._uid=12}wo.prototype.createRoot=function(e){return this.create("root",e)},wo.prototype.createLabel=function(e){return this.create("label",e)},wo.prototype.createShape=function(e){return this.create("shape",e)},wo.prototype.createConnection=function(e){return this.create("connection",e)},wo.prototype.create=function(e,t){return t=q({},t||{}),t.id||(t.id=e+"_"+this._uid++),rT(e,t)};var wl="__fn",zv=1e3,sT=Array.prototype.slice;function oi(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}oi.prototype.on=function(e,t,n,i){if(e=Ye(e)?e:[e],_n(t)&&(i=n,n=t,t=zv),!Ke(t))throw new Error("priority must be a number");var o=n;i&&(o=Zn(n,i),o[wl]=n[wl]||n);var r=this;e.forEach(function(a){r._addListener(a,{priority:t,callback:o,next:null})})},oi.prototype.once=function(e,t,n,i){var o=this;if(_n(t)&&(i=n,n=t,t=zv),!Ke(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[wl]=n,this.on(e,t,r)},oi.prototype.off=function(e,t){e=Ye(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},oi.prototype.createEvent=function(e){var t=new Ps;return t.init(e),t},oi.prototype.fire=function(e,t){var n,i,o,r;if(r=sT.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 Ps?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}},oi.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},oi.prototype._destroy=function(){this._listeners={}},oi.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},oi.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=cT(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},oi.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},oi.prototype._getListeners=function(e){return this._listeners[e]},oi.prototype._setListeners=function(e,t){this._listeners[e]=t},oi.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[wl]===t)&&(o?o.next=i:this._setListeners(e,i)),o=n,n=i};function Ps(){}Ps.prototype.stopPropagation=function(){this.cancelBubble=!0},Ps.prototype.preventDefault=function(){this.defaultPrevented=!0},Ps.prototype.init=function(e){q(this,e||{})};function cT(e,t){return e.apply(null,t)}function Xo(e){return e.childNodes[0]}function lT(e){return e.parentNode.childNodes[1]}function _l(e,t,n,i,o){var r=ws();r.setTranslate(t,n);var a=ws();a.setRotate(i||0,0,0);var s=ws();s.setScale(1,1),_s(e,[r,a,s])}function Dn(e,t,n){var i=ws();i.setTranslate(t,n),_s(e,i)}function Gv(e,t){var n=ws();n.setRotate(t,0,0),_s(e,n)}function yi(e,t){this._eventBus=e,this._elementRegistry=t}yi.$inject=["eventBus","elementRegistry"],yi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=lT(t),n||(n=Ne("g"),dt(n).add("djs-children"),Je(t.parentNode,n))):n=t,n},yi.prototype._clear=function(e){var t=Xo(e);return fl(t),t},yi.prototype._createContainer=function(e,t,n,i){var o=Ne("g");dt(o).add("djs-group"),typeof n<"u"?uT(o,t,t.childNodes[n]):Je(t,o);var r=Ne("g");dt(r).add("djs-element"),dt(r).add("djs-"+e),i&&dt(r).add("djs-frame"),Je(o,r);var a=Ne("g");return dt(a).add("djs-visual"),Je(r,a),r},yi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,gv(t))},yi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=ni(e,function(o,r){return r.parent&&(o[r.parent.id]=r.parent),o},{}),W(i,function(o){var r=o.children;if(r){var a=t._getChildrenContainer(o),s=a.firstChild;W(r,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},yi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},yi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},yi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},yi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},yi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Dn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Pe(n,"display","none"):Pe(n,"display","block")}},yi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);cn(t.parentNode)};function uT(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const pT={__depends__:[SP],__init__:["canvas"],canvas:["type",Ze],elementRegistry:["type",mi],elementFactory:["type",wo],eventBus:["type",oi],graphicsFactory:["type",yi]};function fT(e){var t=new dv(e);return t.init(),t}function dT(e){e=e||{};var t={config:["value",e]},n=[t,pT].concat(e.modules||[]);return fT(n)}function Zo(e,t){this._injector=t||dT(e),this.get("eventBus").fire("diagram.init")}Zo.prototype.get=function(e,t){return this._injector.get(e,t)},Zo.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Zo.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Zo.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function zn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Qn(e,t){return e.$instanceOf(t)}function hT(e){return $t(e.rootElements,function(t){return Qn(t,"bpmn:Process")||Qn(t,"bpmn:Collaboration")})}function gT(e){var t={},n=[],i={};function o(Y,Z){return function(de){Y(de,Z)}}function r(Y){t[Y.id]=Y}function a(Y){return t[Y.id]}function s(Y,Z){var de=Y.gfx;if(de)throw new Error(`already rendered ${zn(Y)}`);return e.element(Y,i[Y.id],Z)}function c(Y,Z){return e.root(Y,i[Y.id],Z)}function l(Y,Z){try{var de=i[Y.id]&&s(Y,Z);return r(Y),de}catch(Se){u(Se.message,{element:Y,error:Se}),console.error(`failed to import ${zn(Y)}`,Se)}}function u(Y,Z){e.error(Y,Z)}var p=this.registerDi=function(Z){var de=Z.bpmnElement;de?i[de.id]?u(`multiple DI elements defined for ${zn(de)}`,{element:de}):i[de.id]=Z:u(`no bpmnElement referenced in ${zn(Z)}`,{element:Z})};function f(Y){d(Y.plane)}function d(Y){p(Y),W(Y.planeElement,g)}function g(Y){p(Y)}this.handleDefinitions=function(Z,de){var Se=Z.diagrams;if(de&&Se.indexOf(de)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!de&&Se&&Se.length&&(de=Se[0]),!de)throw new Error("no diagram to display");i={},f(de);var Ie=de.plane;if(!Ie)throw new Error(`no plane for ${zn(de)}`);var N=Ie.bpmnElement;if(!N)if(N=hT(Z),N)u(`correcting missing bpmnElement on ${zn(Ie)} to ${zn(N)}`),Ie.bpmnElement=N,p(Ie);else throw new Error("no process or collaboration to display");var C=c(N,Ie);if(Qn(N,"bpmn:Process")||Qn(N,"bpmn:SubProcess"))m(N,C);else if(Qn(N,"bpmn:Collaboration"))U(N,C),w(Z.rootElements,C);else throw new Error(`unsupported bpmnElement for ${zn(Ie)}: ${zn(N)}`);h(n)};var h=this.handleDeferred=function(){for(var Z;n.length;)Z=n.shift(),Z()};function m(Y,Z){ae(Y,Z),T(Y.ioSpecification,Z),P(Y.artifacts,Z),r(Y)}function w(Y,Z){var de=ct(Y,function(Se){return!a(Se)&&Qn(Se,"bpmn:Process")&&Se.laneSets});de.forEach(o(m,Z))}function y(Y,Z){l(Y,Z)}function v(Y,Z){W(Y,o(y,Z))}function x(Y,Z){l(Y,Z)}function E(Y,Z){l(Y,Z)}function A(Y,Z){l(Y,Z)}function D(Y,Z){l(Y,Z)}function P(Y,Z){W(Y,function(de){Qn(de,"bpmn:Association")?n.push(function(){D(de,Z)}):D(de,Z)})}function T(Y,Z){Y&&(W(Y.dataInputs,o(E,Z)),W(Y.dataOutputs,o(A,Z)))}var j=this.handleSubProcess=function(Z,de){ae(Z,de),P(Z.artifacts,de)};function F(Y,Z){var de=l(Y,Z);Qn(Y,"bpmn:SubProcess")&&j(Y,de||Z),Qn(Y,"bpmn:Activity")&&T(Y.ioSpecification,Z),n.push(function(){W(Y.dataInputAssociations,o(x,Z)),W(Y.dataOutputAssociations,o(x,Z))})}function G(Y,Z){l(Y,Z)}function Q(Y,Z){l(Y,Z)}function re(Y,Z){n.push(function(){var de=l(Y,Z);Y.childLaneSet&&J(Y.childLaneSet,de||Z),ce(Y)})}function J(Y,Z){W(Y.lanes,o(re,Z))}function ye(Y,Z){W(Y,o(J,Z))}function ae(Y,Z){xe(Y.flowElements,Z),Y.laneSets&&ye(Y.laneSets,Z)}function xe(Y,Z){W(Y,function(de){Qn(de,"bpmn:SequenceFlow")?n.push(function(){G(de,Z)}):Qn(de,"bpmn:BoundaryEvent")?n.unshift(function(){F(de,Z)}):Qn(de,"bpmn:FlowNode")?F(de,Z):Qn(de,"bpmn:DataObject")||(Qn(de,"bpmn:DataStoreReference")||Qn(de,"bpmn:DataObjectReference")?Q(de,Z):u(`unrecognized flowElement ${zn(de)} in context ${zn(Z&&Z.businessObject)}`,{element:de,context:Z}))})}function Ee(Y,Z){var de=l(Y,Z),Se=Y.processRef;Se&&m(Se,de||Z)}function U(Y,Z){W(Y.participants,o(Ee,Z)),n.push(function(){v(Y.messageFlows,Z)}),P(Y.artifacts,Z)}function ce(Y){W(Y.flowNodeRef,function(Z){var de=Z.get("lanes");de&&de.push(Y)})}}function mT(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(h,m){return i.add(h,m)},element:function(h,m,w){return i.add(h,m,w)},error:function(h,m){s.push({message:h,context:m})}},f=new gT(p);u=u||l.diagrams&&l.diagrams[0];var d=yT(l,u);if(!d)throw new Error("no diagram to display");W(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 yT(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!M(n,"bpmn:Process")&&!M(n,"bpmn:Collaboration")&&(i=vT(n));var o;M(i,"bpmn:Collaboration")?o=i:o=$t(e.rootElements,function(l){if(M(l,"bpmn:Collaboration"))return $t(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=Fn(o.participants,function(l){return l.processRef}),r.push(o));var a=Vv(r),s=[t],c=[n];return W(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function Vv(e){var t=[];return W(e,function(n){n&&(t.push(n),t=t.concat(Vv(n.flowElements)))}),t}function vT(e){for(var t=e;t;){if(M(t,"bpmn:Process"))return t;t=t.$parent}}var bT='<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>',Wv=bT,Uv={verticalAlign:"middle"},qv={color:"#404040"},xT={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},wT={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},_T={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"},ET='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Wv+'</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>',to;function ST(){to=zt(ET),qn(to,xT),qn(At("svg",to),Uv),qn(At(".backdrop",to),wT),qn(At(".notice",to),_T),qn(At(".link",to),qv,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function RT(){to||(ST(),ii.bind(to,".backdrop","click",function(e){document.body.removeChild(to)})),document.body.appendChild(to)}const El=5,Yv="djs-outline-hidden";function Yt(e){e=q({},MT,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),PT(this._container)}De(Yt,Zo),Yt.prototype.importXML=async function(t,n){const i=this;function o(a){return i.get("eventBus").createEvent(a)}let r=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(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||[]),Sl(s,r),s=CT(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Yt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Yt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw Sl(r,[]),r}if(typeof t=="string"&&(i=AT(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw Sl(r,[]),r}try{this.clear()}catch(r){throw Sl(r,[]),r}const{warnings:o}=await mT(this,n,i);return{warnings:o}},Yt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,o;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,o=(await this._moddle.toXML(n,t)).xml,o=this._emit("saveXML.serialized",{xml:o})||o}catch(a){i=a}const r=i?{error:i}:{xml:o};if(this._emit("saveXML.done",r),i)throw i;return r},Yt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=At(":scope > defs",i._svg),a=fv(o),s=r?"<defs>"+fv(r)+"</defs>":"",c=i.getContainer();kt(c).add(Yv);let l;try{l=o.getBBox()}finally{kt(c).remove(Yv)}const u=l.x-El,p=l.y-El,f=l.width+El*2,d=l.height+El*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}},Yt.prototype._setDefinitions=function(e){this._definitions=e},Yt.prototype.getModules=function(){return this._modules},Yt.prototype.clear=function(){this.getDefinitions()&&Zo.prototype.clear.call(this)},Yt.prototype.destroy=function(){Zo.prototype.destroy.call(this),Qi(this._container)},Yt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Yt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Yt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=At(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Yt.prototype.getDefinitions=function(){return this._definitions},Yt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Yt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),o=n.additionalModules||[],r=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(r,i,o),s=q(Ki(n,["additionalModules"]),{canvas:q({},n.canvas,{container:e}),modules:a});Zo.call(this,s),n&&n.container&&this.attachTo(n.container)},Yt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Yt.prototype._createContainer=function(e){const t=zt('<div class="bjs-container"></div>');return qn(t,{width:qv(e.width),height:qv(e.height),position:e.position}),t},Yt.prototype._createModdle=function(e){const t=q({},this._moddleExtensions,e.moddleExtensions);return new mm(t)},Yt.prototype._modules=[];function wl(e,t){return e.warnings=t,e}function ET(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 ST={width:"100%",height:"100%",position:"relative"};function qv(e){return e+(Ke(e)?"px":"")}function RT(e,t){return t&&$t(e.diagrams,function(n){return n.id===t})||null}function CT(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Gv+"</a>",i=zt(n);qn(At("svg",i),Vv),qn(i,Wv,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),je.bind(i,"click",function(o){_T(),o.preventDefault()})}function _a(e){Yt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}De(_a,Yt),_a.prototype._createModdle=function(e){var t=Yt.prototype._createModdle.call(this,e);return t.ids=new Zi([32,36,1]),t},_a.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 ht(e,t){return M(e,"bpmn:CallActivity")?!1:M(e,"bpmn:SubProcess")?(t=t||yt(e),t&&M(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):M(e,"bpmn:Participant")?!!be(e).processRef:!0}function En(e){if(!(!M(e,"bpmn:Participant")&&!M(e,"bpmn:Lane"))){var t=yt(e).isHorizontal;return t===void 0?!0:t}}function MT(e){return e&&be(e).isInterrupting!==!1}function Gn(e){return e&&!!be(e).triggeredByEvent}function Ea(e,t){var n=be(e).eventDefinitions;return No(n,function(i){return M(i,t)})}function AT(e){return Ea(e,"bpmn:ErrorEventDefinition")}function PT(e){return Ea(e,"bpmn:EscalationEventDefinition")}function TT(e){return Ea(e,"bpmn:CompensateEventDefinition")}var Lr={width:90,height:20},Yv=15;function Qo(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 _l(e){return rt(e.label)}function kT(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=OT(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-=Yv:a+=Yv,{x:a,y:s}}function OT(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 Kf(e){return e.waypoints?kT(e.waypoints):M(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Lr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Lr.height/2}}function DT(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Lr.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=Kf(t),i=Lr),q({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Kv(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 LT(e){var t=e.categoryValueRef;return t&&t.value||""}function vi(e){var t=e.businessObject,n=Kv(t);if(n)return n==="categoryValueRef"?LT(t):t[n]||""}function IT(e,t){var n=e.businessObject,i=Kv(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function BT(e){return rt(e)&&Qo(e.labelTarget)}var Sa=7;function Xv(e){let t=[];return W(e.incoming,n=>{M(n,"bpmn:Association")&&M(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),W(e.outgoing,n=>{M(n,"bpmn:Association")&&M(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function As(e){const t=new Map;return W(zf(e),n=>{W(Xv(n),i=>{t.has(i.annotation)||t.set(i.annotation,{annotation:i.annotation,associations:[]}),t.get(i.annotation).associations.push(i.association)})}),[...t.values()]}var Xf="hsl(225, 10%, 15%)",NT="white";function no(e,t){return No(e.eventDefinitions,function(n){return n.$type===t})}function $T(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function FT(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function ut(e,t,n){var i=yt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||NT}function Oe(e,t,n){var i=yt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Xf}function Ps(e,t,n,i){var o=yt(e),r=o.get("label");return i||r&&r.get("color:color")||t||Oe(e,n)}function Zv(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 Or(o)}function Zf(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 Or(a)}function jT(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 Or(s)}function HT(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 Or(r)}function Ts(e,t={}){return{width:Ei(e,t),height:ri(e,t)}}function Ei(e,t={}){return ti(t,"width")?t.width:e.width}function ri(e,t={}){return ti(t,"height")?t.height:e.height}var zT=new Zi,GT=10,El=3,VT=1.5,Sl=10,WT=4,Ra=.95,UT=1,qT=.25;function Ir(e,t,n,i,o,r,a){vo.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(N){return n.computeStyle(N,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Xf,strokeWidth:2,fill:"white"})}function p(N){return n.computeStyle(N,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Xf,strokeWidth:2})}function f(N,C){var{ref:S={x:0,y:0},scale:V=1,element:K,parentGfx:le=o._svg}=C,Te=Ne("marker",{id:N,viewBox:"0 0 20 20",refX:S.x,refY:S.y,markerWidth:20*V,markerHeight:20*V,orient:"auto"});Je(Te,K);var Ve=At(":scope > defs",le);Ve||(Ve=Ne("defs"),Je(le,Ve)),Je(Ve,Te)}function d(N,C,S,V){var K=zT.nextPrefixed("marker-");return g(N,K,C,S,V),"url(#"+K+")"}function g(N,C,S,V,K){if(S==="sequenceflow-end"){var le=Ne("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:K,stroke:K,strokeWidth:1})});f(C,{element:le,ref:{x:11,y:10},scale:.5,parentGfx:N})}if(S==="messageflow-start"){var Te=Ne("circle",{cx:6,cy:6,r:3.5,...u({fill:V,stroke:K,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Te,ref:{x:6,y:6},parentGfx:N})}if(S==="messageflow-end"){var Ve=Ne("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:V,stroke:K,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Ve,ref:{x:8.5,y:5},parentGfx:N})}if(S==="association-start"){var wt=Ne("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:wt,ref:{x:1,y:10},scale:.5,parentGfx:N})}if(S==="association-end"){var Qt=Ne("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:N})}if(S==="conditional-flow-marker"){var Pt=Ne("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:V,stroke:K})});f(C,{element:Pt,ref:{x:-1,y:10},scale:.5,parentGfx:N})}if(S==="conditional-default-flow-marker"){var Ht=Ne("path",{d:"M 6 4 L 10 16",...u({stroke:K,fill:"none"})});f(C,{element:Ht,ref:{x:0,y:10},scale:.5,parentGfx:N})}}function h(N,C,S,V,K={}){yn(V)&&(K=V,V=0),V=V||0,K=u(K);var le=C/2,Te=S/2,Ve=Ne("circle",{cx:le,cy:Te,r:Math.round((C+S)/4-V),...K});return Je(N,Ve),Ve}function m(N,C,S,V,K,le){yn(K)&&(le=K,K=0),K=K||0,le=u(le);var Te=Ne("rect",{x:K,y:K,width:C-K*2,height:S-K*2,rx:V,ry:V,...le});return Je(N,Te),Te}function w(N,C,S,V){var K=C/2,le=S/2,Te=[{x:K,y:0},{x:C,y:le},{x:K,y:S},{x:0,y:le}],Ve=Te.map(function(Qt){return Qt.x+","+Qt.y}).join(" ");V=u(V);var wt=Ne("polygon",{...V,points:Ve});return Je(N,wt),wt}function y(N,C,S,V){S=p(S);var K=ws(C,S,V);return Je(N,K),K}function v(N,C,S){return y(N,C,S,5)}function x(N,C,S){S=p(S);var V=Ne("path",{...S,d:C});return Je(N,V),V}function E(N,C,S,V){return x(C,S,q({"data-marker":N},V))}function A(N){return Ie[N]}function D(N){return function(C,S,V){return A(N)(C,S,V)}}var P={"bpmn:MessageEventDefinition":function(N,C,S={},V){var K=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.235,my:.315}}),le=V?Oe(C,c,S.stroke):ut(C,s,S.fill),Te=V?ut(C,s,S.fill):Oe(C,c,S.stroke),Ve=x(N,K,{fill:le,stroke:Te,strokeWidth:1});return Ve},"bpmn:TimerEventDefinition":function(N,C,S={}){var V=S.width||C.width,K=S.height||C.height,le=S.width?1:2,Te=h(N,V,K,.2*K,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:le}),Ve=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:V,containerHeight:K,position:{mx:.5,my:.5}});x(N,Ve,{stroke:Oe(C,c,S.stroke),strokeWidth:le});for(var wt=0;wt<12;wt++){var Qt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:V,containerHeight:K,position:{mx:.5,my:.5}}),Pt=V/2,Ht=K/2;x(N,Qt,{strokeWidth:1,stroke:Oe(C,c,S.stroke),transform:"rotate("+wt*30+","+Ht+","+Pt+")"})}return Te},"bpmn:EscalationEventDefinition":function(N,C,S={},V){var K=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.5,my:.2}}),le=V?Oe(C,c,S.stroke):ut(C,s,S.fill);return x(N,K,{fill:le,stroke:Oe(C,c,S.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(N,C,S={}){var V=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.5,my:.222}});return x(N,V,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(N,C,S={},V){var K=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.57,my:.263}}),le=V?Oe(C,c,S.stroke):ut(C,s,S.fill);return x(N,K,{fill:le,stroke:Oe(C,c,S.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(N,C,S={},V){var K=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.2,my:.722}}),le=V?Oe(C,c,S.stroke):ut(C,s,S.fill);return x(N,K,{fill:le,stroke:Oe(C,c,S.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(N,C,S={},V){var K=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.638,my:-.055}}),le=V?Oe(C,c,S.stroke):"none",Te=x(N,K,{fill:le,stroke:Oe(C,c,S.stroke),strokeWidth:1});return Hv(Te,45),Te},"bpmn:CompensateEventDefinition":function(N,C,S={},V){var K=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.22,my:.5}}),le=V?Oe(C,c,S.stroke):ut(C,s,S.fill);return x(N,K,{fill:le,stroke:Oe(C,c,S.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(N,C,S={},V){var K=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.5,my:.2}}),le=V?Oe(C,c,S.stroke):ut(C,s,S.fill);return x(N,K,{strokeWidth:1,fill:le,stroke:Oe(C,c,S.stroke)})},"bpmn:MultipleEventDefinition":function(N,C,S={},V){var K=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.211,my:.36}}),le=V?Oe(C,c,S.stroke):ut(C,s,S.fill);return x(N,K,{fill:le,stroke:Oe(C,c,S.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(N,C,S={}){var V=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.458,my:.194}});return x(N,V,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(N,C,S={}){var V=h(N,C.width,C.height,8,{fill:Oe(C,c,S.stroke),stroke:Oe(C,c,S.stroke),strokeWidth:4});return V}};function T(N,C,S={},V){var K=be(N),le=$T(K),Te=V||N;return K.get("eventDefinitions")&&K.get("eventDefinitions").length>1?K.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](C,Te,S,le):P["bpmn:MultipleEventDefinition"](C,Te,S,le):no(K,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](C,Te,S,le):no(K,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](C,Te,S,le):no(K,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](C,Te,S,le):no(K,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](C,Te,S,le):no(K,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](C,Te,S,le):no(K,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](C,Te,S,le):no(K,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](C,Te,S,le):no(K,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](C,Te,S,le):no(K,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](C,Te,S,le):no(K,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](C,Te,S,le):null}var j={ParticipantMultiplicityMarker:function(N,C,S={}){var V=Ei(C,S),K=ri(C,S),le=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:V,containerHeight:K,position:{mx:(V/2-6)/V,my:(K-15)/K}});E("participant-multiplicity",N,le,{strokeWidth:2,fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke)})},SubProcessMarker:function(N,C,S={}){var V=m(N,14,14,0,{strokeWidth:1,fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke)});Dn(V,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",N,K,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke)})},ParallelMarker:function(N,C,S){var V=Ei(C,S),K=ri(C,S),le=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:V,containerHeight:K,position:{mx:(V/2+S.parallel)/V,my:(K-20)/K}});E("parallel",N,le,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke)})},SequentialMarker:function(N,C,S){var V=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+S.seq)/C.width,my:(C.height-19)/C.height}});E("sequential",N,V,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke)})},CompensationMarker:function(N,C,S){var V=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+S.compensation)/C.width,my:(C.height-13)/C.height}});E("compensation",N,V,{strokeWidth:1,fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke)})},LoopMarker:function(N,C,S){var V=Ei(C,S),K=ri(C,S),le=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:V,containerHeight:K,position:{mx:(V/2+S.loop)/V,my:(K-7)/K}});E("loop",N,le,{strokeWidth:1.5,fill:"none",stroke:Oe(C,c,S.stroke),strokeMiterlimit:.5})},AdhocMarker:function(N,C,S){var V=Ei(C,S),K=ri(C,S),le=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:V,containerHeight:K,position:{mx:(V/2+S.adhoc)/V,my:(K-15)/K}});E("adhoc",N,le,{strokeWidth:1,fill:Oe(C,c,S.stroke),stroke:Oe(C,c,S.stroke)})}};function F(N,C,S,V){j[N](C,S,V)}function G(N,C,S=[],V={}){V={fill:V.fill,stroke:V.stroke,width:Ei(C,V),height:ri(C,V)};var K=be(C),le=S.includes("SubProcessMarker");le?V={...V,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:V={...V,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},K.get("isForCompensation")&&S.push("CompensationMarker"),M(K,"bpmn:AdHocSubProcess")&&(S.push("AdhocMarker"),le||q(V,{compensation:V.compensation-18}));var Te=K.get("loopCharacteristics"),Ve=Te&&Te.get("isSequential");Te&&(q(V,{compensation:V.compensation-18}),S.includes("AdhocMarker")&&q(V,{seq:-23,loop:-18,parallel:-24}),Ve===void 0&&S.push("LoopMarker"),Ve===!1&&S.push("ParallelMarker"),Ve===!0&&S.push("SequentialMarker")),S.includes("CompensationMarker")&&S.length===1&&q(V,{compensation:-8}),W(S,function(wt){F(wt,N,C,V)})}function Z(N,C,S={}){S=q({size:{width:100}},S);var V=r.createText(C||"",S);return dt(V).add("djs-label"),Je(N,V),V}function re(N,C,S,V={}){var K=be(C),le=Ts({x:C.x,y:C.y,width:C.width,height:C.height},V);return Z(N,K.name,{align:S,box:le,padding:7,style:{fill:Ps(C,l,c,V.stroke)}})}function J(N,C,S={}){var V={width:C.width,height:C.height,x:C.width/2+C.x,y:C.height/2+C.y};return Z(N,vi(C),{box:V,style:q({},r.getExternalStyle(),{fill:Ps(C,l,c,S.stroke)})})}function ye(N,C,S,V={}){var K=En(S),le=Z(N,C,{box:{height:30,width:K?ri(S,V):Ei(S,V)},align:"center-middle",style:{fill:Ps(S,l,c,V.stroke)}});if(K){var Te=-1*ri(S,V);bl(le,0,-Te,270)}}function ae(N,C,S={}){var{width:V,height:K}=Ts(C,S);return m(N,V,K,Sl,{...S,fill:ut(C,s,S.fill),fillOpacity:Ra,stroke:Oe(C,c,S.stroke)})}function we(N,C,S={}){var V=be(C),K=ut(C,s,S.fill),le=Oe(C,c,S.stroke);return(V.get("associationDirection")==="One"||V.get("associationDirection")==="Both")&&(S.markerEnd=d(N,"association-end",K,le)),V.get("associationDirection")==="Both"&&(S.markerStart=d(N,"association-start",K,le)),S=vt(S,["markerStart","markerEnd"]),v(N,C.waypoints,{...S,stroke:le,strokeDasharray:"0, 5"})}function Ee(N,C,S={}){var V=ut(C,s,S.fill),K=Oe(C,c,S.stroke),le=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}}),Te=x(N,le,{fill:V,fillOpacity:Ra,stroke:K}),Ve=be(C);if(FT(Ve)){var wt=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}});x(N,wt,{strokeWidth:2,fill:V,stroke:K})}return Te}function U(N,C,S={}){return h(N,C.width,C.height,{fillOpacity:Ra,...S,fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke)})}function ce(N,C,S={}){return w(N,C.width,C.height,{fill:ut(C,s,S.fill),fillOpacity:Ra,stroke:Oe(C,c,S.stroke)})}function Y(N,C,S={}){var V=m(N,Ei(C,S),ri(C,S),0,{fill:ut(C,s,S.fill),fillOpacity:S.fillOpacity||Ra,stroke:Oe(C,c,S.stroke),strokeWidth:1.5}),K=be(C);if(M(K,"bpmn:Lane")){var le=K.get("name");ye(N,le,C,S)}return V}function X(N,C,S={}){var V=ae(N,C,S),K=ht(C);if(Gn(C)&&(Pe(V,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!K)){var le=be(C).flowElements||[],Te=le.filter(Ve=>M(Ve,"bpmn:StartEvent"));Te.length===1&&fe(Te[0],N,S,C)}return re(N,C,K?"center-top":"center-middle",S),K?G(N,C,void 0,S):G(N,C,["SubProcessMarker"],S),V}function fe(N,C,S,V){var K=22,le={fill:ut(V,s,S.fill),stroke:Oe(V,c,S.stroke),width:K,height:K},Te=be(N).isInterrupting,Ve=Te?0:3,wt=Te?1:1.2,Qt=20,Pt=(K-Qt)/2,Ht="translate("+Pt+","+Pt+")";h(C,Qt,Qt,{fill:le.fill,stroke:le.stroke,strokeWidth:wt,strokeDasharray:Ve,transform:Ht}),T(N,C,le,V)}function Se(N,C,S={}){var V=ae(N,C,S);return re(N,C,"center-middle",S),G(N,C,void 0,S),V}var Ie=this.handlers={"bpmn:AdHocSubProcess":function(N,C,S={}){return ht(C)?S=vt(S,["fill","stroke","width","height"]):S=vt(S,["fill","stroke"]),X(N,C,S)},"bpmn:Association":function(N,C,S={}){return S=vt(S,["fill","stroke"]),we(N,C,S)},"bpmn:BoundaryEvent":function(N,C,S={}){var{renderIcon:V=!0}=S;S=vt(S,["fill","stroke"]);var K=be(C),le=K.get("cancelActivity");S={strokeWidth:1.5,fill:ut(C,s,S.fill),fillOpacity:UT,stroke:Oe(C,c,S.stroke)},le||(S.strokeDasharray="6");var Te=U(N,C,S);return h(N,C.width,C.height,El,{...S,fill:"none"}),V&&T(C,N,S),Te},"bpmn:BusinessRuleTask":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=Se(N,C,S),K=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),le=x(N,K);Pe(le,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:1});var Te=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ve=x(N,Te);return Pe(Ve,{fill:Oe(C,c,S.stroke),stroke:Oe(C,c,S.stroke),strokeWidth:1}),V},"bpmn:CallActivity":function(N,C,S={}){return S=vt(S,["fill","stroke"]),X(N,C,{strokeWidth:5,...S})},"bpmn:ComplexGateway":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=ce(N,C,S),K=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.26}});return x(N,K,{fill:Oe(C,c,S.stroke),stroke:Oe(C,c,S.stroke),strokeWidth:1}),V},"bpmn:DataInput":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=i.getRawPath("DATA_ARROW"),K=Ee(N,C,S);return x(N,V,{fill:"none",stroke:Oe(C,c,S.stroke),strokeWidth:1}),K},"bpmn:DataInputAssociation":function(N,C,S={}){return S=vt(S,["fill","stroke"]),we(N,C,{...S,markerEnd:d(N,"association-end",ut(C,s,S.fill),Oe(C,c,S.stroke))})},"bpmn:DataObject":function(N,C,S={}){return S=vt(S,["fill","stroke"]),Ee(N,C,S)},"bpmn:DataObjectReference":D("bpmn:DataObject"),"bpmn:DataOutput":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=i.getRawPath("DATA_ARROW"),K=Ee(N,C,S);return x(N,V,{strokeWidth:1,fill:Oe(C,c,S.stroke),stroke:Oe(C,c,S.stroke)}),K},"bpmn:DataOutputAssociation":function(N,C,S={}){return S=vt(S,["fill","stroke"]),we(N,C,{...S,markerEnd:d(N,"association-end",ut(C,s,S.fill),Oe(C,c,S.stroke))})},"bpmn:DataStoreReference":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:0,my:.133}});return x(N,V,{fill:ut(C,s,S.fill),fillOpacity:Ra,stroke:Oe(C,c,S.stroke),strokeWidth:2})},"bpmn:EndEvent":function(N,C,S={}){var{renderIcon:V=!0}=S;S=vt(S,["fill","stroke"]);var K=U(N,C,{...S,strokeWidth:4});return V&&T(C,N,S),K},"bpmn:EventBasedGateway":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=be(C),K=ce(N,C,S);h(N,C.width,C.height,C.height*.2,{fill:ut(C,"none",S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:1});var le=V.get("eventGatewayType"),Te=!!V.get("instantiate");function Ve(){var Qt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:C.width,containerHeight:C.height,position:{mx:.36,my:.44}});x(N,Qt,{fill:"none",stroke:Oe(C,c,S.stroke),strokeWidth:2})}if(le==="Parallel"){var wt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}});x(N,wt,{fill:"none",stroke:Oe(C,c,S.stroke),strokeWidth:1})}else le==="Exclusive"&&(Te||h(N,C.width,C.height,C.height*.26,{fill:"none",stroke:Oe(C,c,S.stroke),strokeWidth:1}),Ve());return K},"bpmn:ExclusiveGateway":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=ce(N,C,S),K=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.32,my:.3}}),le=yt(C);return le.get("isMarkerVisible")&&x(N,K,{fill:Oe(C,c,S.stroke),stroke:Oe(C,c,S.stroke),strokeWidth:1}),V},"bpmn:Gateway":function(N,C,S={}){return S=vt(S,["fill","stroke"]),ce(N,C,S)},"bpmn:Group":function(N,C,S={}){return S=vt(S,["fill","stroke","width","height"]),m(N,C.width,C.height,Sl,{stroke:Oe(C,c,S.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Ei(C,S),height:ri(C,S)})},"bpmn:InclusiveGateway":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=ce(N,C,S);return h(N,C.width,C.height,C.height*.24,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:2.5}),V},"bpmn:IntermediateEvent":function(N,C,S={}){var{renderIcon:V=!0}=S;S=vt(S,["fill","stroke"]);var K=U(N,C,{...S,strokeWidth:1.5});return h(N,C.width,C.height,El,{fill:"none",stroke:Oe(C,c,S.stroke),strokeWidth:1.5}),V&&T(C,N,S),K},"bpmn:IntermediateCatchEvent":D("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":D("bpmn:IntermediateEvent"),"bpmn:Lane":function(N,C,S={}){return S=vt(S,["fill","stroke","width","height"]),Y(N,C,{...S,fillOpacity:qT})},"bpmn:ManualTask":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=Se(N,C,S),K=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(N,K,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:.5}),V},"bpmn:MessageFlow":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=be(C),K=yt(C),le=ut(C,s,S.fill),Te=Oe(C,c,S.stroke),Ve=v(N,C.waypoints,{markerEnd:d(N,"messageflow-end",le,Te),markerStart:d(N,"messageflow-start",le,Te),stroke:Te,strokeDasharray:"10, 11",strokeWidth:1.5});if(V.get("messageRef")){var wt=Ve.getPointAtLength(Ve.getTotalLength()/2),Qt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:wt.x,y:wt.y}}),Pt={strokeWidth:1};K.get("messageVisibleKind")==="initiating"?(Pt.fill=le,Pt.stroke=Te):(Pt.fill=Te,Pt.stroke=le);var Ht=x(N,Qt,Pt),gn=V.get("messageRef"),Nn=gn.get("name"),Nt=Z(N,Nn,{align:"center-top",fitBox:!0,style:{fill:Te}}),rn=Ht.getBBox(),Vn=Nt.getBBox(),Za=wt.x-Vn.width/2,pi=wt.y+rn.height/2+GT;bl(Nt,Za,pi,0)}return Ve},"bpmn:ParallelGateway":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=ce(N,C,S),K=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.2}});return x(N,K,{fill:Oe(C,c,S.stroke),stroke:Oe(C,c,S.stroke),strokeWidth:1}),V},"bpmn:Participant":function(N,C,S={}){S=vt(S,["fill","stroke","width","height"]);var V=Y(N,C,S),K=ht(C),le=En(C),Te=be(C),Ve=Te.get("name");if(K){var wt=le?[{x:30,y:0},{x:30,y:ri(C,S)}]:[{x:0,y:30},{x:Ei(C,S),y:30}];y(N,wt,{stroke:Oe(C,c,S.stroke),strokeWidth:VT}),ye(N,Ve,C,S)}else{var Qt=Ts(C,S);le||(Qt.height=Ei(C,S),Qt.width=ri(C,S));var Pt=Z(N,Ve,{box:Qt,align:"center-middle",style:{fill:Ps(C,l,c,S.stroke)}});if(!le){var Ht=-1*ri(C,S);bl(Pt,0,-Ht,270)}}return Te.get("participantMultiplicity")&&F("ParticipantMultiplicityMarker",N,C,S),V},"bpmn:ReceiveTask":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=be(C),K=Se(N,C,S),le;return V.get("instantiate")?(h(N,28,28,20*.22,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:1}),le=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):le=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(N,le,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:1}),K},"bpmn:ScriptTask":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=Se(N,C,S),K=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(N,K,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:1}),V},"bpmn:SendTask":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=Se(N,C,S),K=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(N,K,{fill:Oe(C,c,S.stroke),stroke:ut(C,s,S.fill),strokeWidth:1}),V},"bpmn:SequenceFlow":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=ut(C,s,S.fill),K=Oe(C,c,S.stroke),le=v(N,C.waypoints,{markerEnd:d(N,"sequenceflow-end",V,K),stroke:K}),Te=be(C),{source:Ve}=C;if(Ve){var wt=be(Ve);Te.get("conditionExpression")&&M(wt,"bpmn:Activity")&&Pe(le,{markerStart:d(N,"conditional-flow-marker",V,K)}),wt.get("default")&&(M(wt,"bpmn:Gateway")||M(wt,"bpmn:Activity"))&&wt.get("default")===Te&&Pe(le,{markerStart:d(N,"conditional-default-flow-marker",V,K)})}return le},"bpmn:ServiceTask":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=Se(N,C,S);h(N,10,10,{fill:ut(C,s,S.fill),stroke:"none",transform:"translate(6, 6)"});var K=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(N,K,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:1}),h(N,10,10,{fill:ut(C,s,S.fill),stroke:"none",transform:"translate(11, 10)"});var le=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(N,le,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:1}),V},"bpmn:StartEvent":function(N,C,S={}){var{renderIcon:V=!0}=S;S=vt(S,["fill","stroke"]);var K=be(C);K.get("isInterrupting")||(S={...S,strokeDasharray:"6"});var le=U(N,C,S);return V&&T(C,N,S),le},"bpmn:SubProcess":function(N,C,S={}){return ht(C)?S=vt(S,["fill","stroke","width","height"]):S=vt(S,["fill","stroke"]),X(N,C,S)},"bpmn:Task":function(N,C,S={}){return S=vt(S,["fill","stroke"]),Se(N,C,S)},"bpmn:TextAnnotation":function(N,C,S={}){S=vt(S,["fill","stroke"]);var{width:V,height:K}=Ts(C,S),le=m(N,V,K,0,0,{fill:"none",stroke:"none"}),Te=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:V,containerHeight:K,position:{mx:0,my:0}});x(N,Te,{stroke:Oe(C,c,S.stroke)});var Ve=be(C),wt=Ve.get("text")||"";return Z(N,wt,{align:"left-top",box:Ts(C,S),padding:Sa,style:{fill:Ps(C,l,c,S.stroke)}}),le},"bpmn:Transaction":function(N,C,S={}){ht(C)?S=vt(S,["fill","stroke","width","height"]):S=vt(S,["fill","stroke"]);var V=X(N,C,{strokeWidth:1.5,...S}),K=n.style(["no-fill","no-events"],{stroke:Oe(C,c,S.stroke),strokeWidth:1.5}),le=ht(C);return le||(S={}),m(N,Ei(C,S),ri(C,S),Sl-El,El,K),V},"bpmn:UserTask":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=Se(N,C,S),K=15,le=12,Te=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:K,y:le}});x(N,Te,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:.5});var Ve=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:K,y:le}});x(N,Ve,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:.5});var wt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:K,y:le}});return x(N,wt,{fill:Oe(C,c,S.stroke),stroke:Oe(C,c,S.stroke),strokeWidth:.5}),V},label:function(N,C,S={}){return J(N,C,S)}};this._drawPath=x,this._renderer=A}De(Ir,vo),Ir.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Ir.prototype.canRender=function(e){return M(e,"bpmn:BaseElement")},Ir.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Ir.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Ir.prototype.getShapePath=function(e){return rt(e)?Zf(e,WT):M(e,"bpmn:Event")?Zv(e):M(e,"bpmn:Activity")?Zf(e,Sl):M(e,"bpmn:Gateway")?jT(e):HT(e)};function vt(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var YT=0,KT={width:150,height:50};function XT(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function ZT(e){return yn(e)?q({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Qf=null;function QT(){return Qf||(Qf=document.createElement("canvas").getContext("2d")),Qf}function JT(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(Qv(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Qv(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function ek(e,t){var n=QT();if(!n)return{width:0,height:0};n.font=JT(t),"letterSpacing"in n&&(n.letterSpacing=Qv(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 tk(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=ek(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return nk(e,o,i,r);o=ok(o,r.width,t)}}function nk(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 Jv="";function ik(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===Jv)&&o.pop();break}var a=o[o.length-1];return a&&a===Jv&&(o[o.length-1]="-"),o.join("")}function ok(e,t,n){var i=Math.max(e.length*(n/t),1),o=ik(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function Rl(e){this._config=q({},{size:KT,padding:YT,style:{},align:"center-top"},e||{})}Rl.prototype.createText=function(e,t){return this.layoutText(e,t).element},Rl.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Rl.prototype.layoutText=function(e,t){for(var n=q({},this._config.size,t.box),i=q({},this._config.style,t.style),o=XT(t.align||this._config.align),r=ZT(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=rk(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(tk(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=ni(l,function(m,w,y){return m+(s||w.height)},0)+r.top+r.bottom,f=ni(l,function(m,w,y){return w.width>m?w.width:m},0),d=r.top;o.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||l[0].height)/4;var g=Ne("text");Pe(g,i),W(l,function(m){var w;switch(d+=s||m.height,o.horizontal){case"left":w=r.left;break;case"right":w=(a?f:u)-r.right-m.width;break;default:w=Math.max(((a?f:u)-m.width)/2+r.left,0)}var y=Ne("tspan");Pe(y,{x:w,y:d}),y.textContent=m.text,Je(g,y)});var h={width:f,height:p};return{dimensions:h,element:g}};function rk(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var ak=12,sk=1.2,ck=40;function eb(e){var t=q({fontFamily:"Arial, sans-serif",fontSize:ak,fontWeight:"normal",lineHeight:sk},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=q({},t,{fontSize:n},e&&e.externalStyle||{}),o=new Rl({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Lr.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:Sa});return{x:a.x,y:a.y,width:a.width,height:Math.max(ck,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,q({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}eb.$inject=["config.textRenderer"];function lk(){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=dk(i.d,{mx:o,my:r,e:a});return p}}var uk=/\{([^{}]+)\}/g,pk=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function fk(e,t,n){var i=n;return t.replace(pk,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 dk(e,t){return String(e).replace(uk,function(n,i){return fk(n,i,t)})}const hk={__init__:["bpmnRenderer"],bpmnRenderer:["type",Ir],textRenderer:["type",eb],pathMap:["type",lk]};function gk(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ks={translate:["value",gk]};function Cl(e,t,n){return q({id:e.id,type:e.$type,businessObject:e,di:t},n)}function mk(e,t,n){var i=e.waypoint;return!i||i.length<2?[Xe(t),Xe(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function tb(e,t,n){return new Error(`element ${zn(t)} referenced by ${zn(e)}#${n} not yet drawn`)}function _o(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}_o.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],_o.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(Cl(e,t,a)),this._canvas.addRootElement(i)}else if(M(t,"bpmndi:BPMNShape")){var s=!ht(e,t),c=vk(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Cl(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")&&(yk(n,Xe(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(Cl(e,t,{hidden:o,source:u,target:p,waypoints:mk(t,u,p)})),M(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${zn(t)} for element ${zn(e)}`);return Qo(e)&&vi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},_o.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${zn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw tb(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},_o.prototype.addLabel=function(e,t,n){var i,o,r;return i=DT(t,n),o=vi(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(Cl(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!vi(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)},_o.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?tb(e,i,t+"Ref"):new Error(`${zn(e)}#${t} Ref not specified`)},_o.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},_o.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},_o.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function yk(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 vk(e){return M(e,"bpmn:Group")}const nb={__depends__:[hk,{__depends__:[ks],bpmnImporter:["type",_o]}]};function Os(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Vi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Jf(e){return Math.log(e)/Math.log(10)}var bk=1e3;function ve(e){this._eventBus=e}ve.$inject=["eventBus"];function xk(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}ve.prototype.on=function(e,t,n,i,o,r){if((_n(t)||Ke(t))&&(r=o,o=i,i=n,n=t,t=null),_n(n)&&(r=o,o=i,i=n,n=bk),yn(o)&&(r=o,o=!1),!_n(i))throw new Error("handlerFn must be a function");Ye(e)||(e=[e]);var a=this._eventBus;W(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,o?xk(i,r):i,r)})},ve.prototype.canExecute=Eo("canExecute"),ve.prototype.preExecute=Eo("preExecute"),ve.prototype.preExecuted=Eo("preExecuted"),ve.prototype.execute=Eo("execute"),ve.prototype.executed=Eo("executed"),ve.prototype.postExecute=Eo("postExecute"),ve.prototype.postExecuted=Eo("postExecuted"),ve.prototype.revert=Eo("revert"),ve.prototype.reverted=Eo("reverted");function Eo(e){return function(n,i,o,r,a){(_n(n)||Ke(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var ed=["top","bottom","left","right"],Ml=10;function td(e,t){ve.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(_l(o)&&!Lt(o)){var r=Ek(o);r&&i(o,r)}}function i(o,r){var a=Xe(o),s=o.label,c=Xe(s);if(s.parent){var l=Ge(o),u;switch(r){case"top":u={x:a.x,y:l.top-Ml-s.height/2};break;case"left":u={x:l.left-Ml-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Ml+s.height/2};break;case"right":u={x:l.right+Ml+s.width/2,y:a.y};break}var p=Vi(u,c);t.moveShape(s,p)}}}De(td,ve),td.$inject=["eventBus","modeling"];function wk(e){var t=e.host,n=Xe(e),i=On(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=ed.filter(function(a){return o.indexOf(a)===-1});return r}function _k(e){var t=Xe(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 ib(t,i)});return n}function Ek(e){var t=Xe(e.label),n=Xe(e),i=ib(n,t);if(Sk(i)){var o=_k(e);if(e.host){var r=wk(e);o=o.concat(r)}var a=ed.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?On(e.label,e)!=="intersect"?void 0:i:a[0]}}function ib(e,t){return On(t,e,5)}function Sk(e){return ed.indexOf(e)!==-1}function nd(e){ve.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)}De(nd,ve),nd.$inject=["eventBus"];var Rk=1500;function id(e,t,n){e.invoke(ve,this),this.preExecute("elements.delete",Rk,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=ct(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 W(r,l=>{const u=new Set(ra(ba(Array.from(s),ln(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}De(id,ve),id.$inject=["injector","eventBus","canvas"];function od(e,t){e.invoke(ve,this),this.postExecute("shape.move",function(n){var i=n.newParent,o=n.shape,r=ct(o.incoming.concat(o.outgoing),function(a){return M(a,"bpmn:Association")});W(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}De(od,ve),od.$inject=["injector","modeling"];function Ca(e,t){for(ei(t)&&(t=[t]);e=e.parent;)if(at(e,t))return e;return null}function ob(e,t){var n=Ca(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Ca(e,i),n)return En(n);if(at(e,i))return En(e);var o;for(o=be(e);o&&!M(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=be(a);return s&&s.get("processRef")===o});return r?En(r):!0}var rb=500;function Al(e,t){t.invoke(ve,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",rb,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return ab(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",rb,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];ab(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}Al.$inject=["bpmnReplace","injector"],De(Al,ve),Al.prototype._replaceShape=function(e,t){var n=Ck(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function Ck(e){var t=be(e),n=t.eventDefinitions;return n&&n[0]}function ab(e,t){return!rt(e)&&at(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function rd(e,t){ve.call(this,e);function n(i){return ct(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")&&W(r.outgoing,function(a){var s=a.target,c=n(s);M(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}rd.$inject=["eventBus","modeling"],De(rd,ve);function sb(e){return e.create("bpmn:Category")}function Mk(e){return e.create("bpmn:CategoryValue")}function cb(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=Mk(e)),n.$parent||(n.$parent=sb(e)),n}function Ak(e,t,n){return an(t.get("categoryValue"),e),e.$parent=t,an(n.get("rootElements"),t),t.$parent=n,e}function Pk(e){var t=e.$parent;return t&&(on(t.get("categoryValue"),e),e.$parent=null),e}function Tk(e){var t=e.$parent;return t&&(on(t.get("rootElements"),e),e.$parent=null),e}var kk=500;function ad(e,t,n){n.invoke(ve,this);function i(c){return t.filter(function(l){return M(l,"bpmn:Group")&&!l.labelTarget}).map(be).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&&Ak(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&Tk(l),c&&!o(c,u)&&Pk(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,be(l))},!0),this.executed(["shape.move","shape.resize"],kk,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,be(l))},!0),this.executed("group.updateRefs",function(c){lb(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){lb(c).forEach(function(l){s(l.categoryValue,l.category,be(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,be(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}ad.$inject=["bpmnjs","elementRegistry","injector"],De(ad,ve);function lb(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function sd(e,t,n){ve.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",o,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",r,!0),this.postExecuted("element.updateProperties",a,!0);function i(m){const w=m.source,y=m.target;Ma(w)&&Ds(y)&&u(y)}function o(m){const w=m.connection,y=m.source,v=m.target;Ma(y)&&Pl(v)&&(l(v),f(y,[w]))}function r(m){const w=m.newTarget,y=m.oldSource,v=m.oldTarget;if(v!==w){const x=y;Ds(v)&&u(v),Ma(x)&&Pl(w)&&l(w)}}function a(m){const{element:w}=m;Ds(w)?(p(w),d(w)):Pl(w)&&g(w)}function s(m){const{newData:w,oldShape:y}=m;if(Ma(m.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){const v=y.outgoing.find(({target:x})=>Ds(x));v&&v.target&&(m._connectionTarget=v.target)}else if(!Ma(m.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){const v=y.outgoing.find(({target:x})=>Pl(x));v&&v.target&&(m._connectionTarget=v.target),h(y)}}function c(m){const{_connectionTarget:w,newShape:y}=m;w&&t.connect(y,w)}function l(m){t.updateProperties(m,{isForCompensation:!0})}function u(m){t.updateProperties(m,{isForCompensation:void 0})}function p(m){for(const w of m.incoming)n.canConnect(w.source,m)||t.removeConnection(w);for(const w of m.outgoing)n.canConnect(m,w.target)||t.removeConnection(w)}function f(m,w){m.outgoing.filter(x=>M(x,"bpmn:Association")).filter(x=>Ds(x.target)&&!w.includes(x)).forEach(x=>t.removeConnection(x))}function d(m){const w=m.attachers.slice();w.length&&t.removeElements(w)}function g(m){const w=m.incoming.filter(y=>Ma(y.source));t.removeElements(w)}function h(m){const w=m.outgoing.filter(y=>M(y,"bpmn:SequenceFlow"));t.removeElements(w)}}De(sd,ve),sd.$inject=["eventBus","modeling","bpmnRules"];function Ds(e){const t=be(e);return t&&t.get("isForCompensation")}function Ma(e){return e&&M(e,"bpmn:BoundaryEvent")&&Ea(e,"bpmn:CompensateEventDefinition")}function Pl(e){return e&&M(e,"bpmn:Activity")&&!Gn(e)}function cd(e){e.invoke(ve,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=Ca(i,"bpmn:Participant"))})}cd.$inject=["injector"],De(cd,ve);function ld(e,t){ve.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}})}ld.$inject=["eventBus","bpmnFactory"],De(ld,ve);var ud=20,pd=20,ub=30,Tl=2e3;function fd(e,t,n){ve.call(this,t),t.on(["create.start","shape.move.start"],Tl,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")&&!rt(p)&&!Lt(p)});if(c.length){var l=ln(c),u=Ok(a,l);q(a,u),r.createConstraints=Dk(a,l)}}}),t.on("create.start",Tl,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",Tl,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",Tl,function(o){var r=o.elements,a=o.parent,s=Lk(r),c;s&&M(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=be(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=be(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)&&be(s).set("processRef",be(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)&&be(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)}fd.$inject=["canvas","eventBus","modeling"],De(fd,ve);function Ok(e,t){t={width:t.width+ud*2+ub,height:t.height+pd*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 Dk(e,t){return t=Ge(t),{bottom:t.top+e.height/2-pd,left:t.right-e.width/2+ud,top:t.bottom-e.height/2+pd,right:t.left+e.width/2-ud-ub}}function Lk(e){return $t(e,function(t){return M(t,"bpmn:Participant")})}var pb="__targetRef_placeholder";function dd(e,t){ve.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],fb(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],fb(r));function n(a,s,c){var l=a.get("dataInputAssociations");return $t(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=$t(c,function(u){return u.name===pb});return!l&&s&&(l=t.create("bpmn:Property",{name:pb}),an(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||on(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,w;h&&h!==p&&o(h,l),d&&d!==p&&o(d,l),p?(w=i(p,!0),m.targetRef=w):m.targetRef=null}}dd.$inject=["eventBus","bpmnFactory"],De(dd,ve);function fb(e){return function(t){var n=t.context,i=n.connection;if(M(i,"bpmn:DataInputAssociation"))return e(t)}}function kl(e){this._bpmnUpdater=e}kl.$inject=["bpmnUpdater"],kl.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,o=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,o),[]},kl.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,o=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,o),[]};function hd(e,t,n,i){ve.call(this,i),t.registerHandler("dataStore.updateContainment",kl);function o(){return n.filter(function(s){return M(s,"bpmn:Participant")&&be(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:yt(s),newSemanticParent:u.processRef||u,newDiParent:yt(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:Bk(u,"bpmn:Participant");a(l,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();at(l,["bpmn:Participant","bpmn:SubProcess"])&&M(u,"bpmn:Collaboration")&&r(u).filter(function(p){return Ik(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)})})}hd.$inject=["canvas","commandStack","elementRegistry","eventBus"],De(hd,ve);function Ik(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 Bk(e,t){for(;e.parent;){if(M(e.parent,t))return e.parent;e=e.parent}}var Ol=Math.max,Dl=Math.min,Nk=20;function db(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function $k(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 Fk(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}}function Ll(e,t,n){var i=t[e],o=n.min&&n.min[e],r=n.max&&n.max[e];return Ke(o)&&(i=(/top|left/.test(e)?Dl:Ol)(i,o)),Ke(r)&&(i=(/top|left/.test(e)?Ol:Dl)(i,r)),i}function jk(e,t){if(!t)return e;var n=Ge(e);return ml({top:Ll("top",n,t),right:Ll("right",n,t),bottom:Ll("bottom",n,t),left:Ll("left",n,t)})}function Hk(e,t,n,i){var o=Ge(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?Ge(i):r,s={top:Dl(r.top,a.top),left:Dl(r.left,a.left),bottom:Ol(r.bottom,a.bottom),right:Ol(r.right,a.right)};return ml(s)}function Ls(e,t){return typeof e<"u"?e:Nk}function zk(e,t){var n,i,o,r;return typeof t=="object"?(n=Ls(t.left),i=Ls(t.right),o=Ls(t.top),r=Ls(t.bottom)):n=i=o=r=Ls(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function Gk(e){return!(e.waypoints||e.type==="label")}function hb(e,t){var n;if(e.length===void 0?n=ct(e.children,Gk):n=e,n.length)return zk(ln(n),t)}var Jo=Math.abs;function Vk(e,t){return db(Ge(t),Ge(e))}var Wk=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Si=30;function Il(e,t){return t=t||[],e.children.filter(function(n){M(n,"bpmn:Lane")&&(Il(n,t),t.push(n))}),t}function er(e){return e.children.filter(function(t){return M(t,"bpmn:Lane")})}function Ri(e){return Ca(e,Wk)||e}function Uk(e,t){var n=Ri(e),i=M(n,"bpmn:Process")?[]:[n],o=Il(n,i),r=Ge(e),a=Ge(t),s=Vk(e,t),c=[],l=En(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=Ge(u);s.top&&(Jo(h.bottom-r.top)<10&&(d=a.top-h.bottom),Jo(h.top-r.top)<5&&(p=a.top-h.top)),s.left&&(Jo(h.right-r.left)<10&&(f=a.left-h.right),Jo(h.left-r.left)<5&&(g=a.left-h.left)),s.bottom&&(Jo(h.top-r.bottom)<10&&(p=a.bottom-h.top),Jo(h.bottom-r.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(Jo(h.left-r.right)<10&&(g=a.right-h.left),Jo(h.right-r.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:u,newBounds:Fk(u,{top:p,right:f,bottom:d,left:g})})}}),c}var qk=500;function gd(e,t){ve.call(this,e);function n(i,o){var r=En(i),a=er(o),s=[],c=[],l=[],u=[];if(Dr(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",qk,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))})}gd.$inject=["eventBus","spaceTool"],De(gd,ve);var gb=500;function Bl(e,t){t.invoke(ve,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",gb,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return mb(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",gb,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;mb(a,Kk(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}Bl.$inject=["bpmnReplace","injector"],De(Bl,ve),Bl.prototype._replaceShape=function(e){var t=Yk(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function Yk(e){var t=be(e),n=t.eventDefinitions;return n&&n[0]}function mb(e,t){return!rt(e)&&M(e,"bpmn:BoundaryEvent")&&!t}function Kk(e,t){return e.indexOf(t)!==-1}var Nl=Math.round,Xk=Math.max;function Zk(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 Qk(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var yb=10;function Jk(e,t){var n,i;for(n=0;i=e[n];n++)if(Ss(i,t)<=yb)return{point:e[n],bendpoint:!0,index:n};return null}function e2(e,t){var n=_v(Zk(t,yb),Qk(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=Xk(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:Nl(i.x+o.x)/2,y:Nl(i.y+o.y)/2},index:i.segment2}:{point:{x:Nl(i.x),y:Nl(i.y)},index:i.segment2}:null}function md(e,t){return Jk(e,t)||e2(e,t)}function yd(e,t,n){ve.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(),w;Ke(a.width)?w=Xe(a):w=a;var y=md(s,w);if(y){if(c=s.slice(0,y.index),l=s.slice(y.index+(y.bendpoint?1:0)),!c.length||!l.length)return;u=y.bendpoint?s[y.index]:w,(c.length===1||!vb(o,c[c.length-1]))&&c.push(bb(u)),(l.length===1||!vb(o,l[0]))&&l.unshift(bb(u))}p=r.source,f=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||w),d=r),t.canConnect(o,f,r)&&(d?g=n.connect(o,f,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||w),g=r));var v=[].concat(d&&ct(m,function(x){return x.source===d.source})||[],g&&ct(h,function(x){return x.target===g.target})||[]);v.length&&n.removeElements(v)}this.preExecute("elements.move",function(o){var r=o.newParent,a=o.shapes,s=o.delta,c=a[0];if(!(!c||!r)){r&&r.waypoints&&(o.newParent=r=r.parent);var l=Xe(c),u={x:l.x+s.x,y:l.y+s.y},p=$t(r.children,function(f){var d=t.canInsert(a,f);return d&&md(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)}De(yd,ve),yd.$inject=["eventBus","bpmnRules","modeling"];function vb(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 bb(e){return q({},e)}function vd(e,t){ve.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)&&Aa(o)){var c=[];M(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&Aa(l)):c=a.incoming.filter(l=>l!==o&&Aa(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(Aa).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(Aa).forEach(function(s){const c=a.incoming.filter(Aa).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}vd.$inject=["eventBus","modeling"],De(vd,ve);function Aa(e){return M(e,"bpmn:SequenceFlow")}var $l=1500,xb=2e3;function wb(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"],$l,function(i){var o=i.context,r=o.shape||i.shape,a=i.hover;M(a,"bpmn:Lane")&&!at(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Ri(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(r.labelTarget||at(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"],$l,function(i){var o=i.hover;M(o,"bpmn:Lane")&&(i.hover=Ri(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],$l,function(i){var o=i.context,r=i.hover,a=o.type;M(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Ri(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],$l,function(i){var o=i.context,r=o.start;M(r,"bpmn:Lane")&&(o.start=Ri(r)||r)}),t.on("shape.move.start",xb,function(i){var o=i.shape;M(o,"bpmn:Lane")&&(i.shape=Ri(o)||o)}),t.on("spaceTool.move",xb,function(i){var o=i.hover;o&&M(o,"bpmn:Lane")&&(i.hover=Ri(o))})}wb.$inject=["elementRegistry","eventBus","canvas"];var _b=770;function bd(e,t,n,i){n.invoke(ve,this);function o(s,c){var l=be(s),u=c.categoryValue||l.categoryValueRef;u||(u=cb(e,l));var p=c.category||u.$parent||sb(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=be(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=be(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=be(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&&!be(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&&!be(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||be(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",_b,function(s){var c=s.descriptor,l=s.element;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=be(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",_b,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})}bd.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],De(bd,ve);function xd(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 Eb(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=xd(i,o,r,a),l=xd(i,o,r,s),u;c&&l?Sb(c,r)>Sb(l,r)?u=l:u=c:u=c||l,i.original=u}function n(i){var o=i.waypoints;t(o[0],o[1],Xe(i.source)),t(o[o.length-1],o[o.length-2],Xe(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}Eb.$inject=["eventBus"];function Sb(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function wd(e){ve.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=be(i),r=yt(i);if(at(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}wd.$inject=["eventBus"],De(wd,ve);function Rb(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Cb(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function t2(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 n2(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 _d(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=n2([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 Mb(e,t){var n=_d(e,t),i={x:n.x-e.x,y:n.y-e.y};return Rb(i)}function Is(e,t){return Rb({x:e.x-t.x,y:e.y-t.y})}var Ab=Math.sqrt,Pb=Math.min,i2=Math.max,Tb=Math.abs;function kb(e){return Math.pow(e,2)}function Bs(e,t){return Ab(kb(e.x-t.x)+kb(e.y-t.y))}function o2(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],Db(i,o)?l=[i]:(r=Bs(e,i),a=Bs(e,o),c=Pb(r,a),l=r2(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:Db(i,l[0])?n:n+1}),l.length===2&&(s=s2(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Bs(i,s)/Bs(i,o)}),p=Bs(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function r2(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=Ab(d),h=-p+g,m=-p-g,w={x:e.x-o*h,y:e.y-r*h};if(d===0)return[w];var y={x:e.x-o*m,y:e.y-r*m};return[w,y].filter(function(v){return a2(v,e,t)})}function a2(e,t,n){return Ob(e.x,t.x,n.x)&&Ob(e.y,t.y,n.y)}function Ob(e,t,n){return e>=Pb(t,n)-Fl&&e<=i2(t,n)+Fl}function s2(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Fl=.1;function Db(e,t){return Tb(e.x-t.x)<=Fl&&Tb(e.y-t.y)<=Fl}function c2(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=Ib(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=o2(e,n),c=s.segmentIndex,l=c2(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Bb(n,c),p=Bb(t,l),f=s.position,d=u2(u,f),g=l2(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,w=n[m];if(t.indexOf(w)!==-1)return a;if(h===0){var y=t[m];return o=y.x-s.position.x,r=y.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=Ib(n,m))}var v={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},x=t2({x:e.x-f.x,y:e.y-f.y},g);return o=v.x+x.x-e.x,r=v.y+x.y-e.y,{point:xo(v),delta:xo({x:o,y:r})}}function Ib(e,t){var n=Is(e[t-1],e[t]),i=Is(e[t],e[t+1]),o=n/(n+i);return o}function l2(e,t){var n=Cb(e),i=Cb(t);return i-n}function Bb(e,t){return[e[t],e[t+1]]}function u2(e,t){var n=Is(e[0],e[1]),i=Is(e[0],t);return n===0?0:i/n}function p2(e,t,n,i){var o=Xe(e);return Lb(o,t,n,i).delta}function Ns(e,t,n){var i=Os(t),o=Os(n),r=Vi(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return xo({x:o.x+a.x,y:o.y+a.y})}function Nb(e,t,n){var i=Os(e),o=Os(t),r=Os(n),a=Vi(e,i),s=Vi(i,o),c=f2(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 xo({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function f2(e,t,n){var i=Ge(t),o=Ge(n);if(d2(i,o))return null;var r=On(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=On(n,s),c!==r?null:a}function d2(e,t){return h2(e,t)||g2(e,t)}function h2(e,t){return e.right!==t.right&&e.left!==t.left}function g2(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var $b="name",Fb="text";function Ed(e,t,n,i){ve.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{be(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if($b in l&&t.updateLabel(c,l[$b]),Fb in l&&M(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Fb]||"");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;rt(l)||!Qo(l)||vi(l)&&t.updateLabel(l,vi(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=q({},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),p2(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=be(c);u&&Qo(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(!(!rt(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(vi(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(_l(c)){var p=c.label,f=Xe(p),d=v2(u),g=y2(f,d),h=m2(g,u,l);t.moveShape(p,h)}})}De(Ed,ve),Ed.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function m2(e,t,n){var i=Ns(e,t,n);return xo(Vi(i,e))}function y2(e,t){if(t.length){var n=b2(e,t);return _d(e,n)}}function v2(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 b2(e,t){var n=t.map(function(o){return{line:o,distance:Mb(e,o)}}),i=Yi(n,"distance");return i[0].line}function x2(e,t,n,i){return Lb(e,t,n,i).point}function Sd(e,t){ve.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=q({},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),x2(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)})})}De(Sd,ve),Sd.$inject=["eventBus","modeling"];function jl(e,t,n){var i=zl(e),o=Hb(i,t),r=i[0];return o.length?o[o.length-1]:Ns(r.original||r,n,t)}function Hl(e,t,n){var i=zl(e),o=Hb(i,t),r=i[i.length-1];return o.length?o[0]:Ns(r.original||r,n,t)}function Rd(e,t,n){var i=zl(e),o=jb(t,n),r=i[0];return Ns(r.original||r,o,t)}function Cd(e,t,n){var i=zl(e),o=jb(t,n),r=i[i.length-1];return Ns(r.original||r,o,t)}function jb(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function zl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Hb(e,t){var n=Fn(e,_2);return ct(n,function(i){return w2(i,t)})}function w2(e,t){return On(t,e,1)==="intersect"}function _2(e){return e.original||e}function Md(e,t){ve.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(E2(i,o)){var r=S2(i);r.incoming.forEach(function(a){var s=Hl(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=jl(a,o,i);t.reconnectStart(a,o,s)})}},!0)}Md.$inject=["eventBus","modeling"],De(Md,ve);function E2(e,t){return M(e,"bpmn:Participant")&&ht(e)&&M(t,"bpmn:Participant")&&!ht(t)}function S2(e){var t=_s([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 R2=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function zb(e){const t=be(e);if(!M(t,"bpmn:BoundaryEvent")&&!(M(t,"bpmn:StartEvent")&&Gn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:R2.some(i=>M(n[0],i))}function Gb(e){return M(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Ad(e,t){e.invoke(ve,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!zb(o))return;const a=Gb(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=be(i).get(a),l=be(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}Ad.$inject=["injector","modeling"],De(Ad,ve);function Pd(e,t){ve.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=yt(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}De(Pd,ve),Pd.$inject=["eventBus","modeling"];function Td(e,t,n){ve.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=C2(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}De(Td,ve),Td.$inject=["eventBus","bpmnRules","modeling"];function Pa(e){return e.original||e}function C2(e,t){var n=xd(Pa(e[e.length-2]),Pa(e[e.length-1]),Pa(t[1]),Pa(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Pa(e[0]),Pa(t[t.length-1])]}function kd(e,t){ve.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)}kd.$inject=["eventBus","modeling"],De(kd,ve);function Od(e,t,n,i){ve.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;W(u,r)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,f=p.businessObject,d;u.default&&(d=$t(p.outgoing,sa({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})})}De(Od,ve),Od.$inject=["eventBus","modeling","bpmnRules","injector"];function Gl(e,t,n,i,o,r){i.invoke(ve,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=ni(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=[];W(s.closure.topLevel,function(f){Gn(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})})}De(Gl,ve),Gl.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,o=this._selection;W(t,function(r){var a={type:r.newElementType},s=n.get(r.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&o.select(e)},Gl.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var M2=1500,A2={width:140,height:120},Dd={width:300,height:60},Ld={width:60,height:300},Vl={width:300,height:150},Wl={width:150,height:300},Vb={width:140,height:120},Wb={width:100,height:40};function Ub(e){e.on("resize.start",M2,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=D2(i,o,r)),M(i,"bpmn:SubProcess")&&ht(i)&&(n.minDimensions=Vb),M(i,"bpmn:TextAnnotation")&&(n.minDimensions=Wb)})}Ub.$inject=["eventBus"];var tr=Math.abs,P2=Math.min,T2=Math.max;function qb(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function Ta(e,t,n){return qb(e,t,n,P2)}function ka(e,t,n){return qb(e,t,n,T2)}var k2={top:20,left:50,right:20,bottom:20},O2={top:50,left:20,right:20,bottom:20};function D2(e,t,n){var i=Ri(e),o=!0,r=!0,a=Il(i,[i]),s=Ge(e),c={},l={},u=En(e),p=u?Dd:Ld;/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=Ge(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&&tr(s.top-h.bottom)<10&&ka(c,"top",h.top+p.height),tr(s.top-h.top)<5&&Ta(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&tr(s.right-h.left)<10&&Ta(c,"right",h.right-p.width),tr(s.right-h.right)<5&&ka(l,"right",h.left+p.width)),/s/.test(t)&&(n&&tr(s.bottom-h.top)<10&&Ta(c,"bottom",h.bottom-p.height),tr(s.bottom-h.bottom)<5&&ka(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&tr(s.left-h.right)<10&&ka(c,"left",h.left+p.width),tr(s.left-h.left)<5&&Ta(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?k2:O2;return f.forEach(function(g){var h=Ge(g);/n/.test(t)&&(!u||o)&&Ta(l,"top",h.top-d.top),/e/.test(t)&&(u||r)&&ka(l,"right",h.right+d.right),/s/.test(t)&&(!u||r)&&ka(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||o)&&Ta(l,"left",h.left-d.left)}),{min:l,max:c}}function Yb(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Oa(e){return e.originalEvent||e.srcEvent}function Id(e){Yb(e),Yb(Oa(e))}function Br(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 Kb(){return/mac/i.test(navigator.platform)}function Xb(e,t){return(Oa(e)||e).button===t}function nr(e){return Xb(e,0)}function L2(e){return Xb(e,1)}function $s(e){var t=Oa(e)||e;return nr(e)?Kb()?t.metaKey:t.ctrlKey:!1}function Ul(e){var t=Oa(e)||e;return nr(e)&&t.shiftKey}var Zb=1001;function Qb(e,t){e.on("resize.start",Zb+500,function(n){var i=n.context,o=i.shape;(M(o,"bpmn:Lane")||M(o,"bpmn:Participant"))&&(i.balanced=!$s(n))}),e.on("resize.end",Zb,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=Mv(a),t.resizeLane(o,a,i.balanced)),!1})}Qb.$inject=["eventBus","modeling"];var I2=500;function Bd(e,t,n,i,o){n.invoke(ve,this);function r(u){return at(u,["bpmn:ReceiveTask","bpmn:SendTask"])||B2(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!$t(f,sa({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(at(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(at(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=be(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),an(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");on(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!r(f))){var d=be(f),g=c(d);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",I2,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)})}Bd.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],De(Bd,ve);function B2(e,t){return Ye(t)||(t=[t]),No(t,function(n){return Ea(e,n)})}var Jb=Math.max;function ex(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,o=t.start,r={};return W(n,function(a){var s=a.id;M(a,"bpmn:Participant")&&(r[s]=$2(a,i,o)),M(a,"bpmn:Lane")&&(r[s]=En(a)?Dd:Ld),M(a,"bpmn:SubProcess")&&ht(a)&&(r[s]=Vb),M(a,"bpmn:TextAnnotation")&&(r[s]=Wb),M(a,"bpmn:Group")&&(r[s]=A2)}),r})}ex.$inject=["eventBus"];function N2(e){return e==="x"}function $2(e,t,n){var i=En(e);if(!H2(e))return i?Vl:Wl;var o=N2(t),r={};return o?i?r=Vl:r={width:j2(e,n,o),height:Wl.height}:i?r={width:Vl.width,height:F2(e,n,o)}:r=Wl,r}function F2(e,t,n){var i;return i=z2(e,t,n),Jb(Vl.height,i)}function j2(e,t,n){var i;return i=G2(e,t,n),Jb(Wl.width,i)}function H2(e){return!!er(e).length}function z2(e,t,n){var i=er(e),o;return o=Nd(i,t,n),e.height-o.height+Dd.height}function G2(e,t,n){var i=er(e),o;return o=Nd(i,t,n),e.width-o.width+Ld.width}function Nd(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=er(o),r.length?Nd(r,t,n):o}var tx="_plane";function nx(e){var t=e.id;return V2(t)}function io(e){var t=e.id;return M(e,"bpmn:SubProcess")?ix(t):t}function Nr(e){return ix(e)}function ql(e){var t=yt(e);return M(t,"bpmndi:BPMNPlane")}function ix(e){return e+tx}function V2(e){return e.replace(new RegExp(tx+"$"),"")}var ox=400,W2=600,rx={x:180,y:160};function So(e,t,n,i,o,r,a){ve.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")&&!ht(p)}function l(p){var f=p.shape,d=p.newRootElement,g=be(f);d=s._addDiagram(d||g),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=be(f);s._removeDiagram(d);var g=p.newRootElement=a.get(io(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;W(f,function(d){if(c(d)){var g=a.get(io(d));if(!(!g||!d.children||!d.children.length)){var h=ax(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")||!ht(f)||W(As([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(io(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(io(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(io(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(ql(f)){a.updateId(f,Nr(m)),a.updateId(h,m);return}var w=a.get(Nr(h));w&&a.updateId(Nr(h),Nr(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(ql(f)){a.updateId(f,Nr(h)),a.updateId(m,h);return}var w=a.get(Nr(m));w&&a.updateId(w,Nr(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(ql(f)){var d=f,g=a.get(nx(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",ox,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(ht(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",ox,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(ht(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",W2,function(p){var f=p.shape;if(M(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(ht(f))s._moveChildrenToShape(d.children.slice(),f),W(As(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),W(h.associations,m=>{n.moveConnection(m,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var g=ax(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=io(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(yt(h),"bpmndi:BPMNPlane");if(m){var w=nx(h),y=$t(g,function(v){return v.id===w});y&&(f.parent=y.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}De(So,ve),So.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var o=ln(i),r;if(!t.x)r={x:rx.x-o.x,y:rx.y-o.y};else{var a=Xe(t),s=Xe(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},So.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Xv(e).map(i=>i.annotation));n.size&&W(As(e.children),i=>{n.has(i.annotation)&&W(i.associations,o=>{t.removeConnection(o)})})},So.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},So.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},So.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:io(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},So.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=$t(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},So.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function U2(e){var t=[];return W(As(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function ax(e){return e.children.slice().concat(U2(e.children)).concat(q2(e))}function q2(e){return zf(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function $d(e,t){e.invoke(ve,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"))||!ht(o))){var r=Y2(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}$d.$inject=["injector","modeling"],De($d,ve);function Y2(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Fd(e,t){ve.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,vi(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}}})}De(Fd,ve),Fd.$inject=["eventBus","textRenderer"];function jd(e,t){ve.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(ht(i))return;var o=_s(i);o.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();W(s,function(l){r(l,!0)}),W(c,function(l){r(l,!1)})});function r(a,s){o.indexOf(a.source)!==-1&&o.indexOf(a.target)!==-1||M(a,"bpmn:Association")&&(M(a.source,"bpmn:TextAnnotation")||M(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Xe(i)):t.reconnectStart(a,i,Xe(i)))}},!0)}De(jd,ve),jd.$inject=["eventBus","modeling"];var Hd=500;function zd(e,t,n){ve.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=K2(c).concat([a]),p=hb(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"],Hd,function(a){var s=a.context,c=s.shape;M(c,"bpmn:SubProcess")&&(c.collapsed?yt(c).isExpanded=!1:(i(c.children),yt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Hd,function(a){var s=a.context,c=s.shape;c.collapsed?yt(c).isExpanded=!1:yt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Hd,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"})})}De(zd,ve),zd.$inject=["eventBus","elementFactory","modeling"];function K2(e){return e.filter(function(t){return!t.hidden})}function Gd(e,t,n,i){t.invoke(ve,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;rt(a)||(M(a,"bpmn:Participant")&&ht(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)})}De(Gd,ve),Gd.$inject=["canvas","injector","moddle","modeling"];function Vd(e,t){ve.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;X2(o,r)&&t.updateProperties(r,{default:null})})}De(Vd,ve),Vd.$inject=["eventBus","modeling"];function X2(e,t){if(!M(e,"bpmn:SequenceFlow"))return!1;var n=be(t),i=be(e);return n.get("default")===i}var Z2=500,Q2=5e3,sx=["shape.create","shape.delete","shape.move","shape.resize"],cx=[...sx,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Wd(e,t){ve.call(this,e);var n;function i(){return n=n||new J2,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(cx,Q2,function(){i()}),this.postExecuted(cx,Z2,function(){r()}),this.preExecute(sx,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))})}Wd.$inject=["eventBus","modeling"],De(Wd,ve);function J2(){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 eO=500,tO=5e3,lx=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],ux=[...lx,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Ud(e,t){ve.call(this,e);var n;function i(){return n=n||new nO,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(ux,tO,function(){i()}),this.postExecuted(ux,eO,function(){r()}),this.preExecute(lx,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)})}Ud.$inject=["eventBus","modeling"],De(Ud,ve);function nO(){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 qd(e,t){ve.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)iO(r)&&!rO(r)&&t.updateProperties(r,{isForCompensation:void 0})})}De(qd,ve),qd.$inject=["eventBus","modeling"];function iO(e){const t=be(e);return t&&t.isForCompensation}function oO(e){return e&&M(e,"bpmn:BoundaryEvent")&&Ea(e,"bpmn:CompensateEventDefinition")}function rO(e){return e.incoming.filter(n=>oO(n.source)).length>0}const aO={__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",td],appendBehavior:["type",nd],associationBehavior:["type",od],attachEventBehavior:["type",Al],artifactBehavior:["type",id],boundaryEventBehavior:["type",rd],categoryRootElementReferenceBehavior:["type",ad],compensateBoundaryEventBehaviour:["type",sd],createBehavior:["type",cd],createDataObjectBehavior:["type",ld],createParticipantBehavior:["type",fd],dataInputAssociationBehavior:["type",dd],dataStoreBehavior:["type",hd],deleteLaneBehavior:["type",gd],detachEventBehavior:["type",Bl],dropOnFlowBehavior:["type",yd],eventBasedGatewayBehavior:["type",vd],fixHoverBehavior:["type",wb],groupBehavior:["type",bd],importDockingFix:["type",Eb],isHorizontalFix:["type",wd],labelBehavior:["type",Ed],layoutConnectionBehavior:["type",Sd],messageFlowBehavior:["type",Md],nonInterruptingBehavior:["type",Ad],removeElementBehavior:["type",Td],removeEmbeddedLabelBoundsBehavior:["type",Pd],removeParticipantBehavior:["type",kd],replaceConnectionBehavior:["type",Od],replaceElementBehaviour:["type",Gl],resizeBehavior:["type",Ub],resizeLaneBehavior:["type",Qb],rootElementReferenceBehavior:["type",Bd],spaceToolBehavior:["type",ex],subProcessPlaneBehavior:["type",So],subProcessStartEventBehavior:["type",$d],textAnnotationBehavior:["type",Fd],toggleCollapseConnectionBehaviour:["type",jd],toggleElementCollapseBehaviour:["type",zd],unclaimIdBehavior:["type",Gd],unsetDefaultFlowBehavior:["type",Vd],updateFlowNodeRefsBehavior:["type",Wd],updateCategoryValueRefsBehavior:["type",Ud],setCompensationActivityAfterPasteBehavior:["type",qd]};function Yd(e){this._commandStack=e.get("commandStack",!1)}Yd.$inject=["injector"],Yd.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const oo={__init__:["rules"],rules:["type",Yd]};function Ci(e){ve.call(this,e),this.init()}Ci.$inject=["eventBus"],De(Ci,ve),Ci.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)})},Ci.prototype.init=function(){};function px(e,t){var n=On(e,t,-15);return n!=="intersect"?n:null}function Ln(e){Ci.call(this,e)}De(Ln,Ci),Ln.$inject=["eventBus"],Ln.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return sO(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 Kl(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Kl(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 Sx(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Lt(i)&&!Xl(t,i)?!1:Bo(t,function(o){return Lt(o)?Kl(o.source,o.target,o):o.host?Fs(o,o.host,null,n):Qd(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 vx(a)&&!n.includes(a.host)})?!1:Fs(n,t,null,i)||_x(n,t,i)||Ex(n,t)||Xl(n,t)}),this.addRule("shape.create",function(e){return Qd(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Fs(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Px(n,t)})},Ln.prototype.canConnectMessageFlow=Mx,Ln.prototype.canConnectSequenceFlow=Ax,Ln.prototype.canConnectDataAssociation=Jd,Ln.prototype.canConnectAssociation=Rx,Ln.prototype.canConnectCompensationAssociation=Cx,Ln.prototype.canMove=Ex,Ln.prototype.canAttach=Fs,Ln.prototype.canReplace=_x,Ln.prototype.canDrop=Da,Ln.prototype.canInsert=Xl,Ln.prototype.canCreate=Qd,Ln.prototype.canConnect=Kl,Ln.prototype.canResize=Sx,Ln.prototype.canCopy=Px;function sO(e){return Kd(e)?null:at(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Kd(e){return!e||rt(e)}function fx(e){do{if(M(e,"bpmn:Process"))return be(e);if(M(e,"bpmn:Participant"))return be(e).processRef||be(e)}while(e=e.parent)}function Xd(e){return M(e,"bpmn:TextAnnotation")}function Zd(e){return M(e,"bpmn:Group")&&!e.labelTarget}function dx(e){return M(e,"bpmn:BoundaryEvent")&&ro(e,"bpmn:CompensateEventDefinition")}function Yl(e){return be(e).isForCompensation}function cO(e,t){var n=fx(e),i=fx(t);return n===i}function lO(e){return M(e,"bpmn:InteractionNode")&&!M(e,"bpmn:BoundaryEvent")&&(!M(e,"bpmn:Event")||M(e,"bpmn:ThrowEvent")&&mx(e,"bpmn:MessageEventDefinition"))}function uO(e){return M(e,"bpmn:InteractionNode")&&!Yl(e)&&(!M(e,"bpmn:Event")||M(e,"bpmn:CatchEvent")&&mx(e,"bpmn:MessageEventDefinition"))&&!(M(e,"bpmn:BoundaryEvent")&&!ro(e,"bpmn:MessageEventDefinition"))}function hx(e){for(var t=e;t=t.parent;){if(M(t,"bpmn:FlowElementsContainer"))return be(t);if(M(t,"bpmn:Participant"))return be(t).processRef}return null}function gx(e,t){var n=hx(e),i=hx(t);return n===i}function ro(e,t){var n=be(e);return!!$t(n.eventDefinitions||[],function(i){return M(i,t)})}function mx(e,t){var n=be(e);return(n.eventDefinitions||[]).every(function(i){return M(i,t)})}function pO(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:EndEvent")&&!Gn(e)&&!(M(e,"bpmn:IntermediateThrowEvent")&&ro(e,"bpmn:LinkEventDefinition"))&&!dx(e)&&!Yl(e)}function fO(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:StartEvent")&&!M(e,"bpmn:BoundaryEvent")&&!Gn(e)&&!(M(e,"bpmn:IntermediateCatchEvent")&&ro(e,"bpmn:LinkEventDefinition"))&&!Yl(e)}function dO(e){return M(e,"bpmn:ReceiveTask")||M(e,"bpmn:IntermediateCatchEvent")&&(ro(e,"bpmn:MessageEventDefinition")||ro(e,"bpmn:TimerEventDefinition")||ro(e,"bpmn:ConditionalEventDefinition")||ro(e,"bpmn:SignalEventDefinition"))}function hO(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function yx(e,t){var n=hO(t);return n.indexOf(e)!==-1}function Kl(e,t,n){if(Kd(e)||Kd(t))return null;if(!M(n,"bpmn:DataAssociation")){if(Mx(e,t))return{type:"bpmn:MessageFlow"};if(Ax(e,t))return{type:"bpmn:SequenceFlow"}}var i=Jd(e,t);return i||(Cx(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Rx(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Da(e,t){return rt(e)||Zd(e)?!0:M(t,"bpmn:Participant")&&!ht(t)?!1:M(e,"bpmn:Participant")?M(t,"bpmn:Process")||M(t,"bpmn:Collaboration"):at(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")&&!gO(e)?!1:M(e,"bpmn:FlowElement")&&!M(e,"bpmn:DataStoreReference")?M(t,"bpmn:FlowElementsContainer")?ht(t):at(t,["bpmn:Participant","bpmn:Lane"]):M(e,"bpmn:DataStoreReference")&&M(t,"bpmn:Collaboration")?No(be(t).get("participants"),function(n){return!!n.get("processRef")}):at(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?at(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 gO(e){return be(e).cancelActivity&&(bx(e)||xx(e))}function vx(e){return!rt(e)&&M(e,"bpmn:BoundaryEvent")}function mO(e){return M(e,"bpmn:Lane")}function yO(e){return vx(e)||M(e,"bpmn:IntermediateThrowEvent")&&bx(e)?!0:M(e,"bpmn:IntermediateCatchEvent")&&xx(e)}function bx(e){var t=be(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function xx(e){return wx(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function wx(e,t){return t.some(function(n){return ro(e,n)})}function vO(e){return M(e,"bpmn:ReceiveTask")&&$t(e.incoming,function(t){return M(t.source,"bpmn:EventBasedGateway")})}function Fs(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return rt(o)||!yO(o)||Gn(t)||!M(t,"bpmn:Activity")||Yl(t)||i&&!px(i,t)||vO(t)?!1:"attach"}function _x(e,t,n){if(!t)return!1;var i={replacements:[]};return W(e,function(o){Gn(t)||M(o,"bpmn:StartEvent")&&o.type!=="label"&&Da(o,t)&&(MT(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(AT(o)||PT(o)||TT(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),wx(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")||ro(o,"bpmn:CancelEventDefinition")&&o.type!=="label"&&(M(o,"bpmn:EndEvent")&&Da(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),M(o,"bpmn:BoundaryEvent")&&Fs(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Ex(e,t){return No(e,mO)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Da(n,t)})}function Qd(e,t,n,i){return t?rt(e)||Zd(e)?!0:Da(e,t)||Xl(e,t):!1}function Sx(e,t,n){return M(e,"bpmn:SubProcess")?ht(e)&&(!t||t.width>=100&&t.height>=80):M(e,"bpmn:Lane")||M(e,"bpmn:Participant")?!0:Xd(e)?n?n==="e"||n==="w":!0:Zd(e)?!0:rt(e)?n?n==="e"||n==="w":!0:!1}function bO(e,t){var n=Xd(e),i=Xd(t);return(n||i)&&n!==i}function Rx(e,t){return yx(t,e)||yx(e,t)?!1:bO(e,t)?!0:!!Jd(e,t)}function Cx(e,t){return gx(e,t)&&dx(e)&&M(t,"bpmn:Activity")&&!wO(t,e)&&!Gn(t)}function Mx(e,t){return kx(e)&&!kx(t)?!1:lO(e)&&uO(t)&&!cO(e,t)}function Ax(e,t){return pO(e)&&fO(t)&&gx(e,t)&&!(M(e,"bpmn:EventBasedGateway")&&!dO(t))}function Jd(e,t){return at(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&at(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:at(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&at(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Xl(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:at(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!rt(t)&&M(e,"bpmn:FlowNode")&&!M(e,"bpmn:BoundaryEvent")&&Da(e,t.parent)}function eh(e,t){return e&&t&&e.indexOf(t)!==-1}function Px(e,t){return rt(t)?!0:!(M(t,"bpmn:Lane")&&!eh(e,t.parent)||M(t,"bpmn:MessageFlow")&&!xO(e,t))}function xO(e,t){var n=Tx(t.source),i=Tx(t.target);return eh(e,n)&&eh(e,i)}function Tx(e){for(;e;e=e.parent)if(M(e,"bpmn:Participant"))return e;return null}function kx(e){return Ca(e,"bpmn:Process")||Ca(e,"bpmn:Collaboration")}function wO(e,t){return e.attachers.includes(t)}const _O={__depends__:[oo],__init__:["bpmnRules"],bpmnRules:["type",Ln]};var EO=2e3;function Ox(e,t){e.on("saveXML.start",EO,n);function n(){var i=t.getRootElements();W(i,function(o){var r=yt(o),a,s;a=_s([o]),a=ct(a,function(c){return c!==o&&!c.labelTarget}),s=Fn(a,yt),r.set("planeElement",s)})}}Ox.$inject=["eventBus","canvas"];const SO={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Ox]};function Zl(e){ve.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)})}Zl.prototype.getOrdering=function(e,t){return null},De(Zl,ve);function th(e,t){Zl.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=$t(n,function(c){return at(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&&!at(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=Yg(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}}}th.$inject=["eventBus","canvas"],De(th,Zl);const RO={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",th]};function js(){}js.prototype.get=function(){return this._data},js.prototype.set=function(e){this._data=e},js.prototype.clear=function(){var e=this._data;return delete this._data,e},js.prototype.isEmpty=function(){return!this._data};const CO={clipboard:["type",js]};var Dx=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",Dx,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Dx,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=Br(a),c=document.elementFromPoint(s.x,s.y),MO(c)}}Lx.$inject=["elementRegistry","eventBus","injector"];function MO(e){return kr(e,"svg, .djs-element",!0)}const AO={__init__:["hoverFix"],hoverFix:["type",Lx]};function PO(e){return!0}function Ql(e){return nr(e)||L2(e)}var Ix=500;function Bx(e,t,n){var i=this;function o(P,T,j){if(!s(P,T)){var F,G,Z;j?G=t.getGraphics(j):(F=T.delegateTarget||T.target,F&&(G=F,j=t.get(G))),!(!G||!j)&&(Z=e.fire(P,{element:j,gfx:G,originalEvent:T}),Z===!1&&(T.stopPropagation(),T.preventDefault()))}}var r={};function a(P){return r[P]}function s(P,T){var j=l[P]||nr;return!j(T)}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":PO,"element.mousedown":Ql,"element.mouseup":Ql,"element.click":Ql,"element.dblclick":Ql};function u(P,T,j){var F=c[P];if(!F)throw new Error("unmapped DOM event name <"+P+">");return o(F,T,j)}var p="svg, .djs-element";function f(P,T,j,F){var G=r[j]=function(Z){o(j,Z)};F&&(l[j]=F),G.$delegate=ii.bind(P,p,T,G)}function d(P,T,j){var F=a(j);F&&ii.unbind(P,T,F.$delegate)}function g(P){W(c,function(T,j){f(P,j,T)})}function h(P){W(c,function(T,j){d(P,j,T)})}e.on("canvas.destroy",function(P){h(P.svg)}),e.on("canvas.init",function(P){g(P.svg)}),e.on(["shape.added","connection.added"],function(P){var T=P.element,j=P.gfx;e.fire("interactionEvents.createHit",{element:T,gfx:j})}),e.on(["shape.changed","connection.changed"],Ix,function(P){var T=P.element,j=P.gfx;e.fire("interactionEvents.updateHit",{element:T,gfx:j})}),e.on("interactionEvents.createHit",Ix,function(P){var T=P.element,j=P.gfx;i.createDefaultHit(T,j)}),e.on("interactionEvents.updateHit",function(P){var T=P.element,j=P.gfx;i.updateDefaultHit(T,j)});var m=E("djs-hit djs-hit-stroke"),w=E("djs-hit djs-hit-click-stroke"),y=E("djs-hit djs-hit-all"),v=E("djs-hit djs-hit-no-move"),x={all:y,"click-stroke":w,stroke:m,"no-move":v};function E(P,T){return T=q({stroke:"white",strokeWidth:15},T||{}),n.cls(P,["no-fill","no-border"],T)}function A(P,T){var j=x[T];if(!j)throw new Error("invalid hit type <"+T+">");return Pe(P,j),P}function D(P,T){Je(P,T)}this.removeHits=function(P){var T=ys(".djs-hit",P);W(T,cn)},this.createDefaultHit=function(P,T){var j=P.waypoints,F=P.isFrame,G;return j?this.createWaypointsHit(T,j):(G=F?"stroke":"all",this.createBoxHit(T,G,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,T){var j=ws(T);return A(j,"stroke"),D(P,j),j},this.createBoxHit=function(P,T,j){j=q({x:0,y:0},j);var F=Ne("rect");return A(F,T),Pe(F,j),D(P,F),F},this.updateDefaultHit=function(P,T){var j=At(".djs-hit",T);if(j)return P.waypoints?Hf(j,P.waypoints):Pe(j,{width:P.width,height:P.height}),j},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Bx.$inject=["eventBus","elementRegistry","styles"];const Jl={__init__:["interactionEvents"],interactionEvents:["type",Bx]};function La(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)})}La.$inject=["eventBus","canvas"],La.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()})}},La.prototype.get=function(){return Array.from(this._selectedElements)},La.prototype.isSelected=function(e){return this._selectedElements.has(e)},La.prototype.select=function(e,t){var n=this.get();Ye(e)||(e=e?[e]:[]);var i=this._canvas,o=i.getRootElement();e=e.filter(function(r){var a=i.findRoot(r);return o===a}),t?W(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Nx="hover",$x="selected";function Fx(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,Nx)}),t.on("element.out",function(o){i(o.element,Nx)}),t.on("selection.changed",function(o){function r(l){i(l,$x)}function a(l){n(l,$x)}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)})}Fx.$inject=["canvas","eventBus"];function jx(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;Ye(l)?t.select(l):t.select(s.filter(TO))}}),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=$t(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(nr(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=Ul(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}jx.$inject=["eventBus","selection","canvas","elementRegistry"];function TO(e){return!e.hidden}const Mi={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Jl],selection:["type",La],selectionVisuals:["type",Fx],selectionBehavior:["type",jx]};var kO=/^djs-cursor-.*$/;function eu(e){var t=kt(document.body);t.removeMatching(kO),e&&t.add("djs-cursor-"+e)}function Hx(){eu(null)}var OO=5e3;function zx(e,t){t=t||"element.click";function n(){return!1}return e.once(t,OO,n),function(){e.off(t,n)}}var DO=["c","C"],LO=["v","V"],IO=["d","D"],BO=["x","X"],NO=["y","Y"],Gx=["z","Z"];function $O(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function ai(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function bn(e,t){return e=Ye(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function nh(e){return e.shiftKey}function FO(e){return ai(e)&&bn(DO,e)}function jO(e){return ai(e)&&bn(LO,e)}function HO(e){return ai(e)&&bn(IO,e)}function zO(e){return ai(e)&&bn(BO,e)}function GO(e){return ai(e)&&!nh(e)&&bn(Gx,e)}function VO(e){return ai(e)&&(bn(NO,e)||bn(Gx,e)&&nh(e))}var Ia=Math.round,Vx="djs-drag-active";function $r(e){e.preventDefault()}function WO(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function UO(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Wx(e,t,n,i){var o={threshold:5,trapClick:!0},r;function a(v){var x=t.viewbox(),E=t._container.getBoundingClientRect();return{x:x.x+(v.x-E.left)/x.scale,y:x.y+(v.y-E.top)/x.scale}}function s(v,x){x=x||r;var E=e.createEvent(q({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+v,E)===!1?!1:e.fire(x.prefix+"."+v,E)}function c(v){var x=v.filter(function(E){return i.get(E.id)});x.length&&n.select(x)}function l(v,x){var E=r.payload,A=r.displacement,D=r.globalStart,P=Br(v),T=Vi(P,D),j=r.localStart,F=a(P),G=Vi(F,j);if(!r.active&&(x||UO(T)>r.threshold)){if(q(E,{x:Ia(j.x+A.x),y:Ia(j.y+A.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return m();r.active=!0,r.keepSelection||(E.previousSelection=n.get(),n.select(null)),r.cursor&&eu(r.cursor),t.addMarker(t.getRootElement(),Vx)}Id(v),r.active&&(q(E,{x:Ia(F.x+A.x),y:Ia(F.y+A.y),dx:Ia(G.x),dy:Ia(G.y)},{originalEvent:v}),s("move"))}function u(v){var x,E=!0;r.active&&(v&&(r.payload.originalEvent=v,Id(v)),E=s("end")),E===!1&&s("rejected"),x=w(E!==!0),s("ended",x)}function p(v){bn("Escape",v)&&($r(v),m())}function f(v){var x;r.active&&(x=zx(e),setTimeout(x,400),$r(v)),u(v)}function d(v){l(v)}function g(v){var x=r.payload;x.hoverGfx=v.gfx,x.hover=v.element,s("hover")}function h(v){s("out");var x=r.payload;x.hoverGfx=null,x.hover=null}function m(v){var x;if(r){var E=r.active;E&&s("cancel"),x=w(v),E&&s("canceled",x)}}function w(v){var x,E;s("cleanup"),Hx(),r.trapClick?E=f:E=u,je.unbind(document,"mousemove",l),je.unbind(document,"dragstart",$r),je.unbind(document,"selectstart",$r),je.unbind(document,"mousedown",E,!0),je.unbind(document,"mouseup",E,!0),je.unbind(document,"keyup",p),je.unbind(document,"touchstart",d,!0),je.unbind(document,"touchcancel",m,!0),je.unbind(document,"touchmove",l,!0),je.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),Vx);var A=r.payload.previousSelection;return v!==!1&&A&&!n.get().length&&c(A),x=r,r=null,x}function y(v,x,E,A){r&&m(!1),typeof x=="string"&&(A=E,E=x,x=null),A=q({},o,A||{});var D=A.data||{},P,T,j,F,G;if(A.trapClick?F=f:F=u,v?(P=Oa(v)||v,T=Br(v),Id(v),P.type==="dragstart"&&$r(P)):(P=null,T={x:0,y:0}),j=a(T),x||(x=j),G=WO(P),r=q({prefix:E,data:D,payload:{},globalStart:T,displacement:Vi(x,j),localStart:j,isTouch:G},A),A.manual||(G?(je.bind(document,"touchstart",d,!0),je.bind(document,"touchcancel",m,!0),je.bind(document,"touchmove",l,!0),je.bind(document,"touchend",u,!0)):(je.bind(document,"mousemove",l),je.bind(document,"dragstart",$r),je.bind(document,"selectstart",$r),je.bind(document,"mousedown",F,!0),je.bind(document,"mouseup",F,!0)),je.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return m(),!1;A.autoActivate&&l(v,!0)}e.on("diagram.destroy",m),this.init=y,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=m,this.context=function(){return r},this.setOptions=function(v){q(o,v)}}Wx.$inject=["eventBus","canvas","selection","elementRegistry"];const Ro={__depends__:[AO,Mi],dragging:["type",Wx]};function Fr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Fr.prototype.next=function(){return this._prefix+ ++this._counter};const qO=new Fr("ps");var YO=["marker-start","marker-mid","marker-end"],KO=["circle","ellipse","line","path","polygon","polyline","path","rect"];function ir(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}ir.$inject=["elementRegistry","eventBus","canvas","styles"],ir.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")},ir.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},ir.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=Df(n);return this._cloneMarkers(Xo(o),i),Pe(o,this._styles.cls(i,[])),Je(t,o),Pe(o,"data-preview-support-element-id",e.id),o},ir.prototype.addFrame=function(e,t){var n=Ne("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Je(t,n),Pe(n,"data-preview-support-element-id",e.id),n},ir.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),JO(e)&&YO.forEach(function(o){if(Pe(e,o)){var r=XO(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},ir.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,qO.next()].join("-"),a=At("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Df(n);s.id=r,dt(s).add(o);var c=At(":scope > defs",e);c||(c=Ne("defs"),Je(e,c)),Je(c,s);var l=QO(s.id);Pe(t,i,l)};function XO(e,t,n){var i=ZO(Pe(e,t));return At("marker#"+i,n||document)}function ZO(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function QO(e){return"url(#"+e+")"}function JO(e){return KO.indexOf(e.nodeName)!==-1}const Ba={__init__:["previewSupport"],previewSupport:["type",ir]};var eD="drop-ok",Ux="drop-not-ok",qx="attach-ok",Yx="new-parent",Kx="create",tD=2e3;function Xx(e,t,n,i,o){function r(c,l,u,p,f){if(!l)return!1;c=ct(c,function(y){var v=y.labelTarget;return!y.parent&&!(rt(y)&&c.indexOf(v)!==-1)});var d=$t(c,function(y){return!Lt(y)}),g=!1,h=!1,m=!1;Qx(c)&&(g=o.allowed("shape.attach",{position:u,shape:d,target:l})),g||(Qx(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 w=f.connectionTarget;return m||g?(d&&p&&(h=o.allowed("connection.create",{source:w===p?d:p,target:w===p?p:d,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):m===null||g===null?null:!1}function a(c,l){[qx,eD,Ux,Yx].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}Zx(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,qx):a(p,h?Yx:Ux))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,p=l.shape,f=l.elements,d=l.target,g=l.canExecute,h=g&&g.attach,m=g&&g.connect,w=l.hints||{};if(g===!1||!d)return!1;Zx(c);var y={x:c.x,y:c.y};m?p=i.appendShape(u,p,y,d,{attach:h,connection:m===!0?{}:m,connectionTarget:w.connectionTarget}):(f=i.createElements(f,y,d,q({},w,{attach:h})),p=$t(f,function(v){return!Lt(v)})),q(l,{elements:f,shape:p}),q(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Kx&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],tD,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Ye(l)||(l=[l]);var p=$t(l,function(g){return!Lt(g)});if(p){u=q({elements:l,hints:{},shape:p},u||{}),W(l,function(g){Ke(g.x)||(g.x=0),Ke(g.y)||(g.y=0)});var f=ct(l,function(g){return!g.hidden}),d=ln(f);W(l,function(g){Lt(g)&&(g.waypoints=Fn(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),q(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,Kx,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}Xx.$inject=["canvas","dragging","eventBus","modeling","rules"];function Zx(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 Qx(e){return e&&e.length===1&&!Lt(e[0])}var nD=750;function Jx(e,t,n,i,o){function r(a){var s=Ne("g");Pe(s,o.cls("djs-drag-group",["no-events"]));var c=Ne("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(Xo(u),l)):(u=n._createContainer("shape",c),n.drawShape(Xo(u),l),Dn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",nD,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(),Je(p,u)),Dn(u,a.x,a.y)):cn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&cn(c)})}Jx.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const tu={__depends__:[Ro,Ba,oo,Mi],__init__:["create","createPreview"],create:["type",Xx],createPreview:["type",Jx]};function ih(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)})}ih.$inject=["eventBus"],ih.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||iD(0,0)};function iD(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 Hs={__init__:["mouse"],mouse:["type",ih]};var ew=2e3;function si(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),oD(u)&&(l.priority=2,l.host=u.host.id),Lt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=rD(u)),rt(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),W(["x","y","width","height"],function(f){Ke(u[f])&&(l[f]=u[f])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",ew,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",ew,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;q(l,{createElementsBehavior:!1})})}si.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],si.prototype.copy=function(e,t={}){var n,i;return Ye(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Ye(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},si.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})}}},si.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},si.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},si.prototype._getElementIdsFromTree=function(e){var t={};return W(e,function(n){W(n,function(i){i.id&&(t[i.id]=!0)})}),t},si.prototype._paste=function(e,t,n,i){W(e,function(r){Ke(r.x)||(r.x=0),Ke(r.y)||(r.y=0)});var o=ln(e);return W(e,function(r){Lt(r)&&(r.waypoints=Fn(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),q(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,q({},i))},si.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return W(e,function(r,a){r=Yi(r,"priority"),W(r,function(s){var c=q({},Ki(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(Lt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),o.push(l);return}if(rt(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},si.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Ki(e,["id"]));return t},si.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Ki(e,["id"]));return t},si.prototype.createShape=function(e){var t=this._elementFactory.createShape(Ki(e,["id"]));return t},si.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Lt(e)&&(!n.has(e.source)||!n.has(e.target))||rt(e)&&!n.has(e.labelTarget))},si.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=dl(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}Dr(a,function(p,f,d){if(rt(p))return;W(p.labels,function(m){c(m,d)});function g(m){m&&m.length&&W(m,function(w){W(w.labels,function(y){c(y,d)}),c(w,d)})}W([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=Fn(o,function(p){return p.element});var u=new Set(e);return o=Fn(o,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),o=Yi(o,function(p){return p.descriptor.priority}),e=Fn(o,function(p){return p.element}),W(o,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,u)){nw(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){nw(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function oD(e){return!!e.host}function rD(e){return Fn(e.waypoints,function(t){return t=tw(t),t.original&&(t.original=tw(t.original)),t})}function tw(e){return q({},e)}function nw(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const aD={__depends__:[CO,tu,Hs,oo],__init__:["copyPaste"],copyPaste:["type",si]};function oh(e,t,n){Ye(n)||(n=[n]),W(n,function(i){Er(e[i])||(t[i]=e[i])})}var rh=750;function iw(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",rh,function(c){var l=c.descriptor,u=c.element,p=be(u);if(rt(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(yt(u),!0);d.bpmnElement=f,oh(f,l,"name"),oh(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=be(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(be(c).attachedToRef=be(l[c.host])),Ki(u,ni(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(rt(u)){u.businessObject=be(l[u.labelTarget]),u.di=yt(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,oh(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",rh,function(c){var l=c.descriptor,u=c.element;if(M(u,"bpmn:Participant")){var p=be(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")&&W(As(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",rh,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}iw.$inject=["bpmnFactory","eventBus","moddleCopy"];const sD=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],cD=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function zs(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:o}=i;if(!(!o||!o.length))return Yi(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=yn(o)&&o.$descriptor;if(a&&cD.includes(a))return r;if(a&&sD.includes(a)||a&&s&&!$t(s.properties,sa({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})}zs.$inject=["eventBus","bpmnFactory","moddle"],zs.prototype.copyElement=function(e,t,n,i=!1){n&&!Ye(n)&&(n=[n]),n=n||ah(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||(Ye(o)&&(n=o),W(n,r=>{let a;ti(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!mn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},zs.prototype.copyProperty=function(e,t,n,i=!1){let o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(o===!1)return;if(o)return yn(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;const r=this._moddle.getPropertyDescriptor(t,n);if(!r.isReference)return r.isId?e&&this._copyId(e,t,i):Ye(e)?ni(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):yn(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(o=this._bpmnFactory.create(e.$type),o.$parent=t,o=this.copyElement(e,o,null,i),o):e},zs.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function ah(e,t){return ni(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const ow={__depends__:[aD],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",iw],moddleCopy:["type",zs]};var rw=Math.round;function sh(e,t){this._modeling=e,this._eventBus=t}sh.$inject=["modeling","eventBus"],sh.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=rw(s+r/2),u=rw(c+a/2),p=i.replaceShape(e,q({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function aw(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}aw.$inject=["selection","eventBus"];const lD={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",aw],replace:["type",sh]};function uD(e,t,n){Ye(n)||(n=[n]),W(n,function(i){Er(e[i])||(t[i]=e[i])})}var pD=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function fD(e,t){var n=e&&ti(e,"collapsed")?e.collapsed:!ht(e),i;return t&&(ti(t,"collapsed")||ti(t,"isExpanded"))?i=ti(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function sw(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(nu(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&fD(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),uD(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=ah(p.$descriptor),h=ah(f.$descriptor,!0),m=dD(g,h);q(f,$i(c,pD));var w=ct(m,function(x){return x==="eventDefinitions"?cw(s,c.eventDefinitionType):x==="loopCharacteristics"?!Gn(f):ti(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!Gn(f):!0});if(f=n.copyElement(p,f,w),c.eventDefinitionType&&(cw(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),M(p,"bpmn:Activity")){if(nu(p))d.isExpanded=ht(s);else if(c&&ti(c,"isExpanded")){d.isExpanded=c.isExpanded;var y=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=y.width,d.height=y.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}ht(s)&&!M(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(nu(p)&&!nu(f)&&(l.moveChildren=!1),M(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var v=En(s);yt(s).isHorizontal||(yt(d).isHorizontal=v),d.width=v?s.width:t.getDefaultSize(d).width,d.height=v?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,at(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&at(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}sw.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function nu(e){return M(e,"bpmn:SubProcess")}function cw(e,t){var n=be(e);return t&&n.get("eventDefinitions").some(function(i){return M(i,t)})}function dD(e,t){return e.filter(function(n){return t.includes(n)})}const lw={__depends__:[ow,lD,Mi],bpmnReplace:["type",sw]};var hD=250;function jr(e){this._eventBus=e,this._tools=[],this._active=null}jr.$inject=["eventBus"],jr.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)},jr.prototype.isActive=function(e){return e&&this._active===e},jr.prototype.length=function(e){return this._tools.length},jr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},jr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(o){var r=o.context;if(!r.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),W(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,hD,function(o){this._active&&(gD(o)||this.setActive(null))},this)};function gD(e){var t=e.originalEvent&&e.originalEvent.target;return t&&kr(t,'.group[data-group="tools"]')}const iu={__depends__:[Ro],__init__:["toolManager"],toolManager:["type",jr]};function mD(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 yD(e,t){var n=[],i=new Set(e);W(t,function(r){i.add(r)});var o=new Set;return i.forEach(function(r){var a=r.incoming,s=r.outgoing;W(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(o.has(c)||(o.add(c),n.push(c)))})}),n}function vD(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 ch=Math.abs,bD=Math.round,Co={x:"width",y:"height"},uw="crosshair",or={n:"top",w:"left",s:"bottom",e:"right"},xD=1500,ou={n:"s",w:"e",s:"n",e:"w"},ru=20;function Ai(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",xD,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&fw(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){fw(c);var h={x:0,y:0};h[u]=bD(c["d"+u]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(m){s.activateSelection(m.originalEvent,!0,!0)})}})}Ai.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Ai.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:uw,data:{context:{reactivate:n}},trapClick:!1})},Ai.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:uw,data:{context:{}}})},Ai.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},Ai.prototype.init=function(e,t){var n=ch(e.dx)>ch(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(ch(i)<5)return!1;i<0&&(i*=-1),$s(e)&&(i*=-1);var r=mD(n,i),a=this._canvas.getRootElement();!Ul(e)&&e.hover&&(a=e.hover);var s=[..._s(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,o),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:r,shapes:c.resizingShapes,start:o}),u=wD(c,n,r,o,l);return q(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),eu("resize-"+(n==="x"?"ew":"ns")),!0},Ai.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 W(e,function(d){if(!(!d.parent||rt(d))){if(Lt(d)){u.push(d);return}var g=d[t],h=g+d[Co[t]];if(_D(d)&&(n>0&&Xe(d)[t]>i||n<0&&Xe(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}}}),W(r,function(d){var g=d.attachers;g&&W(g,function(h){p(h)})}),W(l,function(d){var g=d.host;(s.has(g)||c.has(g))&&p(d)}),W(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}},Ai.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Ai.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function pw(e){return{top:e.top-ru,right:e.right+ru,bottom:e.bottom+ru,left:e.left-ru}}function fw(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;Ke(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Ke(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Ke(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),Ke(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function wD(e,t,n,i,o){var r=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(r),p=new Set(a);return W(a,function(f){var d=f.attachers,g=f.children,h=Ge(f),m=ct(g,function(G){return!Lt(G)&&!rt(G)&&!u.has(G)&&!p.has(G)}),w=ct(g,function(G){return!Lt(G)&&!rt(G)&&u.has(G)}),y,v,x,E=[],A=[],D,P,T,j;m.length&&(v=pw(Ge(ln(m))),y=i-h[or[n]]+v[or[n]],n==="n"?s.bottom=l=Ke(l)?Math.min(l,y):y:n==="w"?s.right=l=Ke(l)?Math.min(l,y):y:n==="s"?s.top=c=Ke(c)?Math.max(c,y):y:n==="e"&&(s.left=c=Ke(c)?Math.max(c,y):y)),w.length&&(x=pw(Ge(ln(w))),y=i-x[or[ou[n]]]+h[or[ou[n]]],n==="n"?s.bottom=l=Ke(l)?Math.min(l,y):y:n==="w"?s.right=l=Ke(l)?Math.min(l,y):y:n==="s"?s.top=c=Ke(c)?Math.max(c,y):y:n==="e"&&(s.left=c=Ke(c)?Math.max(c,y):y)),d&&d.length&&(d.forEach(function(G){u.has(G)?E.push(G):A.push(G)}),E.length&&(D=Ge(ln(E.map(Xe))),P=h[or[ou[n]]]-(D[or[ou[n]]]-i)),A.length&&(T=Ge(ln(A.map(Xe))),j=T[or[n]]-(h[or[n]]-i)),n==="n"?(y=Math.min(P||1/0,j||1/0),s.bottom=l=Ke(l)?Math.min(l,y):y):n==="w"?(y=Math.min(P||1/0,j||1/0),s.right=l=Ke(l)?Math.min(l,y):y):n==="s"?(y=Math.max(P||-1/0,j||-1/0),s.top=c=Ke(c)?Math.max(c,y):y):n==="e"&&(y=Math.max(P||-1/0,j||-1/0),s.left=c=Ke(c)?Math.max(c,y):y));var F=o&&o[f.id];F&&(n==="n"?(y=i+f[Co[t]]-F[Co[t]],s.bottom=l=Ke(l)?Math.min(l,y):y):n==="w"?(y=i+f[Co[t]]-F[Co[t]],s.right=l=Ke(l)?Math.min(l,y):y):n==="s"?(y=i-f[Co[t]]+F[Co[t]],s.top=c=Ke(c)?Math.max(c,y):y):n==="e"&&(y=i-f[Co[t]]+F[Co[t]],s.left=c=Ke(c)?Math.max(c,y):y))}),s}}function _D(e){return!!e.host}var lh="djs-dragging",dw="djs-resizing",ED=250,au=Math.max;function hw(e,t,n,i,o){function r(a,s){W(a,function(c){o.addDragger(c,s),n.addMarker(c,lh)})}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=Ne("g");Pe(u,i.cls("djs-crosshair-group",["no-events"])),Je(s,u);var p=Ne("path");Pe(p,"d",l.x),dt(p).add("djs-crosshair"),Je(u,p);var f=Ne("path");Pe(f,"d",l.y),dt(f).add("djs-crosshair"),Je(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Dn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&cn(c)}),e.on("spaceTool.move",ED,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=Ne("path"),Pe(c,"d","M0,0 L0,0"),dt(c).add("djs-crosshair"),Je(f,c),s.line=c;var d=Ne("g");Pe(d,i.cls("djs-drag-group",["no-events"])),Je(n.getActiveLayer(),d),r(u,d);var g=new Set(u);W(p,function(A){g.add(A)});var h=new Set,m=s.movingConnections=[];g.forEach(function(A){W(A.outgoing,function(D){h.has(D)||!Lt(D)||!g.has(D.target)||(h.add(D),m.push(D))})}),r(m,d),s.dragGroup=d}if(!s.frameGroup){var w=Ne("g");Pe(w,i.cls("djs-frame-group",["no-events"])),Je(n.getActiveLayer(),w);var y=[];W(p,function(A){var D=o.addFrame(A,w),P=D.getBBox();y.push({element:D,initialBounds:P}),n.addMarker(A,dw)}),s.frameGroup=w,s.frames=y}var v={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Pe(c,{d:v[l]});var x={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[x[s.axis]]=0,Dn(s.dragGroup,E.x,E.y),W(s.frames,function(A){var D=A.element,P=A.initialBounds,T,j;s.direction==="e"?Pe(D,{width:au(P.width+E.x,5)}):(T=au(P.width-E.x,5),Pe(D,{width:T,x:P.x+P.width-T})),s.direction==="s"?Pe(D,{height:au(P.height+E.y,5)}):(j=au(P.height-E.y,5),Pe(D,{height:j,y:P.y+P.height-j}))})}}),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;W(c,function(g){n.removeMarker(g,lh)}),W(l,function(g){n.removeMarker(g,lh)}),f&&(cn(p),cn(f)),W(u,function(g){n.removeMarker(g,dw)}),d&&cn(d)})}hw.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const SD={__init__:["spaceToolPreview"],__depends__:[Ro,oo,iu,Ba,Hs],spaceTool:["type",Ai],spaceToolPreview:["type",hw]};function su(e,t){e.invoke(Ai,this),this._canvas=t}su.$inject=["injector","canvas"],De(su,Ai),su.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=ra(ba(o.children.filter(l=>M(l,"bpmn:Artifact")),ln(r))));const s=[...e,...a];var c=Ai.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(M(l,"bpmn:TextAnnotation")||RD(l)&&(t==="y"&&En(l)||t==="x"&&!En(l)))}),c};function RD(e){return M(e,"bpmn:Participant")&&!be(e).processRef}const gw={__depends__:[SD],spaceTool:["type",su]};function Kt(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Kt.$inject=["eventBus","injector"],Kt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Kt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let o=this._fire(e,"canExecute",n);if(o===void 0){if(!i)return!1;i.canExecute&&(o=i.canExecute(t))}return o},Kt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Kt.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Kt.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Kt.prototype.register=function(e,t){this._setHandler(e,t)},Kt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Kt.prototype.canUndo=function(){return!!this._getUndoAction()},Kt.prototype.canRedo=function(){return!!this._getRedoAction()},Kt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Kt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Kt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},Kt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let o;n=this._eventBus.createEvent(n);for(const r of i)if(o=this._eventBus.fire("commandStack."+r,n),n.cancelBubble)break;return o},Kt.prototype._createId=function(){return this._uid++},Kt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Kt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,o=this._getHandler(n);if(!o)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),o.preExecute&&o.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),o.execute&&this._markDirty(o.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),o.postExecute&&o.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Kt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Kt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Kg("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Kt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Ye(e)?e:[e],t.dirty=t.dirty.concat(e))},Kt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Kt.prototype._revertedAction=function(e){this._stackIdx--},Kt.prototype._getHandler=function(e){return this._handlerMap[e]},Kt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const CD={commandStack:["type",Kt]};function rr(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 MD=250,mw=1400;function uh(e,t,n){ve.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",mw,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=yw(a),r.validatedShapes=yw(s)}),i&&t.on("shape.move.start",MD,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",mw,function(o){var r=o.context,a=r.closure,s=a.enclosedElements,c=[];W(s,function(l){W(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(o){var r=o.context,a=r.connection||r.shape;rr(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=Gf(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&&(an(s.labels,a,c),a.labelTarget=s)})}De(uh,ve),uh.$inject=["injector","eventBus","modeling"];function yw(e){var t=new Set(e);return ct(e,function(n){return!t.has(n.labelTarget)})}const AD={__init__:["labelSupport"],labelSupport:["type",uh]};var PD=251,vw=1401,bw="attach-ok";function ph(e,t,n,i,o){ve.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",vw,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=TD(c),s.validatedShapes=kD(l)}),r&&t.on("shape.move.start",PD,function(a){var s=a.context,c=s.shapes,l=fh(c);W(l,function(u){r.makeDraggable(s,u,!0),W(u.labels,function(p){r.makeDraggable(s,p,!0)})})}),r&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var l=c[0],u=l.host;u&&(n.addMarker(u,bw),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,bw)}))}}),this.preExecuted("elements.move",vw,function(a){var s=a.context,c=s.closure,l=s.shapes,u=fh(l);W(u,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=ct(c,function(p){var f=p.host;return OD(p)&&!DD(c,f)}),W(u,function(p){o.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;W(s,function(c){W(c.attachers,function(l){W(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)}),W(l.incoming.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&o.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;rr(c.attachers,function(u){var p=i.allowed("elements.move",{target:l,shapes:[u]});p==="attach"?o.updateAttachment(u,l):o.removeShape(u)}),l.attachers.length&&W(l.attachers,function(u){var p=Nb(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&&W(p,function(d){var g=Nb(d,l,u);o.moveShape(d,g,d.parent),W(d.labels,function(h){o.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;rr(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}De(ph,ve),ph.$inject=["injector","eventBus","canvas","rules","modeling"];function fh(e){return kp(Fn(e,function(t){return t.attachers||[]}))}function TD(e){var t=fh(e);return kS("id",e,t)}function kD(e){var t=aa(e,"id");return ct(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function OD(e){return!!e.host}function DD(e,t){return e.indexOf(t)!==-1}const LD={__depends__:[oo],__init__:["attachSupport"],attachSupport:["type",ph]};function xw(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(fv(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)})}xw.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const dh={__init__:["changeSupport"],changeSupport:["type",xw]};function Pi(e){this._model=e}Pi.$inject=["moddle"],Pi.prototype._needsId=function(e){return at(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"])},Pi.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":at(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))},Pi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Pi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Pi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",q({bpmnElement:e,bounds:this.createDiBounds()},t))},Pi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Pi.prototype.createDiWaypoints=function(e){var t=this;return Fn(e,function(n){return t.createDiWaypoint(n)})},Pi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",$i(e,["x","y"]))},Pi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",q({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Pi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",q({bpmnElement:e},t))};function ci(e,t,n){ve.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"],li(r)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],li(a));function s(d){var g=d.context,h=g.oldRoot,m=h.children;W(m,function(w){M(w,"bpmn:BaseElement")&&i.updateParent(w)})}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"],li(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],li(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"],li(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],li(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],li(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],li(u)),this.executed("connection.reconnect",li(function(d){var g=d.context,h=g.connection,m=g.oldSource,w=g.newSource,y=be(h),v=be(m),x=be(w);y.conditionExpression&&!at(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=y.conditionExpression,delete y.conditionExpression),m!==w&&v.default===y&&(g.oldDefault=v.default,delete v.default)})),this.reverted("connection.reconnect",li(function(d){var g=d.context,h=g.connection,m=g.oldSource,w=g.newSource,y=be(h),v=be(m),x=be(w);g.oldConditionExpression&&(y.conditionExpression=g.oldConditionExpression),g.oldDefault&&(v.default=g.oldDefault,delete x.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],li(p)),this.reverted(["element.updateAttachment"],li(p)),this.executed("element.updateLabel",li(f)),this.reverted("element.updateLabel",li(f));function f(d){const{element:g}=d.context,h=vi(g),m=yt(g),w=m&&m.get("label");Qo(g)||ql(g)||(h&&!w?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&w&&m.set("label",void 0))}}De(ci,ve),ci.$inject=["eventBus","bpmnFactory","connectionDocking"],ci.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},ci.prototype.updateParent=function(e,t){if(!rt(e)&&!(M(e,"bpmn:DataStoreReference")&&e.parent&&M(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=yt(e),r=n&&n.businessObject,a=yt(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)}},ci.prototype.updateBounds=function(e){var t=yt(e),n=BD(e);if(n){var i=Vi(n,t.get("bounds"));q(n,{x:e.x+i.x,y:e.y+i.y})}var o=rt(e)?this._getLabel(t):t,r=o.bounds;r||(r=this._bpmnFactory.createDiBounds(),o.set("bounds",r)),q(r,{x:e.x,y:e.y,width:e.width,height:e.height})},ci.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,o;M(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),on(i,e)),M(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),an(o,e))}},ci.prototype.updateDiConnection=function(e,t,n){var i=yt(e),o=yt(t),r=yt(n);i.sourceElement&&i.sourceElement.bpmnElement!==be(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==be(n)&&(i.targetElement=n&&r)},ci.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):(on(n,e),e.$parent=null)}};function ID(e){for(;e&&!M(e,"bpmn:Definitions");)e=e.$parent;return e}ci.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)},ci.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=ID(e.$parent||t),e.$parent&&(on(r.get("rootElements"),o),o.$parent=null),t&&(an(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),on(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);on(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},ci.prototype.updateConnectionWaypoints=function(e){var t=yt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},ci.prototype.updateConnection=function(e){var t=e.connection,n=be(t),i=t.source,o=be(i),r=t.target,a=be(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&&(on(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(on(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)},ci.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function li(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;M(i,"bpmn:BaseElement")&&e(t)}}function BD(e){if(M(e,"bpmn:Activity")){var t=yt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function ar(e,t){wo.call(this),this._bpmnFactory=e,this._moddle=t}De(ar,wo),ar.$inject=["bpmnFactory","moddle"],ar.prototype._baseCreate=wo.prototype.create,ar.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,q({type:"label",di:n},Lr,t))}return this.createElement(e,t)},ar.prototype.createElement=function(e,t){t=q({},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(!$D(o)){var r=q({},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=q({isFrame:!0},t)),t=ND(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=hh(o,t,"isExpanded")),at(i,["bpmn:Lane","bpmn:Participant"])&&(t=hh(o,t,"isHorizontal")),M(i,"bpmn:SubProcess")&&(t.collapsed=!ht(i,o)),M(i,"bpmn:ExclusiveGateway")&&(ti(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),mn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),mn(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,o),t=q({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},ar.prototype.getDefaultSize=function(e,t){var n=be(e);if(t=t||yt(e),M(n,"bpmn:SubProcess"))return ht(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 ht(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}},ar.prototype.createParticipantShape=function(e){return yn(e)||(e={isExpanded:e}),e=q({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function ND(e,t,n){return W(n,function(i){t=hh(e,t,i)}),t}function hh(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Ki(t,[n]))}function $D(e){return at(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function cu(e,t){this._modeling=e,this._canvas=t}cu.$inject=["modeling","canvas"],cu.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;W(n,function(o){var r={x:0,y:0};mn(i.left)?r.x=i.left-o.x:mn(i.right)?r.x=i.right-o.width-o.x:mn(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:mn(i.top)?r.y=i.top-o.y:mn(i.bottom)?r.y=i.bottom-o.height-o.y:mn(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},cu.prototype.postExecute=function(e){};function lu(e){this._modeling=e}lu.$inject=["modeling"],lu.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},lu.prototype.postExecute=function(e){var t=e.hints||{};FD(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 FD(e,t){return No(e.outgoing,function(n){return n.target===t})}function uu(e,t){this._canvas=e,this._layouter=t}uu.$inject=["canvas","layouter"],uu.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},uu.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var pu=Math.round;function gh(e){this._modeling=e}gh.$inject=["modeling"],gh.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,a=this._modeling;W(t,function(p){Ke(p.x)||(p.x=0),Ke(p.y)||(p.y=0)});var s=ct(t,function(p){return!p.hidden}),c=ln(s);W(t,function(p){Lt(p)&&(p.waypoints=Fn(p.waypoints,function(f){return{x:pu(f.x-c.x-c.width/2+o.x),y:pu(f.y-c.y-c.height/2+o.y)}})),q(p,{x:pu(p.x-c.x-c.width/2+o.x),y:pu(p.y-c.y-c.height/2+o.y)})});var l=new Set(dl(t)),u={};W(t,function(p){if(Lt(p)){u[p.id]=Ke(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=q({},r);l.has(p)||(f.autoResize=!1),rt(p)&&(f=Ki(f,["attach"])),u[p.id]=Ke(i)?a.createShape(p,$i(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,$i(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=ra(u)};var ww=Math.round;function sr(e){this._canvas=e}sr.$inject=["canvas"],sr.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?q(t,n):q(t,{x:n.x-ww(t.width/2),y:n.y-ww(t.height/2)}),this._canvas.addShape(t,i,o),t},sr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Gs(e){sr.call(this,e)}De(Gs,sr),Gs.$inject=["canvas"];var jD=sr.prototype.execute;Gs.prototype.execute=function(e){var t=e.shape;return zD(t),t.labelTarget=e.labelTarget,jD.call(this,e)};var HD=sr.prototype.revert;Gs.prototype.revert=function(e){return e.shape.labelTarget=null,HD.call(this,e)};function zD(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Vs(e,t){this._canvas=e,this._modeling=t}Vs.$inject=["canvas","modeling"],Vs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;rr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),rr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Vs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Gf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Vs.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,an(n.children,t,i),this._canvas.addConnection(t,n),t};function mh(e,t){this._modeling=e,this._elementRegistry=t}mh.$inject=["modeling","elementRegistry"],mh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;W(i,function(o){n.get(o.id)&&(o.waypoints?t.removeConnection(o):t.removeShape(o))})};function Ws(e,t){this._canvas=e,this._modeling=t}Ws.$inject=["canvas","modeling"],Ws.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;rr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),rr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),rr(n.children,function(i){Lt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Ws.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Gf(i.children,n),t.removeShape(n),n},Ws.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return an(i.children,n,o),t.addShape(n,i),n};function fu(e){this._modeling=e}fu.$inject=["modeling"];var _w={x:"y",y:"x"};fu.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(m,w){m.range.min=Math.min(w[i],m.range.min),m.range.max=Math.max(w[i]+w[o],m.range.max)}function a(m){return m[i]+m[o]/2}function s(m){return m.length-1}function c(m){return m.max-m.min}function l(m,w){var y={y:0};y[i]=m-a(w),y[i]&&(y[_w[i]]=0,t.moveElements([w],y,w.parent))}var u=n[0],p=s(n),f=n[p],d,g,h=0;W(n,function(m,w){var y,v,x;if(m.elements.length<2){w&&w!==n.length-1&&(r(m,m.elements[0]),h+=c(m.range));return}y=Yi(m.elements,i),v=y[0],w===p&&(v=y[s(y)]),x=a(v),m.range=null,W(y,function(E){if(l(x,E),m.range===null){m.range={min:E[i],max:E[i]+E[o]};return}r(m,E)}),w&&w!==n.length-1&&(h+=c(m.range))}),g=Math.abs(f.range.min-u.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&W(n,function(m,w){var y={},v;m===u||m===f||(v=n[w-1],m.range.max=0,W(m.elements,function(x,E){y[_w[i]]=0,y[i]=v.range.max-x[i]+d,m.range.min!==x[i]&&(y[i]+=x[i]-m.range.min),y[i]&&t.moveElements([x],y,x.parent),m.range.max=Math.max(x[i]+x[o],E?m.range.max:0)}))})},fu.prototype.postExecute=function(e){};function du(e,t){this._layouter=e,this._canvas=t}du.$inject=["layouter","canvas"],du.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return q(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},du.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function yh(){}yh.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=on(r.children,t),an(i.children,t,o),t.parent=i,W(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},yh.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return on(n.children,t),an(i.children,t,o),t.parent=i,W(t.waypoints,function(a){a.x-=r.x,a.y-=r.y,a.original&&(a.original.x-=r.x,a.original.y-=r.y)}),t};function vh(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}vh.prototype.add=function(e,t){return this.addAll([e],t)},vh.prototype.addAll=function(e,t){var n=vP(e,!!t,this);return q(this,n),this};function Us(e){this._modeling=e}Us.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Us.prototype.moveClosure=function(e,t,n,i,o){var r=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;o&&o.parent===n&&(u=!0),W(a,function(p){r.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),W(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?r.moveConnection(p,t,l[p.id]&&!u&&n):r.layoutConnection(p,{connectionStart:f&&Rd(p,p.source,t),connectionEnd:d&&Cd(p,p.target,t)})})},Us.prototype.getClosure=function(e){return new vh().addAll(e,!0)};function hu(e){this._helper=new Us(e)}hu.$inject=["modeling"],hu.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},hu.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 Hr(e){this._modeling=e,this._helper=new Us(e)}Hr.$inject=["modeling"],Hr.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=$i(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=on(r.children,t),an(i.children,t,o),q(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Hr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(W(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:Cd(r,t,n)})}),W(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:Rd(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Hr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return an(n.children,t,i),q(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},Hr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Hr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function qs(e){this._modeling=e}qs.$inject=["modeling"],qs.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 Ye(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},qs.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||Ew(Ye(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||Ew(Ye(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},qs.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 Ew(e){return e.original||e}function Mo(e,t){this._modeling=e,this._rules=t}Mo.$inject=["modeling","rules"],Mo.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();W(f,function(g){var h=g.source,m=c(h,s,g);m&&t.reconnectEnd(g,s,Hl(g,s,u),a)}),W(d,function(g){var h=g.target,m=c(s,h,g);m&&t.reconnectStart(g,s,jl(g,s,u),a)})},Mo.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Mo.prototype.execute=function(e){},Mo.prototype.revert=function(e){},Mo.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Mo.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Mo.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Ys(e){this._modeling=e}Ys.$inject=["modeling"],Ys.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},q(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ys.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(W(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:Hl(r,n,i)})}),W(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:jl(r,n,i)})}))},Ys.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return q(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function cr(e){this._modeling=e}cr.$inject=["modeling"],cr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,o=e.resizingShapes,r=e.start,a={};this.moveShapes(i,t),W(o,function(s){a[s.id]=VD(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(yD(i,o),t,n,r,i,o,a)},cr.prototype.execute=function(){},cr.prototype.revert=function(){},cr.prototype.moveShapes=function(e,t){var n=this;W(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},cr.prototype.resizeShapes=function(e,t,n){var i=this;W(e,function(o){var r=vD(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},cr.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);W(e,function(u){var p=u.source,f=u.target,d=GD(u),g=Rw(n),h={},m=c.has(p)||l.has(p),w=c.has(f)||l.has(f);m&&w?(d=Fn(d,function(y){return Cw(y,i,n)&&(y[g]=y[g]+t[g]),y.original&&Cw(y.original,i,n)&&(y.original[g]=y.original[g]+t[g]),y}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(m||w)&&(c.has(p)?h.connectionStart=Rd(u,p,t):c.has(f)?h.connectionEnd=Cd(u,f,t):l.has(p)?h.connectionStart=jl(u,p,a[p.id]):l.has(f)&&(h.connectionEnd=Hl(u,f,a[f.id])),s._modeling.layoutConnection(u,h))})};function Sw(e){return q({},e)}function GD(e){return Fn(e.waypoints,function(t){return t=Sw(t),t.original&&(t.original=Sw(t.original)),t})}function Rw(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Cw(e,t,n){var i=Rw(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function VD(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function gu(e){this._modeling=e}gu.$inject=["modeling"],gu.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Mw(n),t.collapsed=!t.collapsed;var i=Aw(n,t.collapsed);return[t].concat(i)},gu.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=Pw(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function Mw(e){var t={};return W(e,function(n){t[n.id]=n.hidden,n.children&&(t=q({},t,Mw(n.children)))}),t}function Aw(e,t){var n=[];return W(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Aw(i.children,i.collapsed||t)))}),n}function Pw(e,t){var n=[];return W(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Pw(i.children,t)))}),n}function mu(e){this._modeling=e}mu.$inject=["modeling"],mu.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Tw(i,t),kw(n,t),t.host=n,t},mu.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,Tw(n,t),kw(i,t,o),t};function Tw(e,t){return on(e&&e.attachers,t)}function kw(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),an(i,t,n)}}function bh(){}bh.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},bh.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function It(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}It.$inject=["eventBus","elementFactory","commandStack"],It.prototype.getHandlers=function(){return{"shape.append":lu,"shape.create":sr,"shape.delete":Ws,"shape.move":Hr,"shape.resize":Ys,"shape.replace":Mo,"shape.toggleCollapse":gu,spaceTool:cr,"label.create":Gs,"connection.create":uu,"connection.delete":Vs,"connection.move":yh,"connection.layout":du,"connection.updateWaypoints":bh,"connection.reconnect":qs,"elements.create":gh,"elements.move":hu,"elements.delete":mh,"elements.distribute":fu,"elements.align":cu,"element.updateAttachment":mu}},It.prototype.registerHandlers=function(e){W(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},It.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)},It.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},It.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)},It.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)},It.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},It.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},It.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},It.prototype.createElements=function(e,t,n,i,o){Ye(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},It.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},It.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},It.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},It.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},It.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},It.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},It.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},It.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},It.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},It.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)},It.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},It.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)},It.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,q(i,{docking:"source"}))},It.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,q(i,{docking:"target"}))},It.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},It.prototype._create=function(e,t){return iT(t)?t:this._elementFactory.create(e,t)},It.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ks(e){this._elementRegistry=e}Ks.$inject=["elementRegistry"],Ks.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||WD(n,kc(i));return Ow(n,i),e.oldProperties=r,e.changed=o,o},Ks.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Ow(n,t),i},Ks.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return M(e,"bpmn:DataObject")?UD(e,t):[]};function WD(e,t){return ni(t,function(n,i){return n[i]=e.get(i),n},{})}function Ow(e,t){W(t,function(n,i){e.set(i,n)})}function UD(e,t){return t.filter(function(n){return M(n,"bpmn:DataObjectReference")&&be(n).dataObjectRef===e})}var Xs="default",Ao="id",Dw="di",qD={width:0,height:0};function Zs(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Zs.$inject=["elementRegistry","moddle","modeling","textRenderer"],Zs.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=QD(e.properties),s=e.oldProperties||YD(t,a);return Lw(a,r)&&(o.unclaim(r[Ao]),i.updateId(t,a[Ao]),o.claim(a[Ao],r)),Xs in a&&(a[Xs]&&n.push(i.get(a[Xs].id)),r[Xs]&&n.push(i.get(r[Xs].id))),Iw(t,a),e.oldProperties=s,e.changed=n,n},Zs.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&be(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,qD)}},Zs.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 Iw(t,i),Lw(n,o)&&(a.unclaim(n[Ao]),r.updateId(t,i[Ao]),a.claim(i[Ao],o)),e.changed};function Lw(e,t){return Ao in e&&e[Ao]!==t[Ao]}function YD(e,t){var n=kc(t),i=e.businessObject,o=yt(e);return ni(n,function(r,a){return a!==Dw?r[a]=i.get(a):r[a]=KD(o,kc(t.di)),r},{})}function KD(e,t){return ni(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Iw(e,t){var n=e.businessObject,i=yt(e);W(t,function(o,r){r!==Dw?n.set(r,o):i&&XD(i,o)})}function XD(e,t){W(t,function(n,i){e.set(i,n)})}var ZD=["default"];function QD(e){var t=q({},e);return ZD.forEach(function(n){n in e&&(t[n]=be(t[n]))}),t}function yu(e,t){this._canvas=e,this._modeling=t}yu.$inject=["canvas","modeling"],yu.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=t.getRootElement(),r=o.businessObject,a=r.$parent,s=yt(o);return t.setRootElement(n),t.removeRootElement(o),an(a.rootElements,i),i.$parent=a,on(a.rootElements,r),r.$parent=null,o.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=o,[]},yu.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=e.oldRoot,r=o.businessObject,a=i.$parent,s=yt(n);return t.setRootElement(o),t.removeRootElement(n),on(a.rootElements,i),i.$parent=null,an(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function xh(e,t){this._modeling=e,this._spaceTool=t}xh.$inject=["modeling","spaceTool"],xh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,o=e.location,r=Ri(i),a=r===i,s=a?i:i.parent,c=er(s),l=En(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+Si,y:i.y,width:i.width-Si,height:i.height}:{x:i.x,y:i.y+Si,width:i.width,height:i.height-Si};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];Dr(r,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:ct(x.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 w=t.calculateAdjustments(p,m,f,g),y=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(w.movingShapes,w.resizingShapes,y,h,g);var v=l?{x:i.x+(a?Si:0),y:d-(o==="top"?120:0),width:i.width-(a?Si:0),height:120}:{x:d-(o==="left"?120:0),y:i.y+(a?Si:0),width:120,height:i.height-(a?Si:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},v,s)};function wh(e){this._modeling=e}wh.$inject=["modeling"],wh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=er(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=En(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+Si,y:n.y+f*c,width:n.width-Si,height:l}:{x:n.x+f*c,y:n.y+Si,width:l,height:n.height-Si},f<r?t.resizeShape(o[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function Qs(e,t){this._modeling=e,this._spaceTool=t}Qs.$inject=["modeling","spaceTool"],Qs.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Qs.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=Uk(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},Qs.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Ge(e),o=Ge(t),r=db(o,i),a=Ri(e),s=[],c=[];Dr(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 Js="flowNodeRef",_h="lanes";function vu(){}vu.prototype._computeUpdates=function(e,t){var n=[],i=[],o={},r=[];function a(u,p){var f=Ge(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=Ri(u);return o[p.id]||(o[p.id]=Il(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=Ri(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(_h),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(Js).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},vu.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,o=i.get(_h);n.remove.forEach(function(r){on(o,r),on(r.get(Js),i)}),n.add.forEach(function(r){an(o,r),an(r.get(Js),i)})}),[]},vu.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get(_h);n.add.forEach(function(r){on(o,r),on(r.get(Js),i)}),n.remove.forEach(function(r){an(o,r),an(r.get(Js),i)})}),[]};var Eh="categoryValueRef";function ec(e,t){this._bpmnFactory=e,this._elementRegistry=t}ec.$inject=["bpmnFactory","elementRegistry"],ec.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(y,v,x){if(v){var E=a.get(y);E||(E={},a.set(y,E)),!(x&&E.present)&&(!x&&E.past||(x?E.present={categoryValue:v,root:Sh(y)}:E.past={categoryValue:v}))}}function c(y){o.set(y,be(y))}function l(){n.filter(function(y){return M(y,"bpmn:FlowElement")&&!rt(y)&&y.parent}).forEach(c)}function u(y){var v=be(y),x=v.get("categoryValueRef");return x||(x=cb(i,v),r.push(JD(y,x))),x}function p(y){return y.reduce(function(v,x){var E=Sh(x),A=v.get(E);return A||(A=[],v.set(E,A)),A.push(x),v},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(y){return M(y,"bpmn:Group")&&!rt(y)&&y.parent}).forEach(function(y){var v=be(y).get("categoryValueRef");if(!v){var x=Sh(y),E=f.get(x)||[],A=ba(E,y),D=Object.keys(A).length>0;D&&(v=u(y))}s(y,v,!0)}),t.forEach(function(y){s(y.groupShape,y.categoryValue,!1)}),r.length&&l();var d=Array.from(o.keys()),g=Array.from(a.values()).reduce(function(y,v){return v.present&&y.add(v.present.categoryValue),v.past&&y.add(v.past.categoryValue),y},new Set),h=new Map,m=p(d);a.forEach(function(y,v){var x=y.present;if(x){var E=m.get(x.root)||[],A=ba(E,v);E.forEach(function(D){if(A[D.id]){var P=h.get(D);P||(P=new Set,h.set(D,P)),P.add(x.categoryValue)}})}});var w=d.reduce(function(y,v){var x=o.get(v),E=x.get(Eh),A=new Set(E),D=h.get(v)||new Set,P=Array.from(D).filter(function(j){return!A.has(j)}),T=E.filter(function(j){return g.has(j)&&!D.has(j)});return(P.length||T.length)&&y.push({businessObject:x,categoryValuesToAdd:P,categoryValuesToRemove:T}),y},[]);return{flowElements:w,groups:r}},ec.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),eL(t.groups),nL(t.flowElements),[]},ec.prototype.revert=function(e){var t=e.updates;return iL(t.flowElements),tL(t.groups),[]};function JD(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function eL(e){e.forEach(function(t){be(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function tL(e){e.forEach(function(t){be(t.groupShape).categoryValueRef=null})}function nL(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Eh);t.categoryValuesToRemove.forEach(function(o){on(i,o)}),t.categoryValuesToAdd.forEach(function(o){an(i,o,!0)})})}function iL(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Eh);t.categoryValuesToAdd.forEach(function(o){on(i,o)}),t.categoryValuesToRemove.forEach(function(o){an(i,o,!0)})})}function Sh(e){for(;e.parent;)e=e.parent;return e}function bu(e){this._moddle=e}bu.$inject=["moddle"],bu.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,o=e.claiming;return o?t.claim(n,i):t.unclaim(n),[]},bu.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,o=e.claiming;return o?t.unclaim(n):t.claim(n,i),[]};var oL={fill:void 0,stroke:void 0};function Rh(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(ei(t)){var n=rL(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Rh.$inject=["commandStack"],Rh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||oL,i=this,o={};"fill"in n&&q(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&q(o,{"border-color":this._normalizeColor(n.stroke)}),W(t,function(r){var a=Lt(r)?$i(o,["border-color"]):o,s=yt(r);if(aL(a),rt(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(!at(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function rL(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 aL(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var sL={width:0,height:0};function Bw(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return IT(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!rt(l)&&Qo(l)&&!_l(l)&&!Nw(p)){var f=7,d=Kf(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=vi(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(!(!rt(u)&&!M(u,"bpmn:TextAnnotation"))){if(rt(u)&&Nw(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var g=vi(l);typeof f>"u"&&(f=t.getExternalLabelBounds(u,g)),f&&e.resizeShape(u,f,sL)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}Bw.$inject=["modeling","textRenderer","bpmnFactory"];function Nw(e){return!e||!e.trim()}function In(e,t,n,i){It.call(this,e,t,n),this._bpmnRules=i}De(In,It),In.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],In.prototype.getHandlers=function(){var e=It.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ks,e["element.updateProperties"]=Zs,e["canvas.updateRoot"]=yu,e["lane.add"]=xh,e["lane.resize"]=Qs,e["lane.split"]=wh,e["lane.updateRefs"]=vu,e["group.updateRefs"]=ec,e["id.updateClaim"]=bu,e["element.setColor"]=Rh,e["element.updateLabel"]=Bw,e},In.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},In.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)},In.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},In.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},In.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},In.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},In.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},In.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},In.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},In.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},In.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},In.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},In.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},In.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function $w(){}$w.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Xe(t.source||e.source),t.connectionEnd||Xe(t.target||e.target)]};var xu=20,cL=5,wu=Math.round,Fw=20,lL={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function uL(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function pL(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function jw(e,t,n){var i=On(t,e,cL),o=n.split(":")[0],r=wu((t.x-e.x)/2+e.x),a=wu((t.y-e.y)/2+e.y),s,c,l=pL(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=uL(i,o),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+xu*(/l/.test(o)?-1:1),y:f?a+xu:a}):(f=r===e.x,s={x:f?r+xu:r,y:e.y+xu*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:Ch(e,s,c).concat(s),directions:c,turnNextDirections:f}}function fL(e,t,n){return jw(e,t,n)}function dL(e,t,n){var i=jw(t,e,Hw(n));return{waypoints:i.waypoints.slice().reverse(),directions:Hw(i.directions),turnNextDirections:i.turnNextDirections}}function hL(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=Ch(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function Hw(e){return e.split(":").reverse().join(":")}function gL(e,t,n){var i=wu((t.x-e.x)/2+e.x),o=wu((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 Ch(e,t,n){if(n=n||"h:h",!SL(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Gw(n)){var i=fL(e,t,n),o=dL(e,t,n),r=hL(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return gL(e,t,n)}function mL(e,t,n){var i=Ch(e,t,n);return i.unshift(e),i.push(t),Ww(i)}function yL(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=PS(r,"straight")[0]||"h:h",s=lL[a]||0,c=On(e,t,s),l=EL(c,a);n=n||Xe(e),i=i||Xe(t);var u=l.split(":"),p=Vw(n,e,u[0],RL(c)),f=Vw(i,t,u[1],c);return mL(p,f,l)}function vL(e,t,n,i,o,r){Ye(n)&&(o=n,r=i,n=Xe(e),i=Xe(t)),r=q({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&xL(e,t,n,i,r),c||(c=r.connectionEnd&&_L(t,e,i,o),c)||(c=r.connectionStart&&wL(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:yL(e,t,n,i,r)}function bL(e,t,n){return e>=t&&e<=n}function zw(e,t,n){var i={x:"width",y:"height"};return bL(t[e],n[e],n[e]+n[i[e]])}function xL(e,t,n,i,o){var r={},a,s;return s=On(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),o.preserveDocking==="target"?zw(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:zw(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 wL(e,t,n,i){return Mh(e,t,n,i)}function _L(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:!!$t(u,function(p,f){var d=u[f-1];return d&&Ss(p,d)<3})}function r(u,p,f){var d=bo(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(hv(u[d],p,Fw)||hv(u[d],f,Fw))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&&bo(c)?null:c}function EL(e,t){if(Gw(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 SL(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Gw(e){return e&&/t|r|b|l/.test(e)}function RL(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 Vw(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 Ww(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return Vf(o,r,n,0)||t.push(n),t},[])}var CL=-10,ML=40,AL={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},PL={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},Ah={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},tc={top:"t",right:"r",bottom:"b",left:"l"};function _u(e){this._elementRegistry=e}De(_u,$w),_u.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=Uw(o&&o[0],n)),a||(a=Uw(o&&o[o.length-1],i)),(M(e,"bpmn:Association")||M(e,"bpmn:DataAssociation"))&&o&&!qw(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=ob(n,s)?AL:PL;return M(e,"bpmn:MessageFlow")?c=kL(n,i,u):(M(e,"bpmn:SequenceFlow")||qw(n,i))&&(n===i?c={preferredLayouts:NL(n,e,u)}:M(n,"bpmn:BoundaryEvent")?c={preferredLayouts:$L(n,i,a,u)}:nc(n)||nc(i)?c={preferredLayouts:u.subProcess,preserveDocking:DL(n)}:M(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:M(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=q(c,t),l=Ww(vL(n,i,r,a,o,c))),l||[r,a]};function TL(e){var t=e.host;return On(Xe(e),t,CL)}function kL(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:OL(e,t)}}function OL(e,t){return M(t,"bpmn:Participant")?"source":M(e,"bpmn:Participant")?"target":nc(t)?"source":nc(e)||M(t,"bpmn:Event")?"target":M(e,"bpmn:Event")?"source":null}function DL(e){return nc(e)?"target":"source"}function Uw(e,t){return e?e.original||e:Xe(t)}function qw(e,t){return M(t,"bpmn:Activity")&&M(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function nc(e){return M(e,"bpmn:SubProcess")&&ht(e)}function zr(e,t){return e===t}function LL(e,t){return t.indexOf(e)!==-1}function Na(e){var t=/right|left/.exec(e);return t&&t[0]}function $a(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Yw(e,t){return Ah[e]===t}function IL(e,t){var n=Na(e),i=Ah[n];return t.indexOf(i)!==-1}function BL(e,t){var n=$a(e),i=Ah[n];return t.indexOf(i)!==-1}function Kw(e){return e==="right"||e==="left"}function NL(e,t,n){var i=t.waypoints,o=i&&i.length&&On(i[0],e);return o==="top"?n.loop.fromTop:o==="right"?n.loop.fromRight:o==="left"?n.loop.fromLeft:n.loop.fromBottom}function $L(e,t,n,i){var o=Xe(e),r=Xe(t),a=TL(e),s,c,l=zr(e.host,t),u=LL(a,["top","right","bottom","left"]),p=On(r,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?FL(a,u,e,t,n,i):(s=jL(a,p,u,i.isHorizontal),c=HL(a,p,u,i.isHorizontal),[s+":"+c])}function FL(e,t,n,i,o,r){var a=t?e:r.isHorizontal?$a(e):Na(e),s=tc[a],c;return t?Kw(e)?c=Xw("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=Xw("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function Xw(e,t,n,i){var o=ML;return!(Ph(e,i,n,o)||Ph(e,i,{x:n.x+n.width,y:n.y+n.height},o)||Ph(e,i,Xe(t),o))}function Ph(e,t,n,i){return Math.abs(t[e]-n[e])<i}function jL(e,t,n,i){if(n)return tc[e];var o=$a(e),r=Na(e),a=$a(t),s=Na(t);if(i){if(zr(o,a)||Yw(r,s))return tc[o]}else if(zr(r,s)||Yw(o,a))return tc[r];return tc[i?r:o]}function HL(e,t,n,i){if(n)return Kw(e)?IL(e,t)||zr(e,t)?"h":"v":BL(e,t)||zr(e,t)?"v":"h";var o=$a(e),r=Na(e),a=$a(t),s=Na(t);return a&&!s?"v":s&&!a?"h":i?zr(o,a)?"h":"v":zr(r,s)?"v":"h"}_u.$inject=["elementRegistry"];function Zw(e){return q({original:e.point.original||e.point},e.actual)}function lr(e,t){this._elementRegistry=e,this._graphicsFactory=t}lr.$inject=["elementRegistry","graphicsFactory"],lr.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(Zw(i)),r.push(Zw(o)),r},lr.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}},lr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return Rs(i,o,n)},lr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},lr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},lr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Th={__init__:["modeling","bpmnUpdater"],__depends__:[aO,_O,SO,RO,lw,CD,AD,LD,Mi,dh,gw],bpmnFactory:["type",Pi],bpmnUpdater:["type",ci],elementFactory:["type",ar],modeling:["type",In],layouter:["type",_u],connectionDocking:["type",lr]};var zL=10,Qw=50,GL=250;function kh(e,t,n,i){for(var o;o=VL(e,n,t);)n=i(t,n,o);return n}function Oh(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 VL(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=UL(e);return $t(o,function(r){if(r===n)return!1;var a=On(r,i,zL);return a==="intersect"})}function WL(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||Qw,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||GL,c=t.reference||"start";r||(r=KL);function l(g,h){return o==="n"?c==="start"?Ge(g).top-Ge(h).bottom:c==="center"?Ge(g).top-Xe(h).y:Ge(g).top-Ge(h).top:o==="w"?c==="start"?Ge(g).left-Ge(h).right:c==="center"?Ge(g).left-Xe(h).x:Ge(g).left-Ge(h).left:o==="s"?c==="start"?Ge(h).top-Ge(g).bottom:c==="center"?Xe(h).y-Ge(g).bottom:Ge(h).bottom-Ge(g).bottom:c==="start"?Ge(h).left-Ge(g).right:c==="center"?Xe(h).x-Ge(g).right:Ge(h).right-Ge(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=ni(f,function(g,h){var m=h.distance,w=h.weight;return m<0||m>s||(g[String(m)]||(g[String(m)]=0),g[String(m)]+=1*w,(!g.distance||g[g.distance]<g[String(m)])&&(g.distance=m)),g},{});return d.distance||i}function UL(e){var t=Dh(e);return e.host&&(t=t.concat(Dh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Dh(i))},[]))),t}function Dh(e){return YL(e).concat(qL(e))}function qL(e){return e.incoming.map(function(t){return t.source})}function YL(e){return e.outgoing.map(function(t){return t.target})}function KL(){return!0}var XL=100;function Jw(e,t,n){e.on("autoPlace",XL,function(i){var o=i.shape,r=i.source;return ZL(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}}Jw.$inject=["eventBus","modeling","canvas"];function ZL(e,t,n){n||(n={});var i=n.defaultDistance||Qw,o=Xe(e),r=Ge(e);return{x:r.right+i+t.width/2,y:o.y}}function e_(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}e_.$inject=["eventBus","selection"];const QL={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Jw],autoPlaceSelectionBehavior:["type",e_]};function t_(e,t,n){var i=ob(e,n);if(M(t,"bpmn:TextAnnotation"))return eI(e,t,i);if(at(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return tI(e,t,i);if(M(t,"bpmn:FlowNode"))return JL(e,t,i)}function JL(e,t,n){var i=Ge(e),o=Xe(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=WL(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=On(e,e.host,-25),l.indexOf(r.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:o.y+n_(l,c,r)}:{x:o.x+n_(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return kh(e,t,u,Oh(f))}function n_(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function eI(e,t,n){var i=Ge(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};Lt(e)&&(o=Xe(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 kh(e,t,o,Oh(a))}function tI(e,t,n){var i=Ge(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 kh(e,t,o,Oh(a))}function i_(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return t_(o,i,t)})}i_.$inject=["eventBus","elementRegistry"];const Eu={__depends__:[QL],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",i_]};function Po(e,t,n,i){ve.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=kp(ra(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=aa(s,function(p){return p.parent.id});W(u,function(p,f){Ye(l)&&(p=p.filter(function(d){return $t(l,sa({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)})}Po.$inject=["eventBus","elementRegistry","modeling","rules"],De(Po,ve),Po.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=Ge(ln(e)),r=Ge(t),a={};return o.top-r.top<i.top&&(a.top=o.top-n.top),o.left-r.left<i.left&&(a.left=o.left-n.left),r.right-o.right<i.right&&(a.right=o.right+n.right),r.bottom-o.bottom<i.bottom&&(a.bottom=o.bottom+n.bottom),ml(q({},r,a))},Po.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(nI(i,t)){var o=iI($i(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:o});var r=t.parent;r&&this._expand([t],r)}}},Po.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Po.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Po.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function nI(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function iI(e,t){var n="";return e=Ge(e),t=Ge(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 Su(e){e.invoke(Po,this)}Su.$inject=["injector"],De(Su,Po),Su.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 ic(e){Ci.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}ic.$inject=["eventBus"],De(ic,Ci),ic.prototype.canResize=function(e,t){return!1};function Ru(e,t){ic.call(this,e),this._modeling=t}De(Ru,ic),Ru.$inject=["eventBus","modeling"],Ru.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 W(e,function(i){if(M(i,"bpmn:Lane")||rt(i)){n=!1;return}}),n};const o_={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Su],bpmnAutoResizeProvider:["type",Ru]},oI=1500;class r_{constructor(t){t.on("moddleCopy.canCopyProperties",oI,({sourceElement:n,targetElement:i})=>{var r;if(!((r=n==null?void 0:n.$instanceOf)!=null&&r.call(n,Sr)))return;const o=Cn(n);o!==void 0&&i.set("xml:lang",o)})}}$n(r_,"$inject",["eventBus"]);const a_={__init__:["translationLocaleCopy"],translationLocaleCopy:["type",r_]},rI=500,Cu=1,s_=(e,t)=>{if((e==null?void 0:e.type)!=="bpmn:TextAnnotation"||!(t!=null&&t.original))return;const{x:n,y:i}=t.original;(n<e.x-Cu||n>e.x+e.width+Cu||i<e.y-Cu||i>e.y+e.height+Cu)&&(t.original={x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)})};class c_{constructor(t){t.on("bpmnElement.added",rI,({element:n})=>{if((n==null?void 0:n.type)!=="bpmn:Association")return;const i=n.waypoints;!i||i.length<2||(s_(n.source,i[0]),s_(n.target,i[i.length-1]))})}}$n(c_,"$inject",["eventBus"]);const l_={__init__:["annotationImportDocking"],annotationImportDocking:["type",c_]},u_=[nb,ks,Th,Eu,o_,Hp,a_,l_];function aI(e={}){bm(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new _a({container:t,moddleExtensions:e.moddleExtensions??Fc,additionalModules:[...u_,...e.additionalModules??[]]})}const p_={"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":"풀"},sI={이:["이","가"],을:["을","를"],와:["과","와"]};function cI(e,t){const[n,i]=sI[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 lI={"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":"연관선"},uI="요소";function Lh(e){return(e&&lI[e.type])??uI}const f_=20;function pI(e){const t=e.replace(/\s+/g," ").trim();return t.length>f_?`${t.slice(0,f_)}…`:t}function Mu(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:pI(o.name),a=r===void 0?i+Lh(o):r,s=r===void 0?a:`「${r}」`;return n?s+cI(a,n).slice(a.length):s}function fI(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&&Lh(r)===Lh(a);return[Mu(e,t,i),Mu(e,n,o,s?"다른 ":"")]}function dI(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 hI(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 Au={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function gI(e,t){const n=(o,r)=>Mu(t,o,r),i=(o,r,a,s)=>fI(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)}의 ${Au[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)}의 ${Au[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${Au[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${Au[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 mI(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 d_="기타",Ih={error:0,warning:1,info:2};function h_(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${pt(i)}`,source:"geometry",code:i.kind,severity:dI(i),targetRefs:hI(i),category:p_[i.kind]??d_,message:gI(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:p_[i.ruleId]??d_,message:mI(i,t)});return n}function g_(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function Fa(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function Bh(e,t){if(t===void 0||e.length===0)return!1;const n=Fa(e[0],t);return e.some(i=>Fa(i,t)!==n)}function m_(e,t){const n=Bh(e,t);return e.slice().sort((i,o)=>(n?Number(Fa(o,t))-Number(Fa(i,t)):0)||Ih[i.severity]-Ih[o.severity])}const y_="i18n-untranslated",v_="i18n-review-requested",Nh="i18nDisplay.redrawn",b_=[["untranslated",y_],["reviewRequested",v_]];class $h{constructor(t,n,i,o,r,a,s,c){$n(this,"config");$n(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(Dc,{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(Dc,{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=Rr(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=$o(n).filter(f=>Cn(f)),s=f=>f.body??"",c=a.find(f=>Cn(f)===o&&s(f)),l=Fo(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(Cn);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 b_)r.toggle(g,(o==null?void 0:o.status)===d);if(!o||o.native)return n();const{target:a,key:s}=Rr((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 b_)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(Nh)}}$n($h,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const x_={__depends__:[Hp],__init__:["i18nDisplay"],i18nDisplay:["type",$h]};var yI=new Fr("ov"),vI=500;function An(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=yI,this._overlayDefaults=q({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=bI(n.getContainer()),this._init()}An.$inject=["config.overlays","eventBus","canvas","elementRegistry"],An.prototype.get=function(e){if(ei(e)&&(e={id:e}),ei(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?ct(t.overlays,sa({type:e.type})):t.overlays.slice():[]}else return e.type?ct(this._overlays,sa({type:e.type})):e.id?this._overlays[e.id]:null},An.prototype.add=function(e,t,n){if(yn(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=q({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},An.prototype.remove=function(e){var t=this.get(e)||[];Ye(t)||(t=[t]);var n=this;W(t,function(i){var o=n._getOverlayContainer(i.element,!0);if(i&&(Qi(i.html),Qi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),o){var r=o.overlays.indexOf(i);r!==-1&&o.overlays.splice(r,1)}})},An.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},An.prototype.show=function(){Pu(this._overlayRoot)},An.prototype.hide=function(){Pu(this._overlayRoot,!1)},An.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ll(this._overlayRoot)},An.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=ln(t);i=r.x,o=r.y}w_(n,i,o),Mn(e.html,"data-container-id",t.id)},An.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,o=t.left,r=t.top;if(t.right!==void 0){var a;i.waypoints?a=ln(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=ln(i).height:s=i.height,r=t.bottom*-1+s}w_(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},An.prototype._createOverlayContainer=function(e){var t=zt('<div class="djs-overlays" />');qn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},An.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";__(this._overlayRoot,n)},An.prototype._getOverlayContainer=function(e,t){var n=$t(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},An.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)),ei(i)&&(i=zt(i)),r=this._getOverlayContainer(n),o=zt('<div class="djs-overlay" data-overlay-id="'+t+'">'),qn(o,{position:"absolute"}),o.appendChild(i),e.type&&kt(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Pu(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())},An.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),o=n&&n.minZoom,r=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(mn(o)&&o>t.scale||mn(r)&&r<t.scale))&&(c=!1),Pu(a,c),this._updateOverlayScale(e,t)},An.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,o,r=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,o=1):(i=n.min,o=n.max),mn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),mn(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),mn(a)&&(s="scale("+a+","+a+")"),__(r,s)},An.prototype._updateOverlaysVisibilty=function(e){var t=this;W(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},An.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var o=i.element,r=t.get({element:o});W(r,function(c){t.remove(c.id)});var a=t._getOverlayContainer(o);if(a){Qi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",vI,function(i){var o=i.element,r=t._getOverlayContainer(o,!0);r&&(W(r.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(r))}),e.on("element.marker.update",function(i){var o=t._getOverlayContainer(i.element,!0);o&&kt(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 bI(e){var t=zt('<div class="djs-overlay-container" />');return qn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function w_(e,t,n){qn(e,{left:t+"px",top:n+"px"})}function Pu(e,t){e.style.display=t===!1?"none":""}function __(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Tu={__init__:["overlays"],overlays:["type",An]};function Fh(e,t){t.invoke(ve,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)})}De(Fh,ve),Fh.$inject=["canvas","injector"];const xI={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Fh]};function Gr(e){return CSS.escape(e)}var wI={"&":"&","<":"<",">":">",'"':""","'":"'"};function E_(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return wI[t]})}var _I="bjs-breadcrumbs-shown";function S_(e,t,n){var i=zt('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=kt(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=be(l),p=$t(a,function(f){return f===u});p&&s()});function s(c){c&&(a=EI(c));var l=a.flatMap(function(p){var f=n.findRoot(io(p))||n.findRoot(p.id);if(!f&&M(p,"bpmn:Process")){var d=t.find(function(m){var w=be(m);return w&&w.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=E_(p.name||p.id),h=zt('<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(_I,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}S_.$inject=["eventBus","elementRegistry","canvas"];function EI(e){for(var t=be(e),n=[],i=t;i;i=i.$parent)(M(i,"bpmn:SubProcess")||M(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function R_(e,t){var n=null,i=new SI;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})}R_.$inject=["eventBus","canvas"];function SI(){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 C_={x:180,y:160};function Vr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}Vr.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)})}},Vr.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),CI(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},Vr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=RI(e),i={x:n.x-C_.x,y:n.y-C_.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)})},Vr.prototype._moveToDiPlane=function(e,t){var n=M_(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Vr.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},Vr.$inject=["eventBus","moddle"];function M_(e){return M(e,"bpmndi:BPMNDiagram")?e:M_(e.$parent)}function RI(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=Ge(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),ml(t)}function CI(e,t){var n=e.$parent;return!(!M(n,"bpmn:SubProcess")||n===t.bpmnElement||at(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var ku=250,MI='<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>',AI="bjs-drilldown-empty";function ur(e,t,n,i,o){ve.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",ku,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",ku,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],ku,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"],ku,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)})})}De(ur,ve),ur.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},ur.prototype._canDrillDown=function(e){var t=this._canvas;return M(e,"bpmn:SubProcess")&&t.findRoot(io(e))},ur.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=be(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;kt(i.html).toggle(AI,!o)}},ur.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=be(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=zt('<button type="button" class="bjs-drilldown">'+MI+"</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(io(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},ur.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},ur.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const PI={__depends__:[Tu,dh,xI],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",S_],drilldownCentering:["type",R_],drilldownOverlayBehavior:["type",ur],subprocessCompatibility:["type",Vr]};function pr(e){Yt.call(this,e)}De(pr,Yt),pr.prototype._modules=[nb,PI,Tu,Mi,ks],pr.prototype._moddleExtensions={};var Ou="keyboard.keydown",TI="keyboard.keyup",kI=1e3,A_="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 Yn(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(A_));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Yn.$inject=["config.keyboard","eventBus"],Yn.prototype._keydownHandler=function(e){this._keyHandler(e,Ou)},Yn.prototype._keyupHandler=function(e){this._keyHandler(e,TI)},Yn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Ou,i),n&&e.preventDefault()}},Yn.prototype._isEventIgnored=function(e){return!1},Yn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(A_)),this.unbind(),e=this._node=this._target,je.bind(e,"keydown",this._keydownHandler),je.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Yn.prototype.getBinding=function(){return this._node},Yn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),je.unbind(e,"keydown",this._keydownHandler),je.unbind(e,"keyup",this._keyupHandler)),this._node=null},Yn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Yn.prototype.addListener=function(e,t,n){_n(e)&&(n=t,t=e,e=kI),this._eventBus.on(n||Ou,e,t)},Yn.prototype.removeListener=function(e,t){this._eventBus.off(t||Ou,e)},Yn.prototype.hasModifier=$O,Yn.prototype.isCmd=ai,Yn.prototype.isShift=nh,Yn.prototype.isKey=bn;var OI=500;function ja(e,t){var n=this;e.on("editorActions.init",OI,function(i){var o=i.editorActions;n.registerBindings(t,o)})}ja.$inject=["eventBus","keyboard"],ja.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(GO(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(VO(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(FO(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(jO(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(HO(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(zO(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(bn(["+","Add","="],o)&&ai(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(bn(["-","Subtract"],o)&&ai(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(bn("0",o)&&ai(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(bn(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const jh={__init__:["keyboard","keyboardBindings"],keyboard:["type",Yn],keyboardBindings:["type",ja]};var DI={moveSpeed:50,moveSpeedAccelerated:200};function P_(e,t,n){var i=this;this._config=q({},DI,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})}}P_.$inject=["config.keyboardMove","keyboard","canvas"];const T_={__depends__:[jh],__init__:["keyboardMove"],keyboardMove:["type",P_]};var LI=15;function k_(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=Br(s),p=Vi(u,c);if(!n.dragging&&II(p)>LI&&(n.dragging=!0,l===0&&zx(e),eu("grab")),n.dragging){var f=n.last||n.start;p=Vi(u,f),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){je.unbind(document,"mousemove",o),je.unbind(document,"mouseup",r),n=null,Hx()}function a(s){if(!kr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Br(s)},je.bind(document,"mousemove",o),je.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}k_.$inject=["eventBus","canvas"];function II(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const O_={__init__:["moveCanvas"],moveCanvas:["type",k_]};function D_(e,t){var n=Jf(e.min),i=Jf(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function BI(e,t){return Math.max(e.min,Math.min(e.max,t))}var NI=Math.sign||function(e){return e>=0?1:-1},Hh={min:.2,max:4},L_=10,$I=.1,FI=.75;function ao(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Zn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||FI;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}ao.$inject=["config.zoomScroll","eventBus","canvas"],ao.prototype.scroll=function(t){this._canvas.scroll(t)},ao.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ao.prototype.zoom=function(t,n){var i=D_(Hh,L_*2);this._totalDelta+=t,Math.abs(this._totalDelta)>$I&&(this._zoom(t,n,i),this._totalDelta=0)},ao.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Kb()&&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))*NI(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)}},ao.prototype.stepZoom=function(t,n){var i=D_(Hh,L_);this._zoom(t,n,i)},ao.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=Jf(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(BI(Hh,s),t)},ao.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&je[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},ao.prototype._init=function(e){this.toggle(e)};const I_={__init__:["zoomScroll"],zoomScroll:["type",ao]};function oc(e){pr.call(this,e)}De(oc,pr),oc.prototype._navigationModules=[T_,O_,I_],oc.prototype._modules=[].concat(pr.prototype._modules,oc.prototype._navigationModules);function zh(e){return e&&e[e.length-1]}function B_(e){return e.y}function N_(e){return e.x}var jI={left:N_,center:N_,right:function(e){return e.x+e.width},top:B_,middle:B_,bottom:function(e){return e.y+e.height}};function Ha(e,t){this._modeling=e,this._rules=t}Ha.$inject=["modeling","rules"],Ha.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}},Ha.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Ha.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=zh(t),r[e]=u[i]+u[o];else if(this._isType(e,["center","middle"])){if(W(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=Yi(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return r[e]=zh(c).center,r;l=t[0],t=Yi(t,function(f){return f[i]+f[o]}),u=zh(t),r[e]=p(l,u)}return r},Ha.prototype.trigger=function(e,t){var n=this._modeling,i,o=ct(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:o}),Ye(i)&&(o=i),!(o.length<2||!i)){var r=jI[t],a=Yi(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const HI={__init__:["alignElements"],alignElements:["type",Ha]},zI=new Fr;function za(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}za.$inject=["eventBus"],za.prototype.schedule=function(e,t=zI.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},za.prototype._schedule=function(e,t){const n=GI();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}},za.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},za.prototype._cancel=function(e){clearTimeout(e.executionId)};function GI(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const VI={scheduler:["type",za]};var WI="djs-element-hidden",Du=".entry",UI=1e3,$_=8,qI=300;function pn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}pn.$inject=["canvas","elementRegistry","eventBus","scheduler"],pn.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var o=i.target,r=Ye(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=Ye(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},pn.prototype._createContainer=function(){var e=zt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},pn.prototype.registerProvider=function(e,t){t||(t=e,e=UI),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},pn.prototype.getEntries=function(e){var t=this._getProviders(),n=Ye(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return W(t,function(o){if(_n(o[n])){var r=o[n](e);_n(r)?i=r(i):W(r,function(a,s){i[s]=a})}}),i},pn.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=Mn(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},qI);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},pn.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var o=this._current.target,r=this._current.entries,a=r[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(_n(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},pn.prototype.open=function(e,t){if(!(!t&&this.isOpen(e))){var n=this._eventBus.fire("contextPad.open.allowed",{target:e});n!==!1&&(this.close(),this._updateAndOpen(e))}},pn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},pn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;W(t,function(o,r){var a=o.group||"default",s=zt(o.html||'<div class="entry" draggable="true"></div>'),c;Mn(s,"data-action",r),c=At("[data-group="+Gr(a)+"]",n),c||(c=zt('<div class="group"></div>'),Mn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&YI(s,o.className),o.title&&Mn(s,"title",o.title),o.imageUrl&&(i=zt("<img>"),Mn(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),kt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},pn.prototype._createHtml=function(e){var t=this,n=zt('<div class="djs-context-pad"></div>');return ii.bind(n,Du,"click",function(i){t.trigger("click",i)}),ii.bind(n,Du,"dragstart",function(i){t.trigger("dragstart",i)}),ii.bind(n,Du,"mouseover",function(i){t.trigger("mouseover",i)}),ii.bind(n,Du,"mouseout",function(i){t.trigger("mouseout",i)}),je.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},pn.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&XI(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},pn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},pn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Ye(e)!==Ye(n)?!1:Ye(e)?e.length===n.length&&Bo(e,function(i){return n.includes(i)}):n===e},pn.prototype.isShown=function(){return this.isOpen()&&kt(this._current.html).has("open")},pn.prototype.show=function(){this.isOpen()&&(kt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},pn.prototype.hide=function(){this.isOpen()&&(kt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},pn.prototype._getPosition=function(e){if(!Ye(e)&&Lt(e)){var t=this._canvas.viewbox(),n=KI(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+$_*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+$_*this._canvas.zoom(),top:s.top-a.top}},pn.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(i){i in n&&(t.style[i]=n[i]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},pn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Ye(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,WI)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},pn.prototype._getTargetBounds=function(e){var t=this,n=Ye(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 YI(e,t){var n=kt(e);t=Ye(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function KI(e){return e.waypoints[e.waypoints.length-1]}function XI(e,t){return e=Ye(e)?e:[e],t=Ye(t)?t:[t],e.length===t.length&&Bo(e,function(n){return t.includes(n)})}const F_={__depends__:[Jl,VI,Tu],contextPad:["type",pn]};var Lu,Xt,j_,fr,H_,z_,G_,Gh,Iu,rc,V_,Vh,Wh,Uh,Bu={},Nu=[],ZI=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,$u=Array.isArray;function To(e,t){for(var n in t)e[n]=t[n];return e}function qh(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function W_(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?Lu.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 Fu(e,a,i,o,null)}function Fu(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??++j_,__i:-1,__u:0};return o==null&&Xt.vnode!=null&&Xt.vnode(r),r}function ju(e){return e.children}function Hu(e,t){this.props=e,this.context=t}function Wr(e,t){if(t==null)return e.__?Wr(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"?Wr(e):null}function QI(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=To({},t);r.__v=t.__v+1,Xt.vnode&&Xt.vnode(r),Yh(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Wr(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,J_(i,r,o),t.__e=t.__=null,r.__e!=n&&U_(r)}}function U_(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}),U_(e)}function q_(e){(!e.__d&&(e.__d=!0)&&fr.push(e)&&!zu.__r++||H_!=Xt.debounceRendering)&&((H_=Xt.debounceRendering)||z_)(zu)}function zu(){try{for(var e,t=1;fr.length;)fr.length>t&&fr.sort(G_),e=fr.shift(),t=fr.length,QI(e)}finally{fr.length=zu.__r=0}}function Y_(e,t,n,i,o,r,a,s,c,l,u){var p,f,d,g,h,m,w=i&&i.__k||Nu,y=t.length;for(c=JI(n,t,w,c,y),p=0;p<y;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&w[d.__i]||Bu,d.__i=p,m=Yh(e,d,f,o,r,a,s,c,l,u),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Kh(f.ref,null,d),u.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=K_(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 JI(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]=Fu(null,a,null,null,null):$u(a)?a=e.__k[r]=Fu(ju,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=Fu(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=eB(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=Wr(s)),t0(s,s));return i}function K_(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=K_(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Wr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function eB(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 X_(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||ZI.test(t)?n:n+"px"}function Gu(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||X_(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||X_(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(V_,"$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[rc]=i[rc]:(n[rc]=Vh,e.addEventListener(t,r?Uh:Wh,r)):e.removeEventListener(t,r?Uh:Wh,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 Z_(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Iu]==null)t[Iu]=Vh++;else if(t[Iu]<n[rc])return;return n(Xt.event?Xt.event(t):t)}}}function Yh(e,t,n,i,o,r,a,s,c,l){var u,p,f,d,g,h,m,w,y,v,x,E,A,D,P,T,j=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Xt.__b)&&u(t);e:if(typeof j=="function"){p=a.length;try{if(y=t.props,v=j.prototype&&j.prototype.render,x=(u=j.contextType)&&i[u.__c],E=u?x?x.props.value:u.__:i,n.__c?w=(f=t.__c=n.__c).__=f.__E:(v?t.__c=f=new j(y,E):(t.__c=f=new Hu(y,E),f.constructor=j,f.render=nB),x&&x.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),v&&f.__s==null&&(f.__s=f.state),v&&j.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=To({},f.__s)),To(f.__s,j.getDerivedStateFromProps(y,f.__s))),g=f.props,h=f.state,f.__v=t,d)v&&j.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),v&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(v&&j.getDerivedStateFromProps==null&&y!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(y,E),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(y,f.__s,E)===!1){t.__v!=n.__v&&(f.props=y,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(F){F&&(F.__=t)}),Nu.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Wr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(y,f.__s,E),v&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,m)})}if(f.context=E,f.props=y,f.__P=e,f.__e=!1,A=Xt.__r,D=0,v)f.state=f.__s,f.__d=!1,A&&A(t),u=f.render(f.props,f.state,f.context),Nu.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,A&&A(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++D<25);f.state=f.__s,f.getChildContext!=null&&(i=To(To({},i),f.getChildContext())),v&&!d&&f.getSnapshotBeforeUpdate!=null&&(m=f.getSnapshotBeforeUpdate(g,h)),P=u!=null&&u.type===ju&&u.key==null?e0(u.props.children):u,s=Y_(e,$u(P)?P:[P],t,n,i,o,r,a,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),w&&(f.__E=f.__=null)}catch(F){if(a.length=p,t.__v=null,c||r!=null){if(F.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(T=r.length;T--;)qh(r[T])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),F.then||Q_(t),Xt.__e(F,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=tB(n.__e,t,n,i,o,r,a,c,l);return(u=Xt.diffed)&&u(t),128&t.__u?void 0:s}function Q_(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Q_))}function J_(e,t,n){for(var i=0;i<n.length;i++)Kh(n[i],n[++i],n[++i]);Xt.__c&&Xt.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Xt.__e(r,o.__v)}})}function e0(e){return typeof e!="object"||e==null||e.__b>0?e:$u(e)?e.map(e0):e.constructor!==void 0?null:To({},e)}function tB(e,t,n,i,o,r,a,s,c){var l,u,p,f,d,g,h,m=n.props||Bu,w=t.props,y=t.type;if(y=="svg"?o="http://www.w3.org/2000/svg":y=="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==!!y&&(y?d.localName==y:d.nodeType==3)){e=d,r[l]=null;break}}if(e==null){if(y==null)return document.createTextNode(w);e=document.createElementNS(o,y,w.is&&w),s&&(Xt.__m&&Xt.__m(t,r),s=!1),r=null}if(y==null)m===w||s&&e.data==w||(e.data=w);else{if(r=y=="textarea"&&w.defaultValue!=null?null:r&&Lu.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 w||l=="value"&&"defaultValue"in w||l=="checked"&&"defaultChecked"in w||Gu(e,l,null,d,o);for(l in w)d=w[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?g=d:l=="checked"?h=d:s&&typeof d!="function"||m[l]===d||Gu(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=""),Y_(t.type=="template"?e.content:e,$u(f)?f:[f],t,n,i,y=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&Wr(n,0),s,c),r!=null)for(l=r.length;l--;)qh(r[l]);s&&y!="textarea"||(l="value",y=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||y=="progress"&&!g||y=="option"&&g!=m[l])&&Gu(e,l,g,m[l],o),l="checked",h!=null&&h!=e[l]&&Gu(e,l,h,m[l],o))}return e}function Kh(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(o){Xt.__e(o,n)}}function t0(e,t,n){var i,o;if(Xt.unmount&&Xt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Kh(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Xt.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&t0(i[o],t,n||typeof e.type!="function");n||qh(e.__e),e.__c=e.__=e.__e=void 0}function nB(e,t,n){return this.constructor(e,n)}function n0(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Xt.__&&Xt.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],Yh(t,e=t.__k=W_(ju,null,[e]),o||Bu,Bu,t.namespaceURI,o?null:t.firstChild?Lu.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),J_(r,e,a),e.props.children=null}Lu=Nu.slice,Xt={__e:function(e,t,n,i){for(var o,r,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&r.getDerivedStateFromError!=null&&(o.setState(r.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,i||{}),a=o.__d),a)return o.__E=o}catch(s){e=s}throw e}},j_=0,Hu.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=To({},this.state),typeof e=="function"&&(e=e(To({},n),this.props)),e&&To(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),q_(this))},Hu.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),q_(this))},Hu.prototype.render=ju,fr=[],z_=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,G_=function(e,t){return e.__v.__b-t.__v.__b},zu.__r=0,Gh=Math.random().toString(8),Iu="__d"+Gh,rc="__a"+Gh,V_=/(PointerCapture)$|Capture$/i,Vh=0,Wh=Z_(!1),Uh=Z_(!0);var i0=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,i0(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},o0=new Map;function iB(e){var t=o0.get(this);return t||(t=new Map,o0.set(this,t)),(t=i0(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 Bt=
|
|
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}},Yt.prototype._setDefinitions=function(e){this._definitions=e},Yt.prototype.getModules=function(){return this._modules},Yt.prototype.clear=function(){this.getDefinitions()&&Zo.prototype.clear.call(this)},Yt.prototype.destroy=function(){Zo.prototype.destroy.call(this),Qi(this._container)},Yt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Yt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Yt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=At(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Yt.prototype.getDefinitions=function(){return this._definitions},Yt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Yt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),o=n.additionalModules||[],r=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(r,i,o),s=q(Ki(n,["additionalModules"]),{canvas:q({},n.canvas,{container:e}),modules:a});Zo.call(this,s),n&&n.container&&this.attachTo(n.container)},Yt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Yt.prototype._createContainer=function(e){const t=zt('<div class="bjs-container"></div>');return qn(t,{width:Kv(e.width),height:Kv(e.height),position:e.position}),t},Yt.prototype._createModdle=function(e){const t=q({},this._moddleExtensions,e.moddleExtensions);return new vm(t)},Yt.prototype._modules=[];function Sl(e,t){return e.warnings=t,e}function CT(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 MT={width:"100%",height:"100%",position:"relative"};function Kv(e){return e+(Ke(e)?"px":"")}function AT(e,t){return t&&$t(e.diagrams,function(n){return n.id===t})||null}function PT(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Wv+"</a>",i=zt(n);qn(At("svg",i),Uv),qn(i,qv,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),je.bind(i,"click",function(o){RT(),o.preventDefault()})}function Ea(e){Yt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}De(Ea,Yt),Ea.prototype._createModdle=function(e){var t=Yt.prototype._createModdle.call(this,e);return t.ids=new Zi([32,36,1]),t},Ea.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 ht(e,t){return M(e,"bpmn:CallActivity")?!1:M(e,"bpmn:SubProcess")?(t=t||yt(e),t&&M(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):M(e,"bpmn:Participant")?!!be(e).processRef:!0}function En(e){if(!(!M(e,"bpmn:Participant")&&!M(e,"bpmn:Lane"))){var t=yt(e).isHorizontal;return t===void 0?!0:t}}function TT(e){return e&&be(e).isInterrupting!==!1}function Gn(e){return e&&!!be(e).triggeredByEvent}function Sa(e,t){var n=be(e).eventDefinitions;return No(n,function(i){return M(i,t)})}function kT(e){return Sa(e,"bpmn:ErrorEventDefinition")}function OT(e){return Sa(e,"bpmn:EscalationEventDefinition")}function DT(e){return Sa(e,"bpmn:CompensateEventDefinition")}var Nr={width:90,height:20},Xv=15;function Qo(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 Rl(e){return rt(e.label)}function LT(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=IT(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-=Xv:a+=Xv,{x:a,y:s}}function IT(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 Xf(e){return e.waypoints?LT(e.waypoints):M(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Nr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Nr.height/2}}function BT(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Nr.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=Xf(t),i=Nr),q({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Zv(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 NT(e){var t=e.categoryValueRef;return t&&t.value||""}function vi(e){var t=e.businessObject,n=Zv(t);if(n)return n==="categoryValueRef"?NT(t):t[n]||""}function $T(e,t){var n=e.businessObject,i=Zv(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function FT(e){return rt(e)&&Qo(e.labelTarget)}var Ra=7;function Qv(e){let t=[];return W(e.incoming,n=>{M(n,"bpmn:Association")&&M(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),W(e.outgoing,n=>{M(n,"bpmn:Association")&&M(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Ts(e){const t=new Map;return W(Gf(e),n=>{W(Qv(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 Zf="hsl(225, 10%, 15%)",jT="white";function no(e,t){return No(e.eventDefinitions,function(n){return n.$type===t})}function HT(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function zT(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function ut(e,t,n){var i=yt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||jT}function Oe(e,t,n){var i=yt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Zf}function ks(e,t,n,i){var o=yt(e),r=o.get("label");return i||r&&r.get("color:color")||t||Oe(e,n)}function Jv(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 Ir(o)}function Qf(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 Ir(a)}function GT(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 Ir(s)}function VT(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 Ir(r)}function Os(e,t={}){return{width:Ei(e,t),height:ri(e,t)}}function Ei(e,t={}){return ti(t,"width")?t.width:e.width}function ri(e,t={}){return ti(t,"height")?t.height:e.height}var WT=new Zi,UT=10,Cl=3,qT=1.5,Ml=10,YT=4,Ca=.95,KT=1,XT=.25;function $r(e,t,n,i,o,r,a){vo.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(N){return n.computeStyle(N,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Zf,strokeWidth:2,fill:"white"})}function p(N){return n.computeStyle(N,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Zf,strokeWidth:2})}function f(N,C){var{ref:S={x:0,y:0},scale:V=1,element:X,parentGfx:le=o._svg}=C,Te=Ne("marker",{id:N,viewBox:"0 0 20 20",refX:S.x,refY:S.y,markerWidth:20*V,markerHeight:20*V,orient:"auto"});Je(Te,X);var Ve=At(":scope > defs",le);Ve||(Ve=Ne("defs"),Je(le,Ve)),Je(Ve,Te)}function d(N,C,S,V){var X=WT.nextPrefixed("marker-");return g(N,X,C,S,V),"url(#"+X+")"}function g(N,C,S,V,X){if(S==="sequenceflow-end"){var le=Ne("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:X,stroke:X,strokeWidth:1})});f(C,{element:le,ref:{x:11,y:10},scale:.5,parentGfx:N})}if(S==="messageflow-start"){var Te=Ne("circle",{cx:6,cy:6,r:3.5,...u({fill:V,stroke:X,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Te,ref:{x:6,y:6},parentGfx:N})}if(S==="messageflow-end"){var Ve=Ne("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:V,stroke:X,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Ve,ref:{x:8.5,y:5},parentGfx:N})}if(S==="association-start"){var wt=Ne("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:X,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(C,{element:wt,ref:{x:1,y:10},scale:.5,parentGfx:N})}if(S==="association-end"){var Qt=Ne("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:X,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(C,{element:Qt,ref:{x:11,y:10},scale:.5,parentGfx:N})}if(S==="conditional-flow-marker"){var Pt=Ne("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:V,stroke:X})});f(C,{element:Pt,ref:{x:-1,y:10},scale:.5,parentGfx:N})}if(S==="conditional-default-flow-marker"){var Ht=Ne("path",{d:"M 6 4 L 10 16",...u({stroke:X,fill:"none"})});f(C,{element:Ht,ref:{x:0,y:10},scale:.5,parentGfx:N})}}function h(N,C,S,V,X={}){yn(V)&&(X=V,V=0),V=V||0,X=u(X);var le=C/2,Te=S/2,Ve=Ne("circle",{cx:le,cy:Te,r:Math.round((C+S)/4-V),...X});return Je(N,Ve),Ve}function m(N,C,S,V,X,le){yn(X)&&(le=X,X=0),X=X||0,le=u(le);var Te=Ne("rect",{x:X,y:X,width:C-X*2,height:S-X*2,rx:V,ry:V,...le});return Je(N,Te),Te}function w(N,C,S,V){var X=C/2,le=S/2,Te=[{x:X,y:0},{x:C,y:le},{x:X,y:S},{x:0,y:le}],Ve=Te.map(function(Qt){return Qt.x+","+Qt.y}).join(" ");V=u(V);var wt=Ne("polygon",{...V,points:Ve});return Je(N,wt),wt}function y(N,C,S,V){S=p(S);var X=Es(C,S,V);return Je(N,X),X}function v(N,C,S){return y(N,C,S,5)}function x(N,C,S){S=p(S);var V=Ne("path",{...S,d:C});return Je(N,V),V}function E(N,C,S,V){return x(C,S,q({"data-marker":N},V))}function A(N){return Ie[N]}function D(N){return function(C,S,V){return A(N)(C,S,V)}}var P={"bpmn:MessageEventDefinition":function(N,C,S={},V){var X=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.235,my:.315}}),le=V?Oe(C,c,S.stroke):ut(C,s,S.fill),Te=V?ut(C,s,S.fill):Oe(C,c,S.stroke),Ve=x(N,X,{fill:le,stroke:Te,strokeWidth:1});return Ve},"bpmn:TimerEventDefinition":function(N,C,S={}){var V=S.width||C.width,X=S.height||C.height,le=S.width?1:2,Te=h(N,V,X,.2*X,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:le}),Ve=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:V,containerHeight:X,position:{mx:.5,my:.5}});x(N,Ve,{stroke:Oe(C,c,S.stroke),strokeWidth:le});for(var wt=0;wt<12;wt++){var Qt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:V,containerHeight:X,position:{mx:.5,my:.5}}),Pt=V/2,Ht=X/2;x(N,Qt,{strokeWidth:1,stroke:Oe(C,c,S.stroke),transform:"rotate("+wt*30+","+Ht+","+Pt+")"})}return Te},"bpmn:EscalationEventDefinition":function(N,C,S={},V){var X=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.5,my:.2}}),le=V?Oe(C,c,S.stroke):ut(C,s,S.fill);return x(N,X,{fill:le,stroke:Oe(C,c,S.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(N,C,S={}){var V=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.5,my:.222}});return x(N,V,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(N,C,S={},V){var X=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.57,my:.263}}),le=V?Oe(C,c,S.stroke):ut(C,s,S.fill);return x(N,X,{fill:le,stroke:Oe(C,c,S.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(N,C,S={},V){var X=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.2,my:.722}}),le=V?Oe(C,c,S.stroke):ut(C,s,S.fill);return x(N,X,{fill:le,stroke:Oe(C,c,S.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(N,C,S={},V){var X=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.638,my:-.055}}),le=V?Oe(C,c,S.stroke):"none",Te=x(N,X,{fill:le,stroke:Oe(C,c,S.stroke),strokeWidth:1});return Gv(Te,45),Te},"bpmn:CompensateEventDefinition":function(N,C,S={},V){var X=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.22,my:.5}}),le=V?Oe(C,c,S.stroke):ut(C,s,S.fill);return x(N,X,{fill:le,stroke:Oe(C,c,S.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(N,C,S={},V){var X=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.5,my:.2}}),le=V?Oe(C,c,S.stroke):ut(C,s,S.fill);return x(N,X,{strokeWidth:1,fill:le,stroke:Oe(C,c,S.stroke)})},"bpmn:MultipleEventDefinition":function(N,C,S={},V){var X=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.211,my:.36}}),le=V?Oe(C,c,S.stroke):ut(C,s,S.fill);return x(N,X,{fill:le,stroke:Oe(C,c,S.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(N,C,S={}){var V=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.458,my:.194}});return x(N,V,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(N,C,S={}){var V=h(N,C.width,C.height,8,{fill:Oe(C,c,S.stroke),stroke:Oe(C,c,S.stroke),strokeWidth:4});return V}};function T(N,C,S={},V){var X=be(N),le=HT(X),Te=V||N;return X.get("eventDefinitions")&&X.get("eventDefinitions").length>1?X.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](C,Te,S,le):P["bpmn:MultipleEventDefinition"](C,Te,S,le):no(X,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](C,Te,S,le):no(X,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](C,Te,S,le):no(X,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](C,Te,S,le):no(X,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](C,Te,S,le):no(X,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](C,Te,S,le):no(X,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](C,Te,S,le):no(X,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](C,Te,S,le):no(X,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](C,Te,S,le):no(X,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](C,Te,S,le):no(X,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](C,Te,S,le):null}var j={ParticipantMultiplicityMarker:function(N,C,S={}){var V=Ei(C,S),X=ri(C,S),le=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:V,containerHeight:X,position:{mx:(V/2-6)/V,my:(X-15)/X}});E("participant-multiplicity",N,le,{strokeWidth:2,fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke)})},SubProcessMarker:function(N,C,S={}){var V=m(N,14,14,0,{strokeWidth:1,fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke)});Dn(V,C.width/2-7.5,C.height-20);var X=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",N,X,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke)})},ParallelMarker:function(N,C,S){var V=Ei(C,S),X=ri(C,S),le=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:V,containerHeight:X,position:{mx:(V/2+S.parallel)/V,my:(X-20)/X}});E("parallel",N,le,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke)})},SequentialMarker:function(N,C,S){var V=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+S.seq)/C.width,my:(C.height-19)/C.height}});E("sequential",N,V,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke)})},CompensationMarker:function(N,C,S){var V=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+S.compensation)/C.width,my:(C.height-13)/C.height}});E("compensation",N,V,{strokeWidth:1,fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke)})},LoopMarker:function(N,C,S){var V=Ei(C,S),X=ri(C,S),le=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:V,containerHeight:X,position:{mx:(V/2+S.loop)/V,my:(X-7)/X}});E("loop",N,le,{strokeWidth:1.5,fill:"none",stroke:Oe(C,c,S.stroke),strokeMiterlimit:.5})},AdhocMarker:function(N,C,S){var V=Ei(C,S),X=ri(C,S),le=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:V,containerHeight:X,position:{mx:(V/2+S.adhoc)/V,my:(X-15)/X}});E("adhoc",N,le,{strokeWidth:1,fill:Oe(C,c,S.stroke),stroke:Oe(C,c,S.stroke)})}};function F(N,C,S,V){j[N](C,S,V)}function G(N,C,S=[],V={}){V={fill:V.fill,stroke:V.stroke,width:Ei(C,V),height:ri(C,V)};var X=be(C),le=S.includes("SubProcessMarker");le?V={...V,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:V={...V,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},X.get("isForCompensation")&&S.push("CompensationMarker"),M(X,"bpmn:AdHocSubProcess")&&(S.push("AdhocMarker"),le||q(V,{compensation:V.compensation-18}));var Te=X.get("loopCharacteristics"),Ve=Te&&Te.get("isSequential");Te&&(q(V,{compensation:V.compensation-18}),S.includes("AdhocMarker")&&q(V,{seq:-23,loop:-18,parallel:-24}),Ve===void 0&&S.push("LoopMarker"),Ve===!1&&S.push("ParallelMarker"),Ve===!0&&S.push("SequentialMarker")),S.includes("CompensationMarker")&&S.length===1&&q(V,{compensation:-8}),W(S,function(wt){F(wt,N,C,V)})}function Q(N,C,S={}){S=q({size:{width:100}},S);var V=r.createText(C||"",S);return dt(V).add("djs-label"),Je(N,V),V}function re(N,C,S,V={}){var X=be(C),le=Os({x:C.x,y:C.y,width:C.width,height:C.height},V);return Q(N,X.name,{align:S,box:le,padding:7,style:{fill:ks(C,l,c,V.stroke)}})}function J(N,C,S={}){var V={width:C.width,height:C.height,x:C.width/2+C.x,y:C.height/2+C.y};return Q(N,vi(C),{box:V,style:q({},r.getExternalStyle(),{fill:ks(C,l,c,S.stroke)})})}function ye(N,C,S,V={}){var X=En(S),le=Q(N,C,{box:{height:30,width:X?ri(S,V):Ei(S,V)},align:"center-middle",style:{fill:ks(S,l,c,V.stroke)}});if(X){var Te=-1*ri(S,V);_l(le,0,-Te,270)}}function ae(N,C,S={}){var{width:V,height:X}=Os(C,S);return m(N,V,X,Ml,{...S,fill:ut(C,s,S.fill),fillOpacity:Ca,stroke:Oe(C,c,S.stroke)})}function xe(N,C,S={}){var V=be(C),X=ut(C,s,S.fill),le=Oe(C,c,S.stroke);return(V.get("associationDirection")==="One"||V.get("associationDirection")==="Both")&&(S.markerEnd=d(N,"association-end",X,le)),V.get("associationDirection")==="Both"&&(S.markerStart=d(N,"association-start",X,le)),S=vt(S,["markerStart","markerEnd"]),v(N,C.waypoints,{...S,stroke:le,strokeDasharray:"0, 5"})}function Ee(N,C,S={}){var V=ut(C,s,S.fill),X=Oe(C,c,S.stroke),le=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}}),Te=x(N,le,{fill:V,fillOpacity:Ca,stroke:X}),Ve=be(C);if(zT(Ve)){var wt=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}});x(N,wt,{strokeWidth:2,fill:V,stroke:X})}return Te}function U(N,C,S={}){return h(N,C.width,C.height,{fillOpacity:Ca,...S,fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke)})}function ce(N,C,S={}){return w(N,C.width,C.height,{fill:ut(C,s,S.fill),fillOpacity:Ca,stroke:Oe(C,c,S.stroke)})}function Y(N,C,S={}){var V=m(N,Ei(C,S),ri(C,S),0,{fill:ut(C,s,S.fill),fillOpacity:S.fillOpacity||Ca,stroke:Oe(C,c,S.stroke),strokeWidth:1.5}),X=be(C);if(M(X,"bpmn:Lane")){var le=X.get("name");ye(N,le,C,S)}return V}function Z(N,C,S={}){var V=ae(N,C,S),X=ht(C);if(Gn(C)&&(Pe(V,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!X)){var le=be(C).flowElements||[],Te=le.filter(Ve=>M(Ve,"bpmn:StartEvent"));Te.length===1&&de(Te[0],N,S,C)}return re(N,C,X?"center-top":"center-middle",S),X?G(N,C,void 0,S):G(N,C,["SubProcessMarker"],S),V}function de(N,C,S,V){var X=22,le={fill:ut(V,s,S.fill),stroke:Oe(V,c,S.stroke),width:X,height:X},Te=be(N).isInterrupting,Ve=Te?0:3,wt=Te?1:1.2,Qt=20,Pt=(X-Qt)/2,Ht="translate("+Pt+","+Pt+")";h(C,Qt,Qt,{fill:le.fill,stroke:le.stroke,strokeWidth:wt,strokeDasharray:Ve,transform:Ht}),T(N,C,le,V)}function Se(N,C,S={}){var V=ae(N,C,S);return re(N,C,"center-middle",S),G(N,C,void 0,S),V}var Ie=this.handlers={"bpmn:AdHocSubProcess":function(N,C,S={}){return ht(C)?S=vt(S,["fill","stroke","width","height"]):S=vt(S,["fill","stroke"]),Z(N,C,S)},"bpmn:Association":function(N,C,S={}){return S=vt(S,["fill","stroke"]),xe(N,C,S)},"bpmn:BoundaryEvent":function(N,C,S={}){var{renderIcon:V=!0}=S;S=vt(S,["fill","stroke"]);var X=be(C),le=X.get("cancelActivity");S={strokeWidth:1.5,fill:ut(C,s,S.fill),fillOpacity:KT,stroke:Oe(C,c,S.stroke)},le||(S.strokeDasharray="6");var Te=U(N,C,S);return h(N,C.width,C.height,Cl,{...S,fill:"none"}),V&&T(C,N,S),Te},"bpmn:BusinessRuleTask":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=Se(N,C,S),X=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),le=x(N,X);Pe(le,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:1});var Te=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ve=x(N,Te);return Pe(Ve,{fill:Oe(C,c,S.stroke),stroke:Oe(C,c,S.stroke),strokeWidth:1}),V},"bpmn:CallActivity":function(N,C,S={}){return S=vt(S,["fill","stroke"]),Z(N,C,{strokeWidth:5,...S})},"bpmn:ComplexGateway":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=ce(N,C,S),X=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.26}});return x(N,X,{fill:Oe(C,c,S.stroke),stroke:Oe(C,c,S.stroke),strokeWidth:1}),V},"bpmn:DataInput":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=i.getRawPath("DATA_ARROW"),X=Ee(N,C,S);return x(N,V,{fill:"none",stroke:Oe(C,c,S.stroke),strokeWidth:1}),X},"bpmn:DataInputAssociation":function(N,C,S={}){return S=vt(S,["fill","stroke"]),xe(N,C,{...S,markerEnd:d(N,"association-end",ut(C,s,S.fill),Oe(C,c,S.stroke))})},"bpmn:DataObject":function(N,C,S={}){return S=vt(S,["fill","stroke"]),Ee(N,C,S)},"bpmn:DataObjectReference":D("bpmn:DataObject"),"bpmn:DataOutput":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=i.getRawPath("DATA_ARROW"),X=Ee(N,C,S);return x(N,V,{strokeWidth:1,fill:Oe(C,c,S.stroke),stroke:Oe(C,c,S.stroke)}),X},"bpmn:DataOutputAssociation":function(N,C,S={}){return S=vt(S,["fill","stroke"]),xe(N,C,{...S,markerEnd:d(N,"association-end",ut(C,s,S.fill),Oe(C,c,S.stroke))})},"bpmn:DataStoreReference":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:0,my:.133}});return x(N,V,{fill:ut(C,s,S.fill),fillOpacity:Ca,stroke:Oe(C,c,S.stroke),strokeWidth:2})},"bpmn:EndEvent":function(N,C,S={}){var{renderIcon:V=!0}=S;S=vt(S,["fill","stroke"]);var X=U(N,C,{...S,strokeWidth:4});return V&&T(C,N,S),X},"bpmn:EventBasedGateway":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=be(C),X=ce(N,C,S);h(N,C.width,C.height,C.height*.2,{fill:ut(C,"none",S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:1});var le=V.get("eventGatewayType"),Te=!!V.get("instantiate");function Ve(){var Qt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:C.width,containerHeight:C.height,position:{mx:.36,my:.44}});x(N,Qt,{fill:"none",stroke:Oe(C,c,S.stroke),strokeWidth:2})}if(le==="Parallel"){var wt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}});x(N,wt,{fill:"none",stroke:Oe(C,c,S.stroke),strokeWidth:1})}else le==="Exclusive"&&(Te||h(N,C.width,C.height,C.height*.26,{fill:"none",stroke:Oe(C,c,S.stroke),strokeWidth:1}),Ve());return X},"bpmn:ExclusiveGateway":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=ce(N,C,S),X=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.32,my:.3}}),le=yt(C);return le.get("isMarkerVisible")&&x(N,X,{fill:Oe(C,c,S.stroke),stroke:Oe(C,c,S.stroke),strokeWidth:1}),V},"bpmn:Gateway":function(N,C,S={}){return S=vt(S,["fill","stroke"]),ce(N,C,S)},"bpmn:Group":function(N,C,S={}){return S=vt(S,["fill","stroke","width","height"]),m(N,C.width,C.height,Ml,{stroke:Oe(C,c,S.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Ei(C,S),height:ri(C,S)})},"bpmn:InclusiveGateway":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=ce(N,C,S);return h(N,C.width,C.height,C.height*.24,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:2.5}),V},"bpmn:IntermediateEvent":function(N,C,S={}){var{renderIcon:V=!0}=S;S=vt(S,["fill","stroke"]);var X=U(N,C,{...S,strokeWidth:1.5});return h(N,C.width,C.height,Cl,{fill:"none",stroke:Oe(C,c,S.stroke),strokeWidth:1.5}),V&&T(C,N,S),X},"bpmn:IntermediateCatchEvent":D("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":D("bpmn:IntermediateEvent"),"bpmn:Lane":function(N,C,S={}){return S=vt(S,["fill","stroke","width","height"]),Y(N,C,{...S,fillOpacity:XT})},"bpmn:ManualTask":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=Se(N,C,S),X=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(N,X,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:.5}),V},"bpmn:MessageFlow":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=be(C),X=yt(C),le=ut(C,s,S.fill),Te=Oe(C,c,S.stroke),Ve=v(N,C.waypoints,{markerEnd:d(N,"messageflow-end",le,Te),markerStart:d(N,"messageflow-start",le,Te),stroke:Te,strokeDasharray:"10, 11",strokeWidth:1.5});if(V.get("messageRef")){var wt=Ve.getPointAtLength(Ve.getTotalLength()/2),Qt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:wt.x,y:wt.y}}),Pt={strokeWidth:1};X.get("messageVisibleKind")==="initiating"?(Pt.fill=le,Pt.stroke=Te):(Pt.fill=Te,Pt.stroke=le);var Ht=x(N,Qt,Pt),gn=V.get("messageRef"),Nn=gn.get("name"),Nt=Q(N,Nn,{align:"center-top",fitBox:!0,style:{fill:Te}}),rn=Ht.getBBox(),Vn=Nt.getBBox(),Qa=wt.x-Vn.width/2,pi=wt.y+rn.height/2+UT;_l(Nt,Qa,pi,0)}return Ve},"bpmn:ParallelGateway":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=ce(N,C,S),X=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.2}});return x(N,X,{fill:Oe(C,c,S.stroke),stroke:Oe(C,c,S.stroke),strokeWidth:1}),V},"bpmn:Participant":function(N,C,S={}){S=vt(S,["fill","stroke","width","height"]);var V=Y(N,C,S),X=ht(C),le=En(C),Te=be(C),Ve=Te.get("name");if(X){var wt=le?[{x:30,y:0},{x:30,y:ri(C,S)}]:[{x:0,y:30},{x:Ei(C,S),y:30}];y(N,wt,{stroke:Oe(C,c,S.stroke),strokeWidth:qT}),ye(N,Ve,C,S)}else{var Qt=Os(C,S);le||(Qt.height=Ei(C,S),Qt.width=ri(C,S));var Pt=Q(N,Ve,{box:Qt,align:"center-middle",style:{fill:ks(C,l,c,S.stroke)}});if(!le){var Ht=-1*ri(C,S);_l(Pt,0,-Ht,270)}}return Te.get("participantMultiplicity")&&F("ParticipantMultiplicityMarker",N,C,S),V},"bpmn:ReceiveTask":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=be(C),X=Se(N,C,S),le;return V.get("instantiate")?(h(N,28,28,20*.22,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:1}),le=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):le=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(N,le,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:1}),X},"bpmn:ScriptTask":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=Se(N,C,S),X=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(N,X,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:1}),V},"bpmn:SendTask":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=Se(N,C,S),X=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(N,X,{fill:Oe(C,c,S.stroke),stroke:ut(C,s,S.fill),strokeWidth:1}),V},"bpmn:SequenceFlow":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=ut(C,s,S.fill),X=Oe(C,c,S.stroke),le=v(N,C.waypoints,{markerEnd:d(N,"sequenceflow-end",V,X),stroke:X}),Te=be(C),{source:Ve}=C;if(Ve){var wt=be(Ve);Te.get("conditionExpression")&&M(wt,"bpmn:Activity")&&Pe(le,{markerStart:d(N,"conditional-flow-marker",V,X)}),wt.get("default")&&(M(wt,"bpmn:Gateway")||M(wt,"bpmn:Activity"))&&wt.get("default")===Te&&Pe(le,{markerStart:d(N,"conditional-default-flow-marker",V,X)})}return le},"bpmn:ServiceTask":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=Se(N,C,S);h(N,10,10,{fill:ut(C,s,S.fill),stroke:"none",transform:"translate(6, 6)"});var X=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(N,X,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:1}),h(N,10,10,{fill:ut(C,s,S.fill),stroke:"none",transform:"translate(11, 10)"});var le=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(N,le,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:1}),V},"bpmn:StartEvent":function(N,C,S={}){var{renderIcon:V=!0}=S;S=vt(S,["fill","stroke"]);var X=be(C);X.get("isInterrupting")||(S={...S,strokeDasharray:"6"});var le=U(N,C,S);return V&&T(C,N,S),le},"bpmn:SubProcess":function(N,C,S={}){return ht(C)?S=vt(S,["fill","stroke","width","height"]):S=vt(S,["fill","stroke"]),Z(N,C,S)},"bpmn:Task":function(N,C,S={}){return S=vt(S,["fill","stroke"]),Se(N,C,S)},"bpmn:TextAnnotation":function(N,C,S={}){S=vt(S,["fill","stroke"]);var{width:V,height:X}=Os(C,S),le=m(N,V,X,0,0,{fill:"none",stroke:"none"}),Te=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:V,containerHeight:X,position:{mx:0,my:0}});x(N,Te,{stroke:Oe(C,c,S.stroke)});var Ve=be(C),wt=Ve.get("text")||"";return Q(N,wt,{align:"left-top",box:Os(C,S),padding:Ra,style:{fill:ks(C,l,c,S.stroke)}}),le},"bpmn:Transaction":function(N,C,S={}){ht(C)?S=vt(S,["fill","stroke","width","height"]):S=vt(S,["fill","stroke"]);var V=Z(N,C,{strokeWidth:1.5,...S}),X=n.style(["no-fill","no-events"],{stroke:Oe(C,c,S.stroke),strokeWidth:1.5}),le=ht(C);return le||(S={}),m(N,Ei(C,S),ri(C,S),Ml-Cl,Cl,X),V},"bpmn:UserTask":function(N,C,S={}){S=vt(S,["fill","stroke"]);var V=Se(N,C,S),X=15,le=12,Te=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:X,y:le}});x(N,Te,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:.5});var Ve=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:X,y:le}});x(N,Ve,{fill:ut(C,s,S.fill),stroke:Oe(C,c,S.stroke),strokeWidth:.5});var wt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:X,y:le}});return x(N,wt,{fill:Oe(C,c,S.stroke),stroke:Oe(C,c,S.stroke),strokeWidth:.5}),V},label:function(N,C,S={}){return J(N,C,S)}};this._drawPath=x,this._renderer=A}De($r,vo),$r.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],$r.prototype.canRender=function(e){return M(e,"bpmn:BaseElement")},$r.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},$r.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},$r.prototype.getShapePath=function(e){return rt(e)?Qf(e,YT):M(e,"bpmn:Event")?Jv(e):M(e,"bpmn:Activity")?Qf(e,Ml):M(e,"bpmn:Gateway")?GT(e):VT(e)};function vt(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var ZT=0,QT={width:150,height:50};function JT(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function ek(e){return yn(e)?q({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Jf=null;function tk(){return Jf||(Jf=document.createElement("canvas").getContext("2d")),Jf}function nk(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(eb(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function eb(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function ik(e,t){var n=tk();if(!n)return{width:0,height:0};n.font=nk(t),"letterSpacing"in n&&(n.letterSpacing=eb(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 ok(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=ik(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return rk(e,o,i,r);o=sk(o,r.width,t)}}function rk(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 tb="";function ak(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===tb)&&o.pop();break}var a=o[o.length-1];return a&&a===tb&&(o[o.length-1]="-"),o.join("")}function sk(e,t,n){var i=Math.max(e.length*(n/t),1),o=ak(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function Al(e){this._config=q({},{size:QT,padding:ZT,style:{},align:"center-top"},e||{})}Al.prototype.createText=function(e,t){return this.layoutText(e,t).element},Al.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Al.prototype.layoutText=function(e,t){for(var n=q({},this._config.size,t.box),i=q({},this._config.style,t.style),o=JT(t.align||this._config.align),r=ek(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=ck(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(ok(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=ni(l,function(m,w,y){return m+(s||w.height)},0)+r.top+r.bottom,f=ni(l,function(m,w,y){return w.width>m?w.width:m},0),d=r.top;o.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||l[0].height)/4;var g=Ne("text");Pe(g,i),W(l,function(m){var w;switch(d+=s||m.height,o.horizontal){case"left":w=r.left;break;case"right":w=(a?f:u)-r.right-m.width;break;default:w=Math.max(((a?f:u)-m.width)/2+r.left,0)}var y=Ne("tspan");Pe(y,{x:w,y:d}),y.textContent=m.text,Je(g,y)});var h={width:f,height:p};return{dimensions:h,element:g}};function ck(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var lk=12,uk=1.2,pk=40;function nb(e){var t=q({fontFamily:"Arial, sans-serif",fontSize:lk,fontWeight:"normal",lineHeight:uk},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=q({},t,{fontSize:n},e&&e.externalStyle||{}),o=new Al({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Nr.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:Ra});return{x:a.x,y:a.y,width:a.width,height:Math.max(pk,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,q({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}nb.$inject=["config.textRenderer"];function fk(){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=mk(i.d,{mx:o,my:r,e:a});return p}}var dk=/\{([^{}]+)\}/g,hk=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function gk(e,t,n){var i=n;return t.replace(hk,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 mk(e,t){return String(e).replace(dk,function(n,i){return gk(n,i,t)})}const yk={__init__:["bpmnRenderer"],bpmnRenderer:["type",$r],textRenderer:["type",nb],pathMap:["type",fk]};function vk(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Ds={translate:["value",vk]};function Pl(e,t,n){return q({id:e.id,type:e.$type,businessObject:e,di:t},n)}function bk(e,t,n){var i=e.waypoint;return!i||i.length<2?[Xe(t),Xe(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function ib(e,t,n){return new Error(`element ${zn(t)} referenced by ${zn(e)}#${n} not yet drawn`)}function _o(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}_o.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],_o.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(Pl(e,t,a)),this._canvas.addRootElement(i)}else if(M(t,"bpmndi:BPMNShape")){var s=!ht(e,t),c=wk(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Pl(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")&&(xk(n,Xe(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(Pl(e,t,{hidden:o,source:u,target:p,waypoints:bk(t,u,p)})),M(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${zn(t)} for element ${zn(e)}`);return Qo(e)&&vi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},_o.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${zn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw ib(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},_o.prototype.addLabel=function(e,t,n){var i,o,r;return i=BT(t,n),o=vi(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(Pl(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!vi(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)},_o.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?ib(e,i,t+"Ref"):new Error(`${zn(e)}#${t} Ref not specified`)},_o.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},_o.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},_o.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function xk(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 wk(e){return M(e,"bpmn:Group")}const ob={__depends__:[yk,{__depends__:[Ds],bpmnImporter:["type",_o]}]};function Ls(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Vi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ed(e){return Math.log(e)/Math.log(10)}var _k=1e3;function ve(e){this._eventBus=e}ve.$inject=["eventBus"];function Ek(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}ve.prototype.on=function(e,t,n,i,o,r){if((_n(t)||Ke(t))&&(r=o,o=i,i=n,n=t,t=null),_n(n)&&(r=o,o=i,i=n,n=_k),yn(o)&&(r=o,o=!1),!_n(i))throw new Error("handlerFn must be a function");Ye(e)||(e=[e]);var a=this._eventBus;W(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,o?Ek(i,r):i,r)})},ve.prototype.canExecute=Eo("canExecute"),ve.prototype.preExecute=Eo("preExecute"),ve.prototype.preExecuted=Eo("preExecuted"),ve.prototype.execute=Eo("execute"),ve.prototype.executed=Eo("executed"),ve.prototype.postExecute=Eo("postExecute"),ve.prototype.postExecuted=Eo("postExecuted"),ve.prototype.revert=Eo("revert"),ve.prototype.reverted=Eo("reverted");function Eo(e){return function(n,i,o,r,a){(_n(n)||Ke(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var td=["top","bottom","left","right"],Tl=10;function nd(e,t){ve.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(Rl(o)&&!Lt(o)){var r=Ck(o);r&&i(o,r)}}function i(o,r){var a=Xe(o),s=o.label,c=Xe(s);if(s.parent){var l=Ge(o),u;switch(r){case"top":u={x:a.x,y:l.top-Tl-s.height/2};break;case"left":u={x:l.left-Tl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Tl+s.height/2};break;case"right":u={x:l.right+Tl+s.width/2,y:a.y};break}var p=Vi(u,c);t.moveShape(s,p)}}}De(nd,ve),nd.$inject=["eventBus","modeling"];function Sk(e){var t=e.host,n=Xe(e),i=On(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=td.filter(function(a){return o.indexOf(a)===-1});return r}function Rk(e){var t=Xe(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 rb(t,i)});return n}function Ck(e){var t=Xe(e.label),n=Xe(e),i=rb(n,t);if(Mk(i)){var o=Rk(e);if(e.host){var r=Sk(e);o=o.concat(r)}var a=td.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?On(e.label,e)!=="intersect"?void 0:i:a[0]}}function rb(e,t){return On(t,e,5)}function Mk(e){return td.indexOf(e)!==-1}function id(e){ve.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)}De(id,ve),id.$inject=["eventBus"];var Ak=1500;function od(e,t,n){e.invoke(ve,this),this.preExecute("elements.delete",Ak,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=ct(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 W(r,l=>{const u=new Set(aa(xa(Array.from(s),ln(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}De(od,ve),od.$inject=["injector","eventBus","canvas"];function rd(e,t){e.invoke(ve,this),this.postExecute("shape.move",function(n){var i=n.newParent,o=n.shape,r=ct(o.incoming.concat(o.outgoing),function(a){return M(a,"bpmn:Association")});W(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}De(rd,ve),rd.$inject=["injector","modeling"];function Ma(e,t){for(ei(t)&&(t=[t]);e=e.parent;)if(at(e,t))return e;return null}function ab(e,t){var n=Ma(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Ma(e,i),n)return En(n);if(at(e,i))return En(e);var o;for(o=be(e);o&&!M(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=be(a);return s&&s.get("processRef")===o});return r?En(r):!0}var sb=500;function kl(e,t){t.invoke(ve,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",sb,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return cb(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",sb,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];cb(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}kl.$inject=["bpmnReplace","injector"],De(kl,ve),kl.prototype._replaceShape=function(e,t){var n=Pk(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function Pk(e){var t=be(e),n=t.eventDefinitions;return n&&n[0]}function cb(e,t){return!rt(e)&&at(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function ad(e,t){ve.call(this,e);function n(i){return ct(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")&&W(r.outgoing,function(a){var s=a.target,c=n(s);M(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}ad.$inject=["eventBus","modeling"],De(ad,ve);function lb(e){return e.create("bpmn:Category")}function Tk(e){return e.create("bpmn:CategoryValue")}function ub(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=Tk(e)),n.$parent||(n.$parent=lb(e)),n}function kk(e,t,n){return an(t.get("categoryValue"),e),e.$parent=t,an(n.get("rootElements"),t),t.$parent=n,e}function Ok(e){var t=e.$parent;return t&&(on(t.get("categoryValue"),e),e.$parent=null),e}function Dk(e){var t=e.$parent;return t&&(on(t.get("rootElements"),e),e.$parent=null),e}var Lk=500;function sd(e,t,n){n.invoke(ve,this);function i(c){return t.filter(function(l){return M(l,"bpmn:Group")&&!l.labelTarget}).map(be).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&&kk(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&Dk(l),c&&!o(c,u)&&Ok(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,be(l))},!0),this.executed(["shape.move","shape.resize"],Lk,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,be(l))},!0),this.executed("group.updateRefs",function(c){pb(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){pb(c).forEach(function(l){s(l.categoryValue,l.category,be(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,be(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}sd.$inject=["bpmnjs","elementRegistry","injector"],De(sd,ve);function pb(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function cd(e,t,n){ve.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",o,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",r,!0),this.postExecuted("element.updateProperties",a,!0);function i(m){const w=m.source,y=m.target;Aa(w)&&Is(y)&&u(y)}function o(m){const w=m.connection,y=m.source,v=m.target;Aa(y)&&Ol(v)&&(l(v),f(y,[w]))}function r(m){const w=m.newTarget,y=m.oldSource,v=m.oldTarget;if(v!==w){const x=y;Is(v)&&u(v),Aa(x)&&Ol(w)&&l(w)}}function a(m){const{element:w}=m;Is(w)?(p(w),d(w)):Ol(w)&&g(w)}function s(m){const{newData:w,oldShape:y}=m;if(Aa(m.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){const v=y.outgoing.find(({target:x})=>Is(x));v&&v.target&&(m._connectionTarget=v.target)}else if(!Aa(m.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){const v=y.outgoing.find(({target:x})=>Ol(x));v&&v.target&&(m._connectionTarget=v.target),h(y)}}function c(m){const{_connectionTarget:w,newShape:y}=m;w&&t.connect(y,w)}function l(m){t.updateProperties(m,{isForCompensation:!0})}function u(m){t.updateProperties(m,{isForCompensation:void 0})}function p(m){for(const w of m.incoming)n.canConnect(w.source,m)||t.removeConnection(w);for(const w of m.outgoing)n.canConnect(m,w.target)||t.removeConnection(w)}function f(m,w){m.outgoing.filter(x=>M(x,"bpmn:Association")).filter(x=>Is(x.target)&&!w.includes(x)).forEach(x=>t.removeConnection(x))}function d(m){const w=m.attachers.slice();w.length&&t.removeElements(w)}function g(m){const w=m.incoming.filter(y=>Aa(y.source));t.removeElements(w)}function h(m){const w=m.outgoing.filter(y=>M(y,"bpmn:SequenceFlow"));t.removeElements(w)}}De(cd,ve),cd.$inject=["eventBus","modeling","bpmnRules"];function Is(e){const t=be(e);return t&&t.get("isForCompensation")}function Aa(e){return e&&M(e,"bpmn:BoundaryEvent")&&Sa(e,"bpmn:CompensateEventDefinition")}function Ol(e){return e&&M(e,"bpmn:Activity")&&!Gn(e)}function ld(e){e.invoke(ve,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=Ma(i,"bpmn:Participant"))})}ld.$inject=["injector"],De(ld,ve);function ud(e,t){ve.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}})}ud.$inject=["eventBus","bpmnFactory"],De(ud,ve);var pd=20,fd=20,fb=30,Dl=2e3;function dd(e,t,n){ve.call(this,t),t.on(["create.start","shape.move.start"],Dl,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")&&!rt(p)&&!Lt(p)});if(c.length){var l=ln(c),u=Ik(a,l);q(a,u),r.createConstraints=Bk(a,l)}}}),t.on("create.start",Dl,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",Dl,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",Dl,function(o){var r=o.elements,a=o.parent,s=Nk(r),c;s&&M(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=be(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=be(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)&&be(s).set("processRef",be(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)&&be(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)}dd.$inject=["canvas","eventBus","modeling"],De(dd,ve);function Ik(e,t){t={width:t.width+pd*2+fb,height:t.height+fd*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 Bk(e,t){return t=Ge(t),{bottom:t.top+e.height/2-fd,left:t.right-e.width/2+pd,top:t.bottom-e.height/2+fd,right:t.left+e.width/2-pd-fb}}function Nk(e){return $t(e,function(t){return M(t,"bpmn:Participant")})}var db="__targetRef_placeholder";function hd(e,t){ve.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],hb(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],hb(r));function n(a,s,c){var l=a.get("dataInputAssociations");return $t(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=$t(c,function(u){return u.name===db});return!l&&s&&(l=t.create("bpmn:Property",{name:db}),an(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||on(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,w;h&&h!==p&&o(h,l),d&&d!==p&&o(d,l),p?(w=i(p,!0),m.targetRef=w):m.targetRef=null}}hd.$inject=["eventBus","bpmnFactory"],De(hd,ve);function hb(e){return function(t){var n=t.context,i=n.connection;if(M(i,"bpmn:DataInputAssociation"))return e(t)}}function Ll(e){this._bpmnUpdater=e}Ll.$inject=["bpmnUpdater"],Ll.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),[]},Ll.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 gd(e,t,n,i){ve.call(this,i),t.registerHandler("dataStore.updateContainment",Ll);function o(){return n.filter(function(s){return M(s,"bpmn:Participant")&&be(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:yt(s),newSemanticParent:u.processRef||u,newDiParent:yt(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:Fk(u,"bpmn:Participant");a(l,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();at(l,["bpmn:Participant","bpmn:SubProcess"])&&M(u,"bpmn:Collaboration")&&r(u).filter(function(p){return $k(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)})})}gd.$inject=["canvas","commandStack","elementRegistry","eventBus"],De(gd,ve);function $k(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 Fk(e,t){for(;e.parent;){if(M(e.parent,t))return e.parent;e=e.parent}}var Il=Math.max,Bl=Math.min,jk=20;function gb(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function Hk(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 zk(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 Nl(e,t,n){var i=t[e],o=n.min&&n.min[e],r=n.max&&n.max[e];return Ke(o)&&(i=(/top|left/.test(e)?Bl:Il)(i,o)),Ke(r)&&(i=(/top|left/.test(e)?Il:Bl)(i,r)),i}function Gk(e,t){if(!t)return e;var n=Ge(e);return bl({top:Nl("top",n,t),right:Nl("right",n,t),bottom:Nl("bottom",n,t),left:Nl("left",n,t)})}function Vk(e,t,n,i){var o=Ge(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?Ge(i):r,s={top:Bl(r.top,a.top),left:Bl(r.left,a.left),bottom:Il(r.bottom,a.bottom),right:Il(r.right,a.right)};return bl(s)}function Bs(e,t){return typeof e<"u"?e:jk}function Wk(e,t){var n,i,o,r;return typeof t=="object"?(n=Bs(t.left),i=Bs(t.right),o=Bs(t.top),r=Bs(t.bottom)):n=i=o=r=Bs(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function Uk(e){return!(e.waypoints||e.type==="label")}function mb(e,t){var n;if(e.length===void 0?n=ct(e.children,Uk):n=e,n.length)return Wk(ln(n),t)}var Jo=Math.abs;function qk(e,t){return gb(Ge(t),Ge(e))}var Yk=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Si=30;function $l(e,t){return t=t||[],e.children.filter(function(n){M(n,"bpmn:Lane")&&($l(n,t),t.push(n))}),t}function er(e){return e.children.filter(function(t){return M(t,"bpmn:Lane")})}function Ri(e){return Ma(e,Yk)||e}function Kk(e,t){var n=Ri(e),i=M(n,"bpmn:Process")?[]:[n],o=$l(n,i),r=Ge(e),a=Ge(t),s=qk(e,t),c=[],l=En(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=Ge(u);s.top&&(Jo(h.bottom-r.top)<10&&(d=a.top-h.bottom),Jo(h.top-r.top)<5&&(p=a.top-h.top)),s.left&&(Jo(h.right-r.left)<10&&(f=a.left-h.right),Jo(h.left-r.left)<5&&(g=a.left-h.left)),s.bottom&&(Jo(h.top-r.bottom)<10&&(p=a.bottom-h.top),Jo(h.bottom-r.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(Jo(h.left-r.right)<10&&(g=a.right-h.left),Jo(h.right-r.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:u,newBounds:zk(u,{top:p,right:f,bottom:d,left:g})})}}),c}var Xk=500;function md(e,t){ve.call(this,e);function n(i,o){var r=En(i),a=er(o),s=[],c=[],l=[],u=[];if(Br(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",Xk,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))})}md.$inject=["eventBus","spaceTool"],De(md,ve);var yb=500;function Fl(e,t){t.invoke(ve,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",yb,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return vb(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",yb,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;vb(a,Qk(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}Fl.$inject=["bpmnReplace","injector"],De(Fl,ve),Fl.prototype._replaceShape=function(e){var t=Zk(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function Zk(e){var t=be(e),n=t.eventDefinitions;return n&&n[0]}function vb(e,t){return!rt(e)&&M(e,"bpmn:BoundaryEvent")&&!t}function Qk(e,t){return e.indexOf(t)!==-1}var jl=Math.round,Jk=Math.max;function e2(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 t2(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var bb=10;function n2(e,t){var n,i;for(n=0;i=e[n];n++)if(Cs(i,t)<=bb)return{point:e[n],bendpoint:!0,index:n};return null}function i2(e,t){var n=Sv(e2(t,bb),t2(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=Jk(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:jl(i.x+o.x)/2,y:jl(i.y+o.y)/2},index:i.segment2}:{point:{x:jl(i.x),y:jl(i.y)},index:i.segment2}:null}function yd(e,t){return n2(e,t)||i2(e,t)}function vd(e,t,n){ve.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(),w;Ke(a.width)?w=Xe(a):w=a;var y=yd(s,w);if(y){if(c=s.slice(0,y.index),l=s.slice(y.index+(y.bendpoint?1:0)),!c.length||!l.length)return;u=y.bendpoint?s[y.index]:w,(c.length===1||!xb(o,c[c.length-1]))&&c.push(wb(u)),(l.length===1||!xb(o,l[0]))&&l.unshift(wb(u))}p=r.source,f=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||w),d=r),t.canConnect(o,f,r)&&(d?g=n.connect(o,f,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||w),g=r));var v=[].concat(d&&ct(m,function(x){return x.source===d.source})||[],g&&ct(h,function(x){return x.target===g.target})||[]);v.length&&n.removeElements(v)}this.preExecute("elements.move",function(o){var r=o.newParent,a=o.shapes,s=o.delta,c=a[0];if(!(!c||!r)){r&&r.waypoints&&(o.newParent=r=r.parent);var l=Xe(c),u={x:l.x+s.x,y:l.y+s.y},p=$t(r.children,function(f){var d=t.canInsert(a,f);return d&&yd(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)}De(vd,ve),vd.$inject=["eventBus","bpmnRules","modeling"];function xb(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 wb(e){return q({},e)}function bd(e,t){ve.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)&&Pa(o)){var c=[];M(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&Pa(l)):c=a.incoming.filter(l=>l!==o&&Pa(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(Pa).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(Pa).forEach(function(s){const c=a.incoming.filter(Pa).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}bd.$inject=["eventBus","modeling"],De(bd,ve);function Pa(e){return M(e,"bpmn:SequenceFlow")}var Hl=1500,_b=2e3;function Eb(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"],Hl,function(i){var o=i.context,r=o.shape||i.shape,a=i.hover;M(a,"bpmn:Lane")&&!at(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Ri(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(r.labelTarget||at(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"],Hl,function(i){var o=i.hover;M(o,"bpmn:Lane")&&(i.hover=Ri(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Hl,function(i){var o=i.context,r=i.hover,a=o.type;M(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Ri(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Hl,function(i){var o=i.context,r=o.start;M(r,"bpmn:Lane")&&(o.start=Ri(r)||r)}),t.on("shape.move.start",_b,function(i){var o=i.shape;M(o,"bpmn:Lane")&&(i.shape=Ri(o)||o)}),t.on("spaceTool.move",_b,function(i){var o=i.hover;o&&M(o,"bpmn:Lane")&&(i.hover=Ri(o))})}Eb.$inject=["elementRegistry","eventBus","canvas"];var Sb=770;function xd(e,t,n,i){n.invoke(ve,this);function o(s,c){var l=be(s),u=c.categoryValue||l.categoryValueRef;u||(u=ub(e,l));var p=c.category||u.$parent||lb(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=be(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=be(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=be(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&&!be(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&&!be(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||be(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",Sb,function(s){var c=s.descriptor,l=s.element;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=be(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",Sb,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})}xd.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],De(xd,ve);function wd(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 Rb(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=wd(i,o,r,a),l=wd(i,o,r,s),u;c&&l?Cb(c,r)>Cb(l,r)?u=l:u=c:u=c||l,i.original=u}function n(i){var o=i.waypoints;t(o[0],o[1],Xe(i.source)),t(o[o.length-1],o[o.length-2],Xe(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}Rb.$inject=["eventBus"];function Cb(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function _d(e){ve.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=be(i),r=yt(i);if(at(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}_d.$inject=["eventBus"],De(_d,ve);function Mb(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ab(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function o2(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 r2(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 Ed(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=r2([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 Pb(e,t){var n=Ed(e,t),i={x:n.x-e.x,y:n.y-e.y};return Mb(i)}function Ns(e,t){return Mb({x:e.x-t.x,y:e.y-t.y})}var Tb=Math.sqrt,kb=Math.min,a2=Math.max,Ob=Math.abs;function Db(e){return Math.pow(e,2)}function $s(e,t){return Tb(Db(e.x-t.x)+Db(e.y-t.y))}function s2(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],Ib(i,o)?l=[i]:(r=$s(e,i),a=$s(e,o),c=kb(r,a),l=c2(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:Ib(i,l[0])?n:n+1}),l.length===2&&(s=u2(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:$s(i,s)/$s(i,o)}),p=$s(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function c2(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=Tb(d),h=-p+g,m=-p-g,w={x:e.x-o*h,y:e.y-r*h};if(d===0)return[w];var y={x:e.x-o*m,y:e.y-r*m};return[w,y].filter(function(v){return l2(v,e,t)})}function l2(e,t,n){return Lb(e.x,t.x,n.x)&&Lb(e.y,t.y,n.y)}function Lb(e,t,n){return e>=kb(t,n)-zl&&e<=a2(t,n)+zl}function u2(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var zl=.1;function Ib(e,t){return Ob(e.x-t.x)<=zl&&Ob(e.y-t.y)<=zl}function p2(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=Nb(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 Bb(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=s2(e,n),c=s.segmentIndex,l=p2(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=$b(n,c),p=$b(t,l),f=s.position,d=d2(u,f),g=f2(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,w=n[m];if(t.indexOf(w)!==-1)return a;if(h===0){var y=t[m];return o=y.x-s.position.x,r=y.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=Nb(n,m))}var v={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},x=o2({x:e.x-f.x,y:e.y-f.y},g);return o=v.x+x.x-e.x,r=v.y+x.y-e.y,{point:xo(v),delta:xo({x:o,y:r})}}function Nb(e,t){var n=Ns(e[t-1],e[t]),i=Ns(e[t],e[t+1]),o=n/(n+i);return o}function f2(e,t){var n=Ab(e),i=Ab(t);return i-n}function $b(e,t){return[e[t],e[t+1]]}function d2(e,t){var n=Ns(e[0],e[1]),i=Ns(e[0],t);return n===0?0:i/n}function h2(e,t,n,i){var o=Xe(e);return Bb(o,t,n,i).delta}function Fs(e,t,n){var i=Ls(t),o=Ls(n),r=Vi(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return xo({x:o.x+a.x,y:o.y+a.y})}function Fb(e,t,n){var i=Ls(e),o=Ls(t),r=Ls(n),a=Vi(e,i),s=Vi(i,o),c=g2(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 xo({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function g2(e,t,n){var i=Ge(t),o=Ge(n);if(m2(i,o))return null;var r=On(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=On(n,s),c!==r?null:a}function m2(e,t){return y2(e,t)||v2(e,t)}function y2(e,t){return e.right!==t.right&&e.left!==t.left}function v2(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var jb="name",Hb="text";function Sd(e,t,n,i){ve.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{be(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if(jb in l&&t.updateLabel(c,l[jb]),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;rt(l)||!Qo(l)||vi(l)&&t.updateLabel(l,vi(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=q({},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),h2(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=be(c);u&&Qo(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(!(!rt(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(vi(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(Rl(c)){var p=c.label,f=Xe(p),d=w2(u),g=x2(f,d),h=b2(g,u,l);t.moveShape(p,h)}})}De(Sd,ve),Sd.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function b2(e,t,n){var i=Fs(e,t,n);return xo(Vi(i,e))}function x2(e,t){if(t.length){var n=_2(e,t);return Ed(e,n)}}function w2(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 _2(e,t){var n=t.map(function(o){return{line:o,distance:Pb(e,o)}}),i=Yi(n,"distance");return i[0].line}function E2(e,t,n,i){return Bb(e,t,n,i).point}function Rd(e,t){ve.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=q({},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),E2(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)})})}De(Rd,ve),Rd.$inject=["eventBus","modeling"];function Gl(e,t,n){var i=Wl(e),o=Gb(i,t),r=i[0];return o.length?o[o.length-1]:Fs(r.original||r,n,t)}function Vl(e,t,n){var i=Wl(e),o=Gb(i,t),r=i[i.length-1];return o.length?o[0]:Fs(r.original||r,n,t)}function Cd(e,t,n){var i=Wl(e),o=zb(t,n),r=i[0];return Fs(r.original||r,o,t)}function Md(e,t,n){var i=Wl(e),o=zb(t,n),r=i[i.length-1];return Fs(r.original||r,o,t)}function zb(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Wl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Gb(e,t){var n=Fn(e,R2);return ct(n,function(i){return S2(i,t)})}function S2(e,t){return On(t,e,1)==="intersect"}function R2(e){return e.original||e}function Ad(e,t){ve.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(C2(i,o)){var r=M2(i);r.incoming.forEach(function(a){var s=Vl(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=Gl(a,o,i);t.reconnectStart(a,o,s)})}},!0)}Ad.$inject=["eventBus","modeling"],De(Ad,ve);function C2(e,t){return M(e,"bpmn:Participant")&&ht(e)&&M(t,"bpmn:Participant")&&!ht(t)}function M2(e){var t=Ss([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 A2=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Vb(e){const t=be(e);if(!M(t,"bpmn:BoundaryEvent")&&!(M(t,"bpmn:StartEvent")&&Gn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:A2.some(i=>M(n[0],i))}function Wb(e){return M(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Pd(e,t){e.invoke(ve,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!Vb(o))return;const a=Wb(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=be(i).get(a),l=be(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}Pd.$inject=["injector","modeling"],De(Pd,ve);function Td(e,t){ve.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=yt(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}De(Td,ve),Td.$inject=["eventBus","modeling"];function kd(e,t,n){ve.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=P2(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}De(kd,ve),kd.$inject=["eventBus","bpmnRules","modeling"];function Ta(e){return e.original||e}function P2(e,t){var n=wd(Ta(e[e.length-2]),Ta(e[e.length-1]),Ta(t[1]),Ta(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Ta(e[0]),Ta(t[t.length-1])]}function Od(e,t){ve.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)}Od.$inject=["eventBus","modeling"],De(Od,ve);function Dd(e,t,n,i){ve.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;W(u,r)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,f=p.businessObject,d;u.default&&(d=$t(p.outgoing,ca({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})})}De(Dd,ve),Dd.$inject=["eventBus","modeling","bpmnRules","injector"];function Ul(e,t,n,i,o,r){i.invoke(ve,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=ni(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=[];W(s.closure.topLevel,function(f){Gn(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})})}De(Ul,ve),Ul.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,o=this._selection;W(t,function(r){var a={type:r.newElementType},s=n.get(r.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&o.select(e)},Ul.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var T2=1500,k2={width:140,height:120},Ld={width:300,height:60},Id={width:60,height:300},ql={width:300,height:150},Yl={width:150,height:300},Ub={width:140,height:120},qb={width:100,height:40};function Yb(e){e.on("resize.start",T2,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=B2(i,o,r)),M(i,"bpmn:SubProcess")&&ht(i)&&(n.minDimensions=Ub),M(i,"bpmn:TextAnnotation")&&(n.minDimensions=qb)})}Yb.$inject=["eventBus"];var tr=Math.abs,O2=Math.min,D2=Math.max;function Kb(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function ka(e,t,n){return Kb(e,t,n,O2)}function Oa(e,t,n){return Kb(e,t,n,D2)}var L2={top:20,left:50,right:20,bottom:20},I2={top:50,left:20,right:20,bottom:20};function B2(e,t,n){var i=Ri(e),o=!0,r=!0,a=$l(i,[i]),s=Ge(e),c={},l={},u=En(e),p=u?Ld:Id;/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=Ge(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&&tr(s.top-h.bottom)<10&&Oa(c,"top",h.top+p.height),tr(s.top-h.top)<5&&ka(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&tr(s.right-h.left)<10&&ka(c,"right",h.right-p.width),tr(s.right-h.right)<5&&Oa(l,"right",h.left+p.width)),/s/.test(t)&&(n&&tr(s.bottom-h.top)<10&&ka(c,"bottom",h.bottom-p.height),tr(s.bottom-h.bottom)<5&&Oa(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&tr(s.left-h.right)<10&&Oa(c,"left",h.left+p.width),tr(s.left-h.left)<5&&ka(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?L2:I2;return f.forEach(function(g){var h=Ge(g);/n/.test(t)&&(!u||o)&&ka(l,"top",h.top-d.top),/e/.test(t)&&(u||r)&&Oa(l,"right",h.right+d.right),/s/.test(t)&&(!u||r)&&Oa(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||o)&&ka(l,"left",h.left-d.left)}),{min:l,max:c}}function Xb(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Da(e){return e.originalEvent||e.srcEvent}function Bd(e){Xb(e),Xb(Da(e))}function Fr(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function Zb(){return/mac/i.test(navigator.platform)}function Qb(e,t){return(Da(e)||e).button===t}function nr(e){return Qb(e,0)}function N2(e){return Qb(e,1)}function js(e){var t=Da(e)||e;return nr(e)?Zb()?t.metaKey:t.ctrlKey:!1}function Kl(e){var t=Da(e)||e;return nr(e)&&t.shiftKey}var Jb=1001;function ex(e,t){e.on("resize.start",Jb+500,function(n){var i=n.context,o=i.shape;(M(o,"bpmn:Lane")||M(o,"bpmn:Participant"))&&(i.balanced=!js(n))}),e.on("resize.end",Jb,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=Pv(a),t.resizeLane(o,a,i.balanced)),!1})}ex.$inject=["eventBus","modeling"];var $2=500;function Nd(e,t,n,i,o){n.invoke(ve,this);function r(u){return at(u,["bpmn:ReceiveTask","bpmn:SendTask"])||F2(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!$t(f,ca({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(at(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(at(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=be(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),an(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");on(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!r(f))){var d=be(f),g=c(d);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",$2,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)})}Nd.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],De(Nd,ve);function F2(e,t){return Ye(t)||(t=[t]),No(t,function(n){return Sa(e,n)})}var tx=Math.max;function nx(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,o=t.start,r={};return W(n,function(a){var s=a.id;M(a,"bpmn:Participant")&&(r[s]=H2(a,i,o)),M(a,"bpmn:Lane")&&(r[s]=En(a)?Ld:Id),M(a,"bpmn:SubProcess")&&ht(a)&&(r[s]=Ub),M(a,"bpmn:TextAnnotation")&&(r[s]=qb),M(a,"bpmn:Group")&&(r[s]=k2)}),r})}nx.$inject=["eventBus"];function j2(e){return e==="x"}function H2(e,t,n){var i=En(e);if(!V2(e))return i?ql:Yl;var o=j2(t),r={};return o?i?r=ql:r={width:G2(e,n,o),height:Yl.height}:i?r={width:ql.width,height:z2(e,n,o)}:r=Yl,r}function z2(e,t,n){var i;return i=W2(e,t,n),tx(ql.height,i)}function G2(e,t,n){var i;return i=U2(e,t,n),tx(Yl.width,i)}function V2(e){return!!er(e).length}function W2(e,t,n){var i=er(e),o;return o=$d(i,t,n),e.height-o.height+Ld.height}function U2(e,t,n){var i=er(e),o;return o=$d(i,t,n),e.width-o.width+Id.width}function $d(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=er(o),r.length?$d(r,t,n):o}var ix="_plane";function ox(e){var t=e.id;return q2(t)}function io(e){var t=e.id;return M(e,"bpmn:SubProcess")?rx(t):t}function jr(e){return rx(e)}function Xl(e){var t=yt(e);return M(t,"bpmndi:BPMNPlane")}function rx(e){return e+ix}function q2(e){return e.replace(new RegExp(ix+"$"),"")}var ax=400,Y2=600,sx={x:180,y:160};function So(e,t,n,i,o,r,a){ve.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")&&!ht(p)}function l(p){var f=p.shape,d=p.newRootElement,g=be(f);d=s._addDiagram(d||g),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=be(f);s._removeDiagram(d);var g=p.newRootElement=a.get(io(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;W(f,function(d){if(c(d)){var g=a.get(io(d));if(!(!g||!d.children||!d.children.length)){var h=cx(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")||!ht(f)||W(Ts([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(io(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(io(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(io(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(Xl(f)){a.updateId(f,jr(m)),a.updateId(h,m);return}var w=a.get(jr(h));w&&a.updateId(jr(h),jr(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(Xl(f)){a.updateId(f,jr(h)),a.updateId(m,h);return}var w=a.get(jr(m));w&&a.updateId(w,jr(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Xl(f)){var d=f,g=a.get(ox(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",ax,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(ht(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",ax,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(ht(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",Y2,function(p){var f=p.shape;if(M(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(ht(f))s._moveChildrenToShape(d.children.slice(),f),W(Ts(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),W(h.associations,m=>{n.moveConnection(m,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var g=cx(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=io(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(yt(h),"bpmndi:BPMNPlane");if(m){var w=ox(h),y=$t(g,function(v){return v.id===w});y&&(f.parent=y.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}De(So,ve),So.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var o=ln(i),r;if(!t.x)r={x:sx.x-o.x,y:sx.y-o.y};else{var a=Xe(t),s=Xe(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},So.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Qv(e).map(i=>i.annotation));n.size&&W(Ts(e.children),i=>{n.has(i.annotation)&&W(i.associations,o=>{t.removeConnection(o)})})},So.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},So.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},So.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:io(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},So.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=$t(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},So.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function K2(e){var t=[];return W(Ts(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function cx(e){return e.children.slice().concat(K2(e.children)).concat(X2(e))}function X2(e){return Gf(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Fd(e,t){e.invoke(ve,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"))||!ht(o))){var r=Z2(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}Fd.$inject=["injector","modeling"],De(Fd,ve);function Z2(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function jd(e,t){ve.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,vi(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}}})}De(jd,ve),jd.$inject=["eventBus","textRenderer"];function Hd(e,t){ve.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(ht(i))return;var o=Ss(i);o.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();W(s,function(l){r(l,!0)}),W(c,function(l){r(l,!1)})});function r(a,s){o.indexOf(a.source)!==-1&&o.indexOf(a.target)!==-1||M(a,"bpmn:Association")&&(M(a.source,"bpmn:TextAnnotation")||M(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Xe(i)):t.reconnectStart(a,i,Xe(i)))}},!0)}De(Hd,ve),Hd.$inject=["eventBus","modeling"];var zd=500;function Gd(e,t,n){ve.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=Q2(c).concat([a]),p=mb(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"],zd,function(a){var s=a.context,c=s.shape;M(c,"bpmn:SubProcess")&&(c.collapsed?yt(c).isExpanded=!1:(i(c.children),yt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],zd,function(a){var s=a.context,c=s.shape;c.collapsed?yt(c).isExpanded=!1:yt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],zd,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"})})}De(Gd,ve),Gd.$inject=["eventBus","elementFactory","modeling"];function Q2(e){return e.filter(function(t){return!t.hidden})}function Vd(e,t,n,i){t.invoke(ve,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;rt(a)||(M(a,"bpmn:Participant")&&ht(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)})}De(Vd,ve),Vd.$inject=["canvas","injector","moddle","modeling"];function Wd(e,t){ve.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;J2(o,r)&&t.updateProperties(r,{default:null})})}De(Wd,ve),Wd.$inject=["eventBus","modeling"];function J2(e,t){if(!M(e,"bpmn:SequenceFlow"))return!1;var n=be(t),i=be(e);return n.get("default")===i}var eO=500,tO=5e3,lx=["shape.create","shape.delete","shape.move","shape.resize"],ux=[...lx,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Ud(e,t){ve.call(this,e);var n;function i(){return n=n||new nO,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(ux,tO,function(){i()}),this.postExecuted(ux,eO,function(){r()}),this.preExecute(lx,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))})}Ud.$inject=["eventBus","modeling"],De(Ud,ve);function nO(){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 iO=500,oO=5e3,px=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],fx=[...px,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function qd(e,t){ve.call(this,e);var n;function i(){return n=n||new rO,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(fx,oO,function(){i()}),this.postExecuted(fx,iO,function(){r()}),this.preExecute(px,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)})}qd.$inject=["eventBus","modeling"],De(qd,ve);function rO(){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 Yd(e,t){ve.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)aO(r)&&!cO(r)&&t.updateProperties(r,{isForCompensation:void 0})})}De(Yd,ve),Yd.$inject=["eventBus","modeling"];function aO(e){const t=be(e);return t&&t.isForCompensation}function sO(e){return e&&M(e,"bpmn:BoundaryEvent")&&Sa(e,"bpmn:CompensateEventDefinition")}function cO(e){return e.incoming.filter(n=>sO(n.source)).length>0}const lO={__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",nd],appendBehavior:["type",id],associationBehavior:["type",rd],attachEventBehavior:["type",kl],artifactBehavior:["type",od],boundaryEventBehavior:["type",ad],categoryRootElementReferenceBehavior:["type",sd],compensateBoundaryEventBehaviour:["type",cd],createBehavior:["type",ld],createDataObjectBehavior:["type",ud],createParticipantBehavior:["type",dd],dataInputAssociationBehavior:["type",hd],dataStoreBehavior:["type",gd],deleteLaneBehavior:["type",md],detachEventBehavior:["type",Fl],dropOnFlowBehavior:["type",vd],eventBasedGatewayBehavior:["type",bd],fixHoverBehavior:["type",Eb],groupBehavior:["type",xd],importDockingFix:["type",Rb],isHorizontalFix:["type",_d],labelBehavior:["type",Sd],layoutConnectionBehavior:["type",Rd],messageFlowBehavior:["type",Ad],nonInterruptingBehavior:["type",Pd],removeElementBehavior:["type",kd],removeEmbeddedLabelBoundsBehavior:["type",Td],removeParticipantBehavior:["type",Od],replaceConnectionBehavior:["type",Dd],replaceElementBehaviour:["type",Ul],resizeBehavior:["type",Yb],resizeLaneBehavior:["type",ex],rootElementReferenceBehavior:["type",Nd],spaceToolBehavior:["type",nx],subProcessPlaneBehavior:["type",So],subProcessStartEventBehavior:["type",Fd],textAnnotationBehavior:["type",jd],toggleCollapseConnectionBehaviour:["type",Hd],toggleElementCollapseBehaviour:["type",Gd],unclaimIdBehavior:["type",Vd],unsetDefaultFlowBehavior:["type",Wd],updateFlowNodeRefsBehavior:["type",Ud],updateCategoryValueRefsBehavior:["type",qd],setCompensationActivityAfterPasteBehavior:["type",Yd]};function Kd(e){this._commandStack=e.get("commandStack",!1)}Kd.$inject=["injector"],Kd.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const oo={__init__:["rules"],rules:["type",Kd]};function Ci(e){ve.call(this,e),this.init()}Ci.$inject=["eventBus"],De(Ci,ve),Ci.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)})},Ci.prototype.init=function(){};function dx(e,t){var n=On(e,t,-15);return n!=="intersect"?n:null}function Ln(e){Ci.call(this,e)}De(Ln,Ci),Ln.$inject=["eventBus"],Ln.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return uO(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 Ql(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Ql(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 Cx(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Lt(i)&&!Jl(t,i)?!1:Bo(t,function(o){return Lt(o)?Ql(o.source,o.target,o):o.host?Hs(o,o.host,null,n):Jd(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 xx(a)&&!n.includes(a.host)})?!1:Hs(n,t,null,i)||Sx(n,t,i)||Rx(n,t)||Jl(n,t)}),this.addRule("shape.create",function(e){return Jd(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Hs(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return kx(n,t)})},Ln.prototype.canConnectMessageFlow=Px,Ln.prototype.canConnectSequenceFlow=Tx,Ln.prototype.canConnectDataAssociation=eh,Ln.prototype.canConnectAssociation=Mx,Ln.prototype.canConnectCompensationAssociation=Ax,Ln.prototype.canMove=Rx,Ln.prototype.canAttach=Hs,Ln.prototype.canReplace=Sx,Ln.prototype.canDrop=La,Ln.prototype.canInsert=Jl,Ln.prototype.canCreate=Jd,Ln.prototype.canConnect=Ql,Ln.prototype.canResize=Cx,Ln.prototype.canCopy=kx;function uO(e){return Xd(e)?null:at(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Xd(e){return!e||rt(e)}function hx(e){do{if(M(e,"bpmn:Process"))return be(e);if(M(e,"bpmn:Participant"))return be(e).processRef||be(e)}while(e=e.parent)}function Zd(e){return M(e,"bpmn:TextAnnotation")}function Qd(e){return M(e,"bpmn:Group")&&!e.labelTarget}function gx(e){return M(e,"bpmn:BoundaryEvent")&&ro(e,"bpmn:CompensateEventDefinition")}function Zl(e){return be(e).isForCompensation}function pO(e,t){var n=hx(e),i=hx(t);return n===i}function fO(e){return M(e,"bpmn:InteractionNode")&&!M(e,"bpmn:BoundaryEvent")&&(!M(e,"bpmn:Event")||M(e,"bpmn:ThrowEvent")&&vx(e,"bpmn:MessageEventDefinition"))}function dO(e){return M(e,"bpmn:InteractionNode")&&!Zl(e)&&(!M(e,"bpmn:Event")||M(e,"bpmn:CatchEvent")&&vx(e,"bpmn:MessageEventDefinition"))&&!(M(e,"bpmn:BoundaryEvent")&&!ro(e,"bpmn:MessageEventDefinition"))}function mx(e){for(var t=e;t=t.parent;){if(M(t,"bpmn:FlowElementsContainer"))return be(t);if(M(t,"bpmn:Participant"))return be(t).processRef}return null}function yx(e,t){var n=mx(e),i=mx(t);return n===i}function ro(e,t){var n=be(e);return!!$t(n.eventDefinitions||[],function(i){return M(i,t)})}function vx(e,t){var n=be(e);return(n.eventDefinitions||[]).every(function(i){return M(i,t)})}function hO(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:EndEvent")&&!Gn(e)&&!(M(e,"bpmn:IntermediateThrowEvent")&&ro(e,"bpmn:LinkEventDefinition"))&&!gx(e)&&!Zl(e)}function gO(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:StartEvent")&&!M(e,"bpmn:BoundaryEvent")&&!Gn(e)&&!(M(e,"bpmn:IntermediateCatchEvent")&&ro(e,"bpmn:LinkEventDefinition"))&&!Zl(e)}function mO(e){return M(e,"bpmn:ReceiveTask")||M(e,"bpmn:IntermediateCatchEvent")&&(ro(e,"bpmn:MessageEventDefinition")||ro(e,"bpmn:TimerEventDefinition")||ro(e,"bpmn:ConditionalEventDefinition")||ro(e,"bpmn:SignalEventDefinition"))}function yO(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function bx(e,t){var n=yO(t);return n.indexOf(e)!==-1}function Ql(e,t,n){if(Xd(e)||Xd(t))return null;if(!M(n,"bpmn:DataAssociation")){if(Px(e,t))return{type:"bpmn:MessageFlow"};if(Tx(e,t))return{type:"bpmn:SequenceFlow"}}var i=eh(e,t);return i||(Ax(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Mx(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function La(e,t){return rt(e)||Qd(e)?!0:M(t,"bpmn:Participant")&&!ht(t)?!1:M(e,"bpmn:Participant")?M(t,"bpmn:Process")||M(t,"bpmn:Collaboration"):at(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")&&!vO(e)?!1:M(e,"bpmn:FlowElement")&&!M(e,"bpmn:DataStoreReference")?M(t,"bpmn:FlowElementsContainer")?ht(t):at(t,["bpmn:Participant","bpmn:Lane"]):M(e,"bpmn:DataStoreReference")&&M(t,"bpmn:Collaboration")?No(be(t).get("participants"),function(n){return!!n.get("processRef")}):at(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?at(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 vO(e){return be(e).cancelActivity&&(wx(e)||_x(e))}function xx(e){return!rt(e)&&M(e,"bpmn:BoundaryEvent")}function bO(e){return M(e,"bpmn:Lane")}function xO(e){return xx(e)||M(e,"bpmn:IntermediateThrowEvent")&&wx(e)?!0:M(e,"bpmn:IntermediateCatchEvent")&&_x(e)}function wx(e){var t=be(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function _x(e){return Ex(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Ex(e,t){return t.some(function(n){return ro(e,n)})}function wO(e){return M(e,"bpmn:ReceiveTask")&&$t(e.incoming,function(t){return M(t.source,"bpmn:EventBasedGateway")})}function Hs(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return rt(o)||!xO(o)||Gn(t)||!M(t,"bpmn:Activity")||Zl(t)||i&&!dx(i,t)||wO(t)?!1:"attach"}function Sx(e,t,n){if(!t)return!1;var i={replacements:[]};return W(e,function(o){Gn(t)||M(o,"bpmn:StartEvent")&&o.type!=="label"&&La(o,t)&&(TT(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(kT(o)||OT(o)||DT(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),Ex(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")||ro(o,"bpmn:CancelEventDefinition")&&o.type!=="label"&&(M(o,"bpmn:EndEvent")&&La(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),M(o,"bpmn:BoundaryEvent")&&Hs(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Rx(e,t){return No(e,bO)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return La(n,t)})}function Jd(e,t,n,i){return t?rt(e)||Qd(e)?!0:La(e,t)||Jl(e,t):!1}function Cx(e,t,n){return M(e,"bpmn:SubProcess")?ht(e)&&(!t||t.width>=100&&t.height>=80):M(e,"bpmn:Lane")||M(e,"bpmn:Participant")?!0:Zd(e)?n?n==="e"||n==="w":!0:Qd(e)?!0:rt(e)?n?n==="e"||n==="w":!0:!1}function _O(e,t){var n=Zd(e),i=Zd(t);return(n||i)&&n!==i}function Mx(e,t){return bx(t,e)||bx(e,t)?!1:_O(e,t)?!0:!!eh(e,t)}function Ax(e,t){return yx(e,t)&&gx(e)&&M(t,"bpmn:Activity")&&!SO(t,e)&&!Gn(t)}function Px(e,t){return Dx(e)&&!Dx(t)?!1:fO(e)&&dO(t)&&!pO(e,t)}function Tx(e,t){return hO(e)&&gO(t)&&yx(e,t)&&!(M(e,"bpmn:EventBasedGateway")&&!mO(t))}function eh(e,t){return at(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&at(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:at(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&at(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Jl(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:at(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!rt(t)&&M(e,"bpmn:FlowNode")&&!M(e,"bpmn:BoundaryEvent")&&La(e,t.parent)}function th(e,t){return e&&t&&e.indexOf(t)!==-1}function kx(e,t){return rt(t)?!0:!(M(t,"bpmn:Lane")&&!th(e,t.parent)||M(t,"bpmn:MessageFlow")&&!EO(e,t))}function EO(e,t){var n=Ox(t.source),i=Ox(t.target);return th(e,n)&&th(e,i)}function Ox(e){for(;e;e=e.parent)if(M(e,"bpmn:Participant"))return e;return null}function Dx(e){return Ma(e,"bpmn:Process")||Ma(e,"bpmn:Collaboration")}function SO(e,t){return e.attachers.includes(t)}const RO={__depends__:[oo],__init__:["bpmnRules"],bpmnRules:["type",Ln]};var CO=2e3;function Lx(e,t){e.on("saveXML.start",CO,n);function n(){var i=t.getRootElements();W(i,function(o){var r=yt(o),a,s;a=Ss([o]),a=ct(a,function(c){return c!==o&&!c.labelTarget}),s=Fn(a,yt),r.set("planeElement",s)})}}Lx.$inject=["eventBus","canvas"];const MO={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Lx]};function eu(e){ve.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)})}eu.prototype.getOrdering=function(e,t){return null},De(eu,ve);function nh(e,t){eu.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=$t(n,function(c){return at(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&&!at(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=Xg(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}}}nh.$inject=["eventBus","canvas"],De(nh,eu);const AO={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",nh]};function zs(){}zs.prototype.get=function(){return this._data},zs.prototype.set=function(e){this._data=e},zs.prototype.clear=function(){var e=this._data;return delete this._data,e},zs.prototype.isEmpty=function(){return!this._data};const PO={clipboard:["type",zs]};var Ix=1500;function Bx(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",Ix,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Ix,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=Fr(a),c=document.elementFromPoint(s.x,s.y),TO(c)}}Bx.$inject=["elementRegistry","eventBus","injector"];function TO(e){return Lr(e,"svg, .djs-element",!0)}const kO={__init__:["hoverFix"],hoverFix:["type",Bx]};function OO(e){return!0}function tu(e){return nr(e)||N2(e)}var Nx=500;function $x(e,t,n){var i=this;function o(P,T,j){if(!s(P,T)){var F,G,Q;j?G=t.getGraphics(j):(F=T.delegateTarget||T.target,F&&(G=F,j=t.get(G))),!(!G||!j)&&(Q=e.fire(P,{element:j,gfx:G,originalEvent:T}),Q===!1&&(T.stopPropagation(),T.preventDefault()))}}var r={};function a(P){return r[P]}function s(P,T){var j=l[P]||nr;return!j(T)}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":OO,"element.mousedown":tu,"element.mouseup":tu,"element.click":tu,"element.dblclick":tu};function u(P,T,j){var F=c[P];if(!F)throw new Error("unmapped DOM event name <"+P+">");return o(F,T,j)}var p="svg, .djs-element";function f(P,T,j,F){var G=r[j]=function(Q){o(j,Q)};F&&(l[j]=F),G.$delegate=ii.bind(P,p,T,G)}function d(P,T,j){var F=a(j);F&&ii.unbind(P,T,F.$delegate)}function g(P){W(c,function(T,j){f(P,j,T)})}function h(P){W(c,function(T,j){d(P,j,T)})}e.on("canvas.destroy",function(P){h(P.svg)}),e.on("canvas.init",function(P){g(P.svg)}),e.on(["shape.added","connection.added"],function(P){var T=P.element,j=P.gfx;e.fire("interactionEvents.createHit",{element:T,gfx:j})}),e.on(["shape.changed","connection.changed"],Nx,function(P){var T=P.element,j=P.gfx;e.fire("interactionEvents.updateHit",{element:T,gfx:j})}),e.on("interactionEvents.createHit",Nx,function(P){var T=P.element,j=P.gfx;i.createDefaultHit(T,j)}),e.on("interactionEvents.updateHit",function(P){var T=P.element,j=P.gfx;i.updateDefaultHit(T,j)});var m=E("djs-hit djs-hit-stroke"),w=E("djs-hit djs-hit-click-stroke"),y=E("djs-hit djs-hit-all"),v=E("djs-hit djs-hit-no-move"),x={all:y,"click-stroke":w,stroke:m,"no-move":v};function E(P,T){return T=q({stroke:"white",strokeWidth:15},T||{}),n.cls(P,["no-fill","no-border"],T)}function A(P,T){var j=x[T];if(!j)throw new Error("invalid hit type <"+T+">");return Pe(P,j),P}function D(P,T){Je(P,T)}this.removeHits=function(P){var T=bs(".djs-hit",P);W(T,cn)},this.createDefaultHit=function(P,T){var j=P.waypoints,F=P.isFrame,G;return j?this.createWaypointsHit(T,j):(G=F?"stroke":"all",this.createBoxHit(T,G,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,T){var j=Es(T);return A(j,"stroke"),D(P,j),j},this.createBoxHit=function(P,T,j){j=q({x:0,y:0},j);var F=Ne("rect");return A(F,T),Pe(F,j),D(P,F),F},this.updateDefaultHit=function(P,T){var j=At(".djs-hit",T);if(j)return P.waypoints?zf(j,P.waypoints):Pe(j,{width:P.width,height:P.height}),j},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}$x.$inject=["eventBus","elementRegistry","styles"];const nu={__init__:["interactionEvents"],interactionEvents:["type",$x]};function Ia(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)})}Ia.$inject=["eventBus","canvas"],Ia.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()})}},Ia.prototype.get=function(){return Array.from(this._selectedElements)},Ia.prototype.isSelected=function(e){return this._selectedElements.has(e)},Ia.prototype.select=function(e,t){var n=this.get();Ye(e)||(e=e?[e]:[]);var i=this._canvas,o=i.getRootElement();e=e.filter(function(r){var a=i.findRoot(r);return o===a}),t?W(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Fx="hover",jx="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,jx)}function a(l){n(l,jx)}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 zx(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;Ye(l)?t.select(l):t.select(s.filter(DO))}}),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=$t(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(nr(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=Kl(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}zx.$inject=["eventBus","selection","canvas","elementRegistry"];function DO(e){return!e.hidden}const Mi={__init__:["selectionVisuals","selectionBehavior"],__depends__:[nu],selection:["type",Ia],selectionVisuals:["type",Hx],selectionBehavior:["type",zx]};var LO=/^djs-cursor-.*$/;function iu(e){var t=kt(document.body);t.removeMatching(LO),e&&t.add("djs-cursor-"+e)}function Gx(){iu(null)}var IO=5e3;function Vx(e,t){t=t||"element.click";function n(){return!1}return e.once(t,IO,n),function(){e.off(t,n)}}var BO=["c","C"],NO=["v","V"],$O=["d","D"],FO=["x","X"],jO=["y","Y"],Wx=["z","Z"];function HO(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function ai(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function bn(e,t){return e=Ye(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function ih(e){return e.shiftKey}function zO(e){return ai(e)&&bn(BO,e)}function GO(e){return ai(e)&&bn(NO,e)}function VO(e){return ai(e)&&bn($O,e)}function WO(e){return ai(e)&&bn(FO,e)}function UO(e){return ai(e)&&!ih(e)&&bn(Wx,e)}function qO(e){return ai(e)&&(bn(jO,e)||bn(Wx,e)&&ih(e))}var Ba=Math.round,Ux="djs-drag-active";function Hr(e){e.preventDefault()}function YO(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function KO(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function qx(e,t,n,i){var o={threshold:5,trapClick:!0},r;function a(v){var x=t.viewbox(),E=t._container.getBoundingClientRect();return{x:x.x+(v.x-E.left)/x.scale,y:x.y+(v.y-E.top)/x.scale}}function s(v,x){x=x||r;var E=e.createEvent(q({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+v,E)===!1?!1:e.fire(x.prefix+"."+v,E)}function c(v){var x=v.filter(function(E){return i.get(E.id)});x.length&&n.select(x)}function l(v,x){var E=r.payload,A=r.displacement,D=r.globalStart,P=Fr(v),T=Vi(P,D),j=r.localStart,F=a(P),G=Vi(F,j);if(!r.active&&(x||KO(T)>r.threshold)){if(q(E,{x:Ba(j.x+A.x),y:Ba(j.y+A.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return m();r.active=!0,r.keepSelection||(E.previousSelection=n.get(),n.select(null)),r.cursor&&iu(r.cursor),t.addMarker(t.getRootElement(),Ux)}Bd(v),r.active&&(q(E,{x:Ba(F.x+A.x),y:Ba(F.y+A.y),dx:Ba(G.x),dy:Ba(G.y)},{originalEvent:v}),s("move"))}function u(v){var x,E=!0;r.active&&(v&&(r.payload.originalEvent=v,Bd(v)),E=s("end")),E===!1&&s("rejected"),x=w(E!==!0),s("ended",x)}function p(v){bn("Escape",v)&&(Hr(v),m())}function f(v){var x;r.active&&(x=Vx(e),setTimeout(x,400),Hr(v)),u(v)}function d(v){l(v)}function g(v){var x=r.payload;x.hoverGfx=v.gfx,x.hover=v.element,s("hover")}function h(v){s("out");var x=r.payload;x.hoverGfx=null,x.hover=null}function m(v){var x;if(r){var E=r.active;E&&s("cancel"),x=w(v),E&&s("canceled",x)}}function w(v){var x,E;s("cleanup"),Gx(),r.trapClick?E=f:E=u,je.unbind(document,"mousemove",l),je.unbind(document,"dragstart",Hr),je.unbind(document,"selectstart",Hr),je.unbind(document,"mousedown",E,!0),je.unbind(document,"mouseup",E,!0),je.unbind(document,"keyup",p),je.unbind(document,"touchstart",d,!0),je.unbind(document,"touchcancel",m,!0),je.unbind(document,"touchmove",l,!0),je.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),Ux);var A=r.payload.previousSelection;return v!==!1&&A&&!n.get().length&&c(A),x=r,r=null,x}function y(v,x,E,A){r&&m(!1),typeof x=="string"&&(A=E,E=x,x=null),A=q({},o,A||{});var D=A.data||{},P,T,j,F,G;if(A.trapClick?F=f:F=u,v?(P=Da(v)||v,T=Fr(v),Bd(v),P.type==="dragstart"&&Hr(P)):(P=null,T={x:0,y:0}),j=a(T),x||(x=j),G=YO(P),r=q({prefix:E,data:D,payload:{},globalStart:T,displacement:Vi(x,j),localStart:j,isTouch:G},A),A.manual||(G?(je.bind(document,"touchstart",d,!0),je.bind(document,"touchcancel",m,!0),je.bind(document,"touchmove",l,!0),je.bind(document,"touchend",u,!0)):(je.bind(document,"mousemove",l),je.bind(document,"dragstart",Hr),je.bind(document,"selectstart",Hr),je.bind(document,"mousedown",F,!0),je.bind(document,"mouseup",F,!0)),je.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return m(),!1;A.autoActivate&&l(v,!0)}e.on("diagram.destroy",m),this.init=y,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=m,this.context=function(){return r},this.setOptions=function(v){q(o,v)}}qx.$inject=["eventBus","canvas","selection","elementRegistry"];const Ro={__depends__:[kO,Mi],dragging:["type",qx]};function zr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}zr.prototype.next=function(){return this._prefix+ ++this._counter};const XO=new zr("ps");var ZO=["marker-start","marker-mid","marker-end"],QO=["circle","ellipse","line","path","polygon","polyline","path","rect"];function ir(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}ir.$inject=["elementRegistry","eventBus","canvas","styles"],ir.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")},ir.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},ir.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=Lf(n);return this._cloneMarkers(Xo(o),i),Pe(o,this._styles.cls(i,[])),Je(t,o),Pe(o,"data-preview-support-element-id",e.id),o},ir.prototype.addFrame=function(e,t){var n=Ne("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Je(t,n),Pe(n,"data-preview-support-element-id",e.id),n},ir.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),nD(e)&&ZO.forEach(function(o){if(Pe(e,o)){var r=JO(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},ir.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,XO.next()].join("-"),a=At("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Lf(n);s.id=r,dt(s).add(o);var c=At(":scope > defs",e);c||(c=Ne("defs"),Je(e,c)),Je(c,s);var l=tD(s.id);Pe(t,i,l)};function JO(e,t,n){var i=eD(Pe(e,t));return At("marker#"+i,n||document)}function eD(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function tD(e){return"url(#"+e+")"}function nD(e){return QO.indexOf(e.nodeName)!==-1}const Na={__init__:["previewSupport"],previewSupport:["type",ir]};var iD="drop-ok",Yx="drop-not-ok",Kx="attach-ok",Xx="new-parent",Zx="create",oD=2e3;function Qx(e,t,n,i,o){function r(c,l,u,p,f){if(!l)return!1;c=ct(c,function(y){var v=y.labelTarget;return!y.parent&&!(rt(y)&&c.indexOf(v)!==-1)});var d=$t(c,function(y){return!Lt(y)}),g=!1,h=!1,m=!1;ew(c)&&(g=o.allowed("shape.attach",{position:u,shape:d,target:l})),g||(ew(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 w=f.connectionTarget;return m||g?(d&&p&&(h=o.allowed("connection.create",{source:w===p?d:p,target:w===p?p:d,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):m===null||g===null?null:!1}function a(c,l){[Kx,iD,Yx,Xx].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}Jx(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,Kx):a(p,h?Xx:Yx))}),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,w=l.hints||{};if(g===!1||!d)return!1;Jx(c);var y={x:c.x,y:c.y};m?p=i.appendShape(u,p,y,d,{attach:h,connection:m===!0?{}:m,connectionTarget:w.connectionTarget}):(f=i.createElements(f,y,d,q({},w,{attach:h})),p=$t(f,function(v){return!Lt(v)})),q(l,{elements:f,shape:p}),q(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Zx&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],oD,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Ye(l)||(l=[l]);var p=$t(l,function(g){return!Lt(g)});if(p){u=q({elements:l,hints:{},shape:p},u||{}),W(l,function(g){Ke(g.x)||(g.x=0),Ke(g.y)||(g.y=0)});var f=ct(l,function(g){return!g.hidden}),d=ln(f);W(l,function(g){Lt(g)&&(g.waypoints=Fn(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),q(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,Zx,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}Qx.$inject=["canvas","dragging","eventBus","modeling","rules"];function Jx(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 ew(e){return e&&e.length===1&&!Lt(e[0])}var rD=750;function tw(e,t,n,i,o){function r(a){var s=Ne("g");Pe(s,o.cls("djs-drag-group",["no-events"]));var c=Ne("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(Xo(u),l)):(u=n._createContainer("shape",c),n.drawShape(Xo(u),l),Dn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",rD,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(),Je(p,u)),Dn(u,a.x,a.y)):cn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&cn(c)})}tw.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const ou={__depends__:[Ro,Na,oo,Mi],__init__:["create","createPreview"],create:["type",Qx],createPreview:["type",tw]};function oh(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)})}oh.$inject=["eventBus"],oh.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||aD(0,0)};function aD(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 Gs={__init__:["mouse"],mouse:["type",oh]};var nw=2e3;function si(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),sD(u)&&(l.priority=2,l.host=u.host.id),Lt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=cD(u)),rt(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),W(["x","y","width","height"],function(f){Ke(u[f])&&(l[f]=u[f])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",nw,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",nw,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;q(l,{createElementsBehavior:!1})})}si.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],si.prototype.copy=function(e,t={}){var n,i;return Ye(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Ye(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},si.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})}}},si.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},si.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},si.prototype._getElementIdsFromTree=function(e){var t={};return W(e,function(n){W(n,function(i){i.id&&(t[i.id]=!0)})}),t},si.prototype._paste=function(e,t,n,i){W(e,function(r){Ke(r.x)||(r.x=0),Ke(r.y)||(r.y=0)});var o=ln(e);return W(e,function(r){Lt(r)&&(r.waypoints=Fn(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),q(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,q({},i))},si.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return W(e,function(r,a){r=Yi(r,"priority"),W(r,function(s){var c=q({},Ki(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(Lt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),o.push(l);return}if(rt(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},si.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Ki(e,["id"]));return t},si.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Ki(e,["id"]));return t},si.prototype.createShape=function(e){var t=this._elementFactory.createShape(Ki(e,["id"]));return t},si.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Lt(e)&&(!n.has(e.source)||!n.has(e.target))||rt(e)&&!n.has(e.labelTarget))},si.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=ml(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}Br(a,function(p,f,d){if(rt(p))return;W(p.labels,function(m){c(m,d)});function g(m){m&&m.length&&W(m,function(w){W(w.labels,function(y){c(y,d)}),c(w,d)})}W([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=Fn(o,function(p){return p.element});var u=new Set(e);return o=Fn(o,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),o=Yi(o,function(p){return p.descriptor.priority}),e=Fn(o,function(p){return p.element}),W(o,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,u)){ow(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){ow(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function sD(e){return!!e.host}function cD(e){return Fn(e.waypoints,function(t){return t=iw(t),t.original&&(t.original=iw(t.original)),t})}function iw(e){return q({},e)}function ow(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const lD={__depends__:[PO,ou,Gs,oo],__init__:["copyPaste"],copyPaste:["type",si]};function rh(e,t,n){Ye(n)||(n=[n]),W(n,function(i){Cr(e[i])||(t[i]=e[i])})}var ah=750;function rw(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",ah,function(c){var l=c.descriptor,u=c.element,p=be(u);if(rt(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(yt(u),!0);d.bpmnElement=f,rh(f,l,"name"),rh(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=be(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(be(c).attachedToRef=be(l[c.host])),Ki(u,ni(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(rt(u)){u.businessObject=be(l[u.labelTarget]),u.di=yt(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,rh(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",ah,function(c){var l=c.descriptor,u=c.element;if(M(u,"bpmn:Participant")){var p=be(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")&&W(Ts(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",ah,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}rw.$inject=["bpmnFactory","eventBus","moddleCopy"];const uD=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],pD=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Vs(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:o}=i;if(!(!o||!o.length))return Yi(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=yn(o)&&o.$descriptor;if(a&&pD.includes(a))return r;if(a&&uD.includes(a)||a&&s&&!$t(s.properties,ca({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})}Vs.$inject=["eventBus","bpmnFactory","moddle"],Vs.prototype.copyElement=function(e,t,n,i=!1){n&&!Ye(n)&&(n=[n]),n=n||sh(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||(Ye(o)&&(n=o),W(n,r=>{let a;ti(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!mn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},Vs.prototype.copyProperty=function(e,t,n,i=!1){let o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(o===!1)return;if(o)return yn(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;const r=this._moddle.getPropertyDescriptor(t,n);if(!r.isReference)return r.isId?e&&this._copyId(e,t,i):Ye(e)?ni(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):yn(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(o=this._bpmnFactory.create(e.$type),o.$parent=t,o=this.copyElement(e,o,null,i),o):e},Vs.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function sh(e,t){return ni(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const aw={__depends__:[lD],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",rw],moddleCopy:["type",Vs]};var sw=Math.round;function ch(e,t){this._modeling=e,this._eventBus=t}ch.$inject=["modeling","eventBus"],ch.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=sw(s+r/2),u=sw(c+a/2),p=i.replaceShape(e,q({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function cw(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}cw.$inject=["selection","eventBus"];const fD={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",cw],replace:["type",ch]};function dD(e,t,n){Ye(n)||(n=[n]),W(n,function(i){Cr(e[i])||(t[i]=e[i])})}var hD=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function gD(e,t){var n=e&&ti(e,"collapsed")?e.collapsed:!ht(e),i;return t&&(ti(t,"collapsed")||ti(t,"isExpanded"))?i=ti(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function lw(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(ru(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&gD(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),dD(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=sh(p.$descriptor),h=sh(f.$descriptor,!0),m=mD(g,h);q(f,$i(c,hD));var w=ct(m,function(x){return x==="eventDefinitions"?uw(s,c.eventDefinitionType):x==="loopCharacteristics"?!Gn(f):ti(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!Gn(f):!0});if(f=n.copyElement(p,f,w),c.eventDefinitionType&&(uw(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),M(p,"bpmn:Activity")){if(ru(p))d.isExpanded=ht(s);else if(c&&ti(c,"isExpanded")){d.isExpanded=c.isExpanded;var y=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=y.width,d.height=y.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}ht(s)&&!M(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(ru(p)&&!ru(f)&&(l.moveChildren=!1),M(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var v=En(s);yt(s).isHorizontal||(yt(d).isHorizontal=v),d.width=v?s.width:t.getDefaultSize(d).width,d.height=v?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,at(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&at(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}lw.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function ru(e){return M(e,"bpmn:SubProcess")}function uw(e,t){var n=be(e);return t&&n.get("eventDefinitions").some(function(i){return M(i,t)})}function mD(e,t){return e.filter(function(n){return t.includes(n)})}const pw={__depends__:[aw,fD,Mi],bpmnReplace:["type",lw]};var yD=250;function Gr(e){this._eventBus=e,this._tools=[],this._active=null}Gr.$inject=["eventBus"],Gr.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)},Gr.prototype.isActive=function(e){return e&&this._active===e},Gr.prototype.length=function(e){return this._tools.length},Gr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Gr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(o){var r=o.context;if(!r.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),W(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,yD,function(o){this._active&&(vD(o)||this.setActive(null))},this)};function vD(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Lr(t,'.group[data-group="tools"]')}const au={__depends__:[Ro],__init__:["toolManager"],toolManager:["type",Gr]};function bD(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 xD(e,t){var n=[],i=new Set(e);W(t,function(r){i.add(r)});var o=new Set;return i.forEach(function(r){var a=r.incoming,s=r.outgoing;W(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(o.has(c)||(o.add(c),n.push(c)))})}),n}function wD(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 lh=Math.abs,_D=Math.round,Co={x:"width",y:"height"},fw="crosshair",or={n:"top",w:"left",s:"bottom",e:"right"},ED=1500,su={n:"s",w:"e",s:"n",e:"w"},cu=20;function Ai(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",ED,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&hw(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){hw(c);var h={x:0,y:0};h[u]=_D(c["d"+u]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(m){s.activateSelection(m.originalEvent,!0,!0)})}})}Ai.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Ai.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:fw,data:{context:{reactivate:n}},trapClick:!1})},Ai.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:fw,data:{context:{}}})},Ai.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},Ai.prototype.init=function(e,t){var n=lh(e.dx)>lh(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(lh(i)<5)return!1;i<0&&(i*=-1),js(e)&&(i*=-1);var r=bD(n,i),a=this._canvas.getRootElement();!Kl(e)&&e.hover&&(a=e.hover);var s=[...Ss(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=SD(c,n,r,o,l);return q(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),iu("resize-"+(n==="x"?"ew":"ns")),!0},Ai.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 W(e,function(d){if(!(!d.parent||rt(d))){if(Lt(d)){u.push(d);return}var g=d[t],h=g+d[Co[t]];if(RD(d)&&(n>0&&Xe(d)[t]>i||n<0&&Xe(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}}}),W(r,function(d){var g=d.attachers;g&&W(g,function(h){p(h)})}),W(l,function(d){var g=d.host;(s.has(g)||c.has(g))&&p(d)}),W(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}},Ai.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Ai.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function dw(e){return{top:e.top-cu,right:e.right+cu,bottom:e.bottom+cu,left:e.left-cu}}function hw(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;Ke(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Ke(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Ke(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),Ke(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function SD(e,t,n,i,o){var r=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(r),p=new Set(a);return W(a,function(f){var d=f.attachers,g=f.children,h=Ge(f),m=ct(g,function(G){return!Lt(G)&&!rt(G)&&!u.has(G)&&!p.has(G)}),w=ct(g,function(G){return!Lt(G)&&!rt(G)&&u.has(G)}),y,v,x,E=[],A=[],D,P,T,j;m.length&&(v=dw(Ge(ln(m))),y=i-h[or[n]]+v[or[n]],n==="n"?s.bottom=l=Ke(l)?Math.min(l,y):y:n==="w"?s.right=l=Ke(l)?Math.min(l,y):y:n==="s"?s.top=c=Ke(c)?Math.max(c,y):y:n==="e"&&(s.left=c=Ke(c)?Math.max(c,y):y)),w.length&&(x=dw(Ge(ln(w))),y=i-x[or[su[n]]]+h[or[su[n]]],n==="n"?s.bottom=l=Ke(l)?Math.min(l,y):y:n==="w"?s.right=l=Ke(l)?Math.min(l,y):y:n==="s"?s.top=c=Ke(c)?Math.max(c,y):y:n==="e"&&(s.left=c=Ke(c)?Math.max(c,y):y)),d&&d.length&&(d.forEach(function(G){u.has(G)?E.push(G):A.push(G)}),E.length&&(D=Ge(ln(E.map(Xe))),P=h[or[su[n]]]-(D[or[su[n]]]-i)),A.length&&(T=Ge(ln(A.map(Xe))),j=T[or[n]]-(h[or[n]]-i)),n==="n"?(y=Math.min(P||1/0,j||1/0),s.bottom=l=Ke(l)?Math.min(l,y):y):n==="w"?(y=Math.min(P||1/0,j||1/0),s.right=l=Ke(l)?Math.min(l,y):y):n==="s"?(y=Math.max(P||-1/0,j||-1/0),s.top=c=Ke(c)?Math.max(c,y):y):n==="e"&&(y=Math.max(P||-1/0,j||-1/0),s.left=c=Ke(c)?Math.max(c,y):y));var F=o&&o[f.id];F&&(n==="n"?(y=i+f[Co[t]]-F[Co[t]],s.bottom=l=Ke(l)?Math.min(l,y):y):n==="w"?(y=i+f[Co[t]]-F[Co[t]],s.right=l=Ke(l)?Math.min(l,y):y):n==="s"?(y=i-f[Co[t]]+F[Co[t]],s.top=c=Ke(c)?Math.max(c,y):y):n==="e"&&(y=i-f[Co[t]]+F[Co[t]],s.left=c=Ke(c)?Math.max(c,y):y))}),s}}function RD(e){return!!e.host}var uh="djs-dragging",gw="djs-resizing",CD=250,lu=Math.max;function mw(e,t,n,i,o){function r(a,s){W(a,function(c){o.addDragger(c,s),n.addMarker(c,uh)})}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=Ne("g");Pe(u,i.cls("djs-crosshair-group",["no-events"])),Je(s,u);var p=Ne("path");Pe(p,"d",l.x),dt(p).add("djs-crosshair"),Je(u,p);var f=Ne("path");Pe(f,"d",l.y),dt(f).add("djs-crosshair"),Je(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Dn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&cn(c)}),e.on("spaceTool.move",CD,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=Ne("path"),Pe(c,"d","M0,0 L0,0"),dt(c).add("djs-crosshair"),Je(f,c),s.line=c;var d=Ne("g");Pe(d,i.cls("djs-drag-group",["no-events"])),Je(n.getActiveLayer(),d),r(u,d);var g=new Set(u);W(p,function(A){g.add(A)});var h=new Set,m=s.movingConnections=[];g.forEach(function(A){W(A.outgoing,function(D){h.has(D)||!Lt(D)||!g.has(D.target)||(h.add(D),m.push(D))})}),r(m,d),s.dragGroup=d}if(!s.frameGroup){var w=Ne("g");Pe(w,i.cls("djs-frame-group",["no-events"])),Je(n.getActiveLayer(),w);var y=[];W(p,function(A){var D=o.addFrame(A,w),P=D.getBBox();y.push({element:D,initialBounds:P}),n.addMarker(A,gw)}),s.frameGroup=w,s.frames=y}var v={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Pe(c,{d:v[l]});var x={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[x[s.axis]]=0,Dn(s.dragGroup,E.x,E.y),W(s.frames,function(A){var D=A.element,P=A.initialBounds,T,j;s.direction==="e"?Pe(D,{width:lu(P.width+E.x,5)}):(T=lu(P.width-E.x,5),Pe(D,{width:T,x:P.x+P.width-T})),s.direction==="s"?Pe(D,{height:lu(P.height+E.y,5)}):(j=lu(P.height-E.y,5),Pe(D,{height:j,y:P.y+P.height-j}))})}}),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;W(c,function(g){n.removeMarker(g,uh)}),W(l,function(g){n.removeMarker(g,uh)}),f&&(cn(p),cn(f)),W(u,function(g){n.removeMarker(g,gw)}),d&&cn(d)})}mw.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const MD={__init__:["spaceToolPreview"],__depends__:[Ro,oo,au,Na,Gs],spaceTool:["type",Ai],spaceToolPreview:["type",mw]};function uu(e,t){e.invoke(Ai,this),this._canvas=t}uu.$inject=["injector","canvas"],De(uu,Ai),uu.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=aa(xa(o.children.filter(l=>M(l,"bpmn:Artifact")),ln(r))));const s=[...e,...a];var c=Ai.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(M(l,"bpmn:TextAnnotation")||AD(l)&&(t==="y"&&En(l)||t==="x"&&!En(l)))}),c};function AD(e){return M(e,"bpmn:Participant")&&!be(e).processRef}const yw={__depends__:[MD],spaceTool:["type",uu]};function Kt(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Kt.$inject=["eventBus","injector"],Kt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Kt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let o=this._fire(e,"canExecute",n);if(o===void 0){if(!i)return!1;i.canExecute&&(o=i.canExecute(t))}return o},Kt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Kt.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Kt.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Kt.prototype.register=function(e,t){this._setHandler(e,t)},Kt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Kt.prototype.canUndo=function(){return!!this._getUndoAction()},Kt.prototype.canRedo=function(){return!!this._getRedoAction()},Kt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Kt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Kt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},Kt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let o;n=this._eventBus.createEvent(n);for(const r of i)if(o=this._eventBus.fire("commandStack."+r,n),n.cancelBubble)break;return o},Kt.prototype._createId=function(){return this._uid++},Kt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Kt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,o=this._getHandler(n);if(!o)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),o.preExecute&&o.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),o.execute&&this._markDirty(o.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),o.postExecute&&o.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Kt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Kt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Zg("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Kt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Ye(e)?e:[e],t.dirty=t.dirty.concat(e))},Kt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Kt.prototype._revertedAction=function(e){this._stackIdx--},Kt.prototype._getHandler=function(e){return this._handlerMap[e]},Kt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const PD={commandStack:["type",Kt]};function rr(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 TD=250,vw=1400;function ph(e,t,n){ve.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",vw,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=bw(a),r.validatedShapes=bw(s)}),i&&t.on("shape.move.start",TD,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",vw,function(o){var r=o.context,a=r.closure,s=a.enclosedElements,c=[];W(s,function(l){W(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(o){var r=o.context,a=r.connection||r.shape;rr(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=Vf(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&&(an(s.labels,a,c),a.labelTarget=s)})}De(ph,ve),ph.$inject=["injector","eventBus","modeling"];function bw(e){var t=new Set(e);return ct(e,function(n){return!t.has(n.labelTarget)})}const kD={__init__:["labelSupport"],labelSupport:["type",ph]};var OD=251,xw=1401,ww="attach-ok";function fh(e,t,n,i,o){ve.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",xw,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=DD(c),s.validatedShapes=LD(l)}),r&&t.on("shape.move.start",OD,function(a){var s=a.context,c=s.shapes,l=dh(c);W(l,function(u){r.makeDraggable(s,u,!0),W(u.labels,function(p){r.makeDraggable(s,p,!0)})})}),r&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var l=c[0],u=l.host;u&&(n.addMarker(u,ww),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,ww)}))}}),this.preExecuted("elements.move",xw,function(a){var s=a.context,c=s.closure,l=s.shapes,u=dh(l);W(u,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=ct(c,function(p){var f=p.host;return ID(p)&&!BD(c,f)}),W(u,function(p){o.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;W(s,function(c){W(c.attachers,function(l){W(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)}),W(l.incoming.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&o.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;rr(c.attachers,function(u){var p=i.allowed("elements.move",{target:l,shapes:[u]});p==="attach"?o.updateAttachment(u,l):o.removeShape(u)}),l.attachers.length&&W(l.attachers,function(u){var p=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&&W(p,function(d){var g=Fb(d,l,u);o.moveShape(d,g,d.parent),W(d.labels,function(h){o.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;rr(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}De(fh,ve),fh.$inject=["injector","eventBus","canvas","rules","modeling"];function dh(e){return Op(Fn(e,function(t){return t.attachers||[]}))}function DD(e){var t=dh(e);return LS("id",e,t)}function LD(e){var t=sa(e,"id");return ct(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function ID(e){return!!e.host}function BD(e,t){return e.indexOf(t)!==-1}const ND={__depends__:[oo],__init__:["attachSupport"],attachSupport:["type",fh]};function _w(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(hv(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)})}_w.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const hh={__init__:["changeSupport"],changeSupport:["type",_w]};function Pi(e){this._model=e}Pi.$inject=["moddle"],Pi.prototype._needsId=function(e){return at(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"])},Pi.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":at(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))},Pi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Pi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Pi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",q({bpmnElement:e,bounds:this.createDiBounds()},t))},Pi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Pi.prototype.createDiWaypoints=function(e){var t=this;return Fn(e,function(n){return t.createDiWaypoint(n)})},Pi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",$i(e,["x","y"]))},Pi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",q({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Pi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",q({bpmnElement:e},t))};function ci(e,t,n){ve.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"],li(r)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],li(a));function s(d){var g=d.context,h=g.oldRoot,m=h.children;W(m,function(w){M(w,"bpmn:BaseElement")&&i.updateParent(w)})}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"],li(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],li(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"],li(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],li(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],li(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],li(u)),this.executed("connection.reconnect",li(function(d){var g=d.context,h=g.connection,m=g.oldSource,w=g.newSource,y=be(h),v=be(m),x=be(w);y.conditionExpression&&!at(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=y.conditionExpression,delete y.conditionExpression),m!==w&&v.default===y&&(g.oldDefault=v.default,delete v.default)})),this.reverted("connection.reconnect",li(function(d){var g=d.context,h=g.connection,m=g.oldSource,w=g.newSource,y=be(h),v=be(m),x=be(w);g.oldConditionExpression&&(y.conditionExpression=g.oldConditionExpression),g.oldDefault&&(v.default=g.oldDefault,delete x.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],li(p)),this.reverted(["element.updateAttachment"],li(p)),this.executed("element.updateLabel",li(f)),this.reverted("element.updateLabel",li(f));function f(d){const{element:g}=d.context,h=vi(g),m=yt(g),w=m&&m.get("label");Qo(g)||Xl(g)||(h&&!w?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&w&&m.set("label",void 0))}}De(ci,ve),ci.$inject=["eventBus","bpmnFactory","connectionDocking"],ci.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},ci.prototype.updateParent=function(e,t){if(!rt(e)&&!(M(e,"bpmn:DataStoreReference")&&e.parent&&M(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=yt(e),r=n&&n.businessObject,a=yt(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)}},ci.prototype.updateBounds=function(e){var t=yt(e),n=FD(e);if(n){var i=Vi(n,t.get("bounds"));q(n,{x:e.x+i.x,y:e.y+i.y})}var o=rt(e)?this._getLabel(t):t,r=o.bounds;r||(r=this._bpmnFactory.createDiBounds(),o.set("bounds",r)),q(r,{x:e.x,y:e.y,width:e.width,height:e.height})},ci.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,o;M(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),on(i,e)),M(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),an(o,e))}},ci.prototype.updateDiConnection=function(e,t,n){var i=yt(e),o=yt(t),r=yt(n);i.sourceElement&&i.sourceElement.bpmnElement!==be(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==be(n)&&(i.targetElement=n&&r)},ci.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):(on(n,e),e.$parent=null)}};function $D(e){for(;e&&!M(e,"bpmn:Definitions");)e=e.$parent;return e}ci.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)},ci.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=$D(e.$parent||t),e.$parent&&(on(r.get("rootElements"),o),o.$parent=null),t&&(an(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),on(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);on(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},ci.prototype.updateConnectionWaypoints=function(e){var t=yt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},ci.prototype.updateConnection=function(e){var t=e.connection,n=be(t),i=t.source,o=be(i),r=t.target,a=be(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&&(on(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(on(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)},ci.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function li(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;M(i,"bpmn:BaseElement")&&e(t)}}function FD(e){if(M(e,"bpmn:Activity")){var t=yt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function ar(e,t){wo.call(this),this._bpmnFactory=e,this._moddle=t}De(ar,wo),ar.$inject=["bpmnFactory","moddle"],ar.prototype._baseCreate=wo.prototype.create,ar.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,q({type:"label",di:n},Nr,t))}return this.createElement(e,t)},ar.prototype.createElement=function(e,t){t=q({},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(!HD(o)){var r=q({},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=q({isFrame:!0},t)),t=jD(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=gh(o,t,"isExpanded")),at(i,["bpmn:Lane","bpmn:Participant"])&&(t=gh(o,t,"isHorizontal")),M(i,"bpmn:SubProcess")&&(t.collapsed=!ht(i,o)),M(i,"bpmn:ExclusiveGateway")&&(ti(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),mn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),mn(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,o),t=q({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},ar.prototype.getDefaultSize=function(e,t){var n=be(e);if(t=t||yt(e),M(n,"bpmn:SubProcess"))return ht(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 ht(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}},ar.prototype.createParticipantShape=function(e){return yn(e)||(e={isExpanded:e}),e=q({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function jD(e,t,n){return W(n,function(i){t=gh(e,t,i)}),t}function gh(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Ki(t,[n]))}function HD(e){return at(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function pu(e,t){this._modeling=e,this._canvas=t}pu.$inject=["modeling","canvas"],pu.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;W(n,function(o){var r={x:0,y:0};mn(i.left)?r.x=i.left-o.x:mn(i.right)?r.x=i.right-o.width-o.x:mn(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:mn(i.top)?r.y=i.top-o.y:mn(i.bottom)?r.y=i.bottom-o.height-o.y:mn(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},pu.prototype.postExecute=function(e){};function fu(e){this._modeling=e}fu.$inject=["modeling"],fu.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},fu.prototype.postExecute=function(e){var t=e.hints||{};zD(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 zD(e,t){return No(e.outgoing,function(n){return n.target===t})}function du(e,t){this._canvas=e,this._layouter=t}du.$inject=["canvas","layouter"],du.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},du.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var hu=Math.round;function mh(e){this._modeling=e}mh.$inject=["modeling"],mh.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,a=this._modeling;W(t,function(p){Ke(p.x)||(p.x=0),Ke(p.y)||(p.y=0)});var s=ct(t,function(p){return!p.hidden}),c=ln(s);W(t,function(p){Lt(p)&&(p.waypoints=Fn(p.waypoints,function(f){return{x:hu(f.x-c.x-c.width/2+o.x),y:hu(f.y-c.y-c.height/2+o.y)}})),q(p,{x:hu(p.x-c.x-c.width/2+o.x),y:hu(p.y-c.y-c.height/2+o.y)})});var l=new Set(ml(t)),u={};W(t,function(p){if(Lt(p)){u[p.id]=Ke(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=q({},r);l.has(p)||(f.autoResize=!1),rt(p)&&(f=Ki(f,["attach"])),u[p.id]=Ke(i)?a.createShape(p,$i(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,$i(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=aa(u)};var Ew=Math.round;function sr(e){this._canvas=e}sr.$inject=["canvas"],sr.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?q(t,n):q(t,{x:n.x-Ew(t.width/2),y:n.y-Ew(t.height/2)}),this._canvas.addShape(t,i,o),t},sr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Ws(e){sr.call(this,e)}De(Ws,sr),Ws.$inject=["canvas"];var GD=sr.prototype.execute;Ws.prototype.execute=function(e){var t=e.shape;return WD(t),t.labelTarget=e.labelTarget,GD.call(this,e)};var VD=sr.prototype.revert;Ws.prototype.revert=function(e){return e.shape.labelTarget=null,VD.call(this,e)};function WD(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Us(e,t){this._canvas=e,this._modeling=t}Us.$inject=["canvas","modeling"],Us.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;rr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),rr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Us.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Vf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Us.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,an(n.children,t,i),this._canvas.addConnection(t,n),t};function yh(e,t){this._modeling=e,this._elementRegistry=t}yh.$inject=["modeling","elementRegistry"],yh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;W(i,function(o){n.get(o.id)&&(o.waypoints?t.removeConnection(o):t.removeShape(o))})};function qs(e,t){this._canvas=e,this._modeling=t}qs.$inject=["canvas","modeling"],qs.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;rr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),rr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),rr(n.children,function(i){Lt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},qs.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Vf(i.children,n),t.removeShape(n),n},qs.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return an(i.children,n,o),t.addShape(n,i),n};function gu(e){this._modeling=e}gu.$inject=["modeling"];var Sw={x:"y",y:"x"};gu.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(m,w){m.range.min=Math.min(w[i],m.range.min),m.range.max=Math.max(w[i]+w[o],m.range.max)}function a(m){return m[i]+m[o]/2}function s(m){return m.length-1}function c(m){return m.max-m.min}function l(m,w){var y={y:0};y[i]=m-a(w),y[i]&&(y[Sw[i]]=0,t.moveElements([w],y,w.parent))}var u=n[0],p=s(n),f=n[p],d,g,h=0;W(n,function(m,w){var y,v,x;if(m.elements.length<2){w&&w!==n.length-1&&(r(m,m.elements[0]),h+=c(m.range));return}y=Yi(m.elements,i),v=y[0],w===p&&(v=y[s(y)]),x=a(v),m.range=null,W(y,function(E){if(l(x,E),m.range===null){m.range={min:E[i],max:E[i]+E[o]};return}r(m,E)}),w&&w!==n.length-1&&(h+=c(m.range))}),g=Math.abs(f.range.min-u.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&W(n,function(m,w){var y={},v;m===u||m===f||(v=n[w-1],m.range.max=0,W(m.elements,function(x,E){y[Sw[i]]=0,y[i]=v.range.max-x[i]+d,m.range.min!==x[i]&&(y[i]+=x[i]-m.range.min),y[i]&&t.moveElements([x],y,x.parent),m.range.max=Math.max(x[i]+x[o],E?m.range.max:0)}))})},gu.prototype.postExecute=function(e){};function mu(e,t){this._layouter=e,this._canvas=t}mu.$inject=["layouter","canvas"],mu.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return q(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},mu.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function vh(){}vh.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=on(r.children,t),an(i.children,t,o),t.parent=i,W(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},vh.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return on(n.children,t),an(i.children,t,o),t.parent=i,W(t.waypoints,function(a){a.x-=r.x,a.y-=r.y,a.original&&(a.original.x-=r.x,a.original.y-=r.y)}),t};function bh(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}bh.prototype.add=function(e,t){return this.addAll([e],t)},bh.prototype.addAll=function(e,t){var n=wP(e,!!t,this);return q(this,n),this};function Ys(e){this._modeling=e}Ys.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ys.prototype.moveClosure=function(e,t,n,i,o){var r=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;o&&o.parent===n&&(u=!0),W(a,function(p){r.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),W(s,function(p){var 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&&Cd(p,p.source,t),connectionEnd:d&&Md(p,p.target,t)})})},Ys.prototype.getClosure=function(e){return new bh().addAll(e,!0)};function yu(e){this._helper=new Ys(e)}yu.$inject=["modeling"],yu.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},yu.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 Vr(e){this._modeling=e,this._helper=new Ys(e)}Vr.$inject=["modeling"],Vr.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=$i(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=on(r.children,t),an(i.children,t,o),q(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Vr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(W(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:Md(r,t,n)})}),W(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:Cd(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Vr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return an(n.children,t,i),q(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},Vr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Vr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Ks(e){this._modeling=e}Ks.$inject=["modeling"],Ks.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 Ye(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},Ks.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||Rw(Ye(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||Rw(Ye(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},Ks.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 Rw(e){return e.original||e}function Mo(e,t){this._modeling=e,this._rules=t}Mo.$inject=["modeling","rules"],Mo.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();W(f,function(g){var h=g.source,m=c(h,s,g);m&&t.reconnectEnd(g,s,Vl(g,s,u),a)}),W(d,function(g){var h=g.target,m=c(s,h,g);m&&t.reconnectStart(g,s,Gl(g,s,u),a)})},Mo.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Mo.prototype.execute=function(e){},Mo.prototype.revert=function(e){},Mo.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Mo.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Mo.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Xs(e){this._modeling=e}Xs.$inject=["modeling"],Xs.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},q(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Xs.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(W(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:Vl(r,n,i)})}),W(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:Gl(r,n,i)})}))},Xs.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return q(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function cr(e){this._modeling=e}cr.$inject=["modeling"],cr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,o=e.resizingShapes,r=e.start,a={};this.moveShapes(i,t),W(o,function(s){a[s.id]=qD(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(xD(i,o),t,n,r,i,o,a)},cr.prototype.execute=function(){},cr.prototype.revert=function(){},cr.prototype.moveShapes=function(e,t){var n=this;W(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},cr.prototype.resizeShapes=function(e,t,n){var i=this;W(e,function(o){var r=wD(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},cr.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);W(e,function(u){var p=u.source,f=u.target,d=UD(u),g=Mw(n),h={},m=c.has(p)||l.has(p),w=c.has(f)||l.has(f);m&&w?(d=Fn(d,function(y){return Aw(y,i,n)&&(y[g]=y[g]+t[g]),y.original&&Aw(y.original,i,n)&&(y.original[g]=y.original[g]+t[g]),y}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(m||w)&&(c.has(p)?h.connectionStart=Cd(u,p,t):c.has(f)?h.connectionEnd=Md(u,f,t):l.has(p)?h.connectionStart=Gl(u,p,a[p.id]):l.has(f)&&(h.connectionEnd=Vl(u,f,a[f.id])),s._modeling.layoutConnection(u,h))})};function Cw(e){return q({},e)}function UD(e){return Fn(e.waypoints,function(t){return t=Cw(t),t.original&&(t.original=Cw(t.original)),t})}function Mw(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Aw(e,t,n){var i=Mw(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function qD(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function vu(e){this._modeling=e}vu.$inject=["modeling"],vu.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Pw(n),t.collapsed=!t.collapsed;var i=Tw(n,t.collapsed);return[t].concat(i)},vu.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=kw(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function Pw(e){var t={};return W(e,function(n){t[n.id]=n.hidden,n.children&&(t=q({},t,Pw(n.children)))}),t}function Tw(e,t){var n=[];return W(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Tw(i.children,i.collapsed||t)))}),n}function kw(e,t){var n=[];return W(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(kw(i.children,t)))}),n}function bu(e){this._modeling=e}bu.$inject=["modeling"],bu.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Ow(i,t),Dw(n,t),t.host=n,t},bu.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,Ow(n,t),Dw(i,t,o),t};function Ow(e,t){return on(e&&e.attachers,t)}function Dw(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),an(i,t,n)}}function xh(){}xh.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},xh.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function It(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}It.$inject=["eventBus","elementFactory","commandStack"],It.prototype.getHandlers=function(){return{"shape.append":fu,"shape.create":sr,"shape.delete":qs,"shape.move":Vr,"shape.resize":Xs,"shape.replace":Mo,"shape.toggleCollapse":vu,spaceTool:cr,"label.create":Ws,"connection.create":du,"connection.delete":Us,"connection.move":vh,"connection.layout":mu,"connection.updateWaypoints":xh,"connection.reconnect":Ks,"elements.create":mh,"elements.move":yu,"elements.delete":yh,"elements.distribute":gu,"elements.align":pu,"element.updateAttachment":bu}},It.prototype.registerHandlers=function(e){W(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},It.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)},It.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},It.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)},It.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)},It.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},It.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},It.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},It.prototype.createElements=function(e,t,n,i,o){Ye(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},It.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},It.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},It.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},It.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},It.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},It.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},It.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},It.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},It.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},It.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)},It.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},It.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)},It.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,q(i,{docking:"source"}))},It.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,q(i,{docking:"target"}))},It.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},It.prototype._create=function(e,t){return aT(t)?t:this._elementFactory.create(e,t)},It.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Zs(e){this._elementRegistry=e}Zs.$inject=["elementRegistry"],Zs.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||YD(n,Lc(i));return Lw(n,i),e.oldProperties=r,e.changed=o,o},Zs.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Lw(n,t),i},Zs.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return M(e,"bpmn:DataObject")?KD(e,t):[]};function YD(e,t){return ni(t,function(n,i){return n[i]=e.get(i),n},{})}function Lw(e,t){W(t,function(n,i){e.set(i,n)})}function KD(e,t){return t.filter(function(n){return M(n,"bpmn:DataObjectReference")&&be(n).dataObjectRef===e})}var Qs="default",Ao="id",Iw="di",XD={width:0,height:0};function Js(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Js.$inject=["elementRegistry","moddle","modeling","textRenderer"],Js.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=tL(e.properties),s=e.oldProperties||ZD(t,a);return Bw(a,r)&&(o.unclaim(r[Ao]),i.updateId(t,a[Ao]),o.claim(a[Ao],r)),Qs in a&&(a[Qs]&&n.push(i.get(a[Qs].id)),r[Qs]&&n.push(i.get(r[Qs].id))),Nw(t,a),e.oldProperties=s,e.changed=n,n},Js.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&be(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,XD)}},Js.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 Nw(t,i),Bw(n,o)&&(a.unclaim(n[Ao]),r.updateId(t,i[Ao]),a.claim(i[Ao],o)),e.changed};function Bw(e,t){return Ao in e&&e[Ao]!==t[Ao]}function ZD(e,t){var n=Lc(t),i=e.businessObject,o=yt(e);return ni(n,function(r,a){return a!==Iw?r[a]=i.get(a):r[a]=QD(o,Lc(t.di)),r},{})}function QD(e,t){return ni(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Nw(e,t){var n=e.businessObject,i=yt(e);W(t,function(o,r){r!==Iw?n.set(r,o):i&&JD(i,o)})}function JD(e,t){W(t,function(n,i){e.set(i,n)})}var eL=["default"];function tL(e){var t=q({},e);return eL.forEach(function(n){n in e&&(t[n]=be(t[n]))}),t}function xu(e,t){this._canvas=e,this._modeling=t}xu.$inject=["canvas","modeling"],xu.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=t.getRootElement(),r=o.businessObject,a=r.$parent,s=yt(o);return t.setRootElement(n),t.removeRootElement(o),an(a.rootElements,i),i.$parent=a,on(a.rootElements,r),r.$parent=null,o.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=o,[]},xu.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=e.oldRoot,r=o.businessObject,a=i.$parent,s=yt(n);return t.setRootElement(o),t.removeRootElement(n),on(a.rootElements,i),i.$parent=null,an(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function wh(e,t){this._modeling=e,this._spaceTool=t}wh.$inject=["modeling","spaceTool"],wh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,o=e.location,r=Ri(i),a=r===i,s=a?i:i.parent,c=er(s),l=En(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+Si,y:i.y,width:i.width-Si,height:i.height}:{x:i.x,y:i.y+Si,width:i.width,height:i.height-Si};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];Br(r,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:ct(x.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 w=t.calculateAdjustments(p,m,f,g),y=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(w.movingShapes,w.resizingShapes,y,h,g);var v=l?{x:i.x+(a?Si:0),y:d-(o==="top"?120:0),width:i.width-(a?Si:0),height:120}:{x:d-(o==="left"?120:0),y:i.y+(a?Si:0),width:120,height:i.height-(a?Si:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},v,s)};function _h(e){this._modeling=e}_h.$inject=["modeling"],_h.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=er(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=En(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+Si,y:n.y+f*c,width:n.width-Si,height:l}:{x:n.x+f*c,y:n.y+Si,width:l,height:n.height-Si},f<r?t.resizeShape(o[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function ec(e,t){this._modeling=e,this._spaceTool=t}ec.$inject=["modeling","spaceTool"],ec.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},ec.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=Kk(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},ec.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Ge(e),o=Ge(t),r=gb(o,i),a=Ri(e),s=[],c=[];Br(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 tc="flowNodeRef",Eh="lanes";function wu(){}wu.prototype._computeUpdates=function(e,t){var n=[],i=[],o={},r=[];function a(u,p){var f=Ge(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=Ri(u);return o[p.id]||(o[p.id]=$l(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=Ri(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(Eh),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(tc).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},wu.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(Eh);n.remove.forEach(function(r){on(o,r),on(r.get(tc),i)}),n.add.forEach(function(r){an(o,r),an(r.get(tc),i)})}),[]},wu.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get(Eh);n.add.forEach(function(r){on(o,r),on(r.get(tc),i)}),n.remove.forEach(function(r){an(o,r),an(r.get(tc),i)})}),[]};var Sh="categoryValueRef";function nc(e,t){this._bpmnFactory=e,this._elementRegistry=t}nc.$inject=["bpmnFactory","elementRegistry"],nc.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(y,v,x){if(v){var E=a.get(y);E||(E={},a.set(y,E)),!(x&&E.present)&&(!x&&E.past||(x?E.present={categoryValue:v,root:Rh(y)}:E.past={categoryValue:v}))}}function c(y){o.set(y,be(y))}function l(){n.filter(function(y){return M(y,"bpmn:FlowElement")&&!rt(y)&&y.parent}).forEach(c)}function u(y){var v=be(y),x=v.get("categoryValueRef");return x||(x=ub(i,v),r.push(nL(y,x))),x}function p(y){return y.reduce(function(v,x){var E=Rh(x),A=v.get(E);return A||(A=[],v.set(E,A)),A.push(x),v},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(y){return M(y,"bpmn:Group")&&!rt(y)&&y.parent}).forEach(function(y){var v=be(y).get("categoryValueRef");if(!v){var x=Rh(y),E=f.get(x)||[],A=xa(E,y),D=Object.keys(A).length>0;D&&(v=u(y))}s(y,v,!0)}),t.forEach(function(y){s(y.groupShape,y.categoryValue,!1)}),r.length&&l();var d=Array.from(o.keys()),g=Array.from(a.values()).reduce(function(y,v){return v.present&&y.add(v.present.categoryValue),v.past&&y.add(v.past.categoryValue),y},new Set),h=new Map,m=p(d);a.forEach(function(y,v){var x=y.present;if(x){var E=m.get(x.root)||[],A=xa(E,v);E.forEach(function(D){if(A[D.id]){var P=h.get(D);P||(P=new Set,h.set(D,P)),P.add(x.categoryValue)}})}});var w=d.reduce(function(y,v){var x=o.get(v),E=x.get(Sh),A=new Set(E),D=h.get(v)||new Set,P=Array.from(D).filter(function(j){return!A.has(j)}),T=E.filter(function(j){return g.has(j)&&!D.has(j)});return(P.length||T.length)&&y.push({businessObject:x,categoryValuesToAdd:P,categoryValuesToRemove:T}),y},[]);return{flowElements:w,groups:r}},nc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),iL(t.groups),rL(t.flowElements),[]},nc.prototype.revert=function(e){var t=e.updates;return aL(t.flowElements),oL(t.groups),[]};function nL(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function iL(e){e.forEach(function(t){be(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function oL(e){e.forEach(function(t){be(t.groupShape).categoryValueRef=null})}function rL(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Sh);t.categoryValuesToRemove.forEach(function(o){on(i,o)}),t.categoryValuesToAdd.forEach(function(o){an(i,o,!0)})})}function aL(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Sh);t.categoryValuesToAdd.forEach(function(o){on(i,o)}),t.categoryValuesToRemove.forEach(function(o){an(i,o,!0)})})}function Rh(e){for(;e.parent;)e=e.parent;return e}function _u(e){this._moddle=e}_u.$inject=["moddle"],_u.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),[]},_u.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 sL={fill:void 0,stroke:void 0};function Ch(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(ei(t)){var n=cL(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Ch.$inject=["commandStack"],Ch.prototype.postExecute=function(e){var t=e.elements,n=e.colors||sL,i=this,o={};"fill"in n&&q(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&q(o,{"border-color":this._normalizeColor(n.stroke)}),W(t,function(r){var a=Lt(r)?$i(o,["border-color"]):o,s=yt(r);if(lL(a),rt(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(!at(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function cL(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 lL(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var uL={width:0,height:0};function $w(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return $T(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!rt(l)&&Qo(l)&&!Rl(l)&&!Fw(p)){var f=7,d=Xf(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=vi(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(!(!rt(u)&&!M(u,"bpmn:TextAnnotation"))){if(rt(u)&&Fw(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var g=vi(l);typeof f>"u"&&(f=t.getExternalLabelBounds(u,g)),f&&e.resizeShape(u,f,uL)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}$w.$inject=["modeling","textRenderer","bpmnFactory"];function Fw(e){return!e||!e.trim()}function In(e,t,n,i){It.call(this,e,t,n),this._bpmnRules=i}De(In,It),In.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],In.prototype.getHandlers=function(){var e=It.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Zs,e["element.updateProperties"]=Js,e["canvas.updateRoot"]=xu,e["lane.add"]=wh,e["lane.resize"]=ec,e["lane.split"]=_h,e["lane.updateRefs"]=wu,e["group.updateRefs"]=nc,e["id.updateClaim"]=_u,e["element.setColor"]=Ch,e["element.updateLabel"]=$w,e},In.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},In.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)},In.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},In.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},In.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},In.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},In.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},In.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},In.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},In.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},In.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},In.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},In.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},In.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function jw(){}jw.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Xe(t.source||e.source),t.connectionEnd||Xe(t.target||e.target)]};var Eu=20,pL=5,Su=Math.round,Hw=20,fL={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function dL(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function hL(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function zw(e,t,n){var i=On(t,e,pL),o=n.split(":")[0],r=Su((t.x-e.x)/2+e.x),a=Su((t.y-e.y)/2+e.y),s,c,l=hL(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=dL(i,o),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+Eu*(/l/.test(o)?-1:1),y:f?a+Eu:a}):(f=r===e.x,s={x:f?r+Eu:r,y:e.y+Eu*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:Mh(e,s,c).concat(s),directions:c,turnNextDirections:f}}function gL(e,t,n){return zw(e,t,n)}function mL(e,t,n){var i=zw(t,e,Gw(n));return{waypoints:i.waypoints.slice().reverse(),directions:Gw(i.directions),turnNextDirections:i.turnNextDirections}}function yL(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=Mh(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function Gw(e){return e.split(":").reverse().join(":")}function vL(e,t,n){var i=Su((t.x-e.x)/2+e.x),o=Su((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 Mh(e,t,n){if(n=n||"h:h",!ML(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Ww(n)){var i=gL(e,t,n),o=mL(e,t,n),r=yL(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return vL(e,t,n)}function bL(e,t,n){var i=Mh(e,t,n);return i.unshift(e),i.push(t),qw(i)}function xL(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=OS(r,"straight")[0]||"h:h",s=fL[a]||0,c=On(e,t,s),l=CL(c,a);n=n||Xe(e),i=i||Xe(t);var u=l.split(":"),p=Uw(n,e,u[0],AL(c)),f=Uw(i,t,u[1],c);return bL(p,f,l)}function wL(e,t,n,i,o,r){Ye(n)&&(o=n,r=i,n=Xe(e),i=Xe(t)),r=q({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&EL(e,t,n,i,r),c||(c=r.connectionEnd&&RL(t,e,i,o),c)||(c=r.connectionStart&&SL(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:xL(e,t,n,i,r)}function _L(e,t,n){return e>=t&&e<=n}function Vw(e,t,n){var i={x:"width",y:"height"};return _L(t[e],n[e],n[e]+n[i[e]])}function EL(e,t,n,i,o){var r={},a,s;return s=On(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),o.preserveDocking==="target"?Vw(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:Vw(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 SL(e,t,n,i){return Ah(e,t,n,i)}function RL(e,t,n,i){var o=i.slice().reverse();return o=Ah(e,t,n,o),o?o.reverse():null}function Ah(e,t,n,i){function o(u){return u.length<3?!0:u.length>4?!1:!!$t(u,function(p,f){var d=u[f-1];return d&&Cs(p,d)<3})}function r(u,p,f){var d=bo(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(mv(u[d],p,Hw)||mv(u[d],f,Hw))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=Ah(e,t,n,l)),c&&bo(c)?null:c}function CL(e,t){if(Ww(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 ML(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Ww(e){return e&&/t|r|b|l/.test(e)}function AL(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 Uw(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 qw(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return Wf(o,r,n,0)||t.push(n),t},[])}var PL=-10,TL=40,kL={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},OL={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},Ph={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},ic={top:"t",right:"r",bottom:"b",left:"l"};function Ru(e){this._elementRegistry=e}De(Ru,jw),Ru.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=Yw(o&&o[0],n)),a||(a=Yw(o&&o[o.length-1],i)),(M(e,"bpmn:Association")||M(e,"bpmn:DataAssociation"))&&o&&!Kw(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=ab(n,s)?kL:OL;return M(e,"bpmn:MessageFlow")?c=LL(n,i,u):(M(e,"bpmn:SequenceFlow")||Kw(n,i))&&(n===i?c={preferredLayouts:jL(n,e,u)}:M(n,"bpmn:BoundaryEvent")?c={preferredLayouts:HL(n,i,a,u)}:oc(n)||oc(i)?c={preferredLayouts:u.subProcess,preserveDocking:BL(n)}:M(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:M(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=q(c,t),l=qw(wL(n,i,r,a,o,c))),l||[r,a]};function DL(e){var t=e.host;return On(Xe(e),t,PL)}function LL(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:IL(e,t)}}function IL(e,t){return M(t,"bpmn:Participant")?"source":M(e,"bpmn:Participant")?"target":oc(t)?"source":oc(e)||M(t,"bpmn:Event")?"target":M(e,"bpmn:Event")?"source":null}function BL(e){return oc(e)?"target":"source"}function Yw(e,t){return e?e.original||e:Xe(t)}function Kw(e,t){return M(t,"bpmn:Activity")&&M(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function oc(e){return M(e,"bpmn:SubProcess")&&ht(e)}function Wr(e,t){return e===t}function NL(e,t){return t.indexOf(e)!==-1}function $a(e){var t=/right|left/.exec(e);return t&&t[0]}function Fa(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Xw(e,t){return Ph[e]===t}function $L(e,t){var n=$a(e),i=Ph[n];return t.indexOf(i)!==-1}function FL(e,t){var n=Fa(e),i=Ph[n];return t.indexOf(i)!==-1}function Zw(e){return e==="right"||e==="left"}function jL(e,t,n){var i=t.waypoints,o=i&&i.length&&On(i[0],e);return o==="top"?n.loop.fromTop:o==="right"?n.loop.fromRight:o==="left"?n.loop.fromLeft:n.loop.fromBottom}function HL(e,t,n,i){var o=Xe(e),r=Xe(t),a=DL(e),s,c,l=Wr(e.host,t),u=NL(a,["top","right","bottom","left"]),p=On(r,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?zL(a,u,e,t,n,i):(s=GL(a,p,u,i.isHorizontal),c=VL(a,p,u,i.isHorizontal),[s+":"+c])}function zL(e,t,n,i,o,r){var a=t?e:r.isHorizontal?Fa(e):$a(e),s=ic[a],c;return t?Zw(e)?c=Qw("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=Qw("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function Qw(e,t,n,i){var o=TL;return!(Th(e,i,n,o)||Th(e,i,{x:n.x+n.width,y:n.y+n.height},o)||Th(e,i,Xe(t),o))}function Th(e,t,n,i){return Math.abs(t[e]-n[e])<i}function GL(e,t,n,i){if(n)return ic[e];var o=Fa(e),r=$a(e),a=Fa(t),s=$a(t);if(i){if(Wr(o,a)||Xw(r,s))return ic[o]}else if(Wr(r,s)||Xw(o,a))return ic[r];return ic[i?r:o]}function VL(e,t,n,i){if(n)return Zw(e)?$L(e,t)||Wr(e,t)?"h":"v":FL(e,t)||Wr(e,t)?"v":"h";var o=Fa(e),r=$a(e),a=Fa(t),s=$a(t);return a&&!s?"v":s&&!a?"h":i?Wr(o,a)?"h":"v":Wr(r,s)?"v":"h"}Ru.$inject=["elementRegistry"];function Jw(e){return q({original:e.point.original||e.point},e.actual)}function lr(e,t){this._elementRegistry=e,this._graphicsFactory=t}lr.$inject=["elementRegistry","graphicsFactory"],lr.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(Jw(i)),r.push(Jw(o)),r},lr.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}},lr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return Ms(i,o,n)},lr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},lr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},lr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const kh={__init__:["modeling","bpmnUpdater"],__depends__:[lO,RO,MO,AO,pw,PD,kD,ND,Mi,hh,yw],bpmnFactory:["type",Pi],bpmnUpdater:["type",ci],elementFactory:["type",ar],modeling:["type",In],layouter:["type",Ru],connectionDocking:["type",lr]};var WL=10,e_=50,UL=250;function Oh(e,t,n,i){for(var o;o=qL(e,n,t);)n=i(t,n,o);return n}function Dh(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 qL(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=KL(e);return $t(o,function(r){if(r===n)return!1;var a=On(r,i,WL);return a==="intersect"})}function YL(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||e_,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||UL,c=t.reference||"start";r||(r=QL);function l(g,h){return o==="n"?c==="start"?Ge(g).top-Ge(h).bottom:c==="center"?Ge(g).top-Xe(h).y:Ge(g).top-Ge(h).top:o==="w"?c==="start"?Ge(g).left-Ge(h).right:c==="center"?Ge(g).left-Xe(h).x:Ge(g).left-Ge(h).left:o==="s"?c==="start"?Ge(h).top-Ge(g).bottom:c==="center"?Xe(h).y-Ge(g).bottom:Ge(h).bottom-Ge(g).bottom:c==="start"?Ge(h).left-Ge(g).right:c==="center"?Xe(h).x-Ge(g).right:Ge(h).right-Ge(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=ni(f,function(g,h){var m=h.distance,w=h.weight;return m<0||m>s||(g[String(m)]||(g[String(m)]=0),g[String(m)]+=1*w,(!g.distance||g[g.distance]<g[String(m)])&&(g.distance=m)),g},{});return d.distance||i}function KL(e){var t=Lh(e);return e.host&&(t=t.concat(Lh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Lh(i))},[]))),t}function Lh(e){return ZL(e).concat(XL(e))}function XL(e){return e.incoming.map(function(t){return t.source})}function ZL(e){return e.outgoing.map(function(t){return t.target})}function QL(){return!0}var JL=100;function t_(e,t,n){e.on("autoPlace",JL,function(i){var o=i.shape,r=i.source;return eI(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}}t_.$inject=["eventBus","modeling","canvas"];function eI(e,t,n){n||(n={});var i=n.defaultDistance||e_,o=Xe(e),r=Ge(e);return{x:r.right+i+t.width/2,y:o.y}}function n_(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}n_.$inject=["eventBus","selection"];const tI={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",t_],autoPlaceSelectionBehavior:["type",n_]};function i_(e,t,n){var i=ab(e,n);if(M(t,"bpmn:TextAnnotation"))return iI(e,t,i);if(at(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return oI(e,t,i);if(M(t,"bpmn:FlowNode"))return nI(e,t,i)}function nI(e,t,n){var i=Ge(e),o=Xe(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=YL(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=On(e,e.host,-25),l.indexOf(r.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:o.y+o_(l,c,r)}:{x:o.x+o_(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Oh(e,t,u,Dh(f))}function o_(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function iI(e,t,n){var i=Ge(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};Lt(e)&&(o=Xe(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 Oh(e,t,o,Dh(a))}function oI(e,t,n){var i=Ge(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 Oh(e,t,o,Dh(a))}function r_(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return i_(o,i,t)})}r_.$inject=["eventBus","elementRegistry"];const Cu={__depends__:[tI],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",r_]};function Po(e,t,n,i){ve.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=Op(aa(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=sa(s,function(p){return p.parent.id});W(u,function(p,f){Ye(l)&&(p=p.filter(function(d){return $t(l,ca({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)})}Po.$inject=["eventBus","elementRegistry","modeling","rules"],De(Po,ve),Po.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=Ge(ln(e)),r=Ge(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),bl(q({},r,a))},Po.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(rI(i,t)){var o=aI($i(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:o});var r=t.parent;r&&this._expand([t],r)}}},Po.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Po.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Po.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function rI(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function aI(e,t){var n="";return e=Ge(e),t=Ge(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 Mu(e){e.invoke(Po,this)}Mu.$inject=["injector"],De(Mu,Po),Mu.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){Ci.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}rc.$inject=["eventBus"],De(rc,Ci),rc.prototype.canResize=function(e,t){return!1};function Au(e,t){rc.call(this,e),this._modeling=t}De(Au,rc),Au.$inject=["eventBus","modeling"],Au.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 W(e,function(i){if(M(i,"bpmn:Lane")||rt(i)){n=!1;return}}),n};const a_={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Mu],bpmnAutoResizeProvider:["type",Au]},sI=1500;class s_{constructor(t){t.on("moddleCopy.canCopyProperties",sI,({sourceElement:n,targetElement:i})=>{var r;if(!((r=n==null?void 0:n.$instanceOf)!=null&&r.call(n,Mr)))return;const o=Cn(n);o!==void 0&&i.set("xml:lang",o)})}}$n(s_,"$inject",["eventBus"]);const c_={__init__:["translationLocaleCopy"],translationLocaleCopy:["type",s_]},cI=500,Pu=1,l_=(e,t)=>{if((e==null?void 0:e.type)!=="bpmn:TextAnnotation"||!(t!=null&&t.original))return;const{x:n,y:i}=t.original;(n<e.x-Pu||n>e.x+e.width+Pu||i<e.y-Pu||i>e.y+e.height+Pu)&&(t.original={x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)})};class u_{constructor(t){t.on("bpmnElement.added",cI,({element:n})=>{if((n==null?void 0:n.type)!=="bpmn:Association")return;const i=n.waypoints;!i||i.length<2||(l_(n.source,i[0]),l_(n.target,i[i.length-1]))})}}$n(u_,"$inject",["eventBus"]);const p_={__init__:["annotationImportDocking"],annotationImportDocking:["type",u_]},f_=[ob,Ds,kh,Cu,a_,zp,c_,p_];function lI(e={}){wm(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Ea({container:t,moddleExtensions:e.moddleExtensions??zc,additionalModules:[...f_,...e.additionalModules??[]]})}const d_={"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":"풀"},uI={이:["이","가"],을:["을","를"],와:["과","와"]};function pI(e,t){const[n,i]=uI[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 fI={"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":"연관선"},dI="요소";function Ih(e){return(e&&fI[e.type])??dI}const h_=20;function hI(e){const t=e.replace(/\s+/g," ").trim();return t.length>h_?`${t.slice(0,h_)}…`:t}function Tu(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:hI(o.name),a=r===void 0?i+Ih(o):r,s=r===void 0?a:`「${r}」`;return n?s+pI(a,n).slice(a.length):s}function gI(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&&Ih(r)===Ih(a);return[Tu(e,t,i),Tu(e,n,o,s?"다른 ":"")]}function mI(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 yI(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 ku={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function vI(e,t){const n=(o,r)=>Tu(t,o,r),i=(o,r,a,s)=>gI(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)}의 ${ku[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)}의 ${ku[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${ku[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${ku[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 bI(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Tu(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const g_="기타",Bh={error:0,warning:1,info:2};function m_(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${pt(i)}`,source:"geometry",code:i.kind,severity:mI(i),targetRefs:yI(i),category:d_[i.kind]??g_,message:vI(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:d_[i.ruleId]??g_,message:bI(i,t)});return n}function y_(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function ja(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function Nh(e,t){if(t===void 0||e.length===0)return!1;const n=ja(e[0],t);return e.some(i=>ja(i,t)!==n)}function v_(e,t){const n=Nh(e,t);return e.slice().sort((i,o)=>(n?Number(ja(o,t))-Number(ja(i,t)):0)||Bh[i.severity]-Bh[o.severity])}const b_="i18n-untranslated",x_="i18n-review-requested",$h="i18nDisplay.redrawn",w_=[["untranslated",b_],["reviewRequested",x_]];class Fh{constructor(t,n,i,o,r,a,s,c){$n(this,"config");$n(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(Bc,{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(Bc,{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=Ar(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=$o(n).filter(f=>Cn(f)),s=f=>f.body??"",c=a.find(f=>Cn(f)===o&&s(f)),l=Fo(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(Cn);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 w_)r.toggle(g,(o==null?void 0:o.status)===d);if(!o||o.native)return n();const{target:a,key:s}=Ar((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 w_)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire($h)}}$n(Fh,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const __={__depends__:[zp],__init__:["i18nDisplay"],i18nDisplay:["type",Fh]};var xI=new zr("ov"),wI=500;function An(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=xI,this._overlayDefaults=q({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=_I(n.getContainer()),this._init()}An.$inject=["config.overlays","eventBus","canvas","elementRegistry"],An.prototype.get=function(e){if(ei(e)&&(e={id:e}),ei(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?ct(t.overlays,ca({type:e.type})):t.overlays.slice():[]}else return e.type?ct(this._overlays,ca({type:e.type})):e.id?this._overlays[e.id]:null},An.prototype.add=function(e,t,n){if(yn(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=q({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},An.prototype.remove=function(e){var t=this.get(e)||[];Ye(t)||(t=[t]);var n=this;W(t,function(i){var o=n._getOverlayContainer(i.element,!0);if(i&&(Qi(i.html),Qi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),o){var r=o.overlays.indexOf(i);r!==-1&&o.overlays.splice(r,1)}})},An.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},An.prototype.show=function(){Ou(this._overlayRoot)},An.prototype.hide=function(){Ou(this._overlayRoot,!1)},An.prototype.clear=function(){this._overlays={},this._overlayContainers=[],fl(this._overlayRoot)},An.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=ln(t);i=r.x,o=r.y}E_(n,i,o),Mn(e.html,"data-container-id",t.id)},An.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,o=t.left,r=t.top;if(t.right!==void 0){var a;i.waypoints?a=ln(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=ln(i).height:s=i.height,r=t.bottom*-1+s}E_(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},An.prototype._createOverlayContainer=function(e){var t=zt('<div class="djs-overlays" />');qn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},An.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";S_(this._overlayRoot,n)},An.prototype._getOverlayContainer=function(e,t){var n=$t(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},An.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)),ei(i)&&(i=zt(i)),r=this._getOverlayContainer(n),o=zt('<div class="djs-overlay" data-overlay-id="'+t+'">'),qn(o,{position:"absolute"}),o.appendChild(i),e.type&&kt(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Ou(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())},An.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),o=n&&n.minZoom,r=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(mn(o)&&o>t.scale||mn(r)&&r<t.scale))&&(c=!1),Ou(a,c),this._updateOverlayScale(e,t)},An.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,o,r=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,o=1):(i=n.min,o=n.max),mn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),mn(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),mn(a)&&(s="scale("+a+","+a+")"),S_(r,s)},An.prototype._updateOverlaysVisibilty=function(e){var t=this;W(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},An.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var o=i.element,r=t.get({element:o});W(r,function(c){t.remove(c.id)});var a=t._getOverlayContainer(o);if(a){Qi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",wI,function(i){var o=i.element,r=t._getOverlayContainer(o,!0);r&&(W(r.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(r))}),e.on("element.marker.update",function(i){var o=t._getOverlayContainer(i.element,!0);o&&kt(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 _I(e){var t=zt('<div class="djs-overlay-container" />');return qn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function E_(e,t,n){qn(e,{left:t+"px",top:n+"px"})}function Ou(e,t){e.style.display=t===!1?"none":""}function S_(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Du={__init__:["overlays"],overlays:["type",An]};function jh(e,t){t.invoke(ve,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)})}De(jh,ve),jh.$inject=["canvas","injector"];const EI={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",jh]};function Ur(e){return CSS.escape(e)}var SI={"&":"&","<":"<",">":">",'"':""","'":"'"};function R_(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return SI[t]})}var RI="bjs-breadcrumbs-shown";function C_(e,t,n){var i=zt('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=kt(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=be(l),p=$t(a,function(f){return f===u});p&&s()});function s(c){c&&(a=CI(c));var l=a.flatMap(function(p){var f=n.findRoot(io(p))||n.findRoot(p.id);if(!f&&M(p,"bpmn:Process")){var d=t.find(function(m){var w=be(m);return w&&w.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=R_(p.name||p.id),h=zt('<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(RI,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}C_.$inject=["eventBus","elementRegistry","canvas"];function CI(e){for(var t=be(e),n=[],i=t;i;i=i.$parent)(M(i,"bpmn:SubProcess")||M(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function M_(e,t){var n=null,i=new MI;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})}M_.$inject=["eventBus","canvas"];function MI(){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 A_={x:180,y:160};function qr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}qr.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)})}},qr.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),PI(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},qr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=AI(e),i={x:n.x-A_.x,y:n.y-A_.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)})},qr.prototype._moveToDiPlane=function(e,t){var n=P_(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},qr.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},qr.$inject=["eventBus","moddle"];function P_(e){return M(e,"bpmndi:BPMNDiagram")?e:P_(e.$parent)}function AI(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=Ge(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),bl(t)}function PI(e,t){var n=e.$parent;return!(!M(n,"bpmn:SubProcess")||n===t.bpmnElement||at(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Lu=250,TI='<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>',kI="bjs-drilldown-empty";function ur(e,t,n,i,o){ve.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",Lu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Lu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Lu,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"],Lu,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)})})}De(ur,ve),ur.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},ur.prototype._canDrillDown=function(e){var t=this._canvas;return M(e,"bpmn:SubProcess")&&t.findRoot(io(e))},ur.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=be(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;kt(i.html).toggle(kI,!o)}},ur.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=be(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=zt('<button type="button" class="bjs-drilldown">'+TI+"</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(io(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},ur.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},ur.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const OI={__depends__:[Du,hh,EI],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",C_],drilldownCentering:["type",M_],drilldownOverlayBehavior:["type",ur],subprocessCompatibility:["type",qr]};function pr(e){Yt.call(this,e)}De(pr,Yt),pr.prototype._modules=[ob,OI,Du,Mi,Ds],pr.prototype._moddleExtensions={};var Iu="keyboard.keydown",DI="keyboard.keyup",LI=1e3,T_="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 Yn(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(T_));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Yn.$inject=["config.keyboard","eventBus"],Yn.prototype._keydownHandler=function(e){this._keyHandler(e,Iu)},Yn.prototype._keyupHandler=function(e){this._keyHandler(e,DI)},Yn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Iu,i),n&&e.preventDefault()}},Yn.prototype._isEventIgnored=function(e){return!1},Yn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(T_)),this.unbind(),e=this._node=this._target,je.bind(e,"keydown",this._keydownHandler),je.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Yn.prototype.getBinding=function(){return this._node},Yn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),je.unbind(e,"keydown",this._keydownHandler),je.unbind(e,"keyup",this._keyupHandler)),this._node=null},Yn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Yn.prototype.addListener=function(e,t,n){_n(e)&&(n=t,t=e,e=LI),this._eventBus.on(n||Iu,e,t)},Yn.prototype.removeListener=function(e,t){this._eventBus.off(t||Iu,e)},Yn.prototype.hasModifier=HO,Yn.prototype.isCmd=ai,Yn.prototype.isShift=ih,Yn.prototype.isKey=bn;var II=500;function Ha(e,t){var n=this;e.on("editorActions.init",II,function(i){var o=i.editorActions;n.registerBindings(t,o)})}Ha.$inject=["eventBus","keyboard"],Ha.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(UO(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(qO(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(zO(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(GO(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(VO(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(WO(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(bn(["+","Add","="],o)&&ai(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(bn(["-","Subtract"],o)&&ai(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(bn("0",o)&&ai(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(bn(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const Hh={__init__:["keyboard","keyboardBindings"],keyboard:["type",Yn],keyboardBindings:["type",Ha]};var BI={moveSpeed:50,moveSpeedAccelerated:200};function k_(e,t,n){var i=this;this._config=q({},BI,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})}}k_.$inject=["config.keyboardMove","keyboard","canvas"];const O_={__depends__:[Hh],__init__:["keyboardMove"],keyboardMove:["type",k_]};var NI=15;function D_(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=Fr(s),p=Vi(u,c);if(!n.dragging&&$I(p)>NI&&(n.dragging=!0,l===0&&Vx(e),iu("grab")),n.dragging){var f=n.last||n.start;p=Vi(u,f),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){je.unbind(document,"mousemove",o),je.unbind(document,"mouseup",r),n=null,Gx()}function a(s){if(!Lr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Fr(s)},je.bind(document,"mousemove",o),je.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}D_.$inject=["eventBus","canvas"];function $I(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const L_={__init__:["moveCanvas"],moveCanvas:["type",D_]};function I_(e,t){var n=ed(e.min),i=ed(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function FI(e,t){return Math.max(e.min,Math.min(e.max,t))}var jI=Math.sign||function(e){return e>=0?1:-1},zh={min:.2,max:4},B_=10,HI=.1,zI=.75;function ao(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Zn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||zI;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}ao.$inject=["config.zoomScroll","eventBus","canvas"],ao.prototype.scroll=function(t){this._canvas.scroll(t)},ao.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ao.prototype.zoom=function(t,n){var i=I_(zh,B_*2);this._totalDelta+=t,Math.abs(this._totalDelta)>HI&&(this._zoom(t,n,i),this._totalDelta=0)},ao.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Zb()&&t.metaKey,o=t.shiftKey,r=-1*this._scale,a;if(i?r*=t.deltaMode===0?.02:.32:r*=t.deltaMode===0?1:16,i){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};a=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*jI(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)}},ao.prototype.stepZoom=function(t,n){var i=I_(zh,B_);this._zoom(t,n,i)},ao.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=ed(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(FI(zh,s),t)},ao.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&je[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},ao.prototype._init=function(e){this.toggle(e)};const N_={__init__:["zoomScroll"],zoomScroll:["type",ao]};function ac(e){pr.call(this,e)}De(ac,pr),ac.prototype._navigationModules=[O_,L_,N_],ac.prototype._modules=[].concat(pr.prototype._modules,ac.prototype._navigationModules);function Gh(e){return e&&e[e.length-1]}function $_(e){return e.y}function F_(e){return e.x}var GI={left:F_,center:F_,right:function(e){return e.x+e.width},top:$_,middle:$_,bottom:function(e){return e.y+e.height}};function za(e,t){this._modeling=e,this._rules=t}za.$inject=["modeling","rules"],za.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}},za.prototype._isType=function(e,t){return t.indexOf(e)!==-1},za.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=Gh(t),r[e]=u[i]+u[o];else if(this._isType(e,["center","middle"])){if(W(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=Yi(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return r[e]=Gh(c).center,r;l=t[0],t=Yi(t,function(f){return f[i]+f[o]}),u=Gh(t),r[e]=p(l,u)}return r},za.prototype.trigger=function(e,t){var n=this._modeling,i,o=ct(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:o}),Ye(i)&&(o=i),!(o.length<2||!i)){var r=GI[t],a=Yi(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const VI={__init__:["alignElements"],alignElements:["type",za]},WI=new zr;function Ga(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Ga.$inject=["eventBus"],Ga.prototype.schedule=function(e,t=WI.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Ga.prototype._schedule=function(e,t){const n=UI();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}},Ga.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Ga.prototype._cancel=function(e){clearTimeout(e.executionId)};function UI(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const qI={scheduler:["type",Ga]};var YI="djs-element-hidden",Bu=".entry",KI=1e3,j_=8,XI=300;function pn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}pn.$inject=["canvas","elementRegistry","eventBus","scheduler"],pn.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var o=i.target,r=Ye(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=Ye(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},pn.prototype._createContainer=function(){var e=zt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},pn.prototype.registerProvider=function(e,t){t||(t=e,e=KI),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},pn.prototype.getEntries=function(e){var t=this._getProviders(),n=Ye(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return W(t,function(o){if(_n(o[n])){var r=o[n](e);_n(r)?i=r(i):W(r,function(a,s){i[s]=a})}}),i},pn.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=Mn(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},XI);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},pn.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var o=this._current.target,r=this._current.entries,a=r[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(_n(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},pn.prototype.open=function(e,t){if(!(!t&&this.isOpen(e))){var n=this._eventBus.fire("contextPad.open.allowed",{target:e});n!==!1&&(this.close(),this._updateAndOpen(e))}},pn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},pn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;W(t,function(o,r){var a=o.group||"default",s=zt(o.html||'<div class="entry" draggable="true"></div>'),c;Mn(s,"data-action",r),c=At("[data-group="+Ur(a)+"]",n),c||(c=zt('<div class="group"></div>'),Mn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&ZI(s,o.className),o.title&&Mn(s,"title",o.title),o.imageUrl&&(i=zt("<img>"),Mn(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),kt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},pn.prototype._createHtml=function(e){var t=this,n=zt('<div class="djs-context-pad"></div>');return ii.bind(n,Bu,"click",function(i){t.trigger("click",i)}),ii.bind(n,Bu,"dragstart",function(i){t.trigger("dragstart",i)}),ii.bind(n,Bu,"mouseover",function(i){t.trigger("mouseover",i)}),ii.bind(n,Bu,"mouseout",function(i){t.trigger("mouseout",i)}),je.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},pn.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&JI(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},pn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},pn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Ye(e)!==Ye(n)?!1:Ye(e)?e.length===n.length&&Bo(e,function(i){return n.includes(i)}):n===e},pn.prototype.isShown=function(){return this.isOpen()&&kt(this._current.html).has("open")},pn.prototype.show=function(){this.isOpen()&&(kt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},pn.prototype.hide=function(){this.isOpen()&&(kt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},pn.prototype._getPosition=function(e){if(!Ye(e)&&Lt(e)){var t=this._canvas.viewbox(),n=QI(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+j_*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+j_*this._canvas.zoom(),top:s.top-a.top}},pn.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(i){i in n&&(t.style[i]=n[i]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},pn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Ye(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,YI)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},pn.prototype._getTargetBounds=function(e){var t=this,n=Ye(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 ZI(e,t){var n=kt(e);t=Ye(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function QI(e){return e.waypoints[e.waypoints.length-1]}function JI(e,t){return e=Ye(e)?e:[e],t=Ye(t)?t:[t],e.length===t.length&&Bo(e,function(n){return t.includes(n)})}const H_={__depends__:[nu,qI,Du],contextPad:["type",pn]};var Nu,Xt,z_,fr,G_,V_,W_,Vh,$u,sc,U_,Wh,Uh,qh,Fu={},ju=[],eB=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Hu=Array.isArray;function To(e,t){for(var n in t)e[n]=t[n];return e}function Yh(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function q_(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?Nu.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 zu(e,a,i,o,null)}function zu(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??++z_,__i:-1,__u:0};return o==null&&Xt.vnode!=null&&Xt.vnode(r),r}function Gu(e){return e.children}function Vu(e,t){this.props=e,this.context=t}function Yr(e,t){if(t==null)return e.__?Yr(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"?Yr(e):null}function tB(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=To({},t);r.__v=t.__v+1,Xt.vnode&&Xt.vnode(r),Kh(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Yr(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,t0(i,r,o),t.__e=t.__=null,r.__e!=n&&Y_(r)}}function Y_(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}),Y_(e)}function K_(e){(!e.__d&&(e.__d=!0)&&fr.push(e)&&!Wu.__r++||G_!=Xt.debounceRendering)&&((G_=Xt.debounceRendering)||V_)(Wu)}function Wu(){try{for(var e,t=1;fr.length;)fr.length>t&&fr.sort(W_),e=fr.shift(),t=fr.length,tB(e)}finally{fr.length=Wu.__r=0}}function X_(e,t,n,i,o,r,a,s,c,l,u){var p,f,d,g,h,m,w=i&&i.__k||ju,y=t.length;for(c=nB(n,t,w,c,y),p=0;p<y;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&w[d.__i]||Fu,d.__i=p,m=Kh(e,d,f,o,r,a,s,c,l,u),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Xh(f.ref,null,d),u.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=Z_(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 nB(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]=zu(null,a,null,null,null):Hu(a)?a=e.__k[r]=zu(Gu,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=zu(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=iB(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=Yr(s)),i0(s,s));return i}function Z_(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=Z_(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Yr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function iB(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 Q_(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||eB.test(t)?n:n+"px"}function Uu(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||Q_(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Q_(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(U_,"$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[sc]=i[sc]:(n[sc]=Wh,e.addEventListener(t,r?qh:Uh,r)):e.removeEventListener(t,r?qh:Uh,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 J_(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[$u]==null)t[$u]=Wh++;else if(t[$u]<n[sc])return;return n(Xt.event?Xt.event(t):t)}}}function Kh(e,t,n,i,o,r,a,s,c,l){var u,p,f,d,g,h,m,w,y,v,x,E,A,D,P,T,j=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Xt.__b)&&u(t);e:if(typeof j=="function"){p=a.length;try{if(y=t.props,v=j.prototype&&j.prototype.render,x=(u=j.contextType)&&i[u.__c],E=u?x?x.props.value:u.__:i,n.__c?w=(f=t.__c=n.__c).__=f.__E:(v?t.__c=f=new j(y,E):(t.__c=f=new Vu(y,E),f.constructor=j,f.render=rB),x&&x.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),v&&f.__s==null&&(f.__s=f.state),v&&j.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=To({},f.__s)),To(f.__s,j.getDerivedStateFromProps(y,f.__s))),g=f.props,h=f.state,f.__v=t,d)v&&j.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),v&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(v&&j.getDerivedStateFromProps==null&&y!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(y,E),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(y,f.__s,E)===!1){t.__v!=n.__v&&(f.props=y,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(F){F&&(F.__=t)}),ju.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Yr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(y,f.__s,E),v&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,m)})}if(f.context=E,f.props=y,f.__P=e,f.__e=!1,A=Xt.__r,D=0,v)f.state=f.__s,f.__d=!1,A&&A(t),u=f.render(f.props,f.state,f.context),ju.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,A&&A(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++D<25);f.state=f.__s,f.getChildContext!=null&&(i=To(To({},i),f.getChildContext())),v&&!d&&f.getSnapshotBeforeUpdate!=null&&(m=f.getSnapshotBeforeUpdate(g,h)),P=u!=null&&u.type===Gu&&u.key==null?n0(u.props.children):u,s=X_(e,Hu(P)?P:[P],t,n,i,o,r,a,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),w&&(f.__E=f.__=null)}catch(F){if(a.length=p,t.__v=null,c||r!=null){if(F.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(T=r.length;T--;)Yh(r[T])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),F.then||e0(t),Xt.__e(F,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=oB(n.__e,t,n,i,o,r,a,c,l);return(u=Xt.diffed)&&u(t),128&t.__u?void 0:s}function e0(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(e0))}function t0(e,t,n){for(var i=0;i<n.length;i++)Xh(n[i],n[++i],n[++i]);Xt.__c&&Xt.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Xt.__e(r,o.__v)}})}function n0(e){return typeof e!="object"||e==null||e.__b>0?e:Hu(e)?e.map(n0):e.constructor!==void 0?null:To({},e)}function oB(e,t,n,i,o,r,a,s,c){var l,u,p,f,d,g,h,m=n.props||Fu,w=t.props,y=t.type;if(y=="svg"?o="http://www.w3.org/2000/svg":y=="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==!!y&&(y?d.localName==y:d.nodeType==3)){e=d,r[l]=null;break}}if(e==null){if(y==null)return document.createTextNode(w);e=document.createElementNS(o,y,w.is&&w),s&&(Xt.__m&&Xt.__m(t,r),s=!1),r=null}if(y==null)m===w||s&&e.data==w||(e.data=w);else{if(r=y=="textarea"&&w.defaultValue!=null?null:r&&Nu.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 w||l=="value"&&"defaultValue"in w||l=="checked"&&"defaultChecked"in w||Uu(e,l,null,d,o);for(l in w)d=w[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?g=d:l=="checked"?h=d:s&&typeof d!="function"||m[l]===d||Uu(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=""),X_(t.type=="template"?e.content:e,Hu(f)?f:[f],t,n,i,y=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&Yr(n,0),s,c),r!=null)for(l=r.length;l--;)Yh(r[l]);s&&y!="textarea"||(l="value",y=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||y=="progress"&&!g||y=="option"&&g!=m[l])&&Uu(e,l,g,m[l],o),l="checked",h!=null&&h!=e[l]&&Uu(e,l,h,m[l],o))}return e}function Xh(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(o){Xt.__e(o,n)}}function i0(e,t,n){var i,o;if(Xt.unmount&&Xt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Xh(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Xt.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&i0(i[o],t,n||typeof e.type!="function");n||Yh(e.__e),e.__c=e.__=e.__e=void 0}function rB(e,t,n){return this.constructor(e,n)}function o0(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Xt.__&&Xt.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],Kh(t,e=t.__k=q_(Gu,null,[e]),o||Fu,Fu,t.namespaceURI,o?null:t.firstChild?Nu.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),t0(r,e,a),e.props.children=null}Nu=ju.slice,Xt={__e:function(e,t,n,i){for(var o,r,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&r.getDerivedStateFromError!=null&&(o.setState(r.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,i||{}),a=o.__d),a)return o.__E=o}catch(s){e=s}throw e}},z_=0,Vu.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=To({},this.state),typeof e=="function"&&(e=e(To({},n),this.props)),e&&To(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),K_(this))},Vu.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),K_(this))},Vu.prototype.render=Gu,fr=[],V_=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,W_=function(e,t){return e.__v.__b-t.__v.__b},Wu.__r=0,Vh=Math.random().toString(8),$u="__d"+Vh,sc="__a"+Vh,U_=/(PointerCapture)$|Capture$/i,Wh=0,Uh=J_(!1),qh=J_(!0);var r0=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,r0(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},a0=new Map;function aB(e){var t=a0.get(this);return t||(t=new Map,a0.set(this,t)),(t=r0(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 Bt=aB.bind(q_),Va,fn,Zh,s0,cc=0,c0=[],xn=Xt,l0=xn.__b,u0=xn.__r,p0=xn.diffed,f0=xn.__c,d0=xn.unmount,h0=xn.__;function qu(e,t){xn.__h&&xn.__h(fn,e,cc||t),cc=0;var n=fn.__H||(fn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Qh(e){return cc=1,sB(m0,e)}function sB(e,t,n){var i=qu(Va++,2);if(i.t=e,!i.__c&&(i.__=[m0(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=fn,!fn.__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};fn.__f=!0;var r=fn.shouldComponentUpdate,a=fn.componentWillUpdate;fn.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)},fn.shouldComponentUpdate=o}return i.__N||i.__}function Yu(e,t){var n=qu(Va++,3);!xn.__s&&tg(n.__H,t)&&(n.__=e,n.u=t,fn.__H.__h.push(n))}function Jh(e,t){var n=qu(Va++,4);!xn.__s&&tg(n.__H,t)&&(n.__=e,n.u=t,fn.__h.push(n))}function Ku(e){return cc=5,ko(function(){return{current:e}},[])}function ko(e,t){var n=qu(Va++,7);return tg(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function lc(e,t){return cc=8,ko(function(){return e},t)}function cB(){for(var e;e=c0.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Xu),t.__h.some(eg),t.__h=[]}catch(n){t.__h=[],xn.__e(n,e.__v)}}}xn.__b=function(e){fn=null,l0&&l0(e)},xn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),h0&&h0(e,t)},xn.__r=function(e){u0&&u0(e),Va=0;var t=(fn=e.__c).__H;t&&(Zh===fn?(t.__h=[],fn.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Xu),t.__h.some(eg),t.__h=[],Va=0)),Zh=fn},xn.diffed=function(e){p0&&p0(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(c0.push(t)!==1&&s0===xn.requestAnimationFrame||((s0=xn.requestAnimationFrame)||lB)(cB)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Zh=fn=null},xn.__c=function(e,t){t.some(function(n){try{n.__h.some(Xu),n.__h=n.__h.filter(function(i){return!i.__||eg(i)})}catch(i){t.some(function(o){o.__h&&(o.__h=[])}),t=[],xn.__e(i,n.__v)}}),f0&&f0(e,t)},xn.unmount=function(e){d0&&d0(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Xu(i)}catch(o){t=o}}),n.__H=void 0,t&&xn.__e(t,n.__v))};var g0=typeof requestAnimationFrame=="function";function lB(e){var t,n=function(){clearTimeout(i),g0&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);g0&&(t=requestAnimationFrame(n))}function Xu(e){var t=fn,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),fn=t}function eg(e){var t=fn;e.__c=e.__(),fn=t}function tg(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function m0(e,t){return typeof t=="function"?t(e):t}function uB(e){const{navigationStack:t,setNavigationStack:n}=e,i=ko(()=>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 Bt`
|
|
12
12
|
<div class="djs-popup-breadcrumbs">
|
|
13
13
|
${o&&Bt`
|
|
14
14
|
<button
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
</span>
|
|
42
42
|
`}
|
|
43
43
|
</div>
|
|
44
|
-
`}function
|
|
44
|
+
`}function y0(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=y0(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Zu(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=y0(e))&&(i&&(i+=" "),i+=t);return i}function pB(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:o,title:r}=e,a=ko(()=>fB(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return Bt`
|
|
45
45
|
<div class="djs-popup-header">
|
|
46
46
|
<h3 class="djs-popup-title" title=${r}>${r}</h3>
|
|
47
47
|
${a.map(l=>Bt`
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
${l.entries.map(u=>Bt`
|
|
51
51
|
<li key=${u.id}>
|
|
52
52
|
<${s(u)?"button":"span"}
|
|
53
|
-
class=${
|
|
53
|
+
class=${dB(u,u===i)}
|
|
54
54
|
onClick=${p=>c(p,u)}
|
|
55
55
|
title=${u.title||u.label}
|
|
56
56
|
data-id=${u.id}
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
</ul>
|
|
71
71
|
`)}
|
|
72
72
|
</div>
|
|
73
|
-
`}function
|
|
73
|
+
`}function fB(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 dB(e,t){return Zu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function v0(e,t){return`${e}-entry-${t.id}`}function hB(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 Bt`
|
|
74
74
|
<li
|
|
75
|
-
class=${
|
|
75
|
+
class=${Zu("entry",{selected:i,disabled:n.disabled})}
|
|
76
76
|
data-id=${n.id}
|
|
77
|
-
id=${
|
|
77
|
+
id=${v0(t,n)}
|
|
78
78
|
role="option"
|
|
79
79
|
aria-selected=${i||void 0}
|
|
80
80
|
aria-haspopup=${n.entries?"true":void 0}
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
>
|
|
89
89
|
<div class="djs-popup-entry-content">
|
|
90
90
|
<span
|
|
91
|
-
class=${
|
|
91
|
+
class=${Zu("djs-popup-entry-name",n.className)}
|
|
92
92
|
>
|
|
93
93
|
${n.imageUrl&&Bt`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&Bt`<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
|
|
134
|
+
`}function gB(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:o,idPrefix:r,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=Ku();Jh(()=>{if(!o||!o.current)return;const h=p.current;if(!h)return;const m=h.querySelector(".selected");m&&mB(m)},[t]);const f=()=>{o.current=!1},d=h=>{o.current||n(h)},g=()=>{o.current||n(null)};return Bt`
|
|
135
135
|
<div
|
|
136
136
|
class="djs-popup-results"
|
|
137
137
|
ref=${p}
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
>
|
|
145
145
|
${i.map(h=>Bt`
|
|
146
146
|
${h.name&&Bt`
|
|
147
|
-
<div key=${h.id} id=${
|
|
147
|
+
<div key=${h.id} id=${b0(r,h)} class="entry-header" title=${h.name}>
|
|
148
148
|
${h.name}
|
|
149
149
|
</div>
|
|
150
150
|
`}
|
|
@@ -152,10 +152,10 @@
|
|
|
152
152
|
class="djs-popup-group"
|
|
153
153
|
data-group=${h.id}
|
|
154
154
|
role="group"
|
|
155
|
-
aria-labelledby=${h.name?
|
|
155
|
+
aria-labelledby=${h.name?b0(r,h):void 0}
|
|
156
156
|
>
|
|
157
157
|
${h.entries.map(m=>Bt`
|
|
158
|
-
<${
|
|
158
|
+
<${hB}
|
|
159
159
|
key=${m.id}
|
|
160
160
|
idPrefix=${r}
|
|
161
161
|
entry=${m}
|
|
@@ -168,11 +168,11 @@
|
|
|
168
168
|
</ul>
|
|
169
169
|
`)}
|
|
170
170
|
</div>
|
|
171
|
-
`}function
|
|
172
|
-
<${
|
|
171
|
+
`}function b0(e,t){return`${e}-group-${t.id}`}function mB(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const yB=new zr("djs-popup");function vB(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]=Qh([]);Yu(()=>{m([])},[f]);const[w,y]=Qh(""),v=w.trim().length>0,x=ko(()=>wB(f),[f]),E=ko(()=>mn(l)?x.length>5:!1,[l,x]),A=ko(()=>{const Y=h.length?h[h.length-1].entries:f;return E?v?p(x.filter(({searchable:Z})=>Z!==!1),w,{keys:["label","search","description"]}).map(({item:Z})=>Z):Y.filter(({rank:Z=0})=>Z>=0):Y},[E,v,x,w,p,h,f]),D=ko(()=>v?A.length?[{id:"default",entries:A}]:[]:_B(A),[A,v]),[P,T]=Qh(A[0]),j=Ku(null),F=Ku(!1),G=ko(()=>yB.next(),[]),Q=`${G}-results`,re=P&&v0(G,P);Yu(()=>{const Y=j.current;Y&&A.includes(Y)?T(Y):T(A[0]),j.current=null},[A]);const J=lc(Y=>{const Z=xB(D);let Se=Z.indexOf(P)+Y;Se<0&&(Se=Z.length-1),Se>=Z.length&&(Se=0),F.current=!0,T(Z[Se])},[D,P]),ye=lc(Y=>{Y>0&&P&&P.entries&&(F.current=!0,m(Z=>[...Z,P])),Y<0&&h.length>0&&(F.current=!0,j.current=h[h.length+Y],m(Z=>Z.slice(0,Y)))},[P,h]),ae=lc((Y,Z,de)=>{if(!(!Z||Z.disabled))return Z.entries?(Y.preventDefault(),ye(1)):n(Y,Z,de)},[n,ye]),xe=lc(Y=>{if(Y.key==="Enter"&&P){const Z=Y.target;return!!Lr(Z,"a, button",!0)||P.disabled?void 0:ae(Y,P)}if(Y.key==="Backspace"){const Z=Y.target;if(!(Of(Z,"input")&&Z.value!==""))return ye(-1),Y.preventDefault()}if(Y.key==="ArrowUp")return J(-1),Y.preventDefault();if(Y.key==="ArrowDown")return J(1),Y.preventDefault();if(Y.key==="ArrowRight")return ye(1),Y.preventDefault();if(Y.key==="ArrowLeft")return ye(-1),Y.preventDefault()},[P,J,ye,ae]),Ee=lc(Y=>{Of(Y.target,"input")&&y(()=>Y.target.value)},[y]);Yu(()=>(d(),()=>{g()}),[]);const U=!v&&h.length>0,ce=(a||o.length>0)&&!U;return Bt`
|
|
172
|
+
<${x0}
|
|
173
173
|
onClose=${t}
|
|
174
174
|
onKeyup=${Ee}
|
|
175
|
-
onKeydown=${
|
|
175
|
+
onKeydown=${xe}
|
|
176
176
|
className=${i}
|
|
177
177
|
position=${r}
|
|
178
178
|
width=${s}
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
navigationStack=${h}
|
|
181
181
|
>
|
|
182
182
|
${ce&&Bt`
|
|
183
|
-
<${
|
|
183
|
+
<${pB}
|
|
184
184
|
headerEntries=${o}
|
|
185
185
|
onSelect=${n}
|
|
186
186
|
selectedEntry=${P}
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
/>
|
|
190
190
|
`}
|
|
191
191
|
${U&&Bt`
|
|
192
|
-
<${
|
|
192
|
+
<${uB}
|
|
193
193
|
navigationStack=${h}
|
|
194
194
|
setNavigationStack=${m}
|
|
195
195
|
/>
|
|
@@ -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=${re||void 0}
|
|
213
213
|
aria-autocomplete="list"
|
|
214
214
|
/>
|
|
@@ -221,14 +221,14 @@
|
|
|
221
221
|
</div>
|
|
222
222
|
`}
|
|
223
223
|
|
|
224
|
-
<${
|
|
224
|
+
<${gB}
|
|
225
225
|
groupedEntries=${D}
|
|
226
226
|
selectedEntry=${P}
|
|
227
227
|
setSelectedEntry=${T}
|
|
228
228
|
keyboardSelection=${F}
|
|
229
229
|
onAction=${ae}
|
|
230
230
|
idPrefix=${G}
|
|
231
|
-
id=${
|
|
231
|
+
id=${Q}
|
|
232
232
|
ariaLabel=${a||"Results"}
|
|
233
233
|
tabIndex=${E?-1:0}
|
|
234
234
|
ariaActivedescendant=${E?void 0:re||void 0}
|
|
@@ -257,11 +257,11 @@
|
|
|
257
257
|
${u&&A.length===0&&Bt`
|
|
258
258
|
<div class="djs-popup-no-results">${_n(u)?u(w):u}</div>
|
|
259
259
|
`}
|
|
260
|
-
</${
|
|
261
|
-
`}function
|
|
260
|
+
</${x0}>
|
|
261
|
+
`}function x0(e){const{onClose:t,onKeydown:n,onKeyup:i,className:o,children:r,navigationStack:a,position:s}=e,c=Ku();return Jh(()=>{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]),Jh(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),Yu(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!Lr(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)}},[]),Bt`
|
|
262
262
|
<div
|
|
263
|
-
class=${
|
|
264
|
-
style=${
|
|
263
|
+
class=${Zu("djs-popup",o)}
|
|
264
|
+
style=${bB(e)}
|
|
265
265
|
onKeydown=${n}
|
|
266
266
|
onKeyup=${i}
|
|
267
267
|
ref=${c}
|
|
@@ -269,8 +269,8 @@
|
|
|
269
269
|
>
|
|
270
270
|
${r}
|
|
271
271
|
</div>
|
|
272
|
-
`}function
|
|
273
|
-
<${
|
|
272
|
+
`}function bB(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:mn(t)?n:void 0,maxWidth:mn(t)?"unset":void 0,"transform-origin":"top left"}}function xB(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function wB(e){const t=[];function n(i){i.forEach(o=>{if(o.entries){n(o.entries);return}t.push(o)})}return n(e),t}function _B(e){const t=[],n=r=>t.find(a=>r.id===a.id),i=r=>!!n(r),o=r=>typeof r=="string"?{id:r}:r;return e.forEach(r=>{const a=r.group?o(r.group):{id:"default"};i(a)?n(a).entries.push(r):t.push({...a,entries:[r]})}),t}var EB="data-id",w0=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],SB=1e3;function Zt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var o=mn(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:o},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",r=>{const a=this.isOpen()&&this._current.target;r.element===a&&this.refresh()})}Zt.$inject=["config.popupMenu","eventBus","canvas","search"],Zt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:o,options:r}=this._current,a=_0(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),l=this._updateScale(this._current.container);o0(Bt`
|
|
273
|
+
<${vB}
|
|
274
274
|
onClose=${f=>this.close(f)}
|
|
275
275
|
onSelect=${(f,d,g)=>this.trigger(f,d,g)}
|
|
276
276
|
position=${c}
|
|
@@ -284,7 +284,7 @@
|
|
|
284
284
|
searchFn=${this._search}
|
|
285
285
|
...${{...r}}
|
|
286
286
|
/>
|
|
287
|
-
`,this._current.container)},Zt.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");var o=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(o===!1)return;this.isOpen()&&this.close();const{entries:r,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:r,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},Zt.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:o}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:o},this._emit("refresh"),this._render()},Zt.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),o=this._getHeaderEntries(e,n),r=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:o,emptyPlaceholder:r,empty:!(Object.keys(i).length||Object.keys(o).length)}},Zt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Zt.prototype.reset=function(){const e=this._current.container;
|
|
287
|
+
`,this._current.container)},Zt.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");var o=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(o===!1)return;this.isOpen()&&this.close();const{entries:r,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:r,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},Zt.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:o}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:o},this._emit("refresh"),this._render()},Zt.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),o=this._getHeaderEntries(e,n),r=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:o,emptyPlaceholder:r,empty:!(Object.keys(i).length||Object.keys(o).length)}},Zt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Zt.prototype.reset=function(){const e=this._current.container;o0(null,e),Qi(e)},Zt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Zt.prototype._onOpened=function(){this._emit("opened")},Zt.prototype._onClosed=function(){this._emit("closed")},Zt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=zt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Zt.prototype._bindAutoClose=function(){this._eventBus.once(w0,this.close,this)},Zt.prototype._unbindAutoClose=function(){this._eventBus.off(w0,this.close,this)},Zt.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,o=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),mn(n)&&e<n&&(o=n),mn(i)&&e>i&&(o=i)),o},Zt.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),o={},r=t.x,a=t.y;return t.x+i.width>n.width&&(o.x=!0),t.y+i.height>n.height&&(o.y=!0),o.x&&o.y?(r=t.x-i.width,a=t.y-i.height):o.x?(r=t.x-i.width,a=t.y):o.y&&t.y<i.height?(r=t.x,a=10):o.y&&(r=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:r,y:a}},Zt.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length?!0:this._getContext(e,t).empty},Zt.prototype.registerProvider=function(e,t,n){n||(n=t,t=SB),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Zt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Zt.prototype._getEntries=function(e,t){var n={};return W(t,function(i){if(!i.getPopupMenuEntries){W(i.getEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=Ki(r,["id"])});return}var o=i.getPopupMenuEntries(e);_n(o)?n=o(n):W(o,function(r,a){n[a]=r})}),n},Zt.prototype._getHeaderEntries=function(e,t){var n={};return W(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;W(i.getHeaderEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=Ki(r,["id"])});return}var o=i.getPopupMenuHeaderEntries(e);_n(o)?n=o(n):W(o,function(r,a){n[a]=r})}),n},Zt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>_n(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Zt.prototype.isOpen=function(){return!!this._current},Zt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let o=Lr(e.delegateTarget||e.target,".entry",!0),r=Mn(o,EB);t={id:r,...this._getEntry(r)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(_n(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Zt.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};function _0(e,t=[]){return Object.entries(e).map(([n,i])=>{const o={id:n,...i};return o.entries?o.entries=_0(o.entries,[...t,...E0(o.search)]):t.length&&(o.search=[...t,...E0(o.search)]),o})}function E0(e){return e?Ye(e)?e:[e]:[]}function RB(e,t,n){const{keys:i}=n;if(t=t.trim().toLowerCase(),!t)throw new Error("<pattern> must not be empty");const o=t.trim().toLowerCase().split(/\s+/);return e.flatMap(r=>{const a=CB(r,o,i);return a?{item:r,tokens:a}:[]}).sort(MB(i))}function CB(e,t,n){const{matchedWords:i,tokens:o}=n.reduce((r,a)=>{const s=e[a],{tokens:c,matchedWords:l}=Ye(s)?s.reduce((u,p)=>{const{tokens:f,matchedWords:d}=A0(p,t);return{tokens:[...u.tokens,f],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):A0(s,t);return{tokens:{...r.tokens,[a]:c},matchedWords:{...r.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:o}function MB(e){return(t,n)=>{let i=0,o=1;for(const r of e){const a=AB(t.tokens[r],n.tokens[r]);if(a!==0){i+=a*o,o*=S0;continue}const s=PB(t.item[r],n.item[r]);if(s!==0){i+=s*o,o*=S0;continue}}return i}}function AB(e,t){return R0(t)-R0(e)}const S0=.5,Wa={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function R0(e){const t=e.reduce((s,c)=>s+C0(c),0),n=e.flat(),i=n.reduce((s,c)=>s+c.value.length,0),o=n.reduce((s,c)=>s+(c.match?c.value.length:0),0),r=i?o/i:0;return t*(1+r)}function C0(e){if(Ye(e))return Math.max(...e.map(C0));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Wa.FULL:e.wordEnd?Wa.START_FULL_WORD:Wa.START_WORD_PART:e.wordStart?Wa.WORD_START:Wa.WORD_PART)*t:Wa.NO_MATCH*t}function M0(e=""){return Ye(e)?e.join(", "):e}function PB(e,t){return M0(e).localeCompare(M0(t))}function A0(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},o=t.map(TB),r=[`(?<all>${o.join("\\s+")})`,...o].join("|"),a=new RegExp(r,"ig");let s,c=0;for(;s=a.exec(e);){const[u]=s,p=s.index,f=s.index+u.length,d=p===0,g=f===e.length,h=!!((l=s.groups)!=null&&l.all),m=d||/\s/.test(e.charAt(p-1)),w=g||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:u,index:s.index,match:!0,wordStart:m,wordEnd:w,start:d,end:g,all:h});const y=h?t:[u];for(const v of y)i[v.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function TB(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const P0={search:["value",RB]},ng={__depends__:[P0],__init__:["popupMenu"],popupMenu:["type",Zt]};var T0={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
|
|
288
288
|
<line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
|
|
289
289
|
<rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
290
290
|
<rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
@@ -312,8 +312,8 @@
|
|
|
312
312
|
<line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
|
|
313
313
|
<rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
314
314
|
<rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
315
|
-
</svg>`},AB=900;function Wa(e,t,n,i){e.registerProvider(AB,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Wa.$inject=["contextPad","popupMenu","translate","canvas"],Wa.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&q(t,this._getEntries(e)),t},Wa.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Wa.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${A0.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);q(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Wa.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 PB=["left","center","right","top","middle","bottom"];function cc(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}cc.$inject=["popupMenu","alignElements","translate","rules"],cc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&q(t,this._getEntries(e)),t},cc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},cc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return W(PB,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:A0[r],action:function(){t.trigger(e,r),i.close()}}}),o};function Ku(e){Ci.call(this,e)}Ku.$inject=["eventBus"],De(Ku,Ci),Ku.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=ct(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=dl(n),n.length<2?!1:n})};const TB={__depends__:[HI,F_,tg],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Wa],alignElementsMenuProvider:["type",cc],bpmnAlignElements:["type",Ku]};function Ua(e,t,n){this._canvas=n,this._opts=q({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()})}Ua.$inject=["config.autoScroll","eventBus","canvas"],Ua.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++)kB(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 kB(e,t,n){return t<e&&e<n}Ua.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Ua.prototype.setOptions=function(e){this._opts=q({},this._opts,e)},Ua.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Br(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const OB={__depends__:[Ro],__init__:["autoScroll"],autoScroll:["type",Ua]};var P0="djs-bendpoint",T0="djs-segment-dragger";function DB(e,t){var n=Br(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 ng(e,t,n){var i=DB(e,n),o=md(t,i);return o}function ig(e,t){var n=Ne("g");dt(n).add(P0),Je(e,n);var i=Ne("circle");Pe(i,{cx:0,cy:0,r:4}),dt(i).add("djs-visual"),Je(n,i);var o=Ne("circle");return Pe(o,{cx:0,cy:0,r:10}),dt(o).add("djs-hit"),Je(n,o),t&&dt(n).add(t),n}function LB(e,t,n,i){var o=Ne("g");Je(e,o);var r=18,a=6,s=11,c=BB(t,n,i),l=a+s,u=Ne("rect");Pe(u,{x:-r/2,y:-a/2,width:r,height:a}),dt(u).add("djs-visual"),Je(o,u);var p=Ne("rect");return Pe(p,{x:-c/2,y:-l/2,width:c,height:l}),dt(p).add("djs-hit"),Je(o,p),Hv(o,i==="v"?90:0),o}function k0(e,t,n){var i=Ne("g"),o=Wf(t,n),r=bo(t,n);return Je(e,i),LB(i,t,n,r),dt(i).add(T0),dt(i).add(r==="h"?"horizontal":"vertical"),Dn(i,o.x,o.y),i}function og(e){return Math.abs(Math.round(e*2/3))}function IB(e,t){var n=NB(e,t);return _d(e,n)}function BB(e,t,n){var i=t.x-e.x,o=t.y-e.y;return og(n==="h"?i:o)}function NB(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=Mb(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function O0(e,t,n,i,o){function r(v,x,E){var A=v.index,D=v.point,P,T,j,F,G,Z;return A<=0||v.bendpoint?!1:(P=x[A-1],T=x[A],j=Wf(P,T),F=bo(P,T),G=Math.abs(D.x-j.x),Z=Math.abs(D.y-j.y),F&&G<=E&&Z<=E)}function a(v,x){var E=v.waypoints,A,D,P,T;return x.index<=0||x.bendpoint||(A={start:E[x.index-1],end:E[x.index]},D=bo(A.start,A.end),!D)?null:(D==="h"?P=A.end.x-A.start.x:P=A.end.y-A.start.y,T=og(P)/2,T)}function s(v,x){var E=x.waypoints,A=ng(t,E,v),D;if(A){D=a(x,A);var P;if(r(A,E,D)?P=o.start(v,x,A.index):P=i.start(v,x,A.index,!A.bendpoint),P!==!1)return!0}}function c(v,x,E){je.bind(v,x,function(A){n.triggerMouseEvent(x,A,E),A.stopPropagation()})}function l(v,x){var E=t.getLayer("overlays"),A=At('.djs-bendpoints[data-element-id="'+Gr(v.id)+'"]',E);return!A&&x&&(A=Ne("g"),Pe(A,{"data-element-id":v.id}),dt(A).add("djs-bendpoints"),Je(E,A),c(A,"mousedown",v),c(A,"click",v),c(A,"dblclick",v)),A}function u(v,x){return At('.djs-segment-dragger[data-segment-idx="'+v+'"]',x)}function p(v,x){x.waypoints.forEach(function(E,A){var D=ig(v);Je(v,D),Dn(D,E.x,E.y)}),ig(v,"floating")}function f(v,x){for(var E=x.waypoints,A,D,P,T=1;T<E.length;T++)A=E[T-1],D=E[T],bo(A,D)&&(P=k0(v,A,D),Pe(P,{"data-segment-idx":T}),c(P,"mousemove",x))}function d(v){W(ys("."+P0,v),function(x){cn(x)})}function g(v){W(ys("."+T0,v),function(x){cn(x)})}function h(v){var x=l(v);return x||(x=l(v,!0),p(x,v),f(x,v)),x}function m(v){var x=l(v);x&&(g(x),d(x),f(x,v),p(x,v))}function w(v,x){var E=At(".floating",v),A=x.point;E&&(Dn(E,A.x,A.y),dt(E).add("positioned"))}function y(v,x,E){var A=u(x.index,v),D=E[x.index-1],P=E[x.index],T=x.point,j=Wf(D,P),F=bo(D,P),G,Z;A&&(G=$B(A),Z={x:T.x-j.x,y:T.y-j.y},F==="v"&&(Z={x:Z.y,y:Z.x}),Dn(G,Z.x,Z.y))}e.on("connection.changed",function(v){m(v.element)}),e.on("connection.remove",function(v){var x=l(v.element);x&&cn(x)}),e.on("element.marker.update",function(v){var x=v.element,E;x.waypoints&&(E=h(x),v.add?dt(E).add(v.marker):dt(E).remove(v.marker))}),e.on("element.mousemove",function(v){var x=v.element,E=x.waypoints,A,D;if(E){if(A=l(x,!0),D=ng(t,E,v.originalEvent),!D)return;w(A,D),D.bendpoint||y(A,D,E)}}),e.on("element.mousedown",function(v){if(nr(v)){var x=v.originalEvent,E=v.element;if(E.waypoints)return s(x,E)}}),e.on("selection.changed",function(v){var x=v.newSelection,E=x[0];E&&E.waypoints&&h(E)}),e.on("element.hover",function(v){var x=v.element;x.waypoints&&h(x)}),e.on("element.out",function(v){var x=v.element;if(x.waypoints){var E=l(x);if(E){var A=At(".floating",E);A&&dt(A).remove("positioned")}}}),e.on("element.updateId",function(v){var x=v.element,E=v.newId;if(x.waypoints){var A=l(x);A&&Pe(A,{"data-element-id":E})}}),this.addHandles=h,this.updateHandles=m,this.getBendpointsContainer=l,this.getSegmentDragger=u}O0.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function $B(e){return At(".djs-visual",e)}var D0=Math.round,Ur="reconnectStart",qr="reconnectEnd",lc="updateWaypoints";function rg(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=Ur:!l&&c===d.length-1?g=qr:g=lc;var h=g===lc?"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===lc?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=o.allowed(g,{connection:c,source:f===Ur?p:l,target:f===qr?p:u}),d){s.source=f===Ur?p:l,s.target=f===qr?p:u;return}d===!1&&(d=s.allowed=o.allowed(g,{connection:c,source:f===qr?p:u,target:f===Ur?p:l})),d&&(s.source=f===qr?p:u,s.target=f===Ur?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!==lc&&(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||{},w={x:D0(a.x),y:D0(a.y)};if(!c)return!1;h===lc?(p?f.splice(l,0,w):f[l]=w,m.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),r.updateWaypoints(u,VP(f),m)):(h===Ur?(m.docking="source",Xu(s)&&(m.docking="target",m.newWaypoints=f.reverse())):h===qr&&(m.docking="target",Xu(s)&&(m.docking="source",m.newWaypoints=f.reverse())),r.reconnect(u,d,g,w,m))},this)}rg.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],rg.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 Xu(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===Ur)return t&&i&&t===i&&n!==i;if(o===qr)return t&&n&&t===n&&n!==i}var FB="reconnectStart",jB="reconnectEnd",L0="updateWaypoints",uc="connect-ok",Zu="connect-not-ok",I0="connect-hover",B0="djs-updating",N0="djs-dragging",$0=1100;function F0(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=ig(i.getLayer("overlays"));dt(f).add("djs-dragging"),i.addMarker(c,N0),i.addMarker(c,B0)}),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,I0),l===L0)return;s?(i.removeMarker(c,Zu),i.addMarker(c,uc)):s===!1&&(i.removeMarker(c,uc),i.addMarker(c,Zu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],$0,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,I0),i.removeMarker(s,c?uc: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},w=a.hints||{},y={};o&&(w.connectionStart&&(y.connectionStart=w.connectionStart),w.connectionEnd&&(y.connectionEnd=w.connectionEnd),p===FB?Xu(a)?(y.connectionEnd=y.connectionEnd||m,y.source=g,y.target=u||d,h=h.reverse()):(y.connectionStart=y.connectionStart||m,y.source=u||d,y.target=g):p===jB?Xu(a)?(y.connectionStart=y.connectionStart||m,y.source=u||g,y.target=d,h=h.reverse()):(y.connectionEnd=y.connectionEnd||m,y.source=d,y.target=u||g):(y.noCropping=!0,y.noLayout=!0,h[c]=m),p===L0&&(h=e.cropWaypoints(f,h)),y.waypoints=h,o.drawPreview(a,s,y)),Dn(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],$0,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,cn(c),i.removeMarker(s,B0),i.removeMarker(s,N0),l&&(i.removeMarker(l,uc),i.removeMarker(l,u?uc:Zu)),o&&o.cleanUp(a)})}F0.$inject=["bendpointMove","injector","eventBus","canvas"];var j0="connect-hover",H0="djs-updating";function z0(e,t,n){return ag(e,t,e[t]+n)}function ag(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function HB(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 ag(t,i,s)}function G0(e){return e==="x"?"y":"x"}function V0(e,t,n){var i,o;return e.original?e.original:(i=Xe(t),o=G0(n),ag(e,o,i[o]))}function W0(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,w=d,y=f.waypoints,v=y[m],x=y[w],E=ng(n,y,p),A,D,P;if(A=bo(v,x),!!A)return D=A==="v"?"x":"y",m===0&&(v=V0(v,f.source,D)),w===y.length-1&&(x=V0(x,f.target,D)),E?P=E.point:P={x:(v.x+x.x)/2,y:(v.y+x.y)/2},g={connection:f,segmentStartIndex:m,segmentEndIndex:w,segmentStart:v,segmentEnd:x,axis:D,dragPosition:P},i.init(p,P,"connectionSegment.move",{cursor:D==="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],w=p.segmentEndIndex+f,y=g[w],v=G0(p.axis),x=HB(d,m,y,v);Dn(p.draggerGfx,x.x,x.y)}function u(p,f){var d=0,g=p.filter(function(h,m){return Vf(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=k0(g,f.segmentStart,f.segmentEnd),dt(f.draggerGfx).add("djs-dragging"),n.addMarker(d,H0)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,m=f.segmentStart,w=f.segmentEnd,y=f.axis,v=f.originalWaypoints.slice(),x=z0(m,y,p["d"+y]),E=z0(w,y,p["d"+y]),A=v.length,D=0;v[g]=x,v[h]=E;var P,T;g<2&&(P=On(d.source,x),g===1?P==="intersect"&&(v.shift(),v[0]=x,D--):P!=="intersect"&&(v.unshift(m),D++)),h>A-3&&(T=On(d.target,E),h===A-2?T==="intersect"&&(v.pop(),v[v.length-1]=E):T!=="intersect"&&v.push(w)),f.newWaypoints=d.waypoints=s(d,v),l(f,D,p),f.newSegmentStartIndex=g+D,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,j0)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,j0)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&cn(f.draggerGfx),n.removeMarker(d,H0)}),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),w=m.waypoints,y=s(d,w),v=m.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+v}};r.updateWaypoints(d,y,x)})}W0.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var zB=Math.abs,U0=Math.round;function GB(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],zB(o-e)<=n)return o}function q0(e){return{x:e.x,y:e.y}}function Y0(e){return{x:e.x+e.width,y:e.y+e.height}}function Ti(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:U0(e.x+e.width/2),y:U0(e.y+e.height/2)}}function qa(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function dn(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 K0(e){return e.children||[]}var VB=Math.abs,X0=Math.round,sg=10;function Z0(e){function t(r,a){if(Ye(r)){for(var s=r.length;s--;)if(VB(r[s]-a)<=sg)return r[s]}else{r=+r;var c=a%r;if(c<sg)return a-c;if(c>r-sg)return a-c+r}return a}function n(r,a){if(r.waypoints)return IB(a,r);if(r.width)return{x:X0(r.width/2+r.x),y:X0(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:[]},W(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;q(r,{dx:r.dx-p,dy:r.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&dn(r,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&dn(r,"y",u)}});function o(r){var a=r.snapPoints,s=r.connection.waypoints,c=r.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return r.snapPoints=a={horizontal:[],vertical:[]},W(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(r){var a=r.context,s=a.hover,c=s&&n(s,r);!Lt(s)||!c||!c.x||!c.y||(dn(r,"x",c.x),dn(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;q(r,{dx:r.dx-g,dy:r.dy-h,x:r.x-g,y:r.y-h}),(g||s.vertical.indexOf(u)!==-1)&&dn(r,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&dn(r,"y",d)}})}Z0.$inject=["eventBus"];const WB={__depends__:[Ro,oo],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",O0],bendpointMove:["type",rg],bendpointMovePreview:["type",F0],connectionSegmentMove:["type",W0],bendpointSnapping:["type",Z0]};function Q0(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),!oa(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!oa(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:cg(s)?u:l,connectionEnd:cg(s)?l:u};yn(c)&&(d=c),s.connection=n.connect(p,f,d,g)}),this.start=function(a,s,c,l){yn(c)||(l=c,c=Xe(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}Q0.$inject=["eventBus","dragging","modeling","rules"];function cg(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var UB=1100,qB=900,J0="connect-ok",eE="connect-not-ok";function tE(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;cg(r)&&(g=d,h=f),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",qB,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?J0:eE)}),t.on(["connect.out","connect.cleanup"],UB,function(o){var r=o.hover;r&&(n.removeMarker(r,J0),n.removeMarker(r,eE))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}tE.$inject=["injector","eventBus","canvas"];const lg={__depends__:[Mi,oo,Ro],__init__:["connectPreview"],connect:["type",Q0],connectPreview:["type",tE]};var YB="djs-dragger";function Oo(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)}Oo.$inject=["injector","canvas","graphicsFactory","elementFactory"],Oo.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()),vs(i),o||(o=e.getConnection=KB(function(h,m,w){return g.getConnection(h,m,w)})),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?Xe(r):c,a?Xe(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)"})},Oo.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||Xe(n),r=t.connectionEnd||Xe(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);Je(e,s)},Oo.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&&Rs(r,s,!0)||e,t=i&&Rs(a,s,!1)||t,[e,t]},Oo.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&cn(e.connectionPreviewGfx)},Oo.prototype.getConnection=function(e){var t=XB(e);return this._elementFactory.createConnection(t)},Oo.prototype.createConnectionPreviewGfx=function(){var e=Ne("g");return Pe(e,{pointerEvents:"none"}),dt(e).add(YB),Je(this._canvas.getActiveLayer(),e),e},Oo.prototype.createNoopConnection=function(e,t){return ws([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function KB(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 XB(e){return yn(e)?e:{}}const ZB={__init__:["connectionPreview"],connectionPreview:["type",Oo]},Qu="complex-preview";class nE{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(Qu);n.filter(s=>!QB(s)).forEach(s=>{let c;Lt(s)?(c=this._graphicsFactory._createContainer("connection",Ne("g")),this._graphicsFactory.drawConnection(Xo(c),s)):(c=this._graphicsFactory._createContainer("shape",Ne("g")),this._graphicsFactory.drawShape(Xo(c),s),Dn(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);Lt(s)?Dn(l,c.x,c.y):Dn(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",Ne("g"));this._graphicsFactory.drawShape(Xo(l),s,{width:c.width,height:c.height}),Dn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){vs(this._canvas.getLayer(Qu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Qu)}hide(){this._canvas.hideLayer(Qu)}}nE.$inject=["canvas","graphicsFactory","previewSupport"];function QB(e){return e.hidden}const JB={__depends__:[Ba],__init__:["complexPreview"],complexPreview:["type",nE]},iE=Math.round;function Ju(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}Ju.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(q({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;q(l,{x:u.x-iE(l.width/2),y:u.y-iE(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=>!oa(d))})},Ju.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Ju.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const eN={__depends__:[Eu,JB,Th],__init__:["appendPreview"],appendPreview:["type",Ju]};var oE=Math.min,rE=Math.max;function ug(e){e.preventDefault()}function pc(e){e.stopPropagation()}function tN(e){return e.nodeType===Node.TEXT_NODE}function nN(e){return[].slice.call(e)}function Wi(e){this.container=e.container,this.parent=zt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=At("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Zn(this.autoResize,this),this.handlePaste=Zn(this.handlePaste,this)}Wi.prototype.create=function(e,t,n,i){var o=this,r=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=$i(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);q(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=$i(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return q(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&q(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,je.bind(a,"keydown",this.keyHandler),je.bind(a,"mousedown",pc),je.bind(a,"paste",o.handlePaste),je.bind(a,"focusout",this.focusoutHandler),i.autoResize&&je.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},Wi.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var i;if(e.clipboardData?i=e.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),t.autoResize){var o=this.autoResize(n);o&&this.resizeHandler(o)}},Wi.prototype.insertText=function(e){e=iN(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Wi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=nN(a.childNodes),c,l;if(tN(a)){var u=n.textContent;n.textContent=u.substring(0,o)+e+u.substring(r),c=n,l=o+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[o]),c=p,l=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(g,h){h===f?g.textContent=n.textContent.substring(0,o)+e+i.textContent.substring(r):h>f&&h<=d&&Qi(g)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Wi.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),o=t.scrollHeight;e.style.height=o+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:o-i.height})}},Wi.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,o=parseInt(this.style.minHeight)||0,r=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=zt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(g){ug(g),pc(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,je.bind(document,"mousemove",f),je.bind(document,"mouseup",d)},f=function(g){ug(g),pc(g);var h=oE(rE(l+g.clientX-s,i),r),m=oE(rE(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){ug(g),pc(g),je.unbind(document,"mousemove",f,!1),je.unbind(document,"mouseup",d,!1)};je.bind(n,"mousedown",p)}q(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Wi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),je.unbind(t,"keydown",this.keyHandler),je.unbind(t,"mousedown",pc),je.unbind(t,"input",this.autoResize),je.unbind(t,"paste",this.handlePaste),je.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Qi(n)),Qi(e)},Wi.prototype.getValue=function(){return this.content.innerText.trim()},Wi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Wi.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};function iN(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
-
`)}function ui(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Wi({container:t.getContainer(),keyHandler:Zn(this._handleKey,this),resizeHandler:Zn(this._handleResize,this),focusoutHandler:Zn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}ui.$inject=["eventBus","canvas"],ui.prototype.registerProvider=function(e){this._providers.push(e)},ui.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},ui.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},ui.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},ui.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},ui.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},ui.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()}},ui.prototype.getValue=function(){return this._textbox.getValue()},ui.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()},ui.prototype._handleResize=function(e){this._fire("resize",e)},ui.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},ui.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=$t(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 aE={__depends__:[Jl],__init__:["directEditing"],directEditing:["type",ui]};function oN(e){return function(t){var n=t.target,i=be(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===ht(e);return!r||!a||!s||!c}}const rN={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 me(e,t={}){var n=rN[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var aN=[me("none-start-event",{actionName:"replace-with-none-start"}),me("none-intermediate-throwing"),me("none-end-event",{actionName:"replace-with-none-end"}),me("message-start"),me("timer-start"),me("conditional-start"),me("signal-start")],sN=[me("none-start-event",{actionName:"replace-with-none-start"}),me("none-intermediate-throwing"),me("none-end-event",{actionName:"replace-with-none-end"})],cN=[me("none-start-event",{actionName:"replace-with-none-start"}),me("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),me("none-end-event",{actionName:"replace-with-none-end"}),me("message-intermediate-catch"),me("message-intermediate-throw"),me("timer-intermediate-catch"),me("escalation-intermediate-throw"),me("conditional-intermediate-catch"),me("link-intermediate-catch"),me("link-intermediate-throw"),me("compensation-intermediate-throw"),me("signal-intermediate-catch"),me("signal-intermediate-throw")],lN=[me("none-start-event",{actionName:"replace-with-none-start"}),me("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),me("none-end-event",{actionName:"replace-with-none-end"}),me("message-end"),me("escalation-end"),me("error-end"),me("cancel-end"),me("compensation-end"),me("signal-end"),me("terminate-end")],uN=[me("exclusive-gateway"),me("parallel-gateway"),me("inclusive-gateway"),me("complex-gateway"),me("event-based-gateway")],pN=[me("transaction"),me("event-subprocess"),me("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),me("collapsed-subprocess")],fN=[me("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),me("transaction"),me("event-subprocess"),me("collapsed-ad-hoc-subprocess")],sE=[me("transaction"),me("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),me("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),me("event-subprocess")],dN=sE,cE=[me("task"),me("user-task"),me("service-task"),me("send-task"),me("receive-task"),me("manual-task"),me("rule-task"),me("script-task"),me("call-activity"),me("collapsed-subprocess"),me("expanded-subprocess"),me("collapsed-ad-hoc-subprocess"),me("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],hN=[me("data-store-reference")],gN=[me("data-object-reference")],mN=[me("message-boundary"),me("timer-boundary"),me("escalation-boundary"),me("conditional-boundary"),me("error-boundary"),me("cancel-boundary"),me("signal-boundary"),me("compensation-boundary"),me("non-interrupting-message-boundary"),me("non-interrupting-timer-boundary"),me("non-interrupting-escalation-boundary"),me("non-interrupting-conditional-boundary"),me("non-interrupting-signal-boundary")],yN=[me("message-start"),me("timer-start"),me("conditional-start"),me("signal-start"),me("error-start"),me("escalation-start"),me("compensation-start"),me("non-interrupting-message-start"),me("non-interrupting-timer-start"),me("non-interrupting-conditional-start"),me("non-interrupting-signal-start"),me("non-interrupting-escalation-start")],vN=[{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"}],bN=[me("expanded-pool"),me("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],xN={"bpmn:MessageEventDefinition":[me("message-start"),me("message-intermediate-catch"),me("message-intermediate-throw"),me("message-end")],"bpmn:TimerEventDefinition":[me("timer-start"),me("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[me("conditional-start"),me("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[me("signal-start"),me("signal-intermediate-catch"),me("signal-intermediate-throw"),me("signal-end")],"bpmn:ErrorEventDefinition":[me("error-start"),me("error-end")],"bpmn:EscalationEventDefinition":[me("escalation-start"),me("escalation-intermediate-throw"),me("escalation-end")],"bpmn:CompensateEventDefinition":[me("compensation-start"),me("compensation-intermediate-throw"),me("compensation-end")]};const lE={"start-event-non-interrupting":`
|
|
315
|
+
</svg>`},kB=900;function Ua(e,t,n,i){e.registerProvider(kB,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Ua.$inject=["contextPad","popupMenu","translate","canvas"],Ua.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&q(t,this._getEntries(e)),t},Ua.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Ua.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${T0.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);q(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Ua.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 OB=["left","center","right","top","middle","bottom"];function uc(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}uc.$inject=["popupMenu","alignElements","translate","rules"],uc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&q(t,this._getEntries(e)),t},uc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},uc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return W(OB,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:T0[r],action:function(){t.trigger(e,r),i.close()}}}),o};function Qu(e){Ci.call(this,e)}Qu.$inject=["eventBus"],De(Qu,Ci),Qu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=ct(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=ml(n),n.length<2?!1:n})};const DB={__depends__:[VI,H_,ng],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Ua],alignElementsMenuProvider:["type",uc],bpmnAlignElements:["type",Qu]};function qa(e,t,n){this._canvas=n,this._opts=q({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()})}qa.$inject=["config.autoScroll","eventBus","canvas"],qa.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++)LB(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 LB(e,t,n){return t<e&&e<n}qa.prototype.stopScroll=function(){clearTimeout(this._scrolling)},qa.prototype.setOptions=function(e){this._opts=q({},this._opts,e)},qa.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Fr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const IB={__depends__:[Ro],__init__:["autoScroll"],autoScroll:["type",qa]};var k0="djs-bendpoint",O0="djs-segment-dragger";function BB(e,t){var n=Fr(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 ig(e,t,n){var i=BB(e,n),o=yd(t,i);return o}function og(e,t){var n=Ne("g");dt(n).add(k0),Je(e,n);var i=Ne("circle");Pe(i,{cx:0,cy:0,r:4}),dt(i).add("djs-visual"),Je(n,i);var o=Ne("circle");return Pe(o,{cx:0,cy:0,r:10}),dt(o).add("djs-hit"),Je(n,o),t&&dt(n).add(t),n}function NB(e,t,n,i){var o=Ne("g");Je(e,o);var r=18,a=6,s=11,c=FB(t,n,i),l=a+s,u=Ne("rect");Pe(u,{x:-r/2,y:-a/2,width:r,height:a}),dt(u).add("djs-visual"),Je(o,u);var p=Ne("rect");return Pe(p,{x:-c/2,y:-l/2,width:c,height:l}),dt(p).add("djs-hit"),Je(o,p),Gv(o,i==="v"?90:0),o}function D0(e,t,n){var i=Ne("g"),o=Uf(t,n),r=bo(t,n);return Je(e,i),NB(i,t,n,r),dt(i).add(O0),dt(i).add(r==="h"?"horizontal":"vertical"),Dn(i,o.x,o.y),i}function rg(e){return Math.abs(Math.round(e*2/3))}function $B(e,t){var n=jB(e,t);return Ed(e,n)}function FB(e,t,n){var i=t.x-e.x,o=t.y-e.y;return rg(n==="h"?i:o)}function jB(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=Pb(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function L0(e,t,n,i,o){function r(v,x,E){var A=v.index,D=v.point,P,T,j,F,G,Q;return A<=0||v.bendpoint?!1:(P=x[A-1],T=x[A],j=Uf(P,T),F=bo(P,T),G=Math.abs(D.x-j.x),Q=Math.abs(D.y-j.y),F&&G<=E&&Q<=E)}function a(v,x){var E=v.waypoints,A,D,P,T;return x.index<=0||x.bendpoint||(A={start:E[x.index-1],end:E[x.index]},D=bo(A.start,A.end),!D)?null:(D==="h"?P=A.end.x-A.start.x:P=A.end.y-A.start.y,T=rg(P)/2,T)}function s(v,x){var E=x.waypoints,A=ig(t,E,v),D;if(A){D=a(x,A);var P;if(r(A,E,D)?P=o.start(v,x,A.index):P=i.start(v,x,A.index,!A.bendpoint),P!==!1)return!0}}function c(v,x,E){je.bind(v,x,function(A){n.triggerMouseEvent(x,A,E),A.stopPropagation()})}function l(v,x){var E=t.getLayer("overlays"),A=At('.djs-bendpoints[data-element-id="'+Ur(v.id)+'"]',E);return!A&&x&&(A=Ne("g"),Pe(A,{"data-element-id":v.id}),dt(A).add("djs-bendpoints"),Je(E,A),c(A,"mousedown",v),c(A,"click",v),c(A,"dblclick",v)),A}function u(v,x){return At('.djs-segment-dragger[data-segment-idx="'+v+'"]',x)}function p(v,x){x.waypoints.forEach(function(E,A){var D=og(v);Je(v,D),Dn(D,E.x,E.y)}),og(v,"floating")}function f(v,x){for(var E=x.waypoints,A,D,P,T=1;T<E.length;T++)A=E[T-1],D=E[T],bo(A,D)&&(P=D0(v,A,D),Pe(P,{"data-segment-idx":T}),c(P,"mousemove",x))}function d(v){W(bs("."+k0,v),function(x){cn(x)})}function g(v){W(bs("."+O0,v),function(x){cn(x)})}function h(v){var x=l(v);return x||(x=l(v,!0),p(x,v),f(x,v)),x}function m(v){var x=l(v);x&&(g(x),d(x),f(x,v),p(x,v))}function w(v,x){var E=At(".floating",v),A=x.point;E&&(Dn(E,A.x,A.y),dt(E).add("positioned"))}function y(v,x,E){var A=u(x.index,v),D=E[x.index-1],P=E[x.index],T=x.point,j=Uf(D,P),F=bo(D,P),G,Q;A&&(G=HB(A),Q={x:T.x-j.x,y:T.y-j.y},F==="v"&&(Q={x:Q.y,y:Q.x}),Dn(G,Q.x,Q.y))}e.on("connection.changed",function(v){m(v.element)}),e.on("connection.remove",function(v){var x=l(v.element);x&&cn(x)}),e.on("element.marker.update",function(v){var x=v.element,E;x.waypoints&&(E=h(x),v.add?dt(E).add(v.marker):dt(E).remove(v.marker))}),e.on("element.mousemove",function(v){var x=v.element,E=x.waypoints,A,D;if(E){if(A=l(x,!0),D=ig(t,E,v.originalEvent),!D)return;w(A,D),D.bendpoint||y(A,D,E)}}),e.on("element.mousedown",function(v){if(nr(v)){var x=v.originalEvent,E=v.element;if(E.waypoints)return s(x,E)}}),e.on("selection.changed",function(v){var x=v.newSelection,E=x[0];E&&E.waypoints&&h(E)}),e.on("element.hover",function(v){var x=v.element;x.waypoints&&h(x)}),e.on("element.out",function(v){var x=v.element;if(x.waypoints){var E=l(x);if(E){var A=At(".floating",E);A&&dt(A).remove("positioned")}}}),e.on("element.updateId",function(v){var x=v.element,E=v.newId;if(x.waypoints){var A=l(x);A&&Pe(A,{"data-element-id":E})}}),this.addHandles=h,this.updateHandles=m,this.getBendpointsContainer=l,this.getSegmentDragger=u}L0.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function HB(e){return At(".djs-visual",e)}var I0=Math.round,Kr="reconnectStart",Xr="reconnectEnd",pc="updateWaypoints";function ag(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=Kr:!l&&c===d.length-1?g=Xr:g=pc;var h=g===pc?"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===pc?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=o.allowed(g,{connection:c,source:f===Kr?p:l,target:f===Xr?p:u}),d){s.source=f===Kr?p:l,s.target=f===Xr?p:u;return}d===!1&&(d=s.allowed=o.allowed(g,{connection:c,source:f===Xr?p:u,target:f===Kr?p:l})),d&&(s.source=f===Xr?p:u,s.target=f===Kr?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!==pc&&(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||{},w={x:I0(a.x),y:I0(a.y)};if(!c)return!1;h===pc?(p?f.splice(l,0,w):f[l]=w,m.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),r.updateWaypoints(u,qP(f),m)):(h===Kr?(m.docking="source",Ju(s)&&(m.docking="target",m.newWaypoints=f.reverse())):h===Xr&&(m.docking="target",Ju(s)&&(m.docking="source",m.newWaypoints=f.reverse())),r.reconnect(u,d,g,w,m))},this)}ag.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],ag.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 Ju(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===Kr)return t&&i&&t===i&&n!==i;if(o===Xr)return t&&n&&t===n&&n!==i}var zB="reconnectStart",GB="reconnectEnd",B0="updateWaypoints",fc="connect-ok",ep="connect-not-ok",N0="connect-hover",$0="djs-updating",F0="djs-dragging",j0=1100;function H0(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=og(i.getLayer("overlays"));dt(f).add("djs-dragging"),i.addMarker(c,F0),i.addMarker(c,$0)}),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,N0),l===B0)return;s?(i.removeMarker(c,ep),i.addMarker(c,fc)):s===!1&&(i.removeMarker(c,fc),i.addMarker(c,ep))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],j0,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,N0),i.removeMarker(s,c?fc:ep))}),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},w=a.hints||{},y={};o&&(w.connectionStart&&(y.connectionStart=w.connectionStart),w.connectionEnd&&(y.connectionEnd=w.connectionEnd),p===zB?Ju(a)?(y.connectionEnd=y.connectionEnd||m,y.source=g,y.target=u||d,h=h.reverse()):(y.connectionStart=y.connectionStart||m,y.source=u||d,y.target=g):p===GB?Ju(a)?(y.connectionStart=y.connectionStart||m,y.source=u||g,y.target=d,h=h.reverse()):(y.connectionEnd=y.connectionEnd||m,y.source=d,y.target=u||g):(y.noCropping=!0,y.noLayout=!0,h[c]=m),p===B0&&(h=e.cropWaypoints(f,h)),y.waypoints=h,o.drawPreview(a,s,y)),Dn(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],j0,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,cn(c),i.removeMarker(s,$0),i.removeMarker(s,F0),l&&(i.removeMarker(l,fc),i.removeMarker(l,u?fc:ep)),o&&o.cleanUp(a)})}H0.$inject=["bendpointMove","injector","eventBus","canvas"];var z0="connect-hover",G0="djs-updating";function V0(e,t,n){return sg(e,t,e[t]+n)}function sg(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function VB(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 sg(t,i,s)}function W0(e){return e==="x"?"y":"x"}function U0(e,t,n){var i,o;return e.original?e.original:(i=Xe(t),o=W0(n),sg(e,o,i[o]))}function q0(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,w=d,y=f.waypoints,v=y[m],x=y[w],E=ig(n,y,p),A,D,P;if(A=bo(v,x),!!A)return D=A==="v"?"x":"y",m===0&&(v=U0(v,f.source,D)),w===y.length-1&&(x=U0(x,f.target,D)),E?P=E.point:P={x:(v.x+x.x)/2,y:(v.y+x.y)/2},g={connection:f,segmentStartIndex:m,segmentEndIndex:w,segmentStart:v,segmentEnd:x,axis:D,dragPosition:P},i.init(p,P,"connectionSegment.move",{cursor:D==="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],w=p.segmentEndIndex+f,y=g[w],v=W0(p.axis),x=VB(d,m,y,v);Dn(p.draggerGfx,x.x,x.y)}function u(p,f){var d=0,g=p.filter(function(h,m){return Wf(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=D0(g,f.segmentStart,f.segmentEnd),dt(f.draggerGfx).add("djs-dragging"),n.addMarker(d,G0)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,m=f.segmentStart,w=f.segmentEnd,y=f.axis,v=f.originalWaypoints.slice(),x=V0(m,y,p["d"+y]),E=V0(w,y,p["d"+y]),A=v.length,D=0;v[g]=x,v[h]=E;var P,T;g<2&&(P=On(d.source,x),g===1?P==="intersect"&&(v.shift(),v[0]=x,D--):P!=="intersect"&&(v.unshift(m),D++)),h>A-3&&(T=On(d.target,E),h===A-2?T==="intersect"&&(v.pop(),v[v.length-1]=E):T!=="intersect"&&v.push(w)),f.newWaypoints=d.waypoints=s(d,v),l(f,D,p),f.newSegmentStartIndex=g+D,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,z0)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,z0)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&cn(f.draggerGfx),n.removeMarker(d,G0)}),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),w=m.waypoints,y=s(d,w),v=m.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+v}};r.updateWaypoints(d,y,x)})}q0.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var WB=Math.abs,Y0=Math.round;function UB(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],WB(o-e)<=n)return o}function K0(e){return{x:e.x,y:e.y}}function X0(e){return{x:e.x+e.width,y:e.y+e.height}}function Ti(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Y0(e.x+e.width/2),y:Y0(e.y+e.height/2)}}function Ya(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function dn(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 Z0(e){return e.children||[]}var qB=Math.abs,Q0=Math.round,cg=10;function J0(e){function t(r,a){if(Ye(r)){for(var s=r.length;s--;)if(qB(r[s]-a)<=cg)return r[s]}else{r=+r;var c=a%r;if(c<cg)return a-c;if(c>r-cg)return a-c+r}return a}function n(r,a){if(r.waypoints)return $B(a,r);if(r.width)return{x:Q0(r.width/2+r.x),y:Q0(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:[]},W(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;q(r,{dx:r.dx-p,dy:r.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&dn(r,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&dn(r,"y",u)}});function o(r){var a=r.snapPoints,s=r.connection.waypoints,c=r.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return r.snapPoints=a={horizontal:[],vertical:[]},W(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(r){var a=r.context,s=a.hover,c=s&&n(s,r);!Lt(s)||!c||!c.x||!c.y||(dn(r,"x",c.x),dn(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;q(r,{dx:r.dx-g,dy:r.dy-h,x:r.x-g,y:r.y-h}),(g||s.vertical.indexOf(u)!==-1)&&dn(r,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&dn(r,"y",d)}})}J0.$inject=["eventBus"];const YB={__depends__:[Ro,oo],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",L0],bendpointMove:["type",ag],bendpointMovePreview:["type",H0],connectionSegmentMove:["type",q0],bendpointSnapping:["type",J0]};function eE(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),!ra(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!ra(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:lg(s)?u:l,connectionEnd:lg(s)?l:u};yn(c)&&(d=c),s.connection=n.connect(p,f,d,g)}),this.start=function(a,s,c,l){yn(c)||(l=c,c=Xe(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}eE.$inject=["eventBus","dragging","modeling","rules"];function lg(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var KB=1100,XB=900,tE="connect-ok",nE="connect-not-ok";function iE(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;lg(r)&&(g=d,h=f),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",XB,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?tE:nE)}),t.on(["connect.out","connect.cleanup"],KB,function(o){var r=o.hover;r&&(n.removeMarker(r,tE),n.removeMarker(r,nE))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}iE.$inject=["injector","eventBus","canvas"];const ug={__depends__:[Mi,oo,Ro],__init__:["connectPreview"],connect:["type",eE],connectPreview:["type",iE]};var ZB="djs-dragger";function Oo(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)}Oo.$inject=["injector","canvas","graphicsFactory","elementFactory"],Oo.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()),xs(i),o||(o=e.getConnection=QB(function(h,m,w){return g.getConnection(h,m,w)})),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?Xe(r):c,a?Xe(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)"})},Oo.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||Xe(n),r=t.connectionEnd||Xe(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);Je(e,s)},Oo.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&&Ms(r,s,!0)||e,t=i&&Ms(a,s,!1)||t,[e,t]},Oo.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&cn(e.connectionPreviewGfx)},Oo.prototype.getConnection=function(e){var t=JB(e);return this._elementFactory.createConnection(t)},Oo.prototype.createConnectionPreviewGfx=function(){var e=Ne("g");return Pe(e,{pointerEvents:"none"}),dt(e).add(ZB),Je(this._canvas.getActiveLayer(),e),e},Oo.prototype.createNoopConnection=function(e,t){return Es([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function QB(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 JB(e){return yn(e)?e:{}}const eN={__init__:["connectionPreview"],connectionPreview:["type",Oo]},tp="complex-preview";class oE{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(tp);n.filter(s=>!tN(s)).forEach(s=>{let c;Lt(s)?(c=this._graphicsFactory._createContainer("connection",Ne("g")),this._graphicsFactory.drawConnection(Xo(c),s)):(c=this._graphicsFactory._createContainer("shape",Ne("g")),this._graphicsFactory.drawShape(Xo(c),s),Dn(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);Lt(s)?Dn(l,c.x,c.y):Dn(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",Ne("g"));this._graphicsFactory.drawShape(Xo(l),s,{width:c.width,height:c.height}),Dn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){xs(this._canvas.getLayer(tp)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(tp)}hide(){this._canvas.hideLayer(tp)}}oE.$inject=["canvas","graphicsFactory","previewSupport"];function tN(e){return e.hidden}const nN={__depends__:[Na],__init__:["complexPreview"],complexPreview:["type",oE]},rE=Math.round;function np(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}np.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(q({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;q(l,{x:u.x-rE(l.width/2),y:u.y-rE(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=>!ra(d))})},np.prototype.cleanUp=function(){this._complexPreview.cleanUp()},np.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const iN={__depends__:[Cu,nN,kh],__init__:["appendPreview"],appendPreview:["type",np]};var aE=Math.min,sE=Math.max;function pg(e){e.preventDefault()}function dc(e){e.stopPropagation()}function oN(e){return e.nodeType===Node.TEXT_NODE}function rN(e){return[].slice.call(e)}function Wi(e){this.container=e.container,this.parent=zt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=At("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Zn(this.autoResize,this),this.handlePaste=Zn(this.handlePaste,this)}Wi.prototype.create=function(e,t,n,i){var o=this,r=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=$i(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);q(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=$i(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return q(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&q(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,je.bind(a,"keydown",this.keyHandler),je.bind(a,"mousedown",dc),je.bind(a,"paste",o.handlePaste),je.bind(a,"focusout",this.focusoutHandler),i.autoResize&&je.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},Wi.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var i;if(e.clipboardData?i=e.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),t.autoResize){var o=this.autoResize(n);o&&this.resizeHandler(o)}},Wi.prototype.insertText=function(e){e=aN(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Wi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=rN(a.childNodes),c,l;if(oN(a)){var u=n.textContent;n.textContent=u.substring(0,o)+e+u.substring(r),c=n,l=o+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[o]),c=p,l=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(g,h){h===f?g.textContent=n.textContent.substring(0,o)+e+i.textContent.substring(r):h>f&&h<=d&&Qi(g)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Wi.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),o=t.scrollHeight;e.style.height=o+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:o-i.height})}},Wi.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,o=parseInt(this.style.minHeight)||0,r=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=zt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(g){pg(g),dc(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,je.bind(document,"mousemove",f),je.bind(document,"mouseup",d)},f=function(g){pg(g),dc(g);var h=aE(sE(l+g.clientX-s,i),r),m=aE(sE(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){pg(g),dc(g),je.unbind(document,"mousemove",f,!1),je.unbind(document,"mouseup",d,!1)};je.bind(n,"mousedown",p)}q(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Wi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),je.unbind(t,"keydown",this.keyHandler),je.unbind(t,"mousedown",dc),je.unbind(t,"input",this.autoResize),je.unbind(t,"paste",this.handlePaste),je.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Qi(n)),Qi(e)},Wi.prototype.getValue=function(){return this.content.innerText.trim()},Wi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Wi.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};function aN(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
+
`)}function ui(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Wi({container:t.getContainer(),keyHandler:Zn(this._handleKey,this),resizeHandler:Zn(this._handleResize,this),focusoutHandler:Zn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}ui.$inject=["eventBus","canvas"],ui.prototype.registerProvider=function(e){this._providers.push(e)},ui.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},ui.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},ui.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},ui.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},ui.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},ui.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()}},ui.prototype.getValue=function(){return this._textbox.getValue()},ui.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()},ui.prototype._handleResize=function(e){this._fire("resize",e)},ui.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},ui.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=$t(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 cE={__depends__:[nu],__init__:["directEditing"],directEditing:["type",ui]};function sN(e){return function(t){var n=t.target,i=be(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===ht(e);return!r||!a||!s||!c}}const cN={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 me(e,t={}){var n=cN[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var lN=[me("none-start-event",{actionName:"replace-with-none-start"}),me("none-intermediate-throwing"),me("none-end-event",{actionName:"replace-with-none-end"}),me("message-start"),me("timer-start"),me("conditional-start"),me("signal-start")],uN=[me("none-start-event",{actionName:"replace-with-none-start"}),me("none-intermediate-throwing"),me("none-end-event",{actionName:"replace-with-none-end"})],pN=[me("none-start-event",{actionName:"replace-with-none-start"}),me("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),me("none-end-event",{actionName:"replace-with-none-end"}),me("message-intermediate-catch"),me("message-intermediate-throw"),me("timer-intermediate-catch"),me("escalation-intermediate-throw"),me("conditional-intermediate-catch"),me("link-intermediate-catch"),me("link-intermediate-throw"),me("compensation-intermediate-throw"),me("signal-intermediate-catch"),me("signal-intermediate-throw")],fN=[me("none-start-event",{actionName:"replace-with-none-start"}),me("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),me("none-end-event",{actionName:"replace-with-none-end"}),me("message-end"),me("escalation-end"),me("error-end"),me("cancel-end"),me("compensation-end"),me("signal-end"),me("terminate-end")],dN=[me("exclusive-gateway"),me("parallel-gateway"),me("inclusive-gateway"),me("complex-gateway"),me("event-based-gateway")],hN=[me("transaction"),me("event-subprocess"),me("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),me("collapsed-subprocess")],gN=[me("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),me("transaction"),me("event-subprocess"),me("collapsed-ad-hoc-subprocess")],lE=[me("transaction"),me("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),me("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),me("event-subprocess")],mN=lE,uE=[me("task"),me("user-task"),me("service-task"),me("send-task"),me("receive-task"),me("manual-task"),me("rule-task"),me("script-task"),me("call-activity"),me("collapsed-subprocess"),me("expanded-subprocess"),me("collapsed-ad-hoc-subprocess"),me("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],yN=[me("data-store-reference")],vN=[me("data-object-reference")],bN=[me("message-boundary"),me("timer-boundary"),me("escalation-boundary"),me("conditional-boundary"),me("error-boundary"),me("cancel-boundary"),me("signal-boundary"),me("compensation-boundary"),me("non-interrupting-message-boundary"),me("non-interrupting-timer-boundary"),me("non-interrupting-escalation-boundary"),me("non-interrupting-conditional-boundary"),me("non-interrupting-signal-boundary")],xN=[me("message-start"),me("timer-start"),me("conditional-start"),me("signal-start"),me("error-start"),me("escalation-start"),me("compensation-start"),me("non-interrupting-message-start"),me("non-interrupting-timer-start"),me("non-interrupting-conditional-start"),me("non-interrupting-signal-start"),me("non-interrupting-escalation-start")],wN=[{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"}],_N=[me("expanded-pool"),me("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],EN={"bpmn:MessageEventDefinition":[me("message-start"),me("message-intermediate-catch"),me("message-intermediate-throw"),me("message-end")],"bpmn:TimerEventDefinition":[me("timer-start"),me("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[me("conditional-start"),me("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[me("signal-start"),me("signal-intermediate-catch"),me("signal-intermediate-throw"),me("signal-end")],"bpmn:ErrorEventDefinition":[me("error-start"),me("error-end")],"bpmn:EscalationEventDefinition":[me("escalation-start"),me("escalation-intermediate-throw"),me("escalation-end")],"bpmn:CompensateEventDefinition":[me("compensation-start"),me("compensation-intermediate-throw"),me("compensation-end")]};const pE={"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 ki(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()}ki.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],ki.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},ki.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if(Ye(e)||!n.allowed("shape.replace",{element:e}))return{};var a=oN(e);return M(t,"bpmn:DataObjectReference")?this._createEntries(e,hN):M(t,"bpmn:DataStoreReference")&&!M(e.parent,"bpmn:Collaboration")?this._createEntries(e,gN):(M(t,"bpmn:Event")&&!M(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=xN[o]||[],!Gn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")&&(i=ct(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),M(t,"bpmn:StartEvent")&&!M(t.$parent,"bpmn:SubProcess")?(r=ct(aN.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:Participant")?(r=ct(bN,function(c){return ht(e)!==c.target.isExpanded}),this._createEntries(e,r)):M(t,"bpmn:StartEvent")&&Gn(t.$parent)?(r=ct(yN.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")&&!Gn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")?(r=ct(sN.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:EndEvent")?(r=ct(lN.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=ct(mN,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=ct(cN.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:Gateway")?(r=ct(uN,a),this._createEntries(e,r)):M(t,"bpmn:Transaction")?(r=ct(sE,a),this._createEntries(e,r)):Gn(t)&&ht(e)?(r=ct(dN,a),this._createEntries(e,r)):M(t,"bpmn:AdHocSubProcess")&&ht(e)?(r=ct(fN,a),this._createEntries(e,r)):M(t,"bpmn:SubProcess")&&ht(e)?(r=ct(pN,a),this._createEntries(e,r)):M(t,"bpmn:SubProcess")&&!ht(e)?(r=ct(cE,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,vN):M(t,"bpmn:FlowNode")?(r=ct(cE,a),this._createEntries(e,r)):{})},ki.prototype.getPopupMenuHeaderEntries=function(e){var t={};return M(e,"bpmn:Activity")&&!Gn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),M(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),M(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),zb(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},ki.prototype._createEntries=function(e,t){var n={},i=this;return W(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},ki.prototype._createSequenceFlowEntries=function(e,t){var n=be(e),i={},o=this._modeling,r=this._moddle,a=this;return W(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(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},ki.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}},ki.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=be(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"}}}},ki.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}}},ki.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}}},ki.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=be(e),i=this,o=Gb(e),r=M(e,"bpmn:BoundaryEvent")?lE["intermediate-event-non-interrupting"]:lE["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 wN={__depends__:[tg,lw,Eu],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",ki]};function fc(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(!(!$s(d)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}fc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],fc.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&q(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,o){t.removeElements(o.slice())}}}}),n},fc.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Ye(t)?Bo(e,n=>t.includes(n)):t},fc.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])&&q(u,g()),u;var p=e.businessObject;function f(v,x){o.start(v,x)}function d(v,x){n.removeElements([x])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(v){var x=5,E=t.getPad(v).html,A=E.getBoundingClientRect(),D={x:A.left,y:A.bottom+x};return D}function m(v,x,E,A){function D(j,F){var G=i.createShape(q({type:v},A));r.start(j,G,{source:F})}var P=s?function(j,F){var G=i.createShape(q({type:v},A));s.append(F,G)}:D,T=s?function(j,F){return l.create(F,v,A),()=>{l.cleanUp()}}:null;return{group:"model",className:x,title:E,action:{dragstart:D,click:P,hover:T}}}function w(v){return function(x,E){n.splitLane(E,v),t.open(E,!0)}}if(at(p,["bpmn:Lane","bpmn:Participant"])&&ht(e)){var y=er(e);q(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(v,x){n.addLane(x,"top")}}}}),y.length<2&&((En(e)?e.height>=120:e.width>=120)&&q(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:w(2)}}}),(En(e)?e.height>=180:e.width>=180)&&q(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:w(3)}}})),q(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(v,x){n.addLane(x,"bottom")}}}})}return M(p,"bpmn:FlowNode")&&(M(p,"bpmn:EventBasedGateway")?q(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"})}):uE(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?q(u,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!M(p,"bpmn:EndEvent")&&!p.isForCompensation&&!uE(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Gn(p)&&q(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")||q(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(v,x){var E=q(h(x),{cursor:{x:v.x,y:v.y}});a.open(x,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),M(p,"bpmn:SequenceFlow")&&q(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),M(p,"bpmn:MessageFlow")&&q(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),at(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&q(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")&&q(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),at(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&q(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")&&q(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&q(u,g()),u};function uE(e,t,n){var i=e.$instanceOf(t),o=!1,r=e.eventDefinitions||[];return W(r,function(a){a.$type===n&&(o=!0)}),i&&o}const _N={__depends__:[eN,aE,F_,Mi,lg,tu,wN],__init__:["contextPadProvider"],contextPadProvider:["type",fc]};var EN={horizontal:["x","width"],vertical:["y","height"]},pE=5;function Do(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Ye(i)?i:i?n:[]})}Do.$inject=["modeling","rules"],Do.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Do.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},Do.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(W(t,function(r){o=r(o,n,i)}),o):e},Do.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=Yi(e,i);return W(r,function(a,s){var c=n._findRange(a,i,o),l,u=t[t.length-1];u&&n._hasIntersection(u.range,c)?t[t.length-1].elements.push(a):(l={range:c,elements:[a]},t.push(l))}),t},Do.prototype._setOrientation=function(e){var t=EN[e];this._axis=t[0],this._dimension=t[1]},Do.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)},Do.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+pE,max:t+n-pE}};const SN={__init__:["distributeElements"],distributeElements:["type",Do]};function ep(e){Ci.call(this,e)}ep.$inject=["eventBus"],De(ep,Ci),ep.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=ct(t,function(n){var i=at(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=dl(t),t.length<3?!1:t})};var fE={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
327
|
+
</svg>`};function ki(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()}ki.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],ki.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},ki.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if(Ye(e)||!n.allowed("shape.replace",{element:e}))return{};var a=sN(e);return M(t,"bpmn:DataObjectReference")?this._createEntries(e,yN):M(t,"bpmn:DataStoreReference")&&!M(e.parent,"bpmn:Collaboration")?this._createEntries(e,vN):(M(t,"bpmn:Event")&&!M(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=EN[o]||[],!Gn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")&&(i=ct(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),M(t,"bpmn:StartEvent")&&!M(t.$parent,"bpmn:SubProcess")?(r=ct(lN.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:Participant")?(r=ct(_N,function(c){return ht(e)!==c.target.isExpanded}),this._createEntries(e,r)):M(t,"bpmn:StartEvent")&&Gn(t.$parent)?(r=ct(xN.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")&&!Gn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")?(r=ct(uN.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:EndEvent")?(r=ct(fN.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=ct(bN,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=ct(pN.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:Gateway")?(r=ct(dN,a),this._createEntries(e,r)):M(t,"bpmn:Transaction")?(r=ct(lE,a),this._createEntries(e,r)):Gn(t)&&ht(e)?(r=ct(mN,a),this._createEntries(e,r)):M(t,"bpmn:AdHocSubProcess")&&ht(e)?(r=ct(gN,a),this._createEntries(e,r)):M(t,"bpmn:SubProcess")&&ht(e)?(r=ct(hN,a),this._createEntries(e,r)):M(t,"bpmn:SubProcess")&&!ht(e)?(r=ct(uE,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,wN):M(t,"bpmn:FlowNode")?(r=ct(uE,a),this._createEntries(e,r)):{})},ki.prototype.getPopupMenuHeaderEntries=function(e){var t={};return M(e,"bpmn:Activity")&&!Gn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),M(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),M(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Vb(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},ki.prototype._createEntries=function(e,t){var n={},i=this;return W(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},ki.prototype._createSequenceFlowEntries=function(e,t){var n=be(e),i={},o=this._modeling,r=this._moddle,a=this;return W(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(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},ki.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}},ki.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=be(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"}}}},ki.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}}},ki.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}}},ki.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=be(e),i=this,o=Wb(e),r=M(e,"bpmn:BoundaryEvent")?pE["intermediate-event-non-interrupting"]:pE["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 SN={__depends__:[ng,pw,Cu],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",ki]};function hc(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(!(!js(d)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}hc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],hc.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&q(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,o){t.removeElements(o.slice())}}}}),n},hc.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Ye(t)?Bo(e,n=>t.includes(n)):t},hc.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])&&q(u,g()),u;var p=e.businessObject;function f(v,x){o.start(v,x)}function d(v,x){n.removeElements([x])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(v){var x=5,E=t.getPad(v).html,A=E.getBoundingClientRect(),D={x:A.left,y:A.bottom+x};return D}function m(v,x,E,A){function D(j,F){var G=i.createShape(q({type:v},A));r.start(j,G,{source:F})}var P=s?function(j,F){var G=i.createShape(q({type:v},A));s.append(F,G)}:D,T=s?function(j,F){return l.create(F,v,A),()=>{l.cleanUp()}}:null;return{group:"model",className:x,title:E,action:{dragstart:D,click:P,hover:T}}}function w(v){return function(x,E){n.splitLane(E,v),t.open(E,!0)}}if(at(p,["bpmn:Lane","bpmn:Participant"])&&ht(e)){var y=er(e);q(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(v,x){n.addLane(x,"top")}}}}),y.length<2&&((En(e)?e.height>=120:e.width>=120)&&q(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:w(2)}}}),(En(e)?e.height>=180:e.width>=180)&&q(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:w(3)}}})),q(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(v,x){n.addLane(x,"bottom")}}}})}return M(p,"bpmn:FlowNode")&&(M(p,"bpmn:EventBasedGateway")?q(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"})}):fE(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?q(u,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!M(p,"bpmn:EndEvent")&&!p.isForCompensation&&!fE(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Gn(p)&&q(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")||q(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(v,x){var E=q(h(x),{cursor:{x:v.x,y:v.y}});a.open(x,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),M(p,"bpmn:SequenceFlow")&&q(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),M(p,"bpmn:MessageFlow")&&q(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),at(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&q(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")&&q(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),at(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&q(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")&&q(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&q(u,g()),u};function fE(e,t,n){var i=e.$instanceOf(t),o=!1,r=e.eventDefinitions||[];return W(r,function(a){a.$type===n&&(o=!0)}),i&&o}const RN={__depends__:[iN,cE,H_,Mi,ug,ou,SN],__init__:["contextPadProvider"],contextPadProvider:["type",hc]};var CN={horizontal:["x","width"],vertical:["y","height"]},dE=5;function Do(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Ye(i)?i:i?n:[]})}Do.$inject=["modeling","rules"],Do.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Do.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},Do.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(W(t,function(r){o=r(o,n,i)}),o):e},Do.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=Yi(e,i);return W(r,function(a,s){var c=n._findRange(a,i,o),l,u=t[t.length-1];u&&n._hasIntersection(u.range,c)?t[t.length-1].elements.push(a):(l={range:c,elements:[a]},t.push(l))}),t},Do.prototype._setOrientation=function(e){var t=CN[e];this._axis=t[0],this._dimension=t[1]},Do.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)},Do.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+dE,max:t+n-dE}};const MN={__init__:["distributeElements"],distributeElements:["type",Do]};function ip(e){Ci.call(this,e)}ip.$inject=["eventBus"],De(ip,Ci),ip.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=ct(t,function(n){var i=at(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=ml(t),t.length<3?!1:t})};var hE={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>`},RN=900;function dc(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",RN,this)}dc.$inject=["popupMenu","distributeElements","translate","rules"],dc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&q(t,this._getEntries(e)),t},dc.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},dc.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:fE.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:fE.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const CN={__depends__:[tg,SN],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",ep],distributeElementsMenuProvider:["type",dc]};var dE="is not a registered action",MN="is already registered";function Oi(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Oi.$inject=["eventBus","injector"],Oi.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=Ye(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&&(Ye(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)})},Oi.prototype.trigger=function(e,t){if(!this._actions[e])throw pg(e,dE);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Oi.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);W(e,function(i,o){n._registerAction(o,i)})},Oi.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw pg(e,MN);this._actions[e]=t},Oi.prototype.unregister=function(e){if(!this.isRegistered(e))throw pg(e,dE);this._actions[e]=void 0},Oi.prototype.getActions=function(){return Object.keys(this._actions)},Oi.prototype.isRegistered=function(e){return!!this._actions[e]};function pg(e,t){return new Error(e+" "+t)}const AN={__init__:["editorActions"],editorActions:["type",Oi]};function tp(e){e.invoke(Oi,this)}De(tp,Oi),tp.$inject=["injector"],tp.prototype._registerDefaultActions=function(e){Oi.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=[],w=g.type;h.length&&(m=ct(h,function(y){return!M(y,"bpmn:Lane")}),l.trigger(m,w))}),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(w){return M(w.parent,"bpmn:Collaboration")}):m=n.filter(function(w){return w!==g&&!M(w.parent,"bpmn:SubProcess")}),h=ln(m),f.moveElements(m,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const PN={__depends__:[AN],editorActions:["type",tp]};function hE(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;at(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}hE.$inject=["eventBus"];function Yr(e,t){ve.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;ei(a)?o.newBounds=n.snapComplex(c,a):o.newBounds=n.snapSimple(s,c)}})}Yr.$inject=["eventBus","gridSnapping","modeling"],De(Yr,ve),Yr.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},Yr.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},Yr.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),q(e,r),e},Yr.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),q(e,r),e};var TN=2e3;function gE(e,t){e.on(["spaceTool.move","spaceTool.end"],TN,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)}})}gE.$inject=["eventBus","gridSnapping"];const kN={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Yr],gridSnappingSpaceToolBehavior:["type",gE]};var np=10;function fg(e,t,n){return n||(n="round"),Math[n](e/t)*t}var ON=1200,DN=800;function dr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",DN,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"],ON,function(r){var a=r.originalEvent;if(!(!o.active||a&&ai(a))){var s=r.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=IN(r,l,e);p&&(u.offset=p);var f=LN(r,l);f&&q(u,f),qa(r,l)||o.snapEvent(r,l,u)})}})}dr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);dn(e,t,i)},dr.prototype.getGridSpacing=function(){return np},dr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=fg(e,np);var i,o;return t&&t.min&&(i=t.min,Ke(i)&&(i=fg(i+n,np,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,Ke(o)&&(o=fg(o+n,np,"floor"),e=Math.min(e,o))),e-=n,e},dr.prototype.isActive=function(){return this.active},dr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},dr.prototype.toggleActive=function(){this.setActive(!this.active)},dr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function LN(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&&(ip(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&&(ip(t)?yE(s)?a.x.max=c.left:a.x.min=c.right:mE(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(ip(t)?yE(s)?a.x.min=l.left:a.x.max=l.right:mE(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function IN(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,a=r.snapLocation,s=r.snapOffset;return s&&Ke(s[t])||(s||(s=r.snapOffset={}),Ke(s[t])||(s[t]=0),!o)||(n.get(o.id)||(ip(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 ip(e){return e==="x"}function mE(e){return e.indexOf("n")!==-1}function yE(e){return e.indexOf("w")!==-1}const BN={__depends__:[kN],__init__:["gridSnapping"],gridSnapping:["type",dr]};var NN=2e3;function vE(e,t,n){e.on("autoPlace",NN,function(i){var o=i.source,r=Xe(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")&&($N(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}vE.$inject=["eventBus","gridSnapping","elementRegistry"];function $N(e){return e==="x"}var FN=1750;function bE(e,t,n){t.on(["create.start","shape.move.start"],FN,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}))}})}bE.$inject=["canvas","eventBus","gridSnapping"];var jN=3e3;function op(e,t,n){ve.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],jN,function(o){var r=o.context,a=r.connection,s=r.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||HN(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}op.$inject=["eventBus","gridSnapping","modeling"],De(op,ve),op.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=VN(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function HN(e){return e.length>3}function zN(e){return e==="h"}function GN(e){return e==="v"}function VN(e,t,n){var i=bo(t,n),o={};return zN(i)&&(o.y=e.snapValue(t.y)),GN(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=q({},t,o),n=q({},n,o)),[t,n]}const WN={__depends__:[BN,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",vE],gridSnappingParticipantBehavior:["type",bE],gridSnappingLayoutConnectionBehavior:["type",op]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",hE]};var UN=30,xE=30;function hc(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 ht(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(M(o,"bpmn:SubProcess"))return ht(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}hc.$inject=["eventBus","interactionEvents"],hc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},hc.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=En(e)?{width:UN,height:e.height}:{width:e.width,height:xE};return this._interactionEvents.createBoxHit(t,"all",n),!0},hc.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:xE}),!0};const qN={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",hc]};function rp(e){e.invoke(ja,this)}De(rp,ja),rp.$inject=["injector"],rp.prototype.registerBindings=function(e,t){ja.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 YN={__depends__:[jh],__init__:["keyboardBindings"],keyboardBindings:["type",rp]};var KN={moveSpeed:1,moveSpeedAccelerated:10},XN=1500,wE="left",_E="up",EE="right",SE="down",ZN={ArrowLeft:wE,Left:wE,ArrowUp:_E,Up:_E,ArrowRight:EE,Right:EE,ArrowDown:SE,Down:SE},QN={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 RE(e,t,n,i,o){var r=this;this._config=q({},KN,e||{}),t.addListener(XN,function(a){var s=a.keyEvent,c=ZN[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=QN[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}RE.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const JN={__depends__:[jh,Mi],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",RE]};var CE=10;function gc(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=$k(u,p,l),c.newBounds=jk(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:Ge(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=Mv(p),!e$(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)})}gc.prototype.canResize=function(e){var t=this._rules,n=$i(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},gc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=q({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,ME(t,r),"resize",{autoActivate:!0,cursor:t$(r),data:{shape:t,context:o}})},gc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:CE,height:CE},o=hb(t,e.childrenBoxPadding),Hk(n,t,i,o)},gc.$inject=["eventBus","rules","modeling","dragging"];function e$(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function ME(e,t){var n=Xe(e),i=Ge(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 t$(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 AE="djs-resizing",PE="resize-not-ok",n$=500;function TE(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,AE)),s.width>5&&Pe(c,{x:s.x,width:s.width}),s.height>5&&Pe(c,{y:s.y,height:s.height}),r.canExecute?dt(c).remove(PE):dt(c).add(PE)}function o(r){var a=r.shape,s=r.frame;s&&cn(r.frame),t.removeMarker(a,AE)}e.on("resize.move",n$,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}TE.$inject=["eventBus","canvas","previewSupport"];var ap=-6,sp=8,cp=20,mc="djs-resizer",i$=["n","w","s","e","nw","ne","se","sw"];function hr(e,t,n,i){this._resize=i,this._canvas=t;var o=this;e.on("selection.changed",function(r){var a=r.newSelection;o.removeResizers(),a.length===1&&W(a,Zn(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}hr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){nr(r)&&i.activate(r,e,n)}je.bind(t,"mousedown",o),je.bind(t,"touchstart",o)},hr.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=o$(i),a=Ne("g");dt(a).add(mc),dt(a).add(mc+"-"+e.id),dt(a).add(mc+"-"+i),Je(o,a);var s=Ne("rect");Pe(s,{x:-sp/2+r.x,y:-sp/2+r.y,width:sp,height:sp}),dt(s).add(mc+"-visual"),Je(a,s);var c=Ne("rect");return Pe(c,{x:-cp/2+r.x,y:-cp/2+r.y,width:cp,height:cp}),dt(c).add(mc+"-hit"),Je(a,c),bl(a,t,n),a},hr.prototype.createResizer=function(e,t){var n=ME(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},hr.prototype.addResizer=function(e){var t=this;Lt(e)||W(i$,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},hr.prototype.removeResizers=function(){var e=this._getResizersParent();vs(e)},hr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},hr.$inject=["eventBus","canvas","selection","resize"];function o$(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-ap:e.indexOf("w")!==-1&&(t.x=ap),e.indexOf("s")!==-1?t.y=-ap:e.indexOf("n")!==-1&&(t.y=ap),t}const kE={__depends__:[oo,Ro,Ba],__init__:["resize","resizePreview","resizeHandles"],resize:["type",gc],resizePreview:["type",TE],resizeHandles:["type",hr]};var r$=2e3;function yc(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"],r$,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||at(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}yc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],yc.prototype.activate=function(e){var t=vi(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);q(n,i);var o={},r=n.style||{};return q(r,{backgroundColor:null,border:null}),(at(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||OE(e))&&q(o,{centerVertically:!0}),Qo(e)&&(q(o,{resizable:!0,autoResize:!0}),q(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),M(e,"bpmn:TextAnnotation")&&(q(o,{resizable:!0,autoResize:!0}),q(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),q(n,{options:o,style:r}),n}},yc.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")||c$(e)){var g=En(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};q(r,h),q(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(s$(e)){var m=En(e),w=m?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:o.x-i.height/2,y:o.y-i.width/2};q(r,w),q(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)"})}(at(e,["bpmn:Task","bpmn:CallActivity"])||OE(e))&&(q(r,{width:i.width,height:i.height}),q(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),a$(e)&&(q(r,{width:i.width,x:i.x}),q(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var y=1,v=i.width+2*y;if(n.labelTarget&&(q(r,{width:v,height:i.height+2*y,x:i.x-y,y:i.y-y}),q(d,{fontSize:l+"px",lineHeight:u})),Qo(n)&&!_l(n)&&!rt(n)){var x=Kf(e),E=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),A=l,D=Lr.width*a+2*y;q(r,{width:D,height:A+2*y,x:E.x-D/2,y:E.y-A/2-y}),q(d,{fontSize:l+"px",lineHeight:u})}return M(e,"bpmn:TextAnnotation")&&(q(r,{width:i.width+2*y,height:i.height+2*y,x:i.x-y,y:i.y-y,minWidth:30*a,minHeight:10*a}),q(d,{textAlign:"left",paddingTop:Sa*a+"px",paddingBottom:Sa*a+"px",paddingLeft:Sa*a+"px",paddingRight:Sa*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:r,style:d}},yc.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}),l$(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function OE(e){return M(e,"bpmn:SubProcess")&&!ht(e)}function a$(e){return M(e,"bpmn:SubProcess")&&ht(e)}function s$(e){return M(e,"bpmn:Participant")&&!ht(e)}function c$(e){return M(e,"bpmn:Participant")&&ht(e)}function l$(e){return!e||!e.trim()}var DE="djs-element-hidden",LE="djs-label-hidden";function IE(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=Ne("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=Ne("path");Pe(p,{d:u,strokeWidth:2,stroke:u$(r)}),Je(s,p),Je(o,s),Dn(s,r.x,r.y)}M(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,DE):(M(r,"bpmn:Task")||M(r,"bpmn:CallActivity")||M(r,"bpmn:SubProcess")||M(r,"bpmn:Participant")||M(r,"bpmn:Lane"))&&t.addMarker(r,LE)}),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}});Pe(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,DE),t.removeMarker(r,LE)),r=void 0,a=void 0,s&&(cn(s),s=void 0)})}IE.$inject=["eventBus","canvas","pathMap"];function u$(e,t){var n=yt(e);return n.get("stroke")||t||"black"}const p$={__depends__:[dh,kE,aE],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",yc],labelEditingPreview:["type",IE]};var f$=500,d$=1e3;function so(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){jP(r)||i.createOutline(r)}e.on("element.hover",function(r){o(r.element)}),e.on("selection.changed",function(r){W(r.newSelection,o)}),e.on(["shape.changed","connection.changed"],f$,function(r){var a=r.element,s=r.gfx,c=At(".djs-outline",s);c&&i.updateOutline(a,c)})}so.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=At(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Je(t,n),this.updateOutline(e,n)),n},so.prototype._createOutlineGfx=function(){var e=Ne("rect");return Pe(e,q({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},so.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},so.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&W(i,function(o){n=n||o.updateOutline(t,e)}),n||Pe(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},so.prototype.updateConnectionOutline=function(e,t){var n=ln(t);Pe(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},so.prototype.registerProvider=function(e,t){t||(t=e,e=d$),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},so.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},so.prototype.getOutline=function(e){var t,n=this._getProviders();return W(n,function(i){_n(i.getOutline)&&(t=t||i.getOutline(e))}),t},so.$inject=["eventBus","styles","elementRegistry"];var lp=6;function dg(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)})}dg.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");vs(t);var n=e.length>1,i=this._canvas.getContainer();if(dt(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=h$(ln(e)),r=Ne("rect");Pe(r,q({rx:3},o)),dt(r).add("djs-selection-outline"),Je(t,r)}},dg.$inject=["eventBus","canvas","selection"];function h$(e){return{x:e.x-lp,y:e.y-lp,width:e.width+lp*2,height:e.height+lp*2}}const hg={__depends__:[Mi],__init__:["outline","multiSelectionOutline"],outline:["type",so],multiSelectionOutline:["type",dg]},BE=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],NE={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},g$=15,up=2;function $E(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=>at(g,BE));if(f.length===1){const g=f[0];rt(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(f.length===2){const g=f.find(rt),h=f.find(m=>{var w;return(w=m.labels)==null?void 0:w.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!at(p,BE)||!u(p)||(rt(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=ws([Xe(f),Xe(p)],NE),g=d.getAttribute("d"),m=o.isSelected(p)?c(p):l(p),w=Rs(m,g);if(!w)return;const v=o.isSelected(f)?c(f):l(f),x=Rs(v,g)||Xe(f);Is(x,w)<g$||(Hf(d,[x,w]),Je(r,d))}function s(){ys(`.${NE.class}`,r).forEach(cn)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+gr(f,"x")-up,y:p.y+gr(f,"y")-up,width:gr(f,"width")+up*2,height:gr(f,"height")+up*2};return Zf(d,gr(f,"rx"))}if(f.cx){const d=gr(f,"r"),g={x:p.x+gr(f,"cx")-d,y:p.y+gr(f,"cy")-d,width:d*2,height:d*2};return Zv(g)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}$E.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function gr(e,t){return parseFloat(Pe(e,t)||0)}const m$={__depends__:[Mi,hg],__init__:["labelLink"],labelLink:["type",$E]};var y$=new Fr("tt");function v$(e){var t=zt('<div class="djs-tooltip-container" />');return qn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function b$(e,t,n){qn(e,{left:t+"px",top:n+"px"})}function gg(e,t){e.style.display=t===!1?"none":""}var FE="djs-tooltip",mg="."+FE;function Jn(e,t){this._eventBus=e,this._canvas=t,this._ids=y$,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=v$(t.getContainer());var n=this;ii.bind(this._tooltipRoot,mg,"mousedown",function(i){i.stopPropagation()}),ii.bind(this._tooltipRoot,mg,"mouseover",function(i){n.trigger("mouseover",i)}),ii.bind(this._tooltipRoot,mg,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Jn.$inject=["eventBus","canvas"],Jn.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=q({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Jn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Mn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Jn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Jn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Jn.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)}},Jn.prototype.remove=function(e){var t=this.get(e);t&&(Qi(t.html),Qi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Jn.prototype.show=function(){gg(this._tooltipRoot)},Jn.prototype.hide=function(){gg(this._tooltipRoot,!1)},Jn.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},Jn.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)),ei(n)&&(n=zt(n)),i=zt('<div data-tooltip-id="'+t+'" class="'+FE+'">'),qn(i,{position:"absolute"}),i.appendChild(n),e.type&&kt(i).add("djs-tooltip-"+e.type),e.className&&kt(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Jn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;b$(n,t.x,t.y)},Jn.prototype._updateTooltipVisibilty=function(e){W(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),gg(i,o))})},Jn.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 x$={__init__:["tooltips"],tooltips:["type",Jn]};var w$="flow elements must be children of pools/participants",_$="Data object must be placed within a pool/participant.";function jE(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(w$)):M(a,"bpmn:DataObjectReference")&&i(o,n(_$)))})}jE.$inject=["eventBus","tooltips","translate"];const E$={__depends__:[x$],__init__:["modelingFeedback"],modelingFeedback:["type",jE]};var S$=500,R$=1250,C$=1500,pp=Math.round;function M$(e){return{x:e.x+pp(e.width/2),y:e.y+pp(e.height/2)}}function HE(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",C$,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=A$(u),q(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",R$,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",S$,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=pp(l.x),l.y=pp(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(nr(s)){var c=Oa(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(yn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!dt(s.target).has("djs-hit-no-move")){var p=M$(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}HE.$inject=["eventBus","dragging","modeling","selection","rules"];function A$(e){var t=aa(e,"id");return ct(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var zE=499,yg="djs-dragging",GE="drop-ok",VE="drop-not-ok",WE="new-parent",UE="attach-ok";function qE(e,t,n,i){function o(c){var l=r(c),u=P$(l);return u}function r(c){var l=_s(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[UE,GE,VE,WE].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,yg),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",zE,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,f=o(u);if(!l.dragGroup){var d=Ne("g");Pe(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();Je(g,d),l.dragGroup=d}f.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=kp([p,r(u)]):p=r(u),W(p,function(h){t.addMarker(h,yg)}),l.allDraggedElements=p,l.differentParents=T$(u)}),e.on("shape.move.move",zE,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,UE):l.canExecute&&f&&p.id!==f.id?a(p,WE):a(p,l.canExecute?GE:VE)),Dn(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var l=c.context,u=l.target;u&&a(u,null)}),e.on("shape.move.cleanup",function(c){var l=c.context,u=l.allDraggedElements,p=l.dragGroup;W(u,function(f){t.removeMarker(f,yg)}),p&&cn(p)}),this.makeDraggable=s}qE.$inject=["eventBus","canvas","styles","previewSupport"];function P$(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=ct(e,function(i){return Lt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function T$(e){return TS(aa(e,function(t){return t.parent&&t.parent.id}))!==1}const k$={__depends__:[Jl,Mi,hg,oo,Ro,Ba],__init__:["move","movePreview"],move:["type",HE],movePreview:["type",qE]};var YE=".djs-palette-toggle",KE=".entry",O$=YE+", "+KE,vg="djs-palette-",D$="shown",bg="open",XE="two-column",L$=1e3;function hn(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var o=i.tool;n.updateToolHighlight(o)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}hn.$inject=["eventBus","canvas"],hn.prototype.registerProvider=function(e,t){t||(t=e,e=L$),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},hn.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(B$,{})},hn.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},hn.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=zt(hn.HTML_MARKUP);n.appendChild(i),kt(n).add(vg+D$),ii.bind(i,O$,"click",function(o){var r=o.delegateTarget;if(kf(r,YE))return e.toggle();e.trigger("click",o)}),je.bind(i,"mousedown",function(o){o.stopPropagation()}),ii.bind(i,KE,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},hn.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},hn.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=kt(n),a=kt(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(XE,o),a.toggle(vg+XE,o),"open"in e&&(r.toggle(bg,e.open),a.toggle(vg+bg,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},hn.prototype._update=function(){var e=At(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ll(e),W(t,function(n,i){var o=n.group||"default",r=At("[data-group="+Gr(o)+"]",e);r||(r=zt('<div class="group"></div>'),Mn(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=zt(a);if(r.appendChild(s),!n.separator&&(Mn(s,"data-action",i),n.title&&Mn(s,"title",n.title),n.className&&I$(s,n.className),n.imageUrl)){var c=zt("<img>");Mn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},hn.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=Mn(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},hn.prototype.triggerEntry=function(e,t,n,i){var o=this._entries,r,a;if(r=o[e],!!r&&(a=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:n})!==!1)){if(_n(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},hn.prototype._layoutChanged=function(){this._toggleState({})},hn.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},hn.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},hn.prototype.open=function(){this._toggleState({open:!0})},hn.prototype.toggle=function(){this.isOpen()?this.close():this.open()},hn.prototype.isActiveTool=function(e){return e&&this._activeTool===e},hn.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=At(".djs-palette-entries",this._container),this._toolsContainer=At("[data-group=tools]",t)),n=this._toolsContainer,W(n.children,function(i){var o=i.getAttribute("data-action");if(o){var r=kt(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},hn.prototype.isOpen=function(){return kt(this._container).has(bg)},hn.prototype._getParentContainer=function(){return this._canvas.getContainer()},hn.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function I$(e,t){var n=kt(e),i=Ye(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function B$(e,t){var n=t.getPaletteEntries();return _n(n)?n(e):(W(n,function(i,o){e[o]=i}),e)}const N$={__init__:["palette"],palette:["type",hn]};var ZE="crosshair",QE="selected",$$="djs-dragging-active-lasso";function mr(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=Ne("rect");Pe(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Je(f,d),l(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&Pe(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,QE);for(const m of g)h.has(m)||t.addMarker(m,QE)}},remove:function(p){this.update(p),p.frame&&cn(p.frame),l(!1)}};function l(p){dt(t.getContainer()).toggle($$,p)}function u(p){var f=i.getAll();return new Set(ra(ba(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=JE(p),f.add=Ul(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=JE(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(Ul(p))return s.activateLasso(p.originalEvent),!0})}mr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],mr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:ZE,data:{context:{}},keepSelection:!0})},mr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:ZE,data:{context:{}},keepSelection:!0})},mr.prototype._select=function(e){this._selection.select(e)},mr.prototype.select=function(e,t,n=[]){var i=ra(ba(e,t));this._select([...n,...i])},mr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},mr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function JE(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 F$={__depends__:[iu,Hs],__init__:["lassoTool"],lassoTool:["type",mr]};var xg=1500,e1="grab";function Ya(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",xg,function(c){if($s(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(xg,function(c){if(!(!t1(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(xg,function(c){!t1(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!$s(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Ya.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Ya.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:e1,data:{context:n||{}}})},Ya.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:e1,data:{context:{reactivate:n}}})},Ya.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Ya.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function t1(e){return bn("Space",e)}const j$={__depends__:[iu,Hs],__init__:["handTool"],handTool:["type",Ya]};var n1="connect-ok",i1="connect-not-ok";function Ka(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?n1:i1))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?n1:i1)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(u);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,p)}),!1})}Ka.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Ka.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Ka.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Ka.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Ka.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const H$={__depends__:[lg,oo,Ro,iu,Hs],globalConnect:["type",Ka]};function wg(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)}wg.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],wg.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(w){var y=n.createShape(q({type:p},h));t.start(w,y)}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 q(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 z$={__depends__:[N$,tu,gw,F$,j$,H$,ks],__init__:["paletteProvider"],paletteProvider:["type",wg]};var G$=250;function _g(e,t,n,i,o){ve.call(this,e);function r(s){var c=s.canExecute.replacements;W(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);q(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=At('[data-element-id="'+Gr(f.id)+'"]',s.dragGroup);g&&Pe(g,{display:"none"});var h=o.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;W(c,function(l,u){var p=At('[data-element-id="'+Gr(u)+'"]',s.dragGroup);p&&Pe(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",G$,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}_g.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],De(_g,ve);const V$={__depends__:[Ba],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",_g]};var W$=1250,Eg=40,U$=20,q$=10,o1=20,r1=["x","y"],Y$=Math.abs;function a1(e){e.on(["connect.hover","connect.move","connect.end"],W$,function(t){var n=t.context,i=n.canExecute,o=n.start,r=n.hover,a=n.source,s=n.target;t.originalEvent&&ai(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&r&&K$(t,r,J$(r)),r&&Q$(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Ti(o),at(r,["bpmn:Event","bpmn:Gateway"])&&s1(t,Ti(r)),at(r,["bpmn:Task","bpmn:SubProcess"])&&X$(t,r),M(a,"bpmn:BoundaryEvent")&&s===a.host&&Z$(t)):c1(i,"bpmn:MessageFlow")?(M(o,"bpmn:Event")&&(n.connectionStart=Ti(o)),M(r,"bpmn:Event")&&s1(t,Ti(r))):n.connectionStart=n.initialConnectionStart)})}a1.$inject=["eventBus"];function K$(e,t,n){r1.forEach(function(i){var o=l1(i,t);e[i]<t[i]+n?dn(e,i,t[i]+n):e[i]>t[i]+o-n&&dn(e,i,t[i]+o-n)})}function X$(e,t){var n=Ti(t);r1.forEach(function(i){e5(e,t,i)&&dn(e,i,n[i])})}function Z$(e){var t=e.context,n=t.source,i=t.target;if(!t5(t)){var o=Ti(n),r=On(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;Y$(c-o[s])<Eg&&(c>o[s]?l=o[s]+Eg:l=o[s]-Eg,dn(e,s,l))})}}function s1(e,t){dn(e,"x",t.x),dn(e,"y",t.y)}function c1(e,t){return e&&e.type===t}function Q$(e,t){return No(t,function(n){return c1(e,n)})}function l1(e,t){return e==="x"?t.width:t.height}function J$(e){return M(e,"bpmn:Task")?q$:U$}function e5(e,t,n){return e[n]>t[n]+o1&&e[n]<t[n]+l1(n,t)-o1}function t5(e){var t=e.hover,n=e.source;return t&&n&&t===n}function yr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}yr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},yr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},yr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},yr.prototype.getSnapLocations=function(){return this._snapLocations},yr.prototype.setSnapLocations=function(e){this._snapLocations=e},yr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new fp,n.initDefaults(this._defaultSnaps)),n};function fp(){this._snapValues={}}fp.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)},fp.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&GB(e[n],o[n],i)},fp.prototype.initDefaults=function(e){var t=this;W(e||{},function(n,i){W(n,function(o){t.add(i,o)})})};var n5=1250;function co(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"],n5,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&ai(o.originalEvent))&&!(qa(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()})}co.$inject=["elementRegistry","eventBus","snapping"],co.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new yr);var r;t.get(i.id)?r=Ti(i,e):r={x:e.x+Ti(i).x,y:e.y+Ti(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}),rt(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},co.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return W(i,function(o){if(rt(o)){rt(t)&&e.add("mid",Ti(o));return}if(Lt(o)){if(o.waypoints.length<3)return;var r=o.waypoints.slice(1,-1);W(r,function(a){e.add("mid",a)});return}e.add("mid",Ti(o))}),!Ke(t.x)||!Ke(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Ti(t)),e},co.prototype.getSnapTargets=function(e,t){return K0(t).filter(function(n){return!i5(n)})};function i5(e){return!!e.hidden}var u1=1500;function Xa(e,t){t.invoke(co,this),e.on(["create.move","create.end"],u1,s5),e.on(["create.move","create.end","shape.move.move","shape.move.end"],u1,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!qa(n)&&o5(n,r)})}De(Xa,co),Xa.$inject=["eventBus","injector"],Xa.prototype.initSnap=function(e){var t=co.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return W(n.outgoing,function(o){var r=o.waypoints[0];r=r.original||r,t.setSnapOrigin(o.id+"-docking",f1(r,i,e))}),W(n.incoming,function(o){var r=o.waypoints[o.waypoints.length-1];r=r.original||r,t.setSnapOrigin(o.id+"-docking",f1(r,i,e))}),M(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Xa.prototype.addSnapTargetPoints=function(e,t,n){co.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);W(i,function(r){(a5(r)||r5([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",q0(r)),e.add("bottom-right",Y0(r)))});var o=this._elementRegistry;return W(t.incoming,function(r){if(o.get(t.id)){p1(i,r.source)||e.add("mid",Xe(r.source));var a=r.waypoints[0];e.add(r.id+"-docking",a.original||a)}}),W(t.outgoing,function(r){if(o.get(t.id)){p1(i,r.target)||e.add("mid",Xe(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},Xa.prototype.getSnapTargets=function(e,t){return co.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!M(n,"bpmn:Lane")})};function o5(e,t){var n=Ge(t),i=px(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=Xe(r),/top/.test(i)?dn(e,"y",n.top-a.y):/bottom/.test(i)&&dn(e,"y",n.bottom-a.y),/left/.test(i)?dn(e,"x",n.left-a.x):/right/.test(i)&&dn(e,"x",n.right-a.x)}function r5(e,t){return e.every(function(n){return M(n,t)})}function a5(e){return M(e,"bpmn:SubProcess")&&ht(e)?!0:M(e,"bpmn:Participant")}function s5(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)&&dn(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&dn(e,"y",e.y)}}function p1(e,t){return e.indexOf(t)!==-1}function f1(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var c5=1250;function vc(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],c5,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&ai(i.originalEvent))&&!qa(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),p5(s)&&dn(i,"x",i.x),f5(s)&&dn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}vc.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new yr);var r=d1(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},vc.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return W(o,function(r){e.add("corner",Y0(r)),e.add("corner",q0(r))}),e.add("corner",d1(t,i)),e},vc.$inject=["eventBus","snapping"],vc.prototype.getSnapTargets=function(e,t){return K0(t).filter(function(n){return!l5(n,e)&&!Lt(n)&&!u5(n)&&!rt(n)})};function d1(e,t){var n=Xe(e),i=Ge(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 l5(e,t){return e.host===t}function u5(e){return!!e.hidden}function p5(e){return e==="n"||e==="s"}function f5(e){return e==="e"||e==="w"}var d5=7,h5=1e3;function vr(e){this._canvas=e,this._asyncHide=Dp(Zn(this.hide,this),h5)}vr.$inject=["canvas"],vr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:qa(e,"x"),y:qa(e,"y")};W(o,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(W(["x","y"],function(l){var u;r[l]||(u=t.snap(c,a,l,d5),u!==void 0&&(r[l]={value:u,originValue:u-s[l]}))}),r.x&&r.y)return!1}),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),W(["x","y"],function(a){var s=r[a];yn(s)&&dn(e,a,s.originValue)})},vr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Ne("path");return Pe(n,{d:"M0,0 L0,0"}),dt(n).add("djs-snap-line"),Je(t,n),{update:function(i){Ke(i)?e==="horizontal"?Pe(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Pe(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Pe(n,{display:"none"})}}},vr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},vr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},vr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},vr.prototype.hide=function(){W(this._snapLines,function(e){e.update()})};const g5={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",co],resizeSnapping:["type",vc],snapping:["type",vr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",a1],createMoveSnapping:["type",Xa]};var h1=300;function it(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=At(it.INPUT_SELECTOR,this._container),this._resultsContainer=At(it.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}it.$inject=["canvas","eventBus","selection","translate"],it.prototype._bindEvents=function(){var e=this;function t(n,i,o,r){e._eventMaps.push({el:n,type:o,listener:ii.bind(n,i,o,r)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,it.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,it.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,it.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,it.INPUT_SELECTOR,"keydown",function(n){bn("ArrowUp",n)&&n.preventDefault(),bn("ArrowDown",n)&&n.preventDefault()}),t(this._container,it.INPUT_SELECTOR,"keyup",function(n){if(bn("Escape",n))return e.close();if(bn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(bn("ArrowUp",n))return e._scrollToDirection(!0);if(bn("ArrowDown",n))return e._scrollToDirection();bn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},it.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ii.unbind(e.el,e.type,e.listener)})},it.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=At(it.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},it.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},it.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)}},it.prototype._clearResults=function(){ll(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},it.prototype._getCurrentResult=function(){return At(it.RESULT_SELECTED_SELECTOR,this._resultsContainer)},it.prototype._createResultNode=function(e,t){var n=zt(it.RESULT_HTML);return e.primaryTokens.length>0&&g1(n,e.primaryTokens,it.RESULT_PRIMARY_HTML),g1(n,e.secondaryTokens,it.RESULT_SECONDARY_HTML),Mn(n,it.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},it.prototype.registerProvider=function(e){this._searchProvider=e},it.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,kt(this._canvas.getContainer()).add("djs-search-open"),kt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},it.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,kt(this._canvas.getContainer()).remove("djs-search-open"),kt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},it.prototype.toggle=function(){this.isOpen()?this.close():this.open()},it.prototype.isOpen=function(){return this._open},it.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&kt(t).remove(it.RESULT_SELECTED_CLASS);var n=Mn(e,it.RESULT_ID_ATTRIBUTE),i=this._results[n].element;kt(e).add(it.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:h1}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},it.prototype._select=function(e){var t=Mn(e,it.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:h1}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},it.prototype._getBoxHtml=function(){const e=zt(it.BOX_HTML),t=At(it.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function g1(e,t,n){var i=m5(t),o=zt(n);o.innerHTML=i,e.appendChild(o)}function m5(e){var t="";return e.forEach(function(n){var i=E_(n.value||n.matched||n.normal),o=n.match||n.matched;o?t+='<b class="'+it.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}it.CONTAINER_SELECTOR=".djs-search-container",it.INPUT_SELECTOR=".djs-search-input input",it.RESULTS_CONTAINER_SELECTOR=".djs-search-results",it.RESULT_SELECTOR=".djs-search-result",it.RESULT_SELECTED_CLASS="djs-search-result-selected",it.RESULT_SELECTED_SELECTOR="."+it.RESULT_SELECTED_CLASS,it.RESULT_ID_ATTRIBUTE="data-result-id",it.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",it.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
335
|
+
</svg>`},AN=900;function gc(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",AN,this)}gc.$inject=["popupMenu","distributeElements","translate","rules"],gc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&q(t,this._getEntries(e)),t},gc.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},gc.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:hE.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:hE.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const PN={__depends__:[ng,MN],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",ip],distributeElementsMenuProvider:["type",gc]};var gE="is not a registered action",TN="is already registered";function Oi(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Oi.$inject=["eventBus","injector"],Oi.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=Ye(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&&(Ye(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)})},Oi.prototype.trigger=function(e,t){if(!this._actions[e])throw fg(e,gE);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Oi.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);W(e,function(i,o){n._registerAction(o,i)})},Oi.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw fg(e,TN);this._actions[e]=t},Oi.prototype.unregister=function(e){if(!this.isRegistered(e))throw fg(e,gE);this._actions[e]=void 0},Oi.prototype.getActions=function(){return Object.keys(this._actions)},Oi.prototype.isRegistered=function(e){return!!this._actions[e]};function fg(e,t){return new Error(e+" "+t)}const kN={__init__:["editorActions"],editorActions:["type",Oi]};function op(e){e.invoke(Oi,this)}De(op,Oi),op.$inject=["injector"],op.prototype._registerDefaultActions=function(e){Oi.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=[],w=g.type;h.length&&(m=ct(h,function(y){return!M(y,"bpmn:Lane")}),l.trigger(m,w))}),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(w){return M(w.parent,"bpmn:Collaboration")}):m=n.filter(function(w){return w!==g&&!M(w.parent,"bpmn:SubProcess")}),h=ln(m),f.moveElements(m,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const ON={__depends__:[kN],editorActions:["type",op]};function mE(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;at(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}mE.$inject=["eventBus"];function Zr(e,t){ve.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;ei(a)?o.newBounds=n.snapComplex(c,a):o.newBounds=n.snapSimple(s,c)}})}Zr.$inject=["eventBus","gridSnapping","modeling"],De(Zr,ve),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),q(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),q(e,r),e};var DN=2e3;function yE(e,t){e.on(["spaceTool.move","spaceTool.end"],DN,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)}})}yE.$inject=["eventBus","gridSnapping"];const LN={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Zr],gridSnappingSpaceToolBehavior:["type",yE]};var rp=10;function dg(e,t,n){return n||(n="round"),Math[n](e/t)*t}var IN=1200,BN=800;function dr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",BN,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"],IN,function(r){var a=r.originalEvent;if(!(!o.active||a&&ai(a))){var s=r.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=$N(r,l,e);p&&(u.offset=p);var f=NN(r,l);f&&q(u,f),Ya(r,l)||o.snapEvent(r,l,u)})}})}dr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);dn(e,t,i)},dr.prototype.getGridSpacing=function(){return rp},dr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=dg(e,rp);var i,o;return t&&t.min&&(i=t.min,Ke(i)&&(i=dg(i+n,rp,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,Ke(o)&&(o=dg(o+n,rp,"floor"),e=Math.min(e,o))),e-=n,e},dr.prototype.isActive=function(){return this.active},dr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},dr.prototype.toggleActive=function(){this.setActive(!this.active)},dr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function NN(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&&(ap(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&&(ap(t)?bE(s)?a.x.max=c.left:a.x.min=c.right:vE(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(ap(t)?bE(s)?a.x.min=l.left:a.x.max=l.right:vE(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function $N(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,a=r.snapLocation,s=r.snapOffset;return s&&Ke(s[t])||(s||(s=r.snapOffset={}),Ke(s[t])||(s[t]=0),!o)||(n.get(o.id)||(ap(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 ap(e){return e==="x"}function vE(e){return e.indexOf("n")!==-1}function bE(e){return e.indexOf("w")!==-1}const FN={__depends__:[LN],__init__:["gridSnapping"],gridSnapping:["type",dr]};var jN=2e3;function xE(e,t,n){e.on("autoPlace",jN,function(i){var o=i.source,r=Xe(o),a=i.shape,s=i_(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")&&(HN(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}xE.$inject=["eventBus","gridSnapping","elementRegistry"];function HN(e){return e==="x"}var zN=1750;function wE(e,t,n){t.on(["create.start","shape.move.start"],zN,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}))}})}wE.$inject=["canvas","eventBus","gridSnapping"];var GN=3e3;function sp(e,t,n){ve.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],GN,function(o){var r=o.context,a=r.connection,s=r.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||VN(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}sp.$inject=["eventBus","gridSnapping","modeling"],De(sp,ve),sp.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=qN(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function VN(e){return e.length>3}function WN(e){return e==="h"}function UN(e){return e==="v"}function qN(e,t,n){var i=bo(t,n),o={};return WN(i)&&(o.y=e.snapValue(t.y)),UN(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=q({},t,o),n=q({},n,o)),[t,n]}const YN={__depends__:[FN,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",xE],gridSnappingParticipantBehavior:["type",wE],gridSnappingLayoutConnectionBehavior:["type",sp]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",mE]};var KN=30,_E=30;function mc(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 ht(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(M(o,"bpmn:SubProcess"))return ht(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}mc.$inject=["eventBus","interactionEvents"],mc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},mc.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=En(e)?{width:KN,height:e.height}:{width:e.width,height:_E};return this._interactionEvents.createBoxHit(t,"all",n),!0},mc.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:_E}),!0};const XN={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",mc]};function cp(e){e.invoke(Ha,this)}De(cp,Ha),cp.$inject=["injector"],cp.prototype.registerBindings=function(e,t){Ha.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 ZN={__depends__:[Hh],__init__:["keyboardBindings"],keyboardBindings:["type",cp]};var QN={moveSpeed:1,moveSpeedAccelerated:10},JN=1500,EE="left",SE="up",RE="right",CE="down",e$={ArrowLeft:EE,Left:EE,ArrowUp:SE,Up:SE,ArrowRight:RE,Right:RE,ArrowDown:CE,Down:CE},t$={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 ME(e,t,n,i,o){var r=this;this._config=q({},QN,e||{}),t.addListener(JN,function(a){var s=a.keyEvent,c=e$[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=t$[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}ME.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const n$={__depends__:[Hh,Mi],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",ME]};var AE=10;function yc(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=Hk(u,p,l),c.newBounds=Gk(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:Ge(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=Pv(p),!i$(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)})}yc.prototype.canResize=function(e){var t=this._rules,n=$i(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},yc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=q({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,PE(t,r),"resize",{autoActivate:!0,cursor:o$(r),data:{shape:t,context:o}})},yc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:AE,height:AE},o=mb(t,e.childrenBoxPadding),Vk(n,t,i,o)},yc.$inject=["eventBus","rules","modeling","dragging"];function i$(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function PE(e,t){var n=Xe(e),i=Ge(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 o$(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 TE="djs-resizing",kE="resize-not-ok",r$=500;function OE(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,TE)),s.width>5&&Pe(c,{x:s.x,width:s.width}),s.height>5&&Pe(c,{y:s.y,height:s.height}),r.canExecute?dt(c).remove(kE):dt(c).add(kE)}function o(r){var a=r.shape,s=r.frame;s&&cn(r.frame),t.removeMarker(a,TE)}e.on("resize.move",r$,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}OE.$inject=["eventBus","canvas","previewSupport"];var lp=-6,up=8,pp=20,vc="djs-resizer",a$=["n","w","s","e","nw","ne","se","sw"];function hr(e,t,n,i){this._resize=i,this._canvas=t;var o=this;e.on("selection.changed",function(r){var a=r.newSelection;o.removeResizers(),a.length===1&&W(a,Zn(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}hr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){nr(r)&&i.activate(r,e,n)}je.bind(t,"mousedown",o),je.bind(t,"touchstart",o)},hr.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=s$(i),a=Ne("g");dt(a).add(vc),dt(a).add(vc+"-"+e.id),dt(a).add(vc+"-"+i),Je(o,a);var s=Ne("rect");Pe(s,{x:-up/2+r.x,y:-up/2+r.y,width:up,height:up}),dt(s).add(vc+"-visual"),Je(a,s);var c=Ne("rect");return Pe(c,{x:-pp/2+r.x,y:-pp/2+r.y,width:pp,height:pp}),dt(c).add(vc+"-hit"),Je(a,c),_l(a,t,n),a},hr.prototype.createResizer=function(e,t){var n=PE(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},hr.prototype.addResizer=function(e){var t=this;Lt(e)||W(a$,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},hr.prototype.removeResizers=function(){var e=this._getResizersParent();xs(e)},hr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},hr.$inject=["eventBus","canvas","selection","resize"];function s$(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-lp:e.indexOf("w")!==-1&&(t.x=lp),e.indexOf("s")!==-1?t.y=-lp:e.indexOf("n")!==-1&&(t.y=lp),t}const DE={__depends__:[oo,Ro,Na],__init__:["resize","resizePreview","resizeHandles"],resize:["type",yc],resizePreview:["type",OE],resizeHandles:["type",hr]};var c$=2e3;function bc(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"],c$,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||at(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}bc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],bc.prototype.activate=function(e){var t=vi(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);q(n,i);var o={},r=n.style||{};return q(r,{backgroundColor:null,border:null}),(at(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||LE(e))&&q(o,{centerVertically:!0}),Qo(e)&&(q(o,{resizable:!0,autoResize:!0}),q(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),M(e,"bpmn:TextAnnotation")&&(q(o,{resizable:!0,autoResize:!0}),q(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),q(n,{options:o,style:r}),n}},bc.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")||p$(e)){var g=En(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};q(r,h),q(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(u$(e)){var m=En(e),w=m?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:o.x-i.height/2,y:o.y-i.width/2};q(r,w),q(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)"})}(at(e,["bpmn:Task","bpmn:CallActivity"])||LE(e))&&(q(r,{width:i.width,height:i.height}),q(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),l$(e)&&(q(r,{width:i.width,x:i.x}),q(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var y=1,v=i.width+2*y;if(n.labelTarget&&(q(r,{width:v,height:i.height+2*y,x:i.x-y,y:i.y-y}),q(d,{fontSize:l+"px",lineHeight:u})),Qo(n)&&!Rl(n)&&!rt(n)){var x=Xf(e),E=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),A=l,D=Nr.width*a+2*y;q(r,{width:D,height:A+2*y,x:E.x-D/2,y:E.y-A/2-y}),q(d,{fontSize:l+"px",lineHeight:u})}return M(e,"bpmn:TextAnnotation")&&(q(r,{width:i.width+2*y,height:i.height+2*y,x:i.x-y,y:i.y-y,minWidth:30*a,minHeight:10*a}),q(d,{textAlign:"left",paddingTop:Ra*a+"px",paddingBottom:Ra*a+"px",paddingLeft:Ra*a+"px",paddingRight:Ra*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:r,style:d}},bc.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}),f$(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function LE(e){return M(e,"bpmn:SubProcess")&&!ht(e)}function l$(e){return M(e,"bpmn:SubProcess")&&ht(e)}function u$(e){return M(e,"bpmn:Participant")&&!ht(e)}function p$(e){return M(e,"bpmn:Participant")&&ht(e)}function f$(e){return!e||!e.trim()}var IE="djs-element-hidden",BE="djs-label-hidden";function NE(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=Ne("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=Ne("path");Pe(p,{d:u,strokeWidth:2,stroke:d$(r)}),Je(s,p),Je(o,s),Dn(s,r.x,r.y)}M(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,IE):(M(r,"bpmn:Task")||M(r,"bpmn:CallActivity")||M(r,"bpmn:SubProcess")||M(r,"bpmn:Participant")||M(r,"bpmn:Lane"))&&t.addMarker(r,BE)}),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}});Pe(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,IE),t.removeMarker(r,BE)),r=void 0,a=void 0,s&&(cn(s),s=void 0)})}NE.$inject=["eventBus","canvas","pathMap"];function d$(e,t){var n=yt(e);return n.get("stroke")||t||"black"}const h$={__depends__:[hh,DE,cE],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",bc],labelEditingPreview:["type",NE]};var g$=500,m$=1e3;function so(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){GP(r)||i.createOutline(r)}e.on("element.hover",function(r){o(r.element)}),e.on("selection.changed",function(r){W(r.newSelection,o)}),e.on(["shape.changed","connection.changed"],g$,function(r){var a=r.element,s=r.gfx,c=At(".djs-outline",s);c&&i.updateOutline(a,c)})}so.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=At(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Je(t,n),this.updateOutline(e,n)),n},so.prototype._createOutlineGfx=function(){var e=Ne("rect");return Pe(e,q({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},so.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},so.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&W(i,function(o){n=n||o.updateOutline(t,e)}),n||Pe(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},so.prototype.updateConnectionOutline=function(e,t){var n=ln(t);Pe(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},so.prototype.registerProvider=function(e,t){t||(t=e,e=m$),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},so.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},so.prototype.getOutline=function(e){var t,n=this._getProviders();return W(n,function(i){_n(i.getOutline)&&(t=t||i.getOutline(e))}),t},so.$inject=["eventBus","styles","elementRegistry"];var fp=6;function hg(e,t,n){this._canvas=t;var i=this;e.on("element.changed",function(o){n.isSelected(o.element)&&i._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(o){var r=o.newSelection;i._updateMultiSelectionOutline(r)})}hg.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");xs(t);var n=e.length>1,i=this._canvas.getContainer();if(dt(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=y$(ln(e)),r=Ne("rect");Pe(r,q({rx:3},o)),dt(r).add("djs-selection-outline"),Je(t,r)}},hg.$inject=["eventBus","canvas","selection"];function y$(e){return{x:e.x-fp,y:e.y-fp,width:e.width+fp*2,height:e.height+fp*2}}const gg={__depends__:[Mi],__init__:["outline","multiSelectionOutline"],outline:["type",so],multiSelectionOutline:["type",hg]},$E=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],FE={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},v$=15,dp=2;function jE(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=>at(g,$E));if(f.length===1){const g=f[0];rt(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(f.length===2){const g=f.find(rt),h=f.find(m=>{var w;return(w=m.labels)==null?void 0:w.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!at(p,$E)||!u(p)||(rt(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=Es([Xe(f),Xe(p)],FE),g=d.getAttribute("d"),m=o.isSelected(p)?c(p):l(p),w=Ms(m,g);if(!w)return;const v=o.isSelected(f)?c(f):l(f),x=Ms(v,g)||Xe(f);Ns(x,w)<v$||(zf(d,[x,w]),Je(r,d))}function s(){bs(`.${FE.class}`,r).forEach(cn)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+gr(f,"x")-dp,y:p.y+gr(f,"y")-dp,width:gr(f,"width")+dp*2,height:gr(f,"height")+dp*2};return Qf(d,gr(f,"rx"))}if(f.cx){const d=gr(f,"r"),g={x:p.x+gr(f,"cx")-d,y:p.y+gr(f,"cy")-d,width:d*2,height:d*2};return Jv(g)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}jE.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function gr(e,t){return parseFloat(Pe(e,t)||0)}const b$={__depends__:[Mi,gg],__init__:["labelLink"],labelLink:["type",jE]};var x$=new zr("tt");function w$(e){var t=zt('<div class="djs-tooltip-container" />');return qn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function _$(e,t,n){qn(e,{left:t+"px",top:n+"px"})}function mg(e,t){e.style.display=t===!1?"none":""}var HE="djs-tooltip",yg="."+HE;function Jn(e,t){this._eventBus=e,this._canvas=t,this._ids=x$,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=w$(t.getContainer());var n=this;ii.bind(this._tooltipRoot,yg,"mousedown",function(i){i.stopPropagation()}),ii.bind(this._tooltipRoot,yg,"mouseover",function(i){n.trigger("mouseover",i)}),ii.bind(this._tooltipRoot,yg,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Jn.$inject=["eventBus","canvas"],Jn.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=q({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Jn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Mn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Jn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Jn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Jn.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)}},Jn.prototype.remove=function(e){var t=this.get(e);t&&(Qi(t.html),Qi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Jn.prototype.show=function(){mg(this._tooltipRoot)},Jn.prototype.hide=function(){mg(this._tooltipRoot,!1)},Jn.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},Jn.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)),ei(n)&&(n=zt(n)),i=zt('<div data-tooltip-id="'+t+'" class="'+HE+'">'),qn(i,{position:"absolute"}),i.appendChild(n),e.type&&kt(i).add("djs-tooltip-"+e.type),e.className&&kt(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Jn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;_$(n,t.x,t.y)},Jn.prototype._updateTooltipVisibilty=function(e){W(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),mg(i,o))})},Jn.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 E$={__init__:["tooltips"],tooltips:["type",Jn]};var S$="flow elements must be children of pools/participants",R$="Data object must be placed within a pool/participant.";function zE(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(S$)):M(a,"bpmn:DataObjectReference")&&i(o,n(R$)))})}zE.$inject=["eventBus","tooltips","translate"];const C$={__depends__:[E$],__init__:["modelingFeedback"],modelingFeedback:["type",zE]};var M$=500,A$=1250,P$=1500,hp=Math.round;function T$(e){return{x:e.x+hp(e.width/2),y:e.y+hp(e.height/2)}}function GE(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",P$,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=k$(u),q(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",A$,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",M$,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=hp(l.x),l.y=hp(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(nr(s)){var c=Da(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(yn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!dt(s.target).has("djs-hit-no-move")){var p=T$(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}GE.$inject=["eventBus","dragging","modeling","selection","rules"];function k$(e){var t=sa(e,"id");return ct(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var VE=499,vg="djs-dragging",WE="drop-ok",UE="drop-not-ok",qE="new-parent",YE="attach-ok";function KE(e,t,n,i){function o(c){var l=r(c),u=O$(l);return u}function r(c){var l=Ss(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[YE,WE,UE,qE].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,vg),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",VE,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,f=o(u);if(!l.dragGroup){var d=Ne("g");Pe(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();Je(g,d),l.dragGroup=d}f.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=Op([p,r(u)]):p=r(u),W(p,function(h){t.addMarker(h,vg)}),l.allDraggedElements=p,l.differentParents=D$(u)}),e.on("shape.move.move",VE,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,YE):l.canExecute&&f&&p.id!==f.id?a(p,qE):a(p,l.canExecute?WE:UE)),Dn(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var l=c.context,u=l.target;u&&a(u,null)}),e.on("shape.move.cleanup",function(c){var l=c.context,u=l.allDraggedElements,p=l.dragGroup;W(u,function(f){t.removeMarker(f,vg)}),p&&cn(p)}),this.makeDraggable=s}KE.$inject=["eventBus","canvas","styles","previewSupport"];function O$(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=ct(e,function(i){return Lt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function D$(e){return DS(sa(e,function(t){return t.parent&&t.parent.id}))!==1}const L$={__depends__:[nu,Mi,gg,oo,Ro,Na],__init__:["move","movePreview"],move:["type",GE],movePreview:["type",KE]};var XE=".djs-palette-toggle",ZE=".entry",I$=XE+", "+ZE,bg="djs-palette-",B$="shown",xg="open",QE="two-column",N$=1e3;function hn(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var o=i.tool;n.updateToolHighlight(o)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}hn.$inject=["eventBus","canvas"],hn.prototype.registerProvider=function(e,t){t||(t=e,e=N$),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},hn.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(F$,{})},hn.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},hn.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=zt(hn.HTML_MARKUP);n.appendChild(i),kt(n).add(bg+B$),ii.bind(i,I$,"click",function(o){var r=o.delegateTarget;if(Of(r,XE))return e.toggle();e.trigger("click",o)}),je.bind(i,"mousedown",function(o){o.stopPropagation()}),ii.bind(i,ZE,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},hn.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},hn.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=kt(n),a=kt(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(QE,o),a.toggle(bg+QE,o),"open"in e&&(r.toggle(xg,e.open),a.toggle(bg+xg,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},hn.prototype._update=function(){var e=At(".djs-palette-entries",this._container),t=this._entries=this.getEntries();fl(e),W(t,function(n,i){var o=n.group||"default",r=At("[data-group="+Ur(o)+"]",e);r||(r=zt('<div class="group"></div>'),Mn(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=zt(a);if(r.appendChild(s),!n.separator&&(Mn(s,"data-action",i),n.title&&Mn(s,"title",n.title),n.className&&$$(s,n.className),n.imageUrl)){var c=zt("<img>");Mn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},hn.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=Mn(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},hn.prototype.triggerEntry=function(e,t,n,i){var o=this._entries,r,a;if(r=o[e],!!r&&(a=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:n})!==!1)){if(_n(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},hn.prototype._layoutChanged=function(){this._toggleState({})},hn.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},hn.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},hn.prototype.open=function(){this._toggleState({open:!0})},hn.prototype.toggle=function(){this.isOpen()?this.close():this.open()},hn.prototype.isActiveTool=function(e){return e&&this._activeTool===e},hn.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=At(".djs-palette-entries",this._container),this._toolsContainer=At("[data-group=tools]",t)),n=this._toolsContainer,W(n.children,function(i){var o=i.getAttribute("data-action");if(o){var r=kt(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},hn.prototype.isOpen=function(){return kt(this._container).has(xg)},hn.prototype._getParentContainer=function(){return this._canvas.getContainer()},hn.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function $$(e,t){var n=kt(e),i=Ye(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function F$(e,t){var n=t.getPaletteEntries();return _n(n)?n(e):(W(n,function(i,o){e[o]=i}),e)}const j$={__init__:["palette"],palette:["type",hn]};var JE="crosshair",e1="selected",H$="djs-dragging-active-lasso";function mr(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=Ne("rect");Pe(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Je(f,d),l(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&Pe(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,e1);for(const m of g)h.has(m)||t.addMarker(m,e1)}},remove:function(p){this.update(p),p.frame&&cn(p.frame),l(!1)}};function l(p){dt(t.getContainer()).toggle(H$,p)}function u(p){var f=i.getAll();return new Set(aa(xa(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=t1(p),f.add=Kl(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=t1(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(Kl(p))return s.activateLasso(p.originalEvent),!0})}mr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],mr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:JE,data:{context:{}},keepSelection:!0})},mr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:JE,data:{context:{}},keepSelection:!0})},mr.prototype._select=function(e){this._selection.select(e)},mr.prototype.select=function(e,t,n=[]){var i=aa(xa(e,t));this._select([...n,...i])},mr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},mr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function t1(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 z$={__depends__:[au,Gs],__init__:["lassoTool"],lassoTool:["type",mr]};var wg=1500,n1="grab";function Ka(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",wg,function(c){if(js(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(wg,function(c){if(!(!i1(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(wg,function(c){!i1(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!js(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Ka.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Ka.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:n1,data:{context:n||{}}})},Ka.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:n1,data:{context:{reactivate:n}}})},Ka.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Ka.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function i1(e){return bn("Space",e)}const G$={__depends__:[au,Gs],__init__:["handTool"],handTool:["type",Ka]};var o1="connect-ok",r1="connect-not-ok";function Xa(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?o1:r1))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?o1:r1)}),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})}Xa.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Xa.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Xa.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Xa.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Xa.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const V$={__depends__:[ug,oo,Ro,au,Gs],globalConnect:["type",Xa]};function _g(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)}_g.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],_g.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(w){var y=n.createShape(q({type:p},h));t.start(w,y)}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 q(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 W$={__depends__:[j$,ou,yw,z$,G$,V$,Ds],__init__:["paletteProvider"],paletteProvider:["type",_g]};var U$=250;function Eg(e,t,n,i,o){ve.call(this,e);function r(s){var c=s.canExecute.replacements;W(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);q(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=At('[data-element-id="'+Ur(f.id)+'"]',s.dragGroup);g&&Pe(g,{display:"none"});var h=o.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;W(c,function(l,u){var p=At('[data-element-id="'+Ur(u)+'"]',s.dragGroup);p&&Pe(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",U$,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}Eg.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],De(Eg,ve);const q$={__depends__:[Na],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Eg]};var Y$=1250,Sg=40,K$=20,X$=10,a1=20,s1=["x","y"],Z$=Math.abs;function c1(e){e.on(["connect.hover","connect.move","connect.end"],Y$,function(t){var n=t.context,i=n.canExecute,o=n.start,r=n.hover,a=n.source,s=n.target;t.originalEvent&&ai(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&r&&Q$(t,r,n5(r)),r&&t5(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Ti(o),at(r,["bpmn:Event","bpmn:Gateway"])&&l1(t,Ti(r)),at(r,["bpmn:Task","bpmn:SubProcess"])&&J$(t,r),M(a,"bpmn:BoundaryEvent")&&s===a.host&&e5(t)):u1(i,"bpmn:MessageFlow")?(M(o,"bpmn:Event")&&(n.connectionStart=Ti(o)),M(r,"bpmn:Event")&&l1(t,Ti(r))):n.connectionStart=n.initialConnectionStart)})}c1.$inject=["eventBus"];function Q$(e,t,n){s1.forEach(function(i){var o=p1(i,t);e[i]<t[i]+n?dn(e,i,t[i]+n):e[i]>t[i]+o-n&&dn(e,i,t[i]+o-n)})}function J$(e,t){var n=Ti(t);s1.forEach(function(i){i5(e,t,i)&&dn(e,i,n[i])})}function e5(e){var t=e.context,n=t.source,i=t.target;if(!o5(t)){var o=Ti(n),r=On(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;Z$(c-o[s])<Sg&&(c>o[s]?l=o[s]+Sg:l=o[s]-Sg,dn(e,s,l))})}}function l1(e,t){dn(e,"x",t.x),dn(e,"y",t.y)}function u1(e,t){return e&&e.type===t}function t5(e,t){return No(t,function(n){return u1(e,n)})}function p1(e,t){return e==="x"?t.width:t.height}function n5(e){return M(e,"bpmn:Task")?X$:K$}function i5(e,t,n){return e[n]>t[n]+a1&&e[n]<t[n]+p1(n,t)-a1}function o5(e){var t=e.hover,n=e.source;return t&&n&&t===n}function yr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}yr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},yr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},yr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},yr.prototype.getSnapLocations=function(){return this._snapLocations},yr.prototype.setSnapLocations=function(e){this._snapLocations=e},yr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new gp,n.initDefaults(this._defaultSnaps)),n};function gp(){this._snapValues={}}gp.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)},gp.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&UB(e[n],o[n],i)},gp.prototype.initDefaults=function(e){var t=this;W(e||{},function(n,i){W(n,function(o){t.add(i,o)})})};var r5=1250;function co(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"],r5,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&ai(o.originalEvent))&&!(Ya(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()})}co.$inject=["elementRegistry","eventBus","snapping"],co.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new yr);var r;t.get(i.id)?r=Ti(i,e):r={x:e.x+Ti(i).x,y:e.y+Ti(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}),rt(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},co.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return W(i,function(o){if(rt(o)){rt(t)&&e.add("mid",Ti(o));return}if(Lt(o)){if(o.waypoints.length<3)return;var r=o.waypoints.slice(1,-1);W(r,function(a){e.add("mid",a)});return}e.add("mid",Ti(o))}),!Ke(t.x)||!Ke(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Ti(t)),e},co.prototype.getSnapTargets=function(e,t){return Z0(t).filter(function(n){return!a5(n)})};function a5(e){return!!e.hidden}var f1=1500;function Za(e,t){t.invoke(co,this),e.on(["create.move","create.end"],f1,u5),e.on(["create.move","create.end","shape.move.move","shape.move.end"],f1,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!Ya(n)&&s5(n,r)})}De(Za,co),Za.$inject=["eventBus","injector"],Za.prototype.initSnap=function(e){var t=co.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return W(n.outgoing,function(o){var r=o.waypoints[0];r=r.original||r,t.setSnapOrigin(o.id+"-docking",h1(r,i,e))}),W(n.incoming,function(o){var r=o.waypoints[o.waypoints.length-1];r=r.original||r,t.setSnapOrigin(o.id+"-docking",h1(r,i,e))}),M(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Za.prototype.addSnapTargetPoints=function(e,t,n){co.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);W(i,function(r){(l5(r)||c5([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",K0(r)),e.add("bottom-right",X0(r)))});var o=this._elementRegistry;return W(t.incoming,function(r){if(o.get(t.id)){d1(i,r.source)||e.add("mid",Xe(r.source));var a=r.waypoints[0];e.add(r.id+"-docking",a.original||a)}}),W(t.outgoing,function(r){if(o.get(t.id)){d1(i,r.target)||e.add("mid",Xe(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},Za.prototype.getSnapTargets=function(e,t){return co.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!M(n,"bpmn:Lane")})};function s5(e,t){var n=Ge(t),i=dx(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=Xe(r),/top/.test(i)?dn(e,"y",n.top-a.y):/bottom/.test(i)&&dn(e,"y",n.bottom-a.y),/left/.test(i)?dn(e,"x",n.left-a.x):/right/.test(i)&&dn(e,"x",n.right-a.x)}function c5(e,t){return e.every(function(n){return M(n,t)})}function l5(e){return M(e,"bpmn:SubProcess")&&ht(e)?!0:M(e,"bpmn:Participant")}function u5(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)&&dn(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&dn(e,"y",e.y)}}function d1(e,t){return e.indexOf(t)!==-1}function h1(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var p5=1250;function xc(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],p5,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&ai(i.originalEvent))&&!Ya(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),h5(s)&&dn(i,"x",i.x),g5(s)&&dn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}xc.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new yr);var r=g1(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},xc.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return W(o,function(r){e.add("corner",X0(r)),e.add("corner",K0(r))}),e.add("corner",g1(t,i)),e},xc.$inject=["eventBus","snapping"],xc.prototype.getSnapTargets=function(e,t){return Z0(t).filter(function(n){return!f5(n,e)&&!Lt(n)&&!d5(n)&&!rt(n)})};function g1(e,t){var n=Xe(e),i=Ge(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 f5(e,t){return e.host===t}function d5(e){return!!e.hidden}function h5(e){return e==="n"||e==="s"}function g5(e){return e==="e"||e==="w"}var m5=7,y5=1e3;function vr(e){this._canvas=e,this._asyncHide=Lp(Zn(this.hide,this),y5)}vr.$inject=["canvas"],vr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:Ya(e,"x"),y:Ya(e,"y")};W(o,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(W(["x","y"],function(l){var u;r[l]||(u=t.snap(c,a,l,m5),u!==void 0&&(r[l]={value:u,originValue:u-s[l]}))}),r.x&&r.y)return!1}),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),W(["x","y"],function(a){var s=r[a];yn(s)&&dn(e,a,s.originValue)})},vr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Ne("path");return Pe(n,{d:"M0,0 L0,0"}),dt(n).add("djs-snap-line"),Je(t,n),{update:function(i){Ke(i)?e==="horizontal"?Pe(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Pe(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Pe(n,{display:"none"})}}},vr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},vr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},vr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},vr.prototype.hide=function(){W(this._snapLines,function(e){e.update()})};const v5={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",co],resizeSnapping:["type",xc],snapping:["type",vr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",c1],createMoveSnapping:["type",Za]};var m1=300;function it(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=At(it.INPUT_SELECTOR,this._container),this._resultsContainer=At(it.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}it.$inject=["canvas","eventBus","selection","translate"],it.prototype._bindEvents=function(){var e=this;function t(n,i,o,r){e._eventMaps.push({el:n,type:o,listener:ii.bind(n,i,o,r)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,it.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,it.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,it.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,it.INPUT_SELECTOR,"keydown",function(n){bn("ArrowUp",n)&&n.preventDefault(),bn("ArrowDown",n)&&n.preventDefault()}),t(this._container,it.INPUT_SELECTOR,"keyup",function(n){if(bn("Escape",n))return e.close();if(bn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(bn("ArrowUp",n))return e._scrollToDirection(!0);if(bn("ArrowDown",n))return e._scrollToDirection();bn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},it.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ii.unbind(e.el,e.type,e.listener)})},it.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=At(it.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},it.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},it.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)}},it.prototype._clearResults=function(){fl(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},it.prototype._getCurrentResult=function(){return At(it.RESULT_SELECTED_SELECTOR,this._resultsContainer)},it.prototype._createResultNode=function(e,t){var n=zt(it.RESULT_HTML);return e.primaryTokens.length>0&&y1(n,e.primaryTokens,it.RESULT_PRIMARY_HTML),y1(n,e.secondaryTokens,it.RESULT_SECONDARY_HTML),Mn(n,it.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},it.prototype.registerProvider=function(e){this._searchProvider=e},it.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,kt(this._canvas.getContainer()).add("djs-search-open"),kt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},it.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,kt(this._canvas.getContainer()).remove("djs-search-open"),kt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},it.prototype.toggle=function(){this.isOpen()?this.close():this.open()},it.prototype.isOpen=function(){return this._open},it.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&kt(t).remove(it.RESULT_SELECTED_CLASS);var n=Mn(e,it.RESULT_ID_ATTRIBUTE),i=this._results[n].element;kt(e).add(it.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:m1}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},it.prototype._select=function(e){var t=Mn(e,it.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:m1}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},it.prototype._getBoxHtml=function(){const e=zt(it.BOX_HTML),t=At(it.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function y1(e,t,n){var i=b5(t),o=zt(n);o.innerHTML=i,e.appendChild(o)}function b5(e){var t="";return e.forEach(function(n){var i=R_(n.value||n.matched||n.normal),o=n.match||n.matched;o?t+='<b class="'+it.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}it.CONTAINER_SELECTOR=".djs-search-container",it.INPUT_SELECTOR=".djs-search-input input",it.RESULTS_CONTAINER_SELECTOR=".djs-search-results",it.RESULT_SELECTOR=".djs-search-result",it.RESULT_SELECTED_CLASS="djs-search-result-selected",it.RESULT_SELECTED_SELECTOR="."+it.RESULT_SELECTED_CLASS,it.RESULT_ID_ATTRIBUTE="data-result-id",it.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",it.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>`,it.RESULT_HTML='<div class="djs-search-result"></div>',it.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',it.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const y5={__depends__:[ks,Tu,Mi],searchPad:["type",it]};function Sg(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Sg.$inject=["elementRegistry","searchPad","canvas","search"],Sg.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!rt(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:vi(i),id:i.id})),e,{keys:["label","id"]}).map(v5)};function v5(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const b5={__depends__:[y5,M0],__init__:["bpmnSearch"],bpmnSearch:["type",Sg]},x5="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",w5="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",_5={width:36,height:50},E5={width:50,height:50};function m1(e,t,n){return Ne("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Di=5;function dp(e,t){this._styles=t,e.registerProvider(this)}dp.$inject=["outline","styles"],dp.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(BT(e))return n=Ne("rect"),Pe(n,q({x:-Di,y:-Di,rx:4,width:e.width+Di*2,height:e.height+Di*2},t)),n;if(!rt(e))return M(e,"bpmn:Gateway")?(n=Ne("rect"),q(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Pe(n,q({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):at(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Ne("rect"),Pe(n,q({x:-Di,y:-Di,rx:14,width:e.width+Di*2,height:e.height+Di*2},t))):M(e,"bpmn:EndEvent")?(n=Ne("circle"),Pe(n,q({cx:e.width/2,cy:e.height/2,r:e.width/2+Di+1},t))):M(e,"bpmn:Event")?(n=Ne("circle"),Pe(n,q({cx:e.width/2,cy:e.height/2,r:e.width/2+Di},t))):M(e,"bpmn:DataObjectReference")&&y1(e,"bpmn:DataObjectReference")?n=m1(x5,{x:-6,y:-6},t):M(e,"bpmn:DataStoreReference")&&y1(e,"bpmn:DataStoreReference")&&(n=m1(w5,{x:-6,y:-6},t)),n},dp.prototype.updateOutline=function(e,t){if(!rt(e))return at(e,["bpmn:SubProcess","bpmn:Group"])?(Pe(t,{width:e.width+Di*2,height:e.height+Di*2}),!0):!!at(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function y1(e,t){var n;return t==="bpmn:DataObjectReference"?n=_5:t==="bpmn:DataStoreReference"&&(n=E5),e.width===n.width&&e.height===n.height}const S5={__depends__:[hg],__init__:["outlineProvider"],outlineProvider:["type",dp]};var R5='<?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 lo(e){_a.call(this,e)}De(lo,_a),lo.Viewer=pr,lo.NavigatedViewer=oc,lo.prototype.createDiagram=function(){return this.importXML(R5)},lo.prototype._interactionModules=[T_,O_,I_],lo.prototype._modelingModules=[TB,Eu,OB,o_,WB,lg,ZB,_N,ow,tu,CN,PN,WN,qN,YN,JN,p$,m$,Th,E$,k$,z$,V$,kE,g5,b5,S5],lo.prototype._modules=[].concat(pr.prototype._modules,lo.prototype._interactionModules,lo.prototype._modelingModules);var hp=50,C5=new Fr,v1={min:.2,max:4},M5=10,A5=.1,P5=250,T5=100,k5=2e3;function Bn(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=C5.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||mp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=gp({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);Rg(p,r._canvas),r._update()}function s(u){return function(f){var d=Cg(f);(!r._state._svgClientRect||mp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(d);var g=gp({x:d.x-r._state._svgClientRect.left,y:d.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),h=i.viewbox(),m=D5(g,h),w=r._viewportDom.getBoundingClientRect(),y={x:d.x-w.left+1,y:d.y-w.top+1};q(r._state,{cachedViewbox:h,initialDragPosition:{x:d.x,y:d.y},isDragging:!0,offsetViewport:m,offsetViewportDom:y,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),je.bind(document,"mousemove",c),je.bind(document,"mouseup",l)}}function c(u){var p=Cg(u);if(r._state.isDragging){(!r._state._svgClientRect||mp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var f=r._state.offsetViewportDom,d=r._state.viewportClientRect,g=r._state.parentClientRect;q(r._viewportDom.style,{top:p.y-f.y-g.top+"px",left:p.x-f.x-g.left+"px"});var h=x1(g,{top:p.y-f.y-g.top,left:p.x-f.x-g.left,width:d.width,height:d.height});q(r._overlay.style,{clipPath:h});var m=gp({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);Rg({x:m.x-r._state.offsetViewport.x,y:m.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=Cg(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),q(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),je.unbind(document,"mousemove",c),je.unbind(document,"mouseup",l))}je.bind(this._viewportDom,"mousedown",s(!1)),je.bind(this._svg,"mousedown",s(!0)),je.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||mp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!$5(u,r._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,f=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*F5(u.deltaY)*-p;if(r._state.zoomDelta+=f,Math.abs(r._state.zoomDelta)>A5){var d=f>0?1:-1,g=Math.log(i.zoom())/Math.log(10),h=j5(v1,M5*2),m=Math.round(g/h)*h;m+=h*d;var w=Math.pow(10,m);i.zoom(H5(v1,w),y),r._state.zoomDelta=0;var y=gp({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);Rg(y,r._canvas),r._update()}}}),je.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",P5,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)})}Bn.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],Bn.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");kt(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");kt(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");kt(o).add("map"),n.appendChild(o);var r=this._svg=Ne("svg");Pe(r,{width:"100%",height:"100%"}),Je(o,r);var a=this._elementsGroup=Ne("g");Je(r,a);var s=this._viewportGroup=Ne("g");Je(r,s);var c=this._viewport=Ne("rect");dt(c).add("viewport"),Je(s,c),je.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");kt(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");kt(u).add("overlay"),this._parent.appendChild(u)},Bn.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=Ke(this._config.debounceDelay)?this._config.debounceDelay:T5,n=Ke(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:k5,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)}},Bn.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)})}},Bn.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(w1(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-hp,o=o-hp,r=r+hp*2,a=a+hp*2,this._lastViewbox={x:i,y:o,width:r,height:a},Pe(this._svg,{viewBox:i+", "+o+", "+r+", "+a}),Pe(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};q(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var f=x1(l,p);q(this._overlay.style,{clipPath:f})}}},Bn.prototype.open=function(){q(this._state,{isOpen:!0}),kt(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};Mn(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Bn.prototype.close=function(){q(this._state,{isOpen:!1}),kt(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};Mn(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},Bn.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},Bn.prototype.isOpen=function(){return this._state.isOpen},Bn.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)}},Bn.prototype._updateElementId=function(e,t){try{var n=At("#"+Gr(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},Bn.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},Bn.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=At("#"+Gr(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=I5(e);return s!==-1?a?B5(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),O5(e)?(n=e.parent,i=0,o=0,typeof n.x<"u"&&typeof n.y<"u"&&(i=-n.x,o=-n.y),Pe(r,{transform:"translate("+i+" "+o+")"})):(i=e.x,o=e.y,a&&(n=e.parent,i-=n.x,o-=n.y),Pe(r,{transform:"translate("+i+" "+o+")"})),e.children&&e.children.length&&e.children.forEach(function(c){t._addElement(c)}),r}}},Bn.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&cn(t)},Bn.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=Xo(t),n)){var i=z5(Df(n));return Pe(i,{id:this._prefixId(e.id)}),i}},Bn.prototype._clear=function(){vs(this._elementsGroup)},Bn.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function O5(e){return e.waypoints}function D5(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 gp(e,t,n){var i=t.getBoundingClientRect(),o=L5(n,i.width/i.height),r=b1(e.x,0,i.width,o.x,o.x+o.width),a=b1(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function Rg(e,t){var n=t.viewbox(),i=n.width,o=n.height;t.viewbox({x:e.x-i/2,y:e.y-o/2,width:i,height:o})}function L5(e,t){var n=e.width/e.height,i=q({},{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;q(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;q(i,{x:s,width:a})}return i}function b1(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function I5(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function B5(e,t,n){var i=N5(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function N5(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function mp(e){return e.width===0&&e.height===0}function $5(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var F5=Math.sign||function(e){return e>=0?1:-1};function j5(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 H5(e,t){return Math.max(e.min,Math.min(e.max,t))}function x1(e,t){var n=[uo(t.left,t.top),uo(t.left+t.width,t.top),uo(t.left+t.width,t.top+t.height),uo(t.left,t.top+t.height),uo(t.left,e.height),uo(e.width,e.height),uo(e.width,0),uo(0,0),uo(0,e.height),uo(t.left,e.height)].join(", ");return"polygon("+n+")"}function uo(e,t){return e+"px "+t+"px"}function w1(e){return Bo(e,function(t){return yn(t)?w1(t):Ke(t)&&isFinite(t)})}function Cg(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function z5(e){return ys("[id]",e).forEach(function(t){t.remove()}),e}var G5={__init__:["minimap"],minimap:["type",Bn]};const _1={closed:"미니맵",open:"접기"};class E1{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(Nh,()=>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?_1.open:_1.closed)}}$n(E1,"$inject",["eventBus","minimap","canvas"]);const V5={__depends__:[G5],__init__:["minimapI18n"],minimapI18n:["type",E1]},W5=xe.defineComponent({__name:"BpmnModelerView",props:{xml:{},labelFontFamily:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=xe.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=ef(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 xe.onMounted(async()=>{a=new lo({container:r.value,moddleExtensions:Fc,additionalModules:[x_,V5,a_,l_],...i.labelFontFamily?{textRenderer:{defaultStyle:{fontFamily:i.labelFontFamily}}}:{}}),i.xml&&await s(i.xml),o("ready")}),xe.watch(()=>i.xml,l=>{l&&a&&s(l)}),xe.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(xe.openBlock(),xe.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},U5=Mg(W5,[["__scopeId","data-v-17ae2a23"]]),q5=["title","aria-expanded"],Y5=["title","onClick"],K5={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},X5={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},Z5={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},Q5={key:0,class:"bwl-validation__body"},J5={key:0,class:"bwl-validation__empty"},e3={key:1,class:"bwl-validation__empty"},t3={key:2,class:"bwl-validation__list"},n3=["onClick"],i3={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},o3={class:"bwl-validation__msg"},r3=["title"],a3=Mg(xe.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=xe.computed(()=>h_(n.issues.value,n.describeElement)),o=xe.computed(()=>g_(i.value)),r=g=>Fa(g,n.changeScope.value),a=xe.computed(()=>Bh(i.value,n.changeScope.value)),s=xe.ref({error:!0,warning:!0,info:!0}),c=xe.computed(()=>m_(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=xe.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)=>(xe.openBlock(),xe.createElementBlock("section",{class:xe.normalizeClass(["bwl-validation",{"is-open":l.value}])},[xe.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=m=>l.value=!l.value)},[xe.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(xe.openBlock(),xe.createElementBlock("svg",{class:xe.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[xe.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=xe.createElementVNode("span",null,"검증",-1))],8,q5),xe.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=xe.withModifiers(()=>{},["stop"]))},[(xe.openBlock(),xe.createElementBlock(xe.Fragment,null,xe.renderList(u,m=>xe.createElementVNode("button",{key:m,type:"button",class:xe.normalizeClass(["bwl-validation__count",[`is-${m}`,{"is-off":!s.value[m]}]]),title:l.value?`${p[m]} ${s.value[m]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:w=>f(m)},[(xe.openBlock(),xe.createElementBlock("svg",K5,[h[4]||(h[4]=xe.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),m==="error"?(xe.openBlock(),xe.createElementBlock("path",X5)):(xe.openBlock(),xe.createElementBlock("path",Z5))])),xe.createElementVNode("span",null,xe.toDisplayString(o.value[m]),1)],10,Y5)),64))])]),l.value?(xe.openBlock(),xe.createElementBlock("div",Q5,[i.value.length===0?(xe.openBlock(),xe.createElementBlock("p",J5,"발견된 문제가 없습니다.")):c.value.length===0?(xe.openBlock(),xe.createElementBlock("p",e3," 선택한 심각도에 해당하는 항목이 없습니다. ")):(xe.openBlock(),xe.createElementBlock("ul",t3,[(xe.openBlock(!0),xe.createElementBlock(xe.Fragment,null,xe.renderList(c.value,m=>(xe.openBlock(),xe.createElementBlock("li",{key:m.key,class:xe.normalizeClass(["bwl-validation__item",[`is-${m.severity}`,{"is-clickable":m.targetRefs.length>0}]]),onClick:w=>d(m)},[h[5]||(h[5]=xe.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(m)?(xe.openBlock(),xe.createElementBlock("span",i3,"이번 변경")):xe.createCommentVNode("",!0),xe.createElementVNode("span",o3,xe.toDisplayString(m.message),1),xe.createElementVNode("span",{class:"bwl-validation__cat",title:m.code},xe.toDisplayString(m.category),9,r3)],10,n3))),128))]))])):xe.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),s3={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},c3=["aria-checked","title","data-locale","onClick"],l3={class:"bwl-locale__label"},u3={key:0,class:"bwl-locale__badge"},p3=Mg(xe.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=xe.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?(xe.openBlock(),xe.createElementBlock("div",s3,[(xe.openBlock(!0),xe.createElementBlock(xe.Fragment,null,xe.renderList(o.value,s=>(xe.openBlock(),xe.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:xe.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=>xe.unref(n).setDisplayLocale(s.locale)},[xe.createElementVNode("span",l3,xe.toDisplayString(s.label),1),s.pending>0?(xe.openBlock(),xe.createElementBlock("span",u3,xe.toDisplayString(s.pending),1)):xe.createCommentVNode("",!0)],10,c3))),128))])):xe.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);te.ADDABLE_FLOW_NODE_TYPES=Cc,te.APPLY_BPMN_OPS_SCHEMA=JS,te.BPMN_EVENT_DEFINITION_TYPES=Ac,te.BPMN_MODDLE_EXTENSIONS=Fc,te.BWL_MODDLE_SCHEMA=Wg,te.BWL_NS=Vg,te.BWL_PREFIX=Ap,te.BWL_REVIEW_REQUEST_TYPE=Tc,te.BWL_SIDES=Pp,te.BpmnDisplayLocaleSwitcher=p3,te.BpmnModelerView=U5,te.BpmnValidationPanel=a3,te.EDITOR=SA,te.FLOW_LABEL_INDENT=Rm,te.GROUP_BORDER_MIN_RUN=tf,te.GROUP_BORDER_NEAR=da,te.HEADLESS_BPMN_MODULES=u_,te.HEADLESS_TEXT_METRICS=pa,te.I18N_DISPLAY_REDRAWN_EVENT=Nh,te.I18N_NS=IS,te.I18N_PREFIX=Xg,te.I18N_REVIEW_REQUESTED_CLASS=v_,te.I18N_TRANSLATION_TYPE=Sr,te.I18N_UNTRANSLATED_CLASS=y_,te.I18nDisplay=$h,te.I18nDisplayModule=x_,te.IR_EVENT_DEFINITIONS=Mc,te.IR_FLOW_NODE_TYPES=_r,te.IR_TEXT_LOCALES=Pc,te.LABEL_FORK_MARGIN=rf,te.LABEL_SHAPE_MIN_DEPTH=Nm,te.SET_TRANSLATIONS_COMMAND=Np,te.SEVERITY_ORDER=Ih,te.SYMBOLIC_OP_KINDS=Zg,te.SYMBOLIC_OP_SCHEMA=Qg,te.SetTranslationsHandler=$p,te.TranslationCommands=jp,te.TranslationCommandsModule=Hp,te.TranslationStateIndex=kA,te.UNDO_EPISODE_COMMAND=Tp,te.UPDATE_TRANSLATION_COMMAND=Dc,te.UpdateTranslationHandler=Bp,te.applyBpmnOpBatch=Gy,te.applyBpmnOps=Iy,te.applyLocaleBackfill=TA,te.applyTranslationLocaleRestore=BA,te.approximateTextWidth=fa,te.auditBpmnGeometry=jm,te.auditBpmnGeometryXml=KC,te.auditBpmnSemantics=Cf,te.auditBpmnSemanticsXml=fA,te.auditGeometry=ft,te.auditTargetsOf=Hn,te.axisSegmentsOf=sn,te.blackBoxNameRect=nf,te.buildBpmnOpBatch=xA,te.buildRegistryIndex=zm,te.collectTranslationStates=Xy,te.containerBoundarySegments=ga,te.countBySeverity=g_,te.createBpmnEditorController=RA,te.createBpmnModdle=ym,te.createHeadlessBpmnModeler=aI,te.crossedShapesOf=Vt,te.crossingCost=gi,te.describeProcess=Fy,te.describeProcessXml=aA,te.diffBpmnElements=zy,te.diffBpmnElementsXml=vA,te.documentLocalesOf=as,te.edgeCrossCount=ps,te.edgeCrossingPairsOf=mo,te.edgeCrossingStatsOf=Om,te.executeAsUndoEpisode=qg,te.followMovedEdgeLabels=gy,te.forwardThreePointCandidates=Uc,te.geometryFindingKey=pt,te.inferScriptLocale=cl,te.installHeadlessBpmnDom=bm,te.irEventDefinitionOf=Mp,te.isAddableFlowNodeType=zg,te.isChangeScopeMixed=Bh,te.isEdgeOverlapFinding=of,te.isInChangeScope=Fa,te.isIrEventDefinition=Gg,te.isIrFlowNodeType=Hg,te.isIrTextLocale=RS,te.labelRectsOf=Go,te.labelShapeDepth=$m,te.labelSlot=Rr,te.lineCrossesLabel=Fi,te.lineThroughLabel=Mm,te.lineThroughShapeLabel=Bm,te.loadBpmnXml=ua,te.localeTextsOf=Ip,te.lowerOps=Oy,te.oppositeOverlapCount=IC,te.oppositeOverlapOf=Sm,te.planBackEdgeBoundaryClearance=ty,te.planCrossPoolRoute=Xm,te.planEdgeRepair=Yc,te.planLabelLineClearance=xf,te.planLabelPlacement=fy,te.planLocaleBackfill=PA,te.planMiddleSegmentShifts=Vm,te.planOppositeOverlapRepair=ry,te.planSegmentDetours=Wc,te.planShapeLabelClearance=vy,te.planTranslationLocaleRestore=IA,te.poolOverlapsOf=cf,te.redockIntroducedDetachedEndpoints=xy,te.repairIntroducedBoundaryHugging=ny,te.repairIntroducedCrossings=pf,te.repairIntroducedEdgeCrossings=Wm,te.repairIntroducedFakeMerges=sy,te.repairIntroducedLabelLines=my,te.repairIntroducedOppositeOverlaps=py,te.repairIntroducedShapeLabelLines=by,te.repairIntroducedSharedSegmentLabels=yy,te.rerouteIntroducedCrossPoolEdges=Zm,te.resolverServicesOf=Ry,te.reviewRequestValuesOf=Fp,te.reviewRequestsOf=Fo,te.rootLangOf=Lp,te.saveBpmnXml=EC,te.sceneCrossingCost=km,te.sceneFromDefinitions=Fm,te.sceneFromRegistry=ze,te.segmentShapeClearance=Tr,te.shapesUnderLabel=fs,te.sharedEndpointCrossingPairsOf=ji,te.sharedSegmentUnderLabel=Vc,te.sharedSpansOf=Gc,te.sortPanelIssues=m_,te.toPanelIssues=h_,te.touchedElements=bA,te.translationLocale=Cn,te.translationsOf=$o,te.unreadableOverlapCount=hi,te.unreadableOverlapOf=Pr,te.validateOps=Sy,te.warningMessages=ef,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})}));
|
|
343
|
+
</div>`,it.RESULT_HTML='<div class="djs-search-result"></div>',it.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',it.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const x5={__depends__:[Ds,Du,Mi],searchPad:["type",it]};function Rg(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Rg.$inject=["elementRegistry","searchPad","canvas","search"],Rg.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!rt(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:vi(i),id:i.id})),e,{keys:["label","id"]}).map(w5)};function w5(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const _5={__depends__:[x5,P0],__init__:["bpmnSearch"],bpmnSearch:["type",Rg]},E5="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",S5="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",R5={width:36,height:50},C5={width:50,height:50};function v1(e,t,n){return Ne("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Di=5;function mp(e,t){this._styles=t,e.registerProvider(this)}mp.$inject=["outline","styles"],mp.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(FT(e))return n=Ne("rect"),Pe(n,q({x:-Di,y:-Di,rx:4,width:e.width+Di*2,height:e.height+Di*2},t)),n;if(!rt(e))return M(e,"bpmn:Gateway")?(n=Ne("rect"),q(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Pe(n,q({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):at(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Ne("rect"),Pe(n,q({x:-Di,y:-Di,rx:14,width:e.width+Di*2,height:e.height+Di*2},t))):M(e,"bpmn:EndEvent")?(n=Ne("circle"),Pe(n,q({cx:e.width/2,cy:e.height/2,r:e.width/2+Di+1},t))):M(e,"bpmn:Event")?(n=Ne("circle"),Pe(n,q({cx:e.width/2,cy:e.height/2,r:e.width/2+Di},t))):M(e,"bpmn:DataObjectReference")&&b1(e,"bpmn:DataObjectReference")?n=v1(E5,{x:-6,y:-6},t):M(e,"bpmn:DataStoreReference")&&b1(e,"bpmn:DataStoreReference")&&(n=v1(S5,{x:-6,y:-6},t)),n},mp.prototype.updateOutline=function(e,t){if(!rt(e))return at(e,["bpmn:SubProcess","bpmn:Group"])?(Pe(t,{width:e.width+Di*2,height:e.height+Di*2}),!0):!!at(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function b1(e,t){var n;return t==="bpmn:DataObjectReference"?n=R5:t==="bpmn:DataStoreReference"&&(n=C5),e.width===n.width&&e.height===n.height}const M5={__depends__:[gg],__init__:["outlineProvider"],outlineProvider:["type",mp]};var A5='<?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 lo(e){Ea.call(this,e)}De(lo,Ea),lo.Viewer=pr,lo.NavigatedViewer=ac,lo.prototype.createDiagram=function(){return this.importXML(A5)},lo.prototype._interactionModules=[O_,L_,N_],lo.prototype._modelingModules=[DB,Cu,IB,a_,YB,ug,eN,RN,aw,ou,PN,ON,YN,XN,ZN,n$,h$,b$,kh,C$,L$,W$,q$,DE,v5,_5,M5],lo.prototype._modules=[].concat(pr.prototype._modules,lo.prototype._interactionModules,lo.prototype._modelingModules);var yp=50,P5=new zr,x1={min:.2,max:4},T5=10,k5=.1,O5=250,D5=100,L5=2e3;function Bn(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=P5.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||bp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=vp({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);Cg(p,r._canvas),r._update()}function s(u){return function(f){var d=Mg(f);(!r._state._svgClientRect||bp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(d);var g=vp({x:d.x-r._state._svgClientRect.left,y:d.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),h=i.viewbox(),m=B5(g,h),w=r._viewportDom.getBoundingClientRect(),y={x:d.x-w.left+1,y:d.y-w.top+1};q(r._state,{cachedViewbox:h,initialDragPosition:{x:d.x,y:d.y},isDragging:!0,offsetViewport:m,offsetViewportDom:y,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),je.bind(document,"mousemove",c),je.bind(document,"mouseup",l)}}function c(u){var p=Mg(u);if(r._state.isDragging){(!r._state._svgClientRect||bp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var f=r._state.offsetViewportDom,d=r._state.viewportClientRect,g=r._state.parentClientRect;q(r._viewportDom.style,{top:p.y-f.y-g.top+"px",left:p.x-f.x-g.left+"px"});var h=_1(g,{top:p.y-f.y-g.top,left:p.x-f.x-g.left,width:d.width,height:d.height});q(r._overlay.style,{clipPath:h});var m=vp({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);Cg({x:m.x-r._state.offsetViewport.x,y:m.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=Mg(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),q(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),je.unbind(document,"mousemove",c),je.unbind(document,"mouseup",l))}je.bind(this._viewportDom,"mousedown",s(!1)),je.bind(this._svg,"mousedown",s(!0)),je.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||bp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!H5(u,r._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,f=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*z5(u.deltaY)*-p;if(r._state.zoomDelta+=f,Math.abs(r._state.zoomDelta)>k5){var d=f>0?1:-1,g=Math.log(i.zoom())/Math.log(10),h=G5(x1,T5*2),m=Math.round(g/h)*h;m+=h*d;var w=Math.pow(10,m);i.zoom(V5(x1,w),y),r._state.zoomDelta=0;var y=vp({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);Cg(y,r._canvas),r._update()}}}),je.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",O5,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)})}Bn.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],Bn.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");kt(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");kt(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");kt(o).add("map"),n.appendChild(o);var r=this._svg=Ne("svg");Pe(r,{width:"100%",height:"100%"}),Je(o,r);var a=this._elementsGroup=Ne("g");Je(r,a);var s=this._viewportGroup=Ne("g");Je(r,s);var c=this._viewport=Ne("rect");dt(c).add("viewport"),Je(s,c),je.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");kt(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");kt(u).add("overlay"),this._parent.appendChild(u)},Bn.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=Ke(this._config.debounceDelay)?this._config.debounceDelay:D5,n=Ke(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:L5,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)}},Bn.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)})}},Bn.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(E1(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-yp,o=o-yp,r=r+yp*2,a=a+yp*2,this._lastViewbox={x:i,y:o,width:r,height:a},Pe(this._svg,{viewBox:i+", "+o+", "+r+", "+a}),Pe(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};q(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var f=_1(l,p);q(this._overlay.style,{clipPath:f})}}},Bn.prototype.open=function(){q(this._state,{isOpen:!0}),kt(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};Mn(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Bn.prototype.close=function(){q(this._state,{isOpen:!1}),kt(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};Mn(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},Bn.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},Bn.prototype.isOpen=function(){return this._state.isOpen},Bn.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)}},Bn.prototype._updateElementId=function(e,t){try{var n=At("#"+Ur(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},Bn.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},Bn.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=At("#"+Ur(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=$5(e);return s!==-1?a?F5(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),I5(e)?(n=e.parent,i=0,o=0,typeof n.x<"u"&&typeof n.y<"u"&&(i=-n.x,o=-n.y),Pe(r,{transform:"translate("+i+" "+o+")"})):(i=e.x,o=e.y,a&&(n=e.parent,i-=n.x,o-=n.y),Pe(r,{transform:"translate("+i+" "+o+")"})),e.children&&e.children.length&&e.children.forEach(function(c){t._addElement(c)}),r}}},Bn.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&cn(t)},Bn.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=Xo(t),n)){var i=W5(Lf(n));return Pe(i,{id:this._prefixId(e.id)}),i}},Bn.prototype._clear=function(){xs(this._elementsGroup)},Bn.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function I5(e){return e.waypoints}function B5(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 vp(e,t,n){var i=t.getBoundingClientRect(),o=N5(n,i.width/i.height),r=w1(e.x,0,i.width,o.x,o.x+o.width),a=w1(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function Cg(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 N5(e,t){var n=e.width/e.height,i=q({},{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;q(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;q(i,{x:s,width:a})}return i}function w1(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function $5(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function F5(e,t,n){var i=j5(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function j5(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function bp(e){return e.width===0&&e.height===0}function H5(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var z5=Math.sign||function(e){return e>=0?1:-1};function G5(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 V5(e,t){return Math.max(e.min,Math.min(e.max,t))}function _1(e,t){var n=[uo(t.left,t.top),uo(t.left+t.width,t.top),uo(t.left+t.width,t.top+t.height),uo(t.left,t.top+t.height),uo(t.left,e.height),uo(e.width,e.height),uo(e.width,0),uo(0,0),uo(0,e.height),uo(t.left,e.height)].join(", ");return"polygon("+n+")"}function uo(e,t){return e+"px "+t+"px"}function E1(e){return Bo(e,function(t){return yn(t)?E1(t):Ke(t)&&isFinite(t)})}function Mg(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function W5(e){return bs("[id]",e).forEach(function(t){t.remove()}),e}var U5={__init__:["minimap"],minimap:["type",Bn]};const S1={closed:"미니맵",open:"접기"};class R1{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on($h,()=>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?S1.open:S1.closed)}}$n(R1,"$inject",["eventBus","minimap","canvas"]);const q5={__depends__:[U5],__init__:["minimapI18n"],minimapI18n:["type",R1]},Y5=we.defineComponent({__name:"BpmnModelerView",props:{xml:{},labelFontFamily:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=we.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=tf(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 we.onMounted(async()=>{a=new lo({container:r.value,moddleExtensions:zc,additionalModules:[__,q5,c_,p_],...i.labelFontFamily?{textRenderer:{defaultStyle:{fontFamily:i.labelFontFamily}}}:{}}),i.xml&&await s(i.xml),o("ready")}),we.watch(()=>i.xml,l=>{l&&a&&s(l)}),we.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(we.openBlock(),we.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),Ag=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},K5=Ag(Y5,[["__scopeId","data-v-17ae2a23"]]),X5=["title","aria-expanded"],Z5=["title","onClick"],Q5={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},J5={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},e3={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},t3={key:0,class:"bwl-validation__body"},n3={key:0,class:"bwl-validation__empty"},i3={key:1,class:"bwl-validation__empty"},o3={key:2,class:"bwl-validation__list"},r3=["onClick"],a3={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},s3={class:"bwl-validation__msg"},c3=["title"],l3=Ag(we.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=we.computed(()=>m_(n.issues.value,n.describeElement)),o=we.computed(()=>y_(i.value)),r=g=>ja(g,n.changeScope.value),a=we.computed(()=>Nh(i.value,n.changeScope.value)),s=we.ref({error:!0,warning:!0,info:!0}),c=we.computed(()=>v_(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=we.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)=>(we.openBlock(),we.createElementBlock("section",{class:we.normalizeClass(["bwl-validation",{"is-open":l.value}])},[we.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=m=>l.value=!l.value)},[we.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(we.openBlock(),we.createElementBlock("svg",{class:we.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[we.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=we.createElementVNode("span",null,"검증",-1))],8,X5),we.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=we.withModifiers(()=>{},["stop"]))},[(we.openBlock(),we.createElementBlock(we.Fragment,null,we.renderList(u,m=>we.createElementVNode("button",{key:m,type:"button",class:we.normalizeClass(["bwl-validation__count",[`is-${m}`,{"is-off":!s.value[m]}]]),title:l.value?`${p[m]} ${s.value[m]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:w=>f(m)},[(we.openBlock(),we.createElementBlock("svg",Q5,[h[4]||(h[4]=we.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),m==="error"?(we.openBlock(),we.createElementBlock("path",J5)):(we.openBlock(),we.createElementBlock("path",e3))])),we.createElementVNode("span",null,we.toDisplayString(o.value[m]),1)],10,Z5)),64))])]),l.value?(we.openBlock(),we.createElementBlock("div",t3,[i.value.length===0?(we.openBlock(),we.createElementBlock("p",n3,"발견된 문제가 없습니다.")):c.value.length===0?(we.openBlock(),we.createElementBlock("p",i3," 선택한 심각도에 해당하는 항목이 없습니다. ")):(we.openBlock(),we.createElementBlock("ul",o3,[(we.openBlock(!0),we.createElementBlock(we.Fragment,null,we.renderList(c.value,m=>(we.openBlock(),we.createElementBlock("li",{key:m.key,class:we.normalizeClass(["bwl-validation__item",[`is-${m.severity}`,{"is-clickable":m.targetRefs.length>0}]]),onClick:w=>d(m)},[h[5]||(h[5]=we.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(m)?(we.openBlock(),we.createElementBlock("span",a3,"이번 변경")):we.createCommentVNode("",!0),we.createElementVNode("span",s3,we.toDisplayString(m.message),1),we.createElementVNode("span",{class:"bwl-validation__cat",title:m.code},we.toDisplayString(m.category),9,c3)],10,r3))),128))]))])):we.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),u3={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},p3=["aria-checked","title","data-locale","onClick"],f3={class:"bwl-locale__label"},d3={key:0,class:"bwl-locale__badge"},h3=Ag(we.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=we.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?(we.openBlock(),we.createElementBlock("div",u3,[(we.openBlock(!0),we.createElementBlock(we.Fragment,null,we.renderList(o.value,s=>(we.openBlock(),we.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:we.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=>we.unref(n).setDisplayLocale(s.locale)},[we.createElementVNode("span",f3,we.toDisplayString(s.label),1),s.pending>0?(we.openBlock(),we.createElementBlock("span",d3,we.toDisplayString(s.pending),1)):we.createCommentVNode("",!0)],10,p3))),128))])):we.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);ne.ADDABLE_FLOW_NODE_TYPES=Pc,ne.APPLY_BPMN_OPS_SCHEMA=nR,ne.BPMN_EVENT_DEFINITION_TYPES=kc,ne.BPMN_MODDLE_EXTENSIONS=zc,ne.BWL_MODDLE_SCHEMA=qg,ne.BWL_NS=Ug,ne.BWL_PREFIX=Pp,ne.BWL_REVIEW_REQUEST_TYPE=Dc,ne.BWL_SIDES=Tp,ne.BpmnDisplayLocaleSwitcher=h3,ne.BpmnModelerView=K5,ne.BpmnValidationPanel=l3,ne.EDITOR=MA,ne.FLOW_LABEL_INDENT=Mm,ne.GROUP_BORDER_MIN_RUN=nf,ne.GROUP_BORDER_NEAR=ha,ne.HEADLESS_BPMN_MODULES=f_,ne.HEADLESS_TEXT_METRICS=fa,ne.I18N_DISPLAY_REDRAWN_EVENT=$h,ne.I18N_NS=$S,ne.I18N_PREFIX=Qg,ne.I18N_REVIEW_REQUESTED_CLASS=x_,ne.I18N_TRANSLATION_TYPE=Mr,ne.I18N_UNTRANSLATED_CLASS=b_,ne.I18nDisplay=Fh,ne.I18nDisplayModule=__,ne.IR_EVENT_DEFINITIONS=Tc,ne.IR_FLOW_NODE_TYPES=Rr,ne.IR_TEXT_LOCALES=Oc,ne.LABEL_FORK_MARGIN=af,ne.LABEL_SHAPE_MIN_DEPTH=Fm,ne.SET_TRANSLATIONS_COMMAND=$p,ne.SEVERITY_ORDER=Bh,ne.SYMBOLIC_OP_KINDS=Jg,ne.SYMBOLIC_OP_SCHEMA=em,ne.SetTranslationsHandler=Fp,ne.TranslationCommands=Hp,ne.TranslationCommandsModule=zp,ne.TranslationStateIndex=LA,ne.UNDO_EPISODE_COMMAND=kp,ne.UPDATE_TRANSLATION_COMMAND=Bc,ne.UpdateTranslationHandler=Np,ne.applyBpmnOpBatch=Wy,ne.applyBpmnOps=Ny,ne.applyLocaleBackfill=DA,ne.applyTranslationLocaleRestore=FA,ne.approximateTextWidth=da,ne.auditBpmnGeometry=zm,ne.auditBpmnGeometryXml=QC,ne.auditBpmnSemantics=Mf,ne.auditBpmnSemanticsXml=gA,ne.auditGeometry=ft,ne.auditTargetsOf=Hn,ne.axisSegmentsOf=sn,ne.blackBoxNameRect=of,ne.buildBpmnOpBatch=EA,ne.buildRegistryIndex=Vm,ne.collectTranslationStates=Qy,ne.containerBoundarySegments=ma,ne.countBySeverity=y_,ne.createBpmnEditorController=AA,ne.createBpmnModdle=bm,ne.createHeadlessBpmnModeler=lI,ne.crossedShapesOf=Vt,ne.crossingCost=gi,ne.describeProcess=Hy,ne.describeProcessXml=lA,ne.diffBpmnElements=Vy,ne.diffBpmnElementsXml=wA,ne.documentLocalesOf=cs,ne.edgeCrossCount=ds,ne.edgeCrossingPairsOf=mo,ne.edgeCrossingStatsOf=Lm,ne.executeAsUndoEpisode=Kg,ne.followMovedEdgeLabels=yy,ne.forwardThreePointCandidates=Kc,ne.geometryFindingKey=pt,ne.inferScriptLocale=pl,ne.installHeadlessBpmnDom=wm,ne.irEventDefinitionOf=Ap,ne.isAddableFlowNodeType=Vg,ne.isChangeScopeMixed=Nh,ne.isEdgeOverlapFinding=rf,ne.isInChangeScope=ja,ne.isIrEventDefinition=Wg,ne.isIrFlowNodeType=Gg,ne.isIrTextLocale=AS,ne.labelRectsOf=Go,ne.labelShapeDepth=jm,ne.labelSlot=Ar,ne.lineCrossesLabel=Fi,ne.lineThroughLabel=Pm,ne.lineThroughShapeLabel=$m,ne.loadBpmnXml=pa,ne.localeTextsOf=Bp,ne.lowerOps=Ly,ne.oppositeOverlapCount=$C,ne.oppositeOverlapOf=Cm,ne.planBackEdgeBoundaryClearance=iy,ne.planCrossPoolRoute=Qm,ne.planEdgeRepair=Zc,ne.planLabelLineClearance=wf,ne.planLabelPlacement=hy,ne.planLocaleBackfill=OA,ne.planMiddleSegmentShifts=Um,ne.planOppositeOverlapRepair=sy,ne.planSegmentDetours=Yc,ne.planShapeLabelClearance=xy,ne.planTranslationLocaleRestore=$A,ne.poolOverlapsOf=lf,ne.redockIntroducedDetachedEndpoints=_y,ne.repairIntroducedBoundaryHugging=oy,ne.repairIntroducedCrossings=ff,ne.repairIntroducedEdgeCrossings=qm,ne.repairIntroducedFakeMerges=ly,ne.repairIntroducedLabelLines=vy,ne.repairIntroducedOppositeOverlaps=dy,ne.repairIntroducedShapeLabelLines=wy,ne.repairIntroducedSharedSegmentLabels=by,ne.rerouteIntroducedCrossPoolEdges=Jm,ne.resolverServicesOf=My,ne.reviewRequestValuesOf=jp,ne.reviewRequestsOf=Fo,ne.rootLangOf=Ip,ne.saveBpmnXml=CC,ne.sceneCrossingCost=Dm,ne.sceneFromDefinitions=Hm,ne.sceneFromRegistry=ze,ne.segmentShapeClearance=Dr,ne.shapesUnderLabel=hs,ne.sharedEndpointCrossingPairsOf=ji,ne.sharedSegmentUnderLabel=qc,ne.sharedSpansOf=Uc,ne.sortPanelIssues=v_,ne.toPanelIssues=m_,ne.touchedElements=_A,ne.translationLocale=Cn,ne.translationsOf=$o,ne.unreadableOverlapCount=hi,ne.unreadableOverlapOf=Or,ne.validateOps=Cy,ne.warningMessages=tf,Object.defineProperty(ne,Symbol.toStringTag,{value:"Module"})}));
|