@g1cloud/bpmn-modeler-next 5.0.0-beta.37 → 5.0.0-beta.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
1
- (function(ee,ve){typeof exports=="object"&&typeof module<"u"?ve(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],ve):(ee=typeof globalThis<"u"?globalThis:ee||self,ve(ee.BpmnModeler={},ee.Vue))})(this,(function(ee,ve){"use strict";var h3=Object.defineProperty;var g3=(ee,ve,br)=>ve in ee?h3(ee,ve,{enumerable:!0,configurable:!0,writable:!0,value:br}):ee[ve]=br;var zn=(ee,ve,br)=>g3(ee,typeof ve!="symbol"?ve+"":ve,br);const br=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],wc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function Ag(e){return br.includes(e)}function Pg(e){return wc.includes(e)}const Ec=["timer"],Sc={timer:"bpmn:TimerEventDefinition"};function Tg(e){return typeof e=="string"&&Ec.includes(e)}function vp(e){if(e.length===1)return Ec.find(t=>Sc[t]===e[0])}const Rc=["ko","en","ja","zh"];function eS(e){return typeof e=="string"&&Rc.includes(e)}const kg="http://g1project.net/spec/bpmn/bwl/1.0",bp="bwl",xp=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Cc="bwl:ReviewRequest",Og={name:"bwl-hints",uri:kg,prefix:bp,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"}]}]},_p="bwl.undoEpisode",Dg=new WeakSet;function tS(e){Dg.has(e)||(e.register(_p,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Dg.add(e))}function Lg(e,t){tS(e);const n={run:t};if(e.execute(_p,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function wp(e){return Array.prototype.concat.apply([],e)}const ns=Object.prototype.toString,nS=Object.prototype.hasOwnProperty;function xr(e){return e===void 0}function dn(e){return e!==void 0}function ea(e){return e==null}function We(e){return ns.call(e)==="[object Array]"}function hn(e){return ns.call(e)==="[object Object]"}function Ue(e){return ns.call(e)==="[object Number]"}function bn(e){const t=ns.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Jn(e){return ns.call(e)==="[object String]"}function iS(e){if(!We(e))throw new Error("must supply array")}function ei(e,t){return!ea(e)&&nS.call(e,t)}function Lt(e,t){const n=Ac(t);let i;return z(e,function(o,r){if(n(o,r))return i=o,!1}),i}function Ig(e,t){const n=Ac(t);let i=We(e)?-1:void 0;return z(e,function(o,r){if(n(o,r))return i=r,!1}),i}function rt(e,t){const n=Ac(t);let i=[];return z(e,function(o,r){n(o,r)&&i.push(o)}),i}function z(e,t){let n,i;if(xr(e))return;const o=We(e)?cS:sS;for(let r in e)if(ei(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function oS(e,t){if(xr(e))return[];iS(e);const n=Ac(t);return e.filter(function(i,o){return!n(i,o)})}function ti(e,t,n){return z(e,function(i,o){n=t(n,i,o)}),n}function Lo(e,t){return!!ti(e,function(n,i,o){return n&&t(i,o)},!0)}function Io(e,t){return!!Lt(e,t)}function Nn(e,t){let n=[];return z(e,function(i,o){n.push(t(i,o))}),n}function Mc(e){return e&&Object.keys(e)||[]}function rS(e){return Mc(e).length}function ta(e){return Nn(e,t=>t)}function na(e,t,n={}){return t=Ep(t),z(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function Bg(e,...t){e=Ep(e);let n={};return z(t,o=>na(o,e,n)),Nn(n,function(o,r){return o[0]})}const aS=Bg;function Ui(e,t){t=Ep(t);let n=[];return z(e,function(i,o){let r=t(i,o),a={d:r,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(r<c){n.splice(s,0,a);return}}n.push(a)}),Nn(n,i=>i.v)}function ia(e){return function(t){return Lo(e,function(n,i){return t[i]===n})}}function Ep(e){return bn(e)?e:t=>t[e]}function Ac(e){return bn(e)?e:t=>t===e}function sS(e){return e}function cS(e){return Number(e)}function Sp(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 Xn(e,t){return e.bind(t)}function V(e,...t){return Object.assign(e,...t)}function lS(e,t,n){let i=e;return z(t,function(o,r){if(typeof o!="number"&&typeof o!="string")throw new Error("illegal key type: "+typeof o+". Key should be of type number or string.");if(o==="constructor")throw new Error("illegal key: constructor");if(o==="__proto__")throw new Error("illegal key: __proto__");let a=t[r+1],s=i[o];dn(a)&&ea(s)&&(s=i[o]=isNaN(+a)?{}:[]),xr(a)?xr(n)?delete i[o]:i[o]=n:i=s}),e}function Ii(e,t){let n={},i=Object(e);return z(t,function(o){o in i&&(n[o]=e[o])}),n}function qi(e,t){let n={},i=Object(e);return z(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function M(e,t){var n=ge(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function ot(e,t){return Io(t,function(n){return M(e,n)})}function ge(e){return e&&e.businessObject||e}function dt(e){return e&&e.di}const uS="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Ng="i18n",_r="i18n:Translation";function wr(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 Bo(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,_r)})}function En(e){return e.get("xml:lang")}function No(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,Cc)})}function is(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,o,r)=>i!==t&&r.indexOf(i)===o)]}function Rp(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 Cp(e,t,n){const i=wr(e);if(!i)return{};const o=i.target[i.key]??"",r=Bo(e).filter(u=>En(u)),a=u=>u.body??"",s=o?r.filter(u=>a(u)===o).map(En):[],c=o?s.length?s:[n??t.designLocale]:[],l={};for(const u of is(t)){if(c.includes(u)){l[u]=o;continue}const p=r.find(f=>En(f)===u&&a(f));p&&(l[u]=a(p))}return l}const Pc="bwl.updateTranslation";class Mp{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=wr(c),u=[];t.undo=u;const p=Bo(c).filter(O=>En(O)),f=s??(l?l.target[l.key]??"":""),d=a??o,h=(O=>{if(!O)return[];const B=p.filter($=>$.body===O).map(En);return B.length?B:[d]})(f),m=s!==void 0&&f&&!h.includes(t.locale)?h[0]:t.locale,_=O=>{var B;return((B=p.find($=>En($)===O&&$.body))==null?void 0:B.body)??(h.includes(O)?f:"")},x=O=>No(c).some(B=>B.locale===O),y=_(m);if(y===i)return[];const v=!!y&&!x(m),E=v?r.filter(O=>O!==m&&_(O)&&!x(O)):[],w=()=>{let O=c.extensionElements;return O||(O=this.moddle.create("bpmn:ExtensionElements",{values:[]}),O.$parent=c,c.extensionElements=O,u.push(()=>delete c.extensionElements)),O.get("values")},T=(O,B)=>{const $=w();let H=$.find(Q=>{var J;return((J=Q.$instanceOf)==null?void 0:J.call(Q,_r))&&En(Q)===O});if(H){const Q=H.body;H.body=B,u.push(()=>H.body=Q)}else H=this.moddle.create(_r,{body:B}),H.set("xml:lang",O),H.$parent=c.extensionElements,$.push(H),u.push(()=>$.splice($.indexOf(H),1))},P=O=>{const B=w(),$=B.indexOf(O);B.splice($,1),u.push(()=>B.splice($,0,O))};if(s===void 0){if(m===o&&l){if(f&&!p.some(B=>B.body===f)){const B=a&&a!==o?a:void 0;B&&T(B,f)}const O=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{O?l.target[l.key]=f:delete l.target[l.key]})}T(m,i)}else(p.some(O=>En(O)===m)||!f&&m!==d)&&T(m,i);if(!v)for(const O of No(c).filter(B=>B.locale===m))P(O);for(const O of E){const B=w(),$=this.moddle.create(Cc,{locale:O,sourceLocale:m,previous:y});$.$parent=c.extensionElements,B.push($),u.push(()=>B.splice(B.indexOf($),1))}for(const O of No(c).filter(B=>B.sourceLocale===m&&(B.previous??"")===i))P(O);return u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}zn(Mp,"$inject",["moddle"]);const Ap="bwl.setTranslations",pS=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class Pp{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,!wr(l))return[];const p=()=>{let _=l.extensionElements;return _||(_=this.moddle.create("bpmn:ExtensionElements",{values:[]}),_.$parent=l,l.extensionElements=_,u.push(()=>delete l.extensionElements)),_.get("values")},f=_=>{const x=p(),y=x.indexOf(_);y<0||(x.splice(y,1),u.push(()=>x.splice(y,0,_)))},d=_=>Bo(l).find(x=>En(x)===_);if(i===null)for(const _ of a){const x=d(_);x&&f(x)}else if(i)for(const _ of a){const x=i[_];if(x===void 0)continue;const y=d(_);if(y){if(y.body===x)continue;const w=y.body;y.body=x,u.push(()=>y.body=w);continue}if(_===r&&(s??r)===r)continue;const v=p(),E=this.moddle.create(_r,{body:x});E.set("xml:lang",_),E.$parent=l.extensionElements,v.push(E),u.push(()=>v.splice(v.indexOf(E),1))}const h=[...i===null?[]:c.requests.filter(_=>!o.includes(_.locale)&&!(i&&i[_.locale]!==void 0&&i[_.locale]!==c.texts[_.locale])&&!(i&&_.sourceLocale&&i[_.sourceLocale]===_.previous))];for(const _ of No(l)){const x=h.findIndex(y=>pS(_,y));x>=0?h.splice(x,1):f(_)}for(const _ of h){const x=p(),y=this.moddle.create(Cc,{locale:_.locale,..._.sourceLocale?{sourceLocale:_.sourceLocale}:{},previous:_.previous});y.$parent=l.extensionElements,x.push(y),u.push(()=>x.splice(x.indexOf(y),1))}const m=l.extensionElements;return m&&!m.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=m)),u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}zn(Pp,"$inject",["moddle"]);function Tp(e){return No(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class kp{constructor(t){t.registerHandler(Pc,Mp),t.registerHandler(Ap,Pp)}}zn(kp,"$inject",["commandStack"]);const Op={__init__:["translationCommands"],translationCommands:["type",kp]},$g=["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"],fS={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},dS={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(Rc.map(e=>[e,{type:"string"}])),additionalProperties:!1},hS={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},mS={type:"string",enum:[...Ec],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},yS={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...wc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},vS={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},bS={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},xS={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},_S={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},wS={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},ES={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},SS={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},RS={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},CS={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...xp]},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 MS={"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:[...wc]},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:[...Rc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":Pn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Fg={anyOf:$g.map(e=>MS[e])},AS={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:hS,irParticipant:gS,irNode:yS,irFlowCondition:vS,irSequenceFlow:bS,irMessageFlow:xS,irDataStore:_S,irDataAssociation:wS,irTextAnnotation:ES,irAssociation:SS,irGroup:RS,bwlPlacement:CS,eventDefinition:mS,localeTexts:dS,nullableString:fS,symbolicOp:Fg}};function Dp(){}Dp.prototype.get=function(e){return this.$model.properties.get(this,e)},Dp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function jg(e,t){this.model=e,this.properties=t}jg.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Dp.prototype);z(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var o=e.ns.name;function r(a){n.define(this,"$type",{value:o,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),z(a,Xn(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 PS=V(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Hg=V(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 Lp(e,t){var n=Hg[e];return n?n(t):t}function Ip(e){return!!PS[e]}function zg(e){return!!Hg[e]}function $n(e,t){var n=e.split(/:/),i,o;if(n.length===1)i=e,o=t;else if(n.length===2)i=n[1],o=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(o?o+":":"")+i,{name:e,prefix:o,localName:i}}function fi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}fi.prototype.build=function(){return Ii(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},fi.prototype.addProperty=function(e,t,n){typeof t=="boolean"&&(n=t,t=void 0),this.addNamedProperty(e,n!==!1);var i=this.properties;t!==void 0?i.splice(t,0,e):i.push(e)},fi.prototype.replaceProperty=function(e,t,n){var i=e.ns,o=this.properties,r=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=o.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");o.splice(s,1),this.addProperty(t,n?void 0:s,a),r[i.name]=r[i.localName]=t},fi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=$n(o[0],i),a=$n(o[1],r.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},fi.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},fi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},fi.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},fi.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},fi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},fi.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},fi.prototype.hasProperty=function(e){return this.propertiesByName[e]},fi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(z(e.properties,Xn(function(r){r=V({},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 $o(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,z(e,Xn(this.registerPackage,this))}$o.prototype.getPackage=function(e){return this.packageMap[e]},$o.prototype.getPackages=function(){return this.packages},$o.prototype.registerPackage=function(e){e=V({},e);var t=this.packageMap;Gg(t,e,"prefix"),Gg(t,e,"uri"),z(e.types,Xn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},$o.prototype.registerType=function(e,t){e=V({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:V({},e.meta||{})});var n=$n(e.name,t.prefix),i=n.name,o=Object.create(null);z(e.properties,Xn(function(r){var a=$n(r.name,n.prefix),s=a.name;Ip(r.type)||(r.type=$n(r.type,a.prefix).name),V(r,{ns:a,name:s}),o[s]=r},this)),V(e,{ns:n,name:i,propertiesByName:o}),z(e.extends,Xn(function(r){var a=$n(r,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},$o.prototype.mapTypes=function(e,t,n){var i=Ip(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=$n(c,Ip(c)?"":e.prefix);o.mapTypes(u,t,l)}function a(c){return r(c,!0)}function s(c){return r(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");z(i.superClass,n?a:s),t(i,!n),z(i.traits,a)},$o.prototype.getEffectiveDescriptor=function(e){var t=$n(e),n=new fi(t);this.mapTypes(t,function(o,r){n.addTrait(o,r)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},$o.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Gg(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Er(e){this.model=e}Er.prototype.set=function(e,t,n){if(!Jn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),o=i&&i.name;TS(n)?i?delete e[o]:delete e.$attrs[Bp(t)]:i?o in e?e[o]=n:Vg(e,i,n):e.$attrs[Bp(t)]=n},Er.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Bp(t)];var i=n.name;return!e[i]&&n.isMany&&Vg(e,n,[]),e[i]},Er.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=V({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Er.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Er.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Er.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 TS(e){return typeof e>"u"}function Vg(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Bp(e){return e.replace(/^:/,"")}function vi(e,t={}){this.properties=new Er(this),this.factory=new jg(this,this.properties),this.registry=new $o(e,this.properties),this.typeCache=Object.create(null),this.config=t}vi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},vi.prototype.getType=function(e){var t=this.typeCache,n=Jn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},vi.prototype.createAny=function(e,t,n){var i=$n(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){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}),z(n,function(a,s){hn(a)&&a.value!==void 0?o[a.name]=a.value:o[s]=a}),o},vi.prototype.getPackage=function(e){return this.registry.getPackage(e)},vi.prototype.getPackages=function(){return this.registry.getPackages()},vi.prototype.getElementDescriptor=function(e){return e.$descriptor},vi.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},vi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},vi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Wg=String.fromCharCode,kS=Object.prototype.hasOwnProperty,OS=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,os={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(os).forEach(function(e){os[e.toUpperCase()]=os[e]});function DS(e,t,n,i){return i?kS.call(os,i)?os[i]:"&"+i+";":Wg(t||parseInt(n,16))}function Sr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(OS,DS):e}var Ug="non-whitespace outside of root node";function Fo(e){return new Error(e)}function LS(e){return"missing namespace for prefix <"+e+">"}function Tc(e){return{get:e,enumerable:!0}}function IS(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var qg=Symbol("nameCache");function Np(e){return e+"$uri"}function BS(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Np(i)]=n;return t}function kc(){return{line:0,column:0}}function NS(e){throw e}function Yg(e){if(!this)return new Yg(e);var t=e&&e.proxy,n,i,o,r,a=NS,s,c,l,u,p=kc,f=!1,d=!1,g="",h=!1,m=!1,_=null,x=!1,y,v,E,w;function T($){$ instanceof Error||($=Fo($)),_=$,a($,p)}function P($){s&&($ instanceof Error||($=Fo($)),s($,p))}this.on=function($,H){if(typeof H!="function")throw Fo("required args <name, cb>");switch($){case"openTag":i=H;break;case"text":n=H;break;case"closeTag":o=H;break;case"error":a=H;break;case"warn":s=H;break;case"cdata":r=H;break;case"attention":u=H;break;case"question":l=H;break;case"comment":c=H;break;default:throw Fo("unsupported event: "+$)}return this},this.ns=function($){if(typeof $>"u"&&($={}),typeof $!="object")throw Fo("required args <nsMap={}>");var H=Object.create(null),Q;for(Q in $)H[Q]=$[Q];return m=!0,w=H,this};function O(){y=m?[]:null,v=m?BS(w):null,E=[],p=kc,x=!1,_=null,d=!1,g=""}this.parse=function($){if(typeof $!="string")throw Fo("required args <xml=string>");if(f)throw Fo("parse during stream; call end() first");return O(),B($),p=kc,x=!1,_},this.write=function($){if(typeof $!="string")throw Fo("required args <xml=string>");return f||(O(),f=!0),_||(g=B(g+$,!0)||""),this},this.end=function(){return f||O(),f=!1,_||B(g),g="",p=kc,x=!1,_},this.stop=function(){x=!0};function B($,H=!1){var Q=null,J=null,X,me=0,Ae=!1,Oe=!1,Ee=0,W=0,ne,U,Y,re,he,Le,N,C,R,G="",K=0,ie;function Pe(Ct,vn){var Cn=Ct.indexOf(":");if(Cn===-1)return Ct;var qn=v[Ct.substring(0,Cn)];return qn?vn===qn?Ct.substr(Cn+1):qn+Ct.substr(Cn):(P(LS(Ct.substring(0,Cn))),null)}function et(){if(ie!==null)return ie;var Ct,vn,Cn=m&&v.xmlns,qn=m&&h?[]:null,At=K,Qt=G,_n=Qt.length,qa,Yn,Gi,ui,nn,Wr={},Ya=new Set,Mn,gt,St;e:for(;At<_n;At++)if(Mn=!1,gt=Qt.charCodeAt(At),!(gt===32||gt<14&&gt>8)){for((gt<65||gt>122||gt>90&&gt<97)&&gt!==95&&gt!==58&&(P("illegal first char attribute name"),Mn=!0),St=At+1;St<_n;St++)if(gt=Qt.charCodeAt(St),!(gt>96&&gt<123||gt>64&&gt<91||gt>47&&gt<59||gt===46||gt===45||gt===95)){if(gt===32||gt<14&&gt>8){P("missing attribute value"),At=St;continue e}if(gt===61)break;P("illegal attribute name char"),Mn=!0}if(nn=Qt.substring(At,St),nn==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),Mn=!0),gt=Qt.charCodeAt(St+1),gt===34)St=Qt.indexOf('"',At=St+2),St===-1&&(St=Qt.indexOf("'",At),St!==-1&&(P("attribute value quote missmatch"),Mn=!0));else if(gt===39)St=Qt.indexOf("'",At=St+2),St===-1&&(St=Qt.indexOf('"',At),St!==-1&&(P("attribute value quote missmatch"),Mn=!0));else for(P("missing attribute value quotes"),Mn=!0,St=St+1;St<_n&&(gt=Qt.charCodeAt(St+1),!(gt===32||gt<14&&gt>8));St++);for(St===-1&&(P("missing closing quotes"),St=_n,Mn=!0),Mn||(Gi=Qt.substring(At,St)),At=St;St+1<_n&&(gt=Qt.charCodeAt(St+1),!(gt===32||gt<14&&gt>8));St++)At===St&&(P("illegal character after attribute end"),Mn=!0);if(At=St+1,Mn)continue e;if(Ya.has(nn)){P("attribute <"+nn+"> already defined");continue}if(Ya.add(nn),!m){Wr[nn]=Gi;continue}if(h){if(Yn=nn==="xmlns"?"xmlns":nn.charCodeAt(0)===120&&nn.substr(0,6)==="xmlns:"?nn.substr(6):null,Yn!==null){if(Ct=Sr(Gi),vn=Np(Yn),ui=w[Ct],!ui){if(Yn==="xmlns"||vn in v&&v[vn]!==Ct)do ui="ns"+me++;while(typeof v[ui]<"u");else ui=Yn;w[Ct]=ui}v[Yn]!==ui&&(qa||(v=IS(v),qa=!0),v[Yn]=ui,Yn==="xmlns"&&(v[Np(ui)]=Ct,Cn=ui),v[vn]=Ct),Wr[nn]=Gi;continue}qn.push(nn,Gi);continue}nn=Pe(nn,Cn),nn!==null&&(Wr[nn]=Gi)}if(h)for(At=0,_n=qn.length;At<_n;At++)nn=Pe(qn[At++],Cn),Gi=qn[At],nn!==null&&(Wr[nn]=Gi);return ie=Wr}function mt(){for(var Ct=/(\r\n|\r|\n)/g,vn=0,Cn=0,qn=0,At=W,Qt,_n;Ee>=qn&&(Qt=Ct.exec($),!(!Qt||(At=Qt[0].length+Qt.index,At>Ee)));)vn+=1,qn=At;return Ee==-1?(Cn=At,_n=$.substring(W)):W===0?_n=$.substring(W,Ee):(Cn=Ee-qn,_n=W==-1?$.substring(Ee):$.substring(Ee,W+1)),{data:_n,line:vn,column:Cn}}for(p=mt,t&&(R=Object.create({},{name:Tc(function(){return N}),originalName:Tc(function(){return C}),attrs:Tc(et),ns:Tc(function(){return v})}));W!==-1;){if($.charCodeAt(W)===60?Ee=W:Ee=$.indexOf("<",W),Ee===-1){if(H)return $.substring(W);if(E.length)return T("unexpected end of file");if(!d)return T("missing start tag");W<$.length&&$.substring(W).trim()&&P(Ug);return}if(d||(d=!0),W!==Ee){if(E.length){if(n&&(n($.substring(W,Ee),Sr,p),x))return}else if($.substring(W,Ee).trim()&&(P(Ug),x))return}if(re=$.charCodeAt(Ee+1),re===33){if(Y=$.charCodeAt(Ee+2),Y===91&&$.substr(Ee+3,6)==="CDATA["){if(W=$.indexOf("]]>",Ee),W===-1)return H?$.substring(Ee):T("unclosed cdata");if(r&&(r($.substring(Ee+9,W),p),x))return;W+=3;continue}if(Y===45&&$.charCodeAt(Ee+3)===45){if(W=$.indexOf("-->",Ee),W===-1)return H?$.substring(Ee):T("unclosed comment");if(c&&(c($.substring(Ee+4,W),Sr,p),x))return;W+=3;continue}}if(re===63){if(W=$.indexOf("?>",Ee),W===-1)return H?$.substring(Ee):T("unclosed question");if(l&&(l($.substring(Ee,W+2),p),x))return;W+=2;continue}for(ne=Ee+1;;ne++){if(he=$.charCodeAt(ne),isNaN(he))return H?$.substring(Ee):(W=-1,T("unclosed tag"));if(he===34)Y=$.indexOf('"',ne+1),ne=Y!==-1?Y:ne;else if(he===39)Y=$.indexOf("'",ne+1),ne=Y!==-1?Y:ne;else if(he===62){W=ne;break}}if(re===33){if(u&&(u($.substring(Ee,W+1),Sr,p),x))return;W+=1;continue}if(ie={},re===47){if(Ae=!1,Oe=!0,!E.length)return T("missing open tag");if(ne=N=E.pop(),Y=Ee+2+ne.length,$.substring(Ee+2,Y)!==ne)return T("closing tag mismatch");for(;Y<W;Y++)if(re=$.charCodeAt(Y),!(re===32||re>8&&re<14))return T("close tag")}else{if($.charCodeAt(W-1)===47?(ne=N=$.substring(Ee+1,W-1),Ae=!0,Oe=!0):(ne=N=$.substring(Ee+1,W),Ae=!0,Oe=!1),!(re>96&&re<123||re>64&&re<91||re===95||re===58))return T("illegal first char nodeName");for(Y=1,U=ne.length;Y<U;Y++)if(re=ne.charCodeAt(Y),!(re>96&&re<123||re>64&&re<91||re>47&&re<59||re===45||re===95||re==46)){if(re===32||re<14&&re>8){N=ne.substring(0,Y),ie=null;break}return T("invalid nodeName")}Oe||E.push(N)}if(m){X=v,Ae&&(Oe||y.push(X),ie===null&&(h=ne.indexOf("xmlns",Y)!==-1)&&(K=Y,G=ne,et(),h=!1)),C=N,J!==v&&(Q=v[qg],Q===void 0&&(Q=v[qg]=Object.create(null)),J=v);var qt=Q[N];if(qt!==void 0)N=qt;else{if(re=N.indexOf(":"),re!==-1){if(Le=v[N.substring(0,re)],!Le)return T("missing namespace on <"+C+">");N=N.substr(re+1)}else Le=v.xmlns;Le&&(N=Le+":"+N),Q[C]=N}}if(Ae&&(K=Y,G=ne,i&&(t?i(R,Sr,Oe,p):i(N,et,Sr,Oe,p),x)))return;if(Oe){if(o&&(o(t?R:N,Sr,Ae,p),x))return;m&&(Ae?v=X:v=y.pop())}W+=1}}}function Kg(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var $p={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Xg="property";function Zg(e){return e.xml&&e.xml.serialize}function $S(e){const t=Zg(e);return t!==Xg&&(t||null)}function FS(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Qg(e,t){return Kg(t)?e.prefix+":"+FS(e.localName):e.name}function jS(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 HS(e,t,n){const i=$n(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=$n(o);var a=n.getPackage(r.prefix);return jS(r,a)}function jo(e){return new Error(e)}function fo(e){return e.$descriptor}function zS(e){V(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw jo("expected element");var n=this.elementsById,i=fo(t),o=i.idProperty,r;if(o&&(r=t.get(o.name),r)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(r))throw new Error("illegal ID <"+r+">");if(n[r])throw jo("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function rs(){}rs.prototype.handleEnd=function(){},rs.prototype.handleText=function(){},rs.prototype.handleNode=function(){};function Fp(){}Fp.prototype=Object.create(rs.prototype),Fp.prototype.handleNode=function(){return this};function oa(){}oa.prototype=Object.create(rs.prototype),oa.prototype.handleText=function(e){this.body=(this.body||"")+e};function as(e,t){this.property=e,this.context=t}as.prototype=Object.create(oa.prototype),as.prototype.handleNode=function(e){if(this.element)throw jo("expected no sub nodes");return this.element=this.createReference(e),this},as.prototype.handleEnd=function(){this.element.id=this.body},as.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function jp(e,t){this.element=t,this.propertyDesc=e}jp.prototype=Object.create(oa.prototype),jp.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Lp(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Oc(){}Oc.prototype=Object.create(oa.prototype),Oc.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function Gn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Gn.prototype=Object.create(Oc.prototype),Gn.prototype.addReference=function(e){this.context.addReference(e)},Gn.prototype.handleText=function(e){var t=this.element,n=fo(t),i=n.bodyProperty;if(!i)throw jo("unexpected body text <"+e+">");oa.prototype.handleText.call(this,e)},Gn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=fo(t),i=n.bodyProperty;i&&e!==void 0&&(e=Lp(i.type,e),t.set(i.name,e))},Gn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=fo(n),o=this.context,r=new n({}),a=this.model,s;return z(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),z(p,function(f){o.addReference({element:r,property:u.ns.name,id:f})})):o.addReference({element:r,property:u.ns.name,id:c}):(u?c=Lp(u.type,c):l==="xmlns"?l=":"+l:(s=$n(l,i.ns.prefix),a.getPackage(s.prefix)&&o.addWarning({message:"unknown attribute <"+l+">",element:r,property:l,value:c})),r.set(l,c))}),r},Gn.prototype.getPropertyForNode=function(e){var t=e.name,n=$n(t),i=this.type,o=this.model,r=fo(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=$S(s);if(l){const u=e.attributes[l];if(u){const p=HS(u,e.ns,o),f=o.getType(p);return V({},s,{effectiveType:fo(f).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=Qg(n,c),u=o.getType(l);if(s=Lt(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return V({},s,{effectiveType:fo(u).name})}else if(s=Lt(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw jo("unrecognized element <"+n.name+">")},Gn.prototype.toString=function(){return"ElementDescriptor["+fo(this.type).name+"]"},Gn.prototype.valueHandler=function(e,t){return new jp(e,t)},Gn.prototype.referenceHandler=function(e){return new as(e,this.context)},Gn.prototype.handler=function(e){return e==="Element"?new ra(this.model,e,this.context):new Gn(this.model,e,this.context)},Gn.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,zg(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?(V(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function Hp(e,t,n){Gn.call(this,e,t,n)}Hp.prototype=Object.create(Gn.prototype),Hp.prototype.createElement=function(e){var t=e.name,n=$n(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&Qg(n,r)||t;if(!o.hasType(a))throw jo("unexpected element <"+e.originalName+">");return Gn.prototype.createElement.call(this,e)};function ra(e,t,n){this.model=e,this.context=n}ra.prototype=Object.create(Oc.prototype),ra.prototype.createElement=function(e){var t=e.name,n=$n(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},ra.prototype.handleChild=function(e){var t=new ra(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,o;return i!==void 0&&(o=n.$children=n.$children||[],o.push(i),i.$parent=n),t},ra.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function zp(e){e instanceof vi&&(e={model:e}),V(this,{lax:!1},e)}zp.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Gn?(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 zS(V({},t,{rootHandler:i})),s=new Yg({proxy:!0}),c=GS();i.context=a,c.push(i);function l(E,w,T){var P=w(),O=P.line,B=P.column,$=P.data;$.charAt(0)==="<"&&$.indexOf(" ")!==-1&&($=$.slice(0,$.indexOf(" "))+">");var H="unparsable content "+($?$+" ":"")+`detected
2
- line: `+O+`
3
- column: `+B+`
4
- nested error: `+E.message;if(T)return a.addWarning({message:H,error:E}),!0;throw jo(H)}function u(E,w){return l(E,w,!0)}function p(){var E=a.elementsById,w=a.references,T,P;for(T=0;P=w[T];T++){var O=P.element,B=E[P.id],$=fo(O).propertiesByName[P.property];if(B||a.addWarning({message:"unresolved reference <"+P.id+">",element:P.element,property:P.property,value:P.id}),$.isMany){var H=O.get($.name),Q=H.indexOf(P);Q===-1&&(Q=H.length),B?H[Q]=B:H.splice(Q,1)}else O.set($.name,B)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,g=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function m(E){if(d.test(E)){var w=g.exec(E),T=w&&w[1];!T||h.test(T)||a.addWarning({message:"unsupported document encoding <"+T+">, falling back to UTF-8"})}}function _(E,w){var T=c.peek();try{c.push(T.handleNode(E))}catch(P){l(P,w,r)&&c.push(new Fp)}}function x(E,w){try{c.peek().handleText(E)}catch(T){u(T,w)}}function y(E,w){E.trim()&&x(E,w)}var v=o.getPackages().reduce(function(E,w){return E[w.uri]=w.prefix,E},Object.entries($p).reduce(function(E,[w,T]){return E[T]=w,E},o.config&&o.config.nsMap||{}));return s.ns(v).on("openTag",function(E,w,T,P){var O=E.attrs||{},B=Object.keys(O).reduce(function(H,Q){var J=w(O[Q]);return H[Q]=J,H},{}),$={name:E.name,originalName:E.originalName,attributes:B,ns:E.ns};_($,P)}).on("question",m).on("closeTag",f).on("cdata",x).on("text",function(E,w,T){y(w(E),T)}).on("error",l).on("warn",u),new Promise(function(E,w){var T;try{s.parse(e),p()}catch(H){T=H}var P=i.element;!T&&!P&&(T=jo("failed to parse document as <"+i.type.$descriptor.name+">"));var O=a.warnings,B=a.references,$=a.elementsById;return T?(T.warnings=O,w(T)):E({rootElement:P,elementsById:$,references:B,warnings:O})})},zp.prototype.handler=function(e){return new Hp(this.model,e)};function GS(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var VS=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,WS=/<|>|'|"|&|\n\r|\n/g,Jg=/<|>|&/g;function Yi(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Yi.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Yi.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Yi.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Yi.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)},Yi.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Yi.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Yi.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Yi.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Yi.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 US(e){return e.charAt(0).toLowerCase()+e.slice(1)}function qS(e,t){return Kg(t)?US(e):e}function em(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function tm(e){return Jn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function YS(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 KS(e,t){return t.isGeneric?V({localName:t.ns.localName},e):V({localName:qS(t.ns.localName,t.$pkg)},e)}function XS(e,t){return V({localName:t.ns.localName},e)}function ZS(e){var t=e.$descriptor;return rt(t.properties,function(n){var i=n.name;if(n.isVirtual||!ei(e,i))return!1;var o=e[i];return o===n.default||o===null?!1:n.isMany?o.length:!0})}var QS={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},JS={"<":"lt",">":"gt","&":"amp"};function nm(e,t,n){return e=Jn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function eR(e){return nm(e,WS,QS)}function tR(e){return nm(e,Jg,JS)}function nR(e){return rt(e,function(t){return t.isAttr})}function iR(e){return rt(e,function(t){return!t.isAttr})}function Gp(e){this.tagName=e}Gp.prototype.build=function(e){return this.element=e,this},Gp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Rr(){}Rr.prototype.serializeValue=Rr.prototype.serializeTo=function(e){e.append(this.escape?tR(this.value):this.value)},Rr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Jg)!==-1&&(this.escape=!0),this};function Vp(e){this.tagName=e}em(Vp,Rr),Vp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Ht(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Ht.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,o,r=t.isGeneric;return r?i=this.parseGenericNsAttributes(e):i=this.parseNsAttributes(e),n?this.ns=this.nsPropertyTagName(n):this.ns=this.nsTagName(t),this.tagName=this.addTagName(this.ns),r?this.parseGenericContainments(e):(o=ZS(e),this.parseAttributes(nR(o)),this.parseContainments(iR(o))),this.parseGenericAttributes(e,i),this},Ht.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return KS(t,e)},Ht.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return XS(t,e)},Ht.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Ht.prototype.nsAttributeName=function(e){var t;if(Jn(e)?t=$n(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:V({localName:t.localName},n)},Ht.prototype.parseGenericNsAttributes=function(e){return Object.entries(e).filter(([t,n])=>!t.startsWith("$")&&this.parseNsAttribute(e,t,n)).map(([t,n])=>({name:t,value:n}))},Ht.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Rr().build({type:"String"},t));var n=e.$children;n&&z(n,i=>{this.body.push(new Ht(this).build(i))})},Ht.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,o=$n(t),r;if(o.prefix==="xmlns"&&(r={prefix:o.localName,uri:n}),!o.prefix&&o.localName==="xmlns"&&(r={uri:n}),!r)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(r,!0,!0);else{var a=this.logNamespaceUsed(r,!0);this.getNamespaces().logUsed(a)}},Ht.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return z(n,function(o,r){var a=t.parseNsAttribute(e,r,o);a&&i.push(a)}),i},Ht.prototype.parseGenericAttributes=function(e,t){var n=this;z(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(o){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,o)}})},Ht.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;z(e,function(o){var r=i.get(o.name),a=o.isReference,s=o.isMany;if(s||(r=[r]),o.isBody)n.push(new Rr().build(o,r[0]));else if(zg(o.type))z(r,function(l){n.push(new Vp(t.addTagName(t.nsPropertyTagName(o))).build(o,l))});else if(a)z(r,function(l){n.push(new Gp(t.addTagName(t.nsPropertyTagName(o))).build(l))});else{var c=Zg(o);z(r,function(l){var u;c?c===Xg?u=new Ht(t,o):u=new Dc(t,o,c):u=new Ht(t),n.push(u.build(l))})}})},Ht.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Yi(i):t=i),t},Ht.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),o=e.uri,r=e.prefix,a=i.byUri(o);return(!a||n)&&i.add(e,t),i.mapPrefix(r,o),e},Ht.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),i=e.prefix,o=e.uri,r,a,s;if(!i&&!o)return{localName:e.localName};if(s=n.defaultUriByPrefix(i),o=o||s||n.uriByPrefix(i),!o)throw new Error("no namespace uri given for prefix <"+i+">");if(e=n.byUri(o),!e&&!i&&(e=this.logNamespace({uri:o},s===o,!0)),!e){for(r=i,a=1;n.uriByPrefix(r);)r=i+"_"+a++;e=this.logNamespace({prefix:r,uri:o},s===o)}return i&&n.mapPrefix(i,o),e},Ht.prototype.parseAttributes=function(e){var t=this,n=this.element;z(e,function(i){var o=n.get(i.name);if(i.isReference)if(!i.isMany)o=o.id;else{var r=[];z(o,function(a){r.push(a.id)}),o=r.join(" ")}t.addAttribute(t.nsAttributeName(i),o)})},Ht.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),tm(e)},Ht.prototype.addAttribute=function(e,t){var n=this.attrs;Jn(t)&&(t=eR(t));var i=Ig(n,function(r){return r.name.localName===e.localName&&r.name.uri===e.uri&&r.name.prefix===e.prefix}),o={name:e,value:t};i!==-1?n.splice(i,1,o):n.push(o)},Ht.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=YS(n).concat(t)),z(t,function(i){e.append(" ").append(tm(i.name)).append('="').append(i.value).append('"')})},Ht.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Rr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),z(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function Dc(e,t,n){Ht.call(this,e,t),this.serialization=n}em(Dc,Ht),Dc.prototype.parseNsAttributes=function(e){var t=Ht.prototype.parseNsAttributes.call(this,e).filter(a=>a.name!==this.serialization),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var o=e.$model.getPackage(i.uri),r=o.xml&&o.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+r+n.ns.localName),t},Dc.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function oR(){this.value="",this.write=function(e){this.value+=e}}function rR(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 aR(e){e=V({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new oR,r=new rR(o,e.format);e.preamble&&r.append(VS);var a=new Ht,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(sR(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function sR(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in $p)n[i]=$p[i];for(const i in t){const o=t[i];n[o]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function Lc(e,t){vi.call(this,e,t)}Lc.prototype=Object.create(vi.prototype),Lc.prototype.fromXML=function(e,t,n){Jn(t)||(n=t,t="bpmn:Definitions");var i=new zp(V({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},Lc.prototype.toXML=function(e,t){var n=new aR(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var cR="BPMN20",lR="http://www.omg.org/spec/BPMN/20100524/MODEL",uR="bpmn",pR=[],fR=[{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"}]}],dR=[{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"}]}],hR={tagAlias:"lowerCase",typePrefix:"t"},gR={name:cR,uri:lR,prefix:uR,associations:pR,types:fR,enumerations:dR,xml:hR},mR="BPMNDI",yR="http://www.omg.org/spec/BPMN/20100524/DI",vR="bpmndi",bR=[{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"]}],xR=[{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"}]}],_R=[],wR={name:mR,uri:yR,prefix:vR,types:bR,enumerations:xR,associations:_R},ER="DC",SR="http://www.omg.org/spec/DD/20100524/DC",RR="dc",CR=[{name:"Boolean"},{name:"Integer"},{name:"Real"},{name:"String"},{name:"Font",properties:[{name:"name",type:"String",isAttr:!0},{name:"size",type:"Real",isAttr:!0},{name:"isBold",type:"Boolean",isAttr:!0},{name:"isItalic",type:"Boolean",isAttr:!0},{name:"isUnderline",type:"Boolean",isAttr:!0},{name:"isStrikeThrough",type:"Boolean",isAttr:!0}]},{name:"Point",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0}]},{name:"Bounds",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0},{name:"width",type:"Real",isAttr:!0},{name:"height",type:"Real",isAttr:!0}]}],MR=[],AR={name:ER,uri:SR,prefix:RR,types:CR,associations:MR},PR="DI",TR="http://www.omg.org/spec/DD/20100524/DI",kR="di",OR=[{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"}]}],DR=[],LR={tagAlias:"lowerCase"},IR={name:PR,uri:TR,prefix:kR,types:OR,associations:DR,xml:LR},BR="bpmn.io colors for BPMN",NR="http://bpmn.io/schema/bpmn/biocolor/1.0",$R="bioc",FR=[{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"}]}],jR=[],HR=[],zR={name:BR,uri:NR,prefix:$R,types:FR,enumerations:jR,associations:HR},GR="BPMN in Color",VR="http://www.omg.org/spec/BPMN/non-normative/color/1.0",WR="color",UR=[{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"}]}],qR=[],YR=[],KR={name:GR,uri:VR,prefix:WR,types:UR,enumerations:qR,associations:YR};const XR={bpmn:gR,bpmndi:wR,dc:AR,di:IR,bioc:zR,color:KR};function im(e,t){const n=V({},XR,e);return new Lc(n,t)}const ZR={name:"bpmn-i18n",uri:"http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",prefix:"i18n",types:[{name:"Translation",superClass:["Element"],properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"body",isBody:!0,type:"String"},{name:"target",isAttr:!0,type:"String",default:"@name"},{name:"textFormat",isAttr:"true",type:"String",default:"text/plain"}]}],enumerations:[],associations:[],xml:{tagAlias:"lowerCase",typePrefix:"t"}},Ic={[Ng]:ZR,[bp]:Og};function om(){return im(Ic)}const rm=om();async function aa(e){const{rootElement:t,warnings:n}=await rm.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function QR(e){const{xml:t}=await rm.toXML(e,{format:!0});return t}function Wp(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const sa={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},JR=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function eC(e){const t=sa;return JR.test(e)?t.cjkEm:e===" "?t.spaceEm:e>="0"&&e<="9"?t.digitEm:e>="A"&&e<="Z"?t.upperEm:e>="a"&&e<="z"?t.lowerEm:t.otherEm}function ca(e,t){let n=0;for(const i of e)n+=t*eC(i);return n}function am(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&tC(e),nC(e),iC(e),oC(e)}function tC(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(o){var a;const r=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:ca(o,r),fontBoundingBoxAscent:r*sa.ascentEm,fontBoundingBoxDescent:r*sa.descentEm,actualBoundingBoxAscent:r*sa.ascentEm,actualBoundingBoxDescent:r*sa.descentEm}}};t.getContext=()=>n}function nC(e){if(e.SVGMatrix)return;class t{constructor(){zn(this,"a",1);zn(this,"b",0);zn(this,"c",0);zn(this,"d",1);zn(this,"e",0);zn(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 iC(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:ca(n,12),height:14}})}const Bc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),rC=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),aC=1,Nc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),sC=2;function ct(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"label-over-shape":return`ls|${e.edge}|${e.shape}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"edge-endpoint-detached":return`d|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"edge-along-group-boundary":return`eg|${e.edge}|${e.group}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const sm=20,$c=5,cm=3,cC=8,la=15,Up=50,lm=12,lC=lm*1.2;function qp(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>ca(r,lm))),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 um=1;function on(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],o=e.waypoints[n+1];Math.abs(i.y-o.y)<.5&&Math.abs(i.x-o.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,o.x),hi:Math.max(i.x,o.x),dir:o.x>i.x?1:-1}):Math.abs(i.x-o.x)<.5&&Math.abs(i.y-o.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,o.y),hi:Math.max(i.y,o.y),dir:o.y>i.y?1:-1})}return t}function Cr(e,t){let n=null;const i=e.type!==t.type,r=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of on(e))for(const s of on(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>um)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>=sm&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function Yp(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function pm(e,t){const n=Cr(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function uC(e,t){let n=0;for(const i of t)i.id!==e.id&&pm(e,i)&&n++;return n}function di(e,t){let n=0;for(const i of t)i.id!==e.id&&Cr(e,i)&&n++;return n}const fm=15,dm=20;function pC(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-dm||t.at>n[1]+dm)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 Kp=20;function Fc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>um)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<sm||n.push([o-Kp,r+Kp])}return n}function jc(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of on(e)){const r=pC(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Fc(o,on(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const fC=10,dC=1,hC=(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 Xp(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 mC=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ua=1;function Bi(e,t){const n=e.x+ua,i=e.x+e.width-ua,o=e.y+ua,r=e.y+e.height-ua;return t.axis==="h"?t.at>o&&t.at<r&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<r&&t.hi>o}function pa(e){return[{axis:"h",at:e.y,lo:e.x,hi:e.x+e.width,dir:1},{axis:"h",at:e.y+e.height,lo:e.x,hi:e.x+e.width,dir:1},{axis:"v",at:e.x,lo:e.y,hi:e.y+e.height,dir:1},{axis:"v",at:e.x+e.width,lo:e.y,hi:e.y+e.height,dir:1}]}function hm(e,t){const n=e.label;if(!n)return null;if(on(e).some(i=>Bi(n,i)))return e.id;for(const i of[...t.edges].filter(o=>o.id!==e.id).sort((o,r)=>o.id.localeCompare(r.id)))if(on(i).some(o=>Bi(n,o)))return i.id;for(const i of t.shapes.filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(pa(i).some(o=>Bi(n,o)))return i.id;return null}function zt(e,t){const n=new Set(e.endpoints),i=[];for(const o of t)if(!n.has(o.id)){for(let r=0;r+1<e.waypoints.length;r++)if(gC(e.waypoints[r],e.waypoints[r+1],o,sC)){i.push(o);break}}return i}const ss=(e,t,n)=>{const i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,a=r===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*o))},yC=(e,t,n,i)=>mm(e,t,n,i)?0:Math.min(ss(e,n,i),ss(t,n,i),ss(n,e,t),ss(i,e,t)),gm=(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 cs(e,t,n){const{x:i,y:o,width:r,height:a}=n;if(/Event$/.test(n.type)){const l=Math.min(r,a)/2;return Math.max(0,ss({x:i+r/2,y:o+a/2},e,t)-l)}const s=/Gateway$/.test(n.type)?[{x:i+r/2,y:o},{x:i+r,y:o+a/2},{x:i+r/2,y:o+a},{x:i,y:o+a/2}]:[{x:i,y:o},{x:i+r,y:o},{x:i+r,y:o+a},{x:i,y:o+a}];if(gm(e,s)||gm(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,yC(e,t,s[l],s[(l+1)%s.length]));return c}function mm(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 Zp=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ym(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(mm(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function ls(e,t){let n=0;for(const i of t)i.id===e.id||Zp(e,i)||ym(e,i)&&n++;return n}function hi(e,t){let n=0;for(const i of t)i.id===e.id||Zp(e,i)||ls(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function vm(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++)ls(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function ho(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(ls(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 Ni(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(Zp(n[i],n[o])&&ym(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 bm(e){const t=ho(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let o=0,r=0;for(const[a,s]of t){const c=i.get(a),l=i.get(s);if(!c||!l)continue;const u=n(c.type),p=n(l.type);u==="solid"&&p==="solid"?o++:u==="dashed"&&p==="dashed"&&r++}return{pairs:t,solidPairs:o,dashedPairs:r,mixedPairs:t.length-o-r,crossPoolMessages:vC(e)}}function vC(e){const t=e.shapes.filter(o=>o.type==="bpmn:Participant");if(t.length<3)return 0;const n=o=>{const r=e.shapes.find(a=>a.id===o);if(r)return t.find(a=>r.x>=a.x&&r.y>=a.y&&r.x+r.width<=a.x+a.width&&r.y+r.height<=a.y+a.height)};let i=0;for(const o of e.edges){if(o.type!=="bpmn:MessageFlow"||o.endpoints.length<2)continue;const r=n(o.endpoints[0]),a=n(o.endpoints[1]);if(!r||!a||r.id===a.id)continue;const s=Math.min(r.y,a.y),c=Math.max(r.y+r.height,a.y+a.height);t.some(l=>l.id!==r.id&&l.id!==a.id&&l.y>s&&l.y+l.height<c)&&i++}return i}function xm(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!Nc.has(o.type)&&!i.has(o.id)&&o.x>=n.x&&o.y>=n.y&&o.x+o.width<=n.right&&o.y+o.height<=n.bottom).map(o=>o.id).sort()}function _m(e){var n;const t=(n=Ft(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const o=Ft(i);if((o==null?void 0:o.$type)!=="bwl:Members"||typeof o.refs!="string")continue;const r=o.refs.split(/\s+/).filter(Boolean);return r.length?r:void 0}}const wm=e=>e?{members:e}:{},Vn=e=>e.shapes.filter(t=>!t.container);function bC(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 xC(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 Em(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((o,r)=>o.id.localeCompare(r.id)))if(on(i).some(o=>Bi(n,o)))return i.id;for(const i of[...t.shapes].filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(pa(i).some(o=>Bi(n,o)))return i.id;return null}function Ho(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 Sm=3;function Rm(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 us(e,t){const n=[];for(const i of t.shapes){if(i.container||Nc.has(i.type))continue;const o=Rm(e,i);o>=Sm&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function pt(e,t={}){const n=[],i=e.shapes.filter(y=>!y.container);for(const y of e.edges)for(const v of zt(y,i))n.push({kind:"edge-crosses-shape",edge:y.id,shape:v.id});const o=e.shapes.filter(y=>y.container&&rC.has(y.type));if(o.length){const y=(v,E)=>{const w=e.shapes.find(T=>T.id===E);return!!w&&w.x>=v.x&&w.y>=v.y&&w.x+w.width<=v.x+v.width&&w.y+w.height<=v.y+v.height};for(const v of e.edges)for(const E of zt(v,o))v.endpoints.includes(E.id)||v.endpoints.some(w=>y(E,w))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:E.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[E,w]of v){if(!E)continue;const T=e.shapes.find($=>$.id===E);if(!T||T.container)continue;const P=Math.max(T.x-w.x,w.x-(T.x+T.width),0),O=Math.max(T.y-w.y,w.y-(T.y+T.height),0),B=Math.hypot(P,O);B>fC&&n.push({kind:"edge-endpoint-detached",edge:y.id,shape:E,distance:Math.round(B)})}}const r=e.shapes.filter(y=>y.type==="bpmn:Participant");for(let y=0;y<r.length;y++)for(let v=y+1;v<r.length;v++){const E=r[y],w=r[v];if(E.x+E.width<=w.x||w.x+w.width<=E.x||E.y+E.height<=w.y||w.y+w.height<=E.y)continue;const T=(P,O)=>P.x<=O.x&&P.y<=O.y&&P.x+P.width>=O.x+O.width&&P.y+P.height>=O.y+O.height;n.push({kind:"pool-overlap",pools:[E.id,w.id],contained:T(E,w)||T(w,E)})}const a=i.filter(y=>!y.attached);for(let y=0;y<a.length;y++)for(let v=y+1;v<a.length;v++){const E=a[y],w=a[v];if(!Xp(E,w,aC))continue;const T=E.id<w.id?[E.id,w.id]:[w.id,E.id];n.push({kind:"shape-overlap",shapes:T,identical:mC(E,w)})}const s=e.shapes.filter(y=>y.type==="bpmn:Group"&&Array.isArray(y.members)&&y.members.length>0);for(let y=0;y<s.length;y++)for(let v=y+1;v<s.length;v++){const E=s[y],w=s[v],T=Math.min(E.x+E.width,w.x+w.width)-Math.max(E.x,w.x),P=Math.min(E.y+E.height,w.y+w.height)-Math.max(E.y,w.y);if(T<=$c||P<=$c)continue;const O=E.id<w.id?[E.id,w.id]:[w.id,E.id],B=new Set(w.members);if(E.members.some(H=>B.has(H))){const H=xm(e,s,{x:Math.max(E.x,w.x),y:Math.max(E.y,w.y),right:Math.min(E.x+E.width,w.x+w.width),bottom:Math.min(E.y+E.height,w.y+w.height)});H.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:O,shapes:H});continue}const $=E.x<=w.x&&E.y<=w.y&&E.x+E.width>=w.x+w.width&&E.y+E.height>=w.y+w.height?E.id:w.x<=E.x&&w.y<=E.y&&w.x+w.width>=E.x+E.width&&w.y+w.height>=E.y+E.height?w.id:void 0;n.push({kind:"group-overlap-unintended",groups:O,...$?{container:$}:{}})}const c=new Set(s.flatMap(y=>[...y.members])),l=y=>e.shapes.filter(v=>!v.container&&!Nc.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 s){const v=l(y);if(!v.length)continue;const E=new Set(y.members),w=v.filter(T=>!E.has(T.id));w.some(T=>c.has(T.id))&&(w.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:y.id,shapes:w.map(T=>T.id).sort()}))}for(const y of s){const v=new Set(l(y).map(B=>B.id)),E=new Set(y.members),w=new Set([...v].filter(B=>!E.has(B)&&c.has(B)));if(!w.size)continue;let T=!1,P=!1,O=!1;for(const B of e.edges){if(B.type!=="bpmn:SequenceFlow"||!B.source||!B.target)continue;const $=w.has(B.source),H=w.has(B.target);!$&&H&&!v.has(B.source)?T=!0:$&&!H&&!v.has(B.target)?P=!0:$&&H&&(O=!0)}T&&P&&O&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:y.id,shapes:[...w].sort()})}const u=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<u.length;y++)for(let v=y+1;v<u.length;v++)for(let E=v+1;E<u.length;E++){const w=[u[y],u[v],u[E]],T={x:Math.max(...w.map(B=>B.x)),y:Math.max(...w.map(B=>B.y)),right:Math.min(...w.map(B=>B.x+B.width)),bottom:Math.min(...w.map(B=>B.y+B.height))};if(T.right-T.x<=$c||T.bottom-T.y<=$c)continue;const P=xm(e,[],T);if(!P.length)continue;const O=w.map(B=>B.id).sort();n.push({kind:"group-stack-unreadable",groups:O,shapes:P})}for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||Nc.has(v.type)||v.width<=0||v.height<=0)continue;const E=[["top",y.y,"h",y.x,y.x+y.width],["bottom",y.y+y.height,"h",y.x,y.x+y.width],["left",y.x,"v",y.y,y.y+y.height],["right",y.x+y.width,"v",y.y,y.y+y.height]];for(const[w,T,P,O,B]of E){const $=P==="h"?v.x:v.y,H=P==="h"?v.x+v.width:v.y+v.height;if(!($<B&&O<H))continue;const Q=P==="h"?v.y:v.x,J=P==="h"?v.y+v.height:v.x+v.width;if(!(Q<T&&T<J))continue;const X=Math.min(T-Q,J-T);X<cC||n.push({kind:"group-cuts-shape",group:y.id,shape:v.id,side:w,depth:X})}}const p=t.includeObservationOnly?e.shapes.filter(y=>y.type==="bpmn:Group"&&y.width>0&&y.height>0):[];if(p.length){const y=new Map(e.shapes.filter(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 E=on(v);if(E.length)for(const w of p){const T=w.x+w.width,P=w.y+w.height,O=v.endpoints.some($=>{const H=y.get($);return!!H&&w.x<H.x&&H.x<T&&w.y<H.y&&H.y<P});let B=null;for(const $ of E){const[H,Q,J]=$.axis==="v"?[w.y,P,[["left",w.x],["right",T]]]:[w.x,T,[["top",w.y],["bottom",P]]],X=Math.min($.hi,Q)-Math.max($.lo,H);if(X<Up)continue;const me=$.axis==="v"?w.x<$.at&&$.at<T:w.y<$.at&&$.at<P;if(!(me&&O))for(const[Ae,Oe]of J){const Ee=Math.abs($.at-Oe);Ee<=la&&(!B||Ee<B.distance)&&(B={side:Ae,inside:me,distance:Ee,length:X})}}B&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:w.id,side:B.side,inside:B.inside,distance:Math.round(B.distance),length:Math.round(B.length)})}}}const f=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 f){const E=y.x<v.x+v.width&&v.x<y.x+y.width,w=y.y<v.y+v.height&&v.y<y.y+y.height,T=[["top",y.y,v.y,E],["bottom",y.y+y.height,v.y+v.height,E],["left",y.x,v.x,w],["right",y.x+y.width,v.x+v.width,w]];for(const[P,O,B,$]of T)$&&Math.abs(O-B)<=cm&&n.push({kind:"group-on-container-boundary",group:y.id,container:v.id,side:P})}const d=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<d.length;y++)for(let v=y+1;v<d.length;v++){const E=d[y],w=d[v],T=E.x<w.x+w.width&&w.x<E.x+E.width,P=E.y<w.y+w.height&&w.y<E.y+E.height,O=[["x",E.x+E.width,w.x,P],["x",w.x+w.width,E.x,P],["y",E.y+E.height,w.y,T],["y",w.y+w.height,E.y,T]];for(const[B,$,H,Q]of O)if(Q&&Math.abs($-H)<=cm){n.push({kind:"group-on-group-boundary",groups:E.id<w.id?[E.id,w.id]:[w.id,E.id],axis:B});break}}for(let y=0;y<e.edges.length;y++)for(let v=y+1;v<e.edges.length;v++){const E=e.edges[y],w=e.edges[v],T=Cr(E,w);if(!T)continue;const P=E.id<w.id?[E.id,w.id]:[w.id,E.id];n.push({kind:T.kind==="opposite"?"edge-overlap-opposite":T.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:P,axis:T.axis,length:Math.round(T.length)})}for(const y of e.edges){if(!y.label)continue;const v=jc(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=hm(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:E}of us(y.label,e))n.push({kind:"label-over-shape",edge:y.id,shape:v,depth:Math.round(E)})}const g=new Set(i.map(y=>y.id)),h=e.shapes.filter(y=>y.type==="bpmn:Participant"&&y.label);for(const y of[...i,...h.filter(v=>!g.has(v.id))]){if(!y.label)continue;const v=Em(y,e);v&&n.push({kind:"label-over-line",edge:y.id,line:v})}const m=new Set(e.shapes.filter(y=>y.type==="bpmn:TextAnnotation").map(y=>y.id));for(const y of h)for(const{owner:v,rect:E}of Ho(e))v===y.id||m.has(v)||Xp(y.label,E,ua)&&n.push({kind:"pool-name-over-label",pool:y.id,label:v});const _=Ho(e);for(const y of i)if(y.type==="bpmn:TextAnnotation")for(const{owner:v,rect:E}of _)v!==y.id&&Xp(y,E,ua)&&n.push({kind:"annotation-over-label",annotation:y.id,label:v});const x=new Map(e.shapes.map(y=>[y.id,y]));for(const y of i){const v=y.parent??bC(y,e,x);if(!v)continue;const E=x.get(v);!E||!E.container||hC(E,y,dC)||y.type==="bpmn:TextAnnotation"&&!xC(y,E,e)||n.push({kind:"shape-outside-container",shape:y.id,container:E.id})}return n.sort((y,v)=>ct(y).localeCompare(ct(v)))}const Ft=e=>typeof e=="object"&&e!==null?e:void 0,Xt=e=>typeof e=="number"?e:0,go=e=>{const t=Ft(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function _C(e){const t=Ft(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const o=t[i];for(const r of Array.isArray(o)?o:[o]){const a=go(r);a&&n.push(a)}}return n}function wC(e){const t=Ft(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:go(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:go(t.targetRef);return n&&i?{source:n,target:i}:{}}function EC(e,t){const n=Ft(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=go(n);return o?t.get(o):void 0}if(Bc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return go(n)}function Cm(e){var a,s,c,l,u;const t=[],n=[],i=((a=Ft(e))==null?void 0:a.diagrams)??[],o=new Map,r=new Set;for(const p of((s=Ft(e))==null?void 0:s.rootElements)??[]){const f=Ft(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=Ft(d),h=go(g),m=go(g==null?void 0:g.processRef);h&&m?o.set(m,h):h&&r.add(h)}}for(const p of i){const f=Ft((c=Ft(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=Ft(g);if(!h)continue;const m=Ft(h.bpmnElement),_=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!_)continue;const x=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",y=Ft(h.bounds);if(y){const E=h.isExpanded===!1&&x!=="bpmn:Participant",w=Ft((l=Ft(h.label))==null?void 0:l.bounds),T={id:_,type:x,x:Xt(y.x),y:Xt(y.y),width:Xt(y.width),height:Xt(y.height),container:Bc.has(x)&&!E,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:EC(m,o)}:{},...w?{label:{x:Xt(w.x),y:Xt(w.y),width:Xt(w.width),height:Xt(w.height)}}:{},...x==="bpmn:Group"?wm(_m(m)):{}},P=h.isHorizontal!==!1,O=typeof(m==null?void 0:m.name)=="string"?m.name:"";r.has(_)&&P&&O&&(T.label=qp(T,O)),t.push(T);continue}const v=h.waypoint;if(Array.isArray(v)){const E=Ft((u=Ft(h.label))==null?void 0:u.bounds);n.push({id:_,type:x,waypoints:v.map(w=>{var T,P;return{x:Xt((T=Ft(w))==null?void 0:T.x),y:Xt((P=Ft(w))==null?void 0:P.y)}}),endpoints:_C(m),...wC(m),...E?{label:{x:Xt(E.x),y:Xt(E.y),width:Xt(E.width),height:Xt(E.height)}}:{}})}}}return{shapes:t,edges:n}}function Mm(e){return pt(Cm(e),{includeObservationOnly:!0})}async function SC(e){const{definitions:t,warnings:n}=await aa(e);return{findings:Mm(t),warnings:n}}function Ge(e){var i;const t=[],n=[];for(const o of e.getAll()){const r=o;if(r.type==="label"||r.labelTarget)continue;const a=typeof r.type=="string"?r.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=r.waypoints;if(s){const h=Ft(r.label),m=go(r.source),_=go(r.target);n.push({id:r.id,type:a,waypoints:s.map(x=>({x:Xt(x.x),y:Xt(x.y)})),endpoints:[m,_].filter(x=>!!x),...m&&_?{source:m,target:_}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Xt(h.y),width:Xt(h.width),height:Xt(h.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=Ft(r.businessObject),l=Ft(r.label);let u=Ft(r.parent);for(;u&&u.type==="bpmn:Lane";)u=Ft(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&Bc.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:r.id,type:a,x:r.x,y:r.y,width:Xt(r.width),height:Xt(r.height),container:Bc.has(a)&&(a==="bpmn:Participant"||r.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:Xt(l.y),width:Xt(l.width),height:Xt(l.height)}}:{},...a==="bpmn:Group"?wm(_m(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=Ft(r.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=qp(d,g)),t.push(d)}return{shapes:t,edges:n}}const RC={"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 CC(e,t){const n=RC[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Am(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Pm(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 CC(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Am(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?Am(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 vp(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:No(i.businessObject).map(o=>o.locale)}}}const Qp=20,MC=4,Ve=(e,t)=>Math.abs(e-t)<.5;function Hc(e,t,n,i=Qp){if(Ve(e.y,t.y)&&!Ve(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x);if(!(o<n.x-i&&n.x+n.width+i<r))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=l=>[{x:a,y:e.y},{x:a,y:l},{x:s,y:l},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(Ve(e.x,t.x)&&!Ve(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y);if(!(o<n.y-i&&n.y+n.height+i<r))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=l=>[{x:e.x,y:a},{x:l,y:a},{x:l,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function Tm(e,t,n,i=Qp){if(n.length<2)return null;if(Ve(e.y,t.y)&&!Ve(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x),a=Math.min(...n.map(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(Ve(e.x,t.x)&&!Ve(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y),a=Math.min(...n.map(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 km(e,t,n=Qp){if(e.length!==4)return null;const[i,o,r,a]=e;if(Ve(i.y,o.y)&&Ve(o.x,r.x)&&Ve(r.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(Ve(i.x,o.x)&&Ve(o.y,r.y)&&Ve(r.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function zc(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(o>=i.y&&o<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=o>r,l=[{x:n.x+n.width,y:o},{x:a,y:o},{x:a,y:c?i.y+i.height:i.y}],u=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:r},{x:i.x,y:r}];return[l,u]}const Gc=30,AC=[0,-25,25,-40,40];function PC(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=r<o,s=a?n.y+n.height:n.y,c=a?s+Gc:s-Gc,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return AC.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}]).filter(f=>zt({...e,endpoints:[],waypoints:f},[n]).length===0)}const Jp=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],fa=(e,t,n)=>zt({...e,waypoints:t},n).length;function ef(e,t,n,i){let o=[...e.waypoints],r=fa(e,o,t);if(r===0)return null;let a=!1;for(const p of zc(e,t))if(fa(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(on),c=p=>on({...e,waypoints:p}).some(f=>Fc(f,s).length>0),l=PC(e,t).filter(p=>fa(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);if(e.endpoints.length===2&&o.length>2){const p=t.find(d=>d.id===e.endpoints[0]),f=t.find(d=>d.id===e.endpoints[1]);if(p&&f&&Ve(p.y+p.height/2,f.y+f.height/2)){const d=[o[0],o[o.length-1]];if(Ve(d[0].y,d[1].y)&&!Ve(d[0].x,d[1].x)){const g=t.filter(x=>!e.endpoints.includes(x.id)&&zt({...e,waypoints:d},[x]).length>0),h=g.length>=2?Tm(d[0],d[1],g):null,_=(h?h.map(x=>[d[0],...x,d[1]]):g.length===1?(Hc(d[0],d[1],g[0])??[]).map(x=>[d[0],...x,d[1]]):g.length===0?[d]:[]).filter(x=>fa(e,x,t)===0&&x.length<=o.length).sort((x,y)=>Number(u(y))-Number(u(x)));if(_.length)return _.find(x=>!c(x))??_[0]}}}for(let p=0;p+1<o.length;p++){const f=o[p],d=o[p+1],g=t.filter(_=>!e.endpoints.includes(_.id)&&zt({...e,waypoints:[f,d]},[_]).length>0);if(g.length<2)continue;const h=Tm(f,d,g);if(!h)continue;const m=h.map(_=>Jp(o,p,_)).filter(_=>fa(e,_,t)===0).sort((_,x)=>Number(u(x))-Number(u(_)));if(m.length)return m.find(_=>!c(_))??m[0]}for(let p=0;p<MC&&r>0;p++){let f=!1;for(let d=0;d+1<o.length&&!f;d++){const g=o[d],h=o[d+1];for(const m of t){if(e.endpoints.includes(m.id)||zt({...e,waypoints:[g,h]},[m]).length===0)continue;const _=Hc(g,h,m),x=_?_.map(v=>Jp(o,d,v)):km(o,m)??[];if(!x.length)continue;const y=[...x].sort((v,E)=>Number(u(E))-Number(u(v)));for(const v of y){const E=fa(e,v,t);if(E<r){o=v,r=E,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&r===0?o:null}function tf(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=Vn(r),s=new Set,c=pt(r).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(ct(u)));if(!c.length)return s;const l=new Map;for(const u of c){if(u.kind!=="edge-crosses-shape"||l.has(u.edge))continue;const p=r.edges.find(f=>f.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const f=i.get(u);if(!f)continue;const d=f.parent,g=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=zt(p,a);if(!n&&h.length&&h.every(v=>v.type==="bpmn:TextAnnotation")){s.add(u);continue}const m=ef(p,a,g,r.edges);if(!m){h.some(v=>v.type==="bpmn:TextAnnotation")&&s.add(u);continue}const _=r.edges.filter(v=>v.id!==u),x=di(p,_);di({...p,waypoints:m},_)>x||o.updateWaypoints(f,m)}return s}const TC=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 nf(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 of=(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),rf=(e,t)=>ls(e,[t])>0;function Om(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=Vn(r);let s=r;const c=new Set(pt(r).map(ct));for(const[l,u]of ho(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(T=>T.id===p),g=s.edges.find(T=>T.id===f);if(!d||!g)continue;const h=i.get(p);if(!h)continue;const m=nf(h),_=TC(g),x=[...zc(d,a)??[]],y=ef(d,[...a,..._],m,r.edges);y&&x.push(y);for(let T=0;T+1<d.waypoints.length;T++)for(const P of _)for(const O of Hc(d.waypoints[T],d.waypoints[T+1],P)??[])x.push(Jp(d.waypoints,T,O));const v=s.edges.filter(T=>T.id!==p),E=T=>({...s,edges:s.edges.map(P=>P.id===p?{...P,waypoints:T}:P)}),w=x.find(T=>{const P={...d,waypoints:T};return rf(P,g)||!of(T,m)||v.some(O=>O.id!==f&&!rf(d,O)&&rf(P,O))?!1:pt(E(T)).every(O=>c.has(ct(O)))});if(w){o.updateWaypoints(h,w),s=E(w);break}}}const kC=["top","bottom","left","right"],Dm={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},ps=20,OC=20;function DC(e,t){const n=e.x>=t.x-.5&&e.x<=t.x+t.width+.5,i=e.y>=t.y-.5&&e.y<=t.y+t.height+.5,o=[];return n&&Ve(e.y,t.y)&&o.push("top"),n&&Ve(e.y,t.y+t.height)&&o.push("bottom"),i&&Ve(e.x,t.x)&&o.push("left"),i&&Ve(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const LC=(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 Lm(e,t,n,i){const o=Dm[t],r=Dm[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(Ve(e[f],n[f]))return d===-g&&d*(n[p]-e[p])>=ps?[e,n]:null;let h;if(d===-g){const _=e[p]+d*ps,x=n[p]-d*ps;if(d*(x-_)<0)return null;h=Math.round((e[p]+n[p])/2)}else h=d>0?Math.max(e[p],n[p])+Gc:Math.min(e[p],n[p])-Gc;const m=(_,x)=>a?{x,y:_}:{x:_,y:x};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>=ps&&u>=ps?[e,c,n]:null}function IC(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?DC(a,r):null;if(!s)return[];const c=[];for(const l of kC){const u=LC(t,l),p=o?Lm(u,l,a,s):Lm(a,s,u,l);p&&c.push(p)}return c}const Im=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 BC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=new Set(pt(r).map(ct));let c=r;for(const[l,u]of Ni(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(O=>O.id===l),f=c.edges.find(O=>O.id===u);if(!p||!f||p.type!=="bpmn:SequenceFlow"||f.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!Ni({edges:[p,f]}).length)continue;const d=p.endpoints.find(O=>f.endpoints.includes(O)),g=d?a.get(d):void 0;if(!g||g.container)continue;const h=i.get(l),m=i.get(u);if(!h||!m)continue;const _=O=>n.has(O.id)?[O.waypoints]:[O.waypoints,...IC(O,g,a)],x=O=>O.length-2,y=_(p).flatMap(O=>_(f).map(B=>({pa:O,pb:B}))).filter(({pa:O,pb:B})=>O!==p.waypoints||B!==f.waypoints).map(O=>({...O,cost:Im(O.pa)+Im(O.pb)+OC*(x(O.pa)+x(O.pb))})).sort((O,B)=>O.cost-B.cost),v=nf(h),E=nf(m),w=Ni(c).length,T=new Set(ho(c).map(([O,B])=>`${O}|${B}`)),P=y.find(({pa:O,pb:B})=>{const $={...p,waypoints:O},H={...f,waypoints:B};if(Ni({edges:[$,H]}).length||Cr($,H)||!of(O,v)||!of(B,E))return!1;const Q={...c,edges:c.edges.map(J=>J.id===l?$:J.id===u?H:J)};return Ni(Q).length>=w||ho(Q).some(([J,X])=>!T.has(`${J}|${X}`))?!1:pt(Q).every(J=>s.has(ct(J)))});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(O=>O.id===l?{...p,waypoints:P.pa}:O.id===u?{...f,waypoints:P.pb}:O)})}}const NC=40,$C=20;function FC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>{const u=Ge(i),p=Ni(u);return{keys:new Set(pt(u).map(ct)),crossings:ho(u).length,shared:p.length,mine:p.filter(([f,d])=>f===l||d===l).length}},a=(l,u)=>{const p=Ge(i),f=p.edges.find(d=>d.id===l);return f?new Set(zt({...f,waypoints:u},Vn(p)).map(d=>d.id)):null},s=l=>!!l&&l.type==="bpmn:Participant"&&!(l.children??[]).length&&n.has(l.id),c=i.getAll().filter(l=>l.type==="bpmn:MessageFlow"&&!t.has(l.id));for(const l of c){const u=l.source,p=l.target,f=s(u)?u:s(p)?p:void 0;if(!f)continue;const d=f===u?p:u;if(!d||d.type==="bpmn:Participant")continue;const g=d.x+d.width/2;if(g>=f.x+10&&g<=f.x+f.width-10)continue;const h=g>f.x+f.width,m=f.y>d.y,_=m?d.y+d.height:d.y,x=m?f.y:f.y+f.height,y=Math.round((_+x)/2),v=B=>f===u?[...B].reverse():B,E=(l.waypoints??[]).map(B=>({x:B.x,y:B.y})),w=r(l.id),T=a(l.id,E)??new Set,P=h?f.x+f.width:f.x,O=f.x+f.width/2;for(let B=Math.min(NC,f.width/4);h?P-B>O:P+B<O;B+=$C){const $=Math.round(h?P-B:P+B),H=v([{x:g,y:_},{x:g,y},{x:$,y},{x:$,y:x}]),Q=a(l.id,H);if(!Q||[...Q].some(X=>!T.has(X)))continue;o.updateWaypoints(l,H);const J=r(l.id);if(J.crossings<=w.crossings&&J.shared<=w.shared&&J.mine<=w.mine&&[...J.keys].every(X=>w.keys.has(X)))break;o.updateWaypoints(l,E)}}}const jC=10;function Bm(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 Nm(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(H=>H.type==="bpmn:Participant"&&H.container),i=t.shapes.find(H=>H.id===e.endpoints[0]),o=t.shapes.find(H=>H.id===e.endpoints[1]);if(!i||!o)return null;const r=Bm(i,n),a=Bm(o,n);if(!r||!a||r.id===a.id)return null;const s=a.y>r.y,c=s?r:a,l=s?a:r,u=n.filter(H=>H.id!==r.id&&H.id!==a.id&&H.y>=c.y+c.height&&H.y+H.height<=l.y).sort((H,Q)=>H.y-Q.y);if(!u.length)return null;const p=u[0],f=u[u.length-1],d=(c.y+c.height+p.y)/2,g=(f.y+f.height+l.y)/2,h=s?d:g,m=s?g:d,_=e.waypoints[0],x=e.waypoints[e.waypoints.length-1],y=Vn(t),v=t.edges.filter(H=>H.id!==e.id),E=hi(e,v),w=zt(e,y).length;if(E===0&&w===0||w===0&&e.waypoints.length===2)return null;const T=Math.min(...u.map(H=>H.x)),P=Math.max(...u.map(H=>H.x+H.width)),O=(_.x+x.x)/2,B=H=>H.filter((Q,J)=>J===0||!(Ve(Q.x,H[J-1].x)&&Ve(Q.y,H[J-1].y)));let $;for(let H=T;H<=P;H+=jC){const Q=B([_,{x:_.x,y:h},{x:H,y:h},{x:H,y:m},{x:x.x,y:m},x]),J={...e,waypoints:Q};if(zt(J,y).length>0)continue;const X=hi(J,v),me=Math.abs(H-O);(!$||X<$.cross||X===$.cross&&me<$.detour)&&($={pts:Q,cross:X,detour:me})}return $&&(w>0?$.cross<=E:$.cross<E)?$.pts:null}const HC=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function zC(e,t,n){var l,u;const{elementRegistry:i}=e,o=e.modeling,r=new Map(t.shapes.map(p=>[p.id,p])),a=Ge(i),s=new Map(a.shapes.map(p=>[p.id,p])),c=Vn(a);for(const p of t.edges){if(!HC.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||!Ve(d.width,h.width)||!Ve(d.height,h.height)||!Ve(g.width,m.width)||!Ve(g.height,m.height))continue;const _=h.x-d.x,x=h.y-d.y;if(Ve(_,0)&&Ve(x,0)||!Ve(m.x-g.x,_)||!Ve(m.y-g.y,x))continue;const y=p.waypoints.map(w=>({x:w.x+_,y:w.y+x})),v=f.waypoints.map(w=>({x:w.x,y:w.y}));v.length===y.length&&v.every((w,T)=>Ve(w.x,y[T].x)&&Ve(w.y,y[T].y))||v.length===2&&(Ve(v[0].x,v[1].x)||Ve(v[0].y,v[1].y))&&zt({...p,waypoints:v},c).length===0||zt({...p,waypoints:y},c).length>0||o.updateWaypoints(f,y)}}function $m(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ge(n);for(const r of o.edges){if(r.type!=="bpmn:MessageFlow"||t.has(r.id))continue;const a=Ge(n),s=a.edges.find(u=>u.id===r.id);if(!s)continue;const c=Nm(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const af=20,Fm=10,$i=10,sf=40,GC=6,VC=40,jm=50;function WC(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<=GC})}function cf(e,t,n){let i=0;for(let o=1;o<e.length;o++){const r=e[o-1],a=e[o];if(Ve(r.y,a.y))for(const s of n)t.has(s.id)||r.y<=s.y+1||r.y>=s.y+s.height-1||(i+=Math.max(0,Math.min(Math.max(r.x,a.x),s.x+s.width)-Math.max(Math.min(r.x,a.x),s.x)))}return i}function UC(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 lf(e,t,n){if(t>n)return[];const i=[Math.min(Math.max(e,t),n)];for(let o=Fm;o<=n-t;o+=Fm)e+o<=n&&i.push(e+o),e-o>=t&&i.push(e-o);return i}function qC(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=(X,me)=>me>X.x+$i&&me<X.x+X.width-$i,g=(X,me)=>X.width<=2*sf?X.x+X.width/2:Math.min(Math.max(me,X.x+sf),X.x+X.width-sf),h=Math.max(e.x,t.x)+$i,m=Math.min(e.x+e.width,t.x+t.width)-$i;if(h<=m){const X=!a&&d(t,p)?p:!s&&d(e,f)?f:Math.round((h+m)/2);r.push([{x:X,y:l},{x:X,y:u}])}const _=s?g(t,p):f,x=a?g(e,f):p;if(!a&&!d(e,_)){const X=_<e.x?e.x:e.x+e.width;for(const me of lf(e.y+e.height/2,e.y+$i,e.y+e.height-$i))r.push([{x:X,y:me},{x:_,y:me},{x:_,y:u}])}if(!s&&!d(t,x)){const X=x<t.x?t.x:t.x+t.width;for(const me of lf(t.y+t.height/2,t.y+$i,t.y+t.height-$i))r.push([{x,y:l},{x,y:me},{x:X,y:me}])}const y=(X,me)=>{if(Math.abs(me-X)<2*$i)return[];const Ae=Math.min(X,me)+$i,Oe=Math.max(X,me)-$i;return lf(Math.round((X+me)/2),Ae,Oe)};if(!a&&n)for(const X of y(l,c?n.y+n.height:n.y))r.push([{x:p,y:l},{x:p,y:X},{x:_,y:X},{x:_,y:u}]);if(!s&&i)for(const X of y(u,c?i.y:i.y+i.height))r.push([{x,y:l},{x,y:X},{x:f,y:X},{x:f,y:u}]);const v=Math.min(x,_),E=Math.max(x,_),w=[];for(const[X,me]of o.filter(Ae=>Ae.x<E&&Ae.x+Ae.width>v).map(Ae=>[Ae.y,Ae.y+Ae.height]).sort((Ae,Oe)=>Ae[0]-Oe[0])){const Ae=w[w.length-1];Ae&&X<=Ae[1]?Ae[1]=Math.max(Ae[1],me):w.push([X,me])}const T=[];for(let X=1;X<w.length;X++)w[X][0]-w[X-1][1]>=VC&&T.push(Math.round((w[X-1][1]+w[X][0])/2));w.length&&T.push(w[0][0]-jm,w[w.length-1][1]+jm);const P=(X,me)=>me<X.y?X.y:me>X.y+X.height?X.y+X.height:void 0,O=new Set([a?e.id:n==null?void 0:n.id,s?t.id:i==null?void 0:i.id].filter(X=>!!X)),B=e.y+e.height/2,$=t.y+t.height/2,H=$>B?1:-1,Q=(X,me,Ae)=>o.some(Oe=>!O.has(Oe.id)&&Oe.x<X&&X<Oe.x+Oe.width&&Oe.y<Math.max(me,Ae)-1&&Oe.y+Oe.height>Math.min(me,Ae)+1),J=[];for(const X of T){const me=P(e,X),Ae=P(t,X);me===void 0||Ae===void 0||(X-B)*H<0&&Q(x,me,X)||(X-$)*H>0&&Q(_,Ae,X)||J.push({pts:[{x,y:me},{x,y:X},{x:_,y:X},{x:_,y:Ae}],len:Math.abs(X-me)+(E-v)+Math.abs(Ae-X)})}return{inPools:r,outside:J.sort((X,me)=>X.len-me.len).map(X=>X.pts)}}function YC(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=Ge(i);return{keys:new Set(pt(d).map(ct)),crossings:ho(d).length,shared:Ni(d).length}},l=(d,g)=>d.length===g.length&&d.every((h,m)=>Ve(h.x,g[m].x)&&Ve(h.y,g[m].y)),u=d=>{const g=d.source,h=d.target;if(!g||!h)return"skip";const m=Ge(i),_=new Map(m.shapes.map(W=>[W.id,W])),x=s(g),y=s(h),v=new Set([x,y].filter(W=>!!W)),E=m.shapes.filter(W=>W.type==="bpmn:Participant"),w=(d.waypoints??[]).map(W=>({x:W.x,y:W.y})),T=cf(w,v,E);if(T<af)return"skip";if(t.has(d.id)){const W=r.get(d.id);if(W&&l(W,w)||T-(W?cf(W,v,a):0)<af)return"skip"}const P=_.get(g.id),O=_.get(h.id),B=m.edges.find(W=>W.id===d.id);if(!P||!O||!B)return"skip";const $=Vn(m),H=new Set(zt(B,$).map(W=>W.id)),Q=Ho(m).filter(W=>W.owner!==d.id&&W.owner!==P.id&&W.owner!==O.id),J=[...m.shapes.filter(W=>!W.container&&W.id!==P.id&&W.id!==O.id),...Q.map(W=>W.rect)],X=W=>on({...B,waypoints:W}).some(ne=>WC(ne,J)),me=qC(P,O,x?_.get(x):void 0,y?_.get(y):void 0,E),Ae=W=>W.map((ne,U)=>({pts:ne,i:U,key:ne.length*2+(X(ne)?1:0)})).sort((ne,U)=>ne.key-U.key||ne.i-U.i).map(ne=>ne.pts),Oe=[...Ae(me.inPools),...Ae(me.outside)],Ee=c();for(const W of Oe){if(cf(W,v,E)>=af)continue;const ne={...B,waypoints:W};if(zt(ne,$).some(re=>!H.has(re.id))||on(ne).some(re=>UC(re,m.shapes)||Q.some(he=>Bi(he.rect,re))))continue;o.updateWaypoints(d,W);const Y=c();if(Y.crossings<=Ee.crossings&&Y.shared<=Ee.shared&&[...Y.keys].every(re=>Ee.keys.has(re)))return"fixed";o.updateWaypoints(d,w)}return"stuck"},p=i.getAll().filter(d=>d.type==="bpmn:MessageFlow"),f=[];for(const d of p)u(d)==="stuck"&&f.push(d);for(const d of f)u(d)}const Fi=[25,-25,40,-40],da=35;function KC(e,t,n=[]){const i=e.x+e.width/2,o=t.x+t.width/2,r=[],a=n.filter(s=>!s.container&&s.id!==e.id&&s.id!==t.id&&s.label).map(s=>({...s.label,id:`${s.id}:label`,type:"label",container:!1,attached:!1}));for(const s of[!0,!1]){const c=s?e.y:e.y+e.height,l=s?t.y:t.y+t.height,u=s?Math.min(e.y,t.y)-da:Math.max(e.y+e.height,t.y+t.height)+da,p=ZC(e,t,s,u,n),f=p===null?[[u,0]]:[[u,0],[p,XC]];for(const[d,g]of f)for(const h of[0,...Fi])if(!(Math.abs(h)>=e.width/2-5))for(const m of[0,...Fi]){if(Math.abs(m)>=t.width/2-5)continue;const _=i+h,x=o+m,y=[{x:_,y:c},{x:_,y:d},{x,y:d},{x,y:l}];g&&zt({endpoints:[],waypoints:y},a).length||r.push({pts:y,cost:g+Math.abs(m)+Math.abs(h)})}}return r}const XC=45,Vc=20;function ZC(e,t,n,i,o){if(!o.length)return null;const r=e.x+e.width/2,a=t.x+t.width/2,s=Math.min(r,a),c=Math.max(r,a),l=n?Math.min(e.y,t.y):Math.max(e.y+e.height,t.y+t.height),u=o.filter(m=>m.container&&(m.type==="bpmn:Lane"||m.type==="bpmn:Participant")&&r>=m.x&&r<=m.x+m.width&&e.y>=m.y&&e.y+e.height<=m.y+m.height).sort((m,_)=>m.width*m.height-_.width*_.height)[0];if(!u)return null;const p=o.filter(m=>!m.container&&m.id!==e.id&&m.id!==t.id),f=p.filter(m=>m.x<c&&m.x+m.width>s&&(n?m.y<l&&m.y+m.height>i:m.y+m.height>l&&m.y<i));if(!f.length)return null;const d=[...p,...p.flatMap(m=>m.label?[m.label]:[])].filter(m=>m.x<c&&m.x+m.width>s);if(n){let m=Math.min(...f.map(x=>x.y));for(let x=!0;x;){x=!1;for(const y of d)y.y<m&&y.y<l&&y.y+y.height>m-Vc&&(m=y.y,x=!0)}const _=Math.max(u.y,...d.filter(x=>x.y+x.height<=m).map(x=>x.y+x.height));return m-_>=Vc?Math.round((m+_)/2):null}let g=Math.max(...f.map(m=>m.y+m.height));for(let m=!0;m;){m=!1;for(const _ of d)_.y+_.height>g&&_.y+_.height>l&&_.y<g+Vc&&(g=_.y+_.height,m=!0)}const h=Math.min(u.y+u.height,...d.filter(m=>m.y>=g).map(m=>m.y));return h-g>=Vc?Math.round((g+h)/2):null}function Wc(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const o=n.y+n.height/2;if(o>=i.y&&o<=i.y+i.height)return KC(n,i,[...t.values()]);const r=i.x+i.width/2,a=n.x+n.width/2,s=o<i.y,c=s?i.y:i.y+i.height,l=s?n.y:n.y+n.height,u=s?n.y-da:n.y+n.height+da,p=[];for(const x of[0,...Fi]){if(Math.abs(x)>=i.width/2-5)continue;const y=r+x;p.push({pts:[{x:n.x,y:o},{x:y,y:o},{x:y,y:c}],cost:Math.abs(x)});for(const v of[0,...Fi]){if(Math.abs(v)>=n.width/2-5)continue;const E=a+v;p.push({pts:[{x:E,y:l},{x:E,y:u},{x:y,y:u},{x:y,y:c}],cost:Math.abs(x)+Math.abs(v)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const x of[0,...Fi]){if(Math.abs(x)>=n.width/2-5)continue;const y=a+x;p.push({pts:[{x:y,y:g},{x:y,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(x)})}const h=60,m=s?i.y+i.height:i.y,_=s?i.y+i.height+da:i.y-da;for(const x of[0,...Fi]){if(Math.abs(x)>=i.width/2-5)continue;const y=r+x;for(const v of[0,...Fi]){if(Math.abs(v)>=n.width/2-5)continue;const E=a+v;p.push({pts:[{x:E,y:g},{x:E,y:_},{x:y,y:_},{x:y,y:m}],cost:h+Math.abs(x)+Math.abs(v)})}}return p}const Uc=30;function Hm(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],o=e[n+1],r=Ve(i.y,o.y)&&!Ve(i.x,o.x),a=Ve(i.x,o.x)&&!Ve(i.y,o.y);if(!(!r&&!a))for(const s of t)if(r){const c=Math.min(i.x,o.x);if(Math.max(i.x,o.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<Uc||Math.abs(i.y-(s.y+s.height))<Uc)return!0}else{const c=Math.min(i.y,o.y);if(Math.max(i.y,o.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<Uc||Math.abs(i.x-(s.x+s.width))<Uc)return!0}}return!1}const qc=40;function QC(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-qc,a=o.x+o.width+qc,s=o.y-qc,c=o.y+o.height+qc;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],f={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},d={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(f.x<a&&d.x>r&&f.y<c&&d.y>s){i++;break}}}return i}function zm(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(w=>w.container),i=new Map(t.shapes.map(w=>[w.id,w])),o=Vn(t),r=t.edges.filter(w=>w.id!==e.id),a=di(e,r),s=hi(e,r),c=w=>QC(w,t.shapes,e.endpoints)+(Hm(w,n)?1:0),l=c(e.waypoints),u=w=>{if(!w)return;const T=w.x+w.width/2,P=w.y+w.height/2;return n.find(O=>O.type==="bpmn:Lane"&&T>=O.x&&T<=O.x+O.width&&P>=O.y&&P<=O.y+O.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=w=>{if(!d||!f)return!1;for(let T=1;T<w.length-2;T++){const P=w[T],O=w[T+1];if(Ve(P.y,O.y)&&!Ve(P.x,O.x)&&P.y>f.y&&P.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),_=(w=>{if(!w)return;const T=w.x+w.width/2,P=w.y+w.height/2;return n.filter(O=>O.type==="bpmn:Participant"&&T>=O.x&&T<=O.x+O.width&&P>=O.y&&P<=O.y+O.height).sort((O,B)=>O.width*O.height-B.width*B.height)[0]})(i.get(e.endpoints[0]??"")),x=w=>{if(!_)return 0;let T=0;for(let P=1;P<w.length-1;P++){const O=w[P];(O.x<_.x||O.x>_.x+_.width||O.y<_.y||O.y>_.y+_.height)&&T++}return T},y=x(e.waypoints);if(!Hm(e.waypoints,n)&&!(d&&!h)&&y===0)return null;const v=w=>w.reduce((T,P,O)=>O?T+Math.abs(P.x-w[O-1].x)+Math.abs(P.y-w[O-1].y):0,0);let E;for(const{pts:w,cost:T}of Wc(e,i)){const P={...e,waypoints:w};if(zt(P,o).length>0)continue;const O=di(P,r);if(O>a)continue;const B=x(w);if(B>y)continue;const $=B<y&&O===0;if(!$&&hi(P,r)>s)continue;const H=c(w),Q=g(w);if(!$&&!(Q&&!h)&&H>=l)continue;const X=Q?0:1,me=v(w);(!E||B<E.out||B===E.out&&(X<E.lane||X===E.lane&&(O<E.opp||O===E.opp&&(H<E.sc||H===E.sc&&(T<E.cost||T===E.cost&&me<E.len)))))&&(E={pts:w,out:B,sc:H,lane:X,opp:O,cost:T,len:me})}return(E==null?void 0:E.pts)??null}function JC(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 eM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i).edges.filter(a=>(!t.has(a.id)||n.has(a.id))&&a.waypoints.length>=4).map(a=>a.id).sort();for(const a of r){const s=Ge(i),c=s.edges.find(m=>m.id===a);if(!c||c.waypoints.length<4)continue;const l=Vn(s),u=s.edges.filter(m=>m.id!==a),p=zt(c,l).length,f=di(c,u),d=hi(c,u),g=n.has(a)?new Set(pt(s).map(ct)):null,h=zc(c,s.shapes);h.length===2&&JC(c,s)&&h.reverse();for(const m of h){if(m.length>=c.waypoints.length)continue;const _={...c,waypoints:m};if(zt(_,l).length>p||di(_,u)>f||hi(_,u)>d)continue;if(g){const y=new Set(pt({...s,edges:s.edges.map(w=>w.id===a?_:w)}).map(ct)),v=[...y].filter(w=>!g.has(w)).length,E=[...g].filter(w=>!y.has(w)).length;if(v>E)continue}const x=i.get(a);x&&o.updateWaypoints(x,m);break}}}function Gm(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ge(n).edges.filter(r=>r.type==="bpmn:SequenceFlow"&&!t.has(r.id)).map(r=>r.id).sort();for(const r of o){const a=Ge(n),s=a.edges.find(u=>u.id===r);if(!s)continue;const c=zm(s,a);if(!c)continue;const l=n.get(r);l&&i.updateWaypoints(l,c)}}function uf(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],o=t.get(e.endpoints[0]??""),r=t.get(e.endpoints[1]??""),a=Ve(n[0].x,n[1].x)&&!Ve(n[0].y,n[1].y),s=Ve(n[n.length-1].x,n[n.length-2].x)&&!Ve(n[n.length-1].y,n[n.length-2].y);for(const c of Fi){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 Vm=e=>e==="bpmn:SequenceFlow"||e==="bpmn:MessageFlow";function tM(e,t,n){const i=e.waypoints;if(i.length<2||!Vm(e.type))return[];const o=i[0],r=i[1],a=Ve(o.y,r.y)&&!Ve(o.x,r.x),s=Ve(o.x,r.x)&&!Ve(o.y,r.y);if(!a&&!s)return[];const c=Math.sign(a?r.x-o.x:r.y-o.y);if(!t.some(g=>{if(!Vm(g.type)||g.type===e.type||g.waypoints.length<2)return!1;const h=g.waypoints[0],m=g.waypoints[1];return!Ve(h.x,o.x)||!Ve(h.y,o.y)?!1:a?Ve(h.y,m.y)&&Math.sign(m.x-h.x)===c:Ve(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 Fi){const h=(a?o.y:o.x)+g;if(!f(u,h)||i.length===2&&(!p||!f(p,h)))continue;const m=i.map(_=>({..._}));for(const _ of[m[0],m[1]])a?_.y=h:_.x=h;d.push({pts:m,cost:Math.abs(g)})}return d}function nM(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const o=i.y+i.height<=n.y,r=n.y+n.height<=i.y;if(!o&&!r)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,l=n.y+n.height/2,u=i.x+i.width/2,p=i.y+i.height/2,f=a?n.x+n.width:n.x,d=r?n.y+n.height:n.y,g=a?i.x:i.x+i.width,h=r?i.y:i.y+i.height,m=[];for(const _ of[0,...Fi])Math.abs(_)<i.width/2-5&&m.push({pts:[{x:f,y:l},{x:u+_,y:l},{x:u+_,y:h}],cost:Math.abs(_)}),Math.abs(_)<i.height/2-5&&m.push({pts:[{x:c,y:d},{x:c,y:p+_},{x:g,y:p+_}],cost:Math.abs(_)});return m}function pf(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,...Fi]){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 Wm(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Vn(t),o=t.edges.filter(d=>d.id!==e.id),r=di(e,o);if(r===0)return null;const a=hi(e,o);let s;const c=d=>d.reduce((g,h,m)=>m?g+Math.abs(h.x-d[m-1].x)+Math.abs(h.y-d[m-1].y):0,0),l=3,u=d=>{const g=d[0],h=d[d.length-1],m=Math.hypot(h.x-g.x,h.y-g.y);return m>=1&&c(d)/m>=l?1:0},p=u(e.waypoints),f=[...Wc(e,n),...pf(e,n),...uf(e,n),...tM(e,o,n)];for(const{pts:d,cost:g}of f){const h={...e,waypoints:d};if(zt(h,i).length>0)continue;const m=di(h,o),_=hi(h,o),x=r-m+(p-u(d));if(m>=r||_-a>x)continue;const y=c(d);(!s||m<s.opposite||m===s.opposite&&(_<s.cross||_===s.cross&&(g<s.cost||g===s.cost&&y<s.len)))&&(s={pts:d,opposite:m,cross:_,cost:g,len:y})}return(s==null?void 0:s.pts)??null}function Um(e,t){var i;let n=0;for(const o of t)o.id!==e.id&&((i=Cr(e,o))==null?void 0:i.kind)==="unrelated"&&n++;return n}function iM(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=Vn(t),o=t.edges.filter(f=>f.id!==e.id),r=Um(e,o);if(r===0)return null;const a=di(e,o),s=hi(e,o),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[...Wc(e,n),...pf(e,n),...nM(e,n),...uf(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(zt(g,i).length>0)continue;const h=Um(g,o);if(h>=r)continue;const m=di(g,o);if(m-h>a-r)continue;const _=hi(g,o);if(_-s>(r-h)*l)continue;const x=c(f);(!u||h<u.fake||h===u.fake&&(m<u.unreadable||m===u.unreadable&&(_<u.cross||_===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,fake:h,unreadable:m,cross:_,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function qm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=pt(Ge(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(ct(s)));if(!r.length)return;const a=new Set;for(const s of r)if(s.kind==="edge-overlap-unrelated")for(const c of s.edges)n.has(c)||a.add(c);for(const s of[...a].sort()){const c=Ge(i),l=c.edges.find(f=>f.id===s);if(!l)continue;const u=iM(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function Ym(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 Km(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Cr(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:Ym(e,n)&&Ym(t,n)}function Xm(e,t,n){let i=0;for(const o of t)o.id!==e.id&&Km(e,o,n)&&i++;return i}function oM(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=Vn(t),o=t.edges.filter(f=>f.id!==e.id),r=Xm(e,o,n);if(r===0)return null;const a=di(e,o),s=hi(e,o),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[...Wc(e,n),...pf(e,n),...uf(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(zt(g,i).length>0)continue;const h=Xm(g,o,n);if(h>=r)continue;const m=di(g,o);if(m-h>a-r)continue;const _=hi(g,o);if(_-s>(r-h)*l)continue;const x=c(f);(!u||h<u.chain||h===u.chain&&(m<u.unreadable||m===u.unreadable&&(_<u.cross||_===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,chain:h,unreadable:m,cross:_,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function rM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=pt(r).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(ct(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,p]=l.edges.map(f=>r.edges.find(d=>d.id===f));if(!(!u||!p||!Km(u,p,a)))for(const f of l.edges)n.has(f)||c.add(f)}for(const l of[...c].sort()){const u=Ge(i),p=u.edges.find(g=>g.id===l);if(!p)continue;const f=oM(p,u);if(!f)continue;const d=i.get(l);d&&o.updateWaypoints(d,f)}}function Zm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=pt(r).filter(u=>Yp(u)&&!t.has(ct(u)));if(!a.length)return;const s=new Set;for(const u of a)if(Yp(u))for(const p of u.edges)n.has(p)||s.add(p);const c=u=>{var p;return((p=r.edges.find(f=>f.id===u))==null?void 0:p.type)??""},l=[...s].sort((u,p)=>{const f=c(u)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:u.localeCompare(p)});for(const u of l){const p=Ge(i),f=p.edges.find(h=>h.id===u);if(!f)continue;const d=Wm(f,p);if(!d)continue;const g=i.get(u);g&&o.updateWaypoints(g,d)}}const aM=10,sM=(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 Qm(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!jc(e,i))return null;const o=Vn(t),r=i.flatMap(on);for(const a of on(e)){let s=[[a.lo,a.hi]];for(const[d,g]of Fc(a,r))s=s.flatMap(([h,m])=>{const _=[];return d>h&&_.push([h,Math.min(m,d)]),g<m&&_.push([Math.max(h,g),m]),_.filter(([x,y])=>y>x)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,g])=>g-d>=c+aM*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-fm}:{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(!jc({...e,label:f},i)&&!o.some(d=>!e.endpoints.includes(d.id)&&sM(f,d)))return f}return null}const Tn=8;function ff(e,t){const n=e.label;if(!n)return null;const i=on(e);if(!i.length)return null;const o=n.x+n.width/2,r=n.y+n.height/2,a=f=>{const d=f.axis==="h"?o:r,g=f.axis==="h"?r-f.at:o-f.at,h=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(g,h)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(on),...t.shapes.filter(f=>f.container).flatMap(pa)],l=f=>!c.some(d=>Bi(f,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+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 Jm=30,cM=(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},ey=(e,t)=>cM({x:e.x+e.width/2,y:e.y+e.height/2},t);function lM(e,t){const n=e.label;if(!n)return null;const i=on(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(on),...t.shapes.filter(c=>c.container).flatMap(pa)],r=Ho(t).filter(c=>c.owner!==e.id).map(c=>c.rect),a=(c,l)=>c.x<l.x+l.width&&l.x<c.x+c.width&&c.y<l.y+l.height&&l.y<c.y+c.height,s=c=>!o.some(l=>Bi(c,l))&&!us(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 ty(e,t){var a,s;const{elementRegistry:n}=e,i=e.modeling;let o=Ge(n),r=new Set(pt(o).map(ct));for(const[c,l]of t){const u=l.wps,p=n.get(c),f=p==null?void 0:p.label;if(!f||!(p!=null&&p.waypoints))continue;const d=p.waypoints[0].x-u[0].x,g=p.waypoints[0].y-u[0].y;if(!(p.waypoints.length===u.length&&p.waypoints.every((w,T)=>w.x-u[T].x===d&&w.y-u[T].y===g))){if(((a=p.source)==null?void 0:a.id)===l.source&&((s=p.target)==null?void 0:s.id)===l.target)continue;const w=o.edges.find($=>$.id===c);if(!(w!=null&&w.label)||!us(w.label,o).length)continue;let T={...w.label,x:l.label.x,y:l.label.y};if((us(T,o).length||ey(T,w.waypoints)>Jm)&&(T=null),!T&&ey(w.label,w.waypoints)>Jm&&(T=lM(w,o)),!T)continue;const P=T,O={...o,edges:o.edges.map($=>$.id===c?{...$,label:P}:$)},B=pt(O);if(B.some($=>!r.has(ct($))))continue;i.moveElements([f],{x:P.x-f.x,y:P.y-f.y}),o=O,r=new Set(B.map(ct));continue}const m=l.label.x+d-f.x,_=l.label.y+g-f.y;if(m===0&&_===0)continue;const x=o.edges.find(w=>w.id===c);if(!(x!=null&&x.label))continue;const y={...x.label,x:x.label.x+m,y:x.label.y+_},v={...o,edges:o.edges.map(w=>w.id===c?{...w,label:y}:w)},E=pt(v);E.some(w=>!r.has(ct(w)))||(i.moveElements([f],{x:m,y:_}),o=v,r=new Set(E.map(ct)))}}function ny(e,t,n=new Set){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i);for(const a of r.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=ff(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 iy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=pt(r).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(ct(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=r.edges.find(f=>f.id===s.edge);if(!c)continue;const l=Qm(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 oy(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(on),...t.shapes.filter(f=>f.container).flatMap(pa)],o=i.filter(f=>Bi(n,f));if(!o.length)return null;const r=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=Ho(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Bi(f,d))&&!r.some(d=>s(f,d))&&!a.some(d=>s(f,d)),l=[];for(const f of o)f.axis==="h"?l.push({...n,y:f.at-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 ry(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ge(n);for(const r of o.shapes){if(r.container||!r.label||t.has(r.id))continue;const a=oy(r,Ge(n));if(!a)continue;const s=n.get(r.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function uM(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 ay(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=Ge(n),r=new Set(pt(o).map(ct));const a=[...new Set(pt(o).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(ct(s))).map(s=>s.edge))].sort();for(const s of a){const c=o.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[h,m]of u){const _=h?o.shapes.find(y=>y.id===h):void 0;if(!_)continue;const x=uM(_,l[m]);x.x===l[m].x&&x.y===l[m].y||(l[m]=x,p=!0)}if(!p)continue;const f={...o,edges:o.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=pt(f);if(d.some(h=>!r.has(ct(h))))continue;const g=n.get(s);g&&(i.updateWaypoints(g,l),o=f,r=new Set(d.map(ct)))}}const df=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function sy(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 pM(e,t,n){const i=[],o=n?is(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 sy(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(!df(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[d,g]of Object.entries(u))typeof g!="string"||g===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${d}`}),p=!1):o.includes(d)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:d,locales:o}),p=!1);if(!p)continue;const f=o.filter(d=>!(d in u));f.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:f})}}),i}function bi(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function 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(df(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=sy(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,f=bi(c.participant,"name",a(u));c.participant.lanes&&(f.lanes=c.participant.lanes.map((d,g)=>bi(d,"name",a(p[g])))),s.push({...c,participant:f});break}case"participant.update":{const[u,...p]=l,f=bi(c,"name",a(u));c.lanes&&(f.lanes=c.lanes.map((d,g)=>bi(d,"name",a(p[g])))),s.push(f);break}case"node.add":s.push({...c,node:bi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:bi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:bi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:bi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:bi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:bi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(bi(c,"text",a(l[0])));break;default:s.push(df(l[0].map)?bi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const dM=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,cy=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),ly={"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}]},fs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Yc=e=>typeof e=="string"&&e!=="";function hM(e){const t=[];function n(i,o,r,a){if(a===null){Yc(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!fs(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)Yc(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!fs(i)||!Yc(i.kind)||!(i.kind in ly)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of ly[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(!fs(f))break;f=f[g]}if(!fs(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;fs(c)&&!Yc(c.text)&&c.texts===void 0&&t.push({kind:"payload-invalid",opIndex:o,field:"annotation.text"})}if(i.kind==="node.add"||i.kind==="node.update"){const c=i.band;c!==void 0&&(!Number.isInteger(c)||c<0)&&t.push({kind:"payload-invalid",opIndex:o,field:"band"});const l=i.kind==="node.add"?(r=i.node)==null?void 0:r.type:i.type,u=(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"";if(typeof l=="string"&&!Pg(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&&!Tg(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 uy(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,_){if(!dM.test(m)){o.push({kind:"id-invalid",opIndex:h,id:m});return}if(t.categoryOf(m)!==void 0||r.has(m)){o.push({kind:"id-duplicate",opIndex:h,id:m});return}r.set(m,{..._,opIndex:h})}e.forEach((h,m)=>{var _;switch(h.kind){case"participant.add":s(m,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(x=>x.id)});for(const x of h.participant.lanes??[])s(m,x.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 x of h.associations??[])x.id&&s(m,x.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(m,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(m,h.association.id,{category:"association"});break;case"annotation.add":s(m,h.annotation.id,{category:"annotation"}),(_=h.association)!=null&&_.id&&s(m,h.association.id,{category:"association"});break;case"group.add":s(m,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(x=>x.id));for(const x of h.lanes)t.categoryOf(x.id)===void 0&&s(m,x.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,_,x){const y=c(m);if(y===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:_});return}if(x&&!x.includes(y)){o.push({kind:"ref-category",opIndex:h,ref:m,role:_,expected:x.join("|"),actual:y});return}return y}const p=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),f=new Map;for(const h of e)h.kind==="node.add"?f.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&f.set(h.id,h.eventDefinition);const d=h=>f.has(h)?f.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,m)=>{var _,x;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:y,lane:v}=h.node;if(y===void 0){(p||v!==void 0)&&o.push({kind:"participant-required",opIndex:m,id:h.node.id});break}if(u(m,y,"participant",["participant"])===void 0)break;v!==void 0&&((((_=r.get(y))==null?void 0:_.lanes)??a.get(y)??t.lanesOf(y)).includes(v)||o.push({kind:"lane-unknown",opIndex:m,lane:v,participant:y}));break}case"sequenceFlow.add":{const{id:y,source:v,target:E,name:w,condition:T}=h.flow,P=u(m,v,"source",["flowNode"]),O=u(m,E,"target",["flowNode"]);P&&O&&l(v)!==l(E)&&o.push({kind:"flow-cross-pool",opIndex:m,id:y}),w!==void 0&&T!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:y});break}case"messageFlow.add":{const{id:y,source:v,target:E}=h.flow,w=u(m,v,"source",["flowNode","participant"]),T=u(m,E,"target",["flowNode","participant"]);if(w&&T){const P=l(v),O=l(E);P!==void 0&&P===O&&o.push({kind:"message-flow-same-pool",opIndex:m,id:y})}for(const P of[v,E])d(P)&&o.push({kind:"message-flow-timer-endpoint",opIndex:m,id:y,ref:P});break}case"dataStore.add":{for(const y of h.associations??[]){if([y.source,y.target].filter(w=>w===h.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:m,source:y.source,target:y.target});continue}const E=y.source===h.dataStore.id?y.target:y.source;u(m,E,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:y,target:v}=h.association,E=u(m,y,"source"),w=u(m,v,"target");if(E&&w){const T=new Set([E,w]);T.has("dataStore")&&T.has("flowNode")||o.push({kind:"data-association-ends",opIndex:m,source:y,target:v})}break}case"association.add":{const{id:y,source:v,target:E}=h.association,w=u(m,v,"source"),T=u(m,E,"target");w&&T&&w!=="annotation"&&T!=="annotation"&&o.push({kind:"association-detached",opIndex:m,annotation:y??`${v}->${E}`});break}case"annotation.add":{if(h.association){const{source:y,target:v}=h.association;if(y!==h.annotation.id&&v!==h.annotation.id)o.push({kind:"association-detached",opIndex:m,annotation:h.annotation.id});else{const E=y===h.annotation.id?v:y;u(m,E,"association")}}h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.add":{for(const y of h.group.members??[]){const v=u(m,y,"member");v&&cy.has(v)&&o.push({kind:"ref-category",opIndex:m,ref:y,role:"member",expected:"shape",actual:v})}break}case"participant.update":{if(g(m,h.id,"participant")===void 0)break;if(h.lanes){const y=t.lanesOf(h.id),v=h.lanes.map(P=>P.id);for(const P of y)v.includes(P)||o.push({kind:"lane-shrink-unsupported",opIndex:m,participant:h.id,lane:P});for(const P of v)t.categoryOf(P)!==void 0&&!y.includes(P)&&o.push({kind:"id-duplicate",opIndex:m,id:P});const E=v.filter(P=>y.includes(P)),w=P=>E.every((O,B)=>O===P[B]),T=(((x=t.laneDeclarationOrderOf)==null?void 0:x.call(t,h.id))??y).filter(P=>y.includes(P));E.length===y.length&&!w(y)&&!w(T)&&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 y=t.participantOf(h.id);(y?a.get(y)??t.lanesOf(y):[]).includes(h.lane)||o.push({kind:"lane-unknown",opIndex:m,lane:h.lane,participant:y??""})}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 y=h.source===void 0||u(m,h.source,"source",["flowNode"])!==void 0,v=h.target===void 0||u(m,h.target,"target",["flowNode"])!==void 0,E=t.endpointsOf(h.id),w=h.source??(E==null?void 0:E.source),T=h.target??(E==null?void 0:E.target);y&&v&&w!==void 0&&T!==void 0&&new Set([l(w),l(T),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 y of h.members??[]){const v=u(m,y,"member");v&&cy.has(v)&&o.push({kind:"ref-category",opIndex:m,ref:y,role:"member",expected:"shape",actual:v})}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(...pM(e,t,n.i18n)),o;function g(h,m,_){if(r.has(m)){o.push({kind:"target-added-in-batch",opIndex:h,id:m});return}const x=t.categoryOf(m);if(x===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:"target"});return}if(_&&x!==_){o.push({kind:"ref-category",opIndex:h,ref:m,role:"target",expected:_,actual:x});return}return x}}function py(e){return{modeling:e.get("modeling"),bpmnFactory:e.get("bpmnFactory"),elementFactory:e.get("elementFactory"),elementRegistry:e.get("elementRegistry"),canvas:e.get("canvas"),autoPlace:e.get("autoPlace"),bpmnReplace:e.get("bpmnReplace"),spaceTool:e.get("spaceTool")}}function Kc(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Xc={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]},kn=10,gM=300,mM=160,fy=20,hf=100,dy=40,yM=10,vM=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function hy(e,t,n){if(!(t.width>0))return;const i=t.x+t.width/2,o=t.y+t.height/2;let r;for(const a of e.getAll()){if(a.type!=="bpmn:Lane")continue;const s=a;typeof s.x!="number"||typeof s.width!="number"||i>=s.x&&i<=s.x+s.width&&o>=s.y&&o<=s.y+s.height&&(!r||s.width*s.height<r.width*r.height)&&(r=s)}return r?{x:n.x,width:n.width,y:r.y,height:r.height}:void 0}const Zc=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function Qc(e,t,n,i,o){const r=n,a=hy(e,t,i),s=a??i,c=(Q,J,X=s)=>{const[me,Ae]=Xc[Q];let Oe={x:t.x+t.width/2+me*(t.width/2+r.width/2+J),y:t.y+t.height/2+Ae*(t.height/2+r.height/2+J)};const Ee=X.x+kn+r.width/2,W=X.x+X.width-kn-r.width/2,ne=X.y+kn+r.height/2,U=X.y+X.height-kn-r.height/2,Y={x:Math.min(W,Math.max(Ee,Oe.x)),y:Math.min(U,Math.max(ne,Oe.y))};return(Y.x!==Oe.x||Y.y!==Oe.y)&&(Oe=Math.abs(Y.x-(t.x+t.width/2))<(t.width+r.width)/2+kn&&Math.abs(Y.y-(t.y+t.height/2))<(t.height+r.height)/2+kn?{x:t.x+t.width+kn+r.width/2,y:Y.y}:Y),Oe},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=Ge(e),p=Q=>{var X,me;if(!o.selfId)return!1;const J=e.get(Q);return!!J&&(((X=J.source)==null?void 0:X.id)===o.selfId||((me=J.target)==null?void 0:me.id)===o.selfId)},f=u.edges.filter(Q=>!p(Q.id)).flatMap(on),d=Ho(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 J=g(Q);return l.some(X=>J.x0<X.x+X.width&&J.x1>X.x&&J.y0<X.y+X.height&&J.y1>X.y)},m=Q=>{const J=g(Q);return f.some(X=>X.axis==="h"?X.at>J.y0&&X.at<J.y1&&X.lo<J.x1&&X.hi>J.x0:X.at>J.x0&&X.at<J.x1&&X.lo<J.y1&&X.hi>J.y0)},_=Q=>{const J=g(Q);return d.some(X=>J.x0<X.x+X.width&&J.x1>X.x&&J.y0<X.y+X.height&&J.y1>X.y)},x=u.shapes.filter(Q=>Q.type==="bpmn:Group").flatMap(Q=>[{axis:"h",at:Q.y,lo:Q.x,hi:Q.x+Q.width},{axis:"h",at:Q.y+Q.height,lo:Q.x,hi:Q.x+Q.width},{axis:"v",at:Q.x,lo:Q.y,hi:Q.y+Q.height},{axis:"v",at:Q.x+Q.width,lo:Q.y,hi:Q.y+Q.height}]),y=Q=>{const J=g(Q);return x.some(X=>X.axis==="h"?X.at>J.y0&&X.at<J.y1&&X.lo<J.x1&&X.hi>J.x0:X.at>J.x0&&X.at<J.x1&&X.lo<J.y1&&X.hi>J.y0)},v=Q=>h(Q)||m(Q)||_(Q)||y(Q),E=Q=>Q.x-r.width/2>=i.x&&Q.x+r.width/2<=i.x+i.width&&Q.y-r.height/2>=i.y&&Q.y+r.height/2<=i.y+i.height,w=Q=>E(Q)&&(!a||Zc(Q,r,a));if(o.placement){const Q=Ee=>Ee.startsWith("top")?Ee.replace(/^top/,"bottom"):Ee.replace(/^bottom/,"top"),J=Ee=>Ee.endsWith("left")?Ee.replace(/left$/,"right"):Ee.replace(/right$/,"left"),X=o.placement.side,me=[X,Q(X),J(X),Q(J(X)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],Ae=o.placement.offset??50;let Oe=c(X,Ae);if(v(Oe)||a&&!Zc(Oe,r,a)){const Ee=(W,ne)=>{const U=new Set;for(const Y of me){if(U.has(Y))continue;U.add(Y);const re=c(Y,Ae,W);if(ne(re)&&!v(re))return Oe=re,!0}return!1};!Ee(s,w)&&a&&Ee(i,E)}return Oe}const T=o.from,P=s.x+kn+r.width/2,O=s.x+s.width-kn-r.width/2,B=s.y+kn+r.height/2,$=s.y+s.height-kn-r.height/2;let H={x:Math.min(O,Math.max(P,T.x)),y:Math.min($,Math.max(B,T.y))};if(v(H)){const Q=(t.width+r.width)/2+kn,X=[{x:H.x+Q,y:H.y},{x:H.x-Q,y:H.y},{x:H.x,y:H.y-r.height-kn},{x:H.x,y:H.y+r.height+kn}].filter(w).find(me=>!v(me));X&&(H=X)}return H}function en(e,t){return e.filter(n=>n.kind===t)}class gy extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}function my(e,t){var k1,O1,D1,L1,I1,B1,N1,$1,F1,j1,H1,z1,G1,V1,W1,U1,q1,Y1,K1,X1,Z1,Q1,J1;const{modeling:n,bpmnFactory:i,elementFactory:o,elementRegistry:r,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),p=b=>r.get(b),f=b=>{const S=p(b);if(!S)throw new Error(`하강 참조 해소 실패: ${b}`);return S},d=b=>{let S=b.parent;for(;S;){if(S.type==="bpmn:Participant")return S;S=S.parent}},g=new Map;for(const b of r.filter(S=>!("waypoints"in S&&S.waypoints)&&S.type!=="bpmn:Lane"&&S.type!=="label"&&typeof S.x=="number"))g.set(b.id,{x:b.x,y:b.y});const h=en(e,"participant.add"),m=en(e,"node.add"),_=en(e,"sequenceFlow.add"),x=en(e,"messageFlow.add"),y=en(e,"dataStore.add"),v=en(e,"dataAssociation.add"),E=en(e,"annotation.add"),w=en(e,"group.add"),T=new Map(m.map(b=>[b.node.id,b])),P=(b,S,A)=>{var F;const k=b.businessObject,L=(((F=k.extensionElements)==null?void 0:F.values)??[]).filter(I=>I.$type!==S),D=A?[...L,i.create(S,A)]:L;if(!D.length){k.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const j=i.create("bpmn:ExtensionElements",{values:D});D.forEach(I=>{I.$parent=j}),n.updateProperties(b,{extensionElements:j})},O=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of en(e,"element.remove")){const S=p(b.id);S&&n.removeElements([S])}const B=b=>r.filter(S=>{var A;return S.type==="bpmn:Lane"&&((A=d(S))==null?void 0:A.id)===b}).sort((S,A)=>S.y-A.y);for(const b of en(e,"participant.update")){const S=f(b.id);if(b.name!==void 0&&n.updateProperties(S,{name:b.name??void 0}),!b.lanes)continue;const A=B(b.id);if(!A.length){n.splitLane(S,b.lanes.length),B(b.id).forEach((D,j)=>{const F=b.lanes[j];F&&n.updateProperties(D,{id:F.id,name:F.name})});continue}const k=new Set(A.map(D=>D.id)),L=b.lanes.reduce((D,j,F)=>k.has(j.id)?F:D,-1);b.lanes.forEach((D,j)=>{if(k.has(D.id)){n.updateProperties(f(D.id),{name:D.name});return}const F=j===L+1&&L>=0,I=j===0?n.addLane(B(b.id)[0],"top"):F?n.addLane(B(b.id).at(-1),"bottom"):n.addLane(f(b.lanes[j-1].id),"bottom");n.updateProperties(I,{id:D.id,name:D.name})})}const $=150,H=130,Q=80,J=90,X=180,me=30,Ae=30,Oe=(b,S,A,k,L)=>{const D=A-S.width/2,j=k-S.height/2;return(b.children??[]).find(F=>!("waypoints"in F&&F.waypoints)&&F.type!=="bpmn:Lane"&&F.type!=="label"&&!(L!=null&&L.has(F.id))&&typeof F.x=="number"&&D<F.x+F.width+Ae&&D+S.width+Ae>F.x&&j<F.y+F.height&&j+S.height>F.y)},Ee=new Set;for(const b of h){Ee.add(`pool:${b.participant.id}`);for(const S of b.participant.lanes??[])Ee.add(S.id)}const W=new Map;for(const b of m){const S=b.node.lane??`pool:${b.node.participant??""}`;let A=W.get(S);A||W.set(S,A=new Set([0])),b.band!==void 0&&A.add(b.band)}const ne=new Map;for(const[b,S]of W){if(!Ee.has(b))continue;const A=[...S].sort((D,j)=>D-j),k=A.map((D,j)=>j===0?0:j%2===1?Math.ceil(j/2):-(j/2)),L=Math.min(...k);ne.set(b,new Map(A.map((D,j)=>[D,k[j]-L])))}{const b=new Map;for(const S of h)(S.participant.lanes??[]).forEach((A,k)=>b.set(A.id,k));for(const[S,A]of ne){if(!b.has(S)||A.size<2)continue;const k=b.get(S),L=A.get(0)??0,D=new Set;for(const ce of m){if(ce.node.lane!==S||(ce.band??0)!==0||!ce.node.type.endsWith("Gateway"))continue;const oe={in:new Set,out:new Set,cross:new Set};for(const pe of _){const ye=pe.flow.source===ce.node.id;if(!ye&&pe.flow.target!==ce.node.id)continue;const Ie=T.get(ye?pe.flow.target:pe.flow.source);if(!Ie||Ie.node.participant!==ce.node.participant||!Ie.node.lane)continue;let Te,te=!1;if(Ie.node.lane!==S){const se=b.get(Ie.node.lane);if(se===void 0)continue;Te=se>k?"down":"up",te=!0}else{const se=A.get(Ie.band??0)??L;Te=se>L?"down":se<L?"up":void 0}Te&&(oe[ye?"out":"in"].add(Te),te&&oe.cross.add(Te))}for(const pe of["up","down"])oe.in.has(pe)&&oe.out.has(pe)&&oe.cross.has(pe)&&D.add(pe)}if(D.size!==1)continue;const[j]=D,F=Math.max(...A.values()),I=j==="down"?F:0;if(L===I)continue;const q=[...A.entries()].filter(([ce])=>ce!==0).sort((ce,oe)=>ce[1]-oe[1]),Z=[...Array(F+1).keys()].filter(ce=>ce!==I),ae=new Map([[0,I]]);q.forEach(([ce],oe)=>ae.set(ce,Z[oe])),ne.set(S,ae)}}const U=b=>{var S;return(((S=W.get(b))==null?void 0:S.size)??0)>1},Y=b=>b.band??(b.node.lane||!U(`pool:${b.node.participant??""}`)?void 0:0),re=new Map,he=b=>re.get(b.node.id)??Y(b),Le=new Set,N=new Set;{const b=new Map;for(const k of _)b.set(k.flow.target,(b.get(k.flow.target)??0)+1);const S=k=>{const L=[],D=new Set([k]),j=[k];for(;j.length;){const F=j.shift();L.push(F);for(const I of _)I.flow.source!==F||D.has(I.flow.target)||(b.get(I.flow.target)??0)!==1||(D.add(I.flow.target),j.push(I.flow.target))}return L},A=(k,L)=>{var D;return((D=ne.get(k))==null?void 0:D.get(L))??L};for(const k of m){if(!k.node.type.endsWith("Gateway"))continue;const L=k.node.lane??`pool:${k.node.participant??""}`,D=ne.get(L);if(!D||D.size<2)continue;const j=he(k);if(j===void 0||A(L,j)!==A(L,0))continue;const F=A(L,j),I=_.filter(pe=>pe.flow.source===k.node.id).map(pe=>T.get(pe.flow.target)).filter(pe=>!!pe&&(pe.node.lane??`pool:${pe.node.participant??""}`)===L),q=I.filter(pe=>{const ye=he(pe);return ye!==void 0&&A(L,ye)===F&&(b.get(pe.node.id)??0)===1}),Z=I.some(pe=>{const ye=he(pe);return ye!==void 0&&A(L,ye)>F});if(q.length!==1||!Z)continue;const ae=new Set(I.flatMap(pe=>S(pe.node.id)));if(!_.some(pe=>pe.flow.target===k.node.id&&ae.has(pe.flow.source)))continue;const oe=new Map;for(const[pe,ye]of D)oe.set(pe,ye+1);oe.set(-1,0),ne.set(L,oe);for(const pe of S(q[0].node.id))T.has(pe)&&(re.set(pe,-1),N.add(pe));Le.add(k.node.id)}}const C=(b,S)=>{var A;return((A=ne.get(b))==null?void 0:A.get(S))??S},R=(b,S,A,k)=>{const L=b?p(b):S?p(S):void 0;if(!L)return!1;const D=b?L.y+Math.min(L.height/2,J):L.y+Q;return Math.abs(D+C(b??`pool:${S??""}`,A)*$-k)<=$/2},G=new Map;for(const[b,S]of W){let A=0;for(const k of S)A=Math.max(A,C(b,k));G.set(b,A)}const K=b=>X+$*b,ie=(b,S,A)=>{const k=u().children.filter(L=>!("waypoints"in L&&L.waypoints)&&L.type!=="label"&&L.id!==S&&typeof L.y=="number"&&L.y>=b);k.length&&n.moveElements(k,{x:0,y:A})},Pe=(b,S,A)=>{const k=b.type==="bpmn:Participant"?b:void 0;if(!k||k.children.some(F=>F.type==="bpmn:Lane"))return;const L=A+S.height/2+me-k.y;if(k.height>=L)return;const D=L-k.height,j=k.y+k.height;n.resizeShape(k,{x:k.x,y:k.y,width:k.width,height:L}),ie(j,k.id,D)},et=(b,S)=>{const A=S-b.height;if(A<=0)return;const k=d(b)??b,L=[],D=I=>{L.push(I);for(const q of I.children??[])D(q)};D(k);const j=b.y+b.height-10,F=l.calculateAdjustments(L,"y",A,j);l.makeSpace(F.movingShapes,F.resizingShapes,{x:0,y:A},"s",j)},mt=(b,S,A)=>{if(b){const j=f(b),F=K(S);if(j.height>=F)return;const I=F-j.height,q=d(j),Z=q?q.y+q.height:j.y+j.height;et(j,F),ie(Z,q==null?void 0:q.id,I);return}if(!A)return;const k=$*(S+1);if(A.height>=k)return;const L=k-A.height,D=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:k}),ie(D,A.id,L)},qt=new Map;for(const b of _)qt.set(b.flow.target,(qt.get(b.flow.target)??0)+1);const Ct=b=>(qt.get(b)??0)<=1,vn=new Set(m.map(b=>b.node.id).filter(b=>en(e,"sequenceFlow.update").filter(S=>S.target===b).length===1&&!_.some(S=>S.flow.target===b||S.flow.source===b&&T.has(S.flow.target)))),Cn=new Map,qn=(b,S)=>{if(!b)return;const A=p(b);if(!A||A.height>=K(S))return;const k=A.y+A.height-10,L=d(A);if(L)return new Set((L.children??[]).filter(D=>D.type!=="bpmn:Lane"&&typeof D.y=="number"&&D.y>k).map(D=>D.id))},At=(b,S,A)=>{if(!b)return!0;const k=p(b);return k?A-S.height/2>=k.y&&A+S.height/2<=k.y+k.height:!0},Qt=h.map((b,S)=>({op:b,declared:S}));Qt.sort((b,S)=>{const A=b.op.order??Number.POSITIVE_INFINITY,k=S.op.order??Number.POSITIVE_INFINITY;return A!==k?A-k:b.declared-S.declared});let _n=80;for(const b of r.getAll())b.parent===u()&&"height"in b&&typeof b.y=="number"&&(_n=Math.max(_n,b.y+b.height+60));for(const{op:b}of Qt){const S=b.participant,A=m.filter(ce=>ce.node.participant===S.id).length,k=((k1=S.lanes)==null?void 0:k1.length)??0,L=Math.max(1200,A*160+300),D=(S.lanes??[]).map(ce=>K(G.get(ce.id)??0)),j=D.reduce((ce,oe)=>ce+oe,0);k&&j<300&&(D[k-1]+=300-j);const F=Math.max(300,$*((G.get(`pool:${S.id}`)??0)+1)),I=S.blackBox||A+k===0?120:k?Math.max(300,j):F,q=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:S.id,name:S.name,...b.order!==void 0?{"bwl:poolOrder":b.order}:{},...S.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:L,height:I,isExpanded:!0}),Z=n.createShape(q,{x:100+L/2,y:_n+I/2},u()),ae=S.lanes??[];if(ae.length&&n.splitLane(Z,ae.length),ae.length){const ce=r.filter(oe=>{var pe;return oe.type==="bpmn:Lane"&&((pe=d(oe))==null?void 0:pe.id)===S.id}).sort((oe,pe)=>oe.y-pe.y);if(ce.forEach((oe,pe)=>{const ye=ae[pe];ye&&n.updateProperties(oe,{id:ye.id,name:ye.name})}),D.some(oe=>oe!==Z.height/k)){let oe=Z.y;ce.forEach((pe,ye)=>{const Ie=D[ye];n.resizeShape(pe,{x:pe.x,y:oe,width:pe.width,height:Ie}),oe+=Ie})}}_n=Z.y+Z.height+60}const qa=b=>{var k;const S=T.get(b);if(S)return S.node.participant??"";const A=p(b);return A?A.type==="bpmn:Participant"?A.id:((k=d(A))==null?void 0:k.id)??"":""},Yn=new Map,Gi=b=>{let S=Yn.get(b);return S||Yn.set(b,S={nodes:[],flows:[]}),S};for(const b of m)Gi(b.node.participant??"").nodes.push(b);for(const b of _)Gi(qa(b.flow.source)).flows.push(b);const ui=b=>{var S;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((S=b.condition)==null?void 0:S.label)})},nn=(b,S,A)=>o.createShape({type:Kc(b.type),...b.eventDefinition?{eventDefinitionType:Sc[b.eventDefinition]}:{},businessObject:i.create(Kc(b.type),{id:b.id,name:b.name,...S!==void 0?{"bwl:band":S}:{},...A!==void 0?{"bwl:afterColumn":A}:{}})}),Wr=[...Qt.map(({op:b})=>b.participant.id).filter(b=>Yn.has(b)),...[...Yn.keys()].filter(b=>!h.some(S=>S.participant.id===b))],Ya=b=>b.endsWith("Gateway");for(const b of Wr){const S=Yn.get(b),A=b?f(b):void 0,k=A?A.x+150:250;let L=A?A.y+80:120;const D=(te,se,le)=>{if(te){const xe=f(te);return xe.y+Math.min(xe.height/2,J)+C(te,se??0)*$}return se!==void 0&&A?A.y+Q+C(`pool:${b}`,se)*$:le},j=(te,se,le)=>{if(te){const xe=f(te);return xe.y+Math.min(xe.height/2,J)+se*$}return A?A.y+Q+se*$:le},F=te=>te.participant?f(te.participant):u(),I=(te,se,le,xe,tt,nt,It,jt)=>{const _e=le!==void 0||xe!==void 0,be=$e=>{const Ce=()=>mt(le,$e,A);jt?jt(Ce):Ce()},ue=C(le??`pool:${b}`,xe??0);if((xe===void 0||R(le,b,xe,It??Number.NaN))&&It!==void 0&&At(le,se,It)&&!Oe(te,se,tt,It))return{x:tt,y:It};if(_e)for(let $e=0;$e<4;$e++){const Ce=j(le,ue+$e,nt);if(!Oe(te,se,tt,Ce,qn(le,ue+$e)))return be(ue+$e),{x:tt,y:Ce}}const we=D(le,xe,nt);_e?be(ue):jt?jt(()=>Pe(te,se,se.y+se.height/2)):Pe(te,se,we);let ze=tt;for(let $e=0;$e<64;$e++){const Ce=Oe(te,se,ze,we);if(!Ce)break;ze=Ce.x+Ce.width+H+se.width/2}return{x:ze,y:we}},q=new Set(S.flows.map(te=>te.flow.target)),Z=new Map,ae=te=>{if(te===void 0)return;const se=r.get(te);if(!(!se||typeof se.x!="number"||typeof se.width!="number"))return se.x+se.width+H};for(const te of S.nodes){if(q.has(te.node.id))continue;const se=nn(te.node,te.band,te.afterColumn),le=Y(te),xe=te.node.lane?`${te.node.lane}|${le??""}`:le!==void 0?`band:${le}`:"",tt=F(te.node),nt=Z.get(xe)??k,It=ae(te.afterColumn),jt=It===void 0?nt:Math.max(nt,It);let _e;const be=I(tt,se,te.node.lane,le,jt,L,void 0,vn.has(te.node.id)&&te.node.participant!==void 0?ue=>_e=ue:void 0);if(_e?n.createShape(se,be,tt,{autoResize:!1}):n.createShape(se,be,tt),_e){const ue=te.node.lane?f(te.node.lane):tt;Cn.set(te.node.id,{container:ue,relCy:be.y-ue.y,grow:_e})}Z.set(xe,be.x+se.width+H),!te.node.lane&&le===void 0&&(L+=160)}const ce=new Set,oe=new Map,pe=new Map,ye=new Map;if(b&&Ee.has(`pool:${b}`)){const te=new Map;for(const _e of S.flows)te.set(_e.flow.target,(te.get(_e.flow.target)??0)+1);const se=_e=>D(_e.node.lane,he(_e),Number.NaN),le=new Set,xe=_e=>{var we;const be=(we=T.get(_e))==null?void 0:we.node.participant;if(be)return p(be);const ue=p(_e);if(ue)return ue.type==="bpmn:Participant"?ue:d(ue)},tt=_e=>{const be=[],ue=new Set([_e]),we=[_e];for(;we.length;){const ze=we.shift(),$e=T.get(ze);$e&&be.push($e);for(const Ce of S.flows)Ce.flow.source!==ze||ue.has(Ce.flow.target)||(te.get(Ce.flow.target)??0)!==1||(ue.add(Ce.flow.target),we.push(Ce.flow.target))}return be},nt=_e=>{if(!A)return;const be=new Set(_e.map(ze=>ze.node.id));let ue=!1,we=!1;for(const ze of x){if(!be.has(ze.flow.source))continue;const $e=xe(ze.flow.target);!$e||$e.id===A.id||($e.y<A.y?ue=!0:we=!0)}return ue&&!we?"up":we&&!ue?"down":void 0};for(const _e of S.nodes){if(!Ya(_e.node.type))continue;const be=D(_e.node.lane,Y(_e),Number.NaN);if(Number.isNaN(be))continue;const ue=[];for(const Ce of S.flows){if(Ce.flow.source!==_e.node.id)continue;const st=T.get(Ce.flow.target);if(!st||st.node.lane!==_e.node.lane||(te.get(st.node.id)??0)!==1)continue;const ft=Y(st);if(ft===void 0)continue;const Jt=D(st.node.lane,ft,Number.NaN);if(Number.isNaN(Jt))continue;const An=tt(st.node.id),yt=nt(An);yt&&ue.push({subtree:An,band:ft,row:Jt,dir:yt})}if(!ue.some(Ce=>Ce.dir==="up")||!ue.some(Ce=>Ce.dir==="down")||!ue.some(Ce=>Ce.dir==="up"&&ue.some(st=>st.dir==="down"&&st.row<Ce.row)))continue;const ze=[...ue].sort((Ce,st)=>Ce.row-st.row);[...ue.filter(Ce=>Ce.dir==="up"),...ue.filter(Ce=>Ce.dir==="down")].sort((Ce,st)=>Ce.dir===st.dir?Ce.row-st.row:Ce.dir==="up"?-1:1).forEach((Ce,st)=>{const ft=ze[st].band;if(ft!==Ce.band){le.add(_e.node.id);for(const Jt of Ce.subtree)Y(Jt)===Ce.band&&re.set(Jt.node.id,ft)}})}const It=_e=>{if(!A)return;const be=new Set(_e.map(ze=>ze.node.id));let ue=!1,we=!1;for(const ze of x){if(!be.has(ze.flow.target))continue;const $e=xe(ze.flow.source);!$e||$e.id===A.id||($e.y<A.y?ue=!0:we=!0)}return ue&&!we?"up":we&&!ue?"down":void 0};for(const _e of S.nodes){if(!Ya(_e.node.type))continue;const be=_e.node.lane??`pool:${b}`,ue=ne.get(be);if(!ue||ue.size<2)continue;const we=ue.get(0);if(we===void 0)continue;const ze=Math.max(...ue.values()),$e=we===ze&&we!==0?"down":void 0;if(!$e)continue;const Ce=[];for(const yt of S.flows){if(yt.flow.source!==_e.node.id)continue;const Hn=T.get(yt.flow.target);if(!Hn||Hn.node.lane!==_e.node.lane||(te.get(Hn.node.id)??0)!==1)continue;const Ja=he(Hn);Ja!==void 0&&Ce.push({t:Hn,subtree:tt(Hn.node.id),band:Ja})}const st=Ce.find(yt=>(ue.get(yt.band)??yt.band)===we);if(!st||It(st.subtree)===$e||nt(st.subtree)===$e)continue;const ft=Ce.find(yt=>yt!==st&&It(yt.subtree)===$e);if(!ft)continue;const Jt=st.band,An=ft.band;for(const yt of st.subtree)he(yt)===Jt&&re.set(yt.node.id,An);for(const yt of ft.subtree)he(yt)===An&&re.set(yt.node.id,Jt);le.add(_e.node.id)}for(const _e of S.nodes){if(!Ya(_e.node.type))continue;const be=se(_e);if(Number.isNaN(be)||E.some(Ce=>{var st,ft;return(((st=Ce.placement)==null?void 0:st.anchor)??(Ce.association?Ce.association.source===Ce.annotation.id?Ce.association.target:Ce.association.source:void 0))===_e.node.id&&((ft=Ce.placement)==null?void 0:ft.side.startsWith("bottom"))}))continue;let we,ze=!1,$e;for(const Ce of S.flows){if(Ce.flow.source!==_e.node.id)continue;const st=T.get(Ce.flow.target);if(!st||!st.node.lane&&Y(st)===void 0)continue;const ft=se(st);Number.isNaN(ft)||(Math.abs(ft-be)<.5&&(ze=!0),ft>be?!we||ft>we.row?we={id:st.node.id,row:ft,count:1}:ft===we.row&&we.count++:ft<be&&st.node.lane===_e.node.lane&&(!$e||ft>$e.row?$e={op:st,row:ft,count:1}:ft===$e.row&&$e.count++))}we&&we.count===1&&(te.get(we.id)??0)===1&&!le.has(_e.node.id)&&ce.add(we.id),!ze&&$e&&$e.count===1&&(te.get($e.op.node.id)??0)===1&&!Le.has(_e.node.id)&&oe.set($e.op.node.id,{lane:_e.node.lane,band:he(_e)})}const jt=new Map;for(const _e of x)jt.set(_e.flow.target,[...jt.get(_e.flow.target)??[],_e]);for(const _e of S.nodes){const be=jt.get(_e.node.id);if(!be||be.length!==1||!te.get(_e.node.id)||!_e.node.lane&&Y(_e)===void 0||N.has(_e.node.id))continue;const ue=(O1=T.get(be[0].flow.source))==null?void 0:O1.node.participant,we=ue?p(ue):void 0;if(!we||!A||we.id===A.id)continue;const ze=_e.node.lane??`pool:${b}`,$e=ne.get(ze);if(!$e)continue;const Ce=$e.get(0)??0,st=($e.get(he(_e)??0)??Ce)-Ce;if(st===0)continue;const ft=we.y<A.y;if(ft&&st<0||!ft&&st>0)continue;let Jt;for(const[An,yt]of $e){const Hn=yt-Ce;(ft&&Hn<0&&(!Jt||Hn<Jt.row)||!ft&&Hn>0&&(!Jt||Hn>Jt.row))&&(Jt={band:An,row:Hn})}Jt&&pe.set(_e.node.id,{lane:_e.node.lane,band:Jt.band})}}const Ie=new Set;let Te=0;for(;Te++<S.nodes.length+2;){for(let le=0;le<S.nodes.length+S.flows.length+2;le++){let xe=!1;for(const tt of S.flows){const nt=tt.flow;if(Ie.has(nt.id))continue;const It=p(nt.source);if(!It)continue;const jt=p(nt.target),_e=T.get(nt.target);if(!jt&&_e){const be=nn(_e.node,_e.band),ue=he(_e);if(_e.node.lane||ue!==void 0){const we=F(_e.node),ze=It,$e=ze.x+(ye.get(nt.source)??0)+ze.width+H,Ce=oe.get(nt.target)??pe.get(nt.target),st=I(we,be,Ce?Ce.lane:_e.node.lane,Ce?Ce.band:ue,ce.has(nt.target)?ze.x+ze.width/2:$e,Number.NaN,Ce||!Ct(nt.target)?void 0:ze.y+ze.height/2),ft=n.createShape(be,st,we);ce.has(nt.target)&&ye.set(nt.target,$e-(ft.x+ft.width/2)),n.connect(It,ft,{type:"bpmn:SequenceFlow",businessObject:ui(nt)})}else s.append(It,be,{connection:{type:"bpmn:SequenceFlow",businessObject:ui(nt)}})}else if(jt)n.connect(It,jt,{type:"bpmn:SequenceFlow",businessObject:ui(nt)});else continue;Ie.add(nt.id),xe=!0}if(!xe)break}const te=S.nodes.filter(le=>!p(le.node.id));if(!te.length)break;const se=te[0];{const le=nn(se.node,se.band),xe=F(se.node),tt=Y(se);n.createShape(le,I(xe,le,se.node.lane,tt,k,L),xe),!se.node.lane&&tt===void 0&&(L+=160)}}}const Mn=40,gt=b=>{const S=Z=>Z.kind==="label-over-line"||Z.kind==="label-over-shape"||Z.kind==="label-on-shared-segment"?Z.edge===b.id:Z.kind==="annotation-over-label"||Z.kind==="pool-name-over-label"?Z.label===b.id:!1,A=()=>new Set(pt(Ge(r)).filter(Z=>!S(Z)).map(Z=>ct(Z))),k=A(),L=b.waypoints.map(Z=>({x:Z.x,y:Z.y})),D=b.label,j=D&&{x:D.x,y:D.y};n.layoutConnection(b,{waypoints:[]});const F=A(),I=[...F].filter(Z=>!k.has(Z)).length,q=[...k].filter(Z=>!F.has(Z)).length;I<=q||(n.updateWaypoints(b,L),D&&j&&(D.x!==j.x||D.y!==j.y)&&n.moveElements([D],{x:j.x-D.x,y:j.y-D.y}))},St=5,Oi=10,i1=200,yc=new Set([..._.map(b=>b.flow.id),...x.map(b=>b.flow.id),...en(e,"sequenceFlow.update").map(b=>b.id),...en(e,"messageFlow.update").map(b=>b.id)].filter(b=>!!b)),F5=(b,S,A,k,L,D)=>{const j=new Set(b.map(te=>te.id)),F=Math.min(...b.map(te=>te.x))+S-Oi,I=Math.max(...b.map(te=>te.x+te.width))+S+i1+Oi,q=Math.min(...b.map(te=>te.y+Math.min(0,...A)))-Oi,Z=Math.max(...b.map(te=>te.y+te.height+Math.max(0,...A)))+Oi,ae=r.getAll().filter(te=>{if(te.type!=="bpmn:SequenceFlow"&&te.type!=="bpmn:MessageFlow")return!1;const se=te;return yc.has(se.id)||!se.waypoints||se.waypoints.length<2||[se.source,se.target].some(xe=>!xe||j.has(xe.id)||xe.x>=k)?!1:se.waypoints.some((xe,tt)=>{const nt=se.waypoints[tt+1];return!!nt&&Math.max(xe.x,nt.x)>=F&&Math.min(xe.x,nt.x)<=I&&Math.max(xe.y,nt.y)>=q&&Math.min(xe.y,nt.y)<=Z})});if(!ae.length)return 0;const ce=te=>{const se=new Map;for(const le of b)for(const xe of A){const tt={id:le.id,type:le.type,x:le.x+S+te,y:le.y+xe,width:le.width,height:le.height};for(const nt of ae){let It=1/0;for(let _e=0;_e+1<nt.waypoints.length;_e++)It=Math.min(It,cs(nt.waypoints[_e],nt.waypoints[_e+1],tt));const jt=`${nt.id}|${le.id}`;se.set(jt,Math.min(se.get(jt)??1/0,It))}}return se},oe=[...ce(0)].filter(([,te])=>te<=St).map(([te])=>te);if(!oe.length)return 0;let pe=0;for(let te=1;te<=i1;te++){const se=ce(te);if([...se.values()].every(le=>le>St)&&oe.every(le=>(se.get(le)??1/0)>=Oi)){pe=te;break}}if(!pe)return 0;const ye=Math.min(...b.map(te=>te.x))+S+pe,Ie=new Set(oe.map(te=>te.slice(0,te.indexOf("|"))));return ae.some(te=>te.type==="bpmn:SequenceFlow"&&Ie.has(te.id)&&te.waypoints.some((se,le)=>{const xe=te.waypoints[le+1];if(!xe||Math.min(se.y,xe.y)>D||Math.max(se.y,xe.y)<D||se.y===xe.y)return!1;const tt=se.x+(D-se.y)*(xe.x-se.x)/(xe.y-se.y);return tt>L&&tt<ye}))?0:pe},Ur=(b,S=()=>!0)=>{const A=p(b);if(!A)return[];const k=[A],L=new Set([b]);for(let D=0;D<k.length;D++){const j=k[D].id;for(const F of _){const I=F.flow.target;if(F.flow.source!==j||L.has(I)||!T.has(I))continue;L.add(I);const q=p(I);q&&S(q)&&k.push(q)}}return k},j5=(b,S=()=>!0)=>{const A=p(b);if(!A)return[];const k=[A],L=new Set([b]);for(let D=0;D<k.length;D++){const j=k[D].id;for(const F of _){const I=F.flow.source;if(F.flow.target!==j||L.has(I)||!T.has(I))continue;L.add(I);const q=p(I);q&&S(q)&&k.push(q)}}return k},Di=30,Li=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",Ka=(b,S)=>mf(n,b,S),Xa=(b,S,A=!1)=>{const k=new Set(b.flatMap(I=>I.subtree.map(q=>q.id)));for(const I of b){const q=(I.pool.children??[]).filter(Li).filter(ae=>!k.has(ae.id));if(I.subtree.some(ae=>q.some(ce=>ae.x+S<ce.x+ce.width+Di&&ae.x+S+ae.width+Di>ce.x&&ae.y<ce.y+ce.height&&ae.y+ae.height>ce.y)))return null}const L=b.map(I=>I.pool.width),D=A?r.filter(I=>Array.isArray(I.waypoints)).map(I=>({c:I,wps:I.waypoints.map(q=>({x:q.x,y:q.y}))})):[],j=r.filter(I=>I.type==="label").map(I=>({label:I,x:I.x,y:I.y}));n.moveElements(b.flatMap(I=>I.subtree),{x:S,y:0});const F=b.map(I=>{const Z=Math.max(...I.subtree.map(ae=>ae.x+ae.width))+yy-(I.pool.x+I.pool.width);return Z>0&&Ka(I.pool,I.pool.width+Z),Z});return()=>{n.moveElements(b.flatMap(I=>I.subtree),{x:-S,y:0}),b.forEach((I,q)=>{F[q]>0&&Ka(I.pool,L[q])});for(const{c:I,wps:q}of D){const Z=I.waypoints??[];Z.length===q.length&&Z.every((ce,oe)=>Math.abs(ce.x-q[oe].x)<=.5&&Math.abs(ce.y-q[oe].y)<=.5)||n.updateWaypoints(I,q.map(ce=>({x:ce.x,y:ce.y})))}for(let I=0;I<3;I++){let q=0;for(const Z of j){const ae=Z.x-Z.label.x,ce=Z.y-Z.label.y;Math.abs(ae)<=.5&&Math.abs(ce)<=.5||(n.moveElements([Z.label],{x:ae,y:ce}),q++)}if(!q)break}}},xg=b=>{var L,D;const S=new Map,A=new Map;for(const j of r.getAll()){if(j.type!=="bpmn:Participant")continue;const F=j;(F.children??[]).length||(S.set(F.id,F),A.set(F.id,[]))}for(const j of r.getAll()){if(j.type!=="bpmn:MessageFlow")continue;const F=j,I=(L=F.source)==null?void 0:L.id,q=(D=F.target)==null?void 0:D.id;I&&q&&A.has(I)&&A.get(I).push(q),I&&q&&A.has(q)&&A.get(q).push(I)}const k=[];for(const[j,F]of A)F.length&&F.every(I=>b.has(I))&&k.push(S.get(j));return k},o1=(b,S)=>{if(!b.length)return null;const A=new Set(b.map(Z=>Z.id)),k=r.getAll().filter(Z=>Z.type==="bpmn:Participant"&&!A.has(Z.id)),L=Math.min(...k.filter(Z=>(Z.children??[]).length>0).map(Z=>Z.x)),D=new Set(b.filter(Z=>Math.abs(Z.x-L)<=2).map(Z=>Z.id));if(b.some(Z=>{const ae=D.has(Z.id)?Z.x:Z.x+S,ce=D.has(Z.id)?Z.width+S:Z.width;return k.some(oe=>ae<oe.x+oe.width+Di&&ae+ce+Di>oe.x&&Z.y<oe.y+oe.height&&Z.y+Z.height>oe.y)}))return null;const F=r.filter(Z=>Z.type==="label").map(Z=>({label:Z,x:Z.x,y:Z.y})),I=b.filter(Z=>!D.has(Z.id)),q=b.filter(Z=>D.has(Z.id)).map(Z=>({pool:Z,was:{x:Z.x,y:Z.y,width:Z.width,height:Z.height}}));I.length&&n.moveElements(I,{x:S,y:0});for(const{pool:Z,was:ae}of q)n.resizeShape(Z,{...ae,width:ae.width+S});return()=>{for(const{pool:Z,was:ae}of q)n.resizeShape(Z,ae);I.length&&n.moveElements(I,{x:-S,y:0});for(let Z=0;Z<3;Z++){let ae=0;for(const ce of F){const oe=ce.x-ce.label.x,pe=ce.y-ce.label.y;Math.abs(oe)<=.5&&Math.abs(pe)<=.5||(n.moveElements([ce.label],{x:oe,y:pe}),ae++)}if(!ae)break}}},r1=(b,S,A)=>{const k=A.x+A.width/2,L=S.y>A.y,D=L?A.y+A.height:A.y,j=L?S.y:S.y+S.height,F=b.source===S?[{x:k,y:j},{x:k,y:D}]:[{x:k,y:D},{x:k,y:j}],I=Ge(r),q={...I.edges.find(Z=>Z.id===b.id),waypoints:F};return zt(q,Vn(I)).length?!1:(n.updateWaypoints(b,F),!0)},H5=()=>{const b=r.filter(j=>j.type==="bpmn:Participant"),S=Math.min(...b.filter(j=>(j.children??[]).length>0).map(j=>j.x)),A=j=>h.some(F=>F.participant.id===j.id),k=j=>!!j&&j.type==="bpmn:Participant"&&!(j.children??[]).length&&Math.abs(j.x-S)<=2&&!A(j),L=j=>!!j&&j.type==="bpmn:Participant"&&(j.children??[]).length>0&&!A(j),D=new Set;for(const j of r.getAll()){if(j.type!=="bpmn:MessageFlow")continue;const F=j;if((F.waypoints??[]).length!==2)continue;const I=[F.source,F.target].find(ae=>k(ae)||L(ae)),q=I===F.source?F.target:F.source;if(!I||!q||q.type==="bpmn:Participant")continue;const Z=q.x+q.width/2;L(I)&&(Z<I.x||Z>I.x+I.width)||D.add(F.id)}return D},z5=b=>{var A;const S=new Map;for(const k of b){const L=r.get(k);if(!L||(L.waypoints??[]).length===2)continue;const D=((A=L.source)==null?void 0:A.type)==="bpmn:Participant"?L.source:L.target,j=D===L.source?L.target:L.source;if(j.x+j.width/2<=D.x+D.width)continue;const F=S.get(D.id)??{pool:D,msgs:[]};F.msgs.push({conn:L,other:j}),S.set(D.id,F)}for(const{pool:k,msgs:L}of S.values()){const D=Math.max(...L.map(({other:pe})=>pe.x+pe.width/2))+hf;if(r.getAll().some(pe=>{if(pe.type!=="bpmn:Participant"||pe.id===k.id)return!1;const ye=pe;return k.x<ye.x+ye.width+Di&&D+Di>ye.x&&k.y<ye.y+ye.height&&k.y+k.height>ye.y}))continue;const F={x:k.x,y:k.y,width:k.width,height:k.height},I=[...k.incoming??[],...k.outgoing??[]],q=I.map(pe=>({c:pe,wps:(pe.waypoints??[]).map(ye=>({x:ye.x,y:ye.y}))})),Z=I.flatMap(pe=>{const ye=pe.label;return ye?[{label:ye,x:ye.x,y:ye.y}]:[]}),ae=yr();Ka(k,D-k.x);const ce=L.filter(({conn:pe,other:ye})=>r1(pe,k,ye)).length,oe=yr();if(!(ce>0&&oe.messages>ae.messages&&oe.lines>=ae.lines)){Ka(k,F.width);for(const{c:pe,wps:ye}of q){const Ie=pe.waypoints??[];Ie.length===ye.length&&Ie.every((te,se)=>Math.abs(te.x-ye[se].x)<=.5&&Math.abs(te.y-ye[se].y)<=.5)||n.updateWaypoints(pe,ye.map(te=>({x:te.x,y:te.y})))}for(let pe=0;pe<3;pe++){let ye=0;for(const Ie of Z){const Te=Ie.x-Ie.label.x,te=Ie.y-Ie.label.y;Math.abs(Te)<=.5&&Math.abs(te)<=.5||(n.moveElements([Ie.label],{x:Te,y:te}),ye++)}if(!ye)break}}}},a1=()=>{let b=0;for(const S of r.getAll()){if(S.type!=="bpmn:DataInputAssociation"&&S.type!=="bpmn:DataOutputAssociation")continue;const A=S.waypoints??[];for(let k=1;k<A.length;k++)b+=Math.hypot(A[k].x-A[k-1].x,A[k].y-A[k-1].y)}return b},s1=()=>{let b=0;for(const S of r.getAll()){if(S.type!=="bpmn:Association")continue;const A=S.waypoints??[];for(let k=1;k<A.length;k++)b+=Math.hypot(A[k].x-A[k-1].x,A[k].y-A[k-1].y)}return b},G5=b=>{const S=[];for(const A of r.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const k=A;if(b.has(k.id))continue;const D=[...k.incoming??[],...k.outgoing??[]].filter(I=>I.type==="bpmn:Association").map(I=>I.source===k?I.target:I.source);if(!D.length||D.some(I=>I===void 0))continue;const j=I=>{if(!("waypoints"in I&&I.waypoints))return[I.id];const q=I,Z=[q.source,q.target];return Z.some(ae=>!ae)?[]:Z.map(ae=>ae.id)},F=D.flatMap(I=>j(I));F.length&&F.every(I=>b.has(I))&&S.push(k)}return S},c1=()=>pt(Ge(r)).filter(b=>b.kind==="edge-crosses-shape").length,l1=b=>{const S=(b.children??[]).filter(Li);let A=0;for(let k=0;k<S.length;k++)for(let L=k+1;L<S.length;L++){const D=S[k],j=S[L];D.x<j.x+j.width&&D.x+D.width>j.x&&D.y<j.y+j.height&&D.y+D.height>j.y&&A++}return A},yr=()=>{const b=Ge(r),S=A=>A.length>=2&&(A.every(k=>Math.abs(k.x-A[0].x)<.01)||A.every(k=>Math.abs(k.y-A[0].y)<.01));return{messages:b.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:b.edges.filter(A=>S(A.waypoints)).length}},u1=b=>{const S=new Map;for(const k of r.getAll()){if(k.type!=="bpmn:MessageFlow")continue;const L=k;if(!L.waypoints||L.waypoints.length!==2)continue;const D=L.source,j=L.target;if(!D||!j)continue;const F=b.has(D.id);if(F===b.has(j.id))continue;const I=F?j:D,q=d(I);if(!q||b.has(I.id))continue;const Z=S.get(q.id);Z?I.x<Z.minX&&(Z.minX=I.x):S.set(q.id,{pool:q,minX:I.x})}const A=[];for(const{pool:k,minX:L}of S.values()){const D=(k.children??[]).filter(j=>Li(j)&&!b.has(j.id)&&j.x>=L);D.length&&A.push({subtree:D,pool:k})}return A},V5=(b,S,A)=>{const k=new Map(S.map(j=>[j.pool.id,{subtree:[...j.subtree],pool:j.pool}])),L=new Set(b);for(const j of S)for(const F of j.subtree)L.add(F.id);let D=!1;for(;;){let j=0;for(const F of u1(L)){if(F.pool===A)continue;const I=k.get(F.pool.id);I?I.subtree.push(...F.subtree):k.set(F.pool.id,{subtree:[...F.subtree],pool:F.pool});for(const q of F.subtree)L.add(q.id);j+=F.subtree.length}if(!j)break;D=!0}return D?[...k.values()]:null},W5=(b,S)=>{const A=new Map;for(const L of r.getAll()){if(L.type!=="bpmn:DataInputAssociation"&&L.type!=="bpmn:DataOutputAssociation")continue;const D=L,j=D.waypoints;if(!j||j.length<2||!j.every(oe=>Math.abs(oe.x-j[0].x)<1))continue;const F=D.source,I=D.target;if(!F||!I)continue;const q=b.has(F.id);if(q===b.has(I.id))continue;const Z=q?I:F,ae=d(Z);if(!ae||ae===S||ae===d(q?F:I))continue;const ce=A.get(ae.id);ce?Z.x<ce.minX&&(ce.minX=Z.x):A.set(ae.id,{pool:ae,minX:Z.x})}const k=[];for(const{pool:L,minX:D}of A.values()){const j=(L.children??[]).filter(F=>Li(F)&&!b.has(F.id)&&F.x>=D);j.length&&k.push({subtree:j,pool:L})}return k},p1=b=>{const S=Ge(r),A=S.shapes.filter(L=>b.has(L.id)),k=new Set;for(const L of S.edges)if(!(L.type!=="bpmn:SequenceFlow"&&L.type!=="bpmn:MessageFlow"))for(const D of zt(L,A))k.add(`${L.id}|${D.id}`);return k},f1=new Map;for(const b of en(e,"sequenceFlow.update")){if(b.target===void 0)continue;const S=T.get(b.target);if(!S)continue;const A=p(b.target),k=p(b.id);if(!A||!k)continue;const L=b.source!==void 0?p(b.source):k.source,D=k.target;if(!L||!D||D.id===A.id)continue;const j=k.waypoints&&k.waypoints.length>=3&&Math.abs(k.waypoints[0].x-k.waypoints[1].x)<1&&Math.abs(k.waypoints[0].y-k.waypoints[1].y)>1?{x:k.waypoints[0].x,y:k.waypoints[0].y}:void 0,F=j?k.waypoints[1].y:void 0,I=j&&k.label?{x:k.label.x,y:k.label.y}:void 0,q=I&&k.label&&Math.abs(I.y+k.label.height/2-F)<=$/5&&I.x+k.label.width>j.x?I.x+k.label.width+6:void 0,Z=(L.outgoing??[]).filter(ke=>ke.type==="bpmn:SequenceFlow"&&ke.id!==k.id&&ke.target&&!yc.has(ke.id)),ae=new Set(Z.map(ke=>ke.target.id)),ce=ke=>{const Pt={type:"bpmn:Task",x:ke.x+2,y:ke.y+2,width:ke.width-4,height:ke.height-4};return Z.find(_t=>(_t.waypoints??[]).some((fn,De)=>!!_t.waypoints[De+1]&&cs(fn,_t.waypoints[De+1],Pt)===0))},oe=Ur(b.target),pe=new Set(oe.map(ke=>ke.id)),ye=Cn.has(b.target)?{autoResize:!1}:void 0,Ie=Math.min(...oe.map(ke=>ke.x)),Te=Math.max(...oe.map(ke=>ke.x+ke.width)),te=L.x+L.width,se=D.x+D.width<=L.x,le=(()=>{if(!se)return;const ke=d(A),Pt=((ke==null?void 0:ke.children)??[]).filter(Ne=>Li(Ne)&&!pe.has(Ne.id)&&Ne.type!=="bpmn:Group"&&Ne.type!=="bpmn:Participant"),_t=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],fn=r.getAll().filter(Ne=>{if(!_t.includes(Ne.type))return!1;const Bt=Ne;return Bt.id===k.id||yc.has(Bt.id)||!Bt.waypoints||Bt.waypoints.length<2?!1:![Bt.source,Bt.target].some(Tt=>!Tt||pe.has(Tt.id))}),De=(Ne,Bt)=>oe.every(Tt=>{var Xr;const bt={id:Tt.id,type:Tt.type,x:Tt.x+Ne,y:Tt.y+Bt,width:Tt.width,height:Tt.height};return ke&&(bt.x<ke.x||bt.x+bt.width>ke.x+ke.width||bt.y<ke.y||bt.y+bt.height>ke.y+ke.height)||!At((Xr=T.get(Tt.id))==null?void 0:Xr.node.lane,Tt,Tt.y+Bt+Tt.height/2)||Pt.some(Kn=>bt.x<Kn.x+Kn.width+Oi&&bt.x+bt.width+Oi>Kn.x&&bt.y<Kn.y+Kn.height+Oi&&bt.y+bt.height+Oi>Kn.y)?!1:fn.every(Kn=>{for(let uo=0;uo+1<Kn.waypoints.length;uo++)if(cs(Kn.waypoints[uo],Kn.waypoints[uo+1],bt)<Oi)return!1;return!0})}),Xe=L.x+L.width/2,wt=L.y+L.height/2,Ze=k.waypoints??[],Mt=Ze.length>=2&&Math.abs(Ze[0].y-Ze[1].y)<1&&Ze[1].x<Ze[0].x;return[...F!==void 0?[{cx:Xe,cy:F}]:[],...Mt?[{cx:L.x-Mn-A.width/2,cy:Ze[0].y}]:[],{cx:Xe,cy:wt+$},{cx:Xe,cy:wt-$}].find(Ne=>De(Ne.cx-(A.x+A.width/2),Ne.cy-(A.y+A.height/2)))})(),xe=se&&!le?te:D.x,tt=A.y+A.height/2,nt=F5(oe,te+Mn-Ie,[0,L.y+L.height/2-tt,D.y+D.height/2-tt],xe,te,L.y+L.height/2),It=te+Mn+nt,jt=(()=>{if(q===void 0)return 0;const ke=te+Mn,Pt=L.y+L.height/2-A.height/2,_t={x:ke,y:Pt,width:Te-Ie,height:A.height},fn=d(L);return((fn==null?void 0:fn.children)??[]).some(Xe=>Li(Xe)&&!pe.has(Xe.id)&&Xe.id!==L.id&&Xe.id!==D.id&&Xe.type!=="bpmn:Group"&&Xe.type!=="bpmn:Participant"&&Xe.x<_t.x+_t.width&&Xe.x+Xe.width>_t.x&&Xe.y<_t.y+_t.height&&Xe.y+Xe.height>_t.y)||ce(_t)?Math.max(0,q-ke):0})(),_e=le?0:Te-Ie+Mn*2+nt+jt-(se?0:D.x-te);let be=[];if(_e>0){const ke=d(A),Pt=(ke==null?void 0:ke.children)??[],_t=Ze=>Ze.type==="bpmn:Lane";be=(()=>{const Ze=new Set;for(const je of Pt)Li(je)&&!pe.has(je.id)&&je.id!==L.id&&je.x>=xe&&Ze.add(je.id);const Mt=[];for(const je of Pt){if(je.type!=="bpmn:DataStoreReference"&&je.type!=="bpmn:DataObjectReference")continue;const Ne=je,Tt=[...Ne.incoming??[],...Ne.outgoing??[]].filter(bt=>bt.type==="bpmn:DataInputAssociation"||bt.type==="bpmn:DataOutputAssociation").map(bt=>bt.source===Ne?bt.target:bt.source);Tt.length&&Tt.every(bt=>bt!==void 0&&Ze.has(bt.id))&&Mt.push(Ne)}return Mt})();const De=Pt.filter(Ze=>!("waypoints"in Ze&&Ze.waypoints)&&!_t(Ze)&&Ze.type!=="label"&&!pe.has(Ze.id)&&Ze.id!==L.id&&Ze.x>=xe),Xe=De.flatMap(Ze=>Ze.labels??[]),wt=ke?[ke,...Pt.filter(Ze=>_t(Ze))]:[];if(De.length){const Ze=new Set(De.map(Je=>Je.id)),Mt=u1(Ze),je=Mt.length?V5(Ze,Mt,ke):null,Ne=Je=>{const xt=new Set(Ze);for(const Nt of Je)for(const Do of Nt.subtree)xt.add(Do.id);return G5(xt)},Bt=Ne(Mt),Tt=je?Ne(je):Bt,bt=xg(Ze),Xr=new Set(Ze);for(const Je of Mt)for(const xt of Je.subtree)Xr.add(xt.id);const Kn=Mt.length?xg(Xr):bt,uo=(()=>{if(!je)return[];const Je=new Set(Ze);for(const xt of je)for(const Nt of xt.subtree)Je.add(Nt.id);return xg(Je)})(),es=je??Mt,Zr=(()=>{const Je=new Set(Ze);for(const xt of es)for(const Nt of xt.subtree)Je.add(Nt.id);return W5(Je,ke)})(),Mg=Zr.length?Ne([...es,...Zr]):Bt,Wi=new Set([...De,...wt].map(Je=>Je.id)),vt=Pt.filter(Je=>{const xt=Je.labelTarget;return Je.type==="label"&&!!xt&&"waypoints"in xt&&!!xt.source&&!!xt.target&&Wi.has(xt.source.id)&&Wi.has(xt.target.id)}),wn=H5();n.createSpace([...De,...Xe,...vt],wt,{x:_e,y:0},"e",xe-1);const Yt=(Je,xt,Nt)=>{const Do=yr(),gp=Nt?p1(Nt):null,mp=Xa(Je,_e,!!Nt);if(!mp)return!1;const xc=xt.length?o1(xt,_e):null,yp=yr(),Kt=!!Nt&&!!gp&&[...p1(Nt)].some(Jr=>!gp.has(Jr));return yp.messages>Do.messages&&yp.lines>=Do.lines&&!Kt?!0:(xc==null||xc(),mp(),!1)},pi=Zr.length>0&&Yt([...es,...Zr],je?uo:Kn,new Set(Zr.flatMap(Je=>Je.subtree.map(xt=>xt.id)))),Qr=!pi&&je?Yt(je,uo):!1;let po=pi||Qr;!po&&Mt.length&&(po=Yt(Mt,Kn));const ts=pi?Mg:Qr?Tt:Bt;if(!po){for(const Je of Mt){const xt=yr(),Nt=Xa([Je],_e);if(!Nt)continue;const Do=yr();(Do.messages<=xt.messages||Do.lines<xt.lines)&&Nt()}if(bt.length){const Je=yr(),xt=o1(bt,_e);if(xt){const Nt=yr();(Nt.messages<=Je.messages||Nt.lines<Je.lines)&&xt()}}}if(z5(wn),ts.length){const Je=()=>new Set(pt(Ge(r)).map(Nt=>ct(Nt))),xt=Nt=>{const Do=s1(),gp=Je(),mp=Nt.map(Kt=>({a:Kt,x:Kt.x,y:Kt.y})),xc=r.filter(Kt=>Kt.type==="label").map(Kt=>({label:Kt,x:Kt.x,y:Kt.y}));n.moveElements(Nt,{x:_e,y:0});const yp=[...Je()].filter(Kt=>!gp.has(Kt));if(s1()<Do&&yp.length===0)return!0;for(const{a:Kt,x:Jr,y:_c}of mp)(Kt.x!==Jr||Kt.y!==_c)&&n.moveElements([Kt],{x:Jr-Kt.x,y:_c-Kt.y});for(const Kt of xc){const Jr=Kt.x-Kt.label.x,_c=Kt.y-Kt.label.y;(Jr!==0||_c!==0)&&n.moveElements([Kt.label],{x:Jr,y:_c})}return!1};if(!xt(ts)&&ts.length>1)for(const Nt of ts)xt([Nt])}}}const ue=S.node.lane!==void 0?p(S.node.lane):S.node.participant!==void 0?p(S.node.participant):void 0,we=ke=>{if(!ue)return!0;const Pt=ke.y+ke.height/2;return Pt>=ue.y&&Pt<=ue.y+ue.height},ze=!we(L)&&we(D),$e=ke=>ke.y+ke.height/2,Ce=()=>{const ke=L.x+L.width,Pt=D.x,_t=$e(D)-A.height/2,fn=$e(D)+A.height/2;return!r.getAll().some(De=>Li(De)&&De.type!=="bpmn:Participant"&&De.type!=="bpmn:Group"&&De.type!=="bpmn:TextAnnotation"&&De.id!==L.id&&De.id!==D.id&&De.id!==A.id&&De.x<Pt&&De.x+De.width>ke&&De.y<fn&&De.y+De.height>_t)},st=!ze&&S.band!==void 0&&we(D)&&!R(S.node.lane,S.node.participant,S.band,$e(L))&&R(S.node.lane,S.node.participant,S.band,$e(D))&&D.x>=L.x+L.width&&Ce(),ft=ze||st?D:L,Jt=ft.y+ft.height/2,An=Jt-(A.y+A.height/2),yt=S.band!==void 0,Hn=yt?[A]:oe,Ja=(S.band===void 0||R(S.node.lane,S.node.participant,S.band,Jt))&&Ct(b.target)&&Hn.every(ke=>{var Pt;return At((Pt=T.get(ke.id))==null?void 0:Pt.node.lane,ke,ke.y+ke.height/2+An)}),d3=ke=>Math.abs(ke.y+ke.height/2-(A.y+A.height/2))<=$/2;if(Ja&&yt){const ke=Math.abs(An)<=$/2?oe.filter(De=>De.id!==A.id&&d3(De)):[],Pt=A.y+A.height/2,fn=S.band!==void 0&&!R(S.node.lane,S.node.participant,S.band,Pt)?oe.filter(De=>{var Xe,wt;return De.id!==A.id&&!ke.includes(De)&&((Xe=T.get(De.id))==null?void 0:Xe.band)===S.band&&((wt=T.get(De.id))==null?void 0:wt.node.lane)===S.node.lane&&(Math.abs(De.y+De.height/2-Pt)<=$/2||R(S.node.lane,S.node.participant,S.band,De.y+De.height/2))}).map(De=>({t:De,dy:Jt-(De.y+De.height/2)})).filter(({dy:De})=>De!==0):[];if(n.moveElements(oe,{x:It-Ie,y:0},void 0,ye),n.moveElements([A],{x:0,y:An},void 0,ye),ke.length){const De=()=>new Set(pt(Ge(r)).map(Ne=>ct(Ne))),Xe=De(),wt=r.filter(Ne=>Ne.type==="label").map(Ne=>({label:Ne,x:Ne.x,y:Ne.y}));n.moveElements(ke,{x:0,y:An});const Ze=De(),Mt=[...Ze].filter(Ne=>!Xe.has(Ne)).length,je=[...Xe].filter(Ne=>!Ze.has(Ne)).length;if(Mt>je){n.moveElements(ke,{x:0,y:-An});for(const Ne of wt){const Bt=Ne.x-Ne.label.x,Tt=Ne.y-Ne.label.y;(Bt!==0||Tt!==0)&&n.moveElements([Ne.label],{x:Bt,y:Tt})}}}if(fn.length){const De=new Set(oe.map(Xe=>Xe.id));for(const{t:Xe,dy:wt}of fn)Oe(Xe.parent,Xe,Xe.x+Xe.width/2,Xe.y+Xe.height/2+wt,De)||n.moveElements([Xe],{x:0,y:wt})}}else n.moveElements(oe,{x:It-Ie,y:Ja?An:0},void 0,ye);const Vi=d(A);if(!Ja&&S.node.lane===void 0&&S.band!==void 0&&Vi){const ke=Vi.y+Q+C(`pool:${S.node.participant??""}`,S.band)*$,Pt=ke-(A.y+A.height/2);Pt!==0&&!Oe(Vi,A,A.x+A.width/2,ke,pe)&&n.moveElements([A],{x:0,y:Pt},void 0,ye)}if(le)n.moveElements(oe,{x:le.cx-(A.x+A.width/2),y:le.cy-(A.y+A.height/2)},void 0,ye);else if(Vi){const ke=(Vi.children??[]).filter(De=>Li(De)&&!pe.has(De.id)&&De.type!=="bpmn:Group"&&De.type!=="bpmn:Participant"),Pt=(De,Xe,wt,Ze,Mt)=>De.x+Xe<Mt.x+Mt.width+Ze&&De.x+Xe+De.width+Ze>Mt.x&&De.y+wt<Mt.y+Mt.height+Ze&&De.y+wt+De.height+Ze>Mt.y,_t=ke.find(De=>Pt(A,0,0,0,De)),fn=_t?void 0:ce(A);if(_t||fn){const De=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Xe=r.getAll().filter(vt=>{if(!De.includes(vt.type))return!1;const wn=vt;return yc.has(wn.id)||!wn.waypoints||wn.waypoints.length<2?!1:![wn.source,wn.target].some(Yt=>!Yt||pe.has(Yt.id))}),wt=(vt,wn,Yt)=>{var pi;return At((pi=T.get(vt.id))==null?void 0:pi.node.lane,vt,vt.y+Yt+vt.height/2)&&vt.x+wn>=Vi.x&&vt.x+wn+vt.width<=Vi.x+Vi.width&&vt.y+Yt>=Vi.y&&vt.y+Yt+vt.height<=Vi.y+Vi.height},Ze=(vt,wn)=>oe.every(Yt=>wt(Yt,vt,wn)&&!ke.some(pi=>Pt(Yt,vt,wn,Oi,pi))&&Xe.every(pi=>{const Qr={id:Yt.id,type:Yt.type,x:Yt.x+vt,y:Yt.y+wn,width:Yt.width,height:Yt.height};for(let po=0;po+1<pi.waypoints.length;po++)if(cs(pi.waypoints[po],pi.waypoints[po+1],Qr)<Oi)return!1;return!0})),Mt=A.y+A.height/2,je=[F,D.y+D.height/2].filter(vt=>vt!==void 0&&Math.abs(vt-Mt)>=1),Ne=_t&&ae.has(_t.id)?_t:fn==null?void 0:fn.target,Bt=Ne?Ne.x-A.x:0,Tt=Math.max(...oe.map(vt=>vt.x+vt.width)),bt=[...Bt!==0?[Bt]:[],...nt!==0?[-nt]:[],0],Xr=q===void 0?[]:bt.map(vt=>Math.max(vt,q-A.x)),Kn=vt=>Tt+vt+Mn<=D.x,uo=[...new Set([...Xr,...bt])].filter(Kn),es=_t&&ae.has(_t.id)?[_t.x+_t.width+Mn-A.x]:[],Zr=q===void 0?[]:es.map(vt=>Math.max(vt,q-A.x)),Mg=[...new Set([...Zr,...es])].filter(vt=>Kn(vt)&&!uo.includes(vt));let Wi;for(const vt of[uo,Mg]){for(const wn of je){for(const Yt of vt)if(Ze(Yt,wn-Mt)){Wi={dx:Yt,dy:wn-Mt};break}if(Wi)break}if(Wi)break}if(Wi){const vt=Je=>{const xt=Je;return[xt.edge,xt.other,...Array.isArray(xt.edges)?xt.edges:[]].some(Nt=>typeof Nt=="string"&&yc.has(Nt))},wn=()=>new Set(pt(Ge(r)).filter(Je=>!vt(Je)).map(Je=>ct(Je))),Yt=wn(),pi=r.filter(Je=>Je.type==="label").map(Je=>({label:Je,x:Je.x,y:Je.y}));n.moveElements(oe,{x:Wi.dx,y:Wi.dy},void 0,ye);const Qr=wn(),po=[...Qr].filter(Je=>!Yt.has(Je)).length,ts=[...Yt].filter(Je=>!Qr.has(Je)).length;if(po>ts){n.moveElements(oe,{x:-Wi.dx,y:-Wi.dy},void 0,ye);for(const Je of pi){const xt=Je.x-Je.label.x,Nt=Je.y-Je.label.y;(xt!==0||Nt!==0)&&n.moveElements([Je.label],{x:xt,y:Nt})}}else j&&f1.set(k.id,{exit:j,channelY:F,label:I})}}}{const ke=new Set(oe.map(Xe=>Xe.id)),Pt=new Set(_.map(Xe=>Xe.flow.id)),_t=20,fn=Xe=>{const wt=Xe.source,Ze=Xe.target,Mt=Math.min(wt.x,Ze.x)-_t,je=Math.max(wt.x+wt.width,Ze.x+Ze.width)+_t,Ne=Math.min(wt.y,Ze.y)-_t,Bt=Math.max(wt.y+wt.height,Ze.y+Ze.height)+_t;return Xe.waypoints.some(Tt=>Tt.x<Mt||Tt.x>je||Tt.y<Ne||Tt.y>Bt)},De=new Map;for(const Xe of oe)for(const wt of[...Xe.incoming??[],...Xe.outgoing??[]])wt.id!==b.id&&Pt.has(wt.id)&&!(ke.has(wt.source.id)&&ke.has(wt.target.id))&&De.set(wt.id,wt);for(const Xe of De.values())fn(Xe)&&gt(Xe)}const lo=be.length?d(be[0]):void 0;if(lo){const ke={assoc:a1(),overlaps:l1(lo),crosses:c1()},Pt=be.map(je=>({st:je,x:je.x})),_t=r.filter(je=>je.type==="label").map(je=>({label:je,x:je.x,y:je.y})),fn=Math.min(...be.flatMap(je=>[...je.incoming??[],...je.outgoing??[]].filter(Ne=>Ne.type==="bpmn:DataInputAssociation"||Ne.type==="bpmn:DataOutputAssociation").map(Ne=>(Ne.source===je?Ne.target:Ne.source).x))),De=new Set(be.map(je=>je.id)),Xe=(lo.children??[]).filter(Li).filter(je=>!De.has(je.id));let wt=fn;for(const je of[...be].sort((Ne,Bt)=>Ne.x-Bt.x)){let Ne=wt;for(let Bt=0;Bt<100;Bt++){const Tt=Xe.find(bt=>Ne<bt.x+bt.width+Di&&Ne+je.width+Di>bt.x&&je.y<bt.y+bt.height&&je.y+je.height>bt.y);if(!Tt)break;Ne=Tt.x+Tt.width+Di}Ne!==je.x&&n.moveElements([je],{x:Ne-je.x,y:0}),wt=Ne+je.width+Di}const Ze=wt+150-(lo.x+lo.width);Ze>0&&Ka(lo,lo.width+Ze);const Mt={assoc:a1(),overlaps:l1(lo),crosses:c1()};if(Mt.assoc>=ke.assoc||Mt.overlaps>ke.overlaps||Mt.crosses>ke.crosses){for(const{st:je,x:Ne}of Pt)je.x!==Ne&&n.moveElements([je],{x:Ne-je.x,y:0});Ze>0&&Ka(lo,lo.width-Ze);for(const je of _t){const Ne=je.x-je.label.x,Bt=je.y-je.label.y;(Ne!==0||Bt!==0)&&n.moveElements([je.label],{x:Ne,y:Bt})}}}}for(const[b,S]of Cn){const A=p(b);if(!A)continue;const k=S.container,L=Math.abs(A.y+A.height/2-k.y-S.relCy)>=.5,D=A.label,j=Math.min(A.y,D&&!D.hidden?D.y:A.y),F=Math.max(A.y+A.height,D&&!D.hidden?D.y+D.height:0);if(L&&j>=k.y&&F<=k.y+k.height)continue;const I=A.y;S.grow(),A.y!==I&&n.moveElements([A],{x:0,y:I-A.y},void 0,{autoResize:!1})}const d1=(b,S)=>{const A=S.target===b,k=f(S.source),L=f(S.target),D=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(k,L,S.id?{type:D,businessObject:i.create(D,{id:S.id})}:{type:D})},h1=b=>{for(const S of h){if(!S.participant.blackBox)continue;const A=p(S.participant.id);if(!A)continue;const k=[];for(const D of x){const j=D.flow.source===S.participant.id?D.flow.target:D.flow.target===S.participant.id?D.flow.source:void 0,F=j?p(j):void 0;F&&typeof F.x=="number"&&F.type!=="bpmn:Participant"&&k.push(F)}if(!k.length)continue;if(!b&&S.order===void 0){const D=(()=>{var F;const j=new Map;for(const I of k){const q=d(I);if(!q)continue;const Z=j.get(q.id);Z?Z.n+=1:j.set(q.id,{shape:q,n:1})}return(F=[...j.values()].sort((I,q)=>q.n-I.n)[0])==null?void 0:F.shape})();if(D){const j=q=>q.reduce((Z,ae)=>Z+ae,0)/q.length,F=j(k.map(q=>q.y+q.height/2))<D.y+D.height/2,I=r.filter(q=>q.type==="bpmn:Participant"&&q.id!==S.participant.id&&q.id!==D.id).filter(q=>F?q.y+q.height<=D.y+5:q.y>=D.y+D.height-5);if(I.length){const q=[...I.reduce((le,xe)=>le.set(xe.y,(le.get(xe.y)??0)+1),new Map)].sort((le,xe)=>xe[1]-le[1]||(F?xe[0]-le[0]:le[0]-xe[0]))[0][0],Z=Math.min(A.width,gM),ae=mM,ce=k.map(le=>le.x+le.width/2),oe=Math.round(j(ce)-Z/2),pe=Math.max(...ce)+hf,ye=le=>({x:le,width:Math.max(Z,pe-le)}),Ie=I.filter(le=>Math.min(le.y+le.height,q+ae)-Math.max(le.y,q)>0),Te=le=>{const xe=ye(le);return Ie.some(tt=>tt.x<xe.x+xe.width&&xe.x<tt.x+tt.width)},te=le=>{const xe=ye(le);return ce.filter(tt=>tt>=xe.x+10&&tt<=xe.x+xe.width-10).length},se=(()=>{if(!Te(oe))return oe;const le=te(oe);return Ie.flatMap(xe=>[xe.x+xe.width+fy,xe.x-fy-Z]).map(xe=>Math.round(xe)).filter(xe=>!Te(xe)&&te(xe)>=le).sort((xe,tt)=>Math.abs(xe-oe)-Math.abs(tt-oe))[0]??oe})();if(se!==A.x||q!==A.y||Z!==A.width||ae!==A.height){const le=()=>new Set(pt(Ge(r)).map(_e=>ct(_e))),xe=le(),tt={x:A.x,y:A.y,width:A.width,height:A.height};n.resizeShape(A,{x:se,y:q,width:Z,height:ae});const nt=le(),It=[...nt].filter(_e=>!xe.has(_e)).length,jt=[...xe].filter(_e=>!nt.has(_e)).length;It>jt&&n.resizeShape(A,tt)}}}}const L=Math.max(...k.map(D=>D.x+D.width/2))+hf;if(L>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:L-A.x,height:A.height}),!!b)for(const D of x){const j=p(D.flow.id),F=D.flow.source===S.participant.id?D.flow.target:D.flow.target===S.participant.id?D.flow.source:void 0,I=F?p(F):void 0;if(!j||!I||I.type==="bpmn:Participant")continue;const q=I.x+I.width/2;q<A.x+10||q>A.x+A.width-10||r1(j,A,I)}}};h1(!1);for(const b of x){const S=b.flow;n.connect(f(S.source),f(S.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:S.id,name:S.name})})}{const A=new Set([..._.map(I=>I.flow.id),...x.map(I=>I.flow.id)].filter(I=>!!I)),k=r.filter(I=>!!I.waypoints),L=(I,q)=>Math.abs(q.x-I.x)<2?"L":Math.abs(q.x-(I.x+I.width))<2?"R":Math.abs(q.y-I.y)<2?"T":Math.abs(q.y-(I.y+I.height))<2?"B":void 0,D=new Map,j=(I,q,Z)=>{if(!I||!q||typeof I.x!="number")return;const ae=L(I,q);if(!ae)return;let ce=D.get(I.id);ce||D.set(I.id,ce=new Map),ce.set(ae,[...ce.get(ae)??[],Z])};for(const I of k){const q=I.waypoints;!q||q.length<2||(j(I.source,q[0],{id:I.id,dir:"out"}),j(I.target,q[q.length-1],{id:I.id,dir:"in"}))}const F=new Set;for(const[I,q]of D){const Z=p(I);if(!Z||typeof Z.x!="number")continue;const ae=te=>{var le;const se=(le=p(te.id))==null?void 0:le.source;return!!se&&typeof se.x=="number"&&se.x+se.width/2>Z.x+Z.width/2};if(![...q.values()].some(te=>te.length>=3&&te.some(se=>se.dir==="out")&&te.some(se=>se.dir==="in"&&A.has(se.id)&&ae(se))))continue;const oe=d(Z);if(!oe||F.has(oe.id)||(oe.children??[]).some(te=>te.type==="bpmn:Lane"))continue;const pe=(D1=q.get("T"))!=null&&D1.length?(L1=q.get("B"))!=null&&L1.length?void 0:"B":"T";if(!pe||(pe==="T"?Z.y-oe.y:oe.y+oe.height-(Z.y+Z.height))>=$)continue;const Ie=(oe.children??[]).filter(te=>!("waypoints"in te&&te.waypoints)&&te.type!=="label"&&typeof te.x=="number"),Te=oe.y+oe.height;n.resizeShape(oe,{x:oe.x,y:oe.y,width:oe.width,height:oe.height+$}),ie(Te,oe.id,$),pe==="T"&&Ie.length&&n.moveElements(Ie,{x:0,y:$}),F.add(oe.id)}}const _g=20,g1=4,U5=3,q5=2,Y5=[10,30,80],Oo=()=>{const b=Ge(r);return{bad:pt(b).filter(S=>S.kind==="edge-crosses-shape"||S.kind==="edge-overlap-opposite"||S.kind==="edge-overlap-mixed").length,crossings:vm(b),straight:b.edges.filter(S=>S.type==="bpmn:MessageFlow"&&S.waypoints.length===2).length}},Za=b=>{const S=Ge(r),A=S.edges.find(k=>k.id===b);return A?zt(A,Vn(S)).length:0},up=b=>Za(b)>0,pp=b=>Ge(r).edges.filter(S=>S.type==="bpmn:MessageFlow"&&S.id!==b&&S.waypoints.length===2).length,m1=(b,S,A)=>Xa([{subtree:b,pool:S}],A),y1=(b,S)=>S.bad>b.bad||S.crossings>b.crossings&&S.straight<=b.straight&&S.bad>=b.bad,Qa=(b,S)=>y1(b,S)||S.straight<b.straight,qr=(b,S,A=()=>!0,k=y1,L=!1)=>{const D=Oo(),j=Xa(b,S,L);if(!j)return!1;const F=Oo();return k(D,F)||!A()?(j(),!1):!0},K5=(b,S,A,k=()=>!0)=>qr([{subtree:b,pool:S}],A,k),Yr=b=>{var S;return!!((S=T.get(b))!=null&&S.node.participant)},vc=new Map;for(const b of x){if(!Yr(b.flow.target))continue;const S=vc.get(b.flow.target)??[];S.push(b),vc.set(b.flow.target,S)}const fp=[...vc.keys()],wg=new Set(_.map(b=>b.flow.target)),v1=b=>Qt.findIndex(({op:S})=>S.participant.id===b);fp.sort((b,S)=>{var L,D;const A=wg.has(b)?1:0,k=wg.has(S)?1:0;return A!==k?A-k:v1((L=T.get(b))==null?void 0:L.node.participant)-v1((D=T.get(S))==null?void 0:D.node.participant)});const vr=b=>b.x+b.width/2,X5=b=>{const S=new Map;for(const L of r.getAll()){const D=L;if(!D.waypoints||!D.source||!D.target)continue;(S.get(D.source.id)??S.set(D.source.id,[]).get(D.source.id)).push(D.target.id)}const A=new Set([b]),k=[b];for(let L=0;L<k.length;L++)for(const D of S.get(k[L])??[])A.has(D)||(A.add(D),k.push(D));return A},Z5=(b,S)=>{const A=X5(S);let k;for(const L of r.getAll()){const D=L;if(D.type!=="bpmn:MessageFlow"||!D.source||!D.target||D.target.id!==b||A.has(D.source.id))continue;const j=D.source;if(typeof j.x!="number"||j.type==="bpmn:Participant")continue;const F=vr(j);(k===void 0||F>k)&&(k=F)}return k},Eg=(b,S)=>{const A=p(b.flow.source);if(A)return A.type==="bpmn:Participant"?Z5(A.id,S):vr(A)},b1=b=>{let S;for(const A of vc.get(b)??[]){const k=Eg(A,b);k!==void 0&&(!S||k>S.cx)&&(S={op:A,cx:k})}return S==null?void 0:S.op},Q5=b=>{const S=b1(b),A=p(b),k=S?Eg(S,b):void 0;return A&&k!==void 0?k-vr(A):void 0},J5=b=>{const S=Q5(b);return S!==void 0&&Math.abs(S)<_g},dp=(b,S,A,k,L)=>{var D;for(let j=!0;j;){j=!1;for(const F of x){if(F.flow.id===A)continue;const I=S.has(F.flow.source),q=S.has(F.flow.target);if(I===q||k(I?F.flow.source:F.flow.target))continue;const Z=I?F.flow.target:F.flow.source;if(L(Z)||!Yr(Z))continue;const ae=p(F.flow.id);if(!(ae!=null&&ae.waypoints)||ae.waypoints.length!==2)continue;const ce=p(Z),oe=(D=T.get(Z))==null?void 0:D.node.participant;if(!ce||!oe)continue;const pe=Ur(Z,ye=>ye.x>=ce.x).filter(ye=>!S.has(ye.id));if(!(!pe.length||pe.some(ye=>L(ye.id)))){for(const ye of pe)S.add(ye.id);b.set(oe,[...b.get(oe)??[],...pe]),j=!0}}}return[...b].map(([j,F])=>({subtree:F,pool:f(j)}))},x1=(b,S,A,k,L)=>dp(new Map([[S,[...b]]]),new Set(b.map(D=>D.id)),k,D=>D===A,D=>D===L),Sg=b=>{const S=b1(b);if(!S)return null;const A=p(b),k=p(S.flow.source),L=Eg(S,b);if(!A||!k||L===void 0)return null;const D=L-vr(A);if(D>=_g){const j=T.get(b).node.participant,F=Ur(b,I=>I.x>=A.x);return{groups:x1(F,j,b,S.flow.id,S.flow.source),dx:D}}if(-D>=_g&&Yr(S.flow.source)){const j=T.get(S.flow.source).node.participant,F=Ur(S.flow.source,I=>I.x>=k.x&&!J5(I.id));return{groups:x1(F,j,S.flow.source,S.flow.id,b),dx:-D}}return null},_1=()=>fp.map(b=>({id:b,plan:Sg(b)})).filter(b=>!!b.plan).sort((b,S)=>Math.min(...b.plan.groups.flatMap(A=>A.subtree.map(k=>k.x)))-Math.min(...S.plan.groups.flatMap(A=>A.subtree.map(k=>k.x)))).map(b=>b.id);for(let b=0;b<3;b++){const S=Oo(),A=[];for(const L of _1()){const D=Sg(L);if(!D)continue;const j=Xa(D.groups,D.dx);j&&A.push(j)}if(!A.length)break;if(!Qa(S,Oo()))continue;for(const L of A.reverse())L();let k=!1;for(const L of _1()){const D=Sg(L);D&&qr(D.groups,D.dx,()=>!0,Qa)&&(k=!0)}if(!k)break}for(const b of fp){if(wg.has(b))continue;const S=T.get(b);if(!S||S.node.lane!==void 0)continue;const A=Y(S);if(A===void 0)continue;const k=p(b),L=k?d(k):void 0;if(!k||!L)continue;const D=L.y+Q+C(`pool:${S.node.participant??""}`,A)*$,j=D-(k.y+k.height/2);j!==0&&!Oe(L,k,k.x+k.width/2,D)&&n.moveElements([k],{x:0,y:j})}const w1=new Set;for(let b=0,S=!0;S&&b<U5;b++){S=!1;for(const A of fp.flatMap(k=>vc.get(k)??[])){if(w1.has(A.flow.id)||!up(A.flow.id))continue;const k=p(A.flow.target);if(!k)continue;const L=f(T.get(A.flow.target).node.participant),D=Ur(A.flow.target,q=>q.x>=k.x),j=k.width+H,F=Za(A.flow.id),I=pp(A.flow.id);for(let q=1;q<=g1;q++){const Z=()=>Za(A.flow.id)<F&&pp(A.flow.id)>=I;if(K5(D,L,j*q,Z)){w1.add(A.flow.id),S=!0;break}}}}const Rg=x.map(b=>({id:b.flow.id,source:b.flow.source,target:b.flow.target,preexisting:!1})),E1=new Set(Rg.map(b=>b.id));for(const b of r.filter(S=>S.type==="bpmn:MessageFlow"))E1.has(b.id)||!b.source||!b.target||b.source.type==="bpmn:Participant"!=(b.target.type==="bpmn:Participant")&&Rg.push({id:b.id,source:b.source.id,target:b.target.id,preexisting:!0});for(const b of Rg){if(!up(b.id))continue;const S=p(b.source),A=p(b.target);if(!S||!A)continue;let k,L,D;if(b.preexisting){const[F,I]=S.type==="bpmn:Participant"?[A,S]:[S,A];if(k=vr(F),k<I.x||k>I.x+I.width)continue;[L,D]=F.y<I.y?[F.y+F.height,I.y]:[I.y+I.height,F.y]}else{if(S.type==="bpmn:Participant"||A.type==="bpmn:Participant"||(k=S.x+S.width/2,Math.abs(k-(A.x+A.width/2))>15))continue;[L,D]=S.y<A.y?[S.y+S.height,A.y]:[A.y+A.height,S.y]}const j=[...T.values()].map(F=>p(F.node.id)).filter(F=>!!F&&F.id!==S.id&&F.id!==A.id).filter(F=>F.x<=k&&k<=F.x+F.width&&F.y+F.height>L&&F.y<D).sort((F,I)=>F.x-I.x);for(const F of j){const I=(I1=T.get(F.id))==null?void 0:I1.node.participant,q=I?p(I):void 0;if(!I||!q)continue;const Z=[...T.values()].filter(se=>se.node.participant===I).map(se=>se.node.id),ae=se=>se.map(le=>p(le)).filter(le=>!!le),oe=[j5(F.id,se=>{var le;return((le=T.get(se.id))==null?void 0:le.node.participant)===I}),ae(Z)].filter(se=>se.length).map(se=>[{subtree:se,pool:q}]);if(b.preexisting){const se=ae(Z);se.length&&oe.push(dp(new Map([[I,[...se]]]),new Set(se.map(le=>le.id)),b.id,()=>!1,le=>le===S.id||le===A.id))}const pe=F.width+H,ye=Za(b.id),Ie=pp(b.id),Te=()=>Za(b.id)<ye&&pp(b.id)>=Ie;let te=!1;for(const se of oe){for(let le=1;le<=g1;le++)if(qr(se,pe*le,Te)){te=!0;break}if(te)break}if(!up(b.id))break}}const hp=()=>{var S;const b=new Set;for(const A of pt(Ge(r)))A.kind!=="edge-crosses-shape"||E1.has(A.edge)||((S=p(A.edge))==null?void 0:S.type)==="bpmn:MessageFlow"&&b.add(`${A.edge}>${A.shape}`);return b},e3=(b,S)=>Oo().bad>=b&&[...hp()].some(A=>!S.has(A)),S1=b=>{var S,A;return Za(b)===0&&((A=(S=p(b))==null?void 0:S.waypoints)==null?void 0:A.length)===2},t3=(b,S,A)=>{const k=new Set(b.flatMap(D=>D.subtree.map(j=>j.id))),L=[...hp()].filter(D=>!A.has(D)).map(D=>D.split(">")[1]);return[...new Set(L)].filter(D=>k.has(D)&&D!==S.source&&D!==S.target)},n3=(b,S,A,k,L)=>{const D=b.map(q=>({...q,subtree:q.subtree.filter(Z=>!L.includes(Z.id))})).filter(q=>q.subtree.length),j=new Set(D.flatMap(q=>q.subtree.map(Z=>Z.id))),F=()=>L.every(q=>{const Z=p(q);return!!Z&&_.filter(ae=>ae.flow.target===q&&j.has(ae.flow.source)).every(ae=>{const ce=p(ae.flow.source);return!!ce&&ce.x+ce.width<=Z.x})});return qr(D,S,()=>S1(A.id)&&[...hp()].every(q=>k.has(q))&&F(),Qa,!0)};for(const b of x){if(!up(b.flow.id))continue;const S=p(b.flow.id);if(((B1=S==null?void 0:S.waypoints)==null?void 0:B1.length)!==2)continue;const A=p(b.flow.source),k=p(b.flow.target);if(!A||!k||A.type==="bpmn:Participant"||k.type==="bpmn:Participant"||!Yr(b.flow.source)||!Yr(b.flow.target)||Math.abs(vr(A)-vr(k))>q5)continue;const L=vr(A),D=S.waypoints.map(ye=>ye.y),[j,F]=[Math.min(...D),Math.max(...D)],I=Vn(Ge(r)).filter(ye=>ye.id!==A.id&&ye.id!==k.id&&ye.x<L&&L<ye.x+ye.width&&j<ye.y+ye.height&&ye.y<F);if(!I.length)continue;const q=(N1=T.get(b.flow.source))==null?void 0:N1.node.participant,Z=($1=T.get(b.flow.target))==null?void 0:$1.node.participant;if(!q||!Z)continue;const ae=new Map;for(const[ye,Ie,Te]of[[b.flow.source,A,q],[b.flow.target,k,Z]]){const te=ae.get(Te)??[],se=Ur(ye,le=>le.x>=Ie.x).filter(le=>!te.some(xe=>xe.id===le.id));ae.set(Te,[...te,...se])}const ce=new Set([...ae.values()].flat().map(ye=>ye.id)),oe=dp(ae,ce,b.flow.id,ye=>ye===b.flow.source||ye===b.flow.target,()=>!1),pe=Math.max(...I.map(ye=>ye.x+ye.width));for(const ye of Y5){const Ie=pe+ye-L;if(Ie<=0)continue;const Te=Oo().bad,te=hp();let se=[],le=!0;const xe=()=>!S1(b.flow.id)||le&&(se=t3(oe,b.flow,te),se.length)?!1:!e3(Te,te);if(qr(oe,Ie,xe,Qa))break;if(se.length&&(n3(oe,Ie,b.flow,te,se)||(le=!1,qr(oe,Ie,xe,Qa))))break}}{const b=A=>A.y+A.height/2,S=[];for(const A of T.keys()){if(!Yr(A))continue;const k=_.filter(j=>j.flow.target===A);if(k.length!==1)continue;const L=p(k[0].flow.source),D=p(A);!L||!D||!T.has(L.id)||Math.abs(b(L)-b(D))>1||D.x-(L.x+L.width)<=H+1||S.push({id:A,pred:L,node:D})}S.sort((A,k)=>A.node.x-k.node.x);for(const{id:A}of S){const k=T.get(A),L=p(A),D=p(_.find(Ie=>Ie.flow.target===A).flow.source);if(!L||!D)continue;const j=L.x-(D.x+D.width);if(j<=H+1)continue;const F=f(k.node.participant),I=Ur(A,Ie=>Ie.x>=L.x),q=-(j-H),Z=(Ie,Te)=>Te.bad>Ie.bad||Te.crossings>=Ie.crossings||Te.straight<Ie.straight,ae=dp(new Map([[k.node.participant,[...I]]]),new Set(I.map(Ie=>Ie.id)),"",()=>!1,()=>!1),ce=ae.some(Ie=>Ie.pool!==F)||ae.reduce((Ie,Te)=>Ie+Te.subtree.length,0)>I.length,oe=Oo(),pe=m1(I,F,q);if(!pe)continue;const ye=Oo();if(ce&&!Z(oe,ye)){pe();const Ie=Xa(ae,q);if(Ie){const Te=Oo();if(!Z(oe,Te)&&Te.bad<=ye.bad&&Te.crossings<=ye.crossings)continue;Ie()}m1(I,F,q);continue}Z(oe,ye)&&pe()}}h1(!0);const i3=10,o3=400,r3=b=>[...b.incoming??[],...b.outgoing??[]].filter(S=>S.type==="bpmn:DataInputAssociation"||S.type==="bpmn:DataOutputAssociation").map(S=>S.source===b?S.target:S.source).filter(S=>!!S&&typeof S.y=="number"),a3=r.filter(b=>b.type==="bpmn:DataStoreReference"&&g.has(b.id)),s3=(b,S)=>{const A=b.x+b.width/2,k=b.y+b.height/2;let L;for(const D of a3){if((d(D)??u())!==S||D.y<b.y+b.height)continue;const j=Math.abs(D.x+D.width/2-A);j>o3||j<D.width||!r3(D).some(I=>I.height===b.height&&Math.abs(I.y+I.height/2-k)<=i3&&D.y>=I.y+I.height)||(!L||j<L.dx||j===L.dx&&D.id<L.id)&&(L={dx:j,id:D.id,cy:D.y+D.height/2})}return L==null?void 0:L.cy};for(const b of y){const S=b.associations??[],A=S.map(D=>D.source===b.dataStore.id?D.target:D.source).map(p).find(Boolean),k=A?d(A)??u():u(),L=A?{x:A.x+A.width/2,y:s3(A,k)??A.y+A.height+110}:{x:200,y:_n+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:b.dataStore.id,name:b.dataStore.name})},L,k);for(const D of S)d1(b.dataStore.id,D)}for(const b of v){const A=f(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;d1(A,b.association)}let R1=0;const Kr=10,C1=40,c3=(b,S)=>{const A=S.map(I=>d(I)).filter(I=>!!I);for(const I of A){const q=Kr,Z=I.y,ae=I.y+I.height,ce=I.x,oe=I.x+I.width;if(Math.abs(b.y-Z)<q){const pe=Z+q-b.y;b.y+=pe,b.height-=pe}if(Math.abs(b.y+b.height-ae)<q&&(b.height=ae-q-b.y),Math.abs(b.x-ce)<q){const pe=ce+q-b.x;b.x+=pe,b.width-=pe}Math.abs(b.x+b.width-oe)<q&&(b.width=oe-q-b.x)}if(!A.length)return;const k=Math.min(...A.map(I=>I.y)),L=Math.max(...A.map(I=>I.y+I.height)),D=k-b.y,j=b.y+b.height-L,F=C1-Kr;if(D>0!=j>0)if(D>0&&D<F){const I=D+Kr;b.y+=I,b.height-=I}else j>0&&j<F&&(b.height-=j+Kr)},l3=(b,S)=>{const A=Kr,k=30,L=r.filter(D=>D.type==="bpmn:Group"&&D.id!==S);for(const D of L){const j=D.x,F=D.x+D.width,I=D.y,q=D.y+D.height,Z=b.y<q&&I<b.y+b.height,ae=b.x<F&&j<b.x+b.width;if(Z){if(Math.abs(b.x-F)<A){const ce=Math.min(F+A-b.x,k);ce>0&&b.width-ce>0&&(b.x+=ce,b.width-=ce)}if(Math.abs(b.x+b.width-j)<A){const ce=Math.min(b.x+b.width-(j-A),k);ce>0&&b.width-ce>0&&(b.width-=ce)}}if(ae){if(Math.abs(b.y-q)<A){const ce=Math.min(q+A-b.y,k);ce>0&&b.height-ce>0&&(b.y+=ce,b.height-=ce)}if(Math.abs(b.y+b.height-I)<A){const ce=Math.min(b.y+b.height-(I-A),k);ce>0&&b.height-ce>0&&(b.height-=ce)}}}},Cg=(b,S)=>{const A=C1,k=Math.min(...b.map(I=>I.x))-A,L=Math.min(...b.map(I=>I.y))-A,D=Math.max(...b.map(I=>I.x+I.width))+A,j=Math.max(...b.map(I=>I.y+I.height))+A,F={x:k,y:L,width:D-k,height:j-L};return c3(F,b),l3(F,S),F};for(const b of w){const S=(b.group.members??[]).map(p).filter(L=>!!L);let A;S.length?A=Cg(S,b.group.id):(A={x:300+R1*350,y:40,width:300,height:200},R1++);const k=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());b.group.name&&n.updateLabel(k,b.group.name),(F1=b.group.members)!=null&&F1.length&&P(k,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=r.filter(L=>!!L.waypoints),S=new Map,A=(L,D)=>{!L||!D||(S.has(L)||S.set(L,new Set),S.get(L).add(D))};for(const L of b){const D=(j1=L.source)==null?void 0:j1.id,j=(H1=L.target)==null?void 0:H1.id;A(D,j),((z1=L.type)!=null&&z1.includes("DataOutputAssociation")||(G1=L.type)!=null&&G1.includes("DataInputAssociation")||L.type==="bpmn:Association")&&A(j,D)}const k=r.filter(L=>L.type==="bpmn:Group");for(const L of k){const j=(((V1=L.businessObject.extensionElements)==null?void 0:V1.values)??[]).find(Te=>Te.$type==="bwl:Members"),F=((j==null?void 0:j.refs)??"").split(" ").filter(Boolean);if(!F.length)continue;const I=new Set(F),q=[...F];for(;q.length;){const Te=q.shift();for(const te of S.get(Te)??[])I.has(te)||(I.add(te),q.push(te))}const Z=L.x,ae=L.x+L.width,ce=L.y,oe=L.y+L.height,pe=Te=>_.filter(te=>te.flow.target===Te).length,ye=Te=>{var se;const te=((se=p(Te))==null?void 0:se.type)??"";if(te==="bpmn:StartEvent"&&pe(Te)===0)return!1;if(te.endsWith("Gateway")){const le=_.filter(xe=>xe.flow.target===Te).map(xe=>xe.flow.source);if(le.length&&le.every(xe=>{var tt;return((tt=p(xe))==null?void 0:tt.type)==="bpmn:StartEvent"&&pe(xe)===0}))return!1}return!0},Ie=r.filter(Te=>Li(Te)).filter(Te=>Te.type!=="bpmn:Group"&&Te.type!=="bpmn:Participant"&&Te.type!=="bpmn:TextAnnotation"&&!I.has(Te.id)&&Yr(Te.id)&&ye(Te.id)&&Te.x<ae&&Te.x+Te.width>Z&&Te.y<oe&&Te.y+Te.height>ce);if(Ie.length)for(const Te of[-1,1]){const te=Ie.filter(be=>(be.x+be.width-Z<=ae-be.x?-1:1)===Te);if(!te.length)continue;const se=[];for(const be of te){const ue=se.find(we=>we.some(ze=>be.y<ze.y+ze.height&&be.y+be.height>ze.y));ue?ue.push(be):se.push([be])}const le=new Map;for(const be of se){let ue=Te<0?Z-Kr:ae+Kr;for(const we of[...be].sort((ze,$e)=>Te<0?$e.x-ze.x:ze.x-$e.x)){const ze=Te<0?Math.min(we.x,ue-we.width):Math.max(we.x,ue);ue=Te<0?ze-Di:ze+we.width+Di,ze!==we.x&&Math.sign(ze-we.x)===Te&&le.set(we.id,ze-we.x)}}const xe=new Map,tt=be=>xe.get(be)===be||!xe.get(be)?be:tt(xe.get(be));for(const be of te)xe.set(be.id,be.id);for(const be of x){const ue=le.has(be.flow.source)?be.flow.source:void 0,we=le.has(be.flow.target)?be.flow.target:void 0;if(!ue||!we)continue;const ze=p(be.flow.id);((W1=ze==null?void 0:ze.waypoints)==null?void 0:W1.length)===2&&xe.set(tt(ue),tt(we))}const nt=new Map;for(const be of te){if(!le.has(be.id))continue;const ue=tt(be.id);nt.set(ue,[...nt.get(ue)??[],be])}const It=[...nt.values()].sort((be,ue)=>Te<0?Math.min(...be.map(we=>we.x))-Math.min(...ue.map(we=>we.x)):Math.max(...ue.map(we=>we.x))-Math.max(...be.map(we=>we.x))),jt=[];let _e=!0;for(const be of It){const ue=be.map($e=>le.get($e.id)??0).reduce(($e,Ce)=>Math.abs(Ce)>Math.abs($e)?Ce:$e,0),we=new Map;let ze=!0;for(const $e of be){const Ce=d($e);if(!Ce){ze=!1;break}we.has(Ce.id)||we.set(Ce.id,{subtree:[],pool:Ce}),we.get(Ce.id).subtree.push($e)}ze&&qr([...we.values()],ue,()=>!0,Qa)?jt.push({shapes:be,dx:ue}):_e=!1}if(!_e)for(const be of jt.reverse())n.moveElements(be.shapes,{x:-be.dx,y:0})}}}{const b=new Set([...w.map(S=>S.group.id),...en(e,"group.update").map(S=>S.id)]);for(const S of r.filter(A=>A.type==="bpmn:Group")){if(b.has(S.id))continue;const k=(((U1=S.businessObject.extensionElements)==null?void 0:U1.values)??[]).find(F=>F.$type==="bwl:Members"),L=((k==null?void 0:k.refs)??"").split(" ").filter(Boolean).map(p).filter(F=>!!F);!L.length||!L.some(F=>{const I=g.get(F.id);return!I||I.x!==F.x||I.y!==F.y})||!L.some(F=>F.x<S.x||F.y<S.y||F.x+F.width>S.x+S.width||F.y+F.height>S.y+S.height)||n.resizeShape(S,Cg(L,S.id))}}{const S=new Map(Ho(Ge(r)).map(F=>[F.owner,F.rect])),A=r.filter(F=>!!F.waypoints),k=new Map,L=(F,I)=>{!F||!I||(k.has(F)||k.set(F,new Set),k.get(F).add(I))};for(const F of A){const I=(q1=F.source)==null?void 0:q1.id,q=(Y1=F.target)==null?void 0:Y1.id;L(I,q),((K1=F.type)!=null&&K1.includes("DataOutputAssociation")||(X1=F.type)!=null&&X1.includes("DataInputAssociation")||F.type==="bpmn:Association")&&L(q,I)}const D=F=>_.filter(I=>I.flow.target===F).length,j=F=>{var q;const I=((q=p(F))==null?void 0:q.type)??"";if(I==="bpmn:StartEvent"&&D(F)===0)return!1;if(I.endsWith("Gateway")){const Z=_.filter(ae=>ae.flow.target===F).map(ae=>ae.flow.source);if(Z.length&&Z.every(ae=>{var ce;return((ce=p(ae))==null?void 0:ce.type)==="bpmn:StartEvent"&&D(ae)===0}))return!1}return!0};for(const F of r.filter(I=>I.type==="bpmn:Group")){const q=(((Z1=F.businessObject.extensionElements)==null?void 0:Z1.values)??[]).find(ue=>ue.$type==="bwl:Members"),Z=((q==null?void 0:q.refs)??"").split(" ").filter(Boolean);if(!Z.length)continue;const ae=Z.map(p).filter(ue=>!!ue);if(!ae.length||!(w.some(ue=>ue.group.id===F.id)||en(e,"group.update").some(ue=>ue.id===F.id)||ae.some(ue=>{const we=g.get(ue.id);return!we||we.x!==ue.x||we.y!==ue.y})))continue;const oe=new Set(Z),pe=[...Z];for(;pe.length;){const ue=pe.shift();for(const we of k.get(ue)??[])oe.has(we)||(oe.add(we),pe.push(we))}const ye=F.x,Ie=F.x+F.width,Te=F.y,te=F.y+F.height,se=ue=>{const we=S.get(ue.id),ze={x:ue.x,y:ue.y,width:ue.width,height:ue.height};return we?[ze,{x:we.x,y:we.y,width:we.width,height:we.height}]:[ze]},le=ae.flatMap(se),xe=Math.min(...le.map(ue=>ue.x)),tt=Math.max(...le.map(ue=>ue.x+ue.width)),nt=Math.min(...le.map(ue=>ue.y)),It=Math.max(...le.map(ue=>ue.y+ue.height)),jt={L:xe-ye,R:Ie-tt,T:nt-Te,B:te-It},_e=r.filter(ue=>Li(ue)).filter(ue=>ue.type!=="bpmn:Group"&&ue.type!=="bpmn:Participant"&&ue.type!=="bpmn:TextAnnotation"&&!oe.has(ue.id)&&j(ue.id)&&ue.x<Ie&&ue.x+ue.width>ye&&ue.y<te&&ue.y+ue.height>Te);if(!_e.length)continue;const be={L:0,R:0,T:0,B:0};for(const ue of _e){const we=se(ue),ze=Math.min(...we.map(yt=>yt.x)),$e=Math.max(...we.map(yt=>yt.x+yt.width)),Ce=Math.min(...we.map(yt=>yt.y)),st=Math.max(...we.map(yt=>yt.y+yt.height)),ft={L:$e-ye,R:Ie-ze,T:st-Te,B:te-Ce},Jt=["L","R","T","B"].filter(yt=>ft[yt]<=jt[yt]+.001);if(!Jt.length)continue;const An=Jt.reduce((yt,Hn)=>ft[Hn]<ft[yt]?Hn:yt,Jt[0]);be[An]=Math.max(be[An],Math.min(ft[An]+10,jt[An]))}!be.L&&!be.R&&!be.T&&!be.B||n.resizeShape(F,{x:F.x+be.L,y:F.y+be.T,width:F.width-be.L-be.R,height:F.height-be.T-be.B})}}const M1=b=>{const S=b.waypoints;if(S!=null&&S.length){const k=S[Math.floor((S.length-1)/2)];return{x:k.x,y:k.y,width:0,height:0}}const A=b;return{x:A.x,y:A.y,width:A.width,height:A.height}};let bc=0;const A1=12,P1=14,u3=15,p3=300,f3=b=>{const S=b.split(`
7
- `),A=Math.max(...S.map(D=>ca(D,A1))),k=Math.max(100,Math.min(p3,Math.ceil(A)+P1)),L=S.reduce((D,j)=>D+Math.max(1,Math.ceil((ca(j,A1)+P1)/k)),0);return{width:k,height:Math.max(30,L*u3+10)}};for(const b of E){const S=b.association,A=((Q1=b.placement)==null?void 0:Q1.anchor)??(S?S.source===b.annotation.id?S.target:S.source:void 0),k=A?p(A):void 0,L=k?M1(k):void 0,D=f3(b.annotation.text??"");let j;if(L&&b.placement){const[Z,ae]=Xc[b.placement.side],ce=b.placement.offset??50;j={x:L.x+L.width/2+Z*(L.width/2+D.width/2+ce),y:L.y+L.height/2+ae*(L.height/2+D.height/2+ce)}}else L?(j={x:L.x+L.width/2+180+bc%3*260,y:L.y-110-bc%2*95},bc++):(j={x:300+bc*260,y:60},bc++);const F=k?d(k)??u():u(),I=F;L&&typeof I.x=="number"&&typeof I.width=="number"&&I.type==="bpmn:Participant"&&(j=Qc(r,L,D,I,b.placement?{placement:b.placement}:{from:j}));const q=n.createShape({type:"bpmn:TextAnnotation",width:D.width,height:D.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},j,F);if(S){const Z=ae=>ae===b.annotation.id?q:f(ae);n.connect(Z(S.source),Z(S.target),S.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:S.id})}:{type:"bpmn:Association"})}b.placement&&P(q,"bwl:Placement",O(b.placement))}for(const b of en(e,"association.add")){const S=b.association;n.connect(f(S.source),f(S.target),S.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:S.id})}:{type:"bpmn:Association"})}const T1=()=>new Set(r.getAll().filter(b=>b.type!=="label").map(b=>b.id));for(const b of en(e,"node.update")){let S=f(b.id);if(b.type&&Kc(b.type)!==S.type){const A=S.x+S.width/2,k=S.y+S.height/2,L=T1();S=c.replaceElement(S,{type:Kc(b.type),...b.eventDefinition?{eventDefinitionType:Sc[b.eventDefinition]}:{}});const D=T1(),j=[...L].filter(q=>q!==b.id&&!D.has(q));if(j.length)throw new gy({kind:"type-change-drops-elements",opIndex:e.indexOf(b),id:b.id,type:b.type,dropped:j});const F=Math.round(A-(S.x+S.width/2)),I=Math.round(k-(S.y+S.height/2));if(F!==0||I!==0){n.moveShape(S,{x:F,y:I});for(const q of[...S.incoming??[],...S.outgoing??[]])gt(q)}}if(b.name!==void 0&&n.updateProperties(S,{name:b.name??void 0}),b.lane||b.band!==void 0){b.band!==void 0&&n.updateProperties(S,{"bwl:band":b.band});const A=S.y+S.height/2,k=d(S),L=b.lane?f(b.lane):((k==null?void 0:k.children)??[]).find(j=>j.type==="bpmn:Lane"&&A>=j.y&&A<=j.y+j.height);b.band!==void 0&&mt(L==null?void 0:L.id,b.band,k);const D=L?L.y+(b.band===void 0?L.height/2:Math.min(L.height/2,J)+C(L.id,b.band)*$):b.band!==void 0&&k?k.y+Q+C(`pool:${k.id}`,b.band)*$:void 0;if(D!==void 0){const j=D-A;j!==0&&n.moveElements([S],{x:0,y:j})}}}for(const b of en(e,"sequenceFlow.update")){const S=f(b.id);if(b.source!==void 0||b.target!==void 0){const A=S,k=b.source!==void 0?f(b.source):A.source,L=b.target!==void 0?f(b.target):A.target,D=I=>({x:I.x+I.width/2,y:I.y+I.height/2});n.reconnect(A,k,L,[D(k),D(L)]);const j=f1.get(A.id),F=L.y+L.height/2;if(j&&L.x>j.exit.x&&Math.abs(F-j.exit.y)>1){n.updateWaypoints(A,[j.exit,{x:j.exit.x,y:F},{x:L.x,y:F}]);const I=A.label;if(I&&j.label){const Z=Math.abs(j.label.y+I.height/2-j.channelY)<=$/5&&j.label.x+I.width>j.exit.x,ae=j.exit.x+6,ce=L.x-6-I.width,oe=Z?ce>=ae?{x:Math.max(ae,Math.min(j.label.x,ce)),y:j.label.y+(F-j.channelY)}:void 0:j.label;oe&&(oe.x!==I.x||oe.y!==I.y)&&n.moveElements([I],{x:oe.x-I.x,y:oe.y-I.y})}}else Math.abs(F-(k.y+k.height/2))>1&&gt(A)}b.name!==void 0&&n.updateProperties(S,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(S,{name:((J1=b.condition)==null?void 0:J1.label)??void 0})}for(const b of en(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of en(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of en(e,"annotation.update")){const S=f(b.id);if(b.text!==void 0&&n.updateProperties(S,{text:b.text}),b.placement===null)P(S,"bwl:Placement",null);else if(b.placement){const A=f(b.placement.anchor),k=M1(A),L=d(A)??u(),D=typeof L.x=="number"&&typeof L.width=="number"&&L.type==="bpmn:Participant",[j,F]=Xc[b.placement.side],I=b.placement.offset??50,q={x:k.x+k.width/2+j*(k.width/2+S.width/2+I),y:k.y+k.height/2+F*(k.height/2+S.height/2+I)},Z=D?Qc(r,k,{width:S.width,height:S.height},L,{placement:b.placement,selfId:b.id}):q;n.moveElements([S],{x:Z.x-(S.x+S.width/2),y:Z.y-(S.y+S.height/2)}),P(S,"bwl:Placement",O(b.placement))}}for(const b of en(e,"group.update")){const S=f(b.id);if(b.name!==void 0&&n.updateLabel(S,b.name??""),b.members){const A=b.members.map(p).filter(k=>!!k);A.length&&n.resizeShape(S,Cg(A,b.id)),P(S,"bwl:Members",{refs:b.members.join(" ")})}}}function gf(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 bM(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 _,x,y,v;return h.x===g[m].x&&h.y===g[m].y&&((_=h.original)==null?void 0:_.x)===((x=g[m].original)==null?void 0:x.x)&&((y=h.original)==null?void 0:y.y)===((v=g[m].original)==null?void 0:v.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=Ge(o),f=[...ho(p),...Ni(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 xM(e,t,n){var u,p;const{elementRegistry:i}=e,o=e.modeling,r=f=>pt(f).filter(d=>!t.has(ct(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=Ge(i),c=r(s),l=[...new Set(c.flatMap(gf))].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 me=d.x+d.width/2,Ae=d.y+d.height/2;h=i.getAll().find(Oe=>{if(Oe.type!=="bpmn:Participant")return!1;const Ee=Oe;return typeof Ee.x=="number"&&typeof Ee.width=="number"&&me>=Ee.x&&me<=Ee.x+Ee.width&&Ae>=Ee.y&&Ae<=Ee.y+Ee.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const _=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(me=>me.$type==="bwl:Placement"),x=[...d.incoming??[],...d.outgoing??[]].find(me=>me.type==="bpmn:Association"),y=(_!=null&&_.anchor?i.get(_.anchor):void 0)??(x?((p=x.source)==null?void 0:p.id)===f?x.target:x.source:void 0);if(!y)continue;const v=y.waypoints,E=v!=null&&v.length?{x:v[Math.floor((v.length-1)/2)].x,y:v[Math.floor((v.length-1)/2)].y,width:0,height:0}:{x:y.x,y:y.y,width:y.width,height:y.height},w={width:d.width,height:d.height},T={x:d.x+d.width/2,y:d.y+d.height/2},P=_==null?void 0:_.side,O=hy(i,E,h),B=[];if(P&&P in Xc&&B.push(Qc(i,E,w,h,{placement:{side:P,offset:(_==null?void 0:_.offset)??null},selfId:f})),O&&!Zc(T,w,O))for(const me of vM)B.push(Qc(i,E,w,h,{placement:{side:me,offset:null},selfId:f}));for(const[me,Ae]of[[-1,0],[1,0],[0,-1],[0,1]])for(let Oe=1;Oe<=yM;Oe++)B.push({x:T.x+me*dy*Oe,y:T.y+Ae*dy*Oe});const $={...s,edges:s.edges.filter(me=>me.id!==(x==null?void 0:x.id))},H=r($),Q=H.filter(me=>gf(me).includes(f)).length;if(!Q)continue;let J,X=!1;for(const me of B){const Ae=me.x-T.x,Oe=me.y-T.y;if(!Ae&&!Oe||me.x-w.width/2<h.x||me.x+w.width/2>h.x+h.width||me.y-w.height/2<h.y||me.y+w.height/2>h.y+h.height||O&&!Zc(me,w,O))continue;const Ee={...$,shapes:$.shapes.map(Y=>Y.id===f?{...Y,x:Y.x+Ae,y:Y.y+Oe}:Y)},W=r(Ee),ne=W.filter(Y=>gf(Y).includes(f)).length;if(ne>=Q||W.length>H.length)continue;const U=Math.abs(Ae)+Math.abs(Oe);if(X||((!J||ne<J.mine||ne===J.mine&&(W.length<J.all||W.length===J.all&&U<J.dist))&&(J={x:me.x,y:me.y,mine:ne,all:W.length,dist:U}),J.mine===0&&J.all<H.length&&(X=!0)),ne===0&&W.length<H.length&&bM(e,d,Ae,Oe)===0){J={x:me.x,y:me.y,mine:ne,all:W.length,dist:U};break}}J&&o.moveElements([d],{x:J.x-T.x,y:J.y-T.y})}}const _M=60;function mf(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 wM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=u=>pt(u).filter(p=>!t.has(ct(p))),a=u=>u.filter(p=>p.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,p)=>p.x>=u.x&&p.y>=u.y&&p.x+p.width<=u.x+u.width&&p.y+p.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const f=new Set,d=new Set([u]);for(let h=0;h<4;h++){let m=!1;for(const _ of n.shapes)_.type!=="bpmn:Group"||f.has(_.id)||[...d].some(x=>{const y=s.get(x);return y&&c(_,y)})&&(f.add(_.id),m=!0);for(const _ of n.shapes)_.type!=="bpmn:Participant"||d.has(_.id)||[...f].some(x=>{const y=s.get(x);return y&&c(y,_)})&&(d.add(_.id),m=!0);if(!m)break}const g=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!f.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...f].some(m=>{const _=s.get(m);return _&&c(_,h)})).map(h=>h.id);return[...d,...f,...g]};for(let u=0;u<6;u++){const p=Ge(i),f=r(p),d=a(f);if(!d.length)return;const g=new Map(p.shapes.map(v=>[v.id,v]));let h=null;for(const v of d){if(v.kind!=="pool-overlap")continue;const[E,w]=v.pools,T=g.get(E),P=g.get(w);if(!T||!P)continue;const[O,B]=T.x<=P.x?[T,P]:[P,T];if(v.contained)continue;const $=s.get(O.id),H=s.get(B.id),Q=$&&H?Math.max(H.x-($.x+$.width),0):_M,J=O.x+O.width+Q-B.x;if(J<=0)continue;const X=l(B.id).filter(me=>i.get(me));X.length&&(!h||J>h.dx)&&(h={movers:X,dx:J})}if(!h)return;const m=h.movers.map(v=>i.get(v)).filter(v=>!!v&&typeof v.x=="number");if(!m.length)return;const _=f.length,x=d.length;o.moveElements(m,{x:h.dx,y:0});const y=r(Ge(i));if(!(a(y).length<x&&y.length<=_)){o.moveElements(m,{x:-h.dx,y:0});return}}}const ds=.5,yy=150;function EM(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of SM(n))i.length<n.length&&i.some(r=>RM(e.elementRegistry.get(r.id)))||CM(e,i)}function SM(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)<=ds?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function RM(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 CM(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(x=>x.x+x.width),r=Math.max(...o);if(r-Math.min(...o)>ds)return;const a=t.map(x=>n.get(x.id)).filter(x=>!!x&&typeof x.x=="number");if(a.length<2)return;const s=new Map(t.map(x=>[x.id,x.x]));if(a.some(x=>Math.abs(x.x-s.get(x.id))>ds))return;const c=a.map(x=>x.x+x.width);if(Math.max(...c)-Math.min(...c)<=ds)return;const l=x=>x.x+x.width,u=x=>!!x&&typeof x.width=="number",p=x=>{const y={shapes:[],edges:[],lanes:[]},v=E=>{for(const w of E.children??[]){if("waypoints"in w&&w.waypoints){y.edges.push(w);continue}w.type!=="label"&&(w.type==="bpmn:Lane"?y.lanes.push(w):y.shapes.push(w),v(w))}};return v(x),y},f=new Map(a.map(x=>[x.id,p(x)]));let d=r;for(const x of a){const{shapes:y}=f.get(x.id),v=y.flatMap(E=>[l(E),...u(E.label)?[l(E.label)]:[]]);v.length&&(d=Math.max(d,Math.max(...v)+yy))}const g=a.filter(x=>Math.abs(l(x)-d)>ds);if(!g.length)return;for(const x of g){const y=l(x),{shapes:v,edges:E,lanes:w}=f.get(x.id);if([...v.flatMap(O=>[l(O),...u(O.label)?[l(O.label)]:[]]),...E.flatMap(O=>[...O.waypoints.map(B=>B.x),...u(O.label)?[l(O.label)]:[]])].some(O=>O>d)||[...(x.incoming??[]).map(O=>O.waypoints[O.waypoints.length-1]),...(x.outgoing??[]).map(O=>O.waypoints[0])].some(O=>!O||O.x>d||Math.abs(O.x-y)<1))return;if(d>y){const O={x:y,y:x.y,width:d-y,height:x.height},B=new Set([x.id,...v.map(H=>H.id),...E.map(H=>H.id),...w.map(H=>H.id)]);if(n.getAll().some(H=>{var X;if("waypoints"in H&&H.waypoints||H.type==="bpmn:Group"||!u(H))return!1;const Q=H.type==="label"?(X=H.labelTarget)==null?void 0:X.id:H.id;if(!Q||B.has(Q)||B.has(H.id))return!1;const J=H;return J.x<O.x+O.width&&J.x+J.width>O.x&&J.y<O.y+O.height&&J.y+J.height>O.y}))return}}const h=()=>new Set(pt(Ge(n)).map(ct)),m=h(),_=g.map(x=>x.width);for(const x of g)mf(i,x,d-x.x,{layout:!1});[...h()].every(x=>m.has(x))||g.forEach((x,y)=>mf(i,x,_[y],{layout:!1}))}function MM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>pt(l).filter(u=>!t.has(ct(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const p=n.shapes.filter(w=>w.id!==l.id&&w.type!=="bpmn:Group"&&a(l,w));if(!p.length)continue;const f=p.map(w=>i.get(w.id)).filter(w=>!!w&&typeof w.x=="number");if(f.length!==p.length)continue;const d=s(p),g=s(f),h=g.l+(l.x-d.l),m=g.t+(l.y-d.t),_=g.r+(l.x+l.width-d.r),x=g.b+(l.y+l.height-d.b),y={x:h,y:m,width:_-h,height:x-m};if(y.width<=0||y.height<=0||Math.abs(y.x-u.x)<1&&Math.abs(y.y-u.y)<1&&Math.abs(y.width-u.width)<1&&Math.abs(y.height-u.height)<1)continue;const v=r(Ge(i)).length,E={x:u.x,y:u.y,width:u.width,height:u.height};o.resizeShape(u,y),r(Ge(i)).length>v&&o.resizeShape(u,E)}}const Jc=20,el=10;function AM(e,t,n,i){var p,f;const{elementRegistry:o}=e,r=e.modeling,a=d=>new Set(pt(d,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(ct)),s=Ge(o),c=pt(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(ct(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,g]of u){const h=s.shapes.find(Le=>Le.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 x=h.members.map(Le=>o.get(Le)).filter(Le=>!!Le&&typeof Le.x=="number");if(!x.length)continue;const y=Math.min(...x.map(Le=>Le.x)),v=Math.min(...x.map(Le=>Le.y)),E=Math.max(...x.map(Le=>Le.x+Le.width)),w=Math.max(...x.map(Le=>Le.y+Le.height)),T=h.x,P=h.y,O=h.x+h.width,B=h.y+h.height;let $=T,H=P,Q=O,J=B;for(const Le of g){const N=s.edges.find(R=>R.id===Le.edge);if(!N)continue;const C=N.endpoints.some(R=>{const G=s.shapes.find(Pe=>Pe.id===R);if(!G||G.container)return!1;const K=G.x+G.width/2,ie=G.y+G.height/2;return T<K&&K<O&&P<ie&&ie<B});for(const R of on(N)){const G=R.axis==="v"?[P,B]:[T,O];Math.min(R.hi,G[1])-Math.max(R.lo,G[0])<Up||(R.axis==="v"?T<R.at&&R.at<O:P<R.at&&R.at<B)&&C||(R.axis==="v"?(Math.abs(R.at-T)<=la&&($=Math.max($,R.at+Jc)),Math.abs(R.at-O)<=la&&(Q=Math.min(Q,R.at-Jc))):(Math.abs(R.at-P)<=la&&(H=Math.max(H,R.at+Jc)),Math.abs(R.at-B)<=la&&(J=Math.min(J,R.at-Jc))))}}if($>y-el&&($=T),H>v-el&&(H=P),Q<E+el&&(Q=O),J<w+el&&(J=B),$===T&&H===P&&Q===O&&J===B)continue;const X=o.get(d),me={x:X.x,y:X.y,width:X.width,height:X.height},Ae=Ge(o),Oe=new Set(pt(Ae).map(ct)),Ee=a(Ae);r.resizeShape(X,{x:$,y:H,width:Q-$,height:J-H});let W=Ge(o),ne=pt(W).filter(Le=>!Oe.has(ct(Le)));const U=[];if(ne.length>0&&ne.every(Le=>Le.kind==="label-over-line"&&!i.has(Le.edge)&&W.edges.some(N=>N.id===Le.edge))){for(const Le of ne){if(Le.kind!=="label-over-line")continue;const N=W.edges.find(ie=>ie.id===Le.edge),C=N&&ff(N,W),R=(f=o.get(Le.edge))==null?void 0:f.label;if(!C||!R)continue;const G=C.x-R.x,K=C.y-R.y;r.moveElements([R],{x:G,y:K}),U.push({label:R,dx:G,dy:K})}W=Ge(o),ne=pt(W).filter(Le=>!Oe.has(ct(Le)))}const re=a(W),he=[...re].some(Le=>!Ee.has(Le));if(ne.length||he||re.size>=Ee.size){for(const Le of U.reverse())r.moveElements([Le.label],{x:-Le.dx,y:-Le.dy});r.resizeShape(X,me)}}}function PM(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=Rp((o==null?void 0:o.$parent)??o),a=is(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:Cp(u,i,r),requests:Tp(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 vy(e,t,n={}){var H,Q;const{i18n:i,lower:o=my}=n,r=py(e),a=Pm(r.elementRegistry),s=uy(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?PM(l.writes,r.elementRegistry,r.canvas,i):void 0,p=Ge(r.elementRegistry),f=new Set(pt(p).map(ct)),d=new Set(pt(p,{includeObservationOnly:!0}).map(ct)),g=new Set(p.edges.map(J=>J.id)),h=new Set(t.flatMap(J=>J.kind==="sequenceFlow.update"&&(J.source!==void 0||J.target!==void 0)?[J.id]:[])),m=new Set(p.shapes.map(J=>J.id)),_=ho(p),x=_.length,y=new Set(_.map(([J,X])=>`${J}|${X}`)),v=Ni(p),E=new Set(v.map(([J,X])=>`${J}|${X}`)),w=new Map;for(const J of r.elementRegistry.filter(X=>"waypoints"in X&&!!X.waypoints))J.label&&w.set(J.id,{wps:J.waypoints.map(X=>({x:X.x,y:X.y})),label:{x:J.label.x,y:J.label.y},source:(H=J.source)==null?void 0:H.id,target:(Q=J.target)==null?void 0:Q.id});const T=e.get("commandStack");try{Lg(T,()=>{o(l.ops,r);for(const X of(u==null?void 0:u.contexts())??[])T.execute(Ap,X);wM(r,f,p),EM(r,p),MM(r,f,p),zC(r,p,h),FC(r,g,m),$m(r,g);const J=tf(r,f);Om(r,y,g),Zm(r,f,g),Gm(r,g),eM(r,g,h),qm(r,f,g),rM(r,f,g),BC(r,E,g),YC(r,g,p),iy(r,f,g),ny(r,g,h),ry(r,m),xM(r,f,m),tf(r,f,J),AM(r,d,p,g),ay(r,f),ty(r,w)})}catch(J){return{ok:!1,issues:[J instanceof gy?J.issue:{kind:"lower-failed",message:J instanceof Error?J.message:String(J)}],findings:[],stats:c}}const P=Ge(r.elementRegistry),O=pt(P,{includeObservationOnly:!0}).filter(J=>!d.has(ct(J))),B=bm(P),$=Ni(P);return{ok:!0,issues:[],findings:O,stats:{edgeCrossings:{before:x,after:B.pairs.length,pairs:B.pairs,solidPairs:B.solidPairs,dashedPairs:B.dashedPairs,mixedPairs:B.mixedPairs,crossPoolMessages:B.crossPoolMessages},sharedEndpointCrossings:{before:v.length,after:$.length,pairs:$}}}}function TM(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 xy(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 kM(e){return typeof e=="string"&&xp.includes(e)}function ji(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function wy(e,t={}){const n=e.rootElements??[],i=n.find(W=>W.$type==="bpmn:Collaboration"),o=new Map(n.filter(W=>W.$type==="bpmn:Process").map(W=>[W.id,W])),r=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],d=[],g=[],h=[],m=[],_=[],x=[],y=new Map,v=new Set,E=new Set,w=W=>{W&&v.add(W)},T=W=>{v.add(W),E.add(W)},P=W=>{const ne=_y(W,"bwl:Placement");if(!ne)return;const U=typeof ne.anchor=="string"?ne.anchor:void 0;if(!U||!kM(ne.side))return;const Y=typeof ne.offset=="number"?ne.offset:void 0;m.push({owner:W.id,anchor:U,side:ne.side,...Y!==void 0?{offset:Y}:{}})},O=W=>{const ne=_y(W,"bwl:Members"),U=typeof(ne==null?void 0:ne.refs)=="string"?ne.refs.split(/\s+/).filter(Boolean):[];U.length&&x.push({owner:W.id,refs:U})},B=W=>{var ne;for(const U of W)switch(w(U.id),U.$type){case"bpmn:TextAnnotation":T(U.id),y.set(U.id,U),c.push({id:U.id,text:typeof U.text=="string"?U.text:""}),P(U);break;case"bpmn:Association":g.push({id:U.id,type:U.$type,source:ji(U.sourceRef),target:ji(U.targetRef)});break;case"bpmn:Group":{T(U.id),y.set(U.id,U);const Y=(ne=U.categoryValueRef)==null?void 0:ne.value;l.push({id:U.id,...typeof Y=="string"&&Y?{name:Y}:{}}),O(U);break}default:u.push({id:U.id,type:U.$type,reason:"type-outside-mvp"})}},$=W=>{for(const ne of W.flowElements??[])w(ne.id),u.push({id:ne.id,type:ne.$type,reason:"inside-container"}),(ne.flowElements??[]).length&&$(ne);for(const ne of W.artifacts??[])w(ne.id),u.push({id:ne.id,type:ne.$type,reason:"inside-container"})},H=(W,ne)=>{const U=W.flowElements??[],Y=(W.laneSets??[]).flatMap(he=>he.lanes??[]),re=new Map;for(const he of Y){w(he.id),y.set(he.id,he);for(const Le of he.flowNodeRef??[]){const N=ji(Le);N&&re.set(N,he.id)}}for(const he of U){if(w(he.id),y.set(he.id,he),he.$type==="bpmn:SequenceFlow"){f.push({id:he.id,source:ji(he.sourceRef),target:ji(he.targetRef),...typeof he.name=="string"&&he.name?{name:he.name}:{}});continue}if(he.$type==="bpmn:DataStoreReference"){T(he.id),s.push({id:he.id,...he.name?{name:he.name}:{}});continue}const Le=TM(he.$type),N=Le==="intermediateCatchEvent"?vp((he.eventDefinitions??[]).map(K=>K.$type)):void 0;if(!Ag(Le)||Le==="intermediateCatchEvent"&&!N){u.push({id:he.id,type:he.$type,reason:"type-outside-mvp"});continue}T(he.id);const C=Le==="boundaryEvent"?ji(he.attachedToRef):void 0;a.push({id:he.id,type:Le,...he.name?{name:he.name}:{},...ne?{participant:ne}:{},...re.has(he.id)?{lane:re.get(he.id)}:{},...C?{attachedTo:C}:{},...N?{eventDefinition:N}:{}}),Le==="subProcess"&&$(he);const R=xy(he,"bwl:band");R!==void 0&&(p.bands[he.id]=R);const G=by(he,"bwl:afterColumn");typeof G=="string"&&G!==""&&_.push([he.id,G]);for(const K of he.dataOutputAssociations??[])w(K.id),h.push({id:K.id,type:K.$type,source:he.id,target:ji(K.targetRef)});for(const K of he.dataInputAssociations??[])w(K.id),h.push({id:K.id,type:K.$type,source:ji((K.sourceRef??[])[0]),target:he.id})}B(W.artifacts??[])};if(i){const W=new Set;for(const ne of i.participants??[]){T(ne.id),y.set(ne.id,ne);const U=ji(ne.processRef);U&&W.add(U);const Y=U?o.get(U):void 0,re=((Y==null?void 0:Y.laneSets)??[]).flatMap(C=>C.lanes??[]),he=re.map(C=>({id:C.id,...C.name?{name:C.name}:{}}));for(const C of he)T(C.id);const Le=!Y||(Y.flowElements??[]).length===0&&re.length===0&&(Y.artifacts??[]).length===0;r.push({id:ne.id,...ne.name?{name:ne.name}:{},...Le?{blackBox:!0}:{},...he.length?{lanes:he}:{}});const N=xy(ne,"bwl:poolOrder");N!==void 0&&(p.poolOrders[ne.id]=N),Y&&H(Y,ne.id)}for(const ne of i.messageFlows??[])w(ne.id),y.set(ne.id,ne),d.push({id:ne.id,source:ji(ne.sourceRef),target:ji(ne.targetRef),...typeof ne.name=="string"&&ne.name?{name:ne.name}:{}});B(i.artifacts??[]);for(const[ne,U]of o)!W.has(ne)&&(U.flowElements??[]).length>0&&u.push({id:ne,type:U.$type,reason:"unreachable-process"})}else for(const W of o.values())H(W);const Q=[],J=[],X=[],me=[],Ae=(W,ne)=>!!W&&!!ne&&E.has(W)&&E.has(ne);for(const W of f){if(!Ae(W.source,W.target)){u.push({id:W.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}Q.push({id:W.id,source:W.source,target:W.target,...W.name?{name:W.name}:{}}),E.add(W.id)}for(const W of d){if(!Ae(W.source,W.target)){u.push({id:W.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}J.push({id:W.id,source:W.source,target:W.target,...W.name?{name:W.name}:{}}),E.add(W.id)}for(const W of h){if(!Ae(W.source,W.target)){u.push({id:W.id??"",type:W.type,reason:"endpoint-outside-mvp"});continue}me.push({...W.id?{id:W.id}:{},source:W.source,target:W.target}),W.id&&E.add(W.id)}for(const W of g){if(!Ae(W.source,W.target)){u.push({id:W.id??"",type:W.type,reason:"endpoint-outside-mvp"});continue}X.push({...W.id?{id:W.id}:{},source:W.source,target:W.target})}const Oe=new Map(l.map(W=>[W.id,W]));for(const{owner:W,refs:ne}of x){const U=ne.filter(re=>v.has(re)),Y=Oe.get(W);Y&&U.length&&(Y.members=U)}for(const W of m)v.has(W.anchor)&&(p.placements[W.owner]={anchor:W.anchor,side:W.side,...W.offset!==void 0?{offset:W.offset}:{}});for(const[W,ne]of _)v.has(ne)&&(p.afterColumns[W]=ne);const Ee={...r.length?{participants:r}:{},nodes:a,sequenceFlows:Q,...J.length?{messageFlows:J}:{},...s.length?{dataStores:s}:{},...me.length?{dataAssociations:me}:{},...c.length?{annotations:c}:{},...X.length?{associations:X}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:Ee,hints:p,omitted:u,i18n:OM(Ee,y,e,t.i18n)}:{definition:Ee,hints:p,omitted:u}}function OM(e,t,n,i){const o=Rp(n),r=is(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=Cp(u,i,o);Object.keys(p).length&&(c[l]=p);for(const f of Tp(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 DM(e,t={}){const{definitions:n,warnings:i}=await aa(e);return{...wy(n,t),warnings:i}}const LM=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function yf(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function IM(e){return yf(e.processRef)!==void 0}function BM(e){const t=new Set,n=o=>{const r=yf(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 NM(e){const t=[],n=i=>{for(const o of i.flowElements??[])LM.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 $M(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 vf(e){const t=[],n=e.rootElements??[],i=BM(e);for(const r of NM(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??[])IM(s)&&$M(r.get(yf(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 FM(e){const{definitions:t,warnings:n}=await aa(e);return{issues:vf(t),warnings:n}}const jM=.5,HM=8,zM=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),ha=e=>typeof e=="number"?e:Number(e??NaN),tl=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function GM(e){const t=e,n=[],i=typeof t.name=="string"?t.name:typeof t.text=="string"?t.text:"";n.push(`n=${i.replace(/\s+/g," ").trim()}`);for(const r of["sourceRef","targetRef","attachedToRef","processRef","default"])t[r]!==void 0&&n.push(`${r}=${tl(t[r])}`);if(String(e.$type)==="bpmn:Group"){const r=t.categoryValueRef,a=Array.isArray(r)?r:r==null?[]:[r];n.push(`cat=[${a.map(s=>`${tl(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(tl).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function VM(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},o=a=>{const s=a;return s?[ha(s.x),ha(s.y),ha(s.width),ha(s.height)]:[]},r=a=>{if(Array.isArray(a))return a.forEach(r);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=tl(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,o(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(f=>[ha(f.x),ha(f.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,o(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&r(l)};return r(e.diagrams),{body:t,labels:n}}function Ey(e){const t=VM(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:")&&!zM.has(s)&&n.set(c,{type:s,props:GM(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 Sy(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 Ry(e,t,n={}){const i=n.moveTolerance??jM,o=Ey(e),r=Ey(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||Sy(p.geometry,u.geometry,i)||Sy(p.label,u.label,n.labelTolerance??HM))&&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 WM(e,t,n={}){const[i,o]=await Promise.all([aa(e),aa(t)]);return{...Ry(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function UM(e){return new Set([...e.added,...e.modified])}function qM(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Cy(e,t,{currentVersion:n,i18n:i}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const o=vy(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 YM=new Set(["lasso","lasso.selection","hand","hand.move"]),My=1e4,KM="bwl-edit-locked",Ay=new WeakMap;function XM(e){const t=Ay.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",My,()=>{var s;if(o)return YM.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"],My,()=>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(KM,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 Ay.set(e,a),a}const ZM=Symbol("bpmn-editor"),bf={geometry:[],semantic:[]};function QM(){const e=ve.ref(!1),t=ve.ref(!0),n=ve.ref(!1),i=ve.shallowRef(bf),o=ve.shallowRef(void 0),r=ve.shallowRef(void 0);let a,s,c;const l=()=>{if(p(),!c){i.value=bf;return}const _=pt(Ge(c.get("elementRegistry")),{includeObservationOnly:!0}),x=c.getDefinitions();i.value={geometry:_,semantic:x?vf(x):[]}};function u(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function p(){const _=u();if(!_||!a){r.value=void 0;return}const x=_.locales(),y={};for(const v of x)y[v]={untranslated:_.untranslatedCount(v),reviewRequested:_.reviewRequestedCount(v)};r.value={designLocale:a.designLocale,locales:x,displayLocale:_.getDisplayLocale()??a.designLocale,counts:y}}function f(){const _=u();_&&(_.configure(a),a&&s&&(s=_.setDisplayLocale(s)))}const d=()=>{e.value=!0,l()};function g(_,x){XM(_).set(!x)}function h(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function m(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:l,changeScope:o,i18n:r,configureI18n(_){a=_,f(),p()},setDisplayLocale(_){var y;s=_;const x=(y=u())==null?void 0:y.setDisplayLocale(_);x&&(s=x),p()},setChangeScope(_){o.value=_===void 0?void 0:new Set(_)},requestFocus(_){if(!c)return;const x=c.get("elementRegistry").get(_);x&&(c.get("canvas").scrollToElement(x,180),c.get("selection").select(x))},describeElement(_){const x=c==null?void 0:c.get("elementRegistry").get(_),y=x==null?void 0:x.businessObject;if(!y)return;const v=typeof y.name=="string"&&y.name.trim()!==""?y.name:y.text;return{name:typeof v=="string"&&v.trim()!==""?v.trim():void 0,type:typeof y.$type=="string"?y.$type:""}},attach(_){c&&this.detach(),c=_,c.get("eventBus").on("commandStack.changed",d),t.value||g(c,!1),f(),l()},detach(){c==null||c.get("eventBus").off("commandStack.changed",d),c&&!t.value&&g(c,!0),c=void 0,i.value=bf,o.value=void 0,r.value=void 0},setEditable(_){t.value=_,c&&g(c,_)},async applyAgentBatch(_,x){const y=h();n.value=!0;try{const v=await Cy(y,_,{currentVersion:x,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return v.status==="applied"&&(e.value=!1),v}finally{n.value=!1}},async importXml(_){const{warnings:x}=await h().importXML(_);return e.value=!1,o.value=void 0,l(),{warnings:Wp(x)}},async saveXml(){const{xml:_}=await h().saveXML({format:!0});return e.value=!1,_??""},undo:()=>{var _;return(_=m())==null?void 0:_.undo()},redo:()=>{var _;return(_=m())==null?void 0:_.redo()},canUndo:()=>{var _;return((_=m())==null?void 0:_.canUndo())??!1},canRedo:()=>{var _;return((_=m())==null?void 0:_.canRedo())??!1}}}const JM=new RegExp("\\p{Script=Hangul}","u"),eA=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,tA=new RegExp("\\p{Script=Han}","u");function nl(e){const t=JM.test(e),n=eA.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:tA.test(e)?"han":"other"}}function Py(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 Ty(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=wr(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:Bo(a).filter(l=>En(l))})}return n}const hs=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function nA(e){const t=Py(e),n=Ty(e);let i;const o={},r=[],a=[],s=[];for(const g of n){const h=g.trs.filter(m=>(m.body??"")===g.name).map(En);if(h.length){const m=[...h].sort().join("+");o[m]=(o[m]??0)+1,i=i?new Set([...i].filter(_=>h.includes(_))):new Set(h)}else g.trs.some(m=>m.body)?r.push(hs(g)):s.push({e:g,inference:nl(g.name)});for(const m of g.trs){const _=En(m),x=m.body??"",y=nl(x);y.locale&&y.locale!==_?a.push({...hs(g),locale:_,script:y.script}):_==="ko"&&y.script==="han"&&g.trs.some(v=>v!==m&&v.body===x)&&a.push({...hs(g),locale:_,script:"han"})}}const c=new Set(s.map(g=>g.inference.locale).filter(Boolean));let l,u;if(t)u="kept";else if(i&&i.size===1)[l,u]=[[...i][0],"matched"];else if(i&&i.size>1){const g=c.size===1?[...c][0]:void 0;g&&i.has(g)?[l,u]=[g,"matched"]:u="ambiguous"}else i?u="mixed":c.size===1?[l,u]=[[...c][0],"script"]:u=c.size>1?"mixed":"no-evidence";const p=t??l,f=[],d=[];for(const{e:g,inference:h}of s)h.locale?h.locale!==p&&f.push({...hs(g),locale:h.locale}):d.push({...hs(g),script:h.script});return{root:{current:t,proposed:l,reason:u},additions:f,undecided:d,drift:r,matchedBy:o,scriptMismatch:a}}function iA(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!Py(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(Ty(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=>En(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(_r,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}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;!(a!=null&&a.id)||t.has(a)||(t.add(a),n.push(a))}return n}const xf=e=>En(e)||void 0,Oy=e=>e.body??"";function Dy(e){const t=new Map;for(const n of ky(e)){const i=Bo(n);i.length&&t.set(n.id,{type:n.$type,cells:i.map(o=>({locale:xf(o),body:Oy(o)}))})}return t}const Ly=e=>JSON.stringify(e.map(t=>t.body).sort());class oA{constructor(){zn(this,"byId",new Map);zn(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};Iy(this.byId,o,a),Iy(this.byBodies,Ly(r.cells),a)}}sameId(t){return this.byId.get(t)??[]}sameBodies(t){return this.byBodies.get(Ly(t))??[]}}function Iy(e,t,n){const i=e.get(t);i?i.push(n):e.set(t,[n])}function rA(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 _f(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 aA(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 sA=e=>JSON.stringify([...e.cells].sort((t,n)=>(t.body+t.locale).localeCompare(n.body+n.locale)));function cA(e,t){const n={restores:[],ambiguous:[],stale:[],unresolved:[]},i=Dy(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=rA(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&&_f(m.state,c)).sort((m,_)=>_.version-m.version).slice(0,1).map(m=>m.state)],["lineage",t.index.sameId(a).filter(m=>m.doc!==t.doc&&_f(m.state,c)).map(m=>m.state)],["bodies",t.index.sameBodies(s.cells).filter(m=>!(m.doc===t.doc&&m.id===a)&&_f(m.state,c)).map(m=>m.state)]].find(([,m])=>m.length);if(!p){if(!r(s))continue;for(const[m,_]of c)for(let x=0;x<_;x++)n.unresolved.push({...l,body:m,script:nl(m).script});continue}const[f,d]=p,g=d.map(m=>aA(s,m,c));if(g.some(m=>m.overflow)||new Set(g.map(sA)).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 lA(e,t){if(!t.restores.length)return 0;const n=new Map(ky(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=Bo(r),s=new Set(a.map(xf).filter(Boolean));for(const{body:c,locale:l}of o.cells){if(s.has(l))continue;const u=a.find(p=>!xf(p)&&Oy(p)===c);u&&(u.set("xml:lang",l),s.add(l),i++)}}return i}function Me(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function uA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wf={exports:{}},By;function pA(){if(By)return wf.exports;By=1;var e=wf.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},wf.exports}var fA=pA(),dA=uA(fA);function Ki(e){if(!(this instanceof Ki))return new Ki(e);e=e||[128,36,1],this._seed=e.length?dA.rack(e[0],e[1],e[2]):e}Ki.prototype.next=function(e){return this._seed(e||!0)},Ki.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Ki.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Ki.prototype.assigned=function(e){return this._seed.get(e)||!1},Ki.prototype.unclaim=function(e){delete this._seed.hats[e]},Ki.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const gn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};gn.td=gn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],gn.option=gn.optgroup=[1,'<select multiple="multiple">',"</select>"],gn.thead=gn.tbody=gn.colgroup=gn.caption=gn.tfoot=[1,"<table>","</table>"],gn.polyline=gn.ellipse=gn.polygon=gn.circle=gn.text=gn.line=gn.path=gn.rect=gn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function $t(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:p}=u;return p.remove(),p}let[o,r,a]=Object.hasOwn(gn,i)?gn[i]:gn._default,s=t.createElement("div");for(s.innerHTML=r+e+a;o--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function 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 Wn(e,...t){const n=e.style;return z(t,function(i){i&&z(i,function(o,r){n[r]=o})}),e}function Sn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const gA=Object.prototype.toString;function Rt(e){return new zo(e)}function zo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}zo.prototype.add=function(e){return this.list.add(e),this},zo.prototype.remove=function(e){return gA.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},zo.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},zo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},zo.prototype.array=function(){return Array.from(this.list)},zo.prototype.has=zo.prototype.contains=function(e){return this.list.contains(e)};function il(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Mr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function mA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ol={},Ny;function yA(){if(Ny)return ol;Ny=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return ol.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},ol.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},ol}var $y=yA(),vA=mA($y),Fe=hA({__proto__:null,default:vA},[$y]),Fy=["focus","blur"];function bA(e,t,n,i,o){return Fy.indexOf(n)!==-1&&(o=!0),Fe.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=Mr(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function xA(e,t,n,i){return Fy.indexOf(t)!==-1&&(i=!0),Fe.unbind(e,t,n,i)}var ni={bind:bA,unbind:xA};function Ef(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Et(e,t){return t=t||document,t.querySelector(e)}function gs(e,t){return t=t||document,t.querySelectorAll(e)}function Xi(e){e.parentNode&&e.parentNode.removeChild(e)}function _A(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function wA(e,t){return t.appendChild(_A(e,t))}function Ke(e,t){return wA(t,e),e}var Sf=2,jy={"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":Sf,"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":Sf,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function EA(e,t){return jy[t]?e.style[t]:e.getAttributeNS(null,t)}function Hy(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=jy[i];o?(o===Sf&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function SA(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)Hy(e,o,t[o])}function Se(e,t,n){if(typeof t=="string")if(n!==void 0)Hy(e,t,n);else return EA(e,t);else SA(e,t);return e}const RA=Object.prototype.toString;function lt(e){return new Go(e)}function Go(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Go.prototype.add=function(e){return this.list.add(e),this},Go.prototype.remove=function(e){return RA.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Go.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},Go.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Go.prototype.array=function(){return Array.from(this.list)},Go.prototype.has=Go.prototype.contains=function(e){return this.list.contains(e)};function ms(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Rf(e){return e.cloneNode(!0)}var Cf={svg:"http://www.w3.org/2000/svg"},zy='<svg xmlns="'+Cf.svg+'"';function CA(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Cf.svg)===-1&&(e=zy+e.substring(4)):(e=zy+">"+e+"</svg>",t=!0);var n=MA(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function MA(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Be(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=CA(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Cf.svg,e),t&&Se(n,t),n}var Mf=null;function Gy(){return Mf===null&&(Mf=Be("svg")),Mf}function Vy(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function AA(e,t,n,i,o,r){var a=Gy().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Vy(a,e);case 6:return Vy(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function ys(e){return Gy().createSVGTransform()}var Wy=/([&<>]{1})/g,PA=/([&<>\n\r"]{1})/g,TA={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Af(e,t){function n(i,o){return TA[o]||o}return e.replace(t,n)}function Uy(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(Af(e.textContent,Wy));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,'="',Af(r.value,PA),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Uy(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Af(e.nodeValue,Wy),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function kA(e){for(var t=e.firstChild,n=[];t;)Uy(t,n),t=t.nextSibling;return n.join("")}function qy(e,t){return kA(e)}function rn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function OA(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function DA(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(OA(e,i))}function vs(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),DA(n,t)),n.consolidate()}const LA=/^class[ {]/;function IA(e){return LA.test(e.toString())}function Pf(e){return Array.isArray(e)}function Tf(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function rl(...e){e.length===1&&Pf(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const BA=/constructor\s*[^(]*\(\s*([^)]*)\)/m,NA=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,$A=/\/\*([^*]*)\*\//m;function FA(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(IA(e)?BA:NA);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match($A);return(o&&o[1]||i).trim()})||[]}function Yy(e,t){const n=t||{get:function(y,v){if(i.push(y),v===!1)return null;throw s(`No provider for "${y}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),a=r.injector=this,s=function(y){const v=i.join(" -> ");return i.length=0,new Error(v?`${y} (Resolving: ${v})`:y)};function c(y,v){if(!o[y]&&y.includes(".")){const E=y.split(".");let w=c(E.shift());for(;E.length;)w=w[E.shift()];return w}if(Tf(r,y))return r[y];if(Tf(o,y)){if(i.indexOf(y)!==-1)throw i.push(y),s("Cannot resolve circular dependency!");return i.push(y),r[y]=o[y][0](o[y][1]),i.pop(),r[y]}return n.get(y,v)}function l(y,v){if(typeof v>"u"&&(v={}),typeof y!="function")if(Pf(y))y=rl(y.slice());else throw s(`Cannot invoke "${y}". Expected a function!`);const w=(y.$inject||FA(y)).map(T=>Tf(v,T)?v[T]:c(T));return{fn:y,dependencies:w}}function u(y){const{fn:v,dependencies:E}=l(y),w=Function.prototype.bind.call(v,null,...E);return new w}function p(y,v,E){const{fn:w,dependencies:T}=l(y,E);return w.apply(v,T)}function f(y){return rl(v=>y.get(v))}function d(y,v){if(v&&v.length){const E=Object.create(null),w=Object.create(null),T=[],P=[],O=[];let B,$,H,Q;for(let J in o)B=o[J],v.indexOf(J)!==-1&&(B[2]==="private"?($=T.indexOf(B[3]),$===-1?(H=B[3].createChild([],v),Q=f(H),T.push(B[3]),P.push(H),O.push(Q),E[J]=[Q,J,"private",H]):E[J]=[O[$],J,"private",P[$]]):E[J]=[B[2],B[1]],w[J]=!0),(B[2]==="factory"||B[2]==="type")&&B[1].$scope&&v.forEach(X=>{B[1].$scope.indexOf(X)!==-1&&(E[J]=[B[2],B[1]],w[X]=!0)});v.forEach(J=>{if(!w[J])throw new Error('No provider for "'+J+'". Cannot use provider from the parent!')}),y.unshift(E)}return new Yy(y,a)}const g={factory:p,type:u,value:function(y){return y}};function h(y,v){const E=y.__init__||[];return function(){E.forEach(w=>{typeof w=="string"?v.get(w):v.invoke(w)})}}function m(y){const v=y.__exports__;if(v){const E=y.__modules__,w=Object.keys(y).reduce(($,H)=>(H!=="__exports__"&&H!=="__modules__"&&H!=="__init__"&&H!=="__depends__"&&($[H]=y[H]),$),Object.create(null)),T=(E||[]).concat(w),P=d(T),O=rl(function($){return P.get($)});v.forEach(function($){o[$]=[O,$,"private",P]});const B=(y.__init__||[]).slice();return B.unshift(function(){P.init()}),y=Object.assign({},y,{__init__:B}),h(y,P)}return Object.keys(y).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const w=y[E];if(w[2]==="private"){o[E]=w;return}const T=w[0],P=w[1];o[E]=[g[T],jA(T,P),T]}),h(y,a)}function _(y,v){return y.indexOf(v)!==-1||(y=(v.__depends__||[]).reduce(_,y),y.indexOf(v)!==-1)?y:y.concat(v)}function x(y){const v=y.reduce(_,[]).map(m);let E=!1;return function(){E||(E=!0,v.forEach(w=>w()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=x(e)}function jA(e,t){return e!=="value"&&Pf(t)&&(t=rl(t.slice())),t}var HA=1e3;function mo(e,t){var n=this;t=t||HA,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)})}mo.prototype.canRender=function(e){},mo.prototype.drawShape=function(e,t){},mo.prototype.drawConnection=function(e,t){},mo.prototype.getShapePath=function(e){},mo.prototype.getConnectionPath=function(e){};function Ar(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function zA(e){return["M",e.x,e.y]}function kf(e){return["L",e.x,e.y]}function GA(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function VA(e,t){const n=e.length,i=[zA(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(kf(a));continue}const c=Math.min(t,Of(a.x-r.x,a.y-r.y),Of(s.x-a.x,s.y-a.y));if(!c){i.push(kf(a));continue}const l=al(a,r,c),u=al(a,r,c*.5),p=al(a,s,c),f=al(a,s,c*.5);i.push(kf(l)),i.push(GA(u,f,p))}return i}function al(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=Of(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function Of(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function bs(e,t,n){Ue(t)&&(n=t,t=null),t||(t={});const i=Be("path",t);return Ue(n)&&(i.dataset.cornerRadius=String(n)),Df(i,e)}function Df(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Se(e,{d:Ar(VA(t,n))}),e}function sl(e){var t=new Set(e);return rt(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Pr(e,t,n){n=n||0,We(e)||(e=[e]),z(e,function(i,o){var r=t(i,o,n);We(r)&&r.length&&Pr(r,t,n+1)})}function Lf(e,t,n){var i=new Set,o=new Set;return Pr(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 xs(e,t){return Lf(e)}function WA(e,t,n){xr(t)&&(t=!0),hn(t)&&(n=t,t=!0),n=n||{};var i=_s(n.allShapes),o=_s(n.allConnections),r=_s(n.enclosedElements),a=_s(n.enclosedConnections),s=_s(n.topLevel,t&&na(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=r[u.id]=u),o[u.id]=u}function l(u){if(r[u.id]=u,u.waypoints)a[u.id]=o[u.id]=u;else return i[u.id]=u,z(u.incoming,c),z(u.outgoing,c),u.children}return Pr(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function an(e,t){t=!!t,We(e)||(e=[e]);var n,i,o,r;return z(e,function(a){var s=a;a.waypoints&&!t&&(s=an(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+p>o||o===void 0)&&(o=c+p),(l+u>r||r===void 0)&&(r=l+u)}),{x:n,y:i,height:r-i,width:o-n}}function ga(e,t){var n={};return z(e,function(i){var o=i;o.waypoints&&(o=an(o)),!Ue(t.y)&&o.x>t.x&&(n[i.id]=i),!Ue(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(Ue(t.width)&&Ue(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!Ue(t.width)||!Ue(t.height))&&(n[i.id]=i)}),n}function Ky(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Xy(e){return!!(e&&e.isFrame)}function _s(e,t){return V({},e||{},t||{})}var UA=1;function Vo(e,t){mo.call(this,e,UA),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})}Me(Vo,mo),Vo.prototype.canRender=function(){return!0},Vo.prototype.drawShape=function(t,n,i){var o=Be("rect");return Se(o,{x:0,y:0,width:n.width||0,height:n.height||0}),Xy(n)?Se(o,V({},this.FRAME_STYLE,i||{})):Se(o,V({},this.SHAPE_STYLE,i||{})),Ke(t,o),o},Vo.prototype.drawConnection=function(t,n,i){var o=bs(n.waypoints,V({},this.CONNECTION_STYLE,i||{}));return Ke(t,o),o},Vo.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 Ar(a)},Vo.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 Ar(r)},Vo.$inject=["eventBus","styles"];function qA(){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 V(r,{class:n})},this.style=function(n,i){!We(n)&&!i&&(i=n,n=[]);var o=ti(n,function(r,a){return V(r,e[a]||{})},{});return i?V(o,i):o},this.computeStyle=function(n,i,o){return We(i)||(o=i,i=[]),t.style(i||[],V({},o,n||{}))}}const YA={__init__:["defaultRenderer"],defaultRenderer:["type",Vo],styles:["type",qA]};function Zt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function tn(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var i=e.indexOf(t);if(i!==-1){if(i===n)return;if(n!==-1)e.splice(i,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function If(e,t){return!e||!t?-1:e.indexOf(t)}function ws(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Bf(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=ws(e,t);return Math.abs(o/r)<=i}var KA=2;function yo(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(XA(o,n))return r;return!1}function XA(e,t){const n=t[0];return Lo(t,function(i){return Math.abs(n[e]-i[e])<=KA})}function Zy(e,t,n){return n=n||0,e.x>t.x-n&&e.y>t.y-n&&e.x<t.x+t.width+n&&e.y<t.y+t.height+n}function Nf(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var ZA=/,?([a-z]),?/gi,Qy=parseFloat,sn=Math,Wo=sn.PI,Zi=sn.min,Qi=sn.max,Jy=sn.pow,Uo=sn.abs,QA=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,JA=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,ev=Array.isArray||function(e){return e instanceof Array};function eP(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function tP(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 nP(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 eP(o,i)?(tP(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function iP(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(QA,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(JA,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=Ff,n}function oP(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 rP(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 $f(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 Ff(){return this.join(",").replace(ZA,"$1")}function aP(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=Ff,t}function tv(e,t,n,i,o,r,a,s,c){var l=1-c,u=Jy(l,3),p=Jy(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:cl(g),y:cl(h)}}function nv(e){var t=fP(...e);return $f(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function qo(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function sP(e,t){return e=$f(e),t=$f(t),qo(t,e.x,e.y)||qo(t,e.x2,e.y)||qo(t,e.x,e.y2)||qo(t,e.x2,e.y2)||qo(e,t.x,t.y)||qo(e,t.x2,t.y)||qo(e,t.x,t.y2)||qo(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 iv(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 ov(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=iv(h,e,n,o,a),_=iv(h,t,i,r,s),x=m*m+_*_;d+=f[g]*sn.sqrt(x)}return l*d}function cP(e,t,n,i,o,r,a,s){if(!(Qi(e,n)<Zi(o,a)||Zi(e,n)>Qi(o,a)||Qi(t,i)<Zi(r,s)||Zi(t,i)>Qi(r,s))){var c=(e*i-t*n)*(o-a)-(e-n)*(o*s-r*a),l=(e*i-t*n)*(r-s)-(t-i)*(o*s-r*a),u=(e-n)*(r-s)-(t-i)*(o-a);if(u){var p=cl(c/u),f=cl(l/u),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+Zi(e,n).toFixed(2)||d>+Qi(e,n).toFixed(2)||d<+Zi(o,a).toFixed(2)||d>+Qi(o,a).toFixed(2)||g<+Zi(t,i).toFixed(2)||g>+Qi(t,i).toFixed(2)||g<+Zi(r,s).toFixed(2)||g>+Qi(r,s).toFixed(2)))return{x:p,y:f}}}}function cl(e){return Math.round(e*1e11)/1e11}function lP(e,t,n){var i=nv(e),o=nv(t);if(!sP(i,o))return[];var r=ov(...e),a=ov(...t),s=av(e)?1:~~(r/5)||1,c=av(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=tv(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=tv(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var m=l[d],_=l[d+1],x=u[g],y=u[g+1],v=Uo(_.x-m.x)<.01?"y":"x",E=Uo(y.x-x.x)<.01?"y":"x",w=cP(m.x,m.y,_.x,_.y,x.x,x.y,y.x,y.y),T;if(w){if(T=w.x.toFixed(9)+"#"+w.y.toFixed(9),p[T])continue;p[T]=!0;var P=m.t+Uo((w[v]-m[v])/(_[v]-m[v]))*(_.t-m.t),O=x.t+Uo((w[E]-x[E])/(y[E]-x[E]))*(y.t-x.t);P>=0&&P<=1&&O>=0&&O<=1&&f.push({x:w.x,y:w.y,t1:P,t2:O})}}return f}function rv(e,t,n){e=lv(e),t=lv(t);for(var i,o,r,a,s,c,l,u,p,f,d=n?0:[],g=0,h=e.length;g<h;g++){var m=e[g];if(m[0]=="M")i=s=m[1],o=c=m[2];else{m[0]=="C"?(p=[i,o,...m.slice(1)],i=p[6],o=p[7]):(p=[i,o,i,o,s,c,s,c],i=s,o=c);for(var _=0,x=t.length;_<x;_++){var y=t[_];if(y[0]=="M")r=l=y[1],a=u=y[2];else{y[0]=="C"?(f=[r,a,...y.slice(1)],r=f[6],a=f[7]):(f=[r,a,r,a,l,u,l,u],r=l,a=u);var v=lP(p,f);{for(var E=0,w=v.length;E<w;E++)v[E].segment1=g,v[E].segment2=_,v[E].bez1=p,v[E].bez2=f;d=d.concat(v)}}}}}return d}function uP(e){return ev(e)&&ev(e[0])}function pP(e){if(oP(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=Ff,t}function av(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function ll(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 cv(e,t,n,i,o,r,a,s,c,l){var u=Wo*120/180,p=Wo/180*(+o||0),f=[],d,g=nP(function(N,C,R){var G=N*sn.cos(R)-C*sn.sin(R),K=N*sn.sin(R)+C*sn.cos(R);return{x:G,y:K}});if(l)T=l[0],P=l[1],E=l[2],w=l[3];else{d=g(e,t,-p),e=d.x,t=d.y,d=g(s,c,-p),s=d.x,c=d.y;var h=(e-s)/2,m=(t-c)/2,_=h*h/(n*n)+m*m/(i*i);_>1&&(_=sn.sqrt(_),n=_*n,i=_*i);var x=n*n,y=i*i,v=(r==a?-1:1)*sn.sqrt(Uo((x*y-x*m*m-y*h*h)/(x*m*m+y*h*h))),E=v*n*m/i+(e+s)/2,w=v*-i*h/n+(t+c)/2,T=sn.asin(((t-w)/i).toFixed(9)),P=sn.asin(((c-w)/i).toFixed(9));T=e<E?Wo-T:T,P=s<E?Wo-P:P,T<0&&(T=Wo*2+T),P<0&&(P=Wo*2+P),a&&T>P&&(T=T-Wo*2),!a&&P>T&&(P=P-Wo*2)}var O=P-T;if(Uo(O)>u){var B=P,$=s,H=c;P=T+u*(a&&P>T?1:-1),s=E+n*sn.cos(P),c=w+i*sn.sin(P),f=cv(s,c,n,i,o,0,a,$,H,[P,B,E,w])}O=P-T;var Q=sn.cos(T),J=sn.sin(T),X=sn.cos(P),me=sn.sin(P),Ae=sn.tan(O/4),Oe=4/3*n*Ae,Ee=4/3*i*Ae,W=[e,t],ne=[e+Oe*J,t-Ee*Q],U=[s+Oe*me,c-Ee*X],Y=[s,c];if(ne[0]=2*W[0]-ne[0],ne[1]=2*W[1]-ne[1],l)return[ne,U,Y].concat(f);f=[ne,U,Y].concat(f).join().split(",");for(var re=[],he=0,Le=f.length;he<Le;he++)re[he]=he%2?g(f[he-1],f[he],p).y:g(f[he],f[he+1],p).x;return re}function fP(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,f,d,g,h,m,_,x=0;x<2;++x){if(x==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),Uo(u)<1e-12){if(Uo(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}m=p*p-4*f*u,_=sn.sqrt(m),!(m<0)&&(g=(-p+_)/(2*u),0<g&&g<1&&c.push(g),h=(-p-_)/(2*u),0<h&&h<1&&c.push(h))}for(var y=c.length,v=y,E;y--;)d=c[y],E=1-d,l[0][y]=E*E*E*e+3*E*E*d*n+3*E*d*d*o+d*d*d*a,l[1][y]=E*E*E*t+3*E*E*d*i+3*E*d*d*r+d*d*d*s;return l[0][v]=e,l[1][v]=t,l[0][v+1]=a,l[1][v+1]=s,l[0].length=l[1].length=v+2,{x0:Zi(...l[0]),y0:Zi(...l[1]),x1:Qi(...l[0]),y1:Qi(...l[1])}}function lv(e){if(uP(e)||(e=iP(e)),rP(e))return e;for(var t=aP(pP(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",...cv(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",...ll(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...ll(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...ll(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...ll(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=Qy(u[p-4])||n.x,n.by=Qy(u[p-3])||n.y}return t}function kt(e){return hn(e)&&ei(e,"waypoints")}function it(e){return hn(e)&&ei(e,"labelTarget")}function dP(e){return hn(e)&&ea(e.parent)}function uv(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function vo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function He(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function ul(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function hP(e){return vo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function gP(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=vP(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 qe(e){return kt(e)?gP(e):hP(e)}function On(e,t,n){n=n||0,hn(n)||(n={x:n,y:n});var i=He(e),o=He(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 Es(e,t,n){var i=mP(e,t);return i.length===1||i.length===2&&ws(i[0],i[1])<1?vo(i[0]):i.length>1?(i=Ui(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),vo(i[n?0:i.length-1])):null}function mP(e,t){return rv(e,t)}function yP(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],ws(n,o)===0||Bf(i,o,n)?e.splice(t,1):t++;return e}function vP(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function pl(e,t){return Math.round(e*t)/t}function pv(e){return Ue(e)?e+"px":e}function bP(e){for(;e.parent;)e=e.parent;return e}function xP(e){e=V({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Wn(n,{position:"relative",overflow:"hidden",width:pv(e.width),height:pv(e.height)}),t.appendChild(n),n}function fv(e,t,n){const i=Be("g");lt(i).add(t);const o=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const _P="base",dv=0,wP=1,EP={shape:["x","y","width","height"],connection:["waypoints"]};function Ye(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||{})}Ye.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Ye.prototype._init=function(e){const t=this._eventBus,n=this._container=xP(e),i=this._svg=Be("svg");Se(i,{width:"100%",height:"100%"}),Sn(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")}),Ke(n,i);const o=this._viewport=fv(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Sp(this._viewboxChanged,300)),this._restoreFocus=Sp(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)},Ye.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},Ye.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Ye.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Ky(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Ye.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Ye.prototype.restoreFocus=function(){this._restoreFocus()},Ye.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Ye.prototype.isFocused=function(){return this._focused},Ye.prototype.getDefaultLayer=function(){return this.getLayer(_P,dv)},Ye.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},Ye.prototype._getChildIndex=function(e){return ti(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Ye.prototype._createLayer=function(e,t){typeof t>"u"&&(t=wP);const n=this._getChildIndex(t);return{group:fv(this._viewport,"layer-"+e,n),index:t,visible:!0}},Ye.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},Ye.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(rn(n),t.visible=!1),n},Ye.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],rn(t.group))},Ye.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Ye.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const o=this._findPlaneForRoot(bP(i));if(!o||n&&o.rootElement!==n)return;n=o.rootElement}return n},Ye.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Ye.prototype._findPlaneForRoot=function(e){return Lt(this._planes,function(t){return t.rootElement===e})},Ye.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Ye.prototype._resolveElements=function(e){return We(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Ye.prototype.getContainer=function(){return this._container},Ye.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(z([i.gfx,i.secondaryGfx],function(o){o&&(n?(e.markers.add(t),lt(o).add(t)):(e.markers.delete(t),lt(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Ye.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Ye.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Ye.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Ye.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Ye.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Ye.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,dv);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Ye.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},Ye.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},Ye.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)},Ye.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})},Ye.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})},Ye.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=EP[e];if(!Lo(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Ye.prototype._setParent=function(e,t,n){tn(t.children,e,n),e.parent=t},Ye.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},Ye.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Ye.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Ye.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,o=this._eventBus;if(e=n.get(e.id||e),!!e)return o.fire(t+".remove",{element:e}),i.remove(e),Zt(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},Ye.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Ye.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Ye.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Ye.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Ye.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Ye.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);vs(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=vs(t),o=a?a.matrix:AA(),s=pl(o.a,1e3),c=pl(-o.e||0,1e3),l=pl(-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},Ye.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=V({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),hv(t,n)}),{x:n.e,y:n.f}},Ye.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const o=this.findRoot(i);if(!o)return;o!==this.getRootElement()&&this.setRootElement(o);const r=i.filter(g=>g!=o);if(!r.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=an(r),s=He(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=He(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,p=a.y-c.y;else{const g=Math.max(0,s.right-f.right),h=Math.min(0,s.left-f.left),m=Math.max(0,s.bottom-f.bottom),_=Math.min(0,s.top-f.top);u=g||h,p=m||_}this.scroll({dx:-u*l,dy:-p*l})},Ye.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)}),pl(i.a,1e3)};function hv(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Ye.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},Ye.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=V(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),hv(this._viewport,u),u},Ye.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Ye.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}},Ye.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var ma="data-element-id";function gi(e){this._elements={},this._eventBus=e}gi.$inject=["eventBus"],gi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Se(t,ma,i),n&&Se(n,ma,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},gi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Se(i.gfx,ma,""),i.secondaryGfx&&Se(i.secondaryGfx,ma,""),delete t[n])},gi.prototype.updateId=function(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},gi.prototype.updateGraphics=function(e,t,n){var i=e.id||e,o=this._elements[i];return n?o.secondaryGfx=t:o.gfx=t,t&&Se(t,ma,i),t},gi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Se(e,ma);var n=this._elements[t];return n&&n.element},gi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},gi.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var o=n[i],r=t[o],a=r.element,s=r.gfx;if(e(a,s))return a}},gi.prototype.getAll=function(){return this.filter(function(e){return e})},gi.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],o=i.element,r=i.gfx;return e(o,r)})},gi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},gi.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};function SP(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 RP(e){return e.__refs_collection===!0}function CP(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function gv(e,t,n){var i=SP(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 MP(e,t,n){var i=t.inverse,o=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return o},set:function(r){if(r!==o){var a=o;o=null,a&&e.unset(a,i,n),o=r,e.set(o,i,n)}}})}function xi(e,t){if(!(this instanceof xi))return new xi(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}xi.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?gv(this,t,e):MP(this,t,e)},xi.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return RP(n)||gv(this,t,e),n},xi.prototype.ensureBound=function(e,t){CP(e,t)||this.bind(e,t)},xi.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},xi.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var jf=new xi({name:"children",enumerable:!0,collection:!0},{name:"parent"}),mv=new xi({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),yv=new xi({name:"attachers",collection:!0},{name:"host"}),vv=new xi({name:"outgoing",collection:!0},{name:"source"}),bv=new xi({name:"incoming",collection:!0},{name:"target"});function ya(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),jf.bind(this,"parent"),mv.bind(this,"labels"),vv.bind(this,"outgoing"),bv.bind(this,"incoming")}function Ss(){ya.call(this),jf.bind(this,"children"),yv.bind(this,"host"),yv.bind(this,"attachers")}Me(Ss,ya);function xv(){ya.call(this),jf.bind(this,"children")}Me(xv,Ss);function _v(){Ss.call(this),mv.bind(this,"labelTarget")}Me(_v,Ss);function wv(){ya.call(this),vv.bind(this,"source"),bv.bind(this,"target")}Me(wv,ya);var AP={connection:wv,shape:Ss,label:_v,root:xv};function PP(e,t){var n=AP[e];if(!n)throw new Error("unknown type: <"+e+">");return V(new n,t)}function TP(e){return e instanceof ya}function bo(){this._uid=12}bo.prototype.createRoot=function(e){return this.create("root",e)},bo.prototype.createLabel=function(e){return this.create("label",e)},bo.prototype.createShape=function(e){return this.create("shape",e)},bo.prototype.createConnection=function(e){return this.create("connection",e)},bo.prototype.create=function(e,t){return t=V({},t||{}),t.id||(t.id=e+"_"+this._uid++),PP(e,t)};var fl="__fn",Ev=1e3,kP=Array.prototype.slice;function ii(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}ii.prototype.on=function(e,t,n,i){if(e=We(e)?e:[e],bn(t)&&(i=n,n=t,t=Ev),!Ue(t))throw new Error("priority must be a number");var o=n;i&&(o=Xn(n,i),o[fl]=n[fl]||n);var r=this;e.forEach(function(a){r._addListener(a,{priority:t,callback:o,next:null})})},ii.prototype.once=function(e,t,n,i){var o=this;if(bn(t)&&(i=n,n=t,t=Ev),!Ue(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[fl]=n,this.on(e,t,r)},ii.prototype.off=function(e,t){e=We(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},ii.prototype.createEvent=function(e){var t=new Rs;return t.init(e),t},ii.prototype.fire=function(e,t){var n,i,o,r;if(r=kP.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 Rs?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}},ii.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},ii.prototype._destroy=function(){this._listeners={}},ii.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},ii.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=OP(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},ii.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},ii.prototype._getListeners=function(e){return this._listeners[e]},ii.prototype._setListeners=function(e,t){this._listeners[e]=t},ii.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[fl]===t)&&(o?o.next=i:this._setListeners(e,i)),o=n,n=i};function Rs(){}Rs.prototype.stopPropagation=function(){this.cancelBubble=!0},Rs.prototype.preventDefault=function(){this.defaultPrevented=!0},Rs.prototype.init=function(e){V(this,e||{})};function OP(e,t){return e.apply(null,t)}function Yo(e){return e.childNodes[0]}function DP(e){return e.parentNode.childNodes[1]}function dl(e,t,n,i,o){var r=ys();r.setTranslate(t,n);var a=ys();a.setRotate(i||0,0,0);var s=ys();s.setScale(1,1),vs(e,[r,a,s])}function Dn(e,t,n){var i=ys();i.setTranslate(t,n),vs(e,i)}function Sv(e,t){var n=ys();n.setRotate(t,0,0),vs(e,n)}function mi(e,t){this._eventBus=e,this._elementRegistry=t}mi.$inject=["eventBus","elementRegistry"],mi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=DP(t),n||(n=Be("g"),lt(n).add("djs-children"),Ke(t.parentNode,n))):n=t,n},mi.prototype._clear=function(e){var t=Yo(e);return il(t),t},mi.prototype._createContainer=function(e,t,n,i){var o=Be("g");lt(o).add("djs-group"),typeof n<"u"?LP(o,t,t.childNodes[n]):Ke(t,o);var r=Be("g");lt(r).add("djs-element"),lt(r).add("djs-"+e),i&&lt(r).add("djs-frame"),Ke(o,r);var a=Be("g");return lt(a).add("djs-visual"),Ke(r,a),r},mi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Xy(t))},mi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=ti(e,function(o,r){return r.parent&&(o[r.parent.id]=r.parent),o},{}),z(i,function(o){var r=o.children;if(r){var a=t._getChildrenContainer(o),s=a.firstChild;z(r,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},mi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},mi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},mi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},mi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},mi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Dn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Se(n,"display","none"):Se(n,"display","block")}},mi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);rn(t.parentNode)};function LP(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const IP={__depends__:[YA],__init__:["canvas"],canvas:["type",Ye],elementRegistry:["type",gi],elementFactory:["type",bo],eventBus:["type",ii],graphicsFactory:["type",mi]};function BP(e){var t=new Yy(e);return t.init(),t}function NP(e){e=e||{};var t={config:["value",e]},n=[t,IP].concat(e.modules||[]);return BP(n)}function Ko(e,t){this._injector=t||NP(e),this.get("eventBus").fire("diagram.init")}Ko.prototype.get=function(e,t){return this._injector.get(e,t)},Ko.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Ko.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Ko.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Fn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Zn(e,t){return e.$instanceOf(t)}function $P(e){return Lt(e.rootElements,function(t){return Zn(t,"bpmn:Process")||Zn(t,"bpmn:Collaboration")})}function FP(e){var t={},n=[],i={};function o(U,Y){return function(re){U(re,Y)}}function r(U){t[U.id]=U}function a(U){return t[U.id]}function s(U,Y){var re=U.gfx;if(re)throw new Error(`already rendered ${Fn(U)}`);return e.element(U,i[U.id],Y)}function c(U,Y){return e.root(U,i[U.id],Y)}function l(U,Y){try{var re=i[U.id]&&s(U,Y);return r(U),re}catch(he){u(he.message,{element:U,error:he}),console.error(`failed to import ${Fn(U)}`,he)}}function u(U,Y){e.error(U,Y)}var p=this.registerDi=function(Y){var re=Y.bpmnElement;re?i[re.id]?u(`multiple DI elements defined for ${Fn(re)}`,{element:re}):i[re.id]=Y:u(`no bpmnElement referenced in ${Fn(Y)}`,{element:Y})};function f(U){d(U.plane)}function d(U){p(U),z(U.planeElement,g)}function g(U){p(U)}this.handleDefinitions=function(Y,re){var he=Y.diagrams;if(re&&he.indexOf(re)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!re&&he&&he.length&&(re=he[0]),!re)throw new Error("no diagram to display");i={},f(re);var Le=re.plane;if(!Le)throw new Error(`no plane for ${Fn(re)}`);var N=Le.bpmnElement;if(!N)if(N=$P(Y),N)u(`correcting missing bpmnElement on ${Fn(Le)} to ${Fn(N)}`),Le.bpmnElement=N,p(Le);else throw new Error("no process or collaboration to display");var C=c(N,Le);if(Zn(N,"bpmn:Process")||Zn(N,"bpmn:SubProcess"))m(N,C);else if(Zn(N,"bpmn:Collaboration"))W(N,C),_(Y.rootElements,C);else throw new Error(`unsupported bpmnElement for ${Fn(Le)}: ${Fn(N)}`);h(n)};var h=this.handleDeferred=function(){for(var Y;n.length;)Y=n.shift(),Y()};function m(U,Y){Ae(U,Y),O(U.ioSpecification,Y),P(U.artifacts,Y),r(U)}function _(U,Y){var re=rt(U,function(he){return!a(he)&&Zn(he,"bpmn:Process")&&he.laneSets});re.forEach(o(m,Y))}function x(U,Y){l(U,Y)}function y(U,Y){z(U,o(x,Y))}function v(U,Y){l(U,Y)}function E(U,Y){l(U,Y)}function w(U,Y){l(U,Y)}function T(U,Y){l(U,Y)}function P(U,Y){z(U,function(re){Zn(re,"bpmn:Association")?n.push(function(){T(re,Y)}):T(re,Y)})}function O(U,Y){U&&(z(U.dataInputs,o(E,Y)),z(U.dataOutputs,o(w,Y)))}var B=this.handleSubProcess=function(Y,re){Ae(Y,re),P(Y.artifacts,re)};function $(U,Y){var re=l(U,Y);Zn(U,"bpmn:SubProcess")&&B(U,re||Y),Zn(U,"bpmn:Activity")&&O(U.ioSpecification,Y),n.push(function(){z(U.dataInputAssociations,o(v,Y)),z(U.dataOutputAssociations,o(v,Y))})}function H(U,Y){l(U,Y)}function Q(U,Y){l(U,Y)}function J(U,Y){n.push(function(){var re=l(U,Y);U.childLaneSet&&X(U.childLaneSet,re||Y),ne(U)})}function X(U,Y){z(U.lanes,o(J,Y))}function me(U,Y){z(U,o(X,Y))}function Ae(U,Y){Oe(U.flowElements,Y),U.laneSets&&me(U.laneSets,Y)}function Oe(U,Y){z(U,function(re){Zn(re,"bpmn:SequenceFlow")?n.push(function(){H(re,Y)}):Zn(re,"bpmn:BoundaryEvent")?n.unshift(function(){$(re,Y)}):Zn(re,"bpmn:FlowNode")?$(re,Y):Zn(re,"bpmn:DataObject")||(Zn(re,"bpmn:DataStoreReference")||Zn(re,"bpmn:DataObjectReference")?Q(re,Y):u(`unrecognized flowElement ${Fn(re)} in context ${Fn(Y&&Y.businessObject)}`,{element:re,context:Y}))})}function Ee(U,Y){var re=l(U,Y),he=U.processRef;he&&m(he,re||Y)}function W(U,Y){z(U.participants,o(Ee,Y)),n.push(function(){y(U.messageFlows,Y)}),P(U.artifacts,Y)}function ne(U){z(U.flowNodeRef,function(Y){var re=Y.get("lanes");re&&re.push(U)})}}function jP(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(h,m){return i.add(h,m)},element:function(h,m,_){return i.add(h,m,_)},error:function(h,m){s.push({message:h,context:m})}},f=new FP(p);u=u||l.diagrams&&l.diagrams[0];var d=HP(l,u);if(!d)throw new Error("no diagram to display");z(d,function(h){f.handleDefinitions(l,h)});var g=u.plane.bpmnElement.id;r.setRootElement(r.findRoot(g+"_plane")||r.findRoot(g))}return new Promise(function(l,u){try{return i=e.get("bpmnImporter"),o=e.get("eventBus"),r=e.get("canvas"),o.fire("import.render.start",{definitions:t}),c(t,n),o.fire("import.render.complete",{error:a,warnings:s}),l({warnings:s})}catch(p){return p.warnings=s,u(p)}})}function HP(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!M(n,"bpmn:Process")&&!M(n,"bpmn:Collaboration")&&(i=zP(n));var o;M(i,"bpmn:Collaboration")?o=i:o=Lt(e.rootElements,function(l){if(M(l,"bpmn:Collaboration"))return Lt(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=Nn(o.participants,function(l){return l.processRef}),r.push(o));var a=Rv(r),s=[t],c=[n];return z(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function Rv(e){var t=[];return z(e,function(n){n&&(t.push(n),t=t.concat(Rv(n.flowElements)))}),t}function zP(e){for(var t=e;t;){if(M(t,"bpmn:Process"))return t;t=t.$parent}}var GP='<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>',Cv=GP,Mv={verticalAlign:"middle"},Av={color:"#404040"},VP={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},WP={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},UP={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"},qP='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Cv+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',Ji;function YP(){Ji=$t(qP),Wn(Ji,VP),Wn(Et("svg",Ji),Mv),Wn(Et(".backdrop",Ji),WP),Wn(Et(".notice",Ji),UP),Wn(Et(".link",Ji),Av,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function KP(){Ji||(YP(),ni.bind(Ji,".backdrop","click",function(e){document.body.removeChild(Ji)})),document.body.appendChild(Ji)}const hl=5,Pv="djs-outline-hidden";function Gt(e){e=V({},ZP,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),JP(this._container)}Me(Gt,Ko),Gt.prototype.importXML=async function(t,n){const i=this;function o(a){return i.get("eventBus").createEvent(a)}let r=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;r=r.concat(l),s=this._emit("import.parse.complete",o({error:null,definitions:s,elementsById:u,references:c,warnings:r}))||s;const p=await this.importDefinitions(s,n);return r=r.concat(p.warnings),this._emit("import.done",{error:null,warnings:r}),{warnings:r}}catch(a){let s=a;throw r=r.concat(s.warnings||[]),gl(s,r),s=XP(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Gt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Gt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw gl(r,[]),r}if(typeof t=="string"&&(i=QP(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw gl(r,[]),r}try{this.clear()}catch(r){throw gl(r,[]),r}const{warnings:o}=await jP(this,n,i);return{warnings:o}},Gt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,o;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,o=(await this._moddle.toXML(n,t)).xml,o=this._emit("saveXML.serialized",{xml:o})||o}catch(a){i=a}const r=i?{error:i}:{xml:o};if(this._emit("saveXML.done",r),i)throw i;return r},Gt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=Et(":scope > defs",i._svg),a=qy(o),s=r?"<defs>"+qy(r)+"</defs>":"",c=i.getContainer();Rt(c).add(Pv);let l;try{l=o.getBBox()}finally{Rt(c).remove(Pv)}const u=l.x-hl,p=l.y-hl,f=l.width+hl*2,d=l.height+hl*2;t=`<?xml version="1.0" encoding="utf-8"?>
1
+ (function(J,ve){typeof exports=="object"&&typeof module<"u"?ve(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],ve):(J=typeof globalThis<"u"?globalThis:J||self,ve(J.BpmnModeler={},J.Vue))})(this,(function(J,ve){"use strict";var S3=Object.defineProperty;var R3=(J,ve,wr)=>ve in J?S3(J,ve,{enumerable:!0,configurable:!0,writable:!0,value:wr}):J[ve]=wr;var jn=(J,ve,wr)=>R3(J,typeof ve!="symbol"?ve+"":ve,wr);const wr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],_c=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function Dg(e){return wr.includes(e)}function Lg(e){return _c.includes(e)}const Ec=["timer"],Sc={timer:"bpmn:TimerEventDefinition"};function Ig(e){return typeof e=="string"&&Ec.includes(e)}function xp(e){if(e.length===1)return Ec.find(t=>Sc[t]===e[0])}const Rc=["ko","en","ja","zh"];function sS(e){return typeof e=="string"&&Rc.includes(e)}const Bg="http://g1project.net/spec/bpmn/bwl/1.0",wp="bwl",_p=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Cc="bwl:ReviewRequest",Ng={name:"bwl-hints",uri:Bg,prefix:wp,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"}]}]},Ep="bwl.undoEpisode",$g=new WeakSet;function cS(e){$g.has(e)||(e.register(Ep,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),$g.add(e))}function Fg(e,t){cS(e);const n={run:t};if(e.execute(Ep,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function Sp(e){return Array.prototype.concat.apply([],e)}const ns=Object.prototype.toString,lS=Object.prototype.hasOwnProperty;function _r(e){return e===void 0}function hn(e){return e!==void 0}function ia(e){return e==null}function We(e){return ns.call(e)==="[object Array]"}function gn(e){return ns.call(e)==="[object Object]"}function Ue(e){return ns.call(e)==="[object Number]"}function bn(e){const t=ns.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Qn(e){return ns.call(e)==="[object String]"}function uS(e){if(!We(e))throw new Error("must supply array")}function Jn(e,t){return!ia(e)&&lS.call(e,t)}function It(e,t){const n=Ac(t);let i;return G(e,function(o,r){if(n(o,r))return i=o,!1}),i}function jg(e,t){const n=Ac(t);let i=We(e)?-1:void 0;return G(e,function(o,r){if(n(o,r))return i=r,!1}),i}function rt(e,t){const n=Ac(t);let i=[];return G(e,function(o,r){n(o,r)&&i.push(o)}),i}function G(e,t){let n,i;if(_r(e))return;const o=We(e)?gS:hS;for(let r in e)if(Jn(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function pS(e,t){if(_r(e))return[];uS(e);const n=Ac(t);return e.filter(function(i,o){return!n(i,o)})}function ei(e,t,n){return G(e,function(i,o){n=t(n,i,o)}),n}function Lo(e,t){return!!ei(e,function(n,i,o){return n&&t(i,o)},!0)}function Io(e,t){return!!It(e,t)}function In(e,t){let n=[];return G(e,function(i,o){n.push(t(i,o))}),n}function Mc(e){return e&&Object.keys(e)||[]}function fS(e){return Mc(e).length}function oa(e){return In(e,t=>t)}function ra(e,t,n={}){return t=Rp(t),G(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function Hg(e,...t){e=Rp(e);let n={};return G(t,o=>ra(o,e,n)),In(n,function(o,r){return o[0]})}const dS=Hg;function Ui(e,t){t=Rp(t);let n=[];return G(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)}),In(n,i=>i.v)}function aa(e){return function(t){return Lo(e,function(n,i){return t[i]===n})}}function Rp(e){return bn(e)?e:t=>t[e]}function Ac(e){return bn(e)?e:t=>t===e}function hS(e){return e}function gS(e){return Number(e)}function Cp(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 Yn(e,t){return e.bind(t)}function U(e,...t){return Object.assign(e,...t)}function mS(e,t,n){let i=e;return G(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];hn(a)&&ia(s)&&(s=i[o]=isNaN(+a)?{}:[]),_r(a)?_r(n)?delete i[o]:i[o]=n:i=s}),e}function Bi(e,t){let n={},i=Object(e);return G(t,function(o){o in i&&(n[o]=e[o])}),n}function qi(e,t){let n={},i=Object(e);return G(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function A(e,t){var n=he(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function it(e,t){return Io(t,function(n){return A(e,n)})}function he(e){return e&&e.businessObject||e}function gt(e){return e&&e.di}const yS="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",zg="i18n",Er="i18n:Translation";function Sr(e){if(e){if(A(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(A(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(A(e,"bpmn:FlowElement")||A(e,"bpmn:Participant")||A(e,"bpmn:Lane")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function Bo(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,Er)})}function _n(e){return e.get("xml:lang")}function No(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,Cc)})}function is(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,o,r)=>i!==t&&r.indexOf(i)===o)]}function Mp(e){var n,i;const t=((n=e==null?void 0:e.get)==null?void 0:n.call(e,"xml:lang"))??((i=e==null?void 0:e.$attrs)==null?void 0:i["xml:lang"]);return typeof t=="string"&&t?t:void 0}function Ap(e,t,n){const i=Sr(e);if(!i)return{};const o=i.target[i.key]??"",r=Bo(e).filter(u=>_n(u)),a=u=>u.body??"",s=o?r.filter(u=>a(u)===o).map(_n):[],c=o?s.length?s:[n??t.designLocale]:[],l={};for(const u of is(t)){if(c.includes(u)){l[u]=o;continue}const p=r.find(f=>_n(f)===u&&a(f));p&&(l[u]=a(p))}return l}const Pc="bwl.updateTranslation";class Pp{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=Sr(c),u=[];t.undo=u;const p=Bo(c).filter(D=>_n(D)),f=s??(l?l.target[l.key]??"":""),d=a??o,h=(D=>{if(!D)return[];const N=p.filter(j=>j.body===D).map(_n);return N.length?N:[d]})(f),g=s!==void 0&&f&&!h.includes(t.locale)?h[0]:t.locale,w=D=>{var N;return((N=p.find(j=>_n(j)===D&&j.body))==null?void 0:N.body)??(h.includes(D)?f:"")},x=D=>No(c).some(N=>N.locale===D),y=w(g);if(y===i)return[];const v=!!y&&!x(g),S=v?r.filter(D=>D!==g&&w(D)&&!x(D)):[],_=()=>{let D=c.extensionElements;return D||(D=this.moddle.create("bpmn:ExtensionElements",{values:[]}),D.$parent=c,c.extensionElements=D,u.push(()=>delete c.extensionElements)),D.get("values")},T=(D,N)=>{const j=_();let H=j.find(Q=>{var ne;return((ne=Q.$instanceOf)==null?void 0:ne.call(Q,Er))&&_n(Q)===D});if(H){const Q=H.body;H.body=N,u.push(()=>H.body=Q)}else H=this.moddle.create(Er,{body:N}),H.set("xml:lang",D),H.$parent=c.extensionElements,j.push(H),u.push(()=>j.splice(j.indexOf(H),1))},P=D=>{const N=_(),j=N.indexOf(D);N.splice(j,1),u.push(()=>N.splice(j,0,D))};if(s===void 0){if(g===o&&l){if(f&&!p.some(N=>N.body===f)){const N=a&&a!==o?a:void 0;N&&T(N,f)}const D=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{D?l.target[l.key]=f:delete l.target[l.key]})}T(g,i)}else(p.some(D=>_n(D)===g)||!f&&g!==d)&&T(g,i);if(!v)for(const D of No(c).filter(N=>N.locale===g))P(D);for(const D of S){const N=_(),j=this.moddle.create(Cc,{locale:D,sourceLocale:g,previous:y});j.$parent=c.extensionElements,N.push(j),u.push(()=>N.splice(N.indexOf(j),1))}for(const D of No(c).filter(N=>N.sourceLocale===g&&(N.previous??"")===i))P(D);return u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}jn(Pp,"$inject",["moddle"]);const Tp="bwl.setTranslations",vS=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class kp{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,!Sr(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 x=p(),y=x.indexOf(w);y<0||(x.splice(y,1),u.push(()=>x.splice(y,0,w)))},d=w=>Bo(l).find(x=>_n(x)===w);if(i===null)for(const w of a){const x=d(w);x&&f(x)}else if(i)for(const w of a){const x=i[w];if(x===void 0)continue;const y=d(w);if(y){if(y.body===x)continue;const _=y.body;y.body=x,u.push(()=>y.body=_);continue}if(w===r&&(s??r)===r)continue;const v=p(),S=this.moddle.create(Er,{body:x});S.set("xml:lang",w),S.$parent=l.extensionElements,v.push(S),u.push(()=>v.splice(v.indexOf(S),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 No(l)){const x=h.findIndex(y=>vS(w,y));x>=0?h.splice(x,1):f(w)}for(const w of h){const x=p(),y=this.moddle.create(Cc,{locale:w.locale,...w.sourceLocale?{sourceLocale:w.sourceLocale}:{},previous:w.previous});y.$parent=l.extensionElements,x.push(y),u.push(()=>x.splice(x.indexOf(y),1))}const g=l.extensionElements;return g&&!g.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=g)),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):[]}}jn(kp,"$inject",["moddle"]);function Op(e){return No(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class Dp{constructor(t){t.registerHandler(Pc,Pp),t.registerHandler(Tp,kp)}}jn(Dp,"$inject",["commandStack"]);const Lp={__init__:["translationCommands"],translationCommands:["type",Dp]},Gg=["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"],bS={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},xS={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(Rc.map(e=>[e,{type:"string"}])),additionalProperties:!1},wS={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},_S={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},ES={type:"string",enum:[...Ec],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},SS={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[..._c]},eventDefinition:{$ref:"#/$defs/eventDefinition"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},RS={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},CS={type:"object",description:"시퀀스 플로우(같은 풀 안 노드 간).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},condition:{$ref:"#/$defs/irFlowCondition"}},required:["id","source","target"],additionalProperties:!1},MS={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},AS={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},PS={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},TS={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},OS={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},DS={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[..._p]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function Rn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const LS={"participant.add":Rn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Rn("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":Rn("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":Rn("node.update",{description:"노드 이름/레인/타입/밴드 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환, band = 행 재지정. 🔴 **기존 문서에서 band 는 「몇 번째 갈래」가 아니라 그 컨테이너의 행 번호**다(describe 의 hints.bands 가 보여 주는 값) — 신규 배치의 band 가 대칭으로 펴지는 것과 다르다. 간선이 도형을 가로지르거나 반대 방향으로 겹칠 때 그 노드를 다른 행으로 옮기는 채널이다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lane:{type:"string"},type:{type:"string",enum:[..._c]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":Rn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Rn("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":Rn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Rn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":Rn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Rn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":Rn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Rn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Rn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Rn("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":Rn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Rn("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":Rn("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...Rc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":Rn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Vg={anyOf:Gg.map(e=>LS[e])},IS={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:wS,irParticipant:_S,irNode:SS,irFlowCondition:RS,irSequenceFlow:CS,irMessageFlow:MS,irDataStore:AS,irDataAssociation:PS,irTextAnnotation:TS,irAssociation:kS,irGroup:OS,bwlPlacement:DS,eventDefinition:ES,localeTexts:xS,nullableString:bS,symbolicOp:Vg}};function Ip(){}Ip.prototype.get=function(e){return this.$model.properties.get(this,e)},Ip.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Wg(e,t){this.model=e,this.properties=t}Wg.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Ip.prototype);G(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}),G(a,Yn(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 BS=U(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Ug=U(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function Bp(e,t){var n=Ug[e];return n?n(t):t}function Np(e){return!!BS[e]}function qg(e){return!!Ug[e]}function Bn(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 pi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}pi.prototype.build=function(){return Bi(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},pi.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)},pi.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},pi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=Bn(o[0],i),a=Bn(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},pi.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},pi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},pi.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},pi.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},pi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},pi.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")},pi.prototype.hasProperty=function(e){return this.propertiesByName[e]},pi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(G(e.properties,Yn(function(r){r=U({},r,{name:r.ns.localName,inherited:t}),Object.defineProperty(r,"definedBy",{value:e});var a=r.replaces,s=r.redefines;a||s?this.redefineProperty(r,a||s,a):(r.isBody&&this.setBodyProperty(r),r.isId&&this.setIdProperty(r),this.addProperty(r))},this)),i.push(e),n[o]=e)};function $o(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,G(e,Yn(this.registerPackage,this))}$o.prototype.getPackage=function(e){return this.packageMap[e]},$o.prototype.getPackages=function(){return this.packages},$o.prototype.registerPackage=function(e){e=U({},e);var t=this.packageMap;Yg(t,e,"prefix"),Yg(t,e,"uri"),G(e.types,Yn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},$o.prototype.registerType=function(e,t){e=U({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:U({},e.meta||{})});var n=Bn(e.name,t.prefix),i=n.name,o=Object.create(null);G(e.properties,Yn(function(r){var a=Bn(r.name,n.prefix),s=a.name;Np(r.type)||(r.type=Bn(r.type,a.prefix).name),U(r,{ns:a,name:s}),o[s]=r},this)),U(e,{ns:n,name:i,propertiesByName:o}),G(e.extends,Yn(function(r){var a=Bn(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},$o.prototype.mapTypes=function(e,t,n){var i=Np(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=Bn(c,Np(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+">");G(i.superClass,n?a:s),t(i,!n),G(i.traits,a)},$o.prototype.getEffectiveDescriptor=function(e){var t=Bn(e),n=new pi(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},$o.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Yg(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Rr(e){this.model=e}Rr.prototype.set=function(e,t,n){if(!Qn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),o=i&&i.name;NS(n)?i?delete e[o]:delete e.$attrs[$p(t)]:i?o in e?e[o]=n:Kg(e,i,n):e.$attrs[$p(t)]=n},Rr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[$p(t)];var i=n.name;return!e[i]&&n.isMany&&Kg(e,n,[]),e[i]},Rr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=U({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Rr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Rr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Rr.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 NS(e){return typeof e>"u"}function Kg(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function $p(e){return e.replace(/^:/,"")}function bi(e,t={}){this.properties=new Rr(this),this.factory=new Wg(this,this.properties),this.registry=new $o(e,this.properties),this.typeCache=Object.create(null),this.config=t}bi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},bi.prototype.getType=function(e){var t=this.typeCache,n=Qn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},bi.prototype.createAny=function(e,t,n){var i=Bn(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){mS(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}),G(n,function(a,s){gn(a)&&a.value!==void 0?o[a.name]=a.value:o[s]=a}),o},bi.prototype.getPackage=function(e){return this.registry.getPackage(e)},bi.prototype.getPackages=function(){return this.registry.getPackages()},bi.prototype.getElementDescriptor=function(e){return e.$descriptor},bi.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},bi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},bi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Xg=String.fromCharCode,$S=Object.prototype.hasOwnProperty,FS=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,os={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(os).forEach(function(e){os[e.toUpperCase()]=os[e]});function jS(e,t,n,i){return i?$S.call(os,i)?os[i]:"&"+i+";":Xg(t||parseInt(n,16))}function Cr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(FS,jS):e}var Zg="non-whitespace outside of root node";function Fo(e){return new Error(e)}function HS(e){return"missing namespace for prefix <"+e+">"}function Tc(e){return{get:e,enumerable:!0}}function zS(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Qg=Symbol("nameCache");function Fp(e){return e+"$uri"}function GS(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Fp(i)]=n;return t}function kc(){return{line:0,column:0}}function VS(e){throw e}function Jg(e){if(!this)return new Jg(e);var t=e&&e.proxy,n,i,o,r,a=VS,s,c,l,u,p=kc,f=!1,d=!1,m="",h=!1,g=!1,w=null,x=!1,y,v,S,_;function T(j){j instanceof Error||(j=Fo(j)),w=j,a(j,p)}function P(j){s&&(j instanceof Error||(j=Fo(j)),s(j,p))}this.on=function(j,H){if(typeof H!="function")throw Fo("required args <name, cb>");switch(j){case"openTag":i=H;break;case"text":n=H;break;case"closeTag":o=H;break;case"error":a=H;break;case"warn":s=H;break;case"cdata":r=H;break;case"attention":u=H;break;case"question":l=H;break;case"comment":c=H;break;default:throw Fo("unsupported event: "+j)}return this},this.ns=function(j){if(typeof j>"u"&&(j={}),typeof j!="object")throw Fo("required args <nsMap={}>");var H=Object.create(null),Q;for(Q in j)H[Q]=j[Q];return g=!0,_=H,this};function D(){y=g?[]:null,v=g?GS(_):null,S=[],p=kc,x=!1,w=null,d=!1,m=""}this.parse=function(j){if(typeof j!="string")throw Fo("required args <xml=string>");if(f)throw Fo("parse during stream; call end() first");return D(),N(j),p=kc,x=!1,w},this.write=function(j){if(typeof j!="string")throw Fo("required args <xml=string>");return f||(D(),f=!0),w||(m=N(m+j,!0)||""),this},this.end=function(){return f||D(),f=!1,w||N(m),m="",p=kc,x=!1,w},this.stop=function(){x=!0};function N(j,H=!1){var Q=null,ne=null,W,ee=0,Se=!1,De=!1,_e=0,Y=0,ie,q,X,ce,ye,ke,$,C,R,V="",Z=0,re;function Re(Et,pn){var Fn=Et.indexOf(":");if(Fn===-1)return Et;var Dn=v[Et.substring(0,Fn)];return Dn?pn===Dn?Et.substr(Fn+1):Dn+Et.substr(Fn):(P(HS(Et.substring(0,Fn))),null)}function Ze(){if(re!==null)return re;var Et,pn,Fn=g&&v.xmlns,Dn=g&&h?[]:null,Lt=Z,fn=V,Wn=fn.length,yr,yi,vi,Zn,Kt,qr={},vr=new Set,li,dt,St;e:for(;Lt<Wn;Lt++)if(li=!1,dt=fn.charCodeAt(Lt),!(dt===32||dt<14&&dt>8)){for((dt<65||dt>122||dt>90&&dt<97)&&dt!==95&&dt!==58&&(P("illegal first char attribute name"),li=!0),St=Lt+1;St<Wn;St++)if(dt=fn.charCodeAt(St),!(dt>96&&dt<123||dt>64&&dt<91||dt>47&&dt<59||dt===46||dt===45||dt===95)){if(dt===32||dt<14&&dt>8){P("missing attribute value"),Lt=St;continue e}if(dt===61)break;P("illegal attribute name char"),li=!0}if(Kt=fn.substring(Lt,St),Kt==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),li=!0),dt=fn.charCodeAt(St+1),dt===34)St=fn.indexOf('"',Lt=St+2),St===-1&&(St=fn.indexOf("'",Lt),St!==-1&&(P("attribute value quote missmatch"),li=!0));else if(dt===39)St=fn.indexOf("'",Lt=St+2),St===-1&&(St=fn.indexOf('"',Lt),St!==-1&&(P("attribute value quote missmatch"),li=!0));else for(P("missing attribute value quotes"),li=!0,St=St+1;St<Wn&&(dt=fn.charCodeAt(St+1),!(dt===32||dt<14&&dt>8));St++);for(St===-1&&(P("missing closing quotes"),St=Wn,li=!0),li||(vi=fn.substring(Lt,St)),Lt=St;St+1<Wn&&(dt=fn.charCodeAt(St+1),!(dt===32||dt<14&&dt>8));St++)Lt===St&&(P("illegal character after attribute end"),li=!0);if(Lt=St+1,li)continue e;if(vr.has(Kt)){P("attribute <"+Kt+"> already defined");continue}if(vr.add(Kt),!g){qr[Kt]=vi;continue}if(h){if(yi=Kt==="xmlns"?"xmlns":Kt.charCodeAt(0)===120&&Kt.substr(0,6)==="xmlns:"?Kt.substr(6):null,yi!==null){if(Et=Cr(vi),pn=Fp(yi),Zn=_[Et],!Zn){if(yi==="xmlns"||pn in v&&v[pn]!==Et)do Zn="ns"+ee++;while(typeof v[Zn]<"u");else Zn=yi;_[Et]=Zn}v[yi]!==Zn&&(yr||(v=zS(v),yr=!0),v[yi]=Zn,yi==="xmlns"&&(v[Fp(Zn)]=Et,Fn=Zn),v[pn]=Et),qr[Kt]=vi;continue}Dn.push(Kt,vi);continue}Kt=Re(Kt,Fn),Kt!==null&&(qr[Kt]=vi)}if(h)for(Lt=0,Wn=Dn.length;Lt<Wn;Lt++)Kt=Re(Dn[Lt++],Fn),vi=Dn[Lt],Kt!==null&&(qr[Kt]=vi);return re=qr}function yt(){for(var Et=/(\r\n|\r|\n)/g,pn=0,Fn=0,Dn=0,Lt=Y,fn,Wn;_e>=Dn&&(fn=Et.exec(j),!(!fn||(Lt=fn[0].length+fn.index,Lt>_e)));)pn+=1,Dn=Lt;return _e==-1?(Fn=Lt,Wn=j.substring(Y)):Y===0?Wn=j.substring(Y,_e):(Fn=_e-Dn,Wn=Y==-1?j.substring(_e):j.substring(_e,Y+1)),{data:Wn,line:pn,column:Fn}}for(p=yt,t&&(R=Object.create({},{name:Tc(function(){return $}),originalName:Tc(function(){return C}),attrs:Tc(Ze),ns:Tc(function(){return v})}));Y!==-1;){if(j.charCodeAt(Y)===60?_e=Y:_e=j.indexOf("<",Y),_e===-1){if(H)return j.substring(Y);if(S.length)return T("unexpected end of file");if(!d)return T("missing start tag");Y<j.length&&j.substring(Y).trim()&&P(Zg);return}if(d||(d=!0),Y!==_e){if(S.length){if(n&&(n(j.substring(Y,_e),Cr,p),x))return}else if(j.substring(Y,_e).trim()&&(P(Zg),x))return}if(ce=j.charCodeAt(_e+1),ce===33){if(X=j.charCodeAt(_e+2),X===91&&j.substr(_e+3,6)==="CDATA["){if(Y=j.indexOf("]]>",_e),Y===-1)return H?j.substring(_e):T("unclosed cdata");if(r&&(r(j.substring(_e+9,Y),p),x))return;Y+=3;continue}if(X===45&&j.charCodeAt(_e+3)===45){if(Y=j.indexOf("-->",_e),Y===-1)return H?j.substring(_e):T("unclosed comment");if(c&&(c(j.substring(_e+4,Y),Cr,p),x))return;Y+=3;continue}}if(ce===63){if(Y=j.indexOf("?>",_e),Y===-1)return H?j.substring(_e):T("unclosed question");if(l&&(l(j.substring(_e,Y+2),p),x))return;Y+=2;continue}for(ie=_e+1;;ie++){if(ye=j.charCodeAt(ie),isNaN(ye))return H?j.substring(_e):(Y=-1,T("unclosed tag"));if(ye===34)X=j.indexOf('"',ie+1),ie=X!==-1?X:ie;else if(ye===39)X=j.indexOf("'",ie+1),ie=X!==-1?X:ie;else if(ye===62){Y=ie;break}}if(ce===33){if(u&&(u(j.substring(_e,Y+1),Cr,p),x))return;Y+=1;continue}if(re={},ce===47){if(Se=!1,De=!0,!S.length)return T("missing open tag");if(ie=$=S.pop(),X=_e+2+ie.length,j.substring(_e+2,X)!==ie)return T("closing tag mismatch");for(;X<Y;X++)if(ce=j.charCodeAt(X),!(ce===32||ce>8&&ce<14))return T("close tag")}else{if(j.charCodeAt(Y-1)===47?(ie=$=j.substring(_e+1,Y-1),Se=!0,De=!0):(ie=$=j.substring(_e+1,Y),Se=!0,De=!1),!(ce>96&&ce<123||ce>64&&ce<91||ce===95||ce===58))return T("illegal first char nodeName");for(X=1,q=ie.length;X<q;X++)if(ce=ie.charCodeAt(X),!(ce>96&&ce<123||ce>64&&ce<91||ce>47&&ce<59||ce===45||ce===95||ce==46)){if(ce===32||ce<14&&ce>8){$=ie.substring(0,X),re=null;break}return T("invalid nodeName")}De||S.push($)}if(g){W=v,Se&&(De||y.push(W),re===null&&(h=ie.indexOf("xmlns",X)!==-1)&&(Z=X,V=ie,Ze(),h=!1)),C=$,ne!==v&&(Q=v[Qg],Q===void 0&&(Q=v[Qg]=Object.create(null)),ne=v);var Yt=Q[$];if(Yt!==void 0)$=Yt;else{if(ce=$.indexOf(":"),ce!==-1){if(ke=v[$.substring(0,ce)],!ke)return T("missing namespace on <"+C+">");$=$.substr(ce+1)}else ke=v.xmlns;ke&&($=ke+":"+$),Q[C]=$}}if(Se&&(Z=X,V=ie,i&&(t?i(R,Cr,De,p):i($,Ze,Cr,De,p),x)))return;if(De){if(o&&(o(t?R:$,Cr,Se,p),x))return;g&&(Se?v=W:v=y.pop())}Y+=1}}}function em(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var jp={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},tm="property";function nm(e){return e.xml&&e.xml.serialize}function WS(e){const t=nm(e);return t!==tm&&(t||null)}function US(e){return e.charAt(0).toUpperCase()+e.slice(1)}function im(e,t){return em(t)?e.prefix+":"+US(e.localName):e.name}function qS(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 YS(e,t,n){const i=Bn(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=Bn(o);var a=n.getPackage(r.prefix);return qS(r,a)}function jo(e){return new Error(e)}function fo(e){return e.$descriptor}function KS(e){U(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw jo("expected element");var n=this.elementsById,i=fo(t),o=i.idProperty,r;if(o&&(r=t.get(o.name),r)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(r))throw new Error("illegal ID <"+r+">");if(n[r])throw jo("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function rs(){}rs.prototype.handleEnd=function(){},rs.prototype.handleText=function(){},rs.prototype.handleNode=function(){};function Hp(){}Hp.prototype=Object.create(rs.prototype),Hp.prototype.handleNode=function(){return this};function sa(){}sa.prototype=Object.create(rs.prototype),sa.prototype.handleText=function(e){this.body=(this.body||"")+e};function as(e,t){this.property=e,this.context=t}as.prototype=Object.create(sa.prototype),as.prototype.handleNode=function(e){if(this.element)throw jo("expected no sub nodes");return this.element=this.createReference(e),this},as.prototype.handleEnd=function(){this.element.id=this.body},as.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function zp(e,t){this.element=t,this.propertyDesc=e}zp.prototype=Object.create(sa.prototype),zp.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Bp(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Oc(){}Oc.prototype=Object.create(sa.prototype),Oc.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function Hn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Hn.prototype=Object.create(Oc.prototype),Hn.prototype.addReference=function(e){this.context.addReference(e)},Hn.prototype.handleText=function(e){var t=this.element,n=fo(t),i=n.bodyProperty;if(!i)throw jo("unexpected body text <"+e+">");sa.prototype.handleText.call(this,e)},Hn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=fo(t),i=n.bodyProperty;i&&e!==void 0&&(e=Bp(i.type,e),t.set(i.name,e))},Hn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=fo(n),o=this.context,r=new n({}),a=this.model,s;return G(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),G(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=Bp(u.type,c):l==="xmlns"?l=":"+l:(s=Bn(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},Hn.prototype.getPropertyForNode=function(e){var t=e.name,n=Bn(t),i=this.type,o=this.model,r=fo(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=WS(s);if(l){const u=e.attributes[l];if(u){const p=YS(u,e.ns,o),f=o.getType(p);return U({},s,{effectiveType:fo(f).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=im(n,c),u=o.getType(l);if(s=It(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return U({},s,{effectiveType:fo(u).name})}else if(s=It(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw jo("unrecognized element <"+n.name+">")},Hn.prototype.toString=function(){return"ElementDescriptor["+fo(this.type).name+"]"},Hn.prototype.valueHandler=function(e,t){return new zp(e,t)},Hn.prototype.referenceHandler=function(e){return new as(e,this.context)},Hn.prototype.handler=function(e){return e==="Element"?new ca(this.model,e,this.context):new Hn(this.model,e,this.context)},Hn.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,qg(n))return this.valueHandler(t,i);t.isReference?o=this.referenceHandler(t).handleNode(e):o=this.handler(n).handleNode(e);var r=o.element;return r!==void 0&&(t.isMany?i.get(t.name).push(r):i.set(t.name,r),t.isReference?(U(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function Gp(e,t,n){Hn.call(this,e,t,n)}Gp.prototype=Object.create(Hn.prototype),Gp.prototype.createElement=function(e){var t=e.name,n=Bn(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&im(n,r)||t;if(!o.hasType(a))throw jo("unexpected element <"+e.originalName+">");return Hn.prototype.createElement.call(this,e)};function ca(e,t,n){this.model=e,this.context=n}ca.prototype=Object.create(Oc.prototype),ca.prototype.createElement=function(e){var t=e.name,n=Bn(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},ca.prototype.handleChild=function(e){var t=new ca(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},ca.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Vp(e){e instanceof bi&&(e={model:e}),U(this,{lax:!1},e)}Vp.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Hn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var o=this.model,r=this.lax,a=new KS(U({},t,{rootHandler:i})),s=new Jg({proxy:!0}),c=XS();i.context=a,c.push(i);function l(S,_,T){var P=_(),D=P.line,N=P.column,j=P.data;j.charAt(0)==="<"&&j.indexOf(" ")!==-1&&(j=j.slice(0,j.indexOf(" "))+">");var H="unparsable content "+(j?j+" ":"")+`detected
2
+ line: `+D+`
3
+ column: `+N+`
4
+ nested error: `+S.message;if(T)return a.addWarning({message:H,error:S}),!0;throw jo(H)}function u(S,_){return l(S,_,!0)}function p(){var S=a.elementsById,_=a.references,T,P;for(T=0;P=_[T];T++){var D=P.element,N=S[P.id],j=fo(D).propertiesByName[P.property];if(N||a.addWarning({message:"unresolved reference <"+P.id+">",element:P.element,property:P.property,value:P.id}),j.isMany){var H=D.get(j.name),Q=H.indexOf(P);Q===-1&&(Q=H.length),N?H[Q]=N:H.splice(Q,1)}else D.set(j.name,N)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,m=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function g(S){if(d.test(S)){var _=m.exec(S),T=_&&_[1];!T||h.test(T)||a.addWarning({message:"unsupported document encoding <"+T+">, falling back to UTF-8"})}}function w(S,_){var T=c.peek();try{c.push(T.handleNode(S))}catch(P){l(P,_,r)&&c.push(new Hp)}}function x(S,_){try{c.peek().handleText(S)}catch(T){u(T,_)}}function y(S,_){S.trim()&&x(S,_)}var v=o.getPackages().reduce(function(S,_){return S[_.uri]=_.prefix,S},Object.entries(jp).reduce(function(S,[_,T]){return S[T]=_,S},o.config&&o.config.nsMap||{}));return s.ns(v).on("openTag",function(S,_,T,P){var D=S.attrs||{},N=Object.keys(D).reduce(function(H,Q){var ne=_(D[Q]);return H[Q]=ne,H},{}),j={name:S.name,originalName:S.originalName,attributes:N,ns:S.ns};w(j,P)}).on("question",g).on("closeTag",f).on("cdata",x).on("text",function(S,_,T){y(_(S),T)}).on("error",l).on("warn",u),new Promise(function(S,_){var T;try{s.parse(e),p()}catch(H){T=H}var P=i.element;!T&&!P&&(T=jo("failed to parse document as <"+i.type.$descriptor.name+">"));var D=a.warnings,N=a.references,j=a.elementsById;return T?(T.warnings=D,_(T)):S({rootElement:P,elementsById:j,references:N,warnings:D})})},Vp.prototype.handler=function(e){return new Gp(this.model,e)};function XS(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var ZS=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,QS=/<|>|'|"|&|\n\r|\n/g,om=/<|>|&/g;function Yi(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Yi.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Yi.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Yi.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Yi.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)},Yi.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Yi.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Yi.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Yi.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Yi.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 JS(e){return e.charAt(0).toLowerCase()+e.slice(1)}function eR(e,t){return em(t)?JS(e):e}function rm(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function am(e){return Qn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function tR(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 nR(e,t){return t.isGeneric?U({localName:t.ns.localName},e):U({localName:eR(t.ns.localName,t.$pkg)},e)}function iR(e,t){return U({localName:t.ns.localName},e)}function oR(e){var t=e.$descriptor;return rt(t.properties,function(n){var i=n.name;if(n.isVirtual||!Jn(e,i))return!1;var o=e[i];return o===n.default||o===null?!1:n.isMany?o.length:!0})}var rR={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},aR={"<":"lt",">":"gt","&":"amp"};function sm(e,t,n){return e=Qn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function sR(e){return sm(e,QS,rR)}function cR(e){return sm(e,om,aR)}function lR(e){return rt(e,function(t){return t.isAttr})}function uR(e){return rt(e,function(t){return!t.isAttr})}function Wp(e){this.tagName=e}Wp.prototype.build=function(e){return this.element=e,this},Wp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Mr(){}Mr.prototype.serializeValue=Mr.prototype.serializeTo=function(e){e.append(this.escape?cR(this.value):this.value)},Mr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(om)!==-1&&(this.escape=!0),this};function Up(e){this.tagName=e}rm(Up,Mr),Up.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Ht(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Ht.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,o,r=t.isGeneric;return r?i=this.parseGenericNsAttributes(e):i=this.parseNsAttributes(e),n?this.ns=this.nsPropertyTagName(n):this.ns=this.nsTagName(t),this.tagName=this.addTagName(this.ns),r?this.parseGenericContainments(e):(o=oR(e),this.parseAttributes(lR(o)),this.parseContainments(uR(o))),this.parseGenericAttributes(e,i),this},Ht.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return nR(t,e)},Ht.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return iR(t,e)},Ht.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Ht.prototype.nsAttributeName=function(e){var t;if(Qn(e)?t=Bn(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:U({localName:t.localName},n)},Ht.prototype.parseGenericNsAttributes=function(e){return Object.entries(e).filter(([t,n])=>!t.startsWith("$")&&this.parseNsAttribute(e,t,n)).map(([t,n])=>({name:t,value:n}))},Ht.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Mr().build({type:"String"},t));var n=e.$children;n&&G(n,i=>{this.body.push(new Ht(this).build(i))})},Ht.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,o=Bn(t),r;if(o.prefix==="xmlns"&&(r={prefix:o.localName,uri:n}),!o.prefix&&o.localName==="xmlns"&&(r={uri:n}),!r)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(r,!0,!0);else{var a=this.logNamespaceUsed(r,!0);this.getNamespaces().logUsed(a)}},Ht.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return G(n,function(o,r){var a=t.parseNsAttribute(e,r,o);a&&i.push(a)}),i},Ht.prototype.parseGenericAttributes=function(e,t){var n=this;G(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(o){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,o)}})},Ht.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;G(e,function(o){var r=i.get(o.name),a=o.isReference,s=o.isMany;if(s||(r=[r]),o.isBody)n.push(new Mr().build(o,r[0]));else if(qg(o.type))G(r,function(l){n.push(new Up(t.addTagName(t.nsPropertyTagName(o))).build(o,l))});else if(a)G(r,function(l){n.push(new Wp(t.addTagName(t.nsPropertyTagName(o))).build(l))});else{var c=nm(o);G(r,function(l){var u;c?c===tm?u=new Ht(t,o):u=new Dc(t,o,c):u=new Ht(t),n.push(u.build(l))})}})},Ht.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Yi(i):t=i),t},Ht.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),o=e.uri,r=e.prefix,a=i.byUri(o);return(!a||n)&&i.add(e,t),i.mapPrefix(r,o),e},Ht.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),i=e.prefix,o=e.uri,r,a,s;if(!i&&!o)return{localName:e.localName};if(s=n.defaultUriByPrefix(i),o=o||s||n.uriByPrefix(i),!o)throw new Error("no namespace uri given for prefix <"+i+">");if(e=n.byUri(o),!e&&!i&&(e=this.logNamespace({uri:o},s===o,!0)),!e){for(r=i,a=1;n.uriByPrefix(r);)r=i+"_"+a++;e=this.logNamespace({prefix:r,uri:o},s===o)}return i&&n.mapPrefix(i,o),e},Ht.prototype.parseAttributes=function(e){var t=this,n=this.element;G(e,function(i){var o=n.get(i.name);if(i.isReference)if(!i.isMany)o=o.id;else{var r=[];G(o,function(a){r.push(a.id)}),o=r.join(" ")}t.addAttribute(t.nsAttributeName(i),o)})},Ht.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),am(e)},Ht.prototype.addAttribute=function(e,t){var n=this.attrs;Qn(t)&&(t=sR(t));var i=jg(n,function(r){return r.name.localName===e.localName&&r.name.uri===e.uri&&r.name.prefix===e.prefix}),o={name:e,value:t};i!==-1?n.splice(i,1,o):n.push(o)},Ht.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=tR(n).concat(t)),G(t,function(i){e.append(" ").append(am(i.name)).append('="').append(i.value).append('"')})},Ht.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Mr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),G(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function Dc(e,t,n){Ht.call(this,e,t),this.serialization=n}rm(Dc,Ht),Dc.prototype.parseNsAttributes=function(e){var t=Ht.prototype.parseNsAttributes.call(this,e).filter(a=>a.name!==this.serialization),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var o=e.$model.getPackage(i.uri),r=o.xml&&o.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+r+n.ns.localName),t},Dc.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function pR(){this.value="",this.write=function(e){this.value+=e}}function fR(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 dR(e){e=U({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new pR,r=new fR(o,e.format);e.preamble&&r.append(ZS);var a=new Ht,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(hR(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function hR(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in jp)n[i]=jp[i];for(const i in t){const o=t[i];n[o]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function Lc(e,t){bi.call(this,e,t)}Lc.prototype=Object.create(bi.prototype),Lc.prototype.fromXML=function(e,t,n){Qn(t)||(n=t,t="bpmn:Definitions");var i=new Vp(U({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},Lc.prototype.toXML=function(e,t){var n=new dR(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var gR="BPMN20",mR="http://www.omg.org/spec/BPMN/20100524/MODEL",yR="bpmn",vR=[],bR=[{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"}]}],xR=[{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"}]}],wR={tagAlias:"lowerCase",typePrefix:"t"},_R={name:gR,uri:mR,prefix:yR,associations:vR,types:bR,enumerations:xR,xml:wR},ER="BPMNDI",SR="http://www.omg.org/spec/BPMN/20100524/DI",RR="bpmndi",CR=[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],MR=[{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"}]}],AR=[],PR={name:ER,uri:SR,prefix:RR,types:CR,enumerations:MR,associations:AR},TR="DC",kR="http://www.omg.org/spec/DD/20100524/DC",OR="dc",DR=[{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}]}],LR=[],IR={name:TR,uri:kR,prefix:OR,types:DR,associations:LR},BR="DI",NR="http://www.omg.org/spec/DD/20100524/DI",$R="di",FR=[{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"}]}],jR=[],HR={tagAlias:"lowerCase"},zR={name:BR,uri:NR,prefix:$R,types:FR,associations:jR,xml:HR},GR="bpmn.io colors for BPMN",VR="http://bpmn.io/schema/bpmn/biocolor/1.0",WR="bioc",UR=[{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"}]}],qR=[],YR=[],KR={name:GR,uri:VR,prefix:WR,types:UR,enumerations:qR,associations:YR},XR="BPMN in Color",ZR="http://www.omg.org/spec/BPMN/non-normative/color/1.0",QR="color",JR=[{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"}]}],eC=[],tC=[],nC={name:XR,uri:ZR,prefix:QR,types:JR,enumerations:eC,associations:tC};const iC={bpmn:_R,bpmndi:PR,dc:IR,di:zR,bioc:KR,color:nC};function cm(e,t){const n=U({},iC,e);return new Lc(n,t)}const oC={name:"bpmn-i18n",uri:"http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",prefix:"i18n",types:[{name:"Translation",superClass:["Element"],properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"body",isBody:!0,type:"String"},{name:"target",isAttr:!0,type:"String",default:"@name"},{name:"textFormat",isAttr:"true",type:"String",default:"text/plain"}]}],enumerations:[],associations:[],xml:{tagAlias:"lowerCase",typePrefix:"t"}},Ic={[zg]:oC,[wp]:Ng};function lm(){return cm(Ic)}const um=lm();async function la(e){const{rootElement:t,warnings:n}=await um.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function rC(e){const{xml:t}=await um.toXML(e,{format:!0});return t}function qp(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const ua={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},aC=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function sC(e){const t=ua;return aC.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 pa(e,t){let n=0;for(const i of e)n+=t*sC(i);return n}function pm(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&cC(e),lC(e),uC(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:pa(o,r),fontBoundingBoxAscent:r*ua.ascentEm,fontBoundingBoxDescent:r*ua.descentEm,actualBoundingBoxAscent:r*ua.ascentEm,actualBoundingBoxDescent:r*ua.descentEm}}};t.getContext=()=>n}function lC(e){if(e.SVGMatrix)return;class t{constructor(){jn(this,"a",1);jn(this,"b",0);jn(this,"c",0);jn(this,"d",1);jn(this,"e",0);jn(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 uC(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:pa(n,12),height:14}})}const Bc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),fC=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),dC=1,Nc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),hC=2;function ct(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"label-over-shape":return`ls|${e.edge}|${e.shape}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"edge-endpoint-detached":return`d|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"edge-along-group-boundary":return`eg|${e.edge}|${e.group}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const fm=20,$c=5,dm=3,gC=8,fa=15,Yp=50,hm=12,mC=hm*1.2;function Kp(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>pa(r,hm))),o=n.length*mC;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-o/2,width:i,height:o}}const gm=1;function nn(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 Ar(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 nn(e))for(const s of nn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>gm)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>=fm&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function Xp(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function mm(e,t){const n=Ar(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function yC(e,t){let n=0;for(const i of t)i.id!==e.id&&mm(e,i)&&n++;return n}function fi(e,t){let n=0;for(const i of t)i.id!==e.id&&Ar(e,i)&&n++;return n}const ym=15,vm=20;function vC(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-vm||t.at>n[1]+vm)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 Zp=20;function Fc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>gm)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<fm||n.push([o-Zp,r+Zp])}return n}function jc(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of nn(e)){const r=vC(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Fc(o,nn(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const bC=10,xC=1,wC=(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 _C(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,m)=>{if(m===0)return d<=0;const h=d/m;if(m>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 Qp(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 EC=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,da=1;function Ni(e,t){const n=e.x+da,i=e.x+e.width-da,o=e.y+da,r=e.y+e.height-da;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 ha(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 bm(e,t){const n=e.label;if(!n)return null;if(nn(e).some(i=>Ni(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(nn(i).some(o=>Ni(n,o)))return i.id;for(const i of t.shapes.filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(ha(i).some(o=>Ni(n,o)))return i.id;return null}function zt(e,t){const n=new Set(e.endpoints),i=[];for(const o of t)if(!n.has(o.id)){for(let r=0;r+1<e.waypoints.length;r++)if(_C(e.waypoints[r],e.waypoints[r+1],o,hC)){i.push(o);break}}return i}const ss=(e,t,n)=>{const i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,a=r===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*o))},SC=(e,t,n,i)=>wm(e,t,n,i)?0:Math.min(ss(e,n,i),ss(t,n,i),ss(n,e,t),ss(i,e,t)),xm=(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 cs(e,t,n){const{x:i,y:o,width:r,height:a}=n;if(/Event$/.test(n.type)){const l=Math.min(r,a)/2;return Math.max(0,ss({x:i+r/2,y:o+a/2},e,t)-l)}const s=/Gateway$/.test(n.type)?[{x:i+r/2,y:o},{x:i+r,y:o+a/2},{x:i+r/2,y:o+a},{x:i,y:o+a/2}]:[{x:i,y:o},{x:i+r,y:o},{x:i+r,y:o+a},{x:i,y:o+a}];if(xm(e,s)||xm(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,SC(e,t,s[l],s[(l+1)%s.length]));return c}function wm(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 Jp=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function _m(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(wm(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function ls(e,t){let n=0;for(const i of t)i.id===e.id||Jp(e,i)||_m(e,i)&&n++;return n}function di(e,t){let n=0;for(const i of t)i.id===e.id||Jp(e,i)||ls(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Em(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++)ls(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function ho(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(ls(n[i],[n[o]])>0){const r=n[i].id,a=n[o].id;t.push(r<a?[r,a]:[a,r])}return t.sort((i,o)=>`${i[0]}|${i[1]}`.localeCompare(`${o[0]}|${o[1]}`))}function $i(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(Jp(n[i],n[o])&&_m(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 Sm(e){const t=ho(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:RC(e)}}function RC(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 Rm(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!Nc.has(o.type)&&!i.has(o.id)&&o.x>=n.x&&o.y>=n.y&&o.x+o.width<=n.right&&o.y+o.height<=n.bottom).map(o=>o.id).sort()}function Cm(e){var n;const t=(n=jt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const o=jt(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 Mm=e=>e?{members:e}:{},zn=e=>e.shapes.filter(t=>!t.container);function CC(e,t,n){if(e.type==="bpmn:TextAnnotation")for(const i of t.edges){if(!/Association$/.test(i.type)||!i.endpoints.includes(e.id))continue;const o=i.endpoints.find(a=>a!==e.id),r=o?n.get(o):void 0;if(r&&r.type!=="bpmn:Group"){if(r.container)return r.id;if(r.parent)return r.parent}}}function MC(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 Am(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(nn(i).some(o=>Ni(n,o)))return i.id;for(const i of[...t.shapes].filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(ha(i).some(o=>Ni(n,o)))return i.id;return null}function Ho(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 Pm=3;function Tm(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 us(e,t){const n=[];for(const i of t.shapes){if(i.container||Nc.has(i.type))continue;const o=Tm(e,i);o>=Pm&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function pt(e,t={}){const n=[],i=e.shapes.filter(y=>!y.container);for(const y of e.edges)for(const v of zt(y,i))n.push({kind:"edge-crosses-shape",edge:y.id,shape:v.id});const o=e.shapes.filter(y=>y.container&&fC.has(y.type));if(o.length){const y=(v,S)=>{const _=e.shapes.find(T=>T.id===S);return!!_&&_.x>=v.x&&_.y>=v.y&&_.x+_.width<=v.x+v.width&&_.y+_.height<=v.y+v.height};for(const v of e.edges)for(const S of zt(v,o))v.endpoints.includes(S.id)||v.endpoints.some(_=>y(S,_))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:S.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[S,_]of v){if(!S)continue;const T=e.shapes.find(j=>j.id===S);if(!T||T.container)continue;const P=Math.max(T.x-_.x,_.x-(T.x+T.width),0),D=Math.max(T.y-_.y,_.y-(T.y+T.height),0),N=Math.hypot(P,D);N>bC&&n.push({kind:"edge-endpoint-detached",edge:y.id,shape:S,distance:Math.round(N)})}}const r=e.shapes.filter(y=>y.type==="bpmn:Participant");for(let y=0;y<r.length;y++)for(let v=y+1;v<r.length;v++){const S=r[y],_=r[v];if(S.x+S.width<=_.x||_.x+_.width<=S.x||S.y+S.height<=_.y||_.y+_.height<=S.y)continue;const T=(P,D)=>P.x<=D.x&&P.y<=D.y&&P.x+P.width>=D.x+D.width&&P.y+P.height>=D.y+D.height;n.push({kind:"pool-overlap",pools:[S.id,_.id],contained:T(S,_)||T(_,S)})}const a=i.filter(y=>!y.attached);for(let y=0;y<a.length;y++)for(let v=y+1;v<a.length;v++){const S=a[y],_=a[v];if(!Qp(S,_,dC))continue;const T=S.id<_.id?[S.id,_.id]:[_.id,S.id];n.push({kind:"shape-overlap",shapes:T,identical:EC(S,_)})}const s=e.shapes.filter(y=>y.type==="bpmn:Group"&&Array.isArray(y.members)&&y.members.length>0);for(let y=0;y<s.length;y++)for(let v=y+1;v<s.length;v++){const S=s[y],_=s[v],T=Math.min(S.x+S.width,_.x+_.width)-Math.max(S.x,_.x),P=Math.min(S.y+S.height,_.y+_.height)-Math.max(S.y,_.y);if(T<=$c||P<=$c)continue;const D=S.id<_.id?[S.id,_.id]:[_.id,S.id],N=new Set(_.members);if(S.members.some(H=>N.has(H))){const H=Rm(e,s,{x:Math.max(S.x,_.x),y:Math.max(S.y,_.y),right:Math.min(S.x+S.width,_.x+_.width),bottom:Math.min(S.y+S.height,_.y+_.height)});H.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:D,shapes:H});continue}const j=S.x<=_.x&&S.y<=_.y&&S.x+S.width>=_.x+_.width&&S.y+S.height>=_.y+_.height?S.id:_.x<=S.x&&_.y<=S.y&&_.x+_.width>=S.x+S.width&&_.y+_.height>=S.y+S.height?_.id:void 0;n.push({kind:"group-overlap-unintended",groups:D,...j?{container:j}:{}})}const c=new Set(s.flatMap(y=>[...y.members])),l=y=>e.shapes.filter(v=>!v.container&&!Nc.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 s){const v=l(y);if(!v.length)continue;const S=new Set(y.members),_=v.filter(T=>!S.has(T.id));_.some(T=>c.has(T.id))&&(_.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:y.id,shapes:_.map(T=>T.id).sort()}))}for(const y of s){const v=new Set(l(y).map(N=>N.id)),S=new Set(y.members),_=new Set([...v].filter(N=>!S.has(N)&&c.has(N)));if(!_.size)continue;let T=!1,P=!1,D=!1;for(const N of e.edges){if(N.type!=="bpmn:SequenceFlow"||!N.source||!N.target)continue;const j=_.has(N.source),H=_.has(N.target);!j&&H&&!v.has(N.source)?T=!0:j&&!H&&!v.has(N.target)?P=!0:j&&H&&(D=!0)}T&&P&&D&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:y.id,shapes:[..._].sort()})}const u=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<u.length;y++)for(let v=y+1;v<u.length;v++)for(let S=v+1;S<u.length;S++){const _=[u[y],u[v],u[S]],T={x:Math.max(..._.map(N=>N.x)),y:Math.max(..._.map(N=>N.y)),right:Math.min(..._.map(N=>N.x+N.width)),bottom:Math.min(..._.map(N=>N.y+N.height))};if(T.right-T.x<=$c||T.bottom-T.y<=$c)continue;const P=Rm(e,[],T);if(!P.length)continue;const D=_.map(N=>N.id).sort();n.push({kind:"group-stack-unreadable",groups:D,shapes:P})}for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||Nc.has(v.type)||v.width<=0||v.height<=0)continue;const S=[["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[_,T,P,D,N]of S){const j=P==="h"?v.x:v.y,H=P==="h"?v.x+v.width:v.y+v.height;if(!(j<N&&D<H))continue;const Q=P==="h"?v.y:v.x,ne=P==="h"?v.y+v.height:v.x+v.width;if(!(Q<T&&T<ne))continue;const W=Math.min(T-Q,ne-T);W<gC||n.push({kind:"group-cuts-shape",group:y.id,shape:v.id,side:_,depth:W})}}const p=t.includeObservationOnly?e.shapes.filter(y=>y.type==="bpmn:Group"&&y.width>0&&y.height>0):[];if(p.length){const y=new Map(e.shapes.filter(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 S=nn(v);if(S.length)for(const _ of p){const T=_.x+_.width,P=_.y+_.height,D=v.endpoints.some(j=>{const H=y.get(j);return!!H&&_.x<H.x&&H.x<T&&_.y<H.y&&H.y<P});let N=null;for(const j of S){const[H,Q,ne]=j.axis==="v"?[_.y,P,[["left",_.x],["right",T]]]:[_.x,T,[["top",_.y],["bottom",P]]],W=Math.min(j.hi,Q)-Math.max(j.lo,H);if(W<Yp)continue;const ee=j.axis==="v"?_.x<j.at&&j.at<T:_.y<j.at&&j.at<P;if(!(ee&&D))for(const[Se,De]of ne){const _e=Math.abs(j.at-De);_e<=fa&&(!N||_e<N.distance)&&(N={side:Se,inside:ee,distance:_e,length:W})}}N&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:_.id,side:N.side,inside:N.inside,distance:Math.round(N.distance),length:Math.round(N.length)})}}}const f=e.shapes.filter(y=>y.container&&y.type!=="bpmn:Group"&&y.type!=="bpmn:Lane");for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of f){const S=y.x<v.x+v.width&&v.x<y.x+y.width,_=y.y<v.y+v.height&&v.y<y.y+y.height,T=[["top",y.y,v.y,S],["bottom",y.y+y.height,v.y+v.height,S],["left",y.x,v.x,_],["right",y.x+y.width,v.x+v.width,_]];for(const[P,D,N,j]of T)j&&Math.abs(D-N)<=dm&&n.push({kind:"group-on-container-boundary",group:y.id,container:v.id,side:P})}const d=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<d.length;y++)for(let v=y+1;v<d.length;v++){const S=d[y],_=d[v],T=S.x<_.x+_.width&&_.x<S.x+S.width,P=S.y<_.y+_.height&&_.y<S.y+S.height,D=[["x",S.x+S.width,_.x,P],["x",_.x+_.width,S.x,P],["y",S.y+S.height,_.y,T],["y",_.y+_.height,S.y,T]];for(const[N,j,H,Q]of D)if(Q&&Math.abs(j-H)<=dm){n.push({kind:"group-on-group-boundary",groups:S.id<_.id?[S.id,_.id]:[_.id,S.id],axis:N});break}}for(let y=0;y<e.edges.length;y++)for(let v=y+1;v<e.edges.length;v++){const S=e.edges[y],_=e.edges[v],T=Ar(S,_);if(!T)continue;const P=S.id<_.id?[S.id,_.id]:[_.id,S.id];n.push({kind:T.kind==="opposite"?"edge-overlap-opposite":T.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:P,axis:T.axis,length:Math.round(T.length)})}for(const y of e.edges){if(!y.label)continue;const v=jc(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=bm(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:S}of us(y.label,e))n.push({kind:"label-over-shape",edge:y.id,shape:v,depth:Math.round(S)})}const m=new Set(i.map(y=>y.id)),h=e.shapes.filter(y=>y.type==="bpmn:Participant"&&y.label);for(const y of[...i,...h.filter(v=>!m.has(v.id))]){if(!y.label)continue;const v=Am(y,e);v&&n.push({kind:"label-over-line",edge:y.id,line:v})}const g=new Set(e.shapes.filter(y=>y.type==="bpmn:TextAnnotation").map(y=>y.id));for(const y of h)for(const{owner:v,rect:S}of Ho(e))v===y.id||g.has(v)||Qp(y.label,S,da)&&n.push({kind:"pool-name-over-label",pool:y.id,label:v});const w=Ho(e);for(const y of i)if(y.type==="bpmn:TextAnnotation")for(const{owner:v,rect:S}of w)v!==y.id&&Qp(y,S,da)&&n.push({kind:"annotation-over-label",annotation:y.id,label:v});const x=new Map(e.shapes.map(y=>[y.id,y]));for(const y of i){const v=y.parent??CC(y,e,x);if(!v)continue;const S=x.get(v);!S||!S.container||wC(S,y,xC)||y.type==="bpmn:TextAnnotation"&&!MC(y,S,e)||n.push({kind:"shape-outside-container",shape:y.id,container:S.id})}return n.sort((y,v)=>ct(y).localeCompare(ct(v)))}const jt=e=>typeof e=="object"&&e!==null?e:void 0,Qt=e=>typeof e=="number"?e:0,go=e=>{const t=jt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function AC(e){const t=jt(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=go(r);a&&n.push(a)}}return n}function PC(e){const t=jt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:go(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:go(t.targetRef);return n&&i?{source:n,target:i}:{}}function TC(e,t){const n=jt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=go(n);return o?t.get(o):void 0}if(Bc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return go(n)}function km(e){var a,s,c,l,u;const t=[],n=[],i=((a=jt(e))==null?void 0:a.diagrams)??[],o=new Map,r=new Set;for(const p of((s=jt(e))==null?void 0:s.rootElements)??[]){const f=jt(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const m=jt(d),h=go(m),g=go(m==null?void 0:m.processRef);h&&g?o.set(g,h):h&&r.add(h)}}for(const p of i){const f=jt((c=jt(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const m of d){const h=jt(m);if(!h)continue;const g=jt(h.bpmnElement),w=typeof(g==null?void 0:g.id)=="string"?g.id:void 0;if(!w)continue;const x=typeof(g==null?void 0:g.$type)=="string"?g.$type:"",y=jt(h.bounds);if(y){const S=h.isExpanded===!1&&x!=="bpmn:Participant",_=jt((l=jt(h.label))==null?void 0:l.bounds),T={id:w,type:x,x:Qt(y.x),y:Qt(y.y),width:Qt(y.width),height:Qt(y.height),container:Bc.has(x)&&!S,attached:(g==null?void 0:g.attachedToRef)!==void 0,...g?{parent:TC(g,o)}:{},..._?{label:{x:Qt(_.x),y:Qt(_.y),width:Qt(_.width),height:Qt(_.height)}}:{},...x==="bpmn:Group"?Mm(Cm(g)):{}},P=h.isHorizontal!==!1,D=typeof(g==null?void 0:g.name)=="string"?g.name:"";r.has(w)&&P&&D&&(T.label=Kp(T,D)),t.push(T);continue}const v=h.waypoint;if(Array.isArray(v)){const S=jt((u=jt(h.label))==null?void 0:u.bounds);n.push({id:w,type:x,waypoints:v.map(_=>{var T,P;return{x:Qt((T=jt(_))==null?void 0:T.x),y:Qt((P=jt(_))==null?void 0:P.y)}}),endpoints:AC(g),...PC(g),...S?{label:{x:Qt(S.x),y:Qt(S.y),width:Qt(S.width),height:Qt(S.height)}}:{}})}}}return{shapes:t,edges:n}}function Om(e){return pt(km(e),{includeObservationOnly:!0})}async function kC(e){const{definitions:t,warnings:n}=await la(e);return{findings:Om(t),warnings:n}}function Ge(e){var i;const t=[],n=[];for(const o of e.getAll()){const r=o;if(r.type==="label"||r.labelTarget)continue;const a=typeof r.type=="string"?r.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=r.waypoints;if(s){const h=jt(r.label),g=go(r.source),w=go(r.target);n.push({id:r.id,type:a,waypoints:s.map(x=>({x:Qt(x.x),y:Qt(x.y)})),endpoints:[g,w].filter(x=>!!x),...g&&w?{source:g,target:w}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Qt(h.y),width:Qt(h.width),height:Qt(h.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=jt(r.businessObject),l=jt(r.label);let u=jt(r.parent);for(;u&&u.type==="bpmn:Lane";)u=jt(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&Bc.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:r.id,type:a,x:r.x,y:r.y,width:Qt(r.width),height:Qt(r.height),container:Bc.has(a)&&(a==="bpmn:Participant"||r.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:Qt(l.y),width:Qt(l.width),height:Qt(l.height)}}:{},...a==="bpmn:Group"?Mm(Cm(c)):{}},m=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&m&&((i=jt(r.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Kp(d,m)),t.push(d)}return{shapes:t,edges:n}}const OC={"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 DC(e,t){const n=OC[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Dm(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Lm(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 DC(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Dm(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?Dm(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 xp(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:No(i.businessObject).map(o=>o.locale)}}}const ef=20,LC=4,Ve=(e,t)=>Math.abs(e-t)<.5;function Hc(e,t,n,i=ef){if(Ve(e.y,t.y)&&!Ve(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x);if(!(o<n.x-i&&n.x+n.width+i<r))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=l=>[{x:a,y:e.y},{x:a,y:l},{x:s,y:l},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(Ve(e.x,t.x)&&!Ve(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y);if(!(o<n.y-i&&n.y+n.height+i<r))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=l=>[{x:e.x,y:a},{x:l,y:a},{x:l,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function Im(e,t,n,i=ef){if(n.length<2)return null;if(Ve(e.y,t.y)&&!Ve(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x),a=Math.min(...n.map(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(Ve(e.x,t.x)&&!Ve(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y),a=Math.min(...n.map(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 Bm(e,t,n=ef){if(e.length!==4)return null;const[i,o,r,a]=e;if(Ve(i.y,o.y)&&Ve(o.x,r.x)&&Ve(r.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(Ve(i.x,o.x)&&Ve(o.y,r.y)&&Ve(r.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function zc(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(o>=i.y&&o<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=o>r,l=[{x:n.x+n.width,y:o},{x:a,y:o},{x:a,y:c?i.y+i.height:i.y}],u=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:r},{x:i.x,y:r}];return[l,u]}const Gc=30,IC=[0,-25,25,-40,40];function BC(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=r<o,s=a?n.y+n.height:n.y,c=a?s+Gc:s-Gc,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return IC.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}]).filter(f=>zt({...e,endpoints:[],waypoints:f},[n]).length===0)}const tf=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],ga=(e,t,n)=>zt({...e,waypoints:t},n).length;function nf(e,t,n,i){let o=[...e.waypoints],r=ga(e,o,t);if(r===0)return null;let a=!1;for(const p of zc(e,t))if(ga(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(nn),c=p=>nn({...e,waypoints:p}).some(f=>Fc(f,s).length>0),l=BC(e,t).filter(p=>ga(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&&Ve(p.y+p.height/2,f.y+f.height/2)){const d=[o[0],o[o.length-1]];if(Ve(d[0].y,d[1].y)&&!Ve(d[0].x,d[1].x)){const m=t.filter(x=>!e.endpoints.includes(x.id)&&zt({...e,waypoints:d},[x]).length>0),h=m.length>=2?Im(d[0],d[1],m):null,w=(h?h.map(x=>[d[0],...x,d[1]]):m.length===1?(Hc(d[0],d[1],m[0])??[]).map(x=>[d[0],...x,d[1]]):m.length===0?[d]:[]).filter(x=>ga(e,x,t)===0&&x.length<=o.length).sort((x,y)=>Number(u(y))-Number(u(x)));if(w.length)return w.find(x=>!c(x))??w[0]}}}for(let p=0;p+1<o.length;p++){const f=o[p],d=o[p+1],m=t.filter(w=>!e.endpoints.includes(w.id)&&zt({...e,waypoints:[f,d]},[w]).length>0);if(m.length<2)continue;const h=Im(f,d,m);if(!h)continue;const g=h.map(w=>tf(o,p,w)).filter(w=>ga(e,w,t)===0).sort((w,x)=>Number(u(x))-Number(u(w)));if(g.length)return g.find(w=>!c(w))??g[0]}for(let p=0;p<LC&&r>0;p++){let f=!1;for(let d=0;d+1<o.length&&!f;d++){const m=o[d],h=o[d+1];for(const g of t){if(e.endpoints.includes(g.id)||zt({...e,waypoints:[m,h]},[g]).length===0)continue;const w=Hc(m,h,g),x=w?w.map(v=>tf(o,d,v)):Bm(o,g)??[];if(!x.length)continue;const y=[...x].sort((v,S)=>Number(u(S))-Number(u(v)));for(const v of y){const S=ga(e,v,t);if(S<r){o=v,r=S,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&r===0?o:null}function of(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=zn(r),s=new Set,c=pt(r).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(ct(u)));if(!c.length)return s;const l=new Map;for(const u of c){if(u.kind!=="edge-crosses-shape"||l.has(u.edge))continue;const p=r.edges.find(f=>f.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const f=i.get(u);if(!f)continue;const d=f.parent,m=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=zt(p,a);if(!n&&h.length&&h.every(v=>v.type==="bpmn:TextAnnotation")){s.add(u);continue}const g=nf(p,a,m,r.edges);if(!g){h.some(v=>v.type==="bpmn:TextAnnotation")&&s.add(u);continue}const w=r.edges.filter(v=>v.id!==u),x=fi(p,w);fi({...p,waypoints:g},w)>x||o.updateWaypoints(f,g)}return s}const NC=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 rf(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 af=(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),sf=(e,t)=>ls(e,[t])>0;function Nm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=zn(r);let s=r;const c=new Set(pt(r).map(ct));for(const[l,u]of ho(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(T=>T.id===p),m=s.edges.find(T=>T.id===f);if(!d||!m)continue;const h=i.get(p);if(!h)continue;const g=rf(h),w=NC(m),x=[...zc(d,a)??[]],y=nf(d,[...a,...w],g,r.edges);y&&x.push(y);for(let T=0;T+1<d.waypoints.length;T++)for(const P of w)for(const D of Hc(d.waypoints[T],d.waypoints[T+1],P)??[])x.push(tf(d.waypoints,T,D));const v=s.edges.filter(T=>T.id!==p),S=T=>({...s,edges:s.edges.map(P=>P.id===p?{...P,waypoints:T}:P)}),_=x.find(T=>{const P={...d,waypoints:T};return sf(P,m)||!af(T,g)||v.some(D=>D.id!==f&&!sf(d,D)&&sf(P,D))?!1:pt(S(T)).every(D=>c.has(ct(D)))});if(_){o.updateWaypoints(h,_),s=S(_);break}}}const $C=["top","bottom","left","right"],$m={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},ps=20,FC=20;function jC(e,t){const n=e.x>=t.x-.5&&e.x<=t.x+t.width+.5,i=e.y>=t.y-.5&&e.y<=t.y+t.height+.5,o=[];return n&&Ve(e.y,t.y)&&o.push("top"),n&&Ve(e.y,t.y+t.height)&&o.push("bottom"),i&&Ve(e.x,t.x)&&o.push("left"),i&&Ve(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const HC=(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 Fm(e,t,n,i){const o=$m[t],r=$m[i],a=o.x===0,s=r.x===0;if(a===s){const p=a?"y":"x",f=a?"x":"y",d=o[p],m=r[p];if(Ve(e[f],n[f]))return d===-m&&d*(n[p]-e[p])>=ps?[e,n]:null;let h;if(d===-m){const w=e[p]+d*ps,x=n[p]-d*ps;if(d*(x-w)<0)return null;h=Math.round((e[p]+n[p])/2)}else h=d>0?Math.max(e[p],n[p])+Gc:Math.min(e[p],n[p])-Gc;const g=(w,x)=>a?{x,y:w}:{x:w,y:x};return[e,g(h,e[f]),g(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>=ps&&u>=ps?[e,c,n]:null}function zC(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?jC(a,r):null;if(!s)return[];const c=[];for(const l of $C){const u=HC(t,l),p=o?Fm(u,l,a,s):Fm(a,s,u,l);p&&c.push(p)}return c}const jm=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 GC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=new Set(pt(r).map(ct));let c=r;for(const[l,u]of $i(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(D=>D.id===l),f=c.edges.find(D=>D.id===u);if(!p||!f||p.type!=="bpmn:SequenceFlow"||f.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!$i({edges:[p,f]}).length)continue;const d=p.endpoints.find(D=>f.endpoints.includes(D)),m=d?a.get(d):void 0;if(!m||m.container)continue;const h=i.get(l),g=i.get(u);if(!h||!g)continue;const w=D=>n.has(D.id)?[D.waypoints]:[D.waypoints,...zC(D,m,a)],x=D=>D.length-2,y=w(p).flatMap(D=>w(f).map(N=>({pa:D,pb:N}))).filter(({pa:D,pb:N})=>D!==p.waypoints||N!==f.waypoints).map(D=>({...D,cost:jm(D.pa)+jm(D.pb)+FC*(x(D.pa)+x(D.pb))})).sort((D,N)=>D.cost-N.cost),v=rf(h),S=rf(g),_=$i(c).length,T=new Set(ho(c).map(([D,N])=>`${D}|${N}`)),P=y.find(({pa:D,pb:N})=>{const j={...p,waypoints:D},H={...f,waypoints:N};if($i({edges:[j,H]}).length||Ar(j,H)||!af(D,v)||!af(N,S))return!1;const Q={...c,edges:c.edges.map(ne=>ne.id===l?j:ne.id===u?H:ne)};return $i(Q).length>=_||ho(Q).some(([ne,W])=>!T.has(`${ne}|${W}`))?!1:pt(Q).every(ne=>s.has(ct(ne)))});P&&(P.pa!==p.waypoints&&o.updateWaypoints(h,P.pa),P.pb!==f.waypoints&&o.updateWaypoints(g,P.pb),c={...c,edges:c.edges.map(D=>D.id===l?{...p,waypoints:P.pa}:D.id===u?{...f,waypoints:P.pb}:D)})}}const VC=40,WC=20;function UC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>{const u=Ge(i),p=$i(u);return{keys:new Set(pt(u).map(ct)),crossings:ho(u).length,shared:p.length,mine:p.filter(([f,d])=>f===l||d===l).length}},a=(l,u)=>{const p=Ge(i),f=p.edges.find(d=>d.id===l);return f?new Set(zt({...f,waypoints:u},zn(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 m=d.x+d.width/2;if(m>=f.x+10&&m<=f.x+f.width-10)continue;const h=m>f.x+f.width,g=f.y>d.y,w=g?d.y+d.height:d.y,x=g?f.y:f.y+f.height,y=Math.round((w+x)/2),v=N=>f===u?[...N].reverse():N,S=(l.waypoints??[]).map(N=>({x:N.x,y:N.y})),_=r(l.id),T=a(l.id,S)??new Set,P=h?f.x+f.width:f.x,D=f.x+f.width/2;for(let N=Math.min(VC,f.width/4);h?P-N>D:P+N<D;N+=WC){const j=Math.round(h?P-N:P+N),H=v([{x:m,y:w},{x:m,y},{x:j,y},{x:j,y:x}]),Q=a(l.id,H);if(!Q||[...Q].some(W=>!T.has(W)))continue;o.updateWaypoints(l,H);const ne=r(l.id);if(ne.crossings<=_.crossings&&ne.shared<=_.shared&&ne.mine<=_.mine&&[...ne.keys].every(W=>_.keys.has(W)))break;o.updateWaypoints(l,S)}}}const qC=10;function Hm(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 zm(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(H=>H.type==="bpmn:Participant"&&H.container),i=t.shapes.find(H=>H.id===e.endpoints[0]),o=t.shapes.find(H=>H.id===e.endpoints[1]);if(!i||!o)return null;const r=Hm(i,n),a=Hm(o,n);if(!r||!a||r.id===a.id)return null;const s=a.y>r.y,c=s?r:a,l=s?a:r,u=n.filter(H=>H.id!==r.id&&H.id!==a.id&&H.y>=c.y+c.height&&H.y+H.height<=l.y).sort((H,Q)=>H.y-Q.y);if(!u.length)return null;const p=u[0],f=u[u.length-1],d=(c.y+c.height+p.y)/2,m=(f.y+f.height+l.y)/2,h=s?d:m,g=s?m:d,w=e.waypoints[0],x=e.waypoints[e.waypoints.length-1],y=zn(t),v=t.edges.filter(H=>H.id!==e.id),S=di(e,v),_=zt(e,y).length;if(S===0&&_===0||_===0&&e.waypoints.length===2)return null;const T=Math.min(...u.map(H=>H.x)),P=Math.max(...u.map(H=>H.x+H.width)),D=(w.x+x.x)/2,N=H=>H.filter((Q,ne)=>ne===0||!(Ve(Q.x,H[ne-1].x)&&Ve(Q.y,H[ne-1].y)));let j;for(let H=T;H<=P;H+=qC){const Q=N([w,{x:w.x,y:h},{x:H,y:h},{x:H,y:g},{x:x.x,y:g},x]),ne={...e,waypoints:Q};if(zt(ne,y).length>0)continue;const W=di(ne,v),ee=Math.abs(H-D);(!j||W<j.cross||W===j.cross&&ee<j.detour)&&(j={pts:Q,cross:W,detour:ee})}return j&&(_>0?j.cross<=S:j.cross<S)?j.pts:null}const YC=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function KC(e,t,n){var l,u;const{elementRegistry:i}=e,o=e.modeling,r=new Map(t.shapes.map(p=>[p.id,p])),a=Ge(i),s=new Map(a.shapes.map(p=>[p.id,p])),c=zn(a);for(const p of t.edges){if(!YC.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),m=r.get(p.target),h=s.get(p.source),g=s.get(p.target);if(!d||!m||!h||!g||!Ve(d.width,h.width)||!Ve(d.height,h.height)||!Ve(m.width,g.width)||!Ve(m.height,g.height))continue;const w=h.x-d.x,x=h.y-d.y;if(Ve(w,0)&&Ve(x,0)||!Ve(g.x-m.x,w)||!Ve(g.y-m.y,x))continue;const y=p.waypoints.map(_=>({x:_.x+w,y:_.y+x})),v=f.waypoints.map(_=>({x:_.x,y:_.y}));v.length===y.length&&v.every((_,T)=>Ve(_.x,y[T].x)&&Ve(_.y,y[T].y))||v.length===2&&(Ve(v[0].x,v[1].x)||Ve(v[0].y,v[1].y))&&zt({...p,waypoints:v},c).length===0||zt({...p,waypoints:y},c).length>0||o.updateWaypoints(f,y)}}function Gm(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ge(n);for(const r of o.edges){if(r.type!=="bpmn:MessageFlow"||t.has(r.id))continue;const a=Ge(n),s=a.edges.find(u=>u.id===r.id);if(!s)continue;const c=zm(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const cf=20,Vm=10,Fi=10,lf=40,XC=6,ZC=40,Wm=50;function QC(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<=XC})}function uf(e,t,n){let i=0;for(let o=1;o<e.length;o++){const r=e[o-1],a=e[o];if(Ve(r.y,a.y))for(const s of n)t.has(s.id)||r.y<=s.y+1||r.y>=s.y+s.height-1||(i+=Math.max(0,Math.min(Math.max(r.x,a.x),s.x+s.width)-Math.max(Math.min(r.x,a.x),s.x)))}return i}function JC(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 pf(e,t,n){if(t>n)return[];const i=[Math.min(Math.max(e,t),n)];for(let o=Vm;o<=n-t;o+=Vm)e+o<=n&&i.push(e+o),e-o>=t&&i.push(e-o);return i}function eM(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=(W,ee)=>ee>W.x+Fi&&ee<W.x+W.width-Fi,m=(W,ee)=>W.width<=2*lf?W.x+W.width/2:Math.min(Math.max(ee,W.x+lf),W.x+W.width-lf),h=Math.max(e.x,t.x)+Fi,g=Math.min(e.x+e.width,t.x+t.width)-Fi;if(h<=g){const W=!a&&d(t,p)?p:!s&&d(e,f)?f:Math.round((h+g)/2);r.push([{x:W,y:l},{x:W,y:u}])}const w=s?m(t,p):f,x=a?m(e,f):p;if(!a&&!d(e,w)){const W=w<e.x?e.x:e.x+e.width;for(const ee of pf(e.y+e.height/2,e.y+Fi,e.y+e.height-Fi))r.push([{x:W,y:ee},{x:w,y:ee},{x:w,y:u}])}if(!s&&!d(t,x)){const W=x<t.x?t.x:t.x+t.width;for(const ee of pf(t.y+t.height/2,t.y+Fi,t.y+t.height-Fi))r.push([{x,y:l},{x,y:ee},{x:W,y:ee}])}const y=(W,ee)=>{if(Math.abs(ee-W)<2*Fi)return[];const Se=Math.min(W,ee)+Fi,De=Math.max(W,ee)-Fi;return pf(Math.round((W+ee)/2),Se,De)};if(!a&&n)for(const W of y(l,c?n.y+n.height:n.y))r.push([{x:p,y:l},{x:p,y:W},{x:w,y:W},{x:w,y:u}]);if(!s&&i)for(const W of y(u,c?i.y:i.y+i.height))r.push([{x,y:l},{x,y:W},{x:f,y:W},{x:f,y:u}]);const v=Math.min(x,w),S=Math.max(x,w),_=[];for(const[W,ee]of o.filter(Se=>Se.x<S&&Se.x+Se.width>v).map(Se=>[Se.y,Se.y+Se.height]).sort((Se,De)=>Se[0]-De[0])){const Se=_[_.length-1];Se&&W<=Se[1]?Se[1]=Math.max(Se[1],ee):_.push([W,ee])}const T=[];for(let W=1;W<_.length;W++)_[W][0]-_[W-1][1]>=ZC&&T.push(Math.round((_[W-1][1]+_[W][0])/2));_.length&&T.push(_[0][0]-Wm,_[_.length-1][1]+Wm);const P=(W,ee)=>ee<W.y?W.y:ee>W.y+W.height?W.y+W.height:void 0,D=new Set([a?e.id:n==null?void 0:n.id,s?t.id:i==null?void 0:i.id].filter(W=>!!W)),N=e.y+e.height/2,j=t.y+t.height/2,H=j>N?1:-1,Q=(W,ee,Se)=>o.some(De=>!D.has(De.id)&&De.x<W&&W<De.x+De.width&&De.y<Math.max(ee,Se)-1&&De.y+De.height>Math.min(ee,Se)+1),ne=[];for(const W of T){const ee=P(e,W),Se=P(t,W);ee===void 0||Se===void 0||(W-N)*H<0&&Q(x,ee,W)||(W-j)*H>0&&Q(w,Se,W)||ne.push({pts:[{x,y:ee},{x,y:W},{x:w,y:W},{x:w,y:Se}],len:Math.abs(W-ee)+(S-v)+Math.abs(Se-W)})}return{inPools:r,outside:ne.sort((W,ee)=>W.len-ee.len).map(W=>W.pts)}}function tM(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 m=d;for(;m&&m.type!=="bpmn:Participant";)m=m.parent;return m==null?void 0:m.id},c=()=>{const d=Ge(i);return{keys:new Set(pt(d).map(ct)),crossings:ho(d).length,shared:$i(d).length}},l=(d,m)=>d.length===m.length&&d.every((h,g)=>Ve(h.x,m[g].x)&&Ve(h.y,m[g].y)),u=d=>{const m=d.source,h=d.target;if(!m||!h)return"skip";const g=Ge(i),w=new Map(g.shapes.map(Y=>[Y.id,Y])),x=s(m),y=s(h),v=new Set([x,y].filter(Y=>!!Y)),S=g.shapes.filter(Y=>Y.type==="bpmn:Participant"),_=(d.waypoints??[]).map(Y=>({x:Y.x,y:Y.y})),T=uf(_,v,S);if(T<cf)return"skip";if(t.has(d.id)){const Y=r.get(d.id);if(Y&&l(Y,_)||T-(Y?uf(Y,v,a):0)<cf)return"skip"}const P=w.get(m.id),D=w.get(h.id),N=g.edges.find(Y=>Y.id===d.id);if(!P||!D||!N)return"skip";const j=zn(g),H=new Set(zt(N,j).map(Y=>Y.id)),Q=Ho(g).filter(Y=>Y.owner!==d.id&&Y.owner!==P.id&&Y.owner!==D.id),ne=[...g.shapes.filter(Y=>!Y.container&&Y.id!==P.id&&Y.id!==D.id),...Q.map(Y=>Y.rect)],W=Y=>nn({...N,waypoints:Y}).some(ie=>QC(ie,ne)),ee=eM(P,D,x?w.get(x):void 0,y?w.get(y):void 0,S),Se=Y=>Y.map((ie,q)=>({pts:ie,i:q,key:ie.length*2+(W(ie)?1:0)})).sort((ie,q)=>ie.key-q.key||ie.i-q.i).map(ie=>ie.pts),De=[...Se(ee.inPools),...Se(ee.outside)],_e=c();for(const Y of De){if(uf(Y,v,S)>=cf)continue;const ie={...N,waypoints:Y};if(zt(ie,j).some(ce=>!H.has(ce.id))||nn(ie).some(ce=>JC(ce,g.shapes)||Q.some(ye=>Ni(ye.rect,ce))))continue;o.updateWaypoints(d,Y);const X=c();if(X.crossings<=_e.crossings&&X.shared<=_e.shared&&[...X.keys].every(ce=>_e.keys.has(ce)))return"fixed";o.updateWaypoints(d,_)}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 ji=[25,-25,40,-40],ma=35;function nM(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)-ma:Math.max(e.y+e.height,t.y+t.height)+ma,p=oM(e,t,s,u,n),f=p===null?[[u,0]]:[[u,0],[p,iM]];for(const[d,m]of f)for(const h of[0,...ji])if(!(Math.abs(h)>=e.width/2-5))for(const g of[0,...ji]){if(Math.abs(g)>=t.width/2-5)continue;const w=i+h,x=o+g,y=[{x:w,y:c},{x:w,y:d},{x,y:d},{x,y:l}];m&&zt({endpoints:[],waypoints:y},a).length||r.push({pts:y,cost:m+Math.abs(g)+Math.abs(h)})}}return r}const iM=45,Vc=20;function oM(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(g=>g.container&&(g.type==="bpmn:Lane"||g.type==="bpmn:Participant")&&r>=g.x&&r<=g.x+g.width&&e.y>=g.y&&e.y+e.height<=g.y+g.height).sort((g,w)=>g.width*g.height-w.width*w.height)[0];if(!u)return null;const p=o.filter(g=>!g.container&&g.id!==e.id&&g.id!==t.id),f=p.filter(g=>g.x<c&&g.x+g.width>s&&(n?g.y<l&&g.y+g.height>i:g.y+g.height>l&&g.y<i));if(!f.length)return null;const d=[...p,...p.flatMap(g=>g.label?[g.label]:[])].filter(g=>g.x<c&&g.x+g.width>s);if(n){let g=Math.min(...f.map(x=>x.y));for(let x=!0;x;){x=!1;for(const y of d)y.y<g&&y.y<l&&y.y+y.height>g-Vc&&(g=y.y,x=!0)}const w=Math.max(u.y,...d.filter(x=>x.y+x.height<=g).map(x=>x.y+x.height));return g-w>=Vc?Math.round((g+w)/2):null}let m=Math.max(...f.map(g=>g.y+g.height));for(let g=!0;g;){g=!1;for(const w of d)w.y+w.height>m&&w.y+w.height>l&&w.y<m+Vc&&(m=w.y+w.height,g=!0)}const h=Math.min(u.y+u.height,...d.filter(g=>g.y>=m).map(g=>g.y));return h-m>=Vc?Math.round((m+h)/2):null}function Wc(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const o=n.y+n.height/2;if(o>=i.y&&o<=i.y+i.height)return nM(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-ma:n.y+n.height+ma,p=[];for(const x of[0,...ji]){if(Math.abs(x)>=i.width/2-5)continue;const y=r+x;p.push({pts:[{x:n.x,y:o},{x:y,y:o},{x:y,y:c}],cost:Math.abs(x)});for(const v of[0,...ji]){if(Math.abs(v)>=n.width/2-5)continue;const S=a+v;p.push({pts:[{x:S,y:l},{x:S,y:u},{x:y,y:u},{x:y,y:c}],cost:Math.abs(x)+Math.abs(v)})}}const f=50,d=i.y+i.height/2,m=s?n.y+n.height:n.y;for(const x of[0,...ji]){if(Math.abs(x)>=n.width/2-5)continue;const y=a+x;p.push({pts:[{x:y,y:m},{x:y,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(x)})}const h=60,g=s?i.y+i.height:i.y,w=s?i.y+i.height+ma:i.y-ma;for(const x of[0,...ji]){if(Math.abs(x)>=i.width/2-5)continue;const y=r+x;for(const v of[0,...ji]){if(Math.abs(v)>=n.width/2-5)continue;const S=a+v;p.push({pts:[{x:S,y:m},{x:S,y:w},{x:y,y:w},{x:y,y:g}],cost:h+Math.abs(x)+Math.abs(v)})}}return p}const Uc=30;function Um(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],o=e[n+1],r=Ve(i.y,o.y)&&!Ve(i.x,o.x),a=Ve(i.x,o.x)&&!Ve(i.y,o.y);if(!(!r&&!a))for(const s of t)if(r){const c=Math.min(i.x,o.x);if(Math.max(i.x,o.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<Uc||Math.abs(i.y-(s.y+s.height))<Uc)return!0}else{const c=Math.min(i.y,o.y);if(Math.max(i.y,o.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<Uc||Math.abs(i.x-(s.x+s.width))<Uc)return!0}}return!1}const qc=40;function rM(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-qc,a=o.x+o.width+qc,s=o.y-qc,c=o.y+o.height+qc;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],f={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},d={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(f.x<a&&d.x>r&&f.y<c&&d.y>s){i++;break}}}return i}function qm(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(_=>_.container),i=new Map(t.shapes.map(_=>[_.id,_])),o=zn(t),r=t.edges.filter(_=>_.id!==e.id),a=fi(e,r),s=di(e,r),c=_=>rM(_,t.shapes,e.endpoints)+(Um(_,n)?1:0),l=c(e.waypoints),u=_=>{if(!_)return;const T=_.x+_.width/2,P=_.y+_.height/2;return n.find(D=>D.type==="bpmn:Lane"&&T>=D.x&&T<=D.x+D.width&&P>=D.y&&P<=D.y+D.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,m=_=>{if(!d||!f)return!1;for(let T=1;T<_.length-2;T++){const P=_[T],D=_[T+1];if(Ve(P.y,D.y)&&!Ve(P.x,D.x)&&P.y>f.y&&P.y<f.y+f.height)return!0}return!1},h=m(e.waypoints),w=(_=>{if(!_)return;const T=_.x+_.width/2,P=_.y+_.height/2;return n.filter(D=>D.type==="bpmn:Participant"&&T>=D.x&&T<=D.x+D.width&&P>=D.y&&P<=D.y+D.height).sort((D,N)=>D.width*D.height-N.width*N.height)[0]})(i.get(e.endpoints[0]??"")),x=_=>{if(!w)return 0;let T=0;for(let P=1;P<_.length-1;P++){const D=_[P];(D.x<w.x||D.x>w.x+w.width||D.y<w.y||D.y>w.y+w.height)&&T++}return T},y=x(e.waypoints);if(!Um(e.waypoints,n)&&!(d&&!h)&&y===0)return null;const v=_=>_.reduce((T,P,D)=>D?T+Math.abs(P.x-_[D-1].x)+Math.abs(P.y-_[D-1].y):0,0);let S;for(const{pts:_,cost:T}of Wc(e,i)){const P={...e,waypoints:_};if(zt(P,o).length>0)continue;const D=fi(P,r);if(D>a)continue;const N=x(_);if(N>y)continue;const j=N<y&&D===0;if(!j&&di(P,r)>s)continue;const H=c(_),Q=m(_);if(!j&&!(Q&&!h)&&H>=l)continue;const W=Q?0:1,ee=v(_);(!S||N<S.out||N===S.out&&(W<S.lane||W===S.lane&&(D<S.opp||D===S.opp&&(H<S.sc||H===S.sc&&(T<S.cost||T===S.cost&&ee<S.len)))))&&(S={pts:_,out:N,sc:H,lane:W,opp:D,cost:T,len:ee})}return(S==null?void 0:S.pts)??null}function aM(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 sM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i).edges.filter(a=>(!t.has(a.id)||n.has(a.id))&&a.waypoints.length>=4).map(a=>a.id).sort();for(const a of r){const s=Ge(i),c=s.edges.find(g=>g.id===a);if(!c||c.waypoints.length<4)continue;const l=zn(s),u=s.edges.filter(g=>g.id!==a),p=zt(c,l).length,f=fi(c,u),d=di(c,u),m=n.has(a)?new Set(pt(s).map(ct)):null,h=zc(c,s.shapes);h.length===2&&aM(c,s)&&h.reverse();for(const g of h){if(g.length>=c.waypoints.length)continue;const w={...c,waypoints:g};if(zt(w,l).length>p||fi(w,u)>f||di(w,u)>d)continue;if(m){const y=new Set(pt({...s,edges:s.edges.map(_=>_.id===a?w:_)}).map(ct)),v=[...y].filter(_=>!m.has(_)).length,S=[...m].filter(_=>!y.has(_)).length;if(v>S)continue}const x=i.get(a);x&&o.updateWaypoints(x,g);break}}}function Ym(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ge(n).edges.filter(r=>r.type==="bpmn:SequenceFlow"&&!t.has(r.id)).map(r=>r.id).sort();for(const r of o){const a=Ge(n),s=a.edges.find(u=>u.id===r);if(!s)continue;const c=qm(s,a);if(!c)continue;const l=n.get(r);l&&i.updateWaypoints(l,c)}}function ff(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],o=t.get(e.endpoints[0]??""),r=t.get(e.endpoints[1]??""),a=Ve(n[0].x,n[1].x)&&!Ve(n[0].y,n[1].y),s=Ve(n[n.length-1].x,n[n.length-2].x)&&!Ve(n[n.length-1].y,n[n.length-2].y);for(const c of ji){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 Km=e=>e==="bpmn:SequenceFlow"||e==="bpmn:MessageFlow";function cM(e,t,n){const i=e.waypoints;if(i.length<2||!Km(e.type))return[];const o=i[0],r=i[1],a=Ve(o.y,r.y)&&!Ve(o.x,r.x),s=Ve(o.x,r.x)&&!Ve(o.y,r.y);if(!a&&!s)return[];const c=Math.sign(a?r.x-o.x:r.y-o.y);if(!t.some(m=>{if(!Km(m.type)||m.type===e.type||m.waypoints.length<2)return!1;const h=m.waypoints[0],g=m.waypoints[1];return!Ve(h.x,o.x)||!Ve(h.y,o.y)?!1:a?Ve(h.y,g.y)&&Math.sign(g.x-h.x)===c:Ve(h.x,g.x)&&Math.sign(g.y-h.y)===c}))return[];const u=n.get(e.endpoints[0]??""),p=n.get(e.endpoints[1]??"");if(!u)return[];const f=(m,h)=>a?h>m.y+5&&h<m.y+m.height-5:h>m.x+5&&h<m.x+m.width-5,d=[];for(const m of ji){const h=(a?o.y:o.x)+m;if(!f(u,h)||i.length===2&&(!p||!f(p,h)))continue;const g=i.map(w=>({...w}));for(const w of[g[0],g[1]])a?w.y=h:w.x=h;d.push({pts:g,cost:Math.abs(m)})}return d}function lM(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,m=a?i.x:i.x+i.width,h=r?i.y:i.y+i.height,g=[];for(const w of[0,...ji])Math.abs(w)<i.width/2-5&&g.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&&g.push({pts:[{x:c,y:d},{x:c,y:p+w},{x:m,y:p+w}],cost:Math.abs(w)});return g}function df(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,...ji]){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 Xm(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=zn(t),o=t.edges.filter(d=>d.id!==e.id),r=fi(e,o);if(r===0)return null;const a=di(e,o);let s;const c=d=>d.reduce((m,h,g)=>g?m+Math.abs(h.x-d[g-1].x)+Math.abs(h.y-d[g-1].y):0,0),l=3,u=d=>{const m=d[0],h=d[d.length-1],g=Math.hypot(h.x-m.x,h.y-m.y);return g>=1&&c(d)/g>=l?1:0},p=u(e.waypoints),f=[...Wc(e,n),...df(e,n),...ff(e,n),...cM(e,o,n)];for(const{pts:d,cost:m}of f){const h={...e,waypoints:d};if(zt(h,i).length>0)continue;const g=fi(h,o),w=di(h,o),x=r-g+(p-u(d));if(g>=r||w-a>x)continue;const y=c(d);(!s||g<s.opposite||g===s.opposite&&(w<s.cross||w===s.cross&&(m<s.cost||m===s.cost&&y<s.len)))&&(s={pts:d,opposite:g,cross:w,cost:m,len:y})}return(s==null?void 0:s.pts)??null}function Zm(e,t){var i;let n=0;for(const o of t)o.id!==e.id&&((i=Ar(e,o))==null?void 0:i.kind)==="unrelated"&&n++;return n}function uM(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=zn(t),o=t.edges.filter(f=>f.id!==e.id),r=Zm(e,o);if(r===0)return null;const a=fi(e,o),s=di(e,o),c=f=>f.reduce((d,m,h)=>h?d+Math.abs(m.x-f[h-1].x)+Math.abs(m.y-f[h-1].y):0,0),l=2;let u;const p=[...Wc(e,n),...df(e,n),...lM(e,n),...ff(e,n)];for(const{pts:f,cost:d}of p){const m={...e,waypoints:f};if(zt(m,i).length>0)continue;const h=Zm(m,o);if(h>=r)continue;const g=fi(m,o);if(g-h>a-r)continue;const w=di(m,o);if(w-s>(r-h)*l)continue;const x=c(f);(!u||h<u.fake||h===u.fake&&(g<u.unreadable||g===u.unreadable&&(w<u.cross||w===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,fake:h,unreadable:g,cross:w,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function Qm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=pt(Ge(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(ct(s)));if(!r.length)return;const a=new Set;for(const s of r)if(s.kind==="edge-overlap-unrelated")for(const c of s.edges)n.has(c)||a.add(c);for(const s of[...a].sort()){const c=Ge(i),l=c.edges.find(f=>f.id===s);if(!l)continue;const u=uM(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function Jm(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 ey(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Ar(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:Jm(e,n)&&Jm(t,n)}function ty(e,t,n){let i=0;for(const o of t)o.id!==e.id&&ey(e,o,n)&&i++;return i}function pM(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=zn(t),o=t.edges.filter(f=>f.id!==e.id),r=ty(e,o,n);if(r===0)return null;const a=fi(e,o),s=di(e,o),c=f=>f.reduce((d,m,h)=>h?d+Math.abs(m.x-f[h-1].x)+Math.abs(m.y-f[h-1].y):0,0),l=2;let u;const p=[...Wc(e,n),...df(e,n),...ff(e,n)];for(const{pts:f,cost:d}of p){const m={...e,waypoints:f};if(zt(m,i).length>0)continue;const h=ty(m,o,n);if(h>=r)continue;const g=fi(m,o);if(g-h>a-r)continue;const w=di(m,o);if(w-s>(r-h)*l)continue;const x=c(f);(!u||h<u.chain||h===u.chain&&(g<u.unreadable||g===u.unreadable&&(w<u.cross||w===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,chain:h,unreadable:g,cross:w,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function fM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=pt(r).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(ct(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,p]=l.edges.map(f=>r.edges.find(d=>d.id===f));if(!(!u||!p||!ey(u,p,a)))for(const f of l.edges)n.has(f)||c.add(f)}for(const l of[...c].sort()){const u=Ge(i),p=u.edges.find(m=>m.id===l);if(!p)continue;const f=pM(p,u);if(!f)continue;const d=i.get(l);d&&o.updateWaypoints(d,f)}}function ny(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=pt(r).filter(u=>Xp(u)&&!t.has(ct(u)));if(!a.length)return;const s=new Set;for(const u of a)if(Xp(u))for(const p of u.edges)n.has(p)||s.add(p);const c=u=>{var p;return((p=r.edges.find(f=>f.id===u))==null?void 0:p.type)??""},l=[...s].sort((u,p)=>{const f=c(u)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:u.localeCompare(p)});for(const u of l){const p=Ge(i),f=p.edges.find(h=>h.id===u);if(!f)continue;const d=Xm(f,p);if(!d)continue;const m=i.get(u);m&&o.updateWaypoints(m,d)}}const dM=10,hM=(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 iy(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!jc(e,i))return null;const o=zn(t),r=i.flatMap(nn);for(const a of nn(e)){let s=[[a.lo,a.hi]];for(const[d,m]of Fc(a,r))s=s.flatMap(([h,g])=>{const w=[];return d>h&&w.push([h,Math.min(g,d)]),m<g&&w.push([Math.max(h,m),g]),w.filter(([x,y])=>y>x)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,m])=>m-d>=c+dM*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-ym}:{x:a.at+Cn+n.width/2,y:u},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!jc({...e,label:f},i)&&!o.some(d=>!e.endpoints.includes(d.id)&&hM(f,d)))return f}return null}const Cn=8;function hf(e,t){const n=e.label;if(!n)return null;const i=nn(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,m=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(m,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(nn),...t.shapes.filter(f=>f.container).flatMap(ha)],l=f=>!c.some(d=>Ni(f,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+Cn,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const f of[s.at+Cn,s.at-Cn-n.width])for(const d of p){const m=n.y+d;if(m<s.lo||m+n.height>s.hi)continue;const h={...n,x:f,y:m};if(l(h))return h}else for(const f of[s.at-Cn-n.height,s.at+Cn])for(const d of p){const m=n.x+d;if(m<s.lo||m+n.width>s.hi)continue;const h={...n,x:m,y:f};if(l(h))return h}return null}const oy=30,gM=(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},ry=(e,t)=>gM({x:e.x+e.width/2,y:e.y+e.height/2},t);function mM(e,t){const n=e.label;if(!n)return null;const i=nn(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(nn),...t.shapes.filter(c=>c.container).flatMap(ha)],r=Ho(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=>Ni(c,l))&&!us(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+Cn,c.at-Cn-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+Cn,c.at-Cn-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 ay(e,t){var a,s;const{elementRegistry:n}=e,i=e.modeling;let o=Ge(n),r=new Set(pt(o).map(ct));for(const[c,l]of t){const u=l.wps,p=n.get(c),f=p==null?void 0:p.label;if(!f||!(p!=null&&p.waypoints))continue;const d=p.waypoints[0].x-u[0].x,m=p.waypoints[0].y-u[0].y;if(!(p.waypoints.length===u.length&&p.waypoints.every((_,T)=>_.x-u[T].x===d&&_.y-u[T].y===m))){if(((a=p.source)==null?void 0:a.id)===l.source&&((s=p.target)==null?void 0:s.id)===l.target)continue;const _=o.edges.find(j=>j.id===c);if(!(_!=null&&_.label)||!us(_.label,o).length)continue;let T={..._.label,x:l.label.x,y:l.label.y};if((us(T,o).length||ry(T,_.waypoints)>oy)&&(T=null),!T&&ry(_.label,_.waypoints)>oy&&(T=mM(_,o)),!T)continue;const P=T,D={...o,edges:o.edges.map(j=>j.id===c?{...j,label:P}:j)},N=pt(D);if(N.some(j=>!r.has(ct(j))))continue;i.moveElements([f],{x:P.x-f.x,y:P.y-f.y}),o=D,r=new Set(N.map(ct));continue}const g=l.label.x+d-f.x,w=l.label.y+m-f.y;if(g===0&&w===0)continue;const x=o.edges.find(_=>_.id===c);if(!(x!=null&&x.label))continue;const y={...x.label,x:x.label.x+g,y:x.label.y+w},v={...o,edges:o.edges.map(_=>_.id===c?{..._,label:y}:_)},S=pt(v);S.some(_=>!r.has(ct(_)))||(i.moveElements([f],{x:g,y:w}),o=v,r=new Set(S.map(ct)))}}function sy(e,t,n=new Set){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i);for(const a of r.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=hf(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 cy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=pt(r).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(ct(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=r.edges.find(f=>f.id===s.edge);if(!c)continue;const l=iy(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 ly(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(nn),...t.shapes.filter(f=>f.container).flatMap(ha)],o=i.filter(f=>Ni(n,f));if(!o.length)return null;const r=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=Ho(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Ni(f,d))&&!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-Cn-n.height},{...n,y:f.at+Cn}):l.push({...n,x:f.at-Cn-n.width},{...n,x:f.at+Cn});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+Cn},{...n,x:u-n.width/2,y:e.y-Cn-n.height},{...n,x:e.x+e.width+Cn,y:p-n.height/2},{...n,x:e.x-Cn-n.width,y:p-n.height/2}),l.find(c)??null}function uy(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ge(n);for(const r of o.shapes){if(r.container||!r.label||t.has(r.id))continue;const a=ly(r,Ge(n));if(!a)continue;const s=n.get(r.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function yM(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 py(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=Ge(n),r=new Set(pt(o).map(ct));const a=[...new Set(pt(o).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(ct(s))).map(s=>s.edge))].sort();for(const s of a){const c=o.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[h,g]of u){const w=h?o.shapes.find(y=>y.id===h):void 0;if(!w)continue;const x=yM(w,l[g]);x.x===l[g].x&&x.y===l[g].y||(l[g]=x,p=!0)}if(!p)continue;const f={...o,edges:o.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=pt(f);if(d.some(h=>!r.has(ct(h))))continue;const m=n.get(s);m&&(i.updateWaypoints(m,l),o=f,r=new Set(d.map(ct)))}}const gf=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function fy(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 vM(e,t,n){const i=[],o=n?is(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 fy(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(!gf(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[d,m]of Object.entries(u))typeof m!="string"||m===""?(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 xi(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function bM(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(gf(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=fy(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,f=xi(c.participant,"name",a(u));c.participant.lanes&&(f.lanes=c.participant.lanes.map((d,m)=>xi(d,"name",a(p[m])))),s.push({...c,participant:f});break}case"participant.update":{const[u,...p]=l,f=xi(c,"name",a(u));c.lanes&&(f.lanes=c.lanes.map((d,m)=>xi(d,"name",a(p[m])))),s.push(f);break}case"node.add":s.push({...c,node:xi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:xi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:xi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:xi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:xi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:xi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(xi(c,"text",a(l[0])));break;default:s.push(gf(l[0].map)?xi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const xM=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,dy=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),hy={"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}]},fs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Yc=e=>typeof e=="string"&&e!=="";function wM(e){const t=[];function n(i,o,r,a){if(a===null){Yc(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!fs(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)Yc(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!fs(i)||!Yc(i.kind)||!(i.kind in hy)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of hy[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let f=i;for(const m of p.slice(0,-1)){if(!fs(f))break;f=f[m]}if(!fs(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((m,h)=>n(o,`${u}[${h}]`,m,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;fs(c)&&!Yc(c.text)&&c.texts===void 0&&t.push({kind:"payload-invalid",opIndex:o,field:"annotation.text"})}if(i.kind==="node.add"||i.kind==="node.update"){const c=i.band;c!==void 0&&(!Number.isInteger(c)||c<0)&&t.push({kind:"payload-invalid",opIndex:o,field:"band"});const l=i.kind==="node.add"?(r=i.node)==null?void 0:r.type:i.type,u=(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"";if(typeof l=="string"&&!Lg(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&&!Ig(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 gy(e,t,n={}){const i=wM(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(h,g,w){if(!xM.test(g)){o.push({kind:"id-invalid",opIndex:h,id:g});return}if(t.categoryOf(g)!==void 0||r.has(g)){o.push({kind:"id-duplicate",opIndex:h,id:g});return}r.set(g,{...w,opIndex:h})}e.forEach((h,g)=>{var w;switch(h.kind){case"participant.add":s(g,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(x=>x.id)});for(const x of h.participant.lanes??[])s(g,x.id,{category:"lane"});break;case"node.add":s(g,h.node.id,{category:"flowNode",participant:h.node.participant});break;case"sequenceFlow.add":s(g,h.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(g,h.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(g,h.dataStore.id,{category:"dataStore"});for(const x of h.associations??[])x.id&&s(g,x.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(g,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(g,h.association.id,{category:"association"});break;case"annotation.add":s(g,h.annotation.id,{category:"annotation"}),(w=h.association)!=null&&w.id&&s(g,h.association.id,{category:"association"});break;case"group.add":s(g,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(x=>x.id));for(const x of h.lanes)t.categoryOf(x.id)===void 0&&s(g,x.id,{category:"lane"})}break}});const c=h=>{var g;return((g=r.get(h))==null?void 0:g.category)??t.categoryOf(h)},l=h=>{const g=r.get(h);return g?g.category==="participant"?h:g.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,g,w,x){const y=c(g);if(y===void 0){o.push({kind:"ref-missing",opIndex:h,ref:g,role:w});return}if(x&&!x.includes(y)){o.push({kind:"ref-category",opIndex:h,ref:g,role:w,expected:x.join("|"),actual:y});return}return y}const p=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),f=new Map;for(const h of e)h.kind==="node.add"?f.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&f.set(h.id,h.eventDefinition);const d=h=>f.has(h)?f.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,g)=>{var w,x;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:y,lane:v}=h.node;if(y===void 0){(p||v!==void 0)&&o.push({kind:"participant-required",opIndex:g,id:h.node.id});break}if(u(g,y,"participant",["participant"])===void 0)break;v!==void 0&&((((w=r.get(y))==null?void 0:w.lanes)??a.get(y)??t.lanesOf(y)).includes(v)||o.push({kind:"lane-unknown",opIndex:g,lane:v,participant:y}));break}case"sequenceFlow.add":{const{id:y,source:v,target:S,name:_,condition:T}=h.flow,P=u(g,v,"source",["flowNode"]),D=u(g,S,"target",["flowNode"]);P&&D&&l(v)!==l(S)&&o.push({kind:"flow-cross-pool",opIndex:g,id:y}),_!==void 0&&T!==void 0&&o.push({kind:"condition-name-conflict",opIndex:g,id:y});break}case"messageFlow.add":{const{id:y,source:v,target:S}=h.flow,_=u(g,v,"source",["flowNode","participant"]),T=u(g,S,"target",["flowNode","participant"]);if(_&&T){const P=l(v),D=l(S);P!==void 0&&P===D&&o.push({kind:"message-flow-same-pool",opIndex:g,id:y})}for(const P of[v,S])d(P)&&o.push({kind:"message-flow-timer-endpoint",opIndex:g,id:y,ref:P});break}case"dataStore.add":{for(const y of h.associations??[]){if([y.source,y.target].filter(_=>_===h.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:g,source:y.source,target:y.target});continue}const S=y.source===h.dataStore.id?y.target:y.source;u(g,S,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:y,target:v}=h.association,S=u(g,y,"source"),_=u(g,v,"target");if(S&&_){const T=new Set([S,_]);T.has("dataStore")&&T.has("flowNode")||o.push({kind:"data-association-ends",opIndex:g,source:y,target:v})}break}case"association.add":{const{id:y,source:v,target:S}=h.association,_=u(g,v,"source"),T=u(g,S,"target");_&&T&&_!=="annotation"&&T!=="annotation"&&o.push({kind:"association-detached",opIndex:g,annotation:y??`${v}->${S}`});break}case"annotation.add":{if(h.association){const{source:y,target:v}=h.association;if(y!==h.annotation.id&&v!==h.annotation.id)o.push({kind:"association-detached",opIndex:g,annotation:h.annotation.id});else{const S=y===h.annotation.id?v:y;u(g,S,"association")}}h.placement&&u(g,h.placement.anchor,"anchor");break}case"group.add":{for(const y of h.group.members??[]){const v=u(g,y,"member");v&&dy.has(v)&&o.push({kind:"ref-category",opIndex:g,ref:y,role:"member",expected:"shape",actual:v})}break}case"participant.update":{if(m(g,h.id,"participant")===void 0)break;if(h.lanes){const y=t.lanesOf(h.id),v=h.lanes.map(P=>P.id);for(const P of y)v.includes(P)||o.push({kind:"lane-shrink-unsupported",opIndex:g,participant:h.id,lane:P});for(const P of v)t.categoryOf(P)!==void 0&&!y.includes(P)&&o.push({kind:"id-duplicate",opIndex:g,id:P});const S=v.filter(P=>y.includes(P)),_=P=>S.every((D,N)=>D===P[N]),T=(((x=t.laneDeclarationOrderOf)==null?void 0:x.call(t,h.id))??y).filter(P=>y.includes(P));S.length===y.length&&!_(y)&&!_(T)&&o.push({kind:"lane-reorder-unsupported",opIndex:g,participant:h.id})}break}case"node.update":{if(m(g,h.id,"flowNode")===void 0)break;if(h.lane!==void 0){const y=t.participantOf(h.id);(y?a.get(y)??t.lanesOf(y):[]).includes(h.lane)||o.push({kind:"lane-unknown",opIndex:g,lane:h.lane,participant:y??""})}break}case"sequenceFlow.update":{if(m(g,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&o.push({kind:"condition-name-conflict",opIndex:g,id:h.id}),h.source!==void 0||h.target!==void 0){const y=h.source===void 0||u(g,h.source,"source",["flowNode"])!==void 0,v=h.target===void 0||u(g,h.target,"target",["flowNode"])!==void 0,S=t.endpointsOf(h.id),_=h.source??(S==null?void 0:S.source),T=h.target??(S==null?void 0:S.target);y&&v&&_!==void 0&&T!==void 0&&new Set([l(_),l(T),l(h.id)]).size>1&&o.push({kind:"flow-cross-pool",opIndex:g,id:h.id})}break}case"messageFlow.update":m(g,h.id,"messageFlow");break;case"dataStore.update":m(g,h.id,"dataStore");break;case"annotation.update":{if(m(g,h.id,"annotation")===void 0)break;h.placement&&u(g,h.placement.anchor,"anchor");break}case"group.update":{if(m(g,h.id,"group")===void 0)break;for(const y of h.members??[]){const v=u(g,y,"member");v&&dy.has(v)&&o.push({kind:"ref-category",opIndex:g,ref:y,role:"member",expected:"shape",actual:v})}break}case"translation.confirm":m(g,h.id);break;case"element.remove":{m(g,h.id)==="lane"&&o.push({kind:"ref-category",opIndex:g,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),o.push(...vM(e,t,n.i18n)),o;function m(h,g,w){if(r.has(g)){o.push({kind:"target-added-in-batch",opIndex:h,id:g});return}const x=t.categoryOf(g);if(x===void 0){o.push({kind:"ref-missing",opIndex:h,ref:g,role:"target"});return}if(w&&x!==w){o.push({kind:"ref-category",opIndex:h,ref:g,role:"target",expected:w,actual:x});return}return x}}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 Kc(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Xc={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]},Mn=10,_M=300,EM=160,yy=20,mf=100,vy=40,SM=10,RM=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function by(e,t,n){if(!(t.width>0))return;const i=t.x+t.width/2,o=t.y+t.height/2;let r;for(const a of e.getAll()){if(a.type!=="bpmn:Lane")continue;const s=a;typeof s.x!="number"||typeof s.width!="number"||i>=s.x&&i<=s.x+s.width&&o>=s.y&&o<=s.y+s.height&&(!r||s.width*s.height<r.width*r.height)&&(r=s)}return r?{x:n.x,width:n.width,y:r.y,height:r.height}:void 0}const Zc=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function Qc(e,t,n,i,o){const r=n,a=by(e,t,i),s=a??i,c=(Q,ne,W=s)=>{const[ee,Se]=Xc[Q];let De={x:t.x+t.width/2+ee*(t.width/2+r.width/2+ne),y:t.y+t.height/2+Se*(t.height/2+r.height/2+ne)};const _e=W.x+Mn+r.width/2,Y=W.x+W.width-Mn-r.width/2,ie=W.y+Mn+r.height/2,q=W.y+W.height-Mn-r.height/2,X={x:Math.min(Y,Math.max(_e,De.x)),y:Math.min(q,Math.max(ie,De.y))};return(X.x!==De.x||X.y!==De.y)&&(De=Math.abs(X.x-(t.x+t.width/2))<(t.width+r.width)/2+Mn&&Math.abs(X.y-(t.y+t.height/2))<(t.height+r.height)/2+Mn?{x:t.x+t.width+Mn+r.width/2,y:X.y}:X),De},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=Ge(e),p=Q=>{var W,ee;if(!o.selfId)return!1;const ne=e.get(Q);return!!ne&&(((W=ne.source)==null?void 0:W.id)===o.selfId||((ee=ne.target)==null?void 0:ee.id)===o.selfId)},f=u.edges.filter(Q=>!p(Q.id)).flatMap(nn),d=Ho(u).filter(Q=>Q.owner!==o.selfId).map(Q=>Q.rect),m=Q=>({x0:Q.x-r.width/2-Mn,x1:Q.x+r.width/2+Mn,y0:Q.y-r.height/2-Mn,y1:Q.y+r.height/2+Mn}),h=Q=>{const ne=m(Q);return l.some(W=>ne.x0<W.x+W.width&&ne.x1>W.x&&ne.y0<W.y+W.height&&ne.y1>W.y)},g=Q=>{const ne=m(Q);return f.some(W=>W.axis==="h"?W.at>ne.y0&&W.at<ne.y1&&W.lo<ne.x1&&W.hi>ne.x0:W.at>ne.x0&&W.at<ne.x1&&W.lo<ne.y1&&W.hi>ne.y0)},w=Q=>{const ne=m(Q);return d.some(W=>ne.x0<W.x+W.width&&ne.x1>W.x&&ne.y0<W.y+W.height&&ne.y1>W.y)},x=u.shapes.filter(Q=>Q.type==="bpmn:Group").flatMap(Q=>[{axis:"h",at:Q.y,lo:Q.x,hi:Q.x+Q.width},{axis:"h",at:Q.y+Q.height,lo:Q.x,hi:Q.x+Q.width},{axis:"v",at:Q.x,lo:Q.y,hi:Q.y+Q.height},{axis:"v",at:Q.x+Q.width,lo:Q.y,hi:Q.y+Q.height}]),y=Q=>{const ne=m(Q);return x.some(W=>W.axis==="h"?W.at>ne.y0&&W.at<ne.y1&&W.lo<ne.x1&&W.hi>ne.x0:W.at>ne.x0&&W.at<ne.x1&&W.lo<ne.y1&&W.hi>ne.y0)},v=Q=>h(Q)||g(Q)||w(Q)||y(Q),S=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,_=Q=>S(Q)&&(!a||Zc(Q,r,a));if(o.placement){const Q=_e=>_e.startsWith("top")?_e.replace(/^top/,"bottom"):_e.replace(/^bottom/,"top"),ne=_e=>_e.endsWith("left")?_e.replace(/left$/,"right"):_e.replace(/right$/,"left"),W=o.placement.side,ee=[W,Q(W),ne(W),Q(ne(W)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],Se=o.placement.offset??50;let De=c(W,Se);if(v(De)||a&&!Zc(De,r,a)){const _e=(Y,ie)=>{const q=new Set;for(const X of ee){if(q.has(X))continue;q.add(X);const ce=c(X,Se,Y);if(ie(ce)&&!v(ce))return De=ce,!0}return!1};!_e(s,_)&&a&&_e(i,S)}return De}const T=o.from,P=s.x+Mn+r.width/2,D=s.x+s.width-Mn-r.width/2,N=s.y+Mn+r.height/2,j=s.y+s.height-Mn-r.height/2;let H={x:Math.min(D,Math.max(P,T.x)),y:Math.min(j,Math.max(N,T.y))};if(v(H)){const Q=(t.width+r.width)/2+Mn,W=[{x:H.x+Q,y:H.y},{x:H.x-Q,y:H.y},{x:H.x,y:H.y-r.height-Mn},{x:H.x,y:H.y+r.height+Mn}].filter(_).find(ee=>!v(ee));W&&(H=W)}return H}function Gt(e,t){return e.filter(n=>n.kind===t)}function xy(e,t){const n=new Map,i=new Set(Gt(e,"node.add").map(s=>s.node.id)),o=Gt(e,"sequenceFlow.update"),r=new Set(o.flatMap(s=>s.target!==void 0?[s.target]:[])),a=new Set;for(const s of o){const c=s.source;if(s.target!==void 0||c===void 0||!i.has(c)||r.has(c)||a.has(c))continue;const l=t(s.id),u=l&&Gt(e,"sequenceFlow.add").find(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 wy extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}function _y(e,t){var $1,F1,j1,H1,z1,G1,V1,W1,U1,q1,Y1,K1,X1,Z1,Q1,J1,eS,tS,nS,iS,oS,rS,aS;const{modeling:n,bpmnFactory:i,elementFactory:o,elementRegistry:r,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),p=b=>r.get(b),f=b=>{const E=p(b);if(!E)throw new Error(`하강 참조 해소 실패: ${b}`);return E},d=b=>{let E=b.parent;for(;E;){if(E.type==="bpmn:Participant")return E;E=E.parent}},m=new Map;for(const b of r.filter(E=>!("waypoints"in E&&E.waypoints)&&E.type!=="bpmn:Lane"&&E.type!=="label"&&typeof E.x=="number"))m.set(b.id,{x:b.x,y:b.y});const h=Gt(e,"participant.add"),g=Gt(e,"node.add"),w=Gt(e,"sequenceFlow.add"),x=Gt(e,"messageFlow.add"),y=Gt(e,"dataStore.add"),v=Gt(e,"dataAssociation.add"),S=Gt(e,"annotation.add"),_=Gt(e,"group.add"),T=new Map(g.map(b=>[b.node.id,b])),P=xy(e,b=>{var E,M;return(M=(E=p(b))==null?void 0:E.source)==null?void 0:M.id}),D=new Set([...P.values()].map(b=>b.flow.id)),N=w.filter(b=>!D.has(b.flow.id)),j=new Set([...P.values()].map(b=>b.flow.target)),H=b=>Gt(e,"sequenceFlow.update").filter(E=>E.target===b).length+(j.has(b)?1:0),Q=(b,E,M)=>{var B;const O=b.businessObject,L=(((B=O.extensionElements)==null?void 0:B.values)??[]).filter(I=>I.$type!==E),k=M?[...L,i.create(E,M)]:L;if(!k.length){O.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const F=i.create("bpmn:ExtensionElements",{values:k});k.forEach(I=>{I.$parent=F}),n.updateProperties(b,{extensionElements:F})},ne=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of Gt(e,"element.remove")){const E=p(b.id);E&&n.removeElements([E])}const W=b=>r.filter(E=>{var M;return E.type==="bpmn:Lane"&&((M=d(E))==null?void 0:M.id)===b}).sort((E,M)=>E.y-M.y);for(const b of Gt(e,"participant.update")){const E=f(b.id);if(b.name!==void 0&&n.updateProperties(E,{name:b.name??void 0}),!b.lanes)continue;const M=W(b.id);if(!M.length){n.splitLane(E,b.lanes.length),W(b.id).forEach((k,F)=>{const B=b.lanes[F];B&&n.updateProperties(k,{id:B.id,name:B.name})});continue}const O=new Set(M.map(k=>k.id)),L=b.lanes.reduce((k,F,B)=>O.has(F.id)?B:k,-1);b.lanes.forEach((k,F)=>{if(O.has(k.id)){n.updateProperties(f(k.id),{name:k.name});return}const B=F===L+1&&L>=0,I=F===0?n.addLane(W(b.id)[0],"top"):B?n.addLane(W(b.id).at(-1),"bottom"):n.addLane(f(b.lanes[F-1].id),"bottom");n.updateProperties(I,{id:k.id,name:k.name})})}const ee=150,Se=130,De=80,_e=90,Y=180,ie=30,q=30,X=(b,E,M,O,L)=>{const k=M-E.width/2,F=O-E.height/2;return(b.children??[]).find(B=>!("waypoints"in B&&B.waypoints)&&B.type!=="bpmn:Lane"&&B.type!=="label"&&!(L!=null&&L.has(B.id))&&typeof B.x=="number"&&k<B.x+B.width+q&&k+E.width+q>B.x&&F<B.y+B.height&&F+E.height>B.y)},ce=new Set;for(const b of h){ce.add(`pool:${b.participant.id}`);for(const E of b.participant.lanes??[])ce.add(E.id)}const ye=new Map;for(const b of g){const E=b.node.lane??`pool:${b.node.participant??""}`;let M=ye.get(E);M||ye.set(E,M=new Set([0])),b.band!==void 0&&M.add(b.band)}const ke=new Map;for(const[b,E]of ye){if(!ce.has(b))continue;const M=[...E].sort((k,F)=>k-F),O=M.map((k,F)=>F===0?0:F%2===1?Math.ceil(F/2):-(F/2)),L=Math.min(...O);ke.set(b,new Map(M.map((k,F)=>[k,O[F]-L])))}{const b=new Map;for(const E of h)(E.participant.lanes??[]).forEach((M,O)=>b.set(M.id,O));for(const[E,M]of ke){if(!b.has(E)||M.size<2)continue;const O=b.get(E),L=M.get(0)??0,k=new Set;for(const le of g){if(le.node.lane!==E||(le.band??0)!==0||!le.node.type.endsWith("Gateway"))continue;const ge={in:new Set,out:new Set,cross:new Set};for(const oe of N){const me=oe.flow.source===le.node.id;if(!me&&oe.flow.target!==le.node.id)continue;const Le=T.get(me?oe.flow.target:oe.flow.source);if(!Le||Le.node.participant!==le.node.participant||!Le.node.lane)continue;let Pe,te=!1;if(Le.node.lane!==E){const se=b.get(Le.node.lane);if(se===void 0)continue;Pe=se>O?"down":"up",te=!0}else{const se=M.get(Le.band??0)??L;Pe=se>L?"down":se<L?"up":void 0}Pe&&(ge[me?"out":"in"].add(Pe),te&&ge.cross.add(Pe))}for(const oe of["up","down"])ge.in.has(oe)&&ge.out.has(oe)&&ge.cross.has(oe)&&k.add(oe)}if(k.size!==1)continue;const[F]=k,B=Math.max(...M.values()),I=F==="down"?B:0;if(L===I)continue;const z=[...M.entries()].filter(([le])=>le!==0).sort((le,ge)=>le[1]-ge[1]),K=[...Array(B+1).keys()].filter(le=>le!==I),ae=new Map([[0,I]]);z.forEach(([le],ge)=>ae.set(le,K[ge])),ke.set(E,ae)}}const $=b=>{var E;return(((E=ye.get(b))==null?void 0:E.size)??0)>1},C=b=>b.band??(b.node.lane||!$(`pool:${b.node.participant??""}`)?void 0:0),R=new Map,V=b=>R.get(b.node.id)??C(b),Z=new Set,re=new Set;{const b=new Map;for(const O of N)b.set(O.flow.target,(b.get(O.flow.target)??0)+1);const E=O=>{const L=[],k=new Set([O]),F=[O];for(;F.length;){const B=F.shift();L.push(B);for(const I of N)I.flow.source!==B||k.has(I.flow.target)||(b.get(I.flow.target)??0)!==1||(k.add(I.flow.target),F.push(I.flow.target))}return L},M=(O,L)=>{var k;return((k=ke.get(O))==null?void 0:k.get(L))??L};for(const O of g){if(!O.node.type.endsWith("Gateway"))continue;const L=O.node.lane??`pool:${O.node.participant??""}`,k=ke.get(L);if(!k||k.size<2)continue;const F=V(O);if(F===void 0||M(L,F)!==M(L,0))continue;const B=M(L,F),I=N.filter(oe=>oe.flow.source===O.node.id).map(oe=>T.get(oe.flow.target)).filter(oe=>!!oe&&(oe.node.lane??`pool:${oe.node.participant??""}`)===L),z=I.filter(oe=>{const me=V(oe);return me!==void 0&&M(L,me)===B&&(b.get(oe.node.id)??0)===1}),K=I.some(oe=>{const me=V(oe);return me!==void 0&&M(L,me)>B});if(z.length!==1||!K)continue;const ae=new Set(I.flatMap(oe=>E(oe.node.id)));if(!N.some(oe=>oe.flow.target===O.node.id&&ae.has(oe.flow.source)))continue;const ge=new Map;for(const[oe,me]of k)ge.set(oe,me+1);ge.set(-1,0),ke.set(L,ge);for(const oe of E(z[0].node.id))T.has(oe)&&(R.set(oe,-1),re.add(oe));Z.add(O.node.id)}}const Re=(b,E)=>{var M;return((M=ke.get(b))==null?void 0:M.get(E))??E},Ze=(b,E,M,O)=>{const L=b?p(b):E?p(E):void 0;if(!L)return!1;const k=b?L.y+Math.min(L.height/2,_e):L.y+De;return Math.abs(k+Re(b??`pool:${E??""}`,M)*ee-O)<=ee/2},yt=new Map;for(const[b,E]of ye){let M=0;for(const O of E)M=Math.max(M,Re(b,O));yt.set(b,M)}const Yt=b=>Y+ee*b,Et=(b,E,M)=>{const O=u().children.filter(L=>!("waypoints"in L&&L.waypoints)&&L.type!=="label"&&L.id!==E&&typeof L.y=="number"&&L.y>=b);O.length&&n.moveElements(O,{x:0,y:M})},pn=(b,E,M)=>{const O=b.type==="bpmn:Participant"?b:void 0;if(!O||O.children.some(B=>B.type==="bpmn:Lane"))return;const L=M+E.height/2+ie-O.y;if(O.height>=L)return;const k=L-O.height,F=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:L}),Et(F,O.id,k)},Fn=(b,E)=>{const M=E-b.height;if(M<=0)return;const O=d(b)??b,L=[],k=I=>{L.push(I);for(const z of I.children??[])k(z)};k(O);const F=b.y+b.height-10,B=l.calculateAdjustments(L,"y",M,F);l.makeSpace(B.movingShapes,B.resizingShapes,{x:0,y:M},"s",F)},Dn=(b,E,M)=>{if(b){const F=f(b),B=Yt(E);if(F.height>=B)return;const I=B-F.height,z=d(F),K=z?z.y+z.height:F.y+F.height;Fn(F,B),Et(K,z==null?void 0:z.id,I);return}if(!M)return;const O=ee*(E+1);if(M.height>=O)return;const L=O-M.height,k=M.y+M.height;n.resizeShape(M,{x:M.x,y:M.y,width:M.width,height:O}),Et(k,M.id,L)},Lt=new Map;for(const b of N)Lt.set(b.flow.target,(Lt.get(b.flow.target)??0)+1);const fn=b=>(Lt.get(b)??0)<=1,Wn=new Set(g.map(b=>b.node.id).filter(b=>H(b)===1&&!N.some(E=>E.flow.target===b||E.flow.source===b&&T.has(E.flow.target)))),yr=new Map,yi=(b,E)=>{if(!b)return;const M=p(b);if(!M||M.height>=Yt(E))return;const O=M.y+M.height-10,L=d(M);if(L)return new Set((L.children??[]).filter(k=>k.type!=="bpmn:Lane"&&typeof k.y=="number"&&k.y>O).map(k=>k.id))},vi=(b,E,M)=>{if(!b)return!0;const O=p(b);return O?M-E.height/2>=O.y&&M+E.height/2<=O.y+O.height:!0},Zn=h.map((b,E)=>({op:b,declared:E}));Zn.sort((b,E)=>{const M=b.op.order??Number.POSITIVE_INFINITY,O=E.op.order??Number.POSITIVE_INFINITY;return M!==O?M-O:b.declared-E.declared});let Kt=80;for(const b of r.getAll())b.parent===u()&&"height"in b&&typeof b.y=="number"&&(Kt=Math.max(Kt,b.y+b.height+60));for(const{op:b}of Zn){const E=b.participant,M=g.filter(le=>le.node.participant===E.id).length,O=(($1=E.lanes)==null?void 0:$1.length)??0,L=Math.max(1200,M*160+300),k=(E.lanes??[]).map(le=>Yt(yt.get(le.id)??0)),F=k.reduce((le,ge)=>le+ge,0);O&&F<300&&(k[O-1]+=300-F);const B=Math.max(300,ee*((yt.get(`pool:${E.id}`)??0)+1)),I=E.blackBox||M+O===0?120:O?Math.max(300,F):B,z=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:E.id,name:E.name,...b.order!==void 0?{"bwl:poolOrder":b.order}:{},...E.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:L,height:I,isExpanded:!0}),K=n.createShape(z,{x:100+L/2,y:Kt+I/2},u()),ae=E.lanes??[];if(ae.length&&n.splitLane(K,ae.length),ae.length){const le=r.filter(ge=>{var oe;return ge.type==="bpmn:Lane"&&((oe=d(ge))==null?void 0:oe.id)===E.id}).sort((ge,oe)=>ge.y-oe.y);if(le.forEach((ge,oe)=>{const me=ae[oe];me&&n.updateProperties(ge,{id:me.id,name:me.name})}),k.some(ge=>ge!==K.height/O)){let ge=K.y;le.forEach((oe,me)=>{const Le=k[me];n.resizeShape(oe,{x:oe.x,y:ge,width:oe.width,height:Le}),ge+=Le})}}Kt=K.y+K.height+60}const qr=b=>{var O;const E=T.get(b);if(E)return E.node.participant??"";const M=p(b);return M?M.type==="bpmn:Participant"?M.id:((O=d(M))==null?void 0:O.id)??"":""},vr=new Map,li=b=>{let E=vr.get(b);return E||vr.set(b,E={nodes:[],flows:[]}),E};for(const b of g)li(b.node.participant??"").nodes.push(b);for(const b of N)li(qr(b.flow.source)).flows.push(b);const dt=b=>{var E;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((E=b.condition)==null?void 0:E.label)})},St=(b,E,M)=>o.createShape({type:Kc(b.type),...b.eventDefinition?{eventDefinitionType:Sc[b.eventDefinition]}:{},businessObject:i.create(Kc(b.type),{id:b.id,name:b.name,...E!==void 0?{"bwl:band":E}:{},...M!==void 0?{"bwl:afterColumn":M}:{}})}),U5=[...Zn.map(({op:b})=>b.participant.id).filter(b=>vr.has(b)),...[...vr.keys()].filter(b=>!h.some(E=>E.participant.id===b))],_g=b=>b.endsWith("Gateway");for(const b of U5){const E=vr.get(b),M=b?f(b):void 0,O=M?M.x+150:250;let L=M?M.y+80:120;const k=(te,se,pe)=>{if(te){const be=f(te);return be.y+Math.min(be.height/2,_e)+Re(te,se??0)*ee}return se!==void 0&&M?M.y+De+Re(`pool:${b}`,se)*ee:pe},F=(te,se,pe)=>{if(te){const be=f(te);return be.y+Math.min(be.height/2,_e)+se*ee}return M?M.y+De+se*ee:pe},B=te=>te.participant?f(te.participant):u(),I=(te,se,pe,be,et,ot,At,Ft)=>{const Ee=pe!==void 0||be!==void 0,xe=je=>{const Me=()=>Dn(pe,je,M);Ft?Ft(Me):Me()},ue=Re(pe??`pool:${b}`,be??0);if((be===void 0||Ze(pe,b,be,At??Number.NaN))&&At!==void 0&&vi(pe,se,At)&&!X(te,se,et,At))return{x:et,y:At};if(Ee)for(let je=0;je<4;je++){const Me=F(pe,ue+je,ot);if(!X(te,se,et,Me,yi(pe,ue+je)))return xe(ue+je),{x:et,y:Me}}const we=k(pe,be,ot);Ee?xe(ue):Ft?Ft(()=>pn(te,se,se.y+se.height/2)):pn(te,se,we);let Fe=et;for(let je=0;je<64;je++){const Me=X(te,se,Fe,we);if(!Me)break;Fe=Me.x+Me.width+Se+se.width/2}return{x:Fe,y:we}},z=new Set(E.flows.map(te=>te.flow.target)),K=new Map,ae=te=>{if(te===void 0)return;const se=r.get(te);if(!(!se||typeof se.x!="number"||typeof se.width!="number"))return se.x+se.width+Se};for(const te of E.nodes){if(z.has(te.node.id))continue;const se=St(te.node,te.band,te.afterColumn),pe=C(te),be=te.node.lane?`${te.node.lane}|${pe??""}`:pe!==void 0?`band:${pe}`:"",et=B(te.node),ot=K.get(be)??O,At=ae(te.afterColumn),Ft=At===void 0?ot:Math.max(ot,At);let Ee;const xe=I(et,se,te.node.lane,pe,Ft,L,void 0,Wn.has(te.node.id)&&te.node.participant!==void 0?ue=>Ee=ue:void 0);if(Ee?n.createShape(se,xe,et,{autoResize:!1}):n.createShape(se,xe,et),Ee){const ue=te.node.lane?f(te.node.lane):et;yr.set(te.node.id,{container:ue,relCy:xe.y-ue.y,grow:Ee})}K.set(be,xe.x+se.width+Se),!te.node.lane&&pe===void 0&&(L+=160)}const le=new Set,ge=new Map,oe=new Map,me=new Map;if(b&&ce.has(`pool:${b}`)){const te=new Map;for(const Ee of E.flows)te.set(Ee.flow.target,(te.get(Ee.flow.target)??0)+1);const se=Ee=>k(Ee.node.lane,V(Ee),Number.NaN),pe=new Set,be=Ee=>{var we;const xe=(we=T.get(Ee))==null?void 0:we.node.participant;if(xe)return p(xe);const ue=p(Ee);if(ue)return ue.type==="bpmn:Participant"?ue:d(ue)},et=Ee=>{const xe=[],ue=new Set([Ee]),we=[Ee];for(;we.length;){const Fe=we.shift(),je=T.get(Fe);je&&xe.push(je);for(const Me of E.flows)Me.flow.source!==Fe||ue.has(Me.flow.target)||(te.get(Me.flow.target)??0)!==1||(ue.add(Me.flow.target),we.push(Me.flow.target))}return xe},ot=Ee=>{if(!M)return;const xe=new Set(Ee.map(Fe=>Fe.node.id));let ue=!1,we=!1;for(const Fe of x){if(!xe.has(Fe.flow.source))continue;const je=be(Fe.flow.target);!je||je.id===M.id||(je.y<M.y?ue=!0:we=!0)}return ue&&!we?"up":we&&!ue?"down":void 0};for(const Ee of E.nodes){if(!_g(Ee.node.type))continue;const xe=k(Ee.node.lane,C(Ee),Number.NaN);if(Number.isNaN(xe))continue;const ue=[];for(const Me of E.flows){if(Me.flow.source!==Ee.node.id)continue;const st=T.get(Me.flow.target);if(!st||st.node.lane!==Ee.node.lane||(te.get(st.node.id)??0)!==1)continue;const ht=C(st);if(ht===void 0)continue;const tn=k(st.node.lane,ht,Number.NaN);if(Number.isNaN(tn))continue;const Un=et(st.node.id),ft=ot(Un);ft&&ue.push({subtree:Un,band:ht,row:tn,dir:ft})}if(!ue.some(Me=>Me.dir==="up")||!ue.some(Me=>Me.dir==="down")||!ue.some(Me=>Me.dir==="up"&&ue.some(st=>st.dir==="down"&&st.row<Me.row)))continue;const Fe=[...ue].sort((Me,st)=>Me.row-st.row);[...ue.filter(Me=>Me.dir==="up"),...ue.filter(Me=>Me.dir==="down")].sort((Me,st)=>Me.dir===st.dir?Me.row-st.row:Me.dir==="up"?-1:1).forEach((Me,st)=>{const ht=Fe[st].band;if(ht!==Me.band){pe.add(Ee.node.id);for(const tn of Me.subtree)C(tn)===Me.band&&R.set(tn.node.id,ht)}})}const At=Ee=>{if(!M)return;const xe=new Set(Ee.map(Fe=>Fe.node.id));let ue=!1,we=!1;for(const Fe of x){if(!xe.has(Fe.flow.target))continue;const je=be(Fe.flow.source);!je||je.id===M.id||(je.y<M.y?ue=!0:we=!0)}return ue&&!we?"up":we&&!ue?"down":void 0};for(const Ee of E.nodes){if(!_g(Ee.node.type))continue;const xe=Ee.node.lane??`pool:${b}`,ue=ke.get(xe);if(!ue||ue.size<2)continue;const we=ue.get(0);if(we===void 0)continue;const Fe=Math.max(...ue.values()),je=we===Fe&&we!==0?"down":void 0;if(!je)continue;const Me=[];for(const ft of E.flows){if(ft.flow.source!==Ee.node.id)continue;const Ln=T.get(ft.flow.target);if(!Ln||Ln.node.lane!==Ee.node.lane||(te.get(Ln.node.id)??0)!==1)continue;const mp=V(Ln);mp!==void 0&&Me.push({t:Ln,subtree:et(Ln.node.id),band:mp})}const st=Me.find(ft=>(ue.get(ft.band)??ft.band)===we);if(!st||At(st.subtree)===je||ot(st.subtree)===je)continue;const ht=Me.find(ft=>ft!==st&&At(ft.subtree)===je);if(!ht)continue;const tn=st.band,Un=ht.band;for(const ft of st.subtree)V(ft)===tn&&R.set(ft.node.id,Un);for(const ft of ht.subtree)V(ft)===Un&&R.set(ft.node.id,tn);pe.add(Ee.node.id)}for(const Ee of E.nodes){if(!_g(Ee.node.type))continue;const xe=se(Ee);if(Number.isNaN(xe)||S.some(Me=>{var st,ht;return(((st=Me.placement)==null?void 0:st.anchor)??(Me.association?Me.association.source===Me.annotation.id?Me.association.target:Me.association.source:void 0))===Ee.node.id&&((ht=Me.placement)==null?void 0:ht.side.startsWith("bottom"))}))continue;let we,Fe=!1,je;for(const Me of E.flows){if(Me.flow.source!==Ee.node.id)continue;const st=T.get(Me.flow.target);if(!st||!st.node.lane&&C(st)===void 0)continue;const ht=se(st);Number.isNaN(ht)||(Math.abs(ht-xe)<.5&&(Fe=!0),ht>xe?!we||ht>we.row?we={id:st.node.id,row:ht,count:1}:ht===we.row&&we.count++:ht<xe&&st.node.lane===Ee.node.lane&&(!je||ht>je.row?je={op:st,row:ht,count:1}:ht===je.row&&je.count++))}we&&we.count===1&&(te.get(we.id)??0)===1&&!pe.has(Ee.node.id)&&le.add(we.id),!Fe&&je&&je.count===1&&(te.get(je.op.node.id)??0)===1&&!Z.has(Ee.node.id)&&ge.set(je.op.node.id,{lane:Ee.node.lane,band:V(Ee)})}const Ft=new Map;for(const Ee of x)Ft.set(Ee.flow.target,[...Ft.get(Ee.flow.target)??[],Ee]);for(const Ee of E.nodes){const xe=Ft.get(Ee.node.id);if(!xe||xe.length!==1||!te.get(Ee.node.id)||!Ee.node.lane&&C(Ee)===void 0||re.has(Ee.node.id))continue;const ue=(F1=T.get(xe[0].flow.source))==null?void 0:F1.node.participant,we=ue?p(ue):void 0;if(!we||!M||we.id===M.id)continue;const Fe=Ee.node.lane??`pool:${b}`,je=ke.get(Fe);if(!je)continue;const Me=je.get(0)??0,st=(je.get(V(Ee)??0)??Me)-Me;if(st===0)continue;const ht=we.y<M.y;if(ht&&st<0||!ht&&st>0)continue;let tn;for(const[Un,ft]of je){const Ln=ft-Me;(ht&&Ln<0&&(!tn||Ln<tn.row)||!ht&&Ln>0&&(!tn||Ln>tn.row))&&(tn={band:Un,row:Ln})}tn&&oe.set(Ee.node.id,{lane:Ee.node.lane,band:tn.band})}}const Le=new Set;let Pe=0;for(;Pe++<E.nodes.length+2;){for(let pe=0;pe<E.nodes.length+E.flows.length+2;pe++){let be=!1;for(const et of E.flows){const ot=et.flow;if(Le.has(ot.id))continue;const At=p(ot.source);if(!At)continue;const Ft=p(ot.target),Ee=T.get(ot.target);if(!Ft&&Ee){const xe=St(Ee.node,Ee.band),ue=V(Ee);if(Ee.node.lane||ue!==void 0){const we=B(Ee.node),Fe=At,je=Fe.x+(me.get(ot.source)??0)+Fe.width+Se,Me=ge.get(ot.target)??oe.get(ot.target),st=I(we,xe,Me?Me.lane:Ee.node.lane,Me?Me.band:ue,le.has(ot.target)?Fe.x+Fe.width/2:je,Number.NaN,Me||!fn(ot.target)?void 0:Fe.y+Fe.height/2),ht=n.createShape(xe,st,we);le.has(ot.target)&&me.set(ot.target,je-(ht.x+ht.width/2)),n.connect(At,ht,{type:"bpmn:SequenceFlow",businessObject:dt(ot)})}else s.append(At,xe,{connection:{type:"bpmn:SequenceFlow",businessObject:dt(ot)}})}else if(Ft)n.connect(At,Ft,{type:"bpmn:SequenceFlow",businessObject:dt(ot)});else continue;Le.add(ot.id),be=!0}if(!be)break}const te=E.nodes.filter(pe=>!p(pe.node.id));if(!te.length)break;const se=te[0];{const pe=St(se.node,se.band),be=B(se.node),et=C(se);n.createShape(pe,I(be,pe,se.node.lane,et,O,L),be),!se.node.lane&&et===void 0&&(L+=160)}}}const l1=new Map;for(const[b,E]of P){const M=p(b),O=p(E.flow.target);if(!(M!=null&&M.target)||!O)continue;const L=M.label&&{x:M.label.x,y:M.label.y,width:M.label.width,height:M.label.height};l1.set(b,{waypoints:M.waypoints.map(B=>({x:B.x,y:B.y})),label:L});const k=M.target,F=B=>({x:B.x+B.width/2,y:B.y+B.height/2});n.reconnect(M,O,k,[F(O),F(k)]),n.layoutConnection(M,{waypoints:[]})}const Yr=40,up=b=>{const E=K=>K.kind==="label-over-line"||K.kind==="label-over-shape"||K.kind==="label-on-shared-segment"?K.edge===b.id:K.kind==="annotation-over-label"||K.kind==="pool-name-over-label"?K.label===b.id:!1,M=()=>new Set(pt(Ge(r)).filter(K=>!E(K)).map(K=>ct(K))),O=M(),L=b.waypoints.map(K=>({x:K.x,y:K.y})),k=b.label,F=k&&{x:k.x,y:k.y};n.layoutConnection(b,{waypoints:[]});const B=M(),I=[...B].filter(K=>!O.has(K)).length,z=[...O].filter(K=>!B.has(K)).length;I<=z||(n.updateWaypoints(b,L),k&&F&&(k.x!==F.x||k.y!==F.y)&&n.moveElements([k],{x:F.x-k.x,y:F.y-k.y}))},u1=5,Di=10,p1=200,yc=new Set([...N.map(b=>b.flow.id),...x.map(b=>b.flow.id),...Gt(e,"sequenceFlow.update").map(b=>b.id),...Gt(e,"messageFlow.update").map(b=>b.id)].filter(b=>!!b)),q5=(b,E,M,O,L,k)=>{const F=new Set(b.map(te=>te.id)),B=Math.min(...b.map(te=>te.x))+E-Di,I=Math.max(...b.map(te=>te.x+te.width))+E+p1+Di,z=Math.min(...b.map(te=>te.y+Math.min(0,...M)))-Di,K=Math.max(...b.map(te=>te.y+te.height+Math.max(0,...M)))+Di,ae=r.getAll().filter(te=>{if(te.type!=="bpmn:SequenceFlow"&&te.type!=="bpmn:MessageFlow")return!1;const se=te;return yc.has(se.id)||!se.waypoints||se.waypoints.length<2||[se.source,se.target].some(be=>!be||F.has(be.id)||be.x>=O)?!1:se.waypoints.some((be,et)=>{const ot=se.waypoints[et+1];return!!ot&&Math.max(be.x,ot.x)>=B&&Math.min(be.x,ot.x)<=I&&Math.max(be.y,ot.y)>=z&&Math.min(be.y,ot.y)<=K})});if(!ae.length)return 0;const le=te=>{const se=new Map;for(const pe of b)for(const be of M){const et={id:pe.id,type:pe.type,x:pe.x+E+te,y:pe.y+be,width:pe.width,height:pe.height};for(const ot of ae){let At=1/0;for(let Ee=0;Ee+1<ot.waypoints.length;Ee++)At=Math.min(At,cs(ot.waypoints[Ee],ot.waypoints[Ee+1],et));const Ft=`${ot.id}|${pe.id}`;se.set(Ft,Math.min(se.get(Ft)??1/0,At))}}return se},ge=[...le(0)].filter(([,te])=>te<=u1).map(([te])=>te);if(!ge.length)return 0;let oe=0;for(let te=1;te<=p1;te++){const se=le(te);if([...se.values()].every(pe=>pe>u1)&&ge.every(pe=>(se.get(pe)??1/0)>=Di)){oe=te;break}}if(!oe)return 0;const me=Math.min(...b.map(te=>te.x))+E+oe,Le=new Set(ge.map(te=>te.slice(0,te.indexOf("|"))));return ae.some(te=>te.type==="bpmn:SequenceFlow"&&Le.has(te.id)&&te.waypoints.some((se,pe)=>{const be=te.waypoints[pe+1];if(!be||Math.min(se.y,be.y)>k||Math.max(se.y,be.y)<k||se.y===be.y)return!1;const et=se.x+(k-se.y)*(be.x-se.x)/(be.y-se.y);return et>L&&et<me}))?0:oe},Kr=(b,E=()=>!0)=>{const M=p(b);if(!M)return[];const O=[M],L=new Set([b]);for(let k=0;k<O.length;k++){const F=O[k].id;for(const B of N){const I=B.flow.target;if(B.flow.source!==F||L.has(I)||!T.has(I))continue;L.add(I);const z=p(I);z&&E(z)&&O.push(z)}}return O},Y5=(b,E=()=>!0)=>{const M=p(b);if(!M)return[];const O=[M],L=new Set([b]);for(let k=0;k<O.length;k++){const F=O[k].id;for(const B of N){const I=B.flow.source;if(B.flow.target!==F||L.has(I)||!T.has(I))continue;L.add(I);const z=p(I);z&&E(z)&&O.push(z)}}return O},Li=30,Ii=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",Xa=(b,E)=>vf(n,b,E),Za=(b,E,M=!1)=>{const O=new Set(b.flatMap(I=>I.subtree.map(z=>z.id)));for(const I of b){const z=(I.pool.children??[]).filter(Ii).filter(ae=>!O.has(ae.id));if(I.subtree.some(ae=>z.some(le=>ae.x+E<le.x+le.width+Li&&ae.x+E+ae.width+Li>le.x&&ae.y<le.y+le.height&&ae.y+ae.height>le.y)))return null}const L=b.map(I=>I.pool.width),k=M?r.filter(I=>Array.isArray(I.waypoints)).map(I=>({c:I,wps:I.waypoints.map(z=>({x:z.x,y:z.y}))})):[],F=r.filter(I=>I.type==="label").map(I=>({label:I,x:I.x,y:I.y}));n.moveElements(b.flatMap(I=>I.subtree),{x:E,y:0});const B=b.map(I=>{const K=Math.max(...I.subtree.map(ae=>ae.x+ae.width))+Ey-(I.pool.x+I.pool.width);return K>0&&Xa(I.pool,I.pool.width+K),K});return()=>{n.moveElements(b.flatMap(I=>I.subtree),{x:-E,y:0}),b.forEach((I,z)=>{B[z]>0&&Xa(I.pool,L[z])});for(const{c:I,wps:z}of k){const K=I.waypoints??[];K.length===z.length&&K.every((le,ge)=>Math.abs(le.x-z[ge].x)<=.5&&Math.abs(le.y-z[ge].y)<=.5)||n.updateWaypoints(I,z.map(le=>({x:le.x,y:le.y})))}for(let I=0;I<3;I++){let z=0;for(const K of F){const ae=K.x-K.label.x,le=K.y-K.label.y;Math.abs(ae)<=.5&&Math.abs(le)<=.5||(n.moveElements([K.label],{x:ae,y:le}),z++)}if(!z)break}}},Eg=b=>{var L,k;const E=new Map,M=new Map;for(const F of r.getAll()){if(F.type!=="bpmn:Participant")continue;const B=F;(B.children??[]).length||(E.set(B.id,B),M.set(B.id,[]))}for(const F of r.getAll()){if(F.type!=="bpmn:MessageFlow")continue;const B=F,I=(L=B.source)==null?void 0:L.id,z=(k=B.target)==null?void 0:k.id;I&&z&&M.has(I)&&M.get(I).push(z),I&&z&&M.has(z)&&M.get(z).push(I)}const O=[];for(const[F,B]of M)B.length&&B.every(I=>b.has(I))&&O.push(E.get(F));return O},f1=(b,E)=>{if(!b.length)return null;const M=new Set(b.map(K=>K.id)),O=r.getAll().filter(K=>K.type==="bpmn:Participant"&&!M.has(K.id)),L=Math.min(...O.filter(K=>(K.children??[]).length>0).map(K=>K.x)),k=new Set(b.filter(K=>Math.abs(K.x-L)<=2).map(K=>K.id));if(b.some(K=>{const ae=k.has(K.id)?K.x:K.x+E,le=k.has(K.id)?K.width+E:K.width;return O.some(ge=>ae<ge.x+ge.width+Li&&ae+le+Li>ge.x&&K.y<ge.y+ge.height&&K.y+K.height>ge.y)}))return null;const B=r.filter(K=>K.type==="label").map(K=>({label:K,x:K.x,y:K.y})),I=b.filter(K=>!k.has(K.id)),z=b.filter(K=>k.has(K.id)).map(K=>({pool:K,was:{x:K.x,y:K.y,width:K.width,height:K.height}}));I.length&&n.moveElements(I,{x:E,y:0});for(const{pool:K,was:ae}of z)n.resizeShape(K,{...ae,width:ae.width+E});return()=>{for(const{pool:K,was:ae}of z)n.resizeShape(K,ae);I.length&&n.moveElements(I,{x:-E,y:0});for(let K=0;K<3;K++){let ae=0;for(const le of B){const ge=le.x-le.label.x,oe=le.y-le.label.y;Math.abs(ge)<=.5&&Math.abs(oe)<=.5||(n.moveElements([le.label],{x:ge,y:oe}),ae++)}if(!ae)break}}},d1=(b,E,M)=>{const O=M.x+M.width/2,L=E.y>M.y,k=L?M.y+M.height:M.y,F=L?E.y:E.y+E.height,B=b.source===E?[{x:O,y:F},{x:O,y:k}]:[{x:O,y:k},{x:O,y:F}],I=Ge(r),z={...I.edges.find(K=>K.id===b.id),waypoints:B};return zt(z,zn(I)).length?!1:(n.updateWaypoints(b,B),!0)},K5=()=>{const b=r.filter(F=>F.type==="bpmn:Participant"),E=Math.min(...b.filter(F=>(F.children??[]).length>0).map(F=>F.x)),M=F=>h.some(B=>B.participant.id===F.id),O=F=>!!F&&F.type==="bpmn:Participant"&&!(F.children??[]).length&&Math.abs(F.x-E)<=2&&!M(F),L=F=>!!F&&F.type==="bpmn:Participant"&&(F.children??[]).length>0&&!M(F),k=new Set;for(const F of r.getAll()){if(F.type!=="bpmn:MessageFlow")continue;const B=F;if((B.waypoints??[]).length!==2)continue;const I=[B.source,B.target].find(ae=>O(ae)||L(ae)),z=I===B.source?B.target:B.source;if(!I||!z||z.type==="bpmn:Participant")continue;const K=z.x+z.width/2;L(I)&&(K<I.x||K>I.x+I.width)||k.add(B.id)}return k},X5=b=>{var M;const E=new Map;for(const O of b){const L=r.get(O);if(!L||(L.waypoints??[]).length===2)continue;const k=((M=L.source)==null?void 0:M.type)==="bpmn:Participant"?L.source:L.target,F=k===L.source?L.target:L.source;if(F.x+F.width/2<=k.x+k.width)continue;const B=E.get(k.id)??{pool:k,msgs:[]};B.msgs.push({conn:L,other:F}),E.set(k.id,B)}for(const{pool:O,msgs:L}of E.values()){const k=Math.max(...L.map(({other:oe})=>oe.x+oe.width/2))+mf;if(r.getAll().some(oe=>{if(oe.type!=="bpmn:Participant"||oe.id===O.id)return!1;const me=oe;return O.x<me.x+me.width+Li&&k+Li>me.x&&O.y<me.y+me.height&&O.y+O.height>me.y}))continue;const B={x:O.x,y:O.y,width:O.width,height:O.height},I=[...O.incoming??[],...O.outgoing??[]],z=I.map(oe=>({c:oe,wps:(oe.waypoints??[]).map(me=>({x:me.x,y:me.y}))})),K=I.flatMap(oe=>{const me=oe.label;return me?[{label:me,x:me.x,y:me.y}]:[]}),ae=br();Xa(O,k-O.x);const le=L.filter(({conn:oe,other:me})=>d1(oe,O,me)).length,ge=br();if(!(le>0&&ge.messages>ae.messages&&ge.lines>=ae.lines)){Xa(O,B.width);for(const{c:oe,wps:me}of z){const Le=oe.waypoints??[];Le.length===me.length&&Le.every((te,se)=>Math.abs(te.x-me[se].x)<=.5&&Math.abs(te.y-me[se].y)<=.5)||n.updateWaypoints(oe,me.map(te=>({x:te.x,y:te.y})))}for(let oe=0;oe<3;oe++){let me=0;for(const Le of K){const Pe=Le.x-Le.label.x,te=Le.y-Le.label.y;Math.abs(Pe)<=.5&&Math.abs(te)<=.5||(n.moveElements([Le.label],{x:Pe,y:te}),me++)}if(!me)break}}}},h1=()=>{let b=0;for(const E of r.getAll()){if(E.type!=="bpmn:DataInputAssociation"&&E.type!=="bpmn:DataOutputAssociation")continue;const M=E.waypoints??[];for(let O=1;O<M.length;O++)b+=Math.hypot(M[O].x-M[O-1].x,M[O].y-M[O-1].y)}return b},g1=()=>{let b=0;for(const E of r.getAll()){if(E.type!=="bpmn:Association")continue;const M=E.waypoints??[];for(let O=1;O<M.length;O++)b+=Math.hypot(M[O].x-M[O-1].x,M[O].y-M[O-1].y)}return b},Z5=b=>{const E=[];for(const M of r.getAll()){if(M.type!=="bpmn:TextAnnotation")continue;const O=M;if(b.has(O.id))continue;const k=[...O.incoming??[],...O.outgoing??[]].filter(I=>I.type==="bpmn:Association").map(I=>I.source===O?I.target:I.source);if(!k.length||k.some(I=>I===void 0))continue;const F=I=>{if(!("waypoints"in I&&I.waypoints))return[I.id];const z=I,K=[z.source,z.target];return K.some(ae=>!ae)?[]:K.map(ae=>ae.id)},B=k.flatMap(I=>F(I));B.length&&B.every(I=>b.has(I))&&E.push(O)}return E},m1=()=>pt(Ge(r)).filter(b=>b.kind==="edge-crosses-shape").length,y1=b=>{const E=(b.children??[]).filter(Ii);let M=0;for(let O=0;O<E.length;O++)for(let L=O+1;L<E.length;L++){const k=E[O],F=E[L];k.x<F.x+F.width&&k.x+k.width>F.x&&k.y<F.y+F.height&&k.y+k.height>F.y&&M++}return M},br=()=>{const b=Ge(r),E=M=>M.length>=2&&(M.every(O=>Math.abs(O.x-M[0].x)<.01)||M.every(O=>Math.abs(O.y-M[0].y)<.01));return{messages:b.edges.filter(M=>M.type==="bpmn:MessageFlow"&&M.waypoints.length===2).length,lines:b.edges.filter(M=>E(M.waypoints)).length}},v1=b=>{const E=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,F=L.target;if(!k||!F)continue;const B=b.has(k.id);if(B===b.has(F.id))continue;const I=B?F:k,z=d(I);if(!z||b.has(I.id))continue;const K=E.get(z.id);K?I.x<K.minX&&(K.minX=I.x):E.set(z.id,{pool:z,minX:I.x})}const M=[];for(const{pool:O,minX:L}of E.values()){const k=(O.children??[]).filter(F=>Ii(F)&&!b.has(F.id)&&F.x>=L);k.length&&M.push({subtree:k,pool:O})}return M},Q5=(b,E,M)=>{const O=new Map(E.map(F=>[F.pool.id,{subtree:[...F.subtree],pool:F.pool}])),L=new Set(b);for(const F of E)for(const B of F.subtree)L.add(B.id);let k=!1;for(;;){let F=0;for(const B of v1(L)){if(B.pool===M)continue;const I=O.get(B.pool.id);I?I.subtree.push(...B.subtree):O.set(B.pool.id,{subtree:[...B.subtree],pool:B.pool});for(const z of B.subtree)L.add(z.id);F+=B.subtree.length}if(!F)break;k=!0}return k?[...O.values()]:null},J5=(b,E)=>{const M=new Map;for(const L of r.getAll()){if(L.type!=="bpmn:DataInputAssociation"&&L.type!=="bpmn:DataOutputAssociation")continue;const k=L,F=k.waypoints;if(!F||F.length<2||!F.every(ge=>Math.abs(ge.x-F[0].x)<1))continue;const B=k.source,I=k.target;if(!B||!I)continue;const z=b.has(B.id);if(z===b.has(I.id))continue;const K=z?I:B,ae=d(K);if(!ae||ae===E||ae===d(z?B:I))continue;const le=M.get(ae.id);le?K.x<le.minX&&(le.minX=K.x):M.set(ae.id,{pool:ae,minX:K.x})}const O=[];for(const{pool:L,minX:k}of M.values()){const F=(L.children??[]).filter(B=>Ii(B)&&!b.has(B.id)&&B.x>=k);F.length&&O.push({subtree:F,pool:L})}return O},b1=b=>{const E=Ge(r),M=E.shapes.filter(L=>b.has(L.id)),O=new Set;for(const L of E.edges)if(!(L.type!=="bpmn:SequenceFlow"&&L.type!=="bpmn:MessageFlow"))for(const k of zt(L,M))O.add(`${L.id}|${k.id}`);return O},Sg=new Map,e3=Gt(e,"sequenceFlow.update").flatMap(b=>{if(b.target!==void 0)return[{id:b.id,target:b.target,source:b.source}];const E=P.get(b.id);return E?[{id:b.id,target:E.flow.target,source:E.flow.source}]:[]});for(const b of e3){if(b.target===void 0)continue;const E=T.get(b.target);if(!E)continue;const M=p(b.target),O=p(b.id);if(!M||!O)continue;const L=b.source!==void 0?p(b.source):O.source,k=O.target;if(!L||!k||k.id===M.id)continue;const F=l1.get(O.id)??{waypoints:O.waypoints,label:O.label},B=F.waypoints&&F.waypoints.length>=3&&Math.abs(F.waypoints[0].x-F.waypoints[1].x)<1&&Math.abs(F.waypoints[0].y-F.waypoints[1].y)>1?{x:F.waypoints[0].x,y:F.waypoints[0].y}:void 0,I=B?F.waypoints[1].y:void 0,z=B&&F.label?{x:F.label.x,y:F.label.y}:void 0,K=z&&F.label&&Math.abs(z.y+F.label.height/2-I)<=ee/5&&z.x+F.label.width>B.x?z.x+F.label.width+6:void 0,ae=(L.outgoing??[]).filter(Oe=>Oe.type==="bpmn:SequenceFlow"&&Oe.id!==O.id&&Oe.target&&!yc.has(Oe.id)),le=new Set(ae.map(Oe=>Oe.target.id)),ge=Oe=>{const Pt={type:"bpmn:Task",x:Oe.x+2,y:Oe.y+2,width:Oe.width-4,height:Oe.height-4};return ae.find(_t=>(_t.waypoints??[]).some((dn,Ie)=>!!_t.waypoints[Ie+1]&&cs(dn,_t.waypoints[Ie+1],Pt)===0))},oe=Kr(b.target),me=new Set(oe.map(Oe=>Oe.id)),Le=yr.has(b.target)?{autoResize:!1}:void 0,Pe=Math.min(...oe.map(Oe=>Oe.x)),te=Math.max(...oe.map(Oe=>Oe.x+Oe.width)),se=L.x+L.width,pe=k.x+k.width<=L.x,be=(()=>{if(!pe)return;const Oe=d(M),Pt=((Oe==null?void 0:Oe.children)??[]).filter(Ne=>Ii(Ne)&&!me.has(Ne.id)&&Ne.type!=="bpmn:Group"&&Ne.type!=="bpmn:Participant"),_t=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],dn=r.getAll().filter(Ne=>{if(!_t.includes(Ne.type))return!1;const Bt=Ne;return Bt.id===O.id||yc.has(Bt.id)||!Bt.waypoints||Bt.waypoints.length<2?!1:![Bt.source,Bt.target].some(Tt=>!Tt||me.has(Tt.id))}),Ie=(Ne,Bt)=>oe.every(Tt=>{var Jr;const xt={id:Tt.id,type:Tt.type,x:Tt.x+Ne,y:Tt.y+Bt,width:Tt.width,height:Tt.height};return Oe&&(xt.x<Oe.x||xt.x+xt.width>Oe.x+Oe.width||xt.y<Oe.y||xt.y+xt.height>Oe.y+Oe.height)||!vi((Jr=T.get(Tt.id))==null?void 0:Jr.node.lane,Tt,Tt.y+Bt+Tt.height/2)||Pt.some(qn=>xt.x<qn.x+qn.width+Di&&xt.x+xt.width+Di>qn.x&&xt.y<qn.y+qn.height+Di&&xt.y+xt.height+Di>qn.y)?!1:dn.every(qn=>{for(let uo=0;uo+1<qn.waypoints.length;uo++)if(cs(qn.waypoints[uo],qn.waypoints[uo+1],xt)<Di)return!1;return!0})}),Xe=L.x+L.width/2,bt=L.y+L.height/2,Qe=F.waypoints??[],Mt=Qe.length>=2&&Math.abs(Qe[0].y-Qe[1].y)<1&&Qe[1].x<Qe[0].x;return[...I!==void 0?[{cx:Xe,cy:I}]:[],...Mt?[{cx:L.x-Yr-M.width/2,cy:Qe[0].y}]:[],{cx:Xe,cy:bt+ee},{cx:Xe,cy:bt-ee}].find(Ne=>Ie(Ne.cx-(M.x+M.width/2),Ne.cy-(M.y+M.height/2)))})(),et=pe&&!be?se:k.x,ot=M.y+M.height/2,At=q5(oe,se+Yr-Pe,[0,L.y+L.height/2-ot,k.y+k.height/2-ot],et,se,L.y+L.height/2),Ft=se+Yr+At,Ee=(()=>{if(K===void 0)return 0;const Oe=se+Yr,Pt=L.y+L.height/2-M.height/2,_t={x:Oe,y:Pt,width:te-Pe,height:M.height},dn=d(L);return((dn==null?void 0:dn.children)??[]).some(Xe=>Ii(Xe)&&!me.has(Xe.id)&&Xe.id!==L.id&&Xe.id!==k.id&&Xe.type!=="bpmn:Group"&&Xe.type!=="bpmn:Participant"&&Xe.x<_t.x+_t.width&&Xe.x+Xe.width>_t.x&&Xe.y<_t.y+_t.height&&Xe.y+Xe.height>_t.y)||ge(_t)?Math.max(0,K-Oe):0})(),xe=be?0:te-Pe+Yr*2+At+Ee-(pe?0:k.x-se);let ue=[];if(xe>0){const Oe=d(M),Pt=(Oe==null?void 0:Oe.children)??[],_t=Qe=>Qe.type==="bpmn:Lane";ue=(()=>{const Qe=new Set;for(const He of Pt)Ii(He)&&!me.has(He.id)&&He.id!==L.id&&He.x>=et&&Qe.add(He.id);const Mt=[];for(const He of Pt){if(He.type!=="bpmn:DataStoreReference"&&He.type!=="bpmn:DataObjectReference")continue;const Ne=He,Tt=[...Ne.incoming??[],...Ne.outgoing??[]].filter(xt=>xt.type==="bpmn:DataInputAssociation"||xt.type==="bpmn:DataOutputAssociation").map(xt=>xt.source===Ne?xt.target:xt.source);Tt.length&&Tt.every(xt=>xt!==void 0&&Qe.has(xt.id))&&Mt.push(Ne)}return Mt})();const Ie=Pt.filter(Qe=>!("waypoints"in Qe&&Qe.waypoints)&&!_t(Qe)&&Qe.type!=="label"&&!me.has(Qe.id)&&Qe.id!==L.id&&Qe.x>=et),Xe=Ie.flatMap(Qe=>Qe.labels??[]),bt=Oe?[Oe,...Pt.filter(Qe=>_t(Qe))]:[];if(Ie.length){const Qe=new Set(Ie.map(tt=>tt.id)),Mt=v1(Qe),He=Mt.length?Q5(Qe,Mt,Oe):null,Ne=tt=>{const wt=new Set(Qe);for(const Nt of tt)for(const Do of Nt.subtree)wt.add(Do.id);return Z5(wt)},Bt=Ne(Mt),Tt=He?Ne(He):Bt,xt=Eg(Qe),Jr=new Set(Qe);for(const tt of Mt)for(const wt of tt.subtree)Jr.add(wt.id);const qn=Mt.length?Eg(Jr):xt,uo=(()=>{if(!He)return[];const tt=new Set(Qe);for(const wt of He)for(const Nt of wt.subtree)tt.add(Nt.id);return Eg(tt)})(),es=He??Mt,ea=(()=>{const tt=new Set(Qe);for(const wt of es)for(const Nt of wt.subtree)tt.add(Nt.id);return J5(tt,Oe)})(),Og=ea.length?Ne([...es,...ea]):Bt,Wi=new Set([...Ie,...bt].map(tt=>tt.id)),vt=Pt.filter(tt=>{const wt=tt.labelTarget;return tt.type==="label"&&!!wt&&"waypoints"in wt&&!!wt.source&&!!wt.target&&Wi.has(wt.source.id)&&Wi.has(wt.target.id)}),wn=K5();n.createSpace([...Ie,...Xe,...vt],bt,{x:xe,y:0},"e",et-1);const Xt=(tt,wt,Nt)=>{const Do=br(),yp=Nt?b1(Nt):null,vp=Za(tt,xe,!!Nt);if(!vp)return!1;const xc=wt.length?f1(wt,xe):null,bp=br(),Zt=!!Nt&&!!yp&&[...b1(Nt)].some(na=>!yp.has(na));return bp.messages>Do.messages&&bp.lines>=Do.lines&&!Zt?!0:(xc==null||xc(),vp(),!1)},ui=ea.length>0&&Xt([...es,...ea],He?uo:qn,new Set(ea.flatMap(tt=>tt.subtree.map(wt=>wt.id)))),ta=!ui&&He?Xt(He,uo):!1;let po=ui||ta;!po&&Mt.length&&(po=Xt(Mt,qn));const ts=ui?Og:ta?Tt:Bt;if(!po){for(const tt of Mt){const wt=br(),Nt=Za([tt],xe);if(!Nt)continue;const Do=br();(Do.messages<=wt.messages||Do.lines<wt.lines)&&Nt()}if(xt.length){const tt=br(),wt=f1(xt,xe);if(wt){const Nt=br();(Nt.messages<=tt.messages||Nt.lines<tt.lines)&&wt()}}}if(X5(wn),ts.length){const tt=()=>new Set(pt(Ge(r)).map(Nt=>ct(Nt))),wt=Nt=>{const Do=g1(),yp=tt(),vp=Nt.map(Zt=>({a:Zt,x:Zt.x,y:Zt.y})),xc=r.filter(Zt=>Zt.type==="label").map(Zt=>({label:Zt,x:Zt.x,y:Zt.y}));n.moveElements(Nt,{x:xe,y:0});const bp=[...tt()].filter(Zt=>!yp.has(Zt));if(g1()<Do&&bp.length===0)return!0;for(const{a:Zt,x:na,y:wc}of vp)(Zt.x!==na||Zt.y!==wc)&&n.moveElements([Zt],{x:na-Zt.x,y:wc-Zt.y});for(const Zt of xc){const na=Zt.x-Zt.label.x,wc=Zt.y-Zt.label.y;(na!==0||wc!==0)&&n.moveElements([Zt.label],{x:na,y:wc})}return!1};if(!wt(ts)&&ts.length>1)for(const Nt of ts)wt([Nt])}}}const we=E.node.lane!==void 0?p(E.node.lane):E.node.participant!==void 0?p(E.node.participant):void 0,Fe=Oe=>{if(!we)return!0;const Pt=Oe.y+Oe.height/2;return Pt>=we.y&&Pt<=we.y+we.height},je=!Fe(L)&&Fe(k),Me=Oe=>Oe.y+Oe.height/2,st=()=>{const Oe=L.x+L.width,Pt=k.x,_t=Me(k)-M.height/2,dn=Me(k)+M.height/2;return!r.getAll().some(Ie=>Ii(Ie)&&Ie.type!=="bpmn:Participant"&&Ie.type!=="bpmn:Group"&&Ie.type!=="bpmn:TextAnnotation"&&Ie.id!==L.id&&Ie.id!==k.id&&Ie.id!==M.id&&Ie.x<Pt&&Ie.x+Ie.width>Oe&&Ie.y<dn&&Ie.y+Ie.height>_t)},ht=!je&&E.band!==void 0&&Fe(k)&&!Ze(E.node.lane,E.node.participant,E.band,Me(L))&&Ze(E.node.lane,E.node.participant,E.band,Me(k))&&k.x>=L.x+L.width&&st(),tn=je||ht?k:L,Un=tn.y+tn.height/2,ft=Un-(M.y+M.height/2),Ln=E.band!==void 0,mp=Ln?[M]:oe,kg=(E.band===void 0||Ze(E.node.lane,E.node.participant,E.band,Un))&&fn(b.target)&&mp.every(Oe=>{var Pt;return vi((Pt=T.get(Oe.id))==null?void 0:Pt.node.lane,Oe,Oe.y+Oe.height/2+ft)}),E3=Oe=>Math.abs(Oe.y+Oe.height/2-(M.y+M.height/2))<=ee/2;if(kg&&Ln){const Oe=Math.abs(ft)<=ee/2?oe.filter(Ie=>Ie.id!==M.id&&E3(Ie)):[],Pt=M.y+M.height/2,dn=E.band!==void 0&&!Ze(E.node.lane,E.node.participant,E.band,Pt)?oe.filter(Ie=>{var Xe,bt;return Ie.id!==M.id&&!Oe.includes(Ie)&&((Xe=T.get(Ie.id))==null?void 0:Xe.band)===E.band&&((bt=T.get(Ie.id))==null?void 0:bt.node.lane)===E.node.lane&&(Math.abs(Ie.y+Ie.height/2-Pt)<=ee/2||Ze(E.node.lane,E.node.participant,E.band,Ie.y+Ie.height/2))}).map(Ie=>({t:Ie,dy:Un-(Ie.y+Ie.height/2)})).filter(({dy:Ie})=>Ie!==0):[];if(n.moveElements(oe,{x:Ft-Pe,y:0},void 0,Le),n.moveElements([M],{x:0,y:ft},void 0,Le),Oe.length){const Ie=()=>new Set(pt(Ge(r)).map(Ne=>ct(Ne))),Xe=Ie(),bt=r.filter(Ne=>Ne.type==="label").map(Ne=>({label:Ne,x:Ne.x,y:Ne.y}));n.moveElements(Oe,{x:0,y:ft});const Qe=Ie(),Mt=[...Qe].filter(Ne=>!Xe.has(Ne)).length,He=[...Xe].filter(Ne=>!Qe.has(Ne)).length;if(Mt>He){n.moveElements(Oe,{x:0,y:-ft});for(const Ne of bt){const Bt=Ne.x-Ne.label.x,Tt=Ne.y-Ne.label.y;(Bt!==0||Tt!==0)&&n.moveElements([Ne.label],{x:Bt,y:Tt})}}}if(dn.length){const Ie=new Set(oe.map(Xe=>Xe.id));for(const{t:Xe,dy:bt}of dn)X(Xe.parent,Xe,Xe.x+Xe.width/2,Xe.y+Xe.height/2+bt,Ie)||n.moveElements([Xe],{x:0,y:bt})}}else n.moveElements(oe,{x:Ft-Pe,y:kg?ft:0},void 0,Le);const Vi=d(M);if(!kg&&E.node.lane===void 0&&E.band!==void 0&&Vi){const Oe=Vi.y+De+Re(`pool:${E.node.participant??""}`,E.band)*ee,Pt=Oe-(M.y+M.height/2);Pt!==0&&!X(Vi,M,M.x+M.width/2,Oe,me)&&n.moveElements([M],{x:0,y:Pt},void 0,Le)}if(be)n.moveElements(oe,{x:be.cx-(M.x+M.width/2),y:be.cy-(M.y+M.height/2)},void 0,Le);else if(Vi){const Oe=(Vi.children??[]).filter(Ie=>Ii(Ie)&&!me.has(Ie.id)&&Ie.type!=="bpmn:Group"&&Ie.type!=="bpmn:Participant"),Pt=(Ie,Xe,bt,Qe,Mt)=>Ie.x+Xe<Mt.x+Mt.width+Qe&&Ie.x+Xe+Ie.width+Qe>Mt.x&&Ie.y+bt<Mt.y+Mt.height+Qe&&Ie.y+bt+Ie.height+Qe>Mt.y,_t=Oe.find(Ie=>Pt(M,0,0,0,Ie)),dn=_t?void 0:ge(M);if(_t||dn){const Ie=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Xe=r.getAll().filter(vt=>{if(!Ie.includes(vt.type))return!1;const wn=vt;return yc.has(wn.id)||!wn.waypoints||wn.waypoints.length<2?!1:![wn.source,wn.target].some(Xt=>!Xt||me.has(Xt.id))}),bt=(vt,wn,Xt)=>{var ui;return vi((ui=T.get(vt.id))==null?void 0:ui.node.lane,vt,vt.y+Xt+vt.height/2)&&vt.x+wn>=Vi.x&&vt.x+wn+vt.width<=Vi.x+Vi.width&&vt.y+Xt>=Vi.y&&vt.y+Xt+vt.height<=Vi.y+Vi.height},Qe=(vt,wn)=>oe.every(Xt=>bt(Xt,vt,wn)&&!Oe.some(ui=>Pt(Xt,vt,wn,Di,ui))&&Xe.every(ui=>{const ta={id:Xt.id,type:Xt.type,x:Xt.x+vt,y:Xt.y+wn,width:Xt.width,height:Xt.height};for(let po=0;po+1<ui.waypoints.length;po++)if(cs(ui.waypoints[po],ui.waypoints[po+1],ta)<Di)return!1;return!0})),Mt=M.y+M.height/2,He=[I,k.y+k.height/2].filter(vt=>vt!==void 0&&Math.abs(vt-Mt)>=1),Ne=_t&&le.has(_t.id)?_t:dn==null?void 0:dn.target,Bt=Ne?Ne.x-M.x:0,Tt=Math.max(...oe.map(vt=>vt.x+vt.width)),xt=[...Bt!==0?[Bt]:[],...At!==0?[-At]:[],0],Jr=K===void 0?[]:xt.map(vt=>Math.max(vt,K-M.x)),qn=vt=>Tt+vt+Yr<=k.x,uo=[...new Set([...Jr,...xt])].filter(qn),es=_t&&le.has(_t.id)?[_t.x+_t.width+Yr-M.x]:[],ea=K===void 0?[]:es.map(vt=>Math.max(vt,K-M.x)),Og=[...new Set([...ea,...es])].filter(vt=>qn(vt)&&!uo.includes(vt));let Wi;for(const vt of[uo,Og]){for(const wn of He){for(const Xt of vt)if(Qe(Xt,wn-Mt)){Wi={dx:Xt,dy:wn-Mt};break}if(Wi)break}if(Wi)break}if(Wi){const vt=tt=>{const wt=tt;return[wt.edge,wt.other,...Array.isArray(wt.edges)?wt.edges:[]].some(Nt=>typeof Nt=="string"&&yc.has(Nt))},wn=()=>new Set(pt(Ge(r)).filter(tt=>!vt(tt)).map(tt=>ct(tt))),Xt=wn(),ui=r.filter(tt=>tt.type==="label").map(tt=>({label:tt,x:tt.x,y:tt.y}));n.moveElements(oe,{x:Wi.dx,y:Wi.dy},void 0,Le);const ta=wn(),po=[...ta].filter(tt=>!Xt.has(tt)).length,ts=[...Xt].filter(tt=>!ta.has(tt)).length;if(po>ts){n.moveElements(oe,{x:-Wi.dx,y:-Wi.dy},void 0,Le);for(const tt of ui){const wt=tt.x-tt.label.x,Nt=tt.y-tt.label.y;(wt!==0||Nt!==0)&&n.moveElements([tt.label],{x:wt,y:Nt})}}else B&&Sg.set(O.id,{exit:B,channelY:I,label:z})}}}{const Oe=new Set(oe.map(Xe=>Xe.id)),Pt=new Set(N.map(Xe=>Xe.flow.id)),_t=20,dn=Xe=>{const bt=Xe.source,Qe=Xe.target,Mt=Math.min(bt.x,Qe.x)-_t,He=Math.max(bt.x+bt.width,Qe.x+Qe.width)+_t,Ne=Math.min(bt.y,Qe.y)-_t,Bt=Math.max(bt.y+bt.height,Qe.y+Qe.height)+_t;return Xe.waypoints.some(Tt=>Tt.x<Mt||Tt.x>He||Tt.y<Ne||Tt.y>Bt)},Ie=new Map;for(const Xe of oe)for(const bt of[...Xe.incoming??[],...Xe.outgoing??[]])(P.has(bt.id)||bt.id!==b.id&&Pt.has(bt.id))&&!(Oe.has(bt.source.id)&&Oe.has(bt.target.id))&&Ie.set(bt.id,bt);for(const Xe of Ie.values())dn(Xe)&&up(Xe)}const lo=ue.length?d(ue[0]):void 0;if(lo){const Oe={assoc:h1(),overlaps:y1(lo),crosses:m1()},Pt=ue.map(He=>({st:He,x:He.x})),_t=r.filter(He=>He.type==="label").map(He=>({label:He,x:He.x,y:He.y})),dn=Math.min(...ue.flatMap(He=>[...He.incoming??[],...He.outgoing??[]].filter(Ne=>Ne.type==="bpmn:DataInputAssociation"||Ne.type==="bpmn:DataOutputAssociation").map(Ne=>(Ne.source===He?Ne.target:Ne.source).x))),Ie=new Set(ue.map(He=>He.id)),Xe=(lo.children??[]).filter(Ii).filter(He=>!Ie.has(He.id));let bt=dn;for(const He of[...ue].sort((Ne,Bt)=>Ne.x-Bt.x)){let Ne=bt;for(let Bt=0;Bt<100;Bt++){const Tt=Xe.find(xt=>Ne<xt.x+xt.width+Li&&Ne+He.width+Li>xt.x&&He.y<xt.y+xt.height&&He.y+He.height>xt.y);if(!Tt)break;Ne=Tt.x+Tt.width+Li}Ne!==He.x&&n.moveElements([He],{x:Ne-He.x,y:0}),bt=Ne+He.width+Li}const Qe=bt+150-(lo.x+lo.width);Qe>0&&Xa(lo,lo.width+Qe);const Mt={assoc:h1(),overlaps:y1(lo),crosses:m1()};if(Mt.assoc>=Oe.assoc||Mt.overlaps>Oe.overlaps||Mt.crosses>Oe.crosses){for(const{st:He,x:Ne}of Pt)He.x!==Ne&&n.moveElements([He],{x:Ne-He.x,y:0});Qe>0&&Xa(lo,lo.width-Qe);for(const He of _t){const Ne=He.x-He.label.x,Bt=He.y-He.label.y;(Ne!==0||Bt!==0)&&n.moveElements([He.label],{x:Ne,y:Bt})}}}}for(const[b,E]of yr){const M=p(b);if(!M)continue;const O=E.container,L=Math.abs(M.y+M.height/2-O.y-E.relCy)>=.5,k=M.label,F=Math.min(M.y,k&&!k.hidden?k.y:M.y),B=Math.max(M.y+M.height,k&&!k.hidden?k.y+k.height:0);if(L&&F>=O.y&&B<=O.y+O.height)continue;const I=M.y;E.grow(),M.y!==I&&n.moveElements([M],{x:0,y:I-M.y},void 0,{autoResize:!1})}const x1=(b,E)=>{const M=E.target===b,O=f(E.source),L=f(E.target),k=M?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,L,E.id?{type:k,businessObject:i.create(k,{id:E.id})}:{type:k})},w1=b=>{for(const E of h){if(!E.participant.blackBox)continue;const M=p(E.participant.id);if(!M)continue;const O=[];for(const k of x){const F=k.flow.source===E.participant.id?k.flow.target:k.flow.target===E.participant.id?k.flow.source:void 0,B=F?p(F):void 0;B&&typeof B.x=="number"&&B.type!=="bpmn:Participant"&&O.push(B)}if(!O.length)continue;if(!b&&E.order===void 0){const k=(()=>{var B;const F=new Map;for(const I of O){const z=d(I);if(!z)continue;const K=F.get(z.id);K?K.n+=1:F.set(z.id,{shape:z,n:1})}return(B=[...F.values()].sort((I,z)=>z.n-I.n)[0])==null?void 0:B.shape})();if(k){const F=z=>z.reduce((K,ae)=>K+ae,0)/z.length,B=F(O.map(z=>z.y+z.height/2))<k.y+k.height/2,I=r.filter(z=>z.type==="bpmn:Participant"&&z.id!==E.participant.id&&z.id!==k.id).filter(z=>B?z.y+z.height<=k.y+5:z.y>=k.y+k.height-5);if(I.length){const z=[...I.reduce((pe,be)=>pe.set(be.y,(pe.get(be.y)??0)+1),new Map)].sort((pe,be)=>be[1]-pe[1]||(B?be[0]-pe[0]:pe[0]-be[0]))[0][0],K=Math.min(M.width,_M),ae=EM,le=O.map(pe=>pe.x+pe.width/2),ge=Math.round(F(le)-K/2),oe=Math.max(...le)+mf,me=pe=>({x:pe,width:Math.max(K,oe-pe)}),Le=I.filter(pe=>Math.min(pe.y+pe.height,z+ae)-Math.max(pe.y,z)>0),Pe=pe=>{const be=me(pe);return Le.some(et=>et.x<be.x+be.width&&be.x<et.x+et.width)},te=pe=>{const be=me(pe);return le.filter(et=>et>=be.x+10&&et<=be.x+be.width-10).length},se=(()=>{if(!Pe(ge))return ge;const pe=te(ge);return Le.flatMap(be=>[be.x+be.width+yy,be.x-yy-K]).map(be=>Math.round(be)).filter(be=>!Pe(be)&&te(be)>=pe).sort((be,et)=>Math.abs(be-ge)-Math.abs(et-ge))[0]??ge})();if(se!==M.x||z!==M.y||K!==M.width||ae!==M.height){const pe=()=>new Set(pt(Ge(r)).map(Ee=>ct(Ee))),be=pe(),et={x:M.x,y:M.y,width:M.width,height:M.height};n.resizeShape(M,{x:se,y:z,width:K,height:ae});const ot=pe(),At=[...ot].filter(Ee=>!be.has(Ee)).length,Ft=[...be].filter(Ee=>!ot.has(Ee)).length;At>Ft&&n.resizeShape(M,et)}}}}const L=Math.max(...O.map(k=>k.x+k.width/2))+mf;if(L>M.x+M.width&&n.resizeShape(M,{x:M.x,y:M.y,width:L-M.x,height:M.height}),!!b)for(const k of x){const F=p(k.flow.id),B=k.flow.source===E.participant.id?k.flow.target:k.flow.target===E.participant.id?k.flow.source:void 0,I=B?p(B):void 0;if(!F||!I||I.type==="bpmn:Participant")continue;const z=I.x+I.width/2;z<M.x+10||z>M.x+M.width-10||d1(F,M,I)}}};w1(!1);for(const b of x){const E=b.flow;n.connect(f(E.source),f(E.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:E.id,name:E.name})})}{const M=new Set([...N.map(I=>I.flow.id),...x.map(I=>I.flow.id)].filter(I=>!!I)),O=r.filter(I=>!!I.waypoints),L=(I,z)=>Math.abs(z.x-I.x)<2?"L":Math.abs(z.x-(I.x+I.width))<2?"R":Math.abs(z.y-I.y)<2?"T":Math.abs(z.y-(I.y+I.height))<2?"B":void 0,k=new Map,F=(I,z,K)=>{if(!I||!z||typeof I.x!="number")return;const ae=L(I,z);if(!ae)return;let le=k.get(I.id);le||k.set(I.id,le=new Map),le.set(ae,[...le.get(ae)??[],K])};for(const I of O){const z=I.waypoints;!z||z.length<2||(F(I.source,z[0],{id:I.id,dir:"out"}),F(I.target,z[z.length-1],{id:I.id,dir:"in"}))}const B=new Set;for(const[I,z]of k){const K=p(I);if(!K||typeof K.x!="number")continue;const ae=te=>{var pe;const se=(pe=p(te.id))==null?void 0:pe.source;return!!se&&typeof se.x=="number"&&se.x+se.width/2>K.x+K.width/2};if(![...z.values()].some(te=>te.length>=3&&te.some(se=>se.dir==="out")&&te.some(se=>se.dir==="in"&&M.has(se.id)&&ae(se))))continue;const ge=d(K);if(!ge||B.has(ge.id)||(ge.children??[]).some(te=>te.type==="bpmn:Lane"))continue;const oe=(j1=z.get("T"))!=null&&j1.length?(H1=z.get("B"))!=null&&H1.length?void 0:"B":"T";if(!oe||(oe==="T"?K.y-ge.y:ge.y+ge.height-(K.y+K.height))>=ee)continue;const Le=(ge.children??[]).filter(te=>!("waypoints"in te&&te.waypoints)&&te.type!=="label"&&typeof te.x=="number"),Pe=ge.y+ge.height;n.resizeShape(ge,{x:ge.x,y:ge.y,width:ge.width,height:ge.height+ee}),Et(Pe,ge.id,ee),oe==="T"&&Le.length&&n.moveElements(Le,{x:0,y:ee}),B.add(ge.id)}}const Rg=20,_1=4,t3=3,n3=2,i3=[10,30,80],Oo=()=>{const b=Ge(r);return{bad:pt(b).filter(E=>E.kind==="edge-crosses-shape"||E.kind==="edge-overlap-opposite"||E.kind==="edge-overlap-mixed").length,crossings:Em(b),straight:b.edges.filter(E=>E.type==="bpmn:MessageFlow"&&E.waypoints.length===2).length}},Qa=b=>{const E=Ge(r),M=E.edges.find(O=>O.id===b);return M?zt(M,zn(E)).length:0},pp=b=>Qa(b)>0,fp=b=>Ge(r).edges.filter(E=>E.type==="bpmn:MessageFlow"&&E.id!==b&&E.waypoints.length===2).length,E1=(b,E,M)=>Za([{subtree:b,pool:E}],M),S1=(b,E)=>E.bad>b.bad||E.crossings>b.crossings&&E.straight<=b.straight&&E.bad>=b.bad,Ja=(b,E)=>S1(b,E)||E.straight<b.straight,Xr=(b,E,M=()=>!0,O=S1,L=!1)=>{const k=Oo(),F=Za(b,E,L);if(!F)return!1;const B=Oo();return O(k,B)||!M()?(F(),!1):!0},o3=(b,E,M,O=()=>!0)=>Xr([{subtree:b,pool:E}],M,O),Zr=b=>{var E;return!!((E=T.get(b))!=null&&E.node.participant)},vc=new Map;for(const b of x){if(!Zr(b.flow.target))continue;const E=vc.get(b.flow.target)??[];E.push(b),vc.set(b.flow.target,E)}const dp=[...vc.keys()],Cg=new Set(N.map(b=>b.flow.target)),R1=b=>Zn.findIndex(({op:E})=>E.participant.id===b);dp.sort((b,E)=>{var L,k;const M=Cg.has(b)?1:0,O=Cg.has(E)?1:0;return M!==O?M-O:R1((L=T.get(b))==null?void 0:L.node.participant)-R1((k=T.get(E))==null?void 0:k.node.participant)});const xr=b=>b.x+b.width/2,r3=b=>{const E=new Map;for(const L of r.getAll()){const k=L;if(!k.waypoints||!k.source||!k.target)continue;(E.get(k.source.id)??E.set(k.source.id,[]).get(k.source.id)).push(k.target.id)}const M=new Set([b]),O=[b];for(let L=0;L<O.length;L++)for(const k of E.get(O[L])??[])M.has(k)||(M.add(k),O.push(k));return M},a3=(b,E)=>{const M=r3(E);let O;for(const L of r.getAll()){const k=L;if(k.type!=="bpmn:MessageFlow"||!k.source||!k.target||k.target.id!==b||M.has(k.source.id))continue;const F=k.source;if(typeof F.x!="number"||F.type==="bpmn:Participant")continue;const B=xr(F);(O===void 0||B>O)&&(O=B)}return O},Mg=(b,E)=>{const M=p(b.flow.source);if(M)return M.type==="bpmn:Participant"?a3(M.id,E):xr(M)},C1=b=>{let E;for(const M of vc.get(b)??[]){const O=Mg(M,b);O!==void 0&&(!E||O>E.cx)&&(E={op:M,cx:O})}return E==null?void 0:E.op},s3=b=>{const E=C1(b),M=p(b),O=E?Mg(E,b):void 0;return M&&O!==void 0?O-xr(M):void 0},c3=b=>{const E=s3(b);return E!==void 0&&Math.abs(E)<Rg},hp=(b,E,M,O,L)=>{var k;for(let F=!0;F;){F=!1;for(const B of x){if(B.flow.id===M)continue;const I=E.has(B.flow.source),z=E.has(B.flow.target);if(I===z||O(I?B.flow.source:B.flow.target))continue;const K=I?B.flow.target:B.flow.source;if(L(K)||!Zr(K))continue;const ae=p(B.flow.id);if(!(ae!=null&&ae.waypoints)||ae.waypoints.length!==2)continue;const le=p(K),ge=(k=T.get(K))==null?void 0:k.node.participant;if(!le||!ge)continue;const oe=Kr(K,me=>me.x>=le.x).filter(me=>!E.has(me.id));if(!(!oe.length||oe.some(me=>L(me.id)))){for(const me of oe)E.add(me.id);b.set(ge,[...b.get(ge)??[],...oe]),F=!0}}}return[...b].map(([F,B])=>({subtree:B,pool:f(F)}))},M1=(b,E,M,O,L)=>hp(new Map([[E,[...b]]]),new Set(b.map(k=>k.id)),O,k=>k===M,k=>k===L),Ag=b=>{const E=C1(b);if(!E)return null;const M=p(b),O=p(E.flow.source),L=Mg(E,b);if(!M||!O||L===void 0)return null;const k=L-xr(M);if(k>=Rg){const F=T.get(b).node.participant,B=Kr(b,I=>I.x>=M.x);return{groups:M1(B,F,b,E.flow.id,E.flow.source),dx:k}}if(-k>=Rg&&Zr(E.flow.source)){const F=T.get(E.flow.source).node.participant,B=Kr(E.flow.source,I=>I.x>=O.x&&!c3(I.id));return{groups:M1(B,F,E.flow.source,E.flow.id,b),dx:-k}}return null},A1=()=>dp.map(b=>({id:b,plan:Ag(b)})).filter(b=>!!b.plan).sort((b,E)=>Math.min(...b.plan.groups.flatMap(M=>M.subtree.map(O=>O.x)))-Math.min(...E.plan.groups.flatMap(M=>M.subtree.map(O=>O.x)))).map(b=>b.id);for(let b=0;b<3;b++){const E=Oo(),M=[];for(const L of A1()){const k=Ag(L);if(!k)continue;const F=Za(k.groups,k.dx);F&&M.push(F)}if(!M.length)break;if(!Ja(E,Oo()))continue;for(const L of M.reverse())L();let O=!1;for(const L of A1()){const k=Ag(L);k&&Xr(k.groups,k.dx,()=>!0,Ja)&&(O=!0)}if(!O)break}for(const b of dp){if(Cg.has(b))continue;const E=T.get(b);if(!E||E.node.lane!==void 0)continue;const M=C(E);if(M===void 0)continue;const O=p(b),L=O?d(O):void 0;if(!O||!L)continue;const k=L.y+De+Re(`pool:${E.node.participant??""}`,M)*ee,F=k-(O.y+O.height/2);F!==0&&!X(L,O,O.x+O.width/2,k)&&n.moveElements([O],{x:0,y:F})}const P1=new Set;for(let b=0,E=!0;E&&b<t3;b++){E=!1;for(const M of dp.flatMap(O=>vc.get(O)??[])){if(P1.has(M.flow.id)||!pp(M.flow.id))continue;const O=p(M.flow.target);if(!O)continue;const L=f(T.get(M.flow.target).node.participant),k=Kr(M.flow.target,z=>z.x>=O.x),F=O.width+Se,B=Qa(M.flow.id),I=fp(M.flow.id);for(let z=1;z<=_1;z++){const K=()=>Qa(M.flow.id)<B&&fp(M.flow.id)>=I;if(o3(k,L,F*z,K)){P1.add(M.flow.id),E=!0;break}}}}const Pg=x.map(b=>({id:b.flow.id,source:b.flow.source,target:b.flow.target,preexisting:!1})),T1=new Set(Pg.map(b=>b.id));for(const b of r.filter(E=>E.type==="bpmn:MessageFlow"))T1.has(b.id)||!b.source||!b.target||b.source.type==="bpmn:Participant"!=(b.target.type==="bpmn:Participant")&&Pg.push({id:b.id,source:b.source.id,target:b.target.id,preexisting:!0});for(const b of Pg){if(!pp(b.id))continue;const E=p(b.source),M=p(b.target);if(!E||!M)continue;let O,L,k;if(b.preexisting){const[B,I]=E.type==="bpmn:Participant"?[M,E]:[E,M];if(O=xr(B),O<I.x||O>I.x+I.width)continue;[L,k]=B.y<I.y?[B.y+B.height,I.y]:[I.y+I.height,B.y]}else{if(E.type==="bpmn:Participant"||M.type==="bpmn:Participant"||(O=E.x+E.width/2,Math.abs(O-(M.x+M.width/2))>15))continue;[L,k]=E.y<M.y?[E.y+E.height,M.y]:[M.y+M.height,E.y]}const F=[...T.values()].map(B=>p(B.node.id)).filter(B=>!!B&&B.id!==E.id&&B.id!==M.id).filter(B=>B.x<=O&&O<=B.x+B.width&&B.y+B.height>L&&B.y<k).sort((B,I)=>B.x-I.x);for(const B of F){const I=(z1=T.get(B.id))==null?void 0:z1.node.participant,z=I?p(I):void 0;if(!I||!z)continue;const K=[...T.values()].filter(se=>se.node.participant===I).map(se=>se.node.id),ae=se=>se.map(pe=>p(pe)).filter(pe=>!!pe),ge=[Y5(B.id,se=>{var pe;return((pe=T.get(se.id))==null?void 0:pe.node.participant)===I}),ae(K)].filter(se=>se.length).map(se=>[{subtree:se,pool:z}]);if(b.preexisting){const se=ae(K);se.length&&ge.push(hp(new Map([[I,[...se]]]),new Set(se.map(pe=>pe.id)),b.id,()=>!1,pe=>pe===E.id||pe===M.id))}const oe=B.width+Se,me=Qa(b.id),Le=fp(b.id),Pe=()=>Qa(b.id)<me&&fp(b.id)>=Le;let te=!1;for(const se of ge){for(let pe=1;pe<=_1;pe++)if(Xr(se,oe*pe,Pe)){te=!0;break}if(te)break}if(!pp(b.id))break}}const gp=()=>{var E;const b=new Set;for(const M of pt(Ge(r)))M.kind!=="edge-crosses-shape"||T1.has(M.edge)||((E=p(M.edge))==null?void 0:E.type)==="bpmn:MessageFlow"&&b.add(`${M.edge}>${M.shape}`);return b},l3=(b,E)=>Oo().bad>=b&&[...gp()].some(M=>!E.has(M)),k1=b=>{var E,M;return Qa(b)===0&&((M=(E=p(b))==null?void 0:E.waypoints)==null?void 0:M.length)===2},u3=(b,E,M)=>{const O=new Set(b.flatMap(k=>k.subtree.map(F=>F.id))),L=[...gp()].filter(k=>!M.has(k)).map(k=>k.split(">")[1]);return[...new Set(L)].filter(k=>O.has(k)&&k!==E.source&&k!==E.target)},p3=(b,E,M,O,L)=>{const k=b.map(z=>({...z,subtree:z.subtree.filter(K=>!L.includes(K.id))})).filter(z=>z.subtree.length),F=new Set(k.flatMap(z=>z.subtree.map(K=>K.id))),B=()=>L.every(z=>{const K=p(z);return!!K&&N.filter(ae=>ae.flow.target===z&&F.has(ae.flow.source)).every(ae=>{const le=p(ae.flow.source);return!!le&&le.x+le.width<=K.x})});return Xr(k,E,()=>k1(M.id)&&[...gp()].every(z=>O.has(z))&&B(),Ja,!0)};for(const b of x){if(!pp(b.flow.id))continue;const E=p(b.flow.id);if(((G1=E==null?void 0:E.waypoints)==null?void 0:G1.length)!==2)continue;const M=p(b.flow.source),O=p(b.flow.target);if(!M||!O||M.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!Zr(b.flow.source)||!Zr(b.flow.target)||Math.abs(xr(M)-xr(O))>n3)continue;const L=xr(M),k=E.waypoints.map(me=>me.y),[F,B]=[Math.min(...k),Math.max(...k)],I=zn(Ge(r)).filter(me=>me.id!==M.id&&me.id!==O.id&&me.x<L&&L<me.x+me.width&&F<me.y+me.height&&me.y<B);if(!I.length)continue;const z=(V1=T.get(b.flow.source))==null?void 0:V1.node.participant,K=(W1=T.get(b.flow.target))==null?void 0:W1.node.participant;if(!z||!K)continue;const ae=new Map;for(const[me,Le,Pe]of[[b.flow.source,M,z],[b.flow.target,O,K]]){const te=ae.get(Pe)??[],se=Kr(me,pe=>pe.x>=Le.x).filter(pe=>!te.some(be=>be.id===pe.id));ae.set(Pe,[...te,...se])}const le=new Set([...ae.values()].flat().map(me=>me.id)),ge=hp(ae,le,b.flow.id,me=>me===b.flow.source||me===b.flow.target,()=>!1),oe=Math.max(...I.map(me=>me.x+me.width));for(const me of i3){const Le=oe+me-L;if(Le<=0)continue;const Pe=Oo().bad,te=gp();let se=[],pe=!0;const be=()=>!k1(b.flow.id)||pe&&(se=u3(ge,b.flow,te),se.length)?!1:!l3(Pe,te);if(Xr(ge,Le,be,Ja))break;if(se.length&&(p3(ge,Le,b.flow,te,se)||(pe=!1,Xr(ge,Le,be,Ja))))break}}{const b=M=>M.y+M.height/2,E=[];for(const M of T.keys()){if(!Zr(M))continue;const O=N.filter(F=>F.flow.target===M);if(O.length!==1)continue;const L=p(O[0].flow.source),k=p(M);!L||!k||!T.has(L.id)||Math.abs(b(L)-b(k))>1||k.x-(L.x+L.width)<=Se+1||E.push({id:M,pred:L,node:k})}E.sort((M,O)=>M.node.x-O.node.x);for(const{id:M}of E){const O=T.get(M),L=p(M),k=p(N.find(Le=>Le.flow.target===M).flow.source);if(!L||!k)continue;const F=L.x-(k.x+k.width);if(F<=Se+1)continue;const B=f(O.node.participant),I=Kr(M,Le=>Le.x>=L.x),z=-(F-Se),K=(Le,Pe)=>Pe.bad>Le.bad||Pe.crossings>=Le.crossings||Pe.straight<Le.straight,ae=hp(new Map([[O.node.participant,[...I]]]),new Set(I.map(Le=>Le.id)),"",()=>!1,()=>!1),le=ae.some(Le=>Le.pool!==B)||ae.reduce((Le,Pe)=>Le+Pe.subtree.length,0)>I.length,ge=Oo(),oe=E1(I,B,z);if(!oe)continue;const me=Oo();if(le&&!K(ge,me)){oe();const Le=Za(ae,z);if(Le){const Pe=Oo();if(!K(ge,Pe)&&Pe.bad<=me.bad&&Pe.crossings<=me.crossings)continue;Le()}E1(I,B,z);continue}K(ge,me)&&oe()}}w1(!0);const f3=10,d3=400,h3=b=>[...b.incoming??[],...b.outgoing??[]].filter(E=>E.type==="bpmn:DataInputAssociation"||E.type==="bpmn:DataOutputAssociation").map(E=>E.source===b?E.target:E.source).filter(E=>!!E&&typeof E.y=="number"),g3=r.filter(b=>b.type==="bpmn:DataStoreReference"&&m.has(b.id)),m3=(b,E)=>{const M=b.x+b.width/2,O=b.y+b.height/2;let L;for(const k of g3){if((d(k)??u())!==E||k.y<b.y+b.height)continue;const F=Math.abs(k.x+k.width/2-M);F>d3||F<k.width||!h3(k).some(I=>I.height===b.height&&Math.abs(I.y+I.height/2-O)<=f3&&k.y>=I.y+I.height)||(!L||F<L.dx||F===L.dx&&k.id<L.id)&&(L={dx:F,id:k.id,cy:k.y+k.height/2})}return L==null?void 0:L.cy};for(const b of y){const E=b.associations??[],M=E.map(k=>k.source===b.dataStore.id?k.target:k.source).map(p).find(Boolean),O=M?d(M)??u():u(),L=M?{x:M.x+M.width/2,y:m3(M,O)??M.y+M.height+110}:{x:200,y:Kt+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 E)x1(b.dataStore.id,k)}for(const b of v){const M=f(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;x1(M,b.association)}let O1=0;const Qr=10,D1=40,y3=(b,E)=>{const M=E.map(I=>d(I)).filter(I=>!!I);for(const I of M){const z=Qr,K=I.y,ae=I.y+I.height,le=I.x,ge=I.x+I.width;if(Math.abs(b.y-K)<z){const oe=K+z-b.y;b.y+=oe,b.height-=oe}if(Math.abs(b.y+b.height-ae)<z&&(b.height=ae-z-b.y),Math.abs(b.x-le)<z){const oe=le+z-b.x;b.x+=oe,b.width-=oe}Math.abs(b.x+b.width-ge)<z&&(b.width=ge-z-b.x)}if(!M.length)return;const O=Math.min(...M.map(I=>I.y)),L=Math.max(...M.map(I=>I.y+I.height)),k=O-b.y,F=b.y+b.height-L,B=D1-Qr;if(k>0!=F>0)if(k>0&&k<B){const I=k+Qr;b.y+=I,b.height-=I}else F>0&&F<B&&(b.height-=F+Qr)},v3=(b,E)=>{const M=Qr,O=30,L=r.filter(k=>k.type==="bpmn:Group"&&k.id!==E);for(const k of L){const F=k.x,B=k.x+k.width,I=k.y,z=k.y+k.height,K=b.y<z&&I<b.y+b.height,ae=b.x<B&&F<b.x+b.width;if(K){if(Math.abs(b.x-B)<M){const le=Math.min(B+M-b.x,O);le>0&&b.width-le>0&&(b.x+=le,b.width-=le)}if(Math.abs(b.x+b.width-F)<M){const le=Math.min(b.x+b.width-(F-M),O);le>0&&b.width-le>0&&(b.width-=le)}}if(ae){if(Math.abs(b.y-z)<M){const le=Math.min(z+M-b.y,O);le>0&&b.height-le>0&&(b.y+=le,b.height-=le)}if(Math.abs(b.y+b.height-I)<M){const le=Math.min(b.y+b.height-(I-M),O);le>0&&b.height-le>0&&(b.height-=le)}}}},Tg=(b,E)=>{const M=D1,O=Math.min(...b.map(I=>I.x))-M,L=Math.min(...b.map(I=>I.y))-M,k=Math.max(...b.map(I=>I.x+I.width))+M,F=Math.max(...b.map(I=>I.y+I.height))+M,B={x:O,y:L,width:k-O,height:F-L};return y3(B,b),v3(B,E),B};for(const b of _){const E=(b.group.members??[]).map(p).filter(L=>!!L);let M;E.length?M=Tg(E,b.group.id):(M={x:300+O1*350,y:40,width:300,height:200},O1++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:M.width,height:M.height},{x:M.x+M.width/2,y:M.y+M.height/2},u());b.group.name&&n.updateLabel(O,b.group.name),(U1=b.group.members)!=null&&U1.length&&Q(O,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=r.filter(L=>!!L.waypoints),E=new Map,M=(L,k)=>{!L||!k||(E.has(L)||E.set(L,new Set),E.get(L).add(k))};for(const L of b){const k=(q1=L.source)==null?void 0:q1.id,F=(Y1=L.target)==null?void 0:Y1.id;M(k,F),((K1=L.type)!=null&&K1.includes("DataOutputAssociation")||(X1=L.type)!=null&&X1.includes("DataInputAssociation")||L.type==="bpmn:Association")&&M(F,k)}const O=r.filter(L=>L.type==="bpmn:Group");for(const L of O){const F=(((Z1=L.businessObject.extensionElements)==null?void 0:Z1.values)??[]).find(Pe=>Pe.$type==="bwl:Members"),B=((F==null?void 0:F.refs)??"").split(" ").filter(Boolean);if(!B.length)continue;const I=new Set(B),z=[...B];for(;z.length;){const Pe=z.shift();for(const te of E.get(Pe)??[])I.has(te)||(I.add(te),z.push(te))}const K=L.x,ae=L.x+L.width,le=L.y,ge=L.y+L.height,oe=Pe=>N.filter(te=>te.flow.target===Pe).length,me=Pe=>{var se;const te=((se=p(Pe))==null?void 0:se.type)??"";if(te==="bpmn:StartEvent"&&oe(Pe)===0)return!1;if(te.endsWith("Gateway")){const pe=N.filter(be=>be.flow.target===Pe).map(be=>be.flow.source);if(pe.length&&pe.every(be=>{var et;return((et=p(be))==null?void 0:et.type)==="bpmn:StartEvent"&&oe(be)===0}))return!1}return!0},Le=r.filter(Pe=>Ii(Pe)).filter(Pe=>Pe.type!=="bpmn:Group"&&Pe.type!=="bpmn:Participant"&&Pe.type!=="bpmn:TextAnnotation"&&!I.has(Pe.id)&&Zr(Pe.id)&&me(Pe.id)&&Pe.x<ae&&Pe.x+Pe.width>K&&Pe.y<ge&&Pe.y+Pe.height>le);if(Le.length)for(const Pe of[-1,1]){const te=Le.filter(xe=>(xe.x+xe.width-K<=ae-xe.x?-1:1)===Pe);if(!te.length)continue;const se=[];for(const xe of te){const ue=se.find(we=>we.some(Fe=>xe.y<Fe.y+Fe.height&&xe.y+xe.height>Fe.y));ue?ue.push(xe):se.push([xe])}const pe=new Map;for(const xe of se){let ue=Pe<0?K-Qr:ae+Qr;for(const we of[...xe].sort((Fe,je)=>Pe<0?je.x-Fe.x:Fe.x-je.x)){const Fe=Pe<0?Math.min(we.x,ue-we.width):Math.max(we.x,ue);ue=Pe<0?Fe-Li:Fe+we.width+Li,Fe!==we.x&&Math.sign(Fe-we.x)===Pe&&pe.set(we.id,Fe-we.x)}}const be=new Map,et=xe=>be.get(xe)===xe||!be.get(xe)?xe:et(be.get(xe));for(const xe of te)be.set(xe.id,xe.id);for(const xe of x){const ue=pe.has(xe.flow.source)?xe.flow.source:void 0,we=pe.has(xe.flow.target)?xe.flow.target:void 0;if(!ue||!we)continue;const Fe=p(xe.flow.id);((Q1=Fe==null?void 0:Fe.waypoints)==null?void 0:Q1.length)===2&&be.set(et(ue),et(we))}const ot=new Map;for(const xe of te){if(!pe.has(xe.id))continue;const ue=et(xe.id);ot.set(ue,[...ot.get(ue)??[],xe])}const At=[...ot.values()].sort((xe,ue)=>Pe<0?Math.min(...xe.map(we=>we.x))-Math.min(...ue.map(we=>we.x)):Math.max(...ue.map(we=>we.x))-Math.max(...xe.map(we=>we.x))),Ft=[];let Ee=!0;for(const xe of At){const ue=xe.map(je=>pe.get(je.id)??0).reduce((je,Me)=>Math.abs(Me)>Math.abs(je)?Me:je,0),we=new Map;let Fe=!0;for(const je of xe){const Me=d(je);if(!Me){Fe=!1;break}we.has(Me.id)||we.set(Me.id,{subtree:[],pool:Me}),we.get(Me.id).subtree.push(je)}Fe&&Xr([...we.values()],ue,()=>!0,Ja)?Ft.push({shapes:xe,dx:ue}):Ee=!1}if(!Ee)for(const xe of Ft.reverse())n.moveElements(xe.shapes,{x:-xe.dx,y:0})}}}{const b=new Set([..._.map(E=>E.group.id),...Gt(e,"group.update").map(E=>E.id)]);for(const E of r.filter(M=>M.type==="bpmn:Group")){if(b.has(E.id))continue;const O=(((J1=E.businessObject.extensionElements)==null?void 0:J1.values)??[]).find(B=>B.$type==="bwl:Members"),L=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(p).filter(B=>!!B);!L.length||!L.some(B=>{const I=m.get(B.id);return!I||I.x!==B.x||I.y!==B.y})||!L.some(B=>B.x<E.x||B.y<E.y||B.x+B.width>E.x+E.width||B.y+B.height>E.y+E.height)||n.resizeShape(E,Tg(L,E.id))}}{const E=new Map(Ho(Ge(r)).map(B=>[B.owner,B.rect])),M=r.filter(B=>!!B.waypoints),O=new Map,L=(B,I)=>{!B||!I||(O.has(B)||O.set(B,new Set),O.get(B).add(I))};for(const B of M){const I=(eS=B.source)==null?void 0:eS.id,z=(tS=B.target)==null?void 0:tS.id;L(I,z),((nS=B.type)!=null&&nS.includes("DataOutputAssociation")||(iS=B.type)!=null&&iS.includes("DataInputAssociation")||B.type==="bpmn:Association")&&L(z,I)}const k=B=>N.filter(I=>I.flow.target===B).length,F=B=>{var z;const I=((z=p(B))==null?void 0:z.type)??"";if(I==="bpmn:StartEvent"&&k(B)===0)return!1;if(I.endsWith("Gateway")){const K=N.filter(ae=>ae.flow.target===B).map(ae=>ae.flow.source);if(K.length&&K.every(ae=>{var le;return((le=p(ae))==null?void 0:le.type)==="bpmn:StartEvent"&&k(ae)===0}))return!1}return!0};for(const B of r.filter(I=>I.type==="bpmn:Group")){const z=(((oS=B.businessObject.extensionElements)==null?void 0:oS.values)??[]).find(ue=>ue.$type==="bwl:Members"),K=((z==null?void 0:z.refs)??"").split(" ").filter(Boolean);if(!K.length)continue;const ae=K.map(p).filter(ue=>!!ue);if(!ae.length||!(_.some(ue=>ue.group.id===B.id)||Gt(e,"group.update").some(ue=>ue.id===B.id)||ae.some(ue=>{const we=m.get(ue.id);return!we||we.x!==ue.x||we.y!==ue.y})))continue;const ge=new Set(K),oe=[...K];for(;oe.length;){const ue=oe.shift();for(const we of O.get(ue)??[])ge.has(we)||(ge.add(we),oe.push(we))}const me=B.x,Le=B.x+B.width,Pe=B.y,te=B.y+B.height,se=ue=>{const we=E.get(ue.id),Fe={x:ue.x,y:ue.y,width:ue.width,height:ue.height};return we?[Fe,{x:we.x,y:we.y,width:we.width,height:we.height}]:[Fe]},pe=ae.flatMap(se),be=Math.min(...pe.map(ue=>ue.x)),et=Math.max(...pe.map(ue=>ue.x+ue.width)),ot=Math.min(...pe.map(ue=>ue.y)),At=Math.max(...pe.map(ue=>ue.y+ue.height)),Ft={L:be-me,R:Le-et,T:ot-Pe,B:te-At},Ee=r.filter(ue=>Ii(ue)).filter(ue=>ue.type!=="bpmn:Group"&&ue.type!=="bpmn:Participant"&&ue.type!=="bpmn:TextAnnotation"&&!ge.has(ue.id)&&F(ue.id)&&ue.x<Le&&ue.x+ue.width>me&&ue.y<te&&ue.y+ue.height>Pe);if(!Ee.length)continue;const xe={L:0,R:0,T:0,B:0};for(const ue of Ee){const we=se(ue),Fe=Math.min(...we.map(ft=>ft.x)),je=Math.max(...we.map(ft=>ft.x+ft.width)),Me=Math.min(...we.map(ft=>ft.y)),st=Math.max(...we.map(ft=>ft.y+ft.height)),ht={L:je-me,R:Le-Fe,T:st-Pe,B:te-Me},tn=["L","R","T","B"].filter(ft=>ht[ft]<=Ft[ft]+.001);if(!tn.length)continue;const Un=tn.reduce((ft,Ln)=>ht[Ln]<ht[ft]?Ln:ft,tn[0]);xe[Un]=Math.max(xe[Un],Math.min(ht[Un]+10,Ft[Un]))}!xe.L&&!xe.R&&!xe.T&&!xe.B||n.resizeShape(B,{x:B.x+xe.L,y:B.y+xe.T,width:B.width-xe.L-xe.R,height:B.height-xe.T-xe.B})}}const L1=b=>{const E=b.waypoints;if(E!=null&&E.length){const O=E[Math.floor((E.length-1)/2)];return{x:O.x,y:O.y,width:0,height:0}}const M=b;return{x:M.x,y:M.y,width:M.width,height:M.height}};let bc=0;const I1=12,B1=14,b3=15,x3=300,w3=b=>{const E=b.split(`
7
+ `),M=Math.max(...E.map(k=>pa(k,I1))),O=Math.max(100,Math.min(x3,Math.ceil(M)+B1)),L=E.reduce((k,F)=>k+Math.max(1,Math.ceil((pa(F,I1)+B1)/O)),0);return{width:O,height:Math.max(30,L*b3+10)}};for(const b of S){const E=b.association,M=((rS=b.placement)==null?void 0:rS.anchor)??(E?E.source===b.annotation.id?E.target:E.source:void 0),O=M?p(M):void 0,L=O?L1(O):void 0,k=w3(b.annotation.text??"");let F;if(L&&b.placement){const[K,ae]=Xc[b.placement.side],le=b.placement.offset??50;F={x:L.x+L.width/2+K*(L.width/2+k.width/2+le),y:L.y+L.height/2+ae*(L.height/2+k.height/2+le)}}else L?(F={x:L.x+L.width/2+180+bc%3*260,y:L.y-110-bc%2*95},bc++):(F={x:300+bc*260,y:60},bc++);const B=O?d(O)??u():u(),I=B;L&&typeof I.x=="number"&&typeof I.width=="number"&&I.type==="bpmn:Participant"&&(F=Qc(r,L,k,I,b.placement?{placement:b.placement}:{from:F}));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})},F,B);if(E){const K=ae=>ae===b.annotation.id?z:f(ae);n.connect(K(E.source),K(E.target),E.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:E.id})}:{type:"bpmn:Association"})}b.placement&&Q(z,"bwl:Placement",ne(b.placement))}for(const b of Gt(e,"association.add")){const E=b.association;n.connect(f(E.source),f(E.target),E.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:E.id})}:{type:"bpmn:Association"})}const _3=(b,E,M,O)=>{const L=b.parent;if(!L)return O;const k=b.x+b.width/2,F=new Set([b.id]);if(!X(L,b,k,O,F))return O;const B=E?E.y+Math.min(E.height/2,_e):M?M.y+De:void 0;if(B===void 0)return O;const I=Math.floor((O-B)/ee+1e-6);for(let z=1;z<=3;z++){const K=I+z,ae=B+K*ee,le=yi(E==null?void 0:E.id,K);if(!X(L,b,k,ae,le?new Set([...F,...le]):F))return Dn(E==null?void 0:E.id,K,M),ae}return O},N1=()=>new Set(r.getAll().filter(b=>b.type!=="label").map(b=>b.id));for(const b of Gt(e,"node.update")){let E=f(b.id);if(b.type&&Kc(b.type)!==E.type){const M=E.x+E.width/2,O=E.y+E.height/2,L=N1();E=c.replaceElement(E,{type:Kc(b.type),...b.eventDefinition?{eventDefinitionType:Sc[b.eventDefinition]}:{}});const k=N1(),F=[...L].filter(z=>z!==b.id&&!k.has(z));if(F.length)throw new wy({kind:"type-change-drops-elements",opIndex:e.indexOf(b),id:b.id,type:b.type,dropped:F});const B=Math.round(M-(E.x+E.width/2)),I=Math.round(O-(E.y+E.height/2));if(B!==0||I!==0){n.moveShape(E,{x:B,y:I});for(const z of[...E.incoming??[],...E.outgoing??[]])up(z)}}if(b.name!==void 0&&n.updateProperties(E,{name:b.name??void 0}),b.lane||b.band!==void 0){b.band!==void 0&&n.updateProperties(E,{"bwl:band":b.band});const M=E.y+E.height/2,O=d(E),L=b.lane?f(b.lane):((O==null?void 0:O.children)??[]).find(F=>F.type==="bpmn:Lane"&&M>=F.y&&M<=F.y+F.height);b.band!==void 0&&Dn(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,_e)+Re(L.id,b.band)*ee):b.band!==void 0&&O?O.y+De+Re(`pool:${O.id}`,b.band)*ee:void 0;if(k!==void 0){const F=_3(E,L,O,k),B=F===k?k-M:F-(E.y+E.height/2);B!==0&&n.moveElements([E],{x:0,y:B})}}}for(const b of Gt(e,"sequenceFlow.update")){const E=f(b.id),M=P.get(b.id);if(M){const O=z=>({x:z.x+z.width/2,y:z.y+z.height/2}),L=f(M.flow.source),k=f(M.flow.target),F=n.connect(L,k,{type:"bpmn:SequenceFlow",businessObject:dt(M.flow)}),B=Sg.get(b.id),I=k.y+k.height/2;B&&k.x>B.exit.x&&Math.abs(I-B.exit.y)>1?n.updateWaypoints(F,[B.exit,{x:B.exit.x,y:I},{x:k.x,y:I}]):(n.reconnect(F,L,k,[O(L),O(k)]),Math.abs(I-(L.y+L.height/2))>1&&up(F))}else if(b.source!==void 0||b.target!==void 0){const O=E,L=b.source!==void 0?f(b.source):O.source,k=b.target!==void 0?f(b.target):O.target,F=z=>({x:z.x+z.width/2,y:z.y+z.height/2});n.reconnect(O,L,k,[F(L),F(k)]);const B=Sg.get(O.id),I=k.y+k.height/2;if(B&&k.x>B.exit.x&&Math.abs(I-B.exit.y)>1){n.updateWaypoints(O,[B.exit,{x:B.exit.x,y:I},{x:k.x,y:I}]);const z=O.label;if(z&&B.label){const ae=Math.abs(B.label.y+z.height/2-B.channelY)<=ee/5&&B.label.x+z.width>B.exit.x,le=B.exit.x+6,ge=k.x-6-z.width,oe=ae?ge>=le?{x:Math.max(le,Math.min(B.label.x,ge)),y:B.label.y+(I-B.channelY)}:void 0:B.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(I-(L.y+L.height/2))>1&&up(O)}b.name!==void 0&&n.updateProperties(E,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(E,{name:((aS=b.condition)==null?void 0:aS.label)??void 0})}for(const b of Gt(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of Gt(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of Gt(e,"annotation.update")){const E=f(b.id);if(b.text!==void 0&&n.updateProperties(E,{text:b.text}),b.placement===null)Q(E,"bwl:Placement",null);else if(b.placement){const M=f(b.placement.anchor),O=L1(M),L=d(M)??u(),k=typeof L.x=="number"&&typeof L.width=="number"&&L.type==="bpmn:Participant",[F,B]=Xc[b.placement.side],I=b.placement.offset??50,z={x:O.x+O.width/2+F*(O.width/2+E.width/2+I),y:O.y+O.height/2+B*(O.height/2+E.height/2+I)},K=k?Qc(r,O,{width:E.width,height:E.height},L,{placement:b.placement,selfId:b.id}):z;n.moveElements([E],{x:K.x-(E.x+E.width/2),y:K.y-(E.y+E.height/2)}),Q(E,"bwl:Placement",ne(b.placement))}}for(const b of Gt(e,"group.update")){const E=f(b.id);if(b.name!==void 0&&n.updateLabel(E,b.name??""),b.members){const M=b.members.map(p).filter(O=>!!O);M.length&&n.resizeShape(E,Tg(M,b.id)),Q(E,"bwl:Members",{refs:b.members.join(" ")})}}}function yf(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 CM(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(m=>m.original?{x:m.x,y:m.y,original:{x:m.original.x,y:m.original.y}}:{x:m.x,y:m.y}),c=(d,m)=>d.length===m.length&&d.every((h,g)=>{var w,x,y,v;return h.x===m[g].x&&h.y===m[g].y&&((w=h.original)==null?void 0:w.x)===((x=m[g].original)==null?void 0:x.x)&&((y=h.original)==null?void 0:y.y)===((v=m[g].original)==null?void 0:v.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=Ge(o),f=[...ho(p),...$i(p)].filter(([d,m])=>u.has(d)!==u.has(m)).length;return r.moveElements([t],{x:-n,y:-i}),a.forEach((d,m)=>{c(d.waypoints,l[m])||r.updateWaypoints(d,l[m])}),f}function MM(e,t,n){var u,p;const{elementRegistry:i}=e,o=e.modeling,r=f=>pt(f).filter(d=>!t.has(ct(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=Ge(i),c=r(s),l=[...new Set(c.flatMap(yf))].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 m=d.parent,h;for(;m;){if(m.type==="bpmn:Participant"){h=m;break}m=m.parent}if(!h){const ee=d.x+d.width/2,Se=d.y+d.height/2;h=i.getAll().find(De=>{if(De.type!=="bpmn:Participant")return!1;const _e=De;return typeof _e.x=="number"&&typeof _e.width=="number"&&ee>=_e.x&&ee<=_e.x+_e.width&&Se>=_e.y&&Se<=_e.y+_e.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const w=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(ee=>ee.$type==="bwl:Placement"),x=[...d.incoming??[],...d.outgoing??[]].find(ee=>ee.type==="bpmn:Association"),y=(w!=null&&w.anchor?i.get(w.anchor):void 0)??(x?((p=x.source)==null?void 0:p.id)===f?x.target:x.source:void 0);if(!y)continue;const v=y.waypoints,S=v!=null&&v.length?{x:v[Math.floor((v.length-1)/2)].x,y:v[Math.floor((v.length-1)/2)].y,width:0,height:0}:{x:y.x,y:y.y,width:y.width,height:y.height},_={width:d.width,height:d.height},T={x:d.x+d.width/2,y:d.y+d.height/2},P=w==null?void 0:w.side,D=by(i,S,h),N=[];if(P&&P in Xc&&N.push(Qc(i,S,_,h,{placement:{side:P,offset:(w==null?void 0:w.offset)??null},selfId:f})),D&&!Zc(T,_,D))for(const ee of RM)N.push(Qc(i,S,_,h,{placement:{side:ee,offset:null},selfId:f}));for(const[ee,Se]of[[-1,0],[1,0],[0,-1],[0,1]])for(let De=1;De<=SM;De++)N.push({x:T.x+ee*vy*De,y:T.y+Se*vy*De});const j={...s,edges:s.edges.filter(ee=>ee.id!==(x==null?void 0:x.id))},H=r(j),Q=H.filter(ee=>yf(ee).includes(f)).length;if(!Q)continue;let ne,W=!1;for(const ee of N){const Se=ee.x-T.x,De=ee.y-T.y;if(!Se&&!De||ee.x-_.width/2<h.x||ee.x+_.width/2>h.x+h.width||ee.y-_.height/2<h.y||ee.y+_.height/2>h.y+h.height||D&&!Zc(ee,_,D))continue;const _e={...j,shapes:j.shapes.map(X=>X.id===f?{...X,x:X.x+Se,y:X.y+De}:X)},Y=r(_e),ie=Y.filter(X=>yf(X).includes(f)).length;if(ie>=Q||Y.length>H.length)continue;const q=Math.abs(Se)+Math.abs(De);if(W||((!ne||ie<ne.mine||ie===ne.mine&&(Y.length<ne.all||Y.length===ne.all&&q<ne.dist))&&(ne={x:ee.x,y:ee.y,mine:ie,all:Y.length,dist:q}),ne.mine===0&&ne.all<H.length&&(W=!0)),ie===0&&Y.length<H.length&&CM(e,d,Se,De)===0){ne={x:ee.x,y:ee.y,mine:ie,all:Y.length,dist:q};break}}ne&&o.moveElements([d],{x:ne.x-T.x,y:ne.y-T.y})}}const AM=60;function vf(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 PM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=u=>pt(u).filter(p=>!t.has(ct(p))),a=u=>u.filter(p=>p.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,p)=>p.x>=u.x&&p.y>=u.y&&p.x+p.width<=u.x+u.width&&p.y+p.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const f=new Set,d=new Set([u]);for(let h=0;h<4;h++){let g=!1;for(const w of n.shapes)w.type!=="bpmn:Group"||f.has(w.id)||[...d].some(x=>{const y=s.get(x);return y&&c(w,y)})&&(f.add(w.id),g=!0);for(const w of n.shapes)w.type!=="bpmn:Participant"||d.has(w.id)||[...f].some(x=>{const y=s.get(x);return y&&c(y,w)})&&(d.add(w.id),g=!0);if(!g)break}const m=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!f.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...f].some(g=>{const w=s.get(g);return w&&c(w,h)})).map(h=>h.id);return[...d,...f,...m]};for(let u=0;u<6;u++){const p=Ge(i),f=r(p),d=a(f);if(!d.length)return;const m=new Map(p.shapes.map(v=>[v.id,v]));let h=null;for(const v of d){if(v.kind!=="pool-overlap")continue;const[S,_]=v.pools,T=m.get(S),P=m.get(_);if(!T||!P)continue;const[D,N]=T.x<=P.x?[T,P]:[P,T];if(v.contained)continue;const j=s.get(D.id),H=s.get(N.id),Q=j&&H?Math.max(H.x-(j.x+j.width),0):AM,ne=D.x+D.width+Q-N.x;if(ne<=0)continue;const W=l(N.id).filter(ee=>i.get(ee));W.length&&(!h||ne>h.dx)&&(h={movers:W,dx:ne})}if(!h)return;const g=h.movers.map(v=>i.get(v)).filter(v=>!!v&&typeof v.x=="number");if(!g.length)return;const w=f.length,x=d.length;o.moveElements(g,{x:h.dx,y:0});const y=r(Ge(i));if(!(a(y).length<x&&y.length<=w)){o.moveElements(g,{x:-h.dx,y:0});return}}}const ds=.5,Ey=150;function TM(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of kM(n))i.length<n.length&&i.some(r=>OM(e.elementRegistry.get(r.id)))||DM(e,i)}function kM(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)<=ds?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function OM(e){var i,o,r;const t=(i=e==null?void 0:e.businessObject)==null?void 0:i.processRef;if(!t)return!0;const n=(t.laneSets??[]).reduce((a,s)=>{var c;return a+(((c=s.lanes)==null?void 0:c.length)??0)},0);return(((o=t.flowElements)==null?void 0:o.length)??0)+n+(((r=t.artifacts)==null?void 0:r.length)??0)===0}function DM(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(x=>x.x+x.width),r=Math.max(...o);if(r-Math.min(...o)>ds)return;const a=t.map(x=>n.get(x.id)).filter(x=>!!x&&typeof x.x=="number");if(a.length<2)return;const s=new Map(t.map(x=>[x.id,x.x]));if(a.some(x=>Math.abs(x.x-s.get(x.id))>ds))return;const c=a.map(x=>x.x+x.width);if(Math.max(...c)-Math.min(...c)<=ds)return;const l=x=>x.x+x.width,u=x=>!!x&&typeof x.width=="number",p=x=>{const y={shapes:[],edges:[],lanes:[]},v=S=>{for(const _ of S.children??[]){if("waypoints"in _&&_.waypoints){y.edges.push(_);continue}_.type!=="label"&&(_.type==="bpmn:Lane"?y.lanes.push(_):y.shapes.push(_),v(_))}};return v(x),y},f=new Map(a.map(x=>[x.id,p(x)]));let d=r;for(const x of a){const{shapes:y}=f.get(x.id),v=y.flatMap(S=>[l(S),...u(S.label)?[l(S.label)]:[]]);v.length&&(d=Math.max(d,Math.max(...v)+Ey))}const m=a.filter(x=>Math.abs(l(x)-d)>ds);if(!m.length)return;for(const x of m){const y=l(x),{shapes:v,edges:S,lanes:_}=f.get(x.id);if([...v.flatMap(D=>[l(D),...u(D.label)?[l(D.label)]:[]]),...S.flatMap(D=>[...D.waypoints.map(N=>N.x),...u(D.label)?[l(D.label)]:[]])].some(D=>D>d)||[...(x.incoming??[]).map(D=>D.waypoints[D.waypoints.length-1]),...(x.outgoing??[]).map(D=>D.waypoints[0])].some(D=>!D||D.x>d||Math.abs(D.x-y)<1))return;if(d>y){const D={x:y,y:x.y,width:d-y,height:x.height},N=new Set([x.id,...v.map(H=>H.id),...S.map(H=>H.id),..._.map(H=>H.id)]);if(n.getAll().some(H=>{var W;if("waypoints"in H&&H.waypoints||H.type==="bpmn:Group"||!u(H))return!1;const Q=H.type==="label"?(W=H.labelTarget)==null?void 0:W.id:H.id;if(!Q||N.has(Q)||N.has(H.id))return!1;const ne=H;return ne.x<D.x+D.width&&ne.x+ne.width>D.x&&ne.y<D.y+D.height&&ne.y+ne.height>D.y}))return}}const h=()=>new Set(pt(Ge(n)).map(ct)),g=h(),w=m.map(x=>x.width);for(const x of m)vf(i,x,d-x.x,{layout:!1});[...h()].every(x=>g.has(x))||m.forEach((x,y)=>vf(i,x,w[y],{layout:!1}))}function LM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>pt(l).filter(u=>!t.has(ct(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const p=n.shapes.filter(_=>_.id!==l.id&&_.type!=="bpmn:Group"&&a(l,_));if(!p.length)continue;const f=p.map(_=>i.get(_.id)).filter(_=>!!_&&typeof _.x=="number");if(f.length!==p.length)continue;const d=s(p),m=s(f),h=m.l+(l.x-d.l),g=m.t+(l.y-d.t),w=m.r+(l.x+l.width-d.r),x=m.b+(l.y+l.height-d.b),y={x:h,y:g,width:w-h,height:x-g};if(y.width<=0||y.height<=0||Math.abs(y.x-u.x)<1&&Math.abs(y.y-u.y)<1&&Math.abs(y.width-u.width)<1&&Math.abs(y.height-u.height)<1)continue;const v=r(Ge(i)).length,S={x:u.x,y:u.y,width:u.width,height:u.height};o.resizeShape(u,y),r(Ge(i)).length>v&&o.resizeShape(u,S)}}const Jc=20,el=10;function IM(e,t,n,i){var p,f;const{elementRegistry:o}=e,r=e.modeling,a=d=>new Set(pt(d,{includeObservationOnly:!0}).filter(m=>m.kind==="edge-along-group-boundary").map(ct)),s=Ge(o),c=pt(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(ct(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,m]of u){const h=s.shapes.find(ke=>ke.id===d);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const g=l.get(d);if(!(!g||Math.abs(g.x-h.x)>=.5||Math.abs(g.y-h.y)>=.5||Math.abs(g.width-h.width)>=.5||Math.abs(g.height-h.height)>=.5))continue;const x=h.members.map(ke=>o.get(ke)).filter(ke=>!!ke&&typeof ke.x=="number");if(!x.length)continue;const y=Math.min(...x.map(ke=>ke.x)),v=Math.min(...x.map(ke=>ke.y)),S=Math.max(...x.map(ke=>ke.x+ke.width)),_=Math.max(...x.map(ke=>ke.y+ke.height)),T=h.x,P=h.y,D=h.x+h.width,N=h.y+h.height;let j=T,H=P,Q=D,ne=N;for(const ke of m){const $=s.edges.find(R=>R.id===ke.edge);if(!$)continue;const C=$.endpoints.some(R=>{const V=s.shapes.find(Re=>Re.id===R);if(!V||V.container)return!1;const Z=V.x+V.width/2,re=V.y+V.height/2;return T<Z&&Z<D&&P<re&&re<N});for(const R of nn($)){const V=R.axis==="v"?[P,N]:[T,D];Math.min(R.hi,V[1])-Math.max(R.lo,V[0])<Yp||(R.axis==="v"?T<R.at&&R.at<D:P<R.at&&R.at<N)&&C||(R.axis==="v"?(Math.abs(R.at-T)<=fa&&(j=Math.max(j,R.at+Jc)),Math.abs(R.at-D)<=fa&&(Q=Math.min(Q,R.at-Jc))):(Math.abs(R.at-P)<=fa&&(H=Math.max(H,R.at+Jc)),Math.abs(R.at-N)<=fa&&(ne=Math.min(ne,R.at-Jc))))}}if(j>y-el&&(j=T),H>v-el&&(H=P),Q<S+el&&(Q=D),ne<_+el&&(ne=N),j===T&&H===P&&Q===D&&ne===N)continue;const W=o.get(d),ee={x:W.x,y:W.y,width:W.width,height:W.height},Se=Ge(o),De=new Set(pt(Se).map(ct)),_e=a(Se);r.resizeShape(W,{x:j,y:H,width:Q-j,height:ne-H});let Y=Ge(o),ie=pt(Y).filter(ke=>!De.has(ct(ke)));const q=[];if(ie.length>0&&ie.every(ke=>ke.kind==="label-over-line"&&!i.has(ke.edge)&&Y.edges.some($=>$.id===ke.edge))){for(const ke of ie){if(ke.kind!=="label-over-line")continue;const $=Y.edges.find(re=>re.id===ke.edge),C=$&&hf($,Y),R=(f=o.get(ke.edge))==null?void 0:f.label;if(!C||!R)continue;const V=C.x-R.x,Z=C.y-R.y;r.moveElements([R],{x:V,y:Z}),q.push({label:R,dx:V,dy:Z})}Y=Ge(o),ie=pt(Y).filter(ke=>!De.has(ct(ke)))}const ce=a(Y),ye=[...ce].some(ke=>!_e.has(ke));if(ie.length||ye||ce.size>=_e.size){for(const ke of q.reverse())r.moveElements([ke.label],{x:-ke.dx,y:-ke.dy});r.resizeShape(W,ee)}}}function BM(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=Mp((o==null?void 0:o.$parent)??o),a=is(i),s=new Map;for(const l of e.keys()){const u=(c=t.get(l))==null?void 0:c.businessObject;s.set(l,u?{texts:Ap(u,i,r),requests:Op(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 Sy(e,t,n={}){var Q,ne;const{i18n:i,lower:o=_y}=n,r=my(e),a=Lm(r.elementRegistry),s=gy(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=bM(t,a,i),u=i&&l.writes.size?BM(l.writes,r.elementRegistry,r.canvas,i):void 0,p=Ge(r.elementRegistry),f=new Set(pt(p).map(ct)),d=new Set(pt(p,{includeObservationOnly:!0}).map(ct)),m=new Set(xy(l.ops,W=>{var ee,Se;return(Se=(ee=r.elementRegistry.get(W))==null?void 0:ee.source)==null?void 0:Se.id}).keys()),h=new Set(p.edges.map(W=>W.id).filter(W=>!m.has(W))),g=new Set(t.flatMap(W=>W.kind==="sequenceFlow.update"&&(W.source!==void 0||W.target!==void 0)?[W.id]:[])),w=new Set(p.shapes.map(W=>W.id)),x=ho(p),y=x.length,v=new Set(x.map(([W,ee])=>`${W}|${ee}`)),S=$i(p),_=new Set(S.map(([W,ee])=>`${W}|${ee}`)),T=new Map;for(const W of r.elementRegistry.filter(ee=>"waypoints"in ee&&!!ee.waypoints))W.label&&T.set(W.id,{wps:W.waypoints.map(ee=>({x:ee.x,y:ee.y})),label:{x:W.label.x,y:W.label.y},source:(Q=W.source)==null?void 0:Q.id,target:(ne=W.target)==null?void 0:ne.id});const P=e.get("commandStack");try{Fg(P,()=>{o(l.ops,r);for(const ee of(u==null?void 0:u.contexts())??[])P.execute(Tp,ee);PM(r,f,p),TM(r,p),LM(r,f,p),KC(r,p,g),UC(r,h,w),Gm(r,h);const W=of(r,f);Nm(r,v,h),ny(r,f,h),Ym(r,h),sM(r,h,g),Qm(r,f,h),fM(r,f,h),GC(r,_,h),tM(r,h,p),cy(r,f,h),sy(r,h,g),uy(r,w),MM(r,f,w),of(r,f,W),IM(r,d,p,h),py(r,f),ay(r,T)})}catch(W){return{ok:!1,issues:[W instanceof wy?W.issue:{kind:"lower-failed",message:W instanceof Error?W.message:String(W)}],findings:[],stats:c}}const D=Ge(r.elementRegistry),N=pt(D,{includeObservationOnly:!0}).filter(W=>!d.has(ct(W))),j=Sm(D),H=$i(D);return{ok:!0,issues:[],findings:N,stats:{edgeCrossings:{before:y,after:j.pairs.length,pairs:j.pairs,solidPairs:j.solidPairs,dashedPairs:j.dashedPairs,mixedPairs:j.mixedPairs,crossPoolMessages:j.crossPoolMessages},sharedEndpointCrossings:{before:S.length,after:H.length,pairs:H}}}}function NM(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function Ry(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Cy(e,t){const n=Ry(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function My(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function $M(e){return typeof e=="string"&&_p.includes(e)}function Hi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Ay(e,t={}){const n=e.rootElements??[],i=n.find(Y=>Y.$type==="bpmn:Collaboration"),o=new Map(n.filter(Y=>Y.$type==="bpmn:Process").map(Y=>[Y.id,Y])),r=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],d=[],m=[],h=[],g=[],w=[],x=[],y=new Map,v=new Set,S=new Set,_=Y=>{Y&&v.add(Y)},T=Y=>{v.add(Y),S.add(Y)},P=Y=>{const ie=My(Y,"bwl:Placement");if(!ie)return;const q=typeof ie.anchor=="string"?ie.anchor:void 0;if(!q||!$M(ie.side))return;const X=typeof ie.offset=="number"?ie.offset:void 0;g.push({owner:Y.id,anchor:q,side:ie.side,...X!==void 0?{offset:X}:{}})},D=Y=>{const ie=My(Y,"bwl:Members"),q=typeof(ie==null?void 0:ie.refs)=="string"?ie.refs.split(/\s+/).filter(Boolean):[];q.length&&x.push({owner:Y.id,refs:q})},N=Y=>{var ie;for(const q of Y)switch(_(q.id),q.$type){case"bpmn:TextAnnotation":T(q.id),y.set(q.id,q),c.push({id:q.id,text:typeof q.text=="string"?q.text:""}),P(q);break;case"bpmn:Association":m.push({id:q.id,type:q.$type,source:Hi(q.sourceRef),target:Hi(q.targetRef)});break;case"bpmn:Group":{T(q.id),y.set(q.id,q);const X=(ie=q.categoryValueRef)==null?void 0:ie.value;l.push({id:q.id,...typeof X=="string"&&X?{name:X}:{}}),D(q);break}default:u.push({id:q.id,type:q.$type,reason:"type-outside-mvp"})}},j=Y=>{for(const ie of Y.flowElements??[])_(ie.id),u.push({id:ie.id,type:ie.$type,reason:"inside-container"}),(ie.flowElements??[]).length&&j(ie);for(const ie of Y.artifacts??[])_(ie.id),u.push({id:ie.id,type:ie.$type,reason:"inside-container"})},H=(Y,ie)=>{const q=Y.flowElements??[],X=(Y.laneSets??[]).flatMap(ye=>ye.lanes??[]),ce=new Map;for(const ye of X){_(ye.id),y.set(ye.id,ye);for(const ke of ye.flowNodeRef??[]){const $=Hi(ke);$&&ce.set($,ye.id)}}for(const ye of q){if(_(ye.id),y.set(ye.id,ye),ye.$type==="bpmn:SequenceFlow"){f.push({id:ye.id,source:Hi(ye.sourceRef),target:Hi(ye.targetRef),...typeof ye.name=="string"&&ye.name?{name:ye.name}:{}});continue}if(ye.$type==="bpmn:DataStoreReference"){T(ye.id),s.push({id:ye.id,...ye.name?{name:ye.name}:{}});continue}const ke=NM(ye.$type),$=ke==="intermediateCatchEvent"?xp((ye.eventDefinitions??[]).map(Z=>Z.$type)):void 0;if(!Dg(ke)||ke==="intermediateCatchEvent"&&!$){u.push({id:ye.id,type:ye.$type,reason:"type-outside-mvp"});continue}T(ye.id);const C=ke==="boundaryEvent"?Hi(ye.attachedToRef):void 0;a.push({id:ye.id,type:ke,...ye.name?{name:ye.name}:{},...ie?{participant:ie}:{},...ce.has(ye.id)?{lane:ce.get(ye.id)}:{},...C?{attachedTo:C}:{},...$?{eventDefinition:$}:{}}),ke==="subProcess"&&j(ye);const R=Cy(ye,"bwl:band");R!==void 0&&(p.bands[ye.id]=R);const V=Ry(ye,"bwl:afterColumn");typeof V=="string"&&V!==""&&w.push([ye.id,V]);for(const Z of ye.dataOutputAssociations??[])_(Z.id),h.push({id:Z.id,type:Z.$type,source:ye.id,target:Hi(Z.targetRef)});for(const Z of ye.dataInputAssociations??[])_(Z.id),h.push({id:Z.id,type:Z.$type,source:Hi((Z.sourceRef??[])[0]),target:ye.id})}N(Y.artifacts??[])};if(i){const Y=new Set;for(const ie of i.participants??[]){T(ie.id),y.set(ie.id,ie);const q=Hi(ie.processRef);q&&Y.add(q);const X=q?o.get(q):void 0,ce=((X==null?void 0:X.laneSets)??[]).flatMap(C=>C.lanes??[]),ye=ce.map(C=>({id:C.id,...C.name?{name:C.name}:{}}));for(const C of ye)T(C.id);const ke=!X||(X.flowElements??[]).length===0&&ce.length===0&&(X.artifacts??[]).length===0;r.push({id:ie.id,...ie.name?{name:ie.name}:{},...ke?{blackBox:!0}:{},...ye.length?{lanes:ye}:{}});const $=Cy(ie,"bwl:poolOrder");$!==void 0&&(p.poolOrders[ie.id]=$),X&&H(X,ie.id)}for(const ie of i.messageFlows??[])_(ie.id),y.set(ie.id,ie),d.push({id:ie.id,source:Hi(ie.sourceRef),target:Hi(ie.targetRef),...typeof ie.name=="string"&&ie.name?{name:ie.name}:{}});N(i.artifacts??[]);for(const[ie,q]of o)!Y.has(ie)&&(q.flowElements??[]).length>0&&u.push({id:ie,type:q.$type,reason:"unreachable-process"})}else for(const Y of o.values())H(Y);const Q=[],ne=[],W=[],ee=[],Se=(Y,ie)=>!!Y&&!!ie&&S.has(Y)&&S.has(ie);for(const Y of f){if(!Se(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}Q.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),S.add(Y.id)}for(const Y of d){if(!Se(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}ne.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),S.add(Y.id)}for(const Y of h){if(!Se(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}ee.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target}),Y.id&&S.add(Y.id)}for(const Y of m){if(!Se(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}W.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target})}const De=new Map(l.map(Y=>[Y.id,Y]));for(const{owner:Y,refs:ie}of x){const q=ie.filter(ce=>v.has(ce)),X=De.get(Y);X&&q.length&&(X.members=q)}for(const Y of g)v.has(Y.anchor)&&(p.placements[Y.owner]={anchor:Y.anchor,side:Y.side,...Y.offset!==void 0?{offset:Y.offset}:{}});for(const[Y,ie]of w)v.has(ie)&&(p.afterColumns[Y]=ie);const _e={...r.length?{participants:r}:{},nodes:a,sequenceFlows:Q,...ne.length?{messageFlows:ne}:{},...s.length?{dataStores:s}:{},...ee.length?{dataAssociations:ee}:{},...c.length?{annotations:c}:{},...W.length?{associations:W}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:_e,hints:p,omitted:u,i18n:FM(_e,y,e,t.i18n)}:{definition:_e,hints:p,omitted:u}}function FM(e,t,n,i){const o=Mp(n),r=is(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=Ap(u,i,o);Object.keys(p).length&&(c[l]=p);for(const f of Op(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 jM(e,t={}){const{definitions:n,warnings:i}=await la(e);return{...Ay(n,t),warnings:i}}const HM=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function bf(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function zM(e){return bf(e.processRef)!==void 0}function GM(e){const t=new Set,n=o=>{const r=bf(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 VM(e){const t=[],n=i=>{for(const o of i.flowElements??[])HM.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 WM(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 xf(e){const t=[],n=e.rootElements??[],i=GM(e);for(const r of VM(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??[])zM(s)&&WM(r.get(bf(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 UM(e){const{definitions:t,warnings:n}=await la(e);return{issues:xf(t),warnings:n}}const qM=.5,YM=8,KM=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),ya=e=>typeof e=="number"?e:Number(e??NaN),tl=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function XM(e){const t=e,n=[],i=typeof t.name=="string"?t.name:typeof t.text=="string"?t.text:"";n.push(`n=${i.replace(/\s+/g," ").trim()}`);for(const r of["sourceRef","targetRef","attachedToRef","processRef","default"])t[r]!==void 0&&n.push(`${r}=${tl(t[r])}`);if(String(e.$type)==="bpmn:Group"){const r=t.categoryValueRef,a=Array.isArray(r)?r:r==null?[]:[r];n.push(`cat=[${a.map(s=>`${tl(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(tl).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function ZM(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?[ya(s.x),ya(s.y),ya(s.width),ya(s.height)]:[]},r=a=>{if(Array.isArray(a))return a.forEach(r);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=tl(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,o(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(f=>[ya(f.x),ya(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 Py(e){const t=ZM(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:")&&!KM.has(s)&&n.set(c,{type:s,props:XM(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 Ty(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 ky(e,t,n={}){const i=n.moveTolerance??qM,o=Py(e),r=Py(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||Ty(p.geometry,u.geometry,i)||Ty(p.label,u.label,n.labelTolerance??YM))&&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 QM(e,t,n={}){const[i,o]=await Promise.all([la(e),la(t)]);return{...ky(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function JM(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 Oy(e,t,{currentVersion:n,i18n:i}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const o=Sy(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 tA=new Set(["lasso","lasso.selection","hand","hand.move"]),Dy=1e4,nA="bwl-edit-locked",Ly=new WeakMap;function iA(e){const t=Ly.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",Dy,()=>{var s;if(o)return tA.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"],Dy,()=>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(nA,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 Ly.set(e,a),a}const oA=Symbol("bpmn-editor"),wf={geometry:[],semantic:[]};function rA(){const e=ve.ref(!1),t=ve.ref(!0),n=ve.ref(!1),i=ve.shallowRef(wf),o=ve.shallowRef(void 0),r=ve.shallowRef(void 0);let a,s,c;const l=()=>{if(p(),!c){i.value=wf;return}const w=pt(Ge(c.get("elementRegistry")),{includeObservationOnly:!0}),x=c.getDefinitions();i.value={geometry:w,semantic:x?xf(x):[]}};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 x=w.locales(),y={};for(const v of x)y[v]={untranslated:w.untranslatedCount(v),reviewRequested:w.reviewRequestedCount(v)};r.value={designLocale:a.designLocale,locales:x,displayLocale:w.getDisplayLocale()??a.designLocale,counts:y}}function f(){const w=u();w&&(w.configure(a),a&&s&&(s=w.setDisplayLocale(s)))}const d=()=>{e.value=!0,l()};function m(w,x){iA(w).set(!x)}function h(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function g(){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 y;s=w;const x=(y=u())==null?void 0:y.setDisplayLocale(w);x&&(s=x),p()},setChangeScope(w){o.value=w===void 0?void 0:new Set(w)},requestFocus(w){if(!c)return;const x=c.get("elementRegistry").get(w);x&&(c.get("canvas").scrollToElement(x,180),c.get("selection").select(x))},describeElement(w){const x=c==null?void 0:c.get("elementRegistry").get(w),y=x==null?void 0:x.businessObject;if(!y)return;const v=typeof y.name=="string"&&y.name.trim()!==""?y.name:y.text;return{name:typeof v=="string"&&v.trim()!==""?v.trim():void 0,type:typeof y.$type=="string"?y.$type:""}},attach(w){c&&this.detach(),c=w,c.get("eventBus").on("commandStack.changed",d),t.value||m(c,!1),f(),l()},detach(){c==null||c.get("eventBus").off("commandStack.changed",d),c&&!t.value&&m(c,!0),c=void 0,i.value=wf,o.value=void 0,r.value=void 0},setEditable(w){t.value=w,c&&m(c,w)},async applyAgentBatch(w,x){const y=h();n.value=!0;try{const v=await Oy(y,w,{currentVersion:x,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return v.status==="applied"&&(e.value=!1),v}finally{n.value=!1}},async importXml(w){const{warnings:x}=await h().importXML(w);return e.value=!1,o.value=void 0,l(),{warnings:qp(x)}},async saveXml(){const{xml:w}=await h().saveXML({format:!0});return e.value=!1,w??""},undo:()=>{var w;return(w=g())==null?void 0:w.undo()},redo:()=>{var w;return(w=g())==null?void 0:w.redo()},canUndo:()=>{var w;return((w=g())==null?void 0:w.canUndo())??!1},canRedo:()=>{var w;return((w=g())==null?void 0:w.canRedo())??!1}}}const aA=new RegExp("\\p{Script=Hangul}","u"),sA=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,cA=new RegExp("\\p{Script=Han}","u");function nl(e){const t=aA.test(e),n=sA.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:cA.test(e)?"han":"other"}}function Iy(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 By(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=Sr(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:Bo(a).filter(l=>_n(l))})}return n}const hs=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function lA(e){const t=Iy(e),n=By(e);let i;const o={},r=[],a=[],s=[];for(const m of n){const h=m.trs.filter(g=>(g.body??"")===m.name).map(_n);if(h.length){const g=[...h].sort().join("+");o[g]=(o[g]??0)+1,i=i?new Set([...i].filter(w=>h.includes(w))):new Set(h)}else m.trs.some(g=>g.body)?r.push(hs(m)):s.push({e:m,inference:nl(m.name)});for(const g of m.trs){const w=_n(g),x=g.body??"",y=nl(x);y.locale&&y.locale!==w?a.push({...hs(m),locale:w,script:y.script}):w==="ko"&&y.script==="han"&&m.trs.some(v=>v!==g&&v.body===x)&&a.push({...hs(m),locale:w,script:"han"})}}const c=new Set(s.map(m=>m.inference.locale).filter(Boolean));let l,u;if(t)u="kept";else if(i&&i.size===1)[l,u]=[[...i][0],"matched"];else if(i&&i.size>1){const m=c.size===1?[...c][0]:void 0;m&&i.has(m)?[l,u]=[m,"matched"]:u="ambiguous"}else i?u="mixed":c.size===1?[l,u]=[[...c][0],"script"]:u=c.size>1?"mixed":"no-evidence";const p=t??l,f=[],d=[];for(const{e:m,inference:h}of s)h.locale?h.locale!==p&&f.push({...hs(m),locale:h.locale}):d.push({...hs(m),script:h.script});return{root:{current:t,proposed:l,reason:u},additions:f,undecided:d,drift:r,matchedBy:o,scriptMismatch:a}}function uA(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!Iy(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(By(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=>_n(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(Er,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Ny(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 _f=e=>_n(e)||void 0,$y=e=>e.body??"";function Fy(e){const t=new Map;for(const n of Ny(e)){const i=Bo(n);i.length&&t.set(n.id,{type:n.$type,cells:i.map(o=>({locale:_f(o),body:$y(o)}))})}return t}const jy=e=>JSON.stringify(e.map(t=>t.body).sort());class pA{constructor(){jn(this,"byId",new Map);jn(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};Hy(this.byId,o,a),Hy(this.byBodies,jy(r.cells),a)}}sameId(t){return this.byId.get(t)??[]}sameBodies(t){return this.byBodies.get(jy(t))??[]}}function Hy(e,t,n){const i=e.get(t);i?i.push(n):e.set(t,[n])}function fA(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 Ef(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 hA=e=>JSON.stringify([...e.cells].sort((t,n)=>(t.body+t.locale).localeCompare(n.body+n.locale)));function gA(e,t){const n={restores:[],ambiguous:[],stale:[],unresolved:[]},i=Fy(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=fA(a,s,t.baseline);if(!c.size)continue;const l={id:a,type:s.type},p=[["history",t.index.sameId(a).filter(g=>g.doc===t.doc&&Ef(g.state,c)).sort((g,w)=>w.version-g.version).slice(0,1).map(g=>g.state)],["lineage",t.index.sameId(a).filter(g=>g.doc!==t.doc&&Ef(g.state,c)).map(g=>g.state)],["bodies",t.index.sameBodies(s.cells).filter(g=>!(g.doc===t.doc&&g.id===a)&&Ef(g.state,c)).map(g=>g.state)]].find(([,g])=>g.length);if(!p){if(!r(s))continue;for(const[g,w]of c)for(let x=0;x<w;x++)n.unresolved.push({...l,body:g,script:nl(g).script});continue}const[f,d]=p,m=d.map(g=>dA(s,g,c));if(m.some(g=>g.overflow)||new Set(m.map(hA)).size>1){n.ambiguous.push({...l,source:f});continue}const[h]=m;for(const g of h.stale)n.stale.push({...l,...g});h.cells.length&&n.restores.push({...l,source:f,cells:h.cells})}return n}function mA(e,t){if(!t.restores.length)return 0;const n=new Map(Ny(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=Bo(r),s=new Set(a.map(_f).filter(Boolean));for(const{body:c,locale:l}of o.cells){if(s.has(l))continue;const u=a.find(p=>!_f(p)&&$y(p)===c);u&&(u.set("xml:lang",l),s.add(l),i++)}}return i}function Te(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function yA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Sf={exports:{}},zy;function vA(){if(zy)return Sf.exports;zy=1;var e=Sf.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},Sf.exports}var bA=vA(),xA=yA(bA);function Ki(e){if(!(this instanceof Ki))return new Ki(e);e=e||[128,36,1],this._seed=e.length?xA.rack(e[0],e[1],e[2]):e}Ki.prototype.next=function(e){return this._seed(e||!0)},Ki.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Ki.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Ki.prototype.assigned=function(e){return this._seed.get(e)||!1},Ki.prototype.unclaim=function(e){delete this._seed.hats[e]},Ki.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const mn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};mn.td=mn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],mn.option=mn.optgroup=[1,'<select multiple="multiple">',"</select>"],mn.thead=mn.tbody=mn.colgroup=mn.caption=mn.tfoot=[1,"<table>","</table>"],mn.polyline=mn.ellipse=mn.polygon=mn.circle=mn.text=mn.line=mn.path=mn.rect=mn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function $t(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:p}=u;return p.remove(),p}let[o,r,a]=Object.hasOwn(mn,i)?mn[i]:mn._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 wA(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 Gn(e,...t){const n=e.style;return G(t,function(i){i&&G(i,function(o,r){n[r]=o})}),e}function En(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const _A=Object.prototype.toString;function Ct(e){return new zo(e)}function zo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}zo.prototype.add=function(e){return this.list.add(e),this},zo.prototype.remove=function(e){return _A.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},zo.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},zo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},zo.prototype.array=function(){return Array.from(this.list)},zo.prototype.has=zo.prototype.contains=function(e){return this.list.contains(e)};function il(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Pr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function EA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ol={},Gy;function SA(){if(Gy)return ol;Gy=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return ol.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},ol.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},ol}var Vy=SA(),RA=EA(Vy),$e=wA({__proto__:null,default:RA},[Vy]),Wy=["focus","blur"];function CA(e,t,n,i,o){return Wy.indexOf(n)!==-1&&(o=!0),$e.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=Pr(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function MA(e,t,n,i){return Wy.indexOf(t)!==-1&&(i=!0),$e.unbind(e,t,n,i)}var ti={bind:CA,unbind:MA};function Rf(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Rt(e,t){return t=t||document,t.querySelector(e)}function gs(e,t){return t=t||document,t.querySelectorAll(e)}function Xi(e){e.parentNode&&e.parentNode.removeChild(e)}function AA(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function PA(e,t){return t.appendChild(AA(e,t))}function Ke(e,t){return PA(t,e),e}var Cf=2,Uy={"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":Cf,"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":Cf,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function TA(e,t){return Uy[t]?e.style[t]:e.getAttributeNS(null,t)}function qy(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=Uy[i];o?(o===Cf&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function kA(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)qy(e,o,t[o])}function Ce(e,t,n){if(typeof t=="string")if(n!==void 0)qy(e,t,n);else return TA(e,t);else kA(e,t);return e}const OA=Object.prototype.toString;function lt(e){return new Go(e)}function Go(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Go.prototype.add=function(e){return this.list.add(e),this},Go.prototype.remove=function(e){return OA.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Go.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},Go.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Go.prototype.array=function(){return Array.from(this.list)},Go.prototype.has=Go.prototype.contains=function(e){return this.list.contains(e)};function ms(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Mf(e){return e.cloneNode(!0)}var Af={svg:"http://www.w3.org/2000/svg"},Yy='<svg xmlns="'+Af.svg+'"';function DA(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Af.svg)===-1&&(e=Yy+e.substring(4)):(e=Yy+">"+e+"</svg>",t=!0);var n=LA(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function LA(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Be(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=DA(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Af.svg,e),t&&Ce(n,t),n}var Pf=null;function Ky(){return Pf===null&&(Pf=Be("svg")),Pf}function Xy(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function IA(e,t,n,i,o,r){var a=Ky().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Xy(a,e);case 6:return Xy(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function ys(e){return Ky().createSVGTransform()}var Zy=/([&<>]{1})/g,BA=/([&<>\n\r"]{1})/g,NA={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Tf(e,t){function n(i,o){return NA[o]||o}return e.replace(t,n)}function Qy(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(Tf(e.textContent,Zy));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,'="',Tf(r.value,BA),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Qy(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Tf(e.nodeValue,Zy),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function $A(e){for(var t=e.firstChild,n=[];t;)Qy(t,n),t=t.nextSibling;return n.join("")}function Jy(e,t){return $A(e)}function on(e){var t=e.parentNode;return t&&t.removeChild(e),e}function FA(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function jA(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(FA(e,i))}function vs(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),jA(n,t)),n.consolidate()}const HA=/^class[ {]/;function zA(e){return HA.test(e.toString())}function kf(e){return Array.isArray(e)}function Of(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function rl(...e){e.length===1&&kf(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const GA=/constructor\s*[^(]*\(\s*([^)]*)\)/m,VA=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,WA=/\/\*([^*]*)\*\//m;function UA(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(zA(e)?GA:VA);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(WA);return(o&&o[1]||i).trim()})||[]}function ev(e,t){const n=t||{get:function(y,v){if(i.push(y),v===!1)return null;throw s(`No provider for "${y}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),a=r.injector=this,s=function(y){const v=i.join(" -> ");return i.length=0,new Error(v?`${y} (Resolving: ${v})`:y)};function c(y,v){if(!o[y]&&y.includes(".")){const S=y.split(".");let _=c(S.shift());for(;S.length;)_=_[S.shift()];return _}if(Of(r,y))return r[y];if(Of(o,y)){if(i.indexOf(y)!==-1)throw i.push(y),s("Cannot resolve circular dependency!");return i.push(y),r[y]=o[y][0](o[y][1]),i.pop(),r[y]}return n.get(y,v)}function l(y,v){if(typeof v>"u"&&(v={}),typeof y!="function")if(kf(y))y=rl(y.slice());else throw s(`Cannot invoke "${y}". Expected a function!`);const _=(y.$inject||UA(y)).map(T=>Of(v,T)?v[T]:c(T));return{fn:y,dependencies:_}}function u(y){const{fn:v,dependencies:S}=l(y),_=Function.prototype.bind.call(v,null,...S);return new _}function p(y,v,S){const{fn:_,dependencies:T}=l(y,S);return _.apply(v,T)}function f(y){return rl(v=>y.get(v))}function d(y,v){if(v&&v.length){const S=Object.create(null),_=Object.create(null),T=[],P=[],D=[];let N,j,H,Q;for(let ne in o)N=o[ne],v.indexOf(ne)!==-1&&(N[2]==="private"?(j=T.indexOf(N[3]),j===-1?(H=N[3].createChild([],v),Q=f(H),T.push(N[3]),P.push(H),D.push(Q),S[ne]=[Q,ne,"private",H]):S[ne]=[D[j],ne,"private",P[j]]):S[ne]=[N[2],N[1]],_[ne]=!0),(N[2]==="factory"||N[2]==="type")&&N[1].$scope&&v.forEach(W=>{N[1].$scope.indexOf(W)!==-1&&(S[ne]=[N[2],N[1]],_[W]=!0)});v.forEach(ne=>{if(!_[ne])throw new Error('No provider for "'+ne+'". Cannot use provider from the parent!')}),y.unshift(S)}return new ev(y,a)}const m={factory:p,type:u,value:function(y){return y}};function h(y,v){const S=y.__init__||[];return function(){S.forEach(_=>{typeof _=="string"?v.get(_):v.invoke(_)})}}function g(y){const v=y.__exports__;if(v){const S=y.__modules__,_=Object.keys(y).reduce((j,H)=>(H!=="__exports__"&&H!=="__modules__"&&H!=="__init__"&&H!=="__depends__"&&(j[H]=y[H]),j),Object.create(null)),T=(S||[]).concat(_),P=d(T),D=rl(function(j){return P.get(j)});v.forEach(function(j){o[j]=[D,j,"private",P]});const N=(y.__init__||[]).slice();return N.unshift(function(){P.init()}),y=Object.assign({},y,{__init__:N}),h(y,P)}return Object.keys(y).forEach(function(S){if(S==="__init__"||S==="__depends__")return;const _=y[S];if(_[2]==="private"){o[S]=_;return}const T=_[0],P=_[1];o[S]=[m[T],qA(T,P),T]}),h(y,a)}function w(y,v){return y.indexOf(v)!==-1||(y=(v.__depends__||[]).reduce(w,y),y.indexOf(v)!==-1)?y:y.concat(v)}function x(y){const v=y.reduce(w,[]).map(g);let S=!1;return function(){S||(S=!0,v.forEach(_=>_()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=x(e)}function qA(e,t){return e!=="value"&&kf(t)&&(t=rl(t.slice())),t}var YA=1e3;function mo(e,t){var n=this;t=t||YA,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)})}mo.prototype.canRender=function(e){},mo.prototype.drawShape=function(e,t){},mo.prototype.drawConnection=function(e,t){},mo.prototype.getShapePath=function(e){},mo.prototype.getConnectionPath=function(e){};function Tr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function KA(e){return["M",e.x,e.y]}function Df(e){return["L",e.x,e.y]}function XA(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function ZA(e,t){const n=e.length,i=[KA(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(Df(a));continue}const c=Math.min(t,Lf(a.x-r.x,a.y-r.y),Lf(s.x-a.x,s.y-a.y));if(!c){i.push(Df(a));continue}const l=al(a,r,c),u=al(a,r,c*.5),p=al(a,s,c),f=al(a,s,c*.5);i.push(Df(l)),i.push(XA(u,f,p))}return i}function al(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=Lf(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function Lf(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function bs(e,t,n){Ue(t)&&(n=t,t=null),t||(t={});const i=Be("path",t);return Ue(n)&&(i.dataset.cornerRadius=String(n)),If(i,e)}function If(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Ce(e,{d:Tr(ZA(t,n))}),e}function sl(e){var t=new Set(e);return rt(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function kr(e,t,n){n=n||0,We(e)||(e=[e]),G(e,function(i,o){var r=t(i,o,n);We(r)&&r.length&&kr(r,t,n+1)})}function Bf(e,t,n){var i=new Set,o=new Set;return kr(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 xs(e,t){return Bf(e)}function QA(e,t,n){_r(t)&&(t=!0),gn(t)&&(n=t,t=!0),n=n||{};var i=ws(n.allShapes),o=ws(n.allConnections),r=ws(n.enclosedElements),a=ws(n.enclosedConnections),s=ws(n.topLevel,t&&ra(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,G(u.incoming,c),G(u.outgoing,c),u.children}return kr(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function rn(e,t){t=!!t,We(e)||(e=[e]);var n,i,o,r;return G(e,function(a){var s=a;a.waypoints&&!t&&(s=rn(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 va(e,t){var n={};return G(e,function(i){var o=i;o.waypoints&&(o=rn(o)),!Ue(t.y)&&o.x>t.x&&(n[i.id]=i),!Ue(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(Ue(t.width)&&Ue(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!Ue(t.width)||!Ue(t.height))&&(n[i.id]=i)}),n}function tv(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function nv(e){return!!(e&&e.isFrame)}function ws(e,t){return U({},e||{},t||{})}var JA=1;function Vo(e,t){mo.call(this,e,JA),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})}Te(Vo,mo),Vo.prototype.canRender=function(){return!0},Vo.prototype.drawShape=function(t,n,i){var o=Be("rect");return Ce(o,{x:0,y:0,width:n.width||0,height:n.height||0}),nv(n)?Ce(o,U({},this.FRAME_STYLE,i||{})):Ce(o,U({},this.SHAPE_STYLE,i||{})),Ke(t,o),o},Vo.prototype.drawConnection=function(t,n,i){var o=bs(n.waypoints,U({},this.CONNECTION_STYLE,i||{}));return Ke(t,o),o},Vo.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 Tr(a)},Vo.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 Tr(r)},Vo.$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 U(r,{class:n})},this.style=function(n,i){!We(n)&&!i&&(i=n,n=[]);var o=ei(n,function(r,a){return U(r,e[a]||{})},{});return i?U(o,i):o},this.computeStyle=function(n,i,o){return We(i)||(o=i,i=[]),t.style(i||[],U({},o,n||{}))}}const tP={__init__:["defaultRenderer"],defaultRenderer:["type",Vo],styles:["type",eP]};function Jt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function en(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 Nf(e,t){return!e||!t?-1:e.indexOf(t)}function _s(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function $f(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var o=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),r=_s(e,t);return Math.abs(o/r)<=i}var nP=2;function yo(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(iP(o,n))return r;return!1}function iP(e,t){const n=t[0];return Lo(t,function(i){return Math.abs(n[e]-i[e])<=nP})}function iv(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 Ff(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var oP=/,?([a-z]),?/gi,ov=parseFloat,an=Math,Wo=an.PI,Zi=an.min,Qi=an.max,rv=an.pow,Uo=an.abs,rP=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,aP=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,av=Array.isArray||function(e){return e instanceof Array};function sP(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function cP(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 lP(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 sP(o,i)?(cP(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function uP(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(aP,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=Hf,n}function pP(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 fP(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 jf(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 Hf(){return this.join(",").replace(oP,"$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=Hf,t}function sv(e,t,n,i,o,r,a,s,c){var l=1-c,u=rv(l,3),p=rv(l,2),f=c*c,d=f*c,m=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:cl(m),y:cl(h)}}function cv(e){var t=bP(...e);return jf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function qo(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function hP(e,t){return e=jf(e),t=jf(t),qo(t,e.x,e.y)||qo(t,e.x2,e.y)||qo(t,e.x,e.y2)||qo(t,e.x2,e.y2)||qo(e,t.x,t.y)||qo(e,t.x2,t.y)||qo(e,t.x,t.y2)||qo(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 lv(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 uv(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,m=0;m<u;m++){var h=l*p[m]+l,g=lv(h,e,n,o,a),w=lv(h,t,i,r,s),x=g*g+w*w;d+=f[m]*an.sqrt(x)}return l*d}function gP(e,t,n,i,o,r,a,s){if(!(Qi(e,n)<Zi(o,a)||Zi(e,n)>Qi(o,a)||Qi(t,i)<Zi(r,s)||Zi(t,i)>Qi(r,s))){var c=(e*i-t*n)*(o-a)-(e-n)*(o*s-r*a),l=(e*i-t*n)*(r-s)-(t-i)*(o*s-r*a),u=(e-n)*(r-s)-(t-i)*(o-a);if(u){var p=cl(c/u),f=cl(l/u),d=+p.toFixed(2),m=+f.toFixed(2);if(!(d<+Zi(e,n).toFixed(2)||d>+Qi(e,n).toFixed(2)||d<+Zi(o,a).toFixed(2)||d>+Qi(o,a).toFixed(2)||m<+Zi(t,i).toFixed(2)||m>+Qi(t,i).toFixed(2)||m<+Zi(r,s).toFixed(2)||m>+Qi(r,s).toFixed(2)))return{x:p,y:f}}}}function cl(e){return Math.round(e*1e11)/1e11}function mP(e,t,n){var i=cv(e),o=cv(t);if(!hP(i,o))return[];var r=uv(...e),a=uv(...t),s=fv(e)?1:~~(r/5)||1,c=fv(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},f=[],d,m;for(d=0;d<s+1;d++){var h=sv(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=sv(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(m=0;m<c;m++){var g=l[d],w=l[d+1],x=u[m],y=u[m+1],v=Uo(w.x-g.x)<.01?"y":"x",S=Uo(y.x-x.x)<.01?"y":"x",_=gP(g.x,g.y,w.x,w.y,x.x,x.y,y.x,y.y),T;if(_){if(T=_.x.toFixed(9)+"#"+_.y.toFixed(9),p[T])continue;p[T]=!0;var P=g.t+Uo((_[v]-g[v])/(w[v]-g[v]))*(w.t-g.t),D=x.t+Uo((_[S]-x[S])/(y[S]-x[S]))*(y.t-x.t);P>=0&&P<=1&&D>=0&&D<=1&&f.push({x:_.x,y:_.y,t1:P,t2:D})}}return f}function pv(e,t,n){e=gv(e),t=gv(t);for(var i,o,r,a,s,c,l,u,p,f,d=n?0:[],m=0,h=e.length;m<h;m++){var g=e[m];if(g[0]=="M")i=s=g[1],o=c=g[2];else{g[0]=="C"?(p=[i,o,...g.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,x=t.length;w<x;w++){var y=t[w];if(y[0]=="M")r=l=y[1],a=u=y[2];else{y[0]=="C"?(f=[r,a,...y.slice(1)],r=f[6],a=f[7]):(f=[r,a,r,a,l,u,l,u],r=l,a=u);var v=mP(p,f);{for(var S=0,_=v.length;S<_;S++)v[S].segment1=m,v[S].segment2=w,v[S].bez1=p,v[S].bez2=f;d=d.concat(v)}}}}}return d}function yP(e){return av(e)&&av(e[0])}function vP(e){if(pP(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 m=0,h=l.length;m<h;m++)c[m]=l[m];switch(s=s.toUpperCase(),c[0]){case"Z":n=+o,i=+r;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":o=c[c.length-2],r=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=Hf,t}function fv(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function ll(e,t,n,i){return[e,t,n,i,n,i]}function dv(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 hv(e,t,n,i,o,r,a,s,c,l){var u=Wo*120/180,p=Wo/180*(+o||0),f=[],d,m=lP(function($,C,R){var V=$*an.cos(R)-C*an.sin(R),Z=$*an.sin(R)+C*an.cos(R);return{x:V,y:Z}});if(l)T=l[0],P=l[1],S=l[2],_=l[3];else{d=m(e,t,-p),e=d.x,t=d.y,d=m(s,c,-p),s=d.x,c=d.y;var h=(e-s)/2,g=(t-c)/2,w=h*h/(n*n)+g*g/(i*i);w>1&&(w=an.sqrt(w),n=w*n,i=w*i);var x=n*n,y=i*i,v=(r==a?-1:1)*an.sqrt(Uo((x*y-x*g*g-y*h*h)/(x*g*g+y*h*h))),S=v*n*g/i+(e+s)/2,_=v*-i*h/n+(t+c)/2,T=an.asin(((t-_)/i).toFixed(9)),P=an.asin(((c-_)/i).toFixed(9));T=e<S?Wo-T:T,P=s<S?Wo-P:P,T<0&&(T=Wo*2+T),P<0&&(P=Wo*2+P),a&&T>P&&(T=T-Wo*2),!a&&P>T&&(P=P-Wo*2)}var D=P-T;if(Uo(D)>u){var N=P,j=s,H=c;P=T+u*(a&&P>T?1:-1),s=S+n*an.cos(P),c=_+i*an.sin(P),f=hv(s,c,n,i,o,0,a,j,H,[P,N,S,_])}D=P-T;var Q=an.cos(T),ne=an.sin(T),W=an.cos(P),ee=an.sin(P),Se=an.tan(D/4),De=4/3*n*Se,_e=4/3*i*Se,Y=[e,t],ie=[e+De*ne,t-_e*Q],q=[s+De*ee,c-_e*W],X=[s,c];if(ie[0]=2*Y[0]-ie[0],ie[1]=2*Y[1]-ie[1],l)return[ie,q,X].concat(f);f=[ie,q,X].concat(f).join().split(",");for(var ce=[],ye=0,ke=f.length;ye<ke;ye++)ce[ye]=ye%2?m(f[ye-1],f[ye],p).y:m(f[ye],f[ye+1],p).x;return ce}function bP(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,f,d,m,h,g,w,x=0;x<2;++x){if(x==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),Uo(u)<1e-12){if(Uo(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}g=p*p-4*f*u,w=an.sqrt(g),!(g<0)&&(m=(-p+w)/(2*u),0<m&&m<1&&c.push(m),h=(-p-w)/(2*u),0<h&&h<1&&c.push(h))}for(var y=c.length,v=y,S;y--;)d=c[y],S=1-d,l[0][y]=S*S*S*e+3*S*S*d*n+3*S*d*d*o+d*d*d*a,l[1][y]=S*S*S*t+3*S*S*d*i+3*S*d*d*r+d*d*d*s;return l[0][v]=e,l[1][v]=t,l[0][v+1]=a,l[1][v+1]=s,l[0].length=l[1].length=v+2,{x0:Zi(...l[0]),y0:Zi(...l[1]),x1:Qi(...l[0]),y1:Qi(...l[1])}}function gv(e){if(yP(e)||(e=uP(e)),fP(e))return e;for(var t=dP(vP(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,m){var h,g;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",...hv(d.x,d.y,...f.slice(1))];break;case"S":m=="C"||m=="S"?(h=d.x*2-d.bx,g=d.y*2-d.by):(h=d.x,g=d.y),f=["C",h,g,...f.slice(1)];break;case"T":m=="Q"||m=="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",...dv(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",...dv(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...ll(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...ll(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...ll(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...ll(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 m=f[d];m.length;)r[d]="A",f.splice(d++,0,["C",...m.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=ov(u[p-4])||n.x,n.by=ov(u[p-3])||n.y}return t}function kt(e){return gn(e)&&Jn(e,"waypoints")}function nt(e){return gn(e)&&Jn(e,"labelTarget")}function xP(e){return gn(e)&&ia(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 vo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ze(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function ul(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function wP(e){return vo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function _P(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],m=d&&d.endLength||0,h=RP(f,u);l.push({start:f,end:u,startLength:m,endLength:m+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 qe(e){return kt(e)?_P(e):wP(e)}function An(e,t,n){n=n||0,gn(n)||(n={x:n,y:n});var i=ze(e),o=ze(t),r=i.bottom+n.y<=o.top,a=i.left-n.x>=o.right,s=i.top-n.y>=o.bottom,c=i.right+n.x<=o.left,l=r?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function Es(e,t,n){var i=EP(e,t);return i.length===1||i.length===2&&_s(i[0],i[1])<1?vo(i[0]):i.length>1?(i=Ui(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),vo(i[n?0:i.length-1])):null}function EP(e,t){return pv(e,t)}function SP(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],_s(n,o)===0||$f(i,o,n)?e.splice(t,1):t++;return e}function RP(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function pl(e,t){return Math.round(e*t)/t}function yv(e){return Ue(e)?e+"px":e}function CP(e){for(;e.parent;)e=e.parent;return e}function MP(e){e=U({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Gn(n,{position:"relative",overflow:"hidden",width:yv(e.width),height:yv(e.height)}),t.appendChild(n),n}function vv(e,t,n){const i=Be("g");lt(i).add(t);const o=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const AP="base",bv=0,PP=1,TP={shape:["x","y","width","height"],connection:["waypoints"]};function Ye(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||{})}Ye.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Ye.prototype._init=function(e){const t=this._eventBus,n=this._container=MP(e),i=this._svg=Be("svg");Ce(i,{width:"100%",height:"100%"}),En(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,r=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),Ke(n,i);const o=this._viewport=vv(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Cp(this._viewboxChanged,300)),this._restoreFocus=Cp(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)},Ye.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},Ye.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Ye.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=tv(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Ye.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Ye.prototype.restoreFocus=function(){this._restoreFocus()},Ye.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Ye.prototype.isFocused=function(){return this._focused},Ye.prototype.getDefaultLayer=function(){return this.getLayer(AP,bv)},Ye.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},Ye.prototype._getChildIndex=function(e){return ei(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Ye.prototype._createLayer=function(e,t){typeof t>"u"&&(t=PP);const n=this._getChildIndex(t);return{group:vv(this._viewport,"layer-"+e,n),index:t,visible:!0}},Ye.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},Ye.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&&(on(n),t.visible=!1),n},Ye.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],on(t.group))},Ye.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Ye.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const o=this._findPlaneForRoot(CP(i));if(!o||n&&o.rootElement!==n)return;n=o.rootElement}return n},Ye.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Ye.prototype._findPlaneForRoot=function(e){return It(this._planes,function(t){return t.rootElement===e})},Ye.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Ye.prototype._resolveElements=function(e){return We(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Ye.prototype.getContainer=function(){return this._container},Ye.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&&(G([i.gfx,i.secondaryGfx],function(o){o&&(n?(e.markers.add(t),lt(o).add(t)):(e.markers.delete(t),lt(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Ye.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Ye.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Ye.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Ye.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Ye.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Ye.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,bv);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Ye.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},Ye.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},Ye.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)},Ye.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})},Ye.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})},Ye.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=TP[e];if(!Lo(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Ye.prototype._setParent=function(e,t,n){en(t.children,e,n),e.parent=t},Ye.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},Ye.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Ye.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Ye.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),Jt(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},Ye.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Ye.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Ye.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Ye.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Ye.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Ye.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);vs(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=vs(t),o=a?a.matrix:IA(),s=pl(o.a,1e3),c=pl(-o.e||0,1e3),l=pl(-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},Ye.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=U({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),xv(t,n)}),{x:n.e,y:n.f}},Ye.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const o=this.findRoot(i);if(!o)return;o!==this.getRootElement()&&this.setRootElement(o);const r=i.filter(m=>m!=o);if(!r.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=rn(r),s=ze(a),c=this.viewbox(),l=this.zoom();let u,p;c.y+=t.top/l,c.x+=t.left/l,c.width-=(t.right+t.left)/l,c.height-=(t.bottom+t.top)/l;const f=ze(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,p=a.y-c.y;else{const m=Math.max(0,s.right-f.right),h=Math.min(0,s.left-f.left),g=Math.max(0,s.bottom-f.bottom),w=Math.min(0,s.top-f.top);u=m||h,p=g||w}this.scroll({dx:-u*l,dy:-p*l})},Ye.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)}),pl(i.a,1e3)};function xv(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Ye.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},Ye.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,o=n.createSVGMatrix(),r=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const p=c.a;return t?(a=U(r,t),s=a.matrixTransform(c.inverse()),l=o.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),u=c.multiply(l)):u=o.scale(e),xv(this._viewport,u),u},Ye.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Ye.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}},Ye.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var ba="data-element-id";function hi(e){this._elements={},this._eventBus=e}hi.$inject=["eventBus"],hi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Ce(t,ba,i),n&&Ce(n,ba,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},hi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Ce(i.gfx,ba,""),i.secondaryGfx&&Ce(i.secondaryGfx,ba,""),delete t[n])},hi.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)},hi.prototype.updateGraphics=function(e,t,n){var i=e.id||e,o=this._elements[i];return n?o.secondaryGfx=t:o.gfx=t,t&&Ce(t,ba,i),t},hi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Ce(e,ba);var n=this._elements[t];return n&&n.element},hi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},hi.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}},hi.prototype.getAll=function(){return this.filter(function(e){return e})},hi.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)})},hi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},hi.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 kP(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 OP(e){return e.__refs_collection===!0}function DP(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function wv(e,t,n){var i=kP(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 LP(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 wi(e,t){if(!(this instanceof wi))return new wi(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}wi.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?wv(this,t,e):LP(this,t,e)},wi.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return OP(n)||wv(this,t,e),n},wi.prototype.ensureBound=function(e,t){DP(e,t)||this.bind(e,t)},wi.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},wi.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var zf=new wi({name:"children",enumerable:!0,collection:!0},{name:"parent"}),_v=new wi({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Ev=new wi({name:"attachers",collection:!0},{name:"host"}),Sv=new wi({name:"outgoing",collection:!0},{name:"source"}),Rv=new wi({name:"incoming",collection:!0},{name:"target"});function xa(){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)}}),zf.bind(this,"parent"),_v.bind(this,"labels"),Sv.bind(this,"outgoing"),Rv.bind(this,"incoming")}function Ss(){xa.call(this),zf.bind(this,"children"),Ev.bind(this,"host"),Ev.bind(this,"attachers")}Te(Ss,xa);function Cv(){xa.call(this),zf.bind(this,"children")}Te(Cv,Ss);function Mv(){Ss.call(this),_v.bind(this,"labelTarget")}Te(Mv,Ss);function Av(){xa.call(this),Sv.bind(this,"source"),Rv.bind(this,"target")}Te(Av,xa);var IP={connection:Av,shape:Ss,label:Mv,root:Cv};function BP(e,t){var n=IP[e];if(!n)throw new Error("unknown type: <"+e+">");return U(new n,t)}function NP(e){return e instanceof xa}function bo(){this._uid=12}bo.prototype.createRoot=function(e){return this.create("root",e)},bo.prototype.createLabel=function(e){return this.create("label",e)},bo.prototype.createShape=function(e){return this.create("shape",e)},bo.prototype.createConnection=function(e){return this.create("connection",e)},bo.prototype.create=function(e,t){return t=U({},t||{}),t.id||(t.id=e+"_"+this._uid++),BP(e,t)};var fl="__fn",Pv=1e3,$P=Array.prototype.slice;function ni(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}ni.prototype.on=function(e,t,n,i){if(e=We(e)?e:[e],bn(t)&&(i=n,n=t,t=Pv),!Ue(t))throw new Error("priority must be a number");var o=n;i&&(o=Yn(n,i),o[fl]=n[fl]||n);var r=this;e.forEach(function(a){r._addListener(a,{priority:t,callback:o,next:null})})},ni.prototype.once=function(e,t,n,i){var o=this;if(bn(t)&&(i=n,n=t,t=Pv),!Ue(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[fl]=n,this.on(e,t,r)},ni.prototype.off=function(e,t){e=We(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},ni.prototype.createEvent=function(e){var t=new Rs;return t.init(e),t},ni.prototype.fire=function(e,t){var n,i,o,r;if(r=$P.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 Rs?n=t:n=this.createEvent(t),r[0]=n;var a=n.type;e!==a&&(n.type=e);try{o=this._invokeListeners(n,r,i)}finally{e!==a&&(n.type=a)}return o===void 0&&n.defaultPrevented&&(o=!1),o}},ni.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},ni.prototype._destroy=function(){this._listeners={}},ni.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},ni.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=FP(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(o){if(!this.handleError(o))throw console.error("unhandled error in event listener",o),o}return i},ni.prototype._addListener=function(e,t){var n=this._getListeners(e),i;if(!n){this._setListeners(e,t);return}for(;n;){if(n.priority<t.priority){t.next=n,i?i.next=t:this._setListeners(e,t);return}i=n,n=n.next}i.next=t},ni.prototype._getListeners=function(e){return this._listeners[e]},ni.prototype._setListeners=function(e,t){this._listeners[e]=t},ni.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,o,r;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,r=n.callback,(r===t||r[fl]===t)&&(o?o.next=i:this._setListeners(e,i)),o=n,n=i};function Rs(){}Rs.prototype.stopPropagation=function(){this.cancelBubble=!0},Rs.prototype.preventDefault=function(){this.defaultPrevented=!0},Rs.prototype.init=function(e){U(this,e||{})};function FP(e,t){return e.apply(null,t)}function Yo(e){return e.childNodes[0]}function jP(e){return e.parentNode.childNodes[1]}function dl(e,t,n,i,o){var r=ys();r.setTranslate(t,n);var a=ys();a.setRotate(i||0,0,0);var s=ys();s.setScale(1,1),vs(e,[r,a,s])}function Pn(e,t,n){var i=ys();i.setTranslate(t,n),vs(e,i)}function Tv(e,t){var n=ys();n.setRotate(t,0,0),vs(e,n)}function gi(e,t){this._eventBus=e,this._elementRegistry=t}gi.$inject=["eventBus","elementRegistry"],gi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=jP(t),n||(n=Be("g"),lt(n).add("djs-children"),Ke(t.parentNode,n))):n=t,n},gi.prototype._clear=function(e){var t=Yo(e);return il(t),t},gi.prototype._createContainer=function(e,t,n,i){var o=Be("g");lt(o).add("djs-group"),typeof n<"u"?HP(o,t,t.childNodes[n]):Ke(t,o);var r=Be("g");lt(r).add("djs-element"),lt(r).add("djs-"+e),i&&lt(r).add("djs-frame"),Ke(o,r);var a=Be("g");return lt(a).add("djs-visual"),Ke(r,a),r},gi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,nv(t))},gi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=ei(e,function(o,r){return r.parent&&(o[r.parent.id]=r.parent),o},{}),G(i,function(o){var r=o.children;if(r){var a=t._getChildrenContainer(o),s=a.firstChild;G(r,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},gi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},gi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},gi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},gi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},gi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Pn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Ce(n,"display","none"):Ce(n,"display","block")}},gi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);on(t.parentNode)};function HP(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const zP={__depends__:[tP],__init__:["canvas"],canvas:["type",Ye],elementRegistry:["type",hi],elementFactory:["type",bo],eventBus:["type",ni],graphicsFactory:["type",gi]};function GP(e){var t=new ev(e);return t.init(),t}function VP(e){e=e||{};var t={config:["value",e]},n=[t,zP].concat(e.modules||[]);return GP(n)}function Ko(e,t){this._injector=t||VP(e),this.get("eventBus").fire("diagram.init")}Ko.prototype.get=function(e,t){return this._injector.get(e,t)},Ko.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Ko.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Ko.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Nn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Kn(e,t){return e.$instanceOf(t)}function WP(e){return It(e.rootElements,function(t){return Kn(t,"bpmn:Process")||Kn(t,"bpmn:Collaboration")})}function UP(e){var t={},n=[],i={};function o(q,X){return function(ce){q(ce,X)}}function r(q){t[q.id]=q}function a(q){return t[q.id]}function s(q,X){var ce=q.gfx;if(ce)throw new Error(`already rendered ${Nn(q)}`);return e.element(q,i[q.id],X)}function c(q,X){return e.root(q,i[q.id],X)}function l(q,X){try{var ce=i[q.id]&&s(q,X);return r(q),ce}catch(ye){u(ye.message,{element:q,error:ye}),console.error(`failed to import ${Nn(q)}`,ye)}}function u(q,X){e.error(q,X)}var p=this.registerDi=function(X){var ce=X.bpmnElement;ce?i[ce.id]?u(`multiple DI elements defined for ${Nn(ce)}`,{element:ce}):i[ce.id]=X:u(`no bpmnElement referenced in ${Nn(X)}`,{element:X})};function f(q){d(q.plane)}function d(q){p(q),G(q.planeElement,m)}function m(q){p(q)}this.handleDefinitions=function(X,ce){var ye=X.diagrams;if(ce&&ye.indexOf(ce)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ce&&ye&&ye.length&&(ce=ye[0]),!ce)throw new Error("no diagram to display");i={},f(ce);var ke=ce.plane;if(!ke)throw new Error(`no plane for ${Nn(ce)}`);var $=ke.bpmnElement;if(!$)if($=WP(X),$)u(`correcting missing bpmnElement on ${Nn(ke)} to ${Nn($)}`),ke.bpmnElement=$,p(ke);else throw new Error("no process or collaboration to display");var C=c($,ke);if(Kn($,"bpmn:Process")||Kn($,"bpmn:SubProcess"))g($,C);else if(Kn($,"bpmn:Collaboration"))Y($,C),w(X.rootElements,C);else throw new Error(`unsupported bpmnElement for ${Nn(ke)}: ${Nn($)}`);h(n)};var h=this.handleDeferred=function(){for(var X;n.length;)X=n.shift(),X()};function g(q,X){Se(q,X),D(q.ioSpecification,X),P(q.artifacts,X),r(q)}function w(q,X){var ce=rt(q,function(ye){return!a(ye)&&Kn(ye,"bpmn:Process")&&ye.laneSets});ce.forEach(o(g,X))}function x(q,X){l(q,X)}function y(q,X){G(q,o(x,X))}function v(q,X){l(q,X)}function S(q,X){l(q,X)}function _(q,X){l(q,X)}function T(q,X){l(q,X)}function P(q,X){G(q,function(ce){Kn(ce,"bpmn:Association")?n.push(function(){T(ce,X)}):T(ce,X)})}function D(q,X){q&&(G(q.dataInputs,o(S,X)),G(q.dataOutputs,o(_,X)))}var N=this.handleSubProcess=function(X,ce){Se(X,ce),P(X.artifacts,ce)};function j(q,X){var ce=l(q,X);Kn(q,"bpmn:SubProcess")&&N(q,ce||X),Kn(q,"bpmn:Activity")&&D(q.ioSpecification,X),n.push(function(){G(q.dataInputAssociations,o(v,X)),G(q.dataOutputAssociations,o(v,X))})}function H(q,X){l(q,X)}function Q(q,X){l(q,X)}function ne(q,X){n.push(function(){var ce=l(q,X);q.childLaneSet&&W(q.childLaneSet,ce||X),ie(q)})}function W(q,X){G(q.lanes,o(ne,X))}function ee(q,X){G(q,o(W,X))}function Se(q,X){De(q.flowElements,X),q.laneSets&&ee(q.laneSets,X)}function De(q,X){G(q,function(ce){Kn(ce,"bpmn:SequenceFlow")?n.push(function(){H(ce,X)}):Kn(ce,"bpmn:BoundaryEvent")?n.unshift(function(){j(ce,X)}):Kn(ce,"bpmn:FlowNode")?j(ce,X):Kn(ce,"bpmn:DataObject")||(Kn(ce,"bpmn:DataStoreReference")||Kn(ce,"bpmn:DataObjectReference")?Q(ce,X):u(`unrecognized flowElement ${Nn(ce)} in context ${Nn(X&&X.businessObject)}`,{element:ce,context:X}))})}function _e(q,X){var ce=l(q,X),ye=q.processRef;ye&&g(ye,ce||X)}function Y(q,X){G(q.participants,o(_e,X)),n.push(function(){y(q.messageFlows,X)}),P(q.artifacts,X)}function ie(q){G(q.flowNodeRef,function(X){var ce=X.get("lanes");ce&&ce.push(q)})}}function qP(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(h,g){return i.add(h,g)},element:function(h,g,w){return i.add(h,g,w)},error:function(h,g){s.push({message:h,context:g})}},f=new UP(p);u=u||l.diagrams&&l.diagrams[0];var d=YP(l,u);if(!d)throw new Error("no diagram to display");G(d,function(h){f.handleDefinitions(l,h)});var m=u.plane.bpmnElement.id;r.setRootElement(r.findRoot(m+"_plane")||r.findRoot(m))}return new Promise(function(l,u){try{return i=e.get("bpmnImporter"),o=e.get("eventBus"),r=e.get("canvas"),o.fire("import.render.start",{definitions:t}),c(t,n),o.fire("import.render.complete",{error:a,warnings:s}),l({warnings:s})}catch(p){return p.warnings=s,u(p)}})}function YP(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!A(n,"bpmn:Process")&&!A(n,"bpmn:Collaboration")&&(i=KP(n));var o;A(i,"bpmn:Collaboration")?o=i:o=It(e.rootElements,function(l){if(A(l,"bpmn:Collaboration"))return It(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=In(o.participants,function(l){return l.processRef}),r.push(o));var a=kv(r),s=[t],c=[n];return G(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 kv(e){var t=[];return G(e,function(n){n&&(t.push(n),t=t.concat(kv(n.flowElements)))}),t}function KP(e){for(var t=e;t;){if(A(t,"bpmn:Process"))return t;t=t.$parent}}var XP='<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>',Ov=XP,Dv={verticalAlign:"middle"},Lv={color:"#404040"},ZP={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},QP={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},JP={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">'+Ov+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',Ji;function tT(){Ji=$t(eT),Gn(Ji,ZP),Gn(Rt("svg",Ji),Dv),Gn(Rt(".backdrop",Ji),QP),Gn(Rt(".notice",Ji),JP),Gn(Rt(".link",Ji),Lv,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function nT(){Ji||(tT(),ti.bind(Ji,".backdrop","click",function(e){document.body.removeChild(Ji)})),document.body.appendChild(Ji)}const hl=5,Iv="djs-outline-hidden";function Vt(e){e=U({},oT,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),aT(this._container)}Te(Vt,Ko),Vt.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||[]),gl(s,r),s=iT(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Vt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Vt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw gl(r,[]),r}if(typeof t=="string"&&(i=rT(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw gl(r,[]),r}try{this.clear()}catch(r){throw gl(r,[]),r}const{warnings:o}=await qP(this,n,i);return{warnings:o}},Vt.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},Vt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=Rt(":scope > defs",i._svg),a=Jy(o),s=r?"<defs>"+Jy(r)+"</defs>":"",c=i.getContainer();Ct(c).add(Iv);let l;try{l=o.getBBox()}finally{Ct(c).remove(Iv)}const u=l.x-hl,p=l.y-hl,f=l.width+hl*2,d=l.height+hl*2;t=`<?xml version="1.0" encoding="utf-8"?>
8
8
  <!-- created with bpmn-js / http://bpmn.io -->
9
9
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
10
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+u+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Gt.prototype._setDefinitions=function(e){this._definitions=e},Gt.prototype.getModules=function(){return this._modules},Gt.prototype.clear=function(){this.getDefinitions()&&Ko.prototype.clear.call(this)},Gt.prototype.destroy=function(){Ko.prototype.destroy.call(this),Xi(this._container)},Gt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Gt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Gt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=Et(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Gt.prototype.getDefinitions=function(){return this._definitions},Gt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Gt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),o=n.additionalModules||[],r=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(r,i,o),s=V(qi(n,["additionalModules"]),{canvas:V({},n.canvas,{container:e}),modules:a});Ko.call(this,s),n&&n.container&&this.attachTo(n.container)},Gt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Gt.prototype._createContainer=function(e){const t=$t('<div class="bjs-container"></div>');return Wn(t,{width:Tv(e.width),height:Tv(e.height),position:e.position}),t},Gt.prototype._createModdle=function(e){const t=V({},this._moddleExtensions,e.moddleExtensions);return new im(t)},Gt.prototype._modules=[];function gl(e,t){return e.warnings=t,e}function XP(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 ZP={width:"100%",height:"100%",position:"relative"};function Tv(e){return e+(Ue(e)?"px":"")}function QP(e,t){return t&&Lt(e.diagrams,function(n){return n.id===t})||null}function JP(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Cv+"</a>",i=$t(n);Wn(Et("svg",i),Mv),Wn(i,Av,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Fe.bind(i,"click",function(o){KP(),o.preventDefault()})}function va(e){Gt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Me(va,Gt),va.prototype._createModdle=function(e){var t=Gt.prototype._createModdle.call(this,e);return t.ids=new Ki([32,36,1]),t},va.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,o;i.clear();for(o in t)i.claim(o,t[o])};function ut(e,t){return M(e,"bpmn:CallActivity")?!1:M(e,"bpmn:SubProcess")?(t=t||dt(e),t&&M(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):M(e,"bpmn:Participant")?!!ge(e).processRef:!0}function xn(e){if(!(!M(e,"bpmn:Participant")&&!M(e,"bpmn:Lane"))){var t=dt(e).isHorizontal;return t===void 0?!0:t}}function eT(e){return e&&ge(e).isInterrupting!==!1}function jn(e){return e&&!!ge(e).triggeredByEvent}function ba(e,t){var n=ge(e).eventDefinitions;return Io(n,function(i){return M(i,t)})}function tT(e){return ba(e,"bpmn:ErrorEventDefinition")}function nT(e){return ba(e,"bpmn:EscalationEventDefinition")}function iT(e){return ba(e,"bpmn:CompensateEventDefinition")}var Tr={width:90,height:20},kv=15;function Xo(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 ml(e){return it(e.label)}function oT(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=rT(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-=kv:a+=kv,{x:a,y:s}}function rT(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 Hf(e){return e.waypoints?oT(e.waypoints):M(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Tr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Tr.height/2}}function aT(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Tr.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=Hf(t),i=Tr),V({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Ov(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 sT(e){var t=e.categoryValueRef;return t&&t.value||""}function yi(e){var t=e.businessObject,n=Ov(t);if(n)return n==="categoryValueRef"?sT(t):t[n]||""}function cT(e,t){var n=e.businessObject,i=Ov(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function lT(e){return it(e)&&Xo(e.labelTarget)}var xa=7;function Dv(e){let t=[];return z(e.incoming,n=>{M(n,"bpmn:Association")&&M(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),z(e.outgoing,n=>{M(n,"bpmn:Association")&&M(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Cs(e){const t=new Map;return z(Lf(e),n=>{z(Dv(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%)",uT="white";function eo(e,t){return Io(e.eventDefinitions,function(n){return n.$type===t})}function pT(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function fT(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function at(e,t,n){var i=dt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||uT}function Re(e,t,n){var i=dt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||zf}function Ms(e,t,n,i){var o=dt(e),r=o.get("label");return i||r&&r.get("color:color")||t||Re(e,n)}function Lv(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 Ar(o)}function Gf(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 Ar(a)}function dT(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 Ar(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 Ar(r)}function As(e,t={}){return{width:_i(e,t),height:oi(e,t)}}function _i(e,t={}){return ei(t,"width")?t.width:e.width}function oi(e,t={}){return ei(t,"height")?t.height:e.height}var gT=new Ki,mT=10,yl=3,yT=1.5,vl=10,vT=4,_a=.95,bT=1,xT=.25;function kr(e,t,n,i,o,r,a){mo.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:R={x:0,y:0},scale:G=1,element:K,parentGfx:ie=o._svg}=C,Pe=Be("marker",{id:N,viewBox:"0 0 20 20",refX:R.x,refY:R.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});Ke(Pe,K);var et=Et(":scope > defs",ie);et||(et=Be("defs"),Ke(ie,et)),Ke(et,Pe)}function d(N,C,R,G){var K=gT.nextPrefixed("marker-");return g(N,K,C,R,G),"url(#"+K+")"}function g(N,C,R,G,K){if(R==="sequenceflow-end"){var ie=Be("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:K,stroke:K,strokeWidth:1})});f(C,{element:ie,ref:{x:11,y:10},scale:.5,parentGfx:N})}if(R==="messageflow-start"){var Pe=Be("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:K,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Pe,ref:{x:6,y:6},parentGfx:N})}if(R==="messageflow-end"){var et=Be("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:K,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:et,ref:{x:8.5,y:5},parentGfx:N})}if(R==="association-start"){var mt=Be("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:K,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(C,{element:mt,ref:{x:1,y:10},scale:.5,parentGfx:N})}if(R==="association-end"){var qt=Be("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(R==="conditional-flow-marker"){var Ct=Be("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:K})});f(C,{element:Ct,ref:{x:-1,y:10},scale:.5,parentGfx:N})}if(R==="conditional-default-flow-marker"){var vn=Be("path",{d:"M 6 4 L 10 16",...u({stroke:K,fill:"none"})});f(C,{element:vn,ref:{x:0,y:10},scale:.5,parentGfx:N})}}function h(N,C,R,G,K={}){hn(G)&&(K=G,G=0),G=G||0,K=u(K);var ie=C/2,Pe=R/2,et=Be("circle",{cx:ie,cy:Pe,r:Math.round((C+R)/4-G),...K});return Ke(N,et),et}function m(N,C,R,G,K,ie){hn(K)&&(ie=K,K=0),K=K||0,ie=u(ie);var Pe=Be("rect",{x:K,y:K,width:C-K*2,height:R-K*2,rx:G,ry:G,...ie});return Ke(N,Pe),Pe}function _(N,C,R,G){var K=C/2,ie=R/2,Pe=[{x:K,y:0},{x:C,y:ie},{x:K,y:R},{x:0,y:ie}],et=Pe.map(function(qt){return qt.x+","+qt.y}).join(" ");G=u(G);var mt=Be("polygon",{...G,points:et});return Ke(N,mt),mt}function x(N,C,R,G){R=p(R);var K=bs(C,R,G);return Ke(N,K),K}function y(N,C,R){return x(N,C,R,5)}function v(N,C,R){R=p(R);var G=Be("path",{...R,d:C});return Ke(N,G),G}function E(N,C,R,G){return v(C,R,V({"data-marker":N},G))}function w(N){return Le[N]}function T(N){return function(C,R,G){return w(N)(C,R,G)}}var P={"bpmn:MessageEventDefinition":function(N,C,R={},G){var K=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.235,my:.315}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill),Pe=G?at(C,s,R.fill):Re(C,c,R.stroke),et=v(N,K,{fill:ie,stroke:Pe,strokeWidth:1});return et},"bpmn:TimerEventDefinition":function(N,C,R={}){var G=R.width||C.width,K=R.height||C.height,ie=R.width?1:2,Pe=h(N,G,K,.2*K,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:ie}),et=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:K,position:{mx:.5,my:.5}});v(N,et,{stroke:Re(C,c,R.stroke),strokeWidth:ie});for(var mt=0;mt<12;mt++){var qt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:K,position:{mx:.5,my:.5}}),Ct=G/2,vn=K/2;v(N,qt,{strokeWidth:1,stroke:Re(C,c,R.stroke),transform:"rotate("+mt*30+","+vn+","+Ct+")"})}return Pe},"bpmn:EscalationEventDefinition":function(N,C,R={},G){var K=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill);return v(N,K,{fill:ie,stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(N,C,R={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.222}});return v(N,G,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(N,C,R={},G){var K=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.57,my:.263}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill);return v(N,K,{fill:ie,stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(N,C,R={},G){var K=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.2,my:.722}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill);return v(N,K,{fill:ie,stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(N,C,R={},G){var K=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.638,my:-.055}}),ie=G?Re(C,c,R.stroke):"none",Pe=v(N,K,{fill:ie,stroke:Re(C,c,R.stroke),strokeWidth:1});return Sv(Pe,45),Pe},"bpmn:CompensateEventDefinition":function(N,C,R={},G){var K=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.22,my:.5}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill);return v(N,K,{fill:ie,stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(N,C,R={},G){var K=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill);return v(N,K,{strokeWidth:1,fill:ie,stroke:Re(C,c,R.stroke)})},"bpmn:MultipleEventDefinition":function(N,C,R={},G){var K=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.211,my:.36}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill);return v(N,K,{fill:ie,stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(N,C,R={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.458,my:.194}});return v(N,G,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(N,C,R={}){var G=h(N,C.width,C.height,8,{fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke),strokeWidth:4});return G}};function O(N,C,R={},G){var K=ge(N),ie=pT(K),Pe=G||N;return K.get("eventDefinitions")&&K.get("eventDefinitions").length>1?K.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](C,Pe,R,ie):P["bpmn:MultipleEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](C,Pe,R,ie):null}var B={ParticipantMultiplicityMarker:function(N,C,R={}){var G=_i(C,R),K=oi(C,R),ie=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:K,position:{mx:(G/2-6)/G,my:(K-15)/K}});E("participant-multiplicity",N,ie,{strokeWidth:2,fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)})},SubProcessMarker:function(N,C,R={}){var G=m(N,14,14,0,{strokeWidth:1,fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)});Dn(G,C.width/2-7.5,C.height-20);var K=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2-7.5)/C.width,my:(C.height-20)/C.height}});E("sub-process",N,K,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)})},ParallelMarker:function(N,C,R){var G=_i(C,R),K=oi(C,R),ie=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:K,position:{mx:(G/2+R.parallel)/G,my:(K-20)/K}});E("parallel",N,ie,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)})},SequentialMarker:function(N,C,R){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+R.seq)/C.width,my:(C.height-19)/C.height}});E("sequential",N,G,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)})},CompensationMarker:function(N,C,R){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+R.compensation)/C.width,my:(C.height-13)/C.height}});E("compensation",N,G,{strokeWidth:1,fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)})},LoopMarker:function(N,C,R){var G=_i(C,R),K=oi(C,R),ie=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:K,position:{mx:(G/2+R.loop)/G,my:(K-7)/K}});E("loop",N,ie,{strokeWidth:1.5,fill:"none",stroke:Re(C,c,R.stroke),strokeMiterlimit:.5})},AdhocMarker:function(N,C,R){var G=_i(C,R),K=oi(C,R),ie=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:K,position:{mx:(G/2+R.adhoc)/G,my:(K-15)/K}});E("adhoc",N,ie,{strokeWidth:1,fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke)})}};function $(N,C,R,G){B[N](C,R,G)}function H(N,C,R=[],G={}){G={fill:G.fill,stroke:G.stroke,width:_i(C,G),height:oi(C,G)};var K=ge(C),ie=R.includes("SubProcessMarker");ie?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},K.get("isForCompensation")&&R.push("CompensationMarker"),M(K,"bpmn:AdHocSubProcess")&&(R.push("AdhocMarker"),ie||V(G,{compensation:G.compensation-18}));var Pe=K.get("loopCharacteristics"),et=Pe&&Pe.get("isSequential");Pe&&(V(G,{compensation:G.compensation-18}),R.includes("AdhocMarker")&&V(G,{seq:-23,loop:-18,parallel:-24}),et===void 0&&R.push("LoopMarker"),et===!1&&R.push("ParallelMarker"),et===!0&&R.push("SequentialMarker")),R.includes("CompensationMarker")&&R.length===1&&V(G,{compensation:-8}),z(R,function(mt){$(mt,N,C,G)})}function Q(N,C,R={}){R=V({size:{width:100}},R);var G=r.createText(C||"",R);return lt(G).add("djs-label"),Ke(N,G),G}function J(N,C,R,G={}){var K=ge(C),ie=As({x:C.x,y:C.y,width:C.width,height:C.height},G);return Q(N,K.name,{align:R,box:ie,padding:7,style:{fill:Ms(C,l,c,G.stroke)}})}function X(N,C,R={}){var G={width:C.width,height:C.height,x:C.width/2+C.x,y:C.height/2+C.y};return Q(N,yi(C),{box:G,style:V({},r.getExternalStyle(),{fill:Ms(C,l,c,R.stroke)})})}function me(N,C,R,G={}){var K=xn(R),ie=Q(N,C,{box:{height:30,width:K?oi(R,G):_i(R,G)},align:"center-middle",style:{fill:Ms(R,l,c,G.stroke)}});if(K){var Pe=-1*oi(R,G);dl(ie,0,-Pe,270)}}function Ae(N,C,R={}){var{width:G,height:K}=As(C,R);return m(N,G,K,vl,{...R,fill:at(C,s,R.fill),fillOpacity:_a,stroke:Re(C,c,R.stroke)})}function Oe(N,C,R={}){var G=ge(C),K=at(C,s,R.fill),ie=Re(C,c,R.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(R.markerEnd=d(N,"association-end",K,ie)),G.get("associationDirection")==="Both"&&(R.markerStart=d(N,"association-start",K,ie)),R=ht(R,["markerStart","markerEnd"]),y(N,C.waypoints,{...R,stroke:ie,strokeDasharray:"0, 5"})}function Ee(N,C,R={}){var G=at(C,s,R.fill),K=Re(C,c,R.stroke),ie=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}}),Pe=v(N,ie,{fill:G,fillOpacity:_a,stroke:K}),et=ge(C);if(fT(et)){var mt=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.33,my:(C.height-18)/C.height}});v(N,mt,{strokeWidth:2,fill:G,stroke:K})}return Pe}function W(N,C,R={}){return h(N,C.width,C.height,{fillOpacity:_a,...R,fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)})}function ne(N,C,R={}){return _(N,C.width,C.height,{fill:at(C,s,R.fill),fillOpacity:_a,stroke:Re(C,c,R.stroke)})}function U(N,C,R={}){var G=m(N,_i(C,R),oi(C,R),0,{fill:at(C,s,R.fill),fillOpacity:R.fillOpacity||_a,stroke:Re(C,c,R.stroke),strokeWidth:1.5}),K=ge(C);if(M(K,"bpmn:Lane")){var ie=K.get("name");me(N,ie,C,R)}return G}function Y(N,C,R={}){var G=Ae(N,C,R),K=ut(C);if(jn(C)&&(Se(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!K)){var ie=ge(C).flowElements||[],Pe=ie.filter(et=>M(et,"bpmn:StartEvent"));Pe.length===1&&re(Pe[0],N,R,C)}return J(N,C,K?"center-top":"center-middle",R),K?H(N,C,void 0,R):H(N,C,["SubProcessMarker"],R),G}function re(N,C,R,G){var K=22,ie={fill:at(G,s,R.fill),stroke:Re(G,c,R.stroke),width:K,height:K},Pe=ge(N).isInterrupting,et=Pe?0:3,mt=Pe?1:1.2,qt=20,Ct=(K-qt)/2,vn="translate("+Ct+","+Ct+")";h(C,qt,qt,{fill:ie.fill,stroke:ie.stroke,strokeWidth:mt,strokeDasharray:et,transform:vn}),O(N,C,ie,G)}function he(N,C,R={}){var G=Ae(N,C,R);return J(N,C,"center-middle",R),H(N,C,void 0,R),G}var Le=this.handlers={"bpmn:AdHocSubProcess":function(N,C,R={}){return ut(C)?R=ht(R,["fill","stroke","width","height"]):R=ht(R,["fill","stroke"]),Y(N,C,R)},"bpmn:Association":function(N,C,R={}){return R=ht(R,["fill","stroke"]),Oe(N,C,R)},"bpmn:BoundaryEvent":function(N,C,R={}){var{renderIcon:G=!0}=R;R=ht(R,["fill","stroke"]);var K=ge(C),ie=K.get("cancelActivity");R={strokeWidth:1.5,fill:at(C,s,R.fill),fillOpacity:bT,stroke:Re(C,c,R.stroke)},ie||(R.strokeDasharray="6");var Pe=W(N,C,R);return h(N,C.width,C.height,yl,{...R,fill:"none"}),G&&O(C,N,R),Pe},"bpmn:BusinessRuleTask":function(N,C,R={}){R=ht(R,["fill","stroke"]);var G=he(N,C,R),K=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),ie=v(N,K);Se(ie,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1});var Pe=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),et=v(N,Pe);return Se(et,{fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(N,C,R={}){return R=ht(R,["fill","stroke"]),Y(N,C,{strokeWidth:5,...R})},"bpmn:ComplexGateway":function(N,C,R={}){R=ht(R,["fill","stroke"]);var G=ne(N,C,R),K=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.26}});return v(N,K,{fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(N,C,R={}){R=ht(R,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),K=Ee(N,C,R);return v(N,G,{fill:"none",stroke:Re(C,c,R.stroke),strokeWidth:1}),K},"bpmn:DataInputAssociation":function(N,C,R={}){return R=ht(R,["fill","stroke"]),Oe(N,C,{...R,markerEnd:d(N,"association-end",at(C,s,R.fill),Re(C,c,R.stroke))})},"bpmn:DataObject":function(N,C,R={}){return R=ht(R,["fill","stroke"]),Ee(N,C,R)},"bpmn:DataObjectReference":T("bpmn:DataObject"),"bpmn:DataOutput":function(N,C,R={}){R=ht(R,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),K=Ee(N,C,R);return v(N,G,{strokeWidth:1,fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke)}),K},"bpmn:DataOutputAssociation":function(N,C,R={}){return R=ht(R,["fill","stroke"]),Oe(N,C,{...R,markerEnd:d(N,"association-end",at(C,s,R.fill),Re(C,c,R.stroke))})},"bpmn:DataStoreReference":function(N,C,R={}){R=ht(R,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:0,my:.133}});return v(N,G,{fill:at(C,s,R.fill),fillOpacity:_a,stroke:Re(C,c,R.stroke),strokeWidth:2})},"bpmn:EndEvent":function(N,C,R={}){var{renderIcon:G=!0}=R;R=ht(R,["fill","stroke"]);var K=W(N,C,{...R,strokeWidth:4});return G&&O(C,N,R),K},"bpmn:EventBasedGateway":function(N,C,R={}){R=ht(R,["fill","stroke"]);var G=ge(C),K=ne(N,C,R);h(N,C.width,C.height,C.height*.2,{fill:at(C,"none",R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1});var ie=G.get("eventGatewayType"),Pe=!!G.get("instantiate");function et(){var qt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:C.width,containerHeight:C.height,position:{mx:.36,my:.44}});v(N,qt,{fill:"none",stroke:Re(C,c,R.stroke),strokeWidth:2})}if(ie==="Parallel"){var mt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}});v(N,mt,{fill:"none",stroke:Re(C,c,R.stroke),strokeWidth:1})}else ie==="Exclusive"&&(Pe||h(N,C.width,C.height,C.height*.26,{fill:"none",stroke:Re(C,c,R.stroke),strokeWidth:1}),et());return K},"bpmn:ExclusiveGateway":function(N,C,R={}){R=ht(R,["fill","stroke"]);var G=ne(N,C,R),K=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.32,my:.3}}),ie=dt(C);return ie.get("isMarkerVisible")&&v(N,K,{fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(N,C,R={}){return R=ht(R,["fill","stroke"]),ne(N,C,R)},"bpmn:Group":function(N,C,R={}){return R=ht(R,["fill","stroke","width","height"]),m(N,C.width,C.height,vl,{stroke:Re(C,c,R.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:_i(C,R),height:oi(C,R)})},"bpmn:InclusiveGateway":function(N,C,R={}){R=ht(R,["fill","stroke"]);var G=ne(N,C,R);return h(N,C.width,C.height,C.height*.24,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(N,C,R={}){var{renderIcon:G=!0}=R;R=ht(R,["fill","stroke"]);var K=W(N,C,{...R,strokeWidth:1.5});return h(N,C.width,C.height,yl,{fill:"none",stroke:Re(C,c,R.stroke),strokeWidth:1.5}),G&&O(C,N,R),K},"bpmn:IntermediateCatchEvent":T("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":T("bpmn:IntermediateEvent"),"bpmn:Lane":function(N,C,R={}){return R=ht(R,["fill","stroke","width","height"]),U(N,C,{...R,fillOpacity:xT})},"bpmn:ManualTask":function(N,C,R={}){R=ht(R,["fill","stroke"]);var G=he(N,C,R),K=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return v(N,K,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(N,C,R={}){R=ht(R,["fill","stroke"]);var G=ge(C),K=dt(C),ie=at(C,s,R.fill),Pe=Re(C,c,R.stroke),et=y(N,C.waypoints,{markerEnd:d(N,"messageflow-end",ie,Pe),markerStart:d(N,"messageflow-start",ie,Pe),stroke:Pe,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var mt=et.getPointAtLength(et.getTotalLength()/2),qt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:mt.x,y:mt.y}}),Ct={strokeWidth:1};K.get("messageVisibleKind")==="initiating"?(Ct.fill=ie,Ct.stroke=Pe):(Ct.fill=Pe,Ct.stroke=ie);var vn=v(N,qt,Ct),Cn=G.get("messageRef"),qn=Cn.get("name"),At=Q(N,qn,{align:"center-top",fitBox:!0,style:{fill:Pe}}),Qt=vn.getBBox(),_n=At.getBBox(),qa=mt.x-_n.width/2,Yn=mt.y+Qt.height/2+mT;dl(At,qa,Yn,0)}return et},"bpmn:ParallelGateway":function(N,C,R={}){R=ht(R,["fill","stroke"]);var G=ne(N,C,R),K=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.2}});return v(N,K,{fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke),strokeWidth:1}),G},"bpmn:Participant":function(N,C,R={}){R=ht(R,["fill","stroke","width","height"]);var G=U(N,C,R),K=ut(C),ie=xn(C),Pe=ge(C),et=Pe.get("name");if(K){var mt=ie?[{x:30,y:0},{x:30,y:oi(C,R)}]:[{x:0,y:30},{x:_i(C,R),y:30}];x(N,mt,{stroke:Re(C,c,R.stroke),strokeWidth:yT}),me(N,et,C,R)}else{var qt=As(C,R);ie||(qt.height=_i(C,R),qt.width=oi(C,R));var Ct=Q(N,et,{box:qt,align:"center-middle",style:{fill:Ms(C,l,c,R.stroke)}});if(!ie){var vn=-1*oi(C,R);dl(Ct,0,-vn,270)}}return Pe.get("participantMultiplicity")&&$("ParticipantMultiplicityMarker",N,C,R),G},"bpmn:ReceiveTask":function(N,C,R={}){R=ht(R,["fill","stroke"]);var G=ge(C),K=he(N,C,R),ie;return G.get("instantiate")?(h(N,28,28,20*.22,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1}),ie=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):ie=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),v(N,ie,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1}),K},"bpmn:ScriptTask":function(N,C,R={}){R=ht(R,["fill","stroke"]);var G=he(N,C,R),K=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return v(N,K,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(N,C,R={}){R=ht(R,["fill","stroke"]);var G=he(N,C,R),K=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return v(N,K,{fill:Re(C,c,R.stroke),stroke:at(C,s,R.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(N,C,R={}){R=ht(R,["fill","stroke"]);var G=at(C,s,R.fill),K=Re(C,c,R.stroke),ie=y(N,C.waypoints,{markerEnd:d(N,"sequenceflow-end",G,K),stroke:K}),Pe=ge(C),{source:et}=C;if(et){var mt=ge(et);Pe.get("conditionExpression")&&M(mt,"bpmn:Activity")&&Se(ie,{markerStart:d(N,"conditional-flow-marker",G,K)}),mt.get("default")&&(M(mt,"bpmn:Gateway")||M(mt,"bpmn:Activity"))&&mt.get("default")===Pe&&Se(ie,{markerStart:d(N,"conditional-default-flow-marker",G,K)})}return ie},"bpmn:ServiceTask":function(N,C,R={}){R=ht(R,["fill","stroke"]);var G=he(N,C,R);h(N,10,10,{fill:at(C,s,R.fill),stroke:"none",transform:"translate(6, 6)"});var K=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});v(N,K,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1}),h(N,10,10,{fill:at(C,s,R.fill),stroke:"none",transform:"translate(11, 10)"});var ie=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return v(N,ie,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(N,C,R={}){var{renderIcon:G=!0}=R;R=ht(R,["fill","stroke"]);var K=ge(C);K.get("isInterrupting")||(R={...R,strokeDasharray:"6"});var ie=W(N,C,R);return G&&O(C,N,R),ie},"bpmn:SubProcess":function(N,C,R={}){return ut(C)?R=ht(R,["fill","stroke","width","height"]):R=ht(R,["fill","stroke"]),Y(N,C,R)},"bpmn:Task":function(N,C,R={}){return R=ht(R,["fill","stroke"]),he(N,C,R)},"bpmn:TextAnnotation":function(N,C,R={}){R=ht(R,["fill","stroke"]);var{width:G,height:K}=As(C,R),ie=m(N,G,K,0,0,{fill:"none",stroke:"none"}),Pe=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:K,position:{mx:0,my:0}});v(N,Pe,{stroke:Re(C,c,R.stroke)});var et=ge(C),mt=et.get("text")||"";return Q(N,mt,{align:"left-top",box:As(C,R),padding:xa,style:{fill:Ms(C,l,c,R.stroke)}}),ie},"bpmn:Transaction":function(N,C,R={}){ut(C)?R=ht(R,["fill","stroke","width","height"]):R=ht(R,["fill","stroke"]);var G=Y(N,C,{strokeWidth:1.5,...R}),K=n.style(["no-fill","no-events"],{stroke:Re(C,c,R.stroke),strokeWidth:1.5}),ie=ut(C);return ie||(R={}),m(N,_i(C,R),oi(C,R),vl-yl,yl,K),G},"bpmn:UserTask":function(N,C,R={}){R=ht(R,["fill","stroke"]);var G=he(N,C,R),K=15,ie=12,Pe=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:K,y:ie}});v(N,Pe,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:.5});var et=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:K,y:ie}});v(N,et,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:.5});var mt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:K,y:ie}});return v(N,mt,{fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke),strokeWidth:.5}),G},label:function(N,C,R={}){return X(N,C,R)}};this._drawPath=v,this._renderer=w}Me(kr,mo),kr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],kr.prototype.canRender=function(e){return M(e,"bpmn:BaseElement")},kr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},kr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},kr.prototype.getShapePath=function(e){return it(e)?Gf(e,vT):M(e,"bpmn:Event")?Lv(e):M(e,"bpmn:Activity")?Gf(e,vl):M(e,"bpmn:Gateway")?dT(e):hT(e)};function ht(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var _T=0,wT={width:150,height:50};function ET(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function ST(e){return hn(e)?V({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Vf=null;function RT(){return Vf||(Vf=document.createElement("canvas").getContext("2d")),Vf}function CT(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(Iv(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Iv(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function MT(e,t){var n=RT();if(!n)return{width:0,height:0};n.font=CT(t),"letterSpacing"in n&&(n.letterSpacing=Iv(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 AT(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=MT(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return PT(e,o,i,r);o=kT(o,r.width,t)}}function PT(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 Bv="­";function TT(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===Bv)&&o.pop();break}var a=o[o.length-1];return a&&a===Bv&&(o[o.length-1]="-"),o.join("")}function kT(e,t,n){var i=Math.max(e.length*(n/t),1),o=TT(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function bl(e){this._config=V({},{size:wT,padding:_T,style:{},align:"center-top"},e||{})}bl.prototype.createText=function(e,t){return this.layoutText(e,t).element},bl.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},bl.prototype.layoutText=function(e,t){for(var n=V({},this._config.size,t.box),i=V({},this._config.style,t.style),o=ET(t.align||this._config.align),r=ST(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=OT(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(AT(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=ti(l,function(m,_,x){return m+(s||_.height)},0)+r.top+r.bottom,f=ti(l,function(m,_,x){return _.width>m?_.width:m},0),d=r.top;o.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||l[0].height)/4;var g=Be("text");Se(g,i),z(l,function(m){var _;switch(d+=s||m.height,o.horizontal){case"left":_=r.left;break;case"right":_=(a?f:u)-r.right-m.width;break;default:_=Math.max(((a?f:u)-m.width)/2+r.left,0)}var x=Be("tspan");Se(x,{x:_,y:d}),x.textContent=m.text,Ke(g,x)});var h={width:f,height:p};return{dimensions:h,element:g}};function OT(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var DT=12,LT=1.2,IT=40;function Nv(e){var t=V({fontFamily:"Arial, sans-serif",fontSize:DT,fontWeight:"normal",lineHeight:LT},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=V({},t,{fontSize:n},e&&e.externalStyle||{}),o=new bl({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Tr.width),height:30},l=r(s,c,{style:i});return{x:Math.round(a.x+a.width/2-l.width/2),y:a.y,width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(a,s){var c=r(s,a,{style:t,align:"left-top",padding:xa});return{x:a.x,y:a.y,width:a.width,height:Math.max(IT,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,V({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Nv.$inject=["config.textRenderer"];function BT(){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=jT(i.d,{mx:o,my:r,e:a});return p}}var NT=/\{([^{}]+)\}/g,$T=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function FT(e,t,n){var i=n;return t.replace($T,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 jT(e,t){return String(e).replace(NT,function(n,i){return FT(n,i,t)})}const HT={__init__:["bpmnRenderer"],bpmnRenderer:["type",kr],textRenderer:["type",Nv],pathMap:["type",BT]};function zT(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Ps={translate:["value",zT]};function xl(e,t,n){return V({id:e.id,type:e.$type,businessObject:e,di:t},n)}function GT(e,t,n){var i=e.waypoint;return!i||i.length<2?[qe(t),qe(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function $v(e,t,n){return new Error(`element ${Fn(t)} referenced by ${Fn(e)}#${n} not yet drawn`)}function xo(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}xo.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],xo.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(xl(e,t,a)),this._canvas.addRootElement(i)}else if(M(t,"bpmndi:BPMNShape")){var s=!ut(e,t),c=WT(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(xl(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")&&(VT(n,qe(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(xl(e,t,{hidden:o,source:u,target:p,waypoints:GT(t,u,p)})),M(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${Fn(t)} for element ${Fn(e)}`);return Xo(e)&&yi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},xo.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Fn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw $v(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},xo.prototype.addLabel=function(e,t,n){var i,o,r;return i=aT(t,n),o=yi(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(xl(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!yi(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(r,n.parent)},xo.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?$v(e,i,t+"Ref"):new Error(`${Fn(e)}#${t} Ref not specified`)},xo.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},xo.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},xo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function VT(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 WT(e){return M(e,"bpmn:Group")}const Fv={__depends__:[HT,{__depends__:[Ps],bpmnImporter:["type",xo]}]};function Ts(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Hi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Wf(e){return Math.log(e)/Math.log(10)}var UT=1e3;function de(e){this._eventBus=e}de.$inject=["eventBus"];function qT(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}de.prototype.on=function(e,t,n,i,o,r){if((bn(t)||Ue(t))&&(r=o,o=i,i=n,n=t,t=null),bn(n)&&(r=o,o=i,i=n,n=UT),hn(o)&&(r=o,o=!1),!bn(i))throw new Error("handlerFn must be a function");We(e)||(e=[e]);var a=this._eventBus;z(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,o?qT(i,r):i,r)})},de.prototype.canExecute=_o("canExecute"),de.prototype.preExecute=_o("preExecute"),de.prototype.preExecuted=_o("preExecuted"),de.prototype.execute=_o("execute"),de.prototype.executed=_o("executed"),de.prototype.postExecute=_o("postExecute"),de.prototype.postExecuted=_o("postExecuted"),de.prototype.revert=_o("revert"),de.prototype.reverted=_o("reverted");function _o(e){return function(n,i,o,r,a){(bn(n)||Ue(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var Uf=["top","bottom","left","right"],_l=10;function qf(e,t){de.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(o){var r=o.context,a=r.connection,s=a.source,c=a.target,l=r.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(o){var r=o.context,a=r.shape,s=r.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(o){var r=o.context,a=r.elements,s=r.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(o){if(ml(o)&&!kt(o)){var r=XT(o);r&&i(o,r)}}function i(o,r){var a=qe(o),s=o.label,c=qe(s);if(s.parent){var l=He(o),u;switch(r){case"top":u={x:a.x,y:l.top-_l-s.height/2};break;case"left":u={x:l.left-_l-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+_l+s.height/2};break;case"right":u={x:l.right+_l+s.width/2,y:a.y};break}var p=Hi(u,c);t.moveShape(s,p)}}}Me(qf,de),qf.$inject=["eventBus","modeling"];function YT(e){var t=e.host,n=qe(e),i=On(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=Uf.filter(function(a){return o.indexOf(a)===-1});return r}function KT(e){var t=qe(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return jv(t,i)});return n}function XT(e){var t=qe(e.label),n=qe(e),i=jv(n,t);if(ZT(i)){var o=KT(e);if(e.host){var r=YT(e);o=o.concat(r)}var a=Uf.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?On(e.label,e)!=="intersect"?void 0:i:a[0]}}function jv(e,t){return On(t,e,5)}function ZT(e){return Uf.indexOf(e)!==-1}function Yf(e){de.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(M(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}Me(Yf,de),Yf.$inject=["eventBus"];var QT=1500;function Kf(e,t,n){e.invoke(de,this),this.preExecute("elements.delete",QT,function(o){var r=o.context,a=r.elements,s=i(a);s.length&&(r.elements=a.concat(s))}),t.on("shape.move.start",function(o){var r=o.context.shapes,a=i(r);a.length&&(o.context.shapes=r.concat(a))});function i(o){var r=rt(o,l=>M(l,"bpmn:Participant")||M(l,"bpmn:SubProcess"));if(!r.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>M(l,"bpmn:Artifact"))),c=new Set;return z(r,l=>{const u=new Set(ta(ga(Array.from(s),an(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Me(Kf,de),Kf.$inject=["injector","eventBus","canvas"];function Xf(e,t){e.invoke(de,this),this.postExecute("shape.move",function(n){var i=n.newParent,o=n.shape,r=rt(o.incoming.concat(o.outgoing),function(a){return M(a,"bpmn:Association")});z(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Me(Xf,de),Xf.$inject=["injector","modeling"];function wa(e,t){for(Jn(t)&&(t=[t]);e=e.parent;)if(ot(e,t))return e;return null}function Hv(e,t){var n=wa(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=wa(e,i),n)return xn(n);if(ot(e,i))return xn(e);var o;for(o=ge(e);o&&!M(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=ge(a);return s&&s.get("processRef")===o});return r?xn(r):!0}var zv=500;function wl(e,t){t.invoke(de,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",zv,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return Gv(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",zv,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];Gv(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}wl.$inject=["bpmnReplace","injector"],Me(wl,de),wl.prototype._replaceShape=function(e,t){var n=JT(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function JT(e){var t=ge(e),n=t.eventDefinitions;return n&&n[0]}function Gv(e,t){return!it(e)&&ot(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Zf(e,t){de.call(this,e);function n(i){return rt(i.attachers,function(o){return M(o,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var o=i.context.source,r=i.context.target,a=n(r);M(o,"bpmn:EventBasedGateway")&&M(r,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var o=i.context.oldSource,r=i.context.newSource;M(o,"bpmn:Gateway")&&M(r,"bpmn:EventBasedGateway")&&z(r.outgoing,function(a){var s=a.target,c=n(s);M(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Zf.$inject=["eventBus","modeling"],Me(Zf,de);function Vv(e){return e.create("bpmn:Category")}function ek(e){return e.create("bpmn:CategoryValue")}function Wv(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=ek(e)),n.$parent||(n.$parent=Vv(e)),n}function tk(e,t,n){return tn(t.get("categoryValue"),e),e.$parent=t,tn(n.get("rootElements"),t),t.$parent=n,e}function nk(e){var t=e.$parent;return t&&(Zt(t.get("categoryValue"),e),e.$parent=null),e}function ik(e){var t=e.$parent;return t&&(Zt(t.get("rootElements"),e),e.$parent=null),e}var ok=500;function Qf(e,t,n){n.invoke(de,this);function i(c){return t.filter(function(l){return M(l,"bpmn:Group")&&!l.labelTarget}).map(ge).filter(function(l){return l!==c})}function o(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function r(c,l){return i(l).some(function(u){var p=u.get("categoryValueRef");return p&&p.$parent===c})}function a(c,l){c&&l&&tk(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&ik(l),c&&!o(c,u)&&nk(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ge(l))},!0),this.executed(["shape.move","shape.resize"],ok,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var l=c.shape;c.categoryValue&&s(c.categoryValue,c.category,ge(l))},!0),this.executed("group.updateRefs",function(c){Uv(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){Uv(c).forEach(function(l){s(l.categoryValue,l.category,ge(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ge(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}Qf.$inject=["bpmnjs","elementRegistry","injector"],Me(Qf,de);function Uv(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Jf(e,t,n){de.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",o,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",r,!0),this.postExecuted("element.updateProperties",a,!0);function i(m){const _=m.source,x=m.target;Ea(_)&&ks(x)&&u(x)}function o(m){const _=m.connection,x=m.source,y=m.target;Ea(x)&&El(y)&&(l(y),f(x,[_]))}function r(m){const _=m.newTarget,x=m.oldSource,y=m.oldTarget;if(y!==_){const v=x;ks(y)&&u(y),Ea(v)&&El(_)&&l(_)}}function a(m){const{element:_}=m;ks(_)?(p(_),d(_)):El(_)&&g(_)}function s(m){const{newData:_,oldShape:x}=m;if(Ea(m.oldShape)&&_.eventDefinitionType!=="bpmn:CompensateEventDefinition"||_.type!=="bpmn:BoundaryEvent"){const y=x.outgoing.find(({target:v})=>ks(v));y&&y.target&&(m._connectionTarget=y.target)}else if(!Ea(m.oldShape)&&_.eventDefinitionType==="bpmn:CompensateEventDefinition"&&_.type==="bpmn:BoundaryEvent"){const y=x.outgoing.find(({target:v})=>El(v));y&&y.target&&(m._connectionTarget=y.target),h(x)}}function c(m){const{_connectionTarget:_,newShape:x}=m;_&&t.connect(x,_)}function l(m){t.updateProperties(m,{isForCompensation:!0})}function u(m){t.updateProperties(m,{isForCompensation:void 0})}function p(m){for(const _ of m.incoming)n.canConnect(_.source,m)||t.removeConnection(_);for(const _ of m.outgoing)n.canConnect(m,_.target)||t.removeConnection(_)}function f(m,_){m.outgoing.filter(v=>M(v,"bpmn:Association")).filter(v=>ks(v.target)&&!_.includes(v)).forEach(v=>t.removeConnection(v))}function d(m){const _=m.attachers.slice();_.length&&t.removeElements(_)}function g(m){const _=m.incoming.filter(x=>Ea(x.source));t.removeElements(_)}function h(m){const _=m.outgoing.filter(x=>M(x,"bpmn:SequenceFlow"));t.removeElements(_)}}Me(Jf,de),Jf.$inject=["eventBus","modeling","bpmnRules"];function ks(e){const t=ge(e);return t&&t.get("isForCompensation")}function Ea(e){return e&&M(e,"bpmn:BoundaryEvent")&&ba(e,"bpmn:CompensateEventDefinition")}function El(e){return e&&M(e,"bpmn:Activity")&&!jn(e)}function ed(e){e.invoke(de,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,o=n.shape;M(i,"bpmn:Lane")&&!M(o,"bpmn:Lane")&&(n.parent=wa(i,"bpmn:Participant"))})}ed.$inject=["injector"],Me(ed,de);function td(e,t){de.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,o=i.shape;if(M(o,"bpmn:DataObjectReference")&&o.type!=="label"){var r=t.create("bpmn:DataObject");r.isCollection=((a=o.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,o.businessObject.dataObjectRef=r}})}td.$inject=["eventBus","bpmnFactory"],Me(td,de);var nd=20,id=20,qv=30,Sl=2e3;function od(e,t,n){de.call(this,t),t.on(["create.start","shape.move.start"],Sl,function(o){var r=o.context,a=r.shape,s=e.getRootElement();if(!(!M(a,"bpmn:Participant")||!M(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!M(p,"bpmn:Group")&&!it(p)&&!kt(p)});if(c.length){var l=an(c),u=rk(a,l);V(a,u),r.createConstraints=ak(a,l)}}}),t.on("create.start",Sl,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",Sl,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",Sl,function(o){var r=o.elements,a=o.parent,s=sk(r),c;s&&M(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=ge(s).get("processRef"))},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;M(a,"bpmn:Participant")&&M(r,"bpmn:Process")&&(o.parent=i(),o.process=r,o.processRef=ge(a).get("processRef"))},!0),this.execute("shape.create",function(o){var r=o.hints||{},a=o.process||r.process,s=o.shape,c=r.participant;a&&(!c||s===c)&&ge(s).set("processRef",ge(a))},!0),this.revert("shape.create",function(o){var r=o.hints||{},a=o.process||r.process,s=o.processRef||r.processRef,c=o.shape,l=r.participant;a&&(!l||c===l)&&ge(c).set("processRef",s)},!0),this.postExecute("shape.create",function(o){var r=o.hints||{},a=o.process||o.hints.process,s=o.shape,c=r.participant;if(a){var l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}od.$inject=["canvas","eventBus","modeling"],Me(od,de);function rk(e,t){t={width:t.width+nd*2+qv,height:t.height+id*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 ak(e,t){return t=He(t),{bottom:t.top+e.height/2-id,left:t.right-e.width/2+nd,top:t.bottom-e.height/2+id,right:t.left+e.width/2-nd-qv}}function sk(e){return Lt(e,function(t){return M(t,"bpmn:Participant")})}var Yv="__targetRef_placeholder";function rd(e,t){de.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Kv(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Kv(r));function n(a,s,c){var l=a.get("dataInputAssociations");return Lt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Lt(c,function(u){return u.name===Yv});return!l&&s&&(l=t.create("bpmn:Property",{name:Yv}),tn(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||Zt(a.get("properties"),c))}function r(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,f=s.newTarget,d=f&&f.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,m=c.businessObject,_;h&&h!==p&&o(h,l),d&&d!==p&&o(d,l),p?(_=i(p,!0),m.targetRef=_):m.targetRef=null}}rd.$inject=["eventBus","bpmnFactory"],Me(rd,de);function Kv(e){return function(t){var n=t.context,i=n.connection;if(M(i,"bpmn:DataInputAssociation"))return e(t)}}function Rl(e){this._bpmnUpdater=e}Rl.$inject=["bpmnUpdater"],Rl.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),[]},Rl.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 ad(e,t,n,i){de.call(this,i),t.registerHandler("dataStore.updateContainment",Rl);function o(){return n.filter(function(s){return M(s,"bpmn:Participant")&&ge(s).processRef})[0]}function r(s){return s.children.filter(function(c){return M(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||o(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:dt(s),newSemanticParent:u.processRef||u,newDiParent:dt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(p){return M(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!M(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,p=l.parent;if(!M(u,"bpmn:Collaboration")&&M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(p,"bpmn:Collaboration")){var f=M(u,"bpmn:Participant")?u:lk(u,"bpmn:Participant");a(l,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();ot(l,["bpmn:Participant","bpmn:SubProcess"])&&M(u,"bpmn:Collaboration")&&r(u).filter(function(p){return ck(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)})})}ad.$inject=["canvas","commandStack","elementRegistry","eventBus"],Me(ad,de);function ck(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 lk(e,t){for(;e.parent;){if(M(e.parent,t))return e.parent;e=e.parent}}var Cl=Math.max,Ml=Math.min,uk=20;function Xv(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function pk(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 Al(e,t,n){var i=t[e],o=n.min&&n.min[e],r=n.max&&n.max[e];return Ue(o)&&(i=(/top|left/.test(e)?Ml:Cl)(i,o)),Ue(r)&&(i=(/top|left/.test(e)?Cl:Ml)(i,r)),i}function dk(e,t){if(!t)return e;var n=He(e);return ul({top:Al("top",n,t),right:Al("right",n,t),bottom:Al("bottom",n,t),left:Al("left",n,t)})}function hk(e,t,n,i){var o=He(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?He(i):r,s={top:Ml(r.top,a.top),left:Ml(r.left,a.left),bottom:Cl(r.bottom,a.bottom),right:Cl(r.right,a.right)};return ul(s)}function Os(e,t){return typeof e<"u"?e:uk}function gk(e,t){var n,i,o,r;return typeof t=="object"?(n=Os(t.left),i=Os(t.right),o=Os(t.top),r=Os(t.bottom)):n=i=o=r=Os(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function mk(e){return!(e.waypoints||e.type==="label")}function Zv(e,t){var n;if(e.length===void 0?n=rt(e.children,mk):n=e,n.length)return gk(an(n),t)}var Zo=Math.abs;function yk(e,t){return Xv(He(t),He(e))}var vk=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],wi=30;function Pl(e,t){return t=t||[],e.children.filter(function(n){M(n,"bpmn:Lane")&&(Pl(n,t),t.push(n))}),t}function Qo(e){return e.children.filter(function(t){return M(t,"bpmn:Lane")})}function Ei(e){return wa(e,vk)||e}function bk(e,t){var n=Ei(e),i=M(n,"bpmn:Process")?[]:[n],o=Pl(n,i),r=He(e),a=He(t),s=yk(e,t),c=[],l=xn(e);return o.forEach(function(u){if(u!==e){var p=l?0:s.top,f=l?s.right:0,d=l?0:s.bottom,g=l?s.left:0,h=He(u);s.top&&(Zo(h.bottom-r.top)<10&&(d=a.top-h.bottom),Zo(h.top-r.top)<5&&(p=a.top-h.top)),s.left&&(Zo(h.right-r.left)<10&&(f=a.left-h.right),Zo(h.left-r.left)<5&&(g=a.left-h.left)),s.bottom&&(Zo(h.top-r.bottom)<10&&(p=a.bottom-h.top),Zo(h.bottom-r.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(Zo(h.left-r.right)<10&&(g=a.right-h.left),Zo(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 xk=500;function sd(e,t){de.call(this,e);function n(i,o){var r=xn(i),a=Qo(o),s=[],c=[],l=[],u=[];if(Pr(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))})}sd.$inject=["eventBus","spaceTool"],Me(sd,de);var Qv=500;function Tl(e,t){t.invoke(de,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Qv,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return Jv(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",Qv,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;Jv(a,wk(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}Tl.$inject=["bpmnReplace","injector"],Me(Tl,de),Tl.prototype._replaceShape=function(e){var t=_k(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function _k(e){var t=ge(e),n=t.eventDefinitions;return n&&n[0]}function Jv(e,t){return!it(e)&&M(e,"bpmn:BoundaryEvent")&&!t}function wk(e,t){return e.indexOf(t)!==-1}var kl=Math.round,Ek=Math.max;function Sk(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 Rk(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var eb=10;function Ck(e,t){var n,i;for(n=0;i=e[n];n++)if(ws(i,t)<=eb)return{point:e[n],bendpoint:!0,index:n};return null}function Mk(e,t){var n=rv(Sk(t,eb),Rk(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=Ek(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:kl(i.x+o.x)/2,y:kl(i.y+o.y)/2},index:i.segment2}:{point:{x:kl(i.x),y:kl(i.y)},index:i.segment2}:null}function cd(e,t){return Ck(e,t)||Mk(e,t)}function ld(e,t,n){de.call(this,e);function i(o,r,a){var s=r.waypoints,c,l,u,p,f,d,g,h=o.outgoing.slice(),m=o.incoming.slice(),_;Ue(a.width)?_=qe(a):_=a;var x=cd(s,_);if(x){if(c=s.slice(0,x.index),l=s.slice(x.index+(x.bendpoint?1:0)),!c.length||!l.length)return;u=x.bendpoint?s[x.index]:_,(c.length===1||!tb(o,c[c.length-1]))&&c.push(nb(u)),(l.length===1||!tb(o,l[0]))&&l.unshift(nb(u))}p=r.source,f=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||_),d=r),t.canConnect(o,f,r)&&(d?g=n.connect(o,f,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||_),g=r));var y=[].concat(d&&rt(m,function(v){return v.source===d.source})||[],g&&rt(h,function(v){return v.target===g.target})||[]);y.length&&n.removeElements(y)}this.preExecute("elements.move",function(o){var r=o.newParent,a=o.shapes,s=o.delta,c=a[0];if(!(!c||!r)){r&&r.waypoints&&(o.newParent=r=r.parent);var l=qe(c),u={x:l.x+s.x,y:l.y+s.y},p=Lt(r.children,function(f){var d=t.canInsert(a,f);return d&&cd(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)}Me(ld,de),ld.$inject=["eventBus","bpmnRules","modeling"];function tb(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 nb(e){return V({},e)}function ud(e,t){de.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,o=i.connection,r=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&Sa(o)){var c=[];M(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&Sa(l)):c=a.incoming.filter(l=>l!==o&&Sa(l)&&M(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,o=i.newShape;if(M(o,"bpmn:EventBasedGateway")){var r=o.outgoing.filter(Sa).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(Sa).forEach(function(s){const c=a.incoming.filter(Sa).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}ud.$inject=["eventBus","modeling"],Me(ud,de);function Sa(e){return M(e,"bpmn:SequenceFlow")}var Ol=1500,ib=2e3;function ob(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"],Ol,function(i){var o=i.context,r=o.shape||i.shape,a=i.hover;M(a,"bpmn:Lane")&&!ot(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Ei(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(r.labelTarget||ot(r,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Ol,function(i){var o=i.hover;M(o,"bpmn:Lane")&&(i.hover=Ei(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Ol,function(i){var o=i.context,r=i.hover,a=o.type;M(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Ei(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Ol,function(i){var o=i.context,r=o.start;M(r,"bpmn:Lane")&&(o.start=Ei(r)||r)}),t.on("shape.move.start",ib,function(i){var o=i.shape;M(o,"bpmn:Lane")&&(i.shape=Ei(o)||o)}),t.on("spaceTool.move",ib,function(i){var o=i.hover;o&&M(o,"bpmn:Lane")&&(i.hover=Ei(o))})}ob.$inject=["elementRegistry","eventBus","canvas"];var rb=770;function pd(e,t,n,i){n.invoke(de,this);function o(s,c){var l=ge(s),u=c.categoryValue||l.categoryValueRef;u||(u=Wv(e,l));var p=c.category||u.$parent||Vv(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=ge(s),u=c.categoryValue||l.categoryValueRef,p=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=p,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&o(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&r(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=ge(l);if(!(!M(l,"bpmn:Group")||l.labelTarget)){var p=c.categoryValue=u.categoryValueRef;p&&(c.category=p.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,f=ge(l);p&&(f.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ge(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ge(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||ge(l).categoryValueRef||o(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||r(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",rb,function(s){var c=s.descriptor,l=s.element;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=ge(l);if(u.categoryValueRef){var p=u.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",rb,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})}pd.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Me(pd,de);function fd(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 ab(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=fd(i,o,r,a),l=fd(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],qe(i.source)),t(o[o.length-1],o[o.length-2],qe(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}ab.$inject=["eventBus"];function sb(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function dd(e){de.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,o=ge(i),r=dt(i);if(ot(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}dd.$inject=["eventBus"],Me(dd,de);function cb(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function lb(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function Ak(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 Pk(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 hd(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=Pk([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 ub(e,t){var n=hd(e,t),i={x:n.x-e.x,y:n.y-e.y};return cb(i)}function Ds(e,t){return cb({x:e.x-t.x,y:e.y-t.y})}var pb=Math.sqrt,fb=Math.min,Tk=Math.max,db=Math.abs;function hb(e){return Math.pow(e,2)}function Ls(e,t){return pb(hb(e.x-t.x)+hb(e.y-t.y))}function kk(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],mb(i,o)?l=[i]:(r=Ls(e,i),a=Ls(e,o),c=fb(r,a),l=Ok(i,o,e,c)),l.length<1)throw new Error("expected between [1, 2] circle -> line intersections");l.length===1&&(u={type:"bendpoint",position:l[0],segmentIndex:n,bendpointIndex:mb(i,l[0])?n:n+1}),l.length===2&&(s=Lk(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Ls(i,s)/Ls(i,o)}),p=Ls(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function Ok(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=pb(d),h=-p+g,m=-p-g,_={x:e.x-o*h,y:e.y-r*h};if(d===0)return[_];var x={x:e.x-o*m,y:e.y-r*m};return[_,x].filter(function(y){return Dk(y,e,t)})}function Dk(e,t,n){return gb(e.x,t.x,n.x)&&gb(e.y,t.y,n.y)}function gb(e,t,n){return e>=fb(t,n)-Dl&&e<=Tk(t,n)+Dl}function Lk(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Dl=.1;function mb(e,t){return db(e.x-t.x)<=Dl&&db(e.y-t.y)<=Dl}function Ik(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=vb(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 yb(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=kk(e,n),c=s.segmentIndex,l=Ik(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=Nk(u,f),g=Bk(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,_=n[m];if(t.indexOf(_)!==-1)return a;if(h===0){var x=t[m];return o=x.x-s.position.x,r=x.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=vb(n,m))}var y={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},v=Ak({x:e.x-f.x,y:e.y-f.y},g);return o=y.x+v.x-e.x,r=y.y+v.y-e.y,{point:vo(y),delta:vo({x:o,y:r})}}function vb(e,t){var n=Ds(e[t-1],e[t]),i=Ds(e[t],e[t+1]),o=n/(n+i);return o}function Bk(e,t){var n=lb(e),i=lb(t);return i-n}function bb(e,t){return[e[t],e[t+1]]}function Nk(e,t){var n=Ds(e[0],e[1]),i=Ds(e[0],t);return n===0?0:i/n}function $k(e,t,n,i){var o=qe(e);return yb(o,t,n,i).delta}function Is(e,t,n){var i=Ts(t),o=Ts(n),r=Hi(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return vo({x:o.x+a.x,y:o.y+a.y})}function xb(e,t,n){var i=Ts(e),o=Ts(t),r=Ts(n),a=Hi(e,i),s=Hi(i,o),c=Fk(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 vo({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function Fk(e,t,n){var i=He(t),o=He(n);if(jk(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 jk(e,t){return Hk(e,t)||zk(e,t)}function Hk(e,t){return e.right!==t.right&&e.left!==t.left}function zk(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var _b="name",wb="text";function gd(e,t,n,i){de.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{ge(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if(_b in l&&t.updateLabel(c,l[_b]),wb in l&&M(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[wb]||"");t.updateLabel(c,l.text,u)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var l=s.shape||s.connection;it(l)||!Xo(l)||yi(l)&&t.updateLabel(l,yi(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function r(a){var s=a.context,c=s.connection,l=c.label,u=V({},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),$k(l,p,f,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,p;!u||!u.parent||(p=r(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=ge(c);u&&Xo(u)&&l.label&&c.label&&(c.label.x=l.label.x,c.label.y=l.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.hints||{};if(!(!it(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(yi(c)||"",{box:u,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=u.y!==c.y,g=c.y+c.height;s.newBounds={width:u.width,height:f,x:u.x,y:d?g-f:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(ml(c)){var p=c.label,f=qe(p),d=Wk(u),g=Vk(f,d),h=Gk(g,u,l);t.moveShape(p,h)}})}Me(gd,de),gd.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function Gk(e,t,n){var i=Is(e,t,n);return vo(Hi(i,e))}function Vk(e,t){if(t.length){var n=Uk(e,t);return hd(e,n)}}function Wk(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 Uk(e,t){var n=t.map(function(o){return{line:o,distance:ub(e,o)}}),i=Ui(n,"distance");return i[0].line}function qk(e,t,n,i){return yb(e,t,n,i).point}function md(e,t){de.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=V({},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),qk(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)})})}Me(md,de),md.$inject=["eventBus","modeling"];function Ll(e,t,n){var i=Bl(e),o=Sb(i,t),r=i[0];return o.length?o[o.length-1]:Is(r.original||r,n,t)}function Il(e,t,n){var i=Bl(e),o=Sb(i,t),r=i[i.length-1];return o.length?o[0]:Is(r.original||r,n,t)}function yd(e,t,n){var i=Bl(e),o=Eb(t,n),r=i[0];return Is(r.original||r,o,t)}function vd(e,t,n){var i=Bl(e),o=Eb(t,n),r=i[i.length-1];return Is(r.original||r,o,t)}function Eb(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Bl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Sb(e,t){var n=Nn(e,Kk);return rt(n,function(i){return Yk(i,t)})}function Yk(e,t){return On(t,e,1)==="intersect"}function Kk(e){return e.original||e}function bd(e,t){de.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(Xk(i,o)){var r=Zk(i);r.incoming.forEach(function(a){var s=Il(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=Ll(a,o,i);t.reconnectStart(a,o,s)})}},!0)}bd.$inject=["eventBus","modeling"],Me(bd,de);function Xk(e,t){return M(e,"bpmn:Participant")&&ut(e)&&M(t,"bpmn:Participant")&&!ut(t)}function Zk(e){var t=xs([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 Qk=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Rb(e){const t=ge(e);if(!M(t,"bpmn:BoundaryEvent")&&!(M(t,"bpmn:StartEvent")&&jn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:Qk.some(i=>M(n[0],i))}function Cb(e){return M(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function xd(e,t){e.invoke(de,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!Rb(o))return;const a=Cb(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=ge(i).get(a),l=ge(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}xd.$inject=["injector","modeling"],Me(xd,de);function _d(e,t){de.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=dt(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}Me(_d,de),_d.$inject=["eventBus","modeling"];function wd(e,t,n){de.call(this,e),this.preExecute("shape.delete",function(i){var o=i.context.shape;if(!(o.incoming.length!==1||o.outgoing.length!==1)){var r=o.incoming[0],a=o.outgoing[0];if(!(!M(r,"bpmn:SequenceFlow")||!M(a,"bpmn:SequenceFlow"))&&t.canConnect(r.source,a.target,r)){var s=Jk(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}Me(wd,de),wd.$inject=["eventBus","bpmnRules","modeling"];function Ra(e){return e.original||e}function Jk(e,t){var n=fd(Ra(e[e.length-2]),Ra(e[e.length-1]),Ra(t[1]),Ra(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Ra(e[0]),Ra(t[t.length-1])]}function Ed(e,t){de.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,o=i.parent;M(i,"bpmn:Participant")&&(n.collaborationRoot=o)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var o=t.makeProcess(),r=i.children.slice();t.moveElements(r,{x:0,y:0},o)}},!0)}Ed.$inject=["eventBus","modeling"],Me(Ed,de);function Sd(e,t,n,i){de.call(this,e);var o=i.get("dragging",!1);function r(c){var l=c.source,u=c.target,p=c.parent;if(p){var f,d;M(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(f="bpmn:MessageFlow")),M(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(l,u,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,f=l.newTarget||u.target,d,g;d=n.canConnect(p,f),!(!d||d.type===u.type)&&(g=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=g,o&&s(u,g))}function s(c,l){var u=o.context(),p=u&&u.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;z(u,r)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,f=p.businessObject,d;u.default&&(d=Lt(p.outgoing,ia({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})})}Me(Sd,de),Sd.$inject=["eventBus","modeling","bpmnRules","injector"];function Nl(e,t,n,i,o,r){i.invoke(de,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=r,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=ti(l,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];z(s.closure.topLevel,function(f){jn(f)?u=u.concat(f.children):u=u.concat(f)}),u.length===1&&l&&(c=l);var p=t.canReplace(u,c);p&&this._replaceElements(u,p.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,p;u&&u.length&&(p=t.canReplace(u,l),this._replaceElements(u,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;o.unclaimId(c.businessObject.id,c.businessObject),o.updateProperties(l,{id:c.id})})}Me(Nl,de),Nl.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,o=this._selection;z(t,function(r){var a={type:r.newElementType},s=n.get(r.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&o.select(e)},Nl.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var e2=1500,t2={width:140,height:120},Rd={width:300,height:60},Cd={width:60,height:300},$l={width:300,height:150},Fl={width:150,height:300},Mb={width:140,height:120},Ab={width:100,height:40};function Pb(e){e.on("resize.start",e2,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=a2(i,o,r)),M(i,"bpmn:SubProcess")&&ut(i)&&(n.minDimensions=Mb),M(i,"bpmn:TextAnnotation")&&(n.minDimensions=Ab)})}Pb.$inject=["eventBus"];var Jo=Math.abs,n2=Math.min,i2=Math.max;function Tb(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function Ca(e,t,n){return Tb(e,t,n,n2)}function Ma(e,t,n){return Tb(e,t,n,i2)}var o2={top:20,left:50,right:20,bottom:20},r2={top:50,left:20,right:20,bottom:20};function a2(e,t,n){var i=Ei(e),o=!0,r=!0,a=Pl(i,[i]),s=He(e),c={},l={},u=xn(e),p=u?Rd:Cd;/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=He(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&&Jo(s.top-h.bottom)<10&&Ma(c,"top",h.top+p.height),Jo(s.top-h.top)<5&&Ca(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&Jo(s.right-h.left)<10&&Ca(c,"right",h.right-p.width),Jo(s.right-h.right)<5&&Ma(l,"right",h.left+p.width)),/s/.test(t)&&(n&&Jo(s.bottom-h.top)<10&&Ca(c,"bottom",h.bottom-p.height),Jo(s.bottom-h.bottom)<5&&Ma(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&Jo(s.left-h.right)<10&&Ma(c,"left",h.left+p.width),Jo(s.left-h.left)<5&&Ca(l,"left",h.right-p.width))});var f=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(M(g,"bpmn:FlowElement")||M(g,"bpmn:Artifact"))}),d=u?o2:r2;return f.forEach(function(g){var h=He(g);/n/.test(t)&&(!u||o)&&Ca(l,"top",h.top-d.top),/e/.test(t)&&(u||r)&&Ma(l,"right",h.right+d.right),/s/.test(t)&&(!u||r)&&Ma(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||o)&&Ca(l,"left",h.left-d.left)}),{min:l,max:c}}function kb(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Aa(e){return e.originalEvent||e.srcEvent}function Md(e){kb(e),kb(Aa(e))}function Or(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 Ob(){return/mac/i.test(navigator.platform)}function Db(e,t){return(Aa(e)||e).button===t}function er(e){return Db(e,0)}function s2(e){return Db(e,1)}function Bs(e){var t=Aa(e)||e;return er(e)?Ob()?t.metaKey:t.ctrlKey:!1}function jl(e){var t=Aa(e)||e;return er(e)&&t.shiftKey}var Lb=1001;function Ib(e,t){e.on("resize.start",Lb+500,function(n){var i=n.context,o=i.shape;(M(o,"bpmn:Lane")||M(o,"bpmn:Participant"))&&(i.balanced=!Bs(n))}),e.on("resize.end",Lb,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=uv(a),t.resizeLane(o,a,i.balanced)),!1})}Ib.$inject=["eventBus","modeling"];var c2=500;function Ad(e,t,n,i,o){n.invoke(de,this);function r(u){return ot(u,["bpmn:ReceiveTask","bpmn:SendTask"])||l2(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!Lt(f,ia({id:u.id}))}function s(u){if(M(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(M(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(M(u,"bpmn:MessageEventDefinition"))return"messageRef";if(M(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(ot(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),f=p[0];return f.get(s(f))}function l(u,p){if(ot(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var f=u.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(r(p)){var f=ge(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),tn(g,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");Zt(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!r(f))){var d=ge(f),g=c(d);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",c2,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)})}Ad.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Me(Ad,de);function l2(e,t){return We(t)||(t=[t]),Io(t,function(n){return ba(e,n)})}var Bb=Math.max;function Nb(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,o=t.start,r={};return z(n,function(a){var s=a.id;M(a,"bpmn:Participant")&&(r[s]=p2(a,i,o)),M(a,"bpmn:Lane")&&(r[s]=xn(a)?Rd:Cd),M(a,"bpmn:SubProcess")&&ut(a)&&(r[s]=Mb),M(a,"bpmn:TextAnnotation")&&(r[s]=Ab),M(a,"bpmn:Group")&&(r[s]=t2)}),r})}Nb.$inject=["eventBus"];function u2(e){return e==="x"}function p2(e,t,n){var i=xn(e);if(!h2(e))return i?$l:Fl;var o=u2(t),r={};return o?i?r=$l:r={width:d2(e,n,o),height:Fl.height}:i?r={width:$l.width,height:f2(e,n,o)}:r=Fl,r}function f2(e,t,n){var i;return i=g2(e,t,n),Bb($l.height,i)}function d2(e,t,n){var i;return i=m2(e,t,n),Bb(Fl.width,i)}function h2(e){return!!Qo(e).length}function g2(e,t,n){var i=Qo(e),o;return o=Pd(i,t,n),e.height-o.height+Rd.height}function m2(e,t,n){var i=Qo(e),o;return o=Pd(i,t,n),e.width-o.width+Cd.width}function Pd(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=Qo(o),r.length?Pd(r,t,n):o}var $b="_plane";function Fb(e){var t=e.id;return y2(t)}function to(e){var t=e.id;return M(e,"bpmn:SubProcess")?jb(t):t}function Dr(e){return jb(e)}function Hl(e){var t=dt(e);return M(t,"bpmndi:BPMNPlane")}function jb(e){return e+$b}function y2(e){return e.replace(new RegExp($b+"$"),"")}var Hb=400,v2=600,zb={x:180,y:160};function wo(e,t,n,i,o,r,a){de.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=o,this._bpmnjs=r,this._elementRegistry=a;var s=this;function c(p){return M(p,"bpmn:SubProcess")&&!ut(p)}function l(p){var f=p.shape,d=p.newRootElement,g=ge(f);d=s._addDiagram(d||g),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=ge(f);s._removeDiagram(d);var g=p.newRootElement=a.get(to(d));e.removeRootElement(g)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;z(f,function(d){if(c(d)){var g=a.get(to(d));if(!(!g||!d.children||!d.children.length)){var h=Gb(d);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!M(f,"bpmn:SubProcess")||!ut(f)||z(Cs([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(to(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(to(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(to(f));if(!(!d||!g)){var h=d.children;n.moveElements(h,{x:0,y:0},g)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(M(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,m=d.id;if(h!==m){if(Hl(f)){a.updateId(f,Dr(m)),a.updateId(h,m);return}var _=a.get(Dr(h));_&&a.updateId(Dr(h),Dr(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(Hl(f)){a.updateId(f,Dr(h)),a.updateId(m,h);return}var _=a.get(Dr(m));_&&a.updateId(_,Dr(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Hl(f)){var d=f,g=a.get(Fb(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",Hb,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(ut(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Hb,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(ut(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",v2,function(p){var f=p.shape;if(M(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(ut(f))s._moveChildrenToShape(d.children.slice(),f),z(Cs(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),z(h.associations,m=>{n.moveConnection(m,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var g=Gb(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=to(f),h=a.get(g);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,g=p.elements,h=d.parent,m=M(dt(h),"bpmndi:BPMNPlane");if(m){var _=Fb(h),x=Lt(g,function(y){return y.id===_});x&&(f.parent=x.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}Me(wo,de),wo.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var o=an(i),r;if(!t.x)r={x:zb.x-o.x,y:zb.y-o.y};else{var a=qe(t),s=qe(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},wo.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Dv(e).map(i=>i.annotation));n.size&&z(Cs(e.children),i=>{n.has(i.annotation)&&z(i.associations,o=>{t.removeConnection(o)})})},wo.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},wo.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},wo.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),o=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=o;var r=n.createRoot({id:to(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},wo.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Lt(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},wo.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function b2(e){var t=[];return z(Cs(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Gb(e){return e.children.slice().concat(b2(e.children)).concat(x2(e))}function x2(e){return Lf(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Td(e,t){e.invoke(de,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,o=n.context.newShape;if(!(!M(o,"bpmn:SubProcess")||M(o,"bpmn:AdHocSubProcess")||!(M(i,"bpmn:Task")||M(i,"bpmn:CallActivity"))||!ut(o))){var r=_2(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}Td.$inject=["injector","modeling"],Me(Td,de);function _2(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function kd(e,t){de.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;M(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&M(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,o=i.shape,r=i.hints||{};if(!(!M(o,"bpmn:TextAnnotation")||r.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,yi(o)||""),c=a.y!==o.y&&Math.abs(a.y+a.height-(o.y+o.height))<=1,l=o.y+o.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}Me(kd,de),kd.$inject=["eventBus","textRenderer"];function Od(e,t){de.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(ut(i))return;var o=xs(i);o.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();z(s,function(l){r(l,!0)}),z(c,function(l){r(l,!1)})});function r(a,s){o.indexOf(a.source)!==-1&&o.indexOf(a.target)!==-1||M(a,"bpmn:Association")&&(M(a.source,"bpmn:TextAnnotation")||M(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,qe(i)):t.reconnectStart(a,i,qe(i)))}},!0)}Me(Od,de),Od.$inject=["eventBus","modeling"];var Dd=500;function Ld(e,t,n){de.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function o(a,s){var c=a.children,l=s,u,p;return u=w2(c).concat([a]),p=Zv(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"],Dd,function(a){var s=a.context,c=s.shape;M(c,"bpmn:SubProcess")&&(c.collapsed?dt(c).isExpanded=!1:(i(c.children),dt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Dd,function(a){var s=a.context,c=s.shape;c.collapsed?dt(c).isExpanded=!1:dt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Dd,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"})})}Me(Ld,de),Ld.$inject=["eventBus","elementFactory","modeling"];function w2(e){return e.filter(function(t){return!t.hidden})}function Id(e,t,n,i){t.invoke(de,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;it(a)||(M(a,"bpmn:Participant")&&ut(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(o){var r=o.context,a=r.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var o=e.getRootElement(),r=o.businessObject;M(o,"bpmn:Collaboration")&&n.ids.unclaim(r.id)})}Me(Id,de),Id.$inject=["canvas","injector","moddle","modeling"];function Bd(e,t){de.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;E2(o,r)&&t.updateProperties(r,{default:null})})}Me(Bd,de),Bd.$inject=["eventBus","modeling"];function E2(e,t){if(!M(e,"bpmn:SequenceFlow"))return!1;var n=ge(t),i=ge(e);return n.get("default")===i}var S2=500,R2=5e3,Vb=["shape.create","shape.delete","shape.move","shape.resize"],Wb=[...Vb,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Nd(e,t){de.call(this,e);var n;function i(){return n=n||new C2,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(Wb,R2,function(){i()}),this.postExecuted(Wb,S2,function(){r()}),this.preExecute(Vb,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))})}Nd.$inject=["eventBus","modeling"],Me(Nd,de);function C2(){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 M2=500,A2=5e3,Ub=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],qb=[...Ub,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function $d(e,t){de.call(this,e);var n;function i(){return n=n||new P2,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(qb,A2,function(){i()}),this.postExecuted(qb,M2,function(){r()}),this.preExecute(Ub,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)})}$d.$inject=["eventBus","modeling"],Me($d,de);function P2(){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 Fd(e,t){de.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)T2(r)&&!O2(r)&&t.updateProperties(r,{isForCompensation:void 0})})}Me(Fd,de),Fd.$inject=["eventBus","modeling"];function T2(e){const t=ge(e);return t&&t.isForCompensation}function k2(e){return e&&M(e,"bpmn:BoundaryEvent")&&ba(e,"bpmn:CompensateEventDefinition")}function O2(e){return e.incoming.filter(n=>k2(n.source)).length>0}const D2={__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",qf],appendBehavior:["type",Yf],associationBehavior:["type",Xf],attachEventBehavior:["type",wl],artifactBehavior:["type",Kf],boundaryEventBehavior:["type",Zf],categoryRootElementReferenceBehavior:["type",Qf],compensateBoundaryEventBehaviour:["type",Jf],createBehavior:["type",ed],createDataObjectBehavior:["type",td],createParticipantBehavior:["type",od],dataInputAssociationBehavior:["type",rd],dataStoreBehavior:["type",ad],deleteLaneBehavior:["type",sd],detachEventBehavior:["type",Tl],dropOnFlowBehavior:["type",ld],eventBasedGatewayBehavior:["type",ud],fixHoverBehavior:["type",ob],groupBehavior:["type",pd],importDockingFix:["type",ab],isHorizontalFix:["type",dd],labelBehavior:["type",gd],layoutConnectionBehavior:["type",md],messageFlowBehavior:["type",bd],nonInterruptingBehavior:["type",xd],removeElementBehavior:["type",wd],removeEmbeddedLabelBoundsBehavior:["type",_d],removeParticipantBehavior:["type",Ed],replaceConnectionBehavior:["type",Sd],replaceElementBehaviour:["type",Nl],resizeBehavior:["type",Pb],resizeLaneBehavior:["type",Ib],rootElementReferenceBehavior:["type",Ad],spaceToolBehavior:["type",Nb],subProcessPlaneBehavior:["type",wo],subProcessStartEventBehavior:["type",Td],textAnnotationBehavior:["type",kd],toggleCollapseConnectionBehaviour:["type",Od],toggleElementCollapseBehaviour:["type",Ld],unclaimIdBehavior:["type",Id],unsetDefaultFlowBehavior:["type",Bd],updateFlowNodeRefsBehavior:["type",Nd],updateCategoryValueRefsBehavior:["type",$d],setCompensationActivityAfterPasteBehavior:["type",Fd]};function jd(e){this._commandStack=e.get("commandStack",!1)}jd.$inject=["injector"],jd.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const no={__init__:["rules"],rules:["type",jd]};function Si(e){de.call(this,e),this.init()}Si.$inject=["eventBus"],Me(Si,de),Si.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(o){i.canExecute(o,t,function(r,a,s){return n(r)},!0)})},Si.prototype.init=function(){};function Yb(e,t){var n=On(e,t,-15);return n!=="intersect"?n:null}function Ln(e){Si.call(this,e)}Me(Ln,Si),Ln.$inject=["eventBus"],Ln.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return L2(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 Gl(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Gl(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 kt(i)&&!Vl(t,i)?!1:Lo(t,function(o){return kt(o)?Gl(o.source,o.target,o):o.host?Ns(o,o.host,null,n):Vd(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 tx(a)&&!n.includes(a.host)})?!1:Ns(n,t,null,i)||rx(n,t,i)||ax(n,t)||Vl(n,t)}),this.addRule("shape.create",function(e){return Vd(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Ns(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return fx(n,t)})},Ln.prototype.canConnectMessageFlow=ux,Ln.prototype.canConnectSequenceFlow=px,Ln.prototype.canConnectDataAssociation=Wd,Ln.prototype.canConnectAssociation=cx,Ln.prototype.canConnectCompensationAssociation=lx,Ln.prototype.canMove=ax,Ln.prototype.canAttach=Ns,Ln.prototype.canReplace=rx,Ln.prototype.canDrop=Pa,Ln.prototype.canInsert=Vl,Ln.prototype.canCreate=Vd,Ln.prototype.canConnect=Gl,Ln.prototype.canResize=sx,Ln.prototype.canCopy=fx;function L2(e){return Hd(e)?null:ot(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Hd(e){return!e||it(e)}function Kb(e){do{if(M(e,"bpmn:Process"))return ge(e);if(M(e,"bpmn:Participant"))return ge(e).processRef||ge(e)}while(e=e.parent)}function zd(e){return M(e,"bpmn:TextAnnotation")}function Gd(e){return M(e,"bpmn:Group")&&!e.labelTarget}function Xb(e){return M(e,"bpmn:BoundaryEvent")&&io(e,"bpmn:CompensateEventDefinition")}function zl(e){return ge(e).isForCompensation}function I2(e,t){var n=Kb(e),i=Kb(t);return n===i}function B2(e){return M(e,"bpmn:InteractionNode")&&!M(e,"bpmn:BoundaryEvent")&&(!M(e,"bpmn:Event")||M(e,"bpmn:ThrowEvent")&&Jb(e,"bpmn:MessageEventDefinition"))}function N2(e){return M(e,"bpmn:InteractionNode")&&!zl(e)&&(!M(e,"bpmn:Event")||M(e,"bpmn:CatchEvent")&&Jb(e,"bpmn:MessageEventDefinition"))&&!(M(e,"bpmn:BoundaryEvent")&&!io(e,"bpmn:MessageEventDefinition"))}function Zb(e){for(var t=e;t=t.parent;){if(M(t,"bpmn:FlowElementsContainer"))return ge(t);if(M(t,"bpmn:Participant"))return ge(t).processRef}return null}function Qb(e,t){var n=Zb(e),i=Zb(t);return n===i}function io(e,t){var n=ge(e);return!!Lt(n.eventDefinitions||[],function(i){return M(i,t)})}function Jb(e,t){var n=ge(e);return(n.eventDefinitions||[]).every(function(i){return M(i,t)})}function $2(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:EndEvent")&&!jn(e)&&!(M(e,"bpmn:IntermediateThrowEvent")&&io(e,"bpmn:LinkEventDefinition"))&&!Xb(e)&&!zl(e)}function F2(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:StartEvent")&&!M(e,"bpmn:BoundaryEvent")&&!jn(e)&&!(M(e,"bpmn:IntermediateCatchEvent")&&io(e,"bpmn:LinkEventDefinition"))&&!zl(e)}function j2(e){return M(e,"bpmn:ReceiveTask")||M(e,"bpmn:IntermediateCatchEvent")&&(io(e,"bpmn:MessageEventDefinition")||io(e,"bpmn:TimerEventDefinition")||io(e,"bpmn:ConditionalEventDefinition")||io(e,"bpmn:SignalEventDefinition"))}function H2(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function ex(e,t){var n=H2(t);return n.indexOf(e)!==-1}function Gl(e,t,n){if(Hd(e)||Hd(t))return null;if(!M(n,"bpmn:DataAssociation")){if(ux(e,t))return{type:"bpmn:MessageFlow"};if(px(e,t))return{type:"bpmn:SequenceFlow"}}var i=Wd(e,t);return i||(lx(e,t)?{type:"bpmn:Association",associationDirection:"One"}:cx(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Pa(e,t){return it(e)||Gd(e)?!0:M(t,"bpmn:Participant")&&!ut(t)?!1:M(e,"bpmn:Participant")?M(t,"bpmn:Process")||M(t,"bpmn:Collaboration"):ot(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:M(e,"bpmn:Lane")?M(t,"bpmn:Participant")||M(t,"bpmn:Lane"):M(e,"bpmn:BoundaryEvent")&&!z2(e)?!1:M(e,"bpmn:FlowElement")&&!M(e,"bpmn:DataStoreReference")?M(t,"bpmn:FlowElementsContainer")?ut(t):ot(t,["bpmn:Participant","bpmn:Lane"]):M(e,"bpmn:DataStoreReference")&&M(t,"bpmn:Collaboration")?Io(ge(t).get("participants"),function(n){return!!n.get("processRef")}):ot(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ot(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):M(e,"bpmn:MessageFlow")?M(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function z2(e){return ge(e).cancelActivity&&(nx(e)||ix(e))}function tx(e){return!it(e)&&M(e,"bpmn:BoundaryEvent")}function G2(e){return M(e,"bpmn:Lane")}function V2(e){return tx(e)||M(e,"bpmn:IntermediateThrowEvent")&&nx(e)?!0:M(e,"bpmn:IntermediateCatchEvent")&&ix(e)}function nx(e){var t=ge(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function ix(e){return ox(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function ox(e,t){return t.some(function(n){return io(e,n)})}function W2(e){return M(e,"bpmn:ReceiveTask")&&Lt(e.incoming,function(t){return M(t.source,"bpmn:EventBasedGateway")})}function Ns(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return it(o)||!V2(o)||jn(t)||!M(t,"bpmn:Activity")||zl(t)||i&&!Yb(i,t)||W2(t)?!1:"attach"}function rx(e,t,n){if(!t)return!1;var i={replacements:[]};return z(e,function(o){jn(t)||M(o,"bpmn:StartEvent")&&o.type!=="label"&&Pa(o,t)&&(eT(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(tT(o)||nT(o)||iT(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),ox(o,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&M(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"})),M(t,"bpmn:Transaction")||io(o,"bpmn:CancelEventDefinition")&&o.type!=="label"&&(M(o,"bpmn:EndEvent")&&Pa(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),M(o,"bpmn:BoundaryEvent")&&Ns(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function ax(e,t){return Io(e,G2)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Pa(n,t)})}function Vd(e,t,n,i){return t?it(e)||Gd(e)?!0:Pa(e,t)||Vl(e,t):!1}function sx(e,t,n){return M(e,"bpmn:SubProcess")?ut(e)&&(!t||t.width>=100&&t.height>=80):M(e,"bpmn:Lane")||M(e,"bpmn:Participant")?!0:zd(e)?n?n==="e"||n==="w":!0:Gd(e)?!0:it(e)?n?n==="e"||n==="w":!0:!1}function U2(e,t){var n=zd(e),i=zd(t);return(n||i)&&n!==i}function cx(e,t){return ex(t,e)||ex(e,t)?!1:U2(e,t)?!0:!!Wd(e,t)}function lx(e,t){return Qb(e,t)&&Xb(e)&&M(t,"bpmn:Activity")&&!Y2(t,e)&&!jn(t)}function ux(e,t){return hx(e)&&!hx(t)?!1:B2(e)&&N2(t)&&!I2(e,t)}function px(e,t){return $2(e)&&F2(t)&&Qb(e,t)&&!(M(e,"bpmn:EventBasedGateway")&&!j2(t))}function Wd(e,t){return ot(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ot(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:ot(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ot(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Vl(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:ot(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!it(t)&&M(e,"bpmn:FlowNode")&&!M(e,"bpmn:BoundaryEvent")&&Pa(e,t.parent)}function Ud(e,t){return e&&t&&e.indexOf(t)!==-1}function fx(e,t){return it(t)?!0:!(M(t,"bpmn:Lane")&&!Ud(e,t.parent)||M(t,"bpmn:MessageFlow")&&!q2(e,t))}function q2(e,t){var n=dx(t.source),i=dx(t.target);return Ud(e,n)&&Ud(e,i)}function dx(e){for(;e;e=e.parent)if(M(e,"bpmn:Participant"))return e;return null}function hx(e){return wa(e,"bpmn:Process")||wa(e,"bpmn:Collaboration")}function Y2(e,t){return e.attachers.includes(t)}const K2={__depends__:[no],__init__:["bpmnRules"],bpmnRules:["type",Ln]};var X2=2e3;function gx(e,t){e.on("saveXML.start",X2,n);function n(){var i=t.getRootElements();z(i,function(o){var r=dt(o),a,s;a=xs([o]),a=rt(a,function(c){return c!==o&&!c.labelTarget}),s=Nn(a,dt),r.set("planeElement",s)})}}gx.$inject=["eventBus","canvas"];const Z2={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",gx]};function Wl(e){de.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,o=i.shape||i.connection,r=i.parent,a=t.getOrdering(o,r);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,o=i.shape||i.connection,r=i.newParent||o.parent,a=t.getOrdering(o,r);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}Wl.prototype.getOrdering=function(e,t){return null},Me(Wl,de);function qd(e,t){Wl.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=Lt(n,function(c){return ot(a,[c.type])});return s&&s.order||{level:1}}function o(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function r(a,s,c){for(var l=s;l&&!ot(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||M(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=o(a);c.containers&&(s=r(a,s,c.containers));var l=s.children.indexOf(a),u=Ig(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}}}qd.$inject=["eventBus","canvas"],Me(qd,Wl);const Q2={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",qd]};function $s(){}$s.prototype.get=function(){return this._data},$s.prototype.set=function(e){this._data=e},$s.prototype.clear=function(){var e=this._data;return delete this._data,e},$s.prototype.isEmpty=function(){return!this._data};const J2={clipboard:["type",$s]};var mx=1500;function yx(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",mx,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",mx,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=Or(a),c=document.elementFromPoint(s.x,s.y),eO(c)}}yx.$inject=["elementRegistry","eventBus","injector"];function eO(e){return Mr(e,"svg, .djs-element",!0)}const tO={__init__:["hoverFix"],hoverFix:["type",yx]};function nO(e){return!0}function Ul(e){return er(e)||s2(e)}var vx=500;function bx(e,t,n){var i=this;function o(P,O,B){if(!s(P,O)){var $,H,Q;B?H=t.getGraphics(B):($=O.delegateTarget||O.target,$&&(H=$,B=t.get(H))),!(!H||!B)&&(Q=e.fire(P,{element:B,gfx:H,originalEvent:O}),Q===!1&&(O.stopPropagation(),O.preventDefault()))}}var r={};function a(P){return r[P]}function s(P,O){var B=l[P]||er;return!B(O)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":nO,"element.mousedown":Ul,"element.mouseup":Ul,"element.click":Ul,"element.dblclick":Ul};function u(P,O,B){var $=c[P];if(!$)throw new Error("unmapped DOM event name <"+P+">");return o($,O,B)}var p="svg, .djs-element";function f(P,O,B,$){var H=r[B]=function(Q){o(B,Q)};$&&(l[B]=$),H.$delegate=ni.bind(P,p,O,H)}function d(P,O,B){var $=a(B);$&&ni.unbind(P,O,$.$delegate)}function g(P){z(c,function(O,B){f(P,B,O)})}function h(P){z(c,function(O,B){d(P,B,O)})}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 O=P.element,B=P.gfx;e.fire("interactionEvents.createHit",{element:O,gfx:B})}),e.on(["shape.changed","connection.changed"],vx,function(P){var O=P.element,B=P.gfx;e.fire("interactionEvents.updateHit",{element:O,gfx:B})}),e.on("interactionEvents.createHit",vx,function(P){var O=P.element,B=P.gfx;i.createDefaultHit(O,B)}),e.on("interactionEvents.updateHit",function(P){var O=P.element,B=P.gfx;i.updateDefaultHit(O,B)});var m=E("djs-hit djs-hit-stroke"),_=E("djs-hit djs-hit-click-stroke"),x=E("djs-hit djs-hit-all"),y=E("djs-hit djs-hit-no-move"),v={all:x,"click-stroke":_,stroke:m,"no-move":y};function E(P,O){return O=V({stroke:"white",strokeWidth:15},O||{}),n.cls(P,["no-fill","no-border"],O)}function w(P,O){var B=v[O];if(!B)throw new Error("invalid hit type <"+O+">");return Se(P,B),P}function T(P,O){Ke(P,O)}this.removeHits=function(P){var O=gs(".djs-hit",P);z(O,rn)},this.createDefaultHit=function(P,O){var B=P.waypoints,$=P.isFrame,H;return B?this.createWaypointsHit(O,B):(H=$?"stroke":"all",this.createBoxHit(O,H,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,O){var B=bs(O);return w(B,"stroke"),T(P,B),B},this.createBoxHit=function(P,O,B){B=V({x:0,y:0},B);var $=Be("rect");return w($,O),Se($,B),T(P,$),$},this.updateDefaultHit=function(P,O){var B=Et(".djs-hit",O);if(B)return P.waypoints?Df(B,P.waypoints):Se(B,{width:P.width,height:P.height}),B},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}bx.$inject=["eventBus","elementRegistry","styles"];const ql={__init__:["interactionEvents"],interactionEvents:["type",bx]};function Ta(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var o=i.element;n.deselect(o)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}Ta.$inject=["eventBus","canvas"],Ta.prototype.deselect=function(e){if(this._selectedElements.has(e)){var t=this.get();this._selectedElements.delete(e),this._eventBus.fire("selection.changed",{oldSelection:t,newSelection:this.get()})}},Ta.prototype.get=function(){return Array.from(this._selectedElements)},Ta.prototype.isSelected=function(e){return this._selectedElements.has(e)},Ta.prototype.select=function(e,t){var n=this.get();We(e)||(e=e?[e]:[]);var i=this._canvas,o=i.getRootElement();e=e.filter(function(r){var a=i.findRoot(r);return o===a}),t?z(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var xx="hover",_x="selected";function wx(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,xx)}),t.on("element.out",function(o){i(o.element,xx)}),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)})}wx.$inject=["canvas","eventBus"];function Ex(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;We(l)?t.select(l):t.select(s.filter(iO))}}),e.on("connect.end",500,function(o){var r=o.context,a=r.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(o){var r=o.previousSelection||[],a=i.get(o.context.shape.id),s=Lt(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(er(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=jl(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}Ex.$inject=["eventBus","selection","canvas","elementRegistry"];function iO(e){return!e.hidden}const Ri={__init__:["selectionVisuals","selectionBehavior"],__depends__:[ql],selection:["type",Ta],selectionVisuals:["type",wx],selectionBehavior:["type",Ex]};var oO=/^djs-cursor-.*$/;function Yl(e){var t=Rt(document.body);t.removeMatching(oO),e&&t.add("djs-cursor-"+e)}function Sx(){Yl(null)}var rO=5e3;function Rx(e,t){t=t||"element.click";function n(){return!1}return e.once(t,rO,n),function(){e.off(t,n)}}var aO=["c","C"],sO=["v","V"],cO=["d","D"],lO=["x","X"],uO=["y","Y"],Cx=["z","Z"];function pO(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function ri(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function mn(e,t){return e=We(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Yd(e){return e.shiftKey}function fO(e){return ri(e)&&mn(aO,e)}function dO(e){return ri(e)&&mn(sO,e)}function hO(e){return ri(e)&&mn(cO,e)}function gO(e){return ri(e)&&mn(lO,e)}function mO(e){return ri(e)&&!Yd(e)&&mn(Cx,e)}function yO(e){return ri(e)&&(mn(uO,e)||mn(Cx,e)&&Yd(e))}var ka=Math.round,Mx="djs-drag-active";function Lr(e){e.preventDefault()}function vO(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function bO(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ax(e,t,n,i){var o={threshold:5,trapClick:!0},r;function a(y){var v=t.viewbox(),E=t._container.getBoundingClientRect();return{x:v.x+(y.x-E.left)/v.scale,y:v.y+(y.y-E.top)/v.scale}}function s(y,v){v=v||r;var E=e.createEvent(V({},v.payload,v.data,{isTouch:v.isTouch}));return e.fire("drag."+y,E)===!1?!1:e.fire(v.prefix+"."+y,E)}function c(y){var v=y.filter(function(E){return i.get(E.id)});v.length&&n.select(v)}function l(y,v){var E=r.payload,w=r.displacement,T=r.globalStart,P=Or(y),O=Hi(P,T),B=r.localStart,$=a(P),H=Hi($,B);if(!r.active&&(v||bO(O)>r.threshold)){if(V(E,{x:ka(B.x+w.x),y:ka(B.y+w.y),dx:0,dy:0},{originalEvent:y}),s("start")===!1)return m();r.active=!0,r.keepSelection||(E.previousSelection=n.get(),n.select(null)),r.cursor&&Yl(r.cursor),t.addMarker(t.getRootElement(),Mx)}Md(y),r.active&&(V(E,{x:ka($.x+w.x),y:ka($.y+w.y),dx:ka(H.x),dy:ka(H.y)},{originalEvent:y}),s("move"))}function u(y){var v,E=!0;r.active&&(y&&(r.payload.originalEvent=y,Md(y)),E=s("end")),E===!1&&s("rejected"),v=_(E!==!0),s("ended",v)}function p(y){mn("Escape",y)&&(Lr(y),m())}function f(y){var v;r.active&&(v=Rx(e),setTimeout(v,400),Lr(y)),u(y)}function d(y){l(y)}function g(y){var v=r.payload;v.hoverGfx=y.gfx,v.hover=y.element,s("hover")}function h(y){s("out");var v=r.payload;v.hoverGfx=null,v.hover=null}function m(y){var v;if(r){var E=r.active;E&&s("cancel"),v=_(y),E&&s("canceled",v)}}function _(y){var v,E;s("cleanup"),Sx(),r.trapClick?E=f:E=u,Fe.unbind(document,"mousemove",l),Fe.unbind(document,"dragstart",Lr),Fe.unbind(document,"selectstart",Lr),Fe.unbind(document,"mousedown",E,!0),Fe.unbind(document,"mouseup",E,!0),Fe.unbind(document,"keyup",p),Fe.unbind(document,"touchstart",d,!0),Fe.unbind(document,"touchcancel",m,!0),Fe.unbind(document,"touchmove",l,!0),Fe.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),Mx);var w=r.payload.previousSelection;return y!==!1&&w&&!n.get().length&&c(w),v=r,r=null,v}function x(y,v,E,w){r&&m(!1),typeof v=="string"&&(w=E,E=v,v=null),w=V({},o,w||{});var T=w.data||{},P,O,B,$,H;if(w.trapClick?$=f:$=u,y?(P=Aa(y)||y,O=Or(y),Md(y),P.type==="dragstart"&&Lr(P)):(P=null,O={x:0,y:0}),B=a(O),v||(v=B),H=vO(P),r=V({prefix:E,data:T,payload:{},globalStart:O,displacement:Hi(v,B),localStart:B,isTouch:H},w),w.manual||(H?(Fe.bind(document,"touchstart",d,!0),Fe.bind(document,"touchcancel",m,!0),Fe.bind(document,"touchmove",l,!0),Fe.bind(document,"touchend",u,!0)):(Fe.bind(document,"mousemove",l),Fe.bind(document,"dragstart",Lr),Fe.bind(document,"selectstart",Lr),Fe.bind(document,"mousedown",$,!0),Fe.bind(document,"mouseup",$,!0)),Fe.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return m(),!1;w.autoActivate&&l(y,!0)}e.on("diagram.destroy",m),this.init=x,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=m,this.context=function(){return r},this.setOptions=function(y){V(o,y)}}Ax.$inject=["eventBus","canvas","selection","elementRegistry"];const Eo={__depends__:[tO,Ri],dragging:["type",Ax]};function Ir(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Ir.prototype.next=function(){return this._prefix+ ++this._counter};const xO=new Ir("ps");var _O=["marker-start","marker-mid","marker-end"],wO=["circle","ellipse","line","path","polygon","polyline","path","rect"];function tr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}tr.$inject=["elementRegistry","eventBus","canvas","styles"],tr.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")},tr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},tr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=Rf(n);return this._cloneMarkers(Yo(o),i),Se(o,this._styles.cls(i,[])),Ke(t,o),Se(o,"data-preview-support-element-id",e.id),o},tr.prototype.addFrame=function(e,t){var n=Be("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Ke(t,n),Se(n,"data-preview-support-element-id",e.id),n},tr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),CO(e)&&_O.forEach(function(o){if(Se(e,o)){var r=EO(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},tr.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,xO.next()].join("-"),a=Et("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Rf(n);s.id=r,lt(s).add(o);var c=Et(":scope > defs",e);c||(c=Be("defs"),Ke(e,c)),Ke(c,s);var l=RO(s.id);Se(t,i,l)};function EO(e,t,n){var i=SO(Se(e,t));return Et("marker#"+i,n||document)}function SO(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function RO(e){return"url(#"+e+")"}function CO(e){return wO.indexOf(e.nodeName)!==-1}const Oa={__init__:["previewSupport"],previewSupport:["type",tr]};var MO="drop-ok",Px="drop-not-ok",Tx="attach-ok",kx="new-parent",Ox="create",AO=2e3;function Dx(e,t,n,i,o){function r(c,l,u,p,f){if(!l)return!1;c=rt(c,function(x){var y=x.labelTarget;return!x.parent&&!(it(x)&&c.indexOf(y)!==-1)});var d=Lt(c,function(x){return!kt(x)}),g=!1,h=!1,m=!1;Ix(c)&&(g=o.allowed("shape.attach",{position:u,shape:d,target:l})),g||(Ix(c)?m=o.allowed("shape.create",{position:u,shape:d,source:p,target:l}):m=o.allowed("elements.create",{elements:c,position:u,target:l}));var _=f.connectionTarget;return m||g?(d&&p&&(h=o.allowed("connection.create",{source:_===p?d:p,target:_===p?p:d,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):m===null||g===null?null:!1}function a(c,l){[Tx,MO,Px,kx].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}Lx(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,Tx):a(p,h?kx:Px))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,p=l.shape,f=l.elements,d=l.target,g=l.canExecute,h=g&&g.attach,m=g&&g.connect,_=l.hints||{};if(g===!1||!d)return!1;Lx(c);var x={x:c.x,y:c.y};m?p=i.appendShape(u,p,x,d,{attach:h,connection:m===!0?{}:m,connectionTarget:_.connectionTarget}):(f=i.createElements(f,x,d,V({},_,{attach:h})),p=Lt(f,function(y){return!kt(y)})),V(l,{elements:f,shape:p}),V(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Ox&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],AO,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){We(l)||(l=[l]);var p=Lt(l,function(g){return!kt(g)});if(p){u=V({elements:l,hints:{},shape:p},u||{}),z(l,function(g){Ue(g.x)||(g.x=0),Ue(g.y)||(g.y=0)});var f=rt(l,function(g){return!g.hidden}),d=an(f);z(l,function(g){kt(g)&&(g.waypoints=Nn(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),V(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,Ox,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}Dx.$inject=["canvas","dragging","eventBus","modeling","rules"];function Lx(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 Ix(e){return e&&e.length===1&&!kt(e[0])}var PO=750;function Bx(e,t,n,i,o){function r(a){var s=Be("g");Se(s,o.cls("djs-drag-group",["no-events"]));var c=Be("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(Yo(u),l)):(u=n._createContainer("shape",c),n.drawShape(Yo(u),l),Dn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",PO,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(),Ke(p,u)),Dn(u,a.x,a.y)):rn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&rn(c)})}Bx.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Kl={__depends__:[Eo,Oa,no,Ri],__init__:["create","createPreview"],create:["type",Dx],createPreview:["type",Bx]};function Kd(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)})}Kd.$inject=["eventBus"],Kd.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||TO(0,0)};function TO(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 Fs={__init__:["mouse"],mouse:["type",Kd]};var Nx=2e3;function ai(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),kO(u)&&(l.priority=2,l.host=u.host.id),kt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=OO(u)),it(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),z(["x","y","width","height"],function(f){Ue(u[f])&&(l[f]=u[f])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",Nx,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",Nx,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;V(l,{createElementsBehavior:!1})})}ai.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],ai.prototype.copy=function(e,t={}){var n,i;return We(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(We(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},ai.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})}}},ai.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},ai.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},ai.prototype._getElementIdsFromTree=function(e){var t={};return z(e,function(n){z(n,function(i){i.id&&(t[i.id]=!0)})}),t},ai.prototype._paste=function(e,t,n,i){z(e,function(r){Ue(r.x)||(r.x=0),Ue(r.y)||(r.y=0)});var o=an(e);return z(e,function(r){kt(r)&&(r.waypoints=Nn(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),V(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,V({},i))},ai.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return z(e,function(r,a){r=Ui(r,"priority"),z(r,function(s){var c=V({},qi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(kt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),o.push(l);return}if(it(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),o.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),o.push(l)})}),o},ai.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(qi(e,["id"]));return t},ai.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(qi(e,["id"]));return t},ai.prototype.createShape=function(e){var t=this._elementFactory.createShape(qi(e,["id"]));return t},ai.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(kt(e)&&(!n.has(e.source)||!n.has(e.target))||it(e)&&!n.has(e.labelTarget))},ai.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=sl(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}Pr(a,function(p,f,d){if(it(p))return;z(p.labels,function(m){c(m,d)});function g(m){m&&m.length&&z(m,function(_){z(_.labels,function(x){c(x,d)}),c(_,d)})}z([p.attachers,p.incoming,p.outgoing],g),c(p,d);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=Nn(o,function(p){return p.element});var u=new Set(e);return o=Nn(o,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),o=Ui(o,function(p){return p.descriptor.priority}),e=Nn(o,function(p){return p.element}),z(o,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,u)){Fx(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){Fx(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function kO(e){return!!e.host}function OO(e){return Nn(e.waypoints,function(t){return t=$x(t),t.original&&(t.original=$x(t.original)),t})}function $x(e){return V({},e)}function Fx(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const DO={__depends__:[J2,Kl,Fs,no],__init__:["copyPaste"],copyPaste:["type",ai]};function Xd(e,t,n){We(n)||(n=[n]),z(n,function(i){xr(e[i])||(t[i]=e[i])})}var Zd=750;function jx(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",Zd,function(c){var l=c.descriptor,u=c.element,p=ge(u);if(it(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(dt(u),!0);d.bpmnElement=f,Xd(f,l,"name"),Xd(d,l,"isExpanded"),p.default&&(l.default=p.default.id)});var o="-bpmn-js-refs";function r(c){return c[o]=c[o]||{}}function a(c,l){c[o]=l}function s(c,l,u){var p=ge(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(ge(c).attachedToRef=ge(l[c.host])),qi(u,ti(u,function(f,d,g){var h=d.element,m=d.property;return g===c.id&&(h.set(m,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,f=u.di;if(it(u)){u.businessObject=ge(l[u.labelTarget]),u.di=dt(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,Xd(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",Zd,function(c){var l=c.descriptor,u=c.element;if(M(u,"bpmn:Participant")){var p=ge(u);p.processRef&&(l.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;M(l,"bpmn:SubProcess")&&z(Cs(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",Zd,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}jx.$inject=["bpmnFactory","eventBus","moddleCopy"];const LO=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],IO=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function js(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 Ui(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=hn(o)&&o.$descriptor;if(a&&IO.includes(a))return r;if(a&&LO.includes(a)||a&&s&&!Lt(s.properties,ia({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})}js.$inject=["eventBus","bpmnFactory","moddle"],js.prototype.copyElement=function(e,t,n,i=!1){n&&!We(n)&&(n=[n]),n=n||Qd(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||(We(o)&&(n=o),z(n,r=>{let a;ei(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!dn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},js.prototype.copyProperty=function(e,t,n,i=!1){let o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(o===!1)return;if(o)return hn(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;const r=this._moddle.getPropertyDescriptor(t,n);if(!r.isReference)return r.isId?e&&this._copyId(e,t,i):We(e)?ti(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):hn(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(o=this._bpmnFactory.create(e.$type),o.$parent=t,o=this.copyElement(e,o,null,i),o):e},js.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 Qd(e,t){return ti(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Hx={__depends__:[DO],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",jx],moddleCopy:["type",js]};var zx=Math.round;function Jd(e,t){this._modeling=e,this._eventBus=t}Jd.$inject=["modeling","eventBus"],Jd.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=zx(s+r/2),u=zx(c+a/2),p=i.replaceShape(e,V({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Gx(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}Gx.$inject=["selection","eventBus"];const BO={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Gx],replace:["type",Jd]};function NO(e,t,n){We(n)||(n=[n]),z(n,function(i){xr(e[i])||(t[i]=e[i])})}var $O=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function FO(e,t){var n=e&&ei(e,"collapsed")?e.collapsed:!ut(e),i;return t&&(ei(t,"collapsed")||ei(t,"isExpanded"))?i=ei(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Vx(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(Xl(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&FO(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),NO(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=Qd(p.$descriptor),h=Qd(f.$descriptor,!0),m=jO(g,h);V(f,Ii(c,$O));var _=rt(m,function(v){return v==="eventDefinitions"?Wx(s,c.eventDefinitionType):v==="loopCharacteristics"?!jn(f):ei(f,v)||v==="processRef"&&c.isExpanded===!1||v==="triggeredByEvent"?!1:v==="isForCompensation"?!jn(f):!0});if(f=n.copyElement(p,f,_),c.eventDefinitionType&&(Wx(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),M(p,"bpmn:Activity")){if(Xl(p))d.isExpanded=ut(s);else if(c&&ei(c,"isExpanded")){d.isExpanded=c.isExpanded;var x=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=x.width,d.height=x.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}ut(s)&&!M(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Xl(p)&&!Xl(f)&&(l.moveChildren=!1),M(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var y=xn(s);dt(s).isHorizontal||(dt(d).isHorizontal=y),d.width=y?s.width:t.getDefaultSize(d).width,d.height=y?t.getDefaultSize(d).height:s.height}return r.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,ot(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ot(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!M(p,"bpmn:BoundaryEvent")&&M(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),o.replaceElement(s,d,{...l,targetElement:c})}this.replaceElement=a}Vx.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Xl(e){return M(e,"bpmn:SubProcess")}function Wx(e,t){var n=ge(e);return t&&n.get("eventDefinitions").some(function(i){return M(i,t)})}function jO(e,t){return e.filter(function(n){return t.includes(n)})}const Ux={__depends__:[Hx,BO,Ri],bpmnReplace:["type",Vx]};var HO=250;function Br(e){this._eventBus=e,this._tools=[],this._active=null}Br.$inject=["eventBus"],Br.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)},Br.prototype.isActive=function(e){return e&&this._active===e},Br.prototype.length=function(e){return this._tools.length},Br.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Br.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(o){var r=o.context;if(!r.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),z(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,HO,function(o){this._active&&(zO(o)||this.setActive(null))},this)};function zO(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Mr(t,'.group[data-group="tools"]')}const Zl={__depends__:[Eo],__init__:["toolManager"],toolManager:["type",Br]};function GO(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 VO(e,t){var n=[],i=new Set(e);z(t,function(r){i.add(r)});var o=new Set;return i.forEach(function(r){var a=r.incoming,s=r.outgoing;z(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(o.has(c)||(o.add(c),n.push(c)))})}),n}function WO(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 eh=Math.abs,UO=Math.round,So={x:"width",y:"height"},qx="crosshair",nr={n:"top",w:"left",s:"bottom",e:"right"},qO=1500,Ql={n:"s",w:"e",s:"n",e:"w"},Jl=20;function Ci(e,t,n,i,o,r,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=o,this._toolManager=r,this._mouse=a;var s=this;r.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",qO,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&Kx(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){Kx(c);var h={x:0,y:0};h[u]=UO(c["d"+u]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(m){s.activateSelection(m.originalEvent,!0,!0)})}})}Ci.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Ci.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:qx,data:{context:{reactivate:n}},trapClick:!1})},Ci.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:qx,data:{context:{}}})},Ci.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},Ci.prototype.init=function(e,t){var n=eh(e.dx)>eh(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(eh(i)<5)return!1;i<0&&(i*=-1),Bs(e)&&(i*=-1);var r=GO(n,i),a=this._canvas.getRootElement();!jl(e)&&e.hover&&(a=e.hover);var s=[...xs(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=YO(c,n,r,o,l);return V(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),Yl("resize-"+(n==="x"?"ew":"ns")),!0},Ci.prototype.calculateAdjustments=function(e,t,n,i){var o=this._rules,r=[],a=[],s=new Set,c=new Set,l=[],u=[];function p(d){s.has(d)||(s.add(d),r.push(d));var g=d.label;g&&!s.has(g)&&(s.add(g),r.push(g))}function f(d){c.has(d)||(c.add(d),a.push(d))}return z(e,function(d){if(!(!d.parent||it(d))){if(kt(d)){u.push(d);return}var g=d[t],h=g+d[So[t]];if(KO(d)&&(n>0&&qe(d)[t]>i||n<0&&qe(d)[t]<i)){l.push(d);return}if(n>0&&g>i||n<0&&h<i){p(d);return}if(g<i&&h>i&&o.allowed("shape.resize",{shape:d})){f(d);return}}}),z(r,function(d){var g=d.attachers;g&&z(g,function(h){p(h)})}),z(l,function(d){var g=d.host;(s.has(g)||c.has(g))&&p(d)}),z(u,function(d){var g=d.source,h=d.target,m=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&m&&p(m)}),{movingShapes:r,resizingShapes:a}},Ci.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Ci.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Yx(e){return{top:e.top-Jl,right:e.right+Jl,bottom:e.bottom+Jl,left:e.left-Jl}}function Kx(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;Ue(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Ue(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Ue(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),Ue(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function YO(e,t,n,i,o){var r=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(r),p=new Set(a);return z(a,function(f){var d=f.attachers,g=f.children,h=He(f),m=rt(g,function(H){return!kt(H)&&!it(H)&&!u.has(H)&&!p.has(H)}),_=rt(g,function(H){return!kt(H)&&!it(H)&&u.has(H)}),x,y,v,E=[],w=[],T,P,O,B;m.length&&(y=Yx(He(an(m))),x=i-h[nr[n]]+y[nr[n]],n==="n"?s.bottom=l=Ue(l)?Math.min(l,x):x:n==="w"?s.right=l=Ue(l)?Math.min(l,x):x:n==="s"?s.top=c=Ue(c)?Math.max(c,x):x:n==="e"&&(s.left=c=Ue(c)?Math.max(c,x):x)),_.length&&(v=Yx(He(an(_))),x=i-v[nr[Ql[n]]]+h[nr[Ql[n]]],n==="n"?s.bottom=l=Ue(l)?Math.min(l,x):x:n==="w"?s.right=l=Ue(l)?Math.min(l,x):x:n==="s"?s.top=c=Ue(c)?Math.max(c,x):x:n==="e"&&(s.left=c=Ue(c)?Math.max(c,x):x)),d&&d.length&&(d.forEach(function(H){u.has(H)?E.push(H):w.push(H)}),E.length&&(T=He(an(E.map(qe))),P=h[nr[Ql[n]]]-(T[nr[Ql[n]]]-i)),w.length&&(O=He(an(w.map(qe))),B=O[nr[n]]-(h[nr[n]]-i)),n==="n"?(x=Math.min(P||1/0,B||1/0),s.bottom=l=Ue(l)?Math.min(l,x):x):n==="w"?(x=Math.min(P||1/0,B||1/0),s.right=l=Ue(l)?Math.min(l,x):x):n==="s"?(x=Math.max(P||-1/0,B||-1/0),s.top=c=Ue(c)?Math.max(c,x):x):n==="e"&&(x=Math.max(P||-1/0,B||-1/0),s.left=c=Ue(c)?Math.max(c,x):x));var $=o&&o[f.id];$&&(n==="n"?(x=i+f[So[t]]-$[So[t]],s.bottom=l=Ue(l)?Math.min(l,x):x):n==="w"?(x=i+f[So[t]]-$[So[t]],s.right=l=Ue(l)?Math.min(l,x):x):n==="s"?(x=i-f[So[t]]+$[So[t]],s.top=c=Ue(c)?Math.max(c,x):x):n==="e"&&(x=i-f[So[t]]+$[So[t]],s.left=c=Ue(c)?Math.max(c,x):x))}),s}}function KO(e){return!!e.host}var th="djs-dragging",Xx="djs-resizing",XO=250,eu=Math.max;function Zx(e,t,n,i,o){function r(a,s){z(a,function(c){o.addDragger(c,s),n.addMarker(c,th)})}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=Be("g");Se(u,i.cls("djs-crosshair-group",["no-events"])),Ke(s,u);var p=Be("path");Se(p,"d",l.x),lt(p).add("djs-crosshair"),Ke(u,p);var f=Be("path");Se(f,"d",l.y),lt(f).add("djs-crosshair"),Ke(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&&rn(c)}),e.on("spaceTool.move",XO,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=Be("path"),Se(c,"d","M0,0 L0,0"),lt(c).add("djs-crosshair"),Ke(f,c),s.line=c;var d=Be("g");Se(d,i.cls("djs-drag-group",["no-events"])),Ke(n.getActiveLayer(),d),r(u,d);var g=new Set(u);z(p,function(w){g.add(w)});var h=new Set,m=s.movingConnections=[];g.forEach(function(w){z(w.outgoing,function(T){h.has(T)||!kt(T)||!g.has(T.target)||(h.add(T),m.push(T))})}),r(m,d),s.dragGroup=d}if(!s.frameGroup){var _=Be("g");Se(_,i.cls("djs-frame-group",["no-events"])),Ke(n.getActiveLayer(),_);var x=[];z(p,function(w){var T=o.addFrame(w,_),P=T.getBBox();x.push({element:T,initialBounds:P}),n.addMarker(w,Xx)}),s.frameGroup=_,s.frames=x}var y={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Se(c,{d:y[l]});var v={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[v[s.axis]]=0,Dn(s.dragGroup,E.x,E.y),z(s.frames,function(w){var T=w.element,P=w.initialBounds,O,B;s.direction==="e"?Se(T,{width:eu(P.width+E.x,5)}):(O=eu(P.width-E.x,5),Se(T,{width:O,x:P.x+P.width-O})),s.direction==="s"?Se(T,{height:eu(P.height+E.y,5)}):(B=eu(P.height-E.y,5),Se(T,{height:B,y:P.y+P.height-B}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;z(c,function(g){n.removeMarker(g,th)}),z(l,function(g){n.removeMarker(g,th)}),f&&(rn(p),rn(f)),z(u,function(g){n.removeMarker(g,Xx)}),d&&rn(d)})}Zx.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const ZO={__init__:["spaceToolPreview"],__depends__:[Eo,no,Zl,Oa,Fs],spaceTool:["type",Ci],spaceToolPreview:["type",Zx]};function tu(e,t){e.invoke(Ci,this),this._canvas=t}tu.$inject=["injector","canvas"],Me(tu,Ci),tu.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=ta(ga(o.children.filter(l=>M(l,"bpmn:Artifact")),an(r))));const s=[...e,...a];var c=Ci.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(M(l,"bpmn:TextAnnotation")||QO(l)&&(t==="y"&&xn(l)||t==="x"&&!xn(l)))}),c};function QO(e){return M(e,"bpmn:Participant")&&!ge(e).processRef}const Qx={__depends__:[ZO],spaceTool:["type",tu]};function Vt(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Vt.$inject=["eventBus","injector"],Vt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Vt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let o=this._fire(e,"canExecute",n);if(o===void 0){if(!i)return!1;i.canExecute&&(o=i.canExecute(t))}return o},Vt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Vt.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Vt.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Vt.prototype.register=function(e,t){this._setHandler(e,t)},Vt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Vt.prototype.canUndo=function(){return!!this._getUndoAction()},Vt.prototype.canRedo=function(){return!!this._getRedoAction()},Vt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Vt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Vt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},Vt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let o;n=this._eventBus.createEvent(n);for(const r of i)if(o=this._eventBus.fire("commandStack."+r,n),n.cancelBubble)break;return o},Vt.prototype._createId=function(){return this._uid++},Vt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Vt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,o=this._getHandler(n);if(!o)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),o.preExecute&&o.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),o.execute&&this._markDirty(o.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),o.postExecute&&o.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Vt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Vt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Bg("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Vt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=We(e)?e:[e],t.dirty=t.dirty.concat(e))},Vt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Vt.prototype._revertedAction=function(e){this._stackIdx--},Vt.prototype._getHandler=function(e){return this._handlerMap[e]},Vt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const JO={commandStack:["type",Vt]};function ir(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 eD=250,Jx=1400;function nh(e,t,n){de.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Jx,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=e_(a),r.validatedShapes=e_(s)}),i&&t.on("shape.move.start",eD,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",Jx,function(o){var r=o.context,a=r.closure,s=a.enclosedElements,c=[];z(s,function(l){z(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(o){var r=o.context,a=r.connection||r.shape;ir(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=If(s.labels,a),r.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(o){var r=o.context,a=r.shape,s=r.labelTarget,c=r.labelTargetIndex;s&&(tn(s.labels,a,c),a.labelTarget=s)})}Me(nh,de),nh.$inject=["injector","eventBus","modeling"];function e_(e){var t=new Set(e);return rt(e,function(n){return!t.has(n.labelTarget)})}const tD={__init__:["labelSupport"],labelSupport:["type",nh]};var nD=251,t_=1401,n_="attach-ok";function ih(e,t,n,i,o){de.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",t_,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=iD(c),s.validatedShapes=oD(l)}),r&&t.on("shape.move.start",nD,function(a){var s=a.context,c=s.shapes,l=oh(c);z(l,function(u){r.makeDraggable(s,u,!0),z(u.labels,function(p){r.makeDraggable(s,p,!0)})})}),r&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var l=c[0],u=l.host;u&&(n.addMarker(u,n_),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,n_)}))}}),this.preExecuted("elements.move",t_,function(a){var s=a.context,c=s.closure,l=s.shapes,u=oh(l);z(u,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=rt(c,function(p){var f=p.host;return rD(p)&&!aD(c,f)}),z(u,function(p){o.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;z(s,function(c){z(c.attachers,function(l){z(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)}),z(l.incoming.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&o.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;ir(c.attachers,function(u){var p=i.allowed("elements.move",{target:l,shapes:[u]});p==="attach"?o.updateAttachment(u,l):o.removeShape(u)}),l.attachers.length&&z(l.attachers,function(u){var p=xb(u,c,l);o.moveShape(u,p,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&z(p,function(d){var g=xb(d,l,u);o.moveShape(d,g,d.parent),z(d.labels,function(h){o.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;ir(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}Me(ih,de),ih.$inject=["injector","eventBus","canvas","rules","modeling"];function oh(e){return wp(Nn(e,function(t){return t.attachers||[]}))}function iD(e){var t=oh(e);return aS("id",e,t)}function oD(e){var t=na(e,"id");return rt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function rD(e){return!!e.host}function aD(e,t){return e.indexOf(t)!==-1}const sD={__depends__:[no],__init__:["attachSupport"],attachSupport:["type",ih]};function i_(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(Ky(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)})}i_.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const rh={__init__:["changeSupport"],changeSupport:["type",i_]};function Mi(e){this._model=e}Mi.$inject=["moddle"],Mi.prototype._needsId=function(e){return ot(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},Mi.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;M(e,"bpmn:Activity")?t="Activity":M(e,"bpmn:Event")?t="Event":M(e,"bpmn:Gateway")?t="Gateway":ot(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Mi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Mi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Mi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",V({bpmnElement:e,bounds:this.createDiBounds()},t))},Mi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Mi.prototype.createDiWaypoints=function(e){var t=this;return Nn(e,function(n){return t.createDiWaypoint(n)})},Mi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Ii(e,["x","y"]))},Mi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",V({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Mi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",V({bpmnElement:e},t))};function si(e,t,n){de.call(this,e),this._bpmnFactory=t;var i=this;function o(d){var g=d.context,h=g.hints||{},m;!g.cropped&&h.createElementsBehavior!==!1&&(m=g.connection,m.waypoints=n.getCroppedWaypoints(m),g.cropped=!0)}this.executed(["connection.layout","connection.create"],o),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function r(d){var g=d.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(d){var g=d.context,h=g.shape||g.connection,m=g.parent||g.newParent;i.updateParent(h,m)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ci(r)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ci(a));function s(d){var g=d.context,h=g.oldRoot,m=h.children;z(m,function(_){M(_,"bpmn:BaseElement")&&i.updateParent(_)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;M(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],ci(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],ci(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"],ci(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],ci(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],ci(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],ci(u)),this.executed("connection.reconnect",ci(function(d){var g=d.context,h=g.connection,m=g.oldSource,_=g.newSource,x=ge(h),y=ge(m),v=ge(_);x.conditionExpression&&!ot(v,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=x.conditionExpression,delete x.conditionExpression),m!==_&&y.default===x&&(g.oldDefault=y.default,delete y.default)})),this.reverted("connection.reconnect",ci(function(d){var g=d.context,h=g.connection,m=g.oldSource,_=g.newSource,x=ge(h),y=ge(m),v=ge(_);g.oldConditionExpression&&(x.conditionExpression=g.oldConditionExpression),g.oldDefault&&(y.default=g.oldDefault,delete v.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],ci(p)),this.reverted(["element.updateAttachment"],ci(p)),this.executed("element.updateLabel",ci(f)),this.reverted("element.updateLabel",ci(f));function f(d){const{element:g}=d.context,h=yi(g),m=dt(g),_=m&&m.get("label");Xo(g)||Hl(g)||(h&&!_?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&_&&m.set("label",void 0))}}Me(si,de),si.$inject=["eventBus","bpmnFactory","connectionDocking"],si.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},si.prototype.updateParent=function(e,t){if(!it(e)&&!(M(e,"bpmn:DataStoreReference")&&e.parent&&M(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=dt(e),r=n&&n.businessObject,a=dt(n);M(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),M(e,"bpmn:DataOutputAssociation")&&(e.source?r=e.source.businessObject:r=null),M(e,"bpmn:DataInputAssociation")&&(e.target?r=e.target.businessObject:r=null),this.updateSemanticParent(i,r),M(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(o,a)}},si.prototype.updateBounds=function(e){var t=dt(e),n=lD(e);if(n){var i=Hi(n,t.get("bounds"));V(n,{x:e.x+i.x,y:e.y+i.y})}var o=it(e)?this._getLabel(t):t,r=o.bounds;r||(r=this._bpmnFactory.createDiBounds(),o.set("bounds",r)),V(r,{x:e.x,y:e.y,width:e.width,height:e.height})},si.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,o;M(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Zt(i,e)),M(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),tn(o,e))}},si.prototype.updateDiConnection=function(e,t,n){var i=dt(e),o=dt(t),r=dt(n);i.sourceElement&&i.sourceElement.bpmnElement!==ge(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==ge(n)&&(i.targetElement=n&&r)},si.prototype.updateDiParent=function(e,t){if(t&&!M(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Zt(n,e),e.$parent=null)}};function cD(e){for(;e&&!M(e,"bpmn:Definitions");)e=e.$parent;return e}si.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)},si.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=cD(e.$parent||t),e.$parent&&(Zt(r.get("rootElements"),o),o.$parent=null),t&&(tn(r.get("rootElements"),o),o.$parent=r))}else M(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":M(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),Zt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Zt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},si.prototype.updateConnectionWaypoints=function(e){var t=dt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},si.prototype.updateConnection=function(e){var t=e.connection,n=ge(t),i=t.source,o=ge(i),r=t.target,a=ge(t.target),s;if(M(n,"bpmn:DataAssociation"))M(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=o,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):M(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||o,this.updateSemanticParent(n,o,s),n.targetRef=a);else{var c=M(n,"bpmn:SequenceFlow");n.sourceRef!==o&&(c&&(Zt(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(Zt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,r)},si.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function ci(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;M(i,"bpmn:BaseElement")&&e(t)}}function lD(e){if(M(e,"bpmn:Activity")){var t=dt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function or(e,t){bo.call(this),this._bpmnFactory=e,this._moddle=t}Me(or,bo),or.$inject=["bpmnFactory","moddle"],or.prototype._baseCreate=bo.prototype.create,or.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,V({type:"label",di:n},Tr,t))}return this.createElement(e,t)},or.prototype.createElement=function(e,t){t=V({},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(!pD(o)){var r=V({},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=V({isFrame:!0},t)),t=uD(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=ah(o,t,"isExpanded")),ot(i,["bpmn:Lane","bpmn:Participant"])&&(t=ah(o,t,"isHorizontal")),M(i,"bpmn:SubProcess")&&(t.collapsed=!ut(i,o)),M(i,"bpmn:ExclusiveGateway")&&(ei(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),dn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),dn(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,o),t=V({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},or.prototype.getDefaultSize=function(e,t){var n=ge(e);if(t=t||dt(e),M(n,"bpmn:SubProcess"))return ut(n,t)?{width:350,height:200}:{width:100,height:80};if(M(n,"bpmn:Task"))return{width:100,height:80};if(M(n,"bpmn:Gateway"))return{width:50,height:50};if(M(n,"bpmn:Event"))return{width:36,height:36};if(M(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return ut(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return M(n,"bpmn:Lane")?{width:400,height:100}:M(n,"bpmn:DataObjectReference")?{width:36,height:50}:M(n,"bpmn:DataStoreReference")?{width:50,height:50}:M(n,"bpmn:TextAnnotation")?{width:100,height:40}:M(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},or.prototype.createParticipantShape=function(e){return hn(e)||(e={isExpanded:e}),e=V({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function uD(e,t,n){return z(n,function(i){t=ah(e,t,i)}),t}function ah(e,t,n){return t[n]===void 0?t:(e[n]=t[n],qi(t,[n]))}function pD(e){return ot(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function nu(e,t){this._modeling=e,this._canvas=t}nu.$inject=["modeling","canvas"],nu.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;z(n,function(o){var r={x:0,y:0};dn(i.left)?r.x=i.left-o.x:dn(i.right)?r.x=i.right-o.width-o.x:dn(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:dn(i.top)?r.y=i.top-o.y:dn(i.bottom)?r.y=i.bottom-o.height-o.y:dn(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},nu.prototype.postExecute=function(e){};function iu(e){this._modeling=e}iu.$inject=["modeling"],iu.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},iu.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 Io(e.outgoing,function(n){return n.target===t})}function ou(e,t){this._canvas=e,this._layouter=t}ou.$inject=["canvas","layouter"],ou.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},ou.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var ru=Math.round;function sh(e){this._modeling=e}sh.$inject=["modeling"],sh.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,a=this._modeling;z(t,function(p){Ue(p.x)||(p.x=0),Ue(p.y)||(p.y=0)});var s=rt(t,function(p){return!p.hidden}),c=an(s);z(t,function(p){kt(p)&&(p.waypoints=Nn(p.waypoints,function(f){return{x:ru(f.x-c.x-c.width/2+o.x),y:ru(f.y-c.y-c.height/2+o.y)}})),V(p,{x:ru(p.x-c.x-c.width/2+o.x),y:ru(p.y-c.y-c.height/2+o.y)})});var l=new Set(sl(t)),u={};z(t,function(p){if(kt(p)){u[p.id]=Ue(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=V({},r);l.has(p)||(f.autoResize=!1),it(p)&&(f=qi(f,["attach"])),u[p.id]=Ue(i)?a.createShape(p,Ii(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Ii(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=ta(u)};var o_=Math.round;function rr(e){this._canvas=e}rr.$inject=["canvas"],rr.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?V(t,n):V(t,{x:n.x-o_(t.width/2),y:n.y-o_(t.height/2)}),this._canvas.addShape(t,i,o),t},rr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Hs(e){rr.call(this,e)}Me(Hs,rr),Hs.$inject=["canvas"];var dD=rr.prototype.execute;Hs.prototype.execute=function(e){var t=e.shape;return gD(t),t.labelTarget=e.labelTarget,dD.call(this,e)};var hD=rr.prototype.revert;Hs.prototype.revert=function(e){return e.shape.labelTarget=null,hD.call(this,e)};function gD(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function zs(e,t){this._canvas=e,this._modeling=t}zs.$inject=["canvas","modeling"],zs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;ir(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ir(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},zs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=If(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},zs.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,tn(n.children,t,i),this._canvas.addConnection(t,n),t};function ch(e,t){this._modeling=e,this._elementRegistry=t}ch.$inject=["modeling","elementRegistry"],ch.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;z(i,function(o){n.get(o.id)&&(o.waypoints?t.removeConnection(o):t.removeShape(o))})};function Gs(e,t){this._canvas=e,this._modeling=t}Gs.$inject=["canvas","modeling"],Gs.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;ir(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ir(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),ir(n.children,function(i){kt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Gs.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=If(i.children,n),t.removeShape(n),n},Gs.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return tn(i.children,n,o),t.addShape(n,i),n};function au(e){this._modeling=e}au.$inject=["modeling"];var r_={x:"y",y:"x"};au.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(m,_){m.range.min=Math.min(_[i],m.range.min),m.range.max=Math.max(_[i]+_[o],m.range.max)}function a(m){return m[i]+m[o]/2}function s(m){return m.length-1}function c(m){return m.max-m.min}function l(m,_){var x={y:0};x[i]=m-a(_),x[i]&&(x[r_[i]]=0,t.moveElements([_],x,_.parent))}var u=n[0],p=s(n),f=n[p],d,g,h=0;z(n,function(m,_){var x,y,v;if(m.elements.length<2){_&&_!==n.length-1&&(r(m,m.elements[0]),h+=c(m.range));return}x=Ui(m.elements,i),y=x[0],_===p&&(y=x[s(x)]),v=a(y),m.range=null,z(x,function(E){if(l(v,E),m.range===null){m.range={min:E[i],max:E[i]+E[o]};return}r(m,E)}),_&&_!==n.length-1&&(h+=c(m.range))}),g=Math.abs(f.range.min-u.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&z(n,function(m,_){var x={},y;m===u||m===f||(y=n[_-1],m.range.max=0,z(m.elements,function(v,E){x[r_[i]]=0,x[i]=y.range.max-v[i]+d,m.range.min!==v[i]&&(x[i]+=v[i]-m.range.min),x[i]&&t.moveElements([v],x,v.parent),m.range.max=Math.max(v[i]+v[o],E?m.range.max:0)}))})},au.prototype.postExecute=function(e){};function su(e,t){this._layouter=e,this._canvas=t}su.$inject=["layouter","canvas"],su.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return V(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},su.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function lh(){}lh.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,o=e.newParentIndex,r=t.parent;return e.oldParent=r,e.oldParentIndex=Zt(r.children,t),tn(i.children,t,o),t.parent=i,z(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},lh.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return Zt(n.children,t),tn(i.children,t,o),t.parent=i,z(t.waypoints,function(a){a.x-=r.x,a.y-=r.y,a.original&&(a.original.x-=r.x,a.original.y-=r.y)}),t};function uh(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}uh.prototype.add=function(e,t){return this.addAll([e],t)},uh.prototype.addAll=function(e,t){var n=WA(e,!!t,this);return V(this,n),this};function Vs(e){this._modeling=e}Vs.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Vs.prototype.moveClosure=function(e,t,n,i,o){var r=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;o&&o.parent===n&&(u=!0),z(a,function(p){r.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),z(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?r.moveConnection(p,t,l[p.id]&&!u&&n):r.layoutConnection(p,{connectionStart:f&&yd(p,p.source,t),connectionEnd:d&&vd(p,p.target,t)})})},Vs.prototype.getClosure=function(e){return new uh().addAll(e,!0)};function cu(e){this._helper=new Vs(e)}cu.$inject=["modeling"],cu.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},cu.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 Nr(e){this._modeling=e,this._helper=new Vs(e)}Nr.$inject=["modeling"],Nr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,o=e.newParentIndex,r=t.parent;return e.oldBounds=Ii(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=Zt(r.children,t),tn(i.children,t,o),V(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Nr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(z(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:vd(r,t,n)})}),z(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:yd(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Nr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return tn(n.children,t,i),V(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},Nr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Nr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Ws(e){this._modeling=e}Ws.$inject=["modeling"],Ws.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 We(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},Ws.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||a_(We(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||a_(We(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},Ws.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 a_(e){return e.original||e}function Ro(e,t){this._modeling=e,this._rules=t}Ro.$inject=["modeling","rules"],Ro.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,o=e.oldShape,r=e.newData,a=e.hints||{},s;function c(g,h,m){return i.allowed("connection.reconnect",{connection:m,source:g,target:h})}var l={x:r.x,y:r.y},u={x:o.x,y:o.y,width:o.width,height:o.height};s=e.newShape=e.newShape||t.createShape(r,l,o.parent,a),o.host&&n.updateAttachment(s,o.host);var p;a.moveChildren!==!1&&(p=o.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=o.incoming.slice(),d=o.outgoing.slice();z(f,function(g){var h=g.source,m=c(h,s,g);m&&t.reconnectEnd(g,s,Il(g,s,u),a)}),z(d,function(g){var h=g.target,m=c(s,h,g);m&&t.reconnectStart(g,s,Ll(g,s,u),a)})},Ro.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Ro.prototype.execute=function(e){},Ro.prototype.revert=function(e){},Ro.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Ro.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Ro.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Us(e){this._modeling=e}Us.$inject=["modeling"],Us.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},V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Us.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(z(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:Il(r,n,i)})}),z(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:Ll(r,n,i)})}))},Us.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function ar(e){this._modeling=e}ar.$inject=["modeling"],ar.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,o=e.resizingShapes,r=e.start,a={};this.moveShapes(i,t),z(o,function(s){a[s.id]=yD(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(VO(i,o),t,n,r,i,o,a)},ar.prototype.execute=function(){},ar.prototype.revert=function(){},ar.prototype.moveShapes=function(e,t){var n=this;z(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},ar.prototype.resizeShapes=function(e,t,n){var i=this;z(e,function(o){var r=WO(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},ar.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);z(e,function(u){var p=u.source,f=u.target,d=mD(u),g=c_(n),h={},m=c.has(p)||l.has(p),_=c.has(f)||l.has(f);m&&_?(d=Nn(d,function(x){return l_(x,i,n)&&(x[g]=x[g]+t[g]),x.original&&l_(x.original,i,n)&&(x.original[g]=x.original[g]+t[g]),x}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(m||_)&&(c.has(p)?h.connectionStart=yd(u,p,t):c.has(f)?h.connectionEnd=vd(u,f,t):l.has(p)?h.connectionStart=Ll(u,p,a[p.id]):l.has(f)&&(h.connectionEnd=Il(u,f,a[f.id])),s._modeling.layoutConnection(u,h))})};function s_(e){return V({},e)}function mD(e){return Nn(e.waypoints,function(t){return t=s_(t),t.original&&(t.original=s_(t.original)),t})}function c_(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function l_(e,t,n){var i=c_(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function yD(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function lu(e){this._modeling=e}lu.$inject=["modeling"],lu.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=u_(n),t.collapsed=!t.collapsed;var i=p_(n,t.collapsed);return[t].concat(i)},lu.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=f_(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function u_(e){var t={};return z(e,function(n){t[n.id]=n.hidden,n.children&&(t=V({},t,u_(n.children)))}),t}function p_(e,t){var n=[];return z(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(p_(i.children,i.collapsed||t)))}),n}function f_(e,t){var n=[];return z(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(f_(i.children,t)))}),n}function uu(e){this._modeling=e}uu.$inject=["modeling"],uu.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=d_(i,t),h_(n,t),t.host=n,t},uu.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,d_(n,t),h_(i,t,o),t};function d_(e,t){return Zt(e&&e.attachers,t)}function h_(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),tn(i,t,n)}}function ph(){}ph.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},ph.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Ot(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Ot.$inject=["eventBus","elementFactory","commandStack"],Ot.prototype.getHandlers=function(){return{"shape.append":iu,"shape.create":rr,"shape.delete":Gs,"shape.move":Nr,"shape.resize":Us,"shape.replace":Ro,"shape.toggleCollapse":lu,spaceTool:ar,"label.create":Hs,"connection.create":ou,"connection.delete":zs,"connection.move":lh,"connection.layout":su,"connection.updateWaypoints":ph,"connection.reconnect":Ws,"elements.create":sh,"elements.move":cu,"elements.delete":ch,"elements.distribute":au,"elements.align":nu,"element.updateAttachment":uu}},Ot.prototype.registerHandlers=function(e){z(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Ot.prototype.moveShape=function(e,t,n,i,o){typeof i=="object"&&(o=i,i=null);var r={shape:e,delta:t,newParent:n,newParentIndex:i,hints:o||{}};this._commandStack.execute("shape.move",r)},Ot.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Ot.prototype.moveElements=function(e,t,n,i){i=i||{};var o=i.attach,r=n,a;o===!0?(a=n,r=n.parent):o===!1&&(a=null);var s={shapes:e,delta:t,newParent:r,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},Ot.prototype.moveConnection=function(e,t,n,i,o){typeof i=="object"&&(o=i,i=void 0);var r={connection:e,delta:t,newParent:n,newParentIndex:i,hints:o||{}};this._commandStack.execute("connection.move",r)},Ot.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Ot.prototype.createConnection=function(e,t,n,i,o,r){typeof n=="object"&&(r=o,o=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:o,parentIndex:n,connection:i,hints:r};return this._commandStack.execute("connection.create",a),a.connection},Ot.prototype.createShape=function(e,t,n,i,o){typeof i!="number"&&(o=i,i=void 0),o=o||{};var r=o.attach,a,s;e=this._create("shape",e),r?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:o};return this._commandStack.execute("shape.create",c),c.shape},Ot.prototype.createElements=function(e,t,n,i,o){We(e)||(e=[e]),typeof i!="number"&&(o=i,i=void 0),o=o||{};var r={position:t,elements:e,parent:n,parentIndex:i,hints:o};return this._commandStack.execute("elements.create",r),r.elements},Ot.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var o={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",o),o.shape},Ot.prototype.appendShape=function(e,t,n,i,o){o=o||{},t=this._create("shape",t);var r={source:e,position:n,target:i,shape:t,connection:o.connection,connectionParent:o.connectionParent,hints:o};return this._commandStack.execute("shape.append",r),r.shape},Ot.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Ot.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Ot.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Ot.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Ot.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Ot.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Ot.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},Ot.prototype.createSpace=function(e,t,n,i,o){var r={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:o};this._commandStack.execute("spaceTool",r)},Ot.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Ot.prototype.reconnect=function(e,t,n,i,o){var r={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:o||{}};this._commandStack.execute("connection.reconnect",r)},Ot.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,V(i,{docking:"source"}))},Ot.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,V(i,{docking:"target"}))},Ot.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Ot.prototype._create=function(e,t){return TP(t)?t:this._elementFactory.create(e,t)},Ot.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function qs(e){this._elementRegistry=e}qs.$inject=["elementRegistry"],qs.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||vD(n,Mc(i));return g_(n,i),e.oldProperties=r,e.changed=o,o},qs.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return g_(n,t),i},qs.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return M(e,"bpmn:DataObject")?bD(e,t):[]};function vD(e,t){return ti(t,function(n,i){return n[i]=e.get(i),n},{})}function g_(e,t){z(t,function(n,i){e.set(i,n)})}function bD(e,t){return t.filter(function(n){return M(n,"bpmn:DataObjectReference")&&ge(n).dataObjectRef===e})}var Ys="default",Co="id",m_="di",xD={width:0,height:0};function Ks(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Ks.$inject=["elementRegistry","moddle","modeling","textRenderer"],Ks.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=RD(e.properties),s=e.oldProperties||_D(t,a);return y_(a,r)&&(o.unclaim(r[Co]),i.updateId(t,a[Co]),o.claim(a[Co],r)),Ys in a&&(a[Ys]&&n.push(i.get(a[Ys].id)),r[Ys]&&n.push(i.get(r[Ys].id))),v_(t,a),e.oldProperties=s,e.changed=n,n},Ks.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ge(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,xD)}},Ks.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 v_(t,i),y_(n,o)&&(a.unclaim(n[Co]),r.updateId(t,i[Co]),a.claim(i[Co],o)),e.changed};function y_(e,t){return Co in e&&e[Co]!==t[Co]}function _D(e,t){var n=Mc(t),i=e.businessObject,o=dt(e);return ti(n,function(r,a){return a!==m_?r[a]=i.get(a):r[a]=wD(o,Mc(t.di)),r},{})}function wD(e,t){return ti(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function v_(e,t){var n=e.businessObject,i=dt(e);z(t,function(o,r){r!==m_?n.set(r,o):i&&ED(i,o)})}function ED(e,t){z(t,function(n,i){e.set(i,n)})}var SD=["default"];function RD(e){var t=V({},e);return SD.forEach(function(n){n in e&&(t[n]=ge(t[n]))}),t}function pu(e,t){this._canvas=e,this._modeling=t}pu.$inject=["canvas","modeling"],pu.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=t.getRootElement(),r=o.businessObject,a=r.$parent,s=dt(o);return t.setRootElement(n),t.removeRootElement(o),tn(a.rootElements,i),i.$parent=a,Zt(a.rootElements,r),r.$parent=null,o.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=o,[]},pu.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=e.oldRoot,r=o.businessObject,a=i.$parent,s=dt(n);return t.setRootElement(o),t.removeRootElement(n),Zt(a.rootElements,i),i.$parent=null,tn(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function fh(e,t){this._modeling=e,this._spaceTool=t}fh.$inject=["modeling","spaceTool"],fh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,o=e.location,r=Ei(i),a=r===i,s=a?i:i.parent,c=Qo(s),l=xn(i);if(l?o==="left"?o="top":o==="right"&&(o="bottom"):o==="top"?o="left":o==="bottom"&&(o="right"),!c.length){var u=l?{x:i.x+wi,y:i.y,width:i.width-wi,height:i.height}:{x:i.x,y:i.y+wi,width:i.width,height:i.height-wi};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];Pr(r,function(v){return p.push(v),v.label&&p.push(v.label),v===i?[]:rt(v.children,function(E){return E!==i})});var f,d,g,h,m;o==="top"?(f=-120,d=i.y,g=d+10,h="n",m="y"):o==="left"?(f=-120,d=i.x,g=d+10,h="w",m="x"):o==="bottom"?(f=120,d=i.y+i.height,g=d-10,h="s",m="y"):o==="right"&&(f=120,d=i.x+i.width,g=d-10,h="e",m="x");var _=t.calculateAdjustments(p,m,f,g),x=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(_.movingShapes,_.resizingShapes,x,h,g);var y=l?{x:i.x+(a?wi:0),y:d-(o==="top"?120:0),width:i.width-(a?wi:0),height:120}:{x:d-(o==="left"?120:0),y:i.y+(a?wi:0),width:120,height:i.height-(a?wi:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},y,s)};function dh(e){this._modeling=e}dh.$inject=["modeling"],dh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=Qo(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=xn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,f;for(f=0;f<i;f++)f===i-1?l=s-c*f:l=c,u=a?{x:n.x+wi,y:n.y+f*c,width:n.width-wi,height:l}:{x:n.x+f*c,y:n.y+wi,width:l,height:n.height-wi},f<r?t.resizeShape(o[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function Xs(e,t){this._modeling=e,this._spaceTool=t}Xs.$inject=["modeling","spaceTool"],Xs.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Xs.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=bk(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},Xs.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=He(e),o=He(t),r=Xv(o,i),a=Ei(e),s=[],c=[];Pr(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 Zs="flowNodeRef",hh="lanes";function fu(){}fu.prototype._computeUpdates=function(e,t){var n=[],i=[],o={},r=[];function a(u,p){var f=He(p),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(u){n.indexOf(u)===-1&&(r.push(u),n.push(u))}function c(u){var p=Ei(u);return o[p.id]||(o[p.id]=Pl(p)),o[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(f){return a(u,f)}).map(function(f){return f.businessObject})}return t.forEach(function(u){var p=Ei(u);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return M(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),r.forEach(function(u){var p=u.businessObject,f=p.get(hh),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(Zs).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},fu.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(hh);n.remove.forEach(function(r){Zt(o,r),Zt(r.get(Zs),i)}),n.add.forEach(function(r){tn(o,r),tn(r.get(Zs),i)})}),[]},fu.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get(hh);n.add.forEach(function(r){Zt(o,r),Zt(r.get(Zs),i)}),n.remove.forEach(function(r){tn(o,r),tn(r.get(Zs),i)})}),[]};var gh="categoryValueRef";function Qs(e,t){this._bpmnFactory=e,this._elementRegistry=t}Qs.$inject=["bpmnFactory","elementRegistry"],Qs.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(x,y,v){if(y){var E=a.get(x);E||(E={},a.set(x,E)),!(v&&E.present)&&(!v&&E.past||(v?E.present={categoryValue:y,root:mh(x)}:E.past={categoryValue:y}))}}function c(x){o.set(x,ge(x))}function l(){n.filter(function(x){return M(x,"bpmn:FlowElement")&&!it(x)&&x.parent}).forEach(c)}function u(x){var y=ge(x),v=y.get("categoryValueRef");return v||(v=Wv(i,y),r.push(CD(x,v))),v}function p(x){return x.reduce(function(y,v){var E=mh(v),w=y.get(E);return w||(w=[],y.set(E,w)),w.push(v),y},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(x){return M(x,"bpmn:Group")&&!it(x)&&x.parent}).forEach(function(x){var y=ge(x).get("categoryValueRef");if(!y){var v=mh(x),E=f.get(v)||[],w=ga(E,x),T=Object.keys(w).length>0;T&&(y=u(x))}s(x,y,!0)}),t.forEach(function(x){s(x.groupShape,x.categoryValue,!1)}),r.length&&l();var d=Array.from(o.keys()),g=Array.from(a.values()).reduce(function(x,y){return y.present&&x.add(y.present.categoryValue),y.past&&x.add(y.past.categoryValue),x},new Set),h=new Map,m=p(d);a.forEach(function(x,y){var v=x.present;if(v){var E=m.get(v.root)||[],w=ga(E,y);E.forEach(function(T){if(w[T.id]){var P=h.get(T);P||(P=new Set,h.set(T,P)),P.add(v.categoryValue)}})}});var _=d.reduce(function(x,y){var v=o.get(y),E=v.get(gh),w=new Set(E),T=h.get(y)||new Set,P=Array.from(T).filter(function(B){return!w.has(B)}),O=E.filter(function(B){return g.has(B)&&!T.has(B)});return(P.length||O.length)&&x.push({businessObject:v,categoryValuesToAdd:P,categoryValuesToRemove:O}),x},[]);return{flowElements:_,groups:r}},Qs.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),MD(t.groups),PD(t.flowElements),[]},Qs.prototype.revert=function(e){var t=e.updates;return TD(t.flowElements),AD(t.groups),[]};function CD(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function MD(e){e.forEach(function(t){ge(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function AD(e){e.forEach(function(t){ge(t.groupShape).categoryValueRef=null})}function PD(e){e.forEach(function(t){var n=t.businessObject,i=n.get(gh);t.categoryValuesToRemove.forEach(function(o){Zt(i,o)}),t.categoryValuesToAdd.forEach(function(o){tn(i,o,!0)})})}function TD(e){e.forEach(function(t){var n=t.businessObject,i=n.get(gh);t.categoryValuesToAdd.forEach(function(o){Zt(i,o)}),t.categoryValuesToRemove.forEach(function(o){tn(i,o,!0)})})}function mh(e){for(;e.parent;)e=e.parent;return e}function du(e){this._moddle=e}du.$inject=["moddle"],du.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),[]},du.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 kD={fill:void 0,stroke:void 0};function yh(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Jn(t)){var n=OD(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}yh.$inject=["commandStack"],yh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||kD,i=this,o={};"fill"in n&&V(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&V(o,{"border-color":this._normalizeColor(n.stroke)}),z(t,function(r){var a=kt(r)?Ii(o,["border-color"]):o,s=dt(r);if(DD(a),it(r)){if(!s||!M(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:r,moddleElement:s.label,properties:{color:o["border-color"]}})}else{if(!ot(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function OD(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 DD(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var LD={width:0,height:0};function b_(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return cT(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!it(l)&&Xo(l)&&!ml(l)&&!x_(p)){var f=7,d=Hf(l);d={x:d.x,y:d.y+f},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function r(c){return c.oldLabel=yi(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!it(u)&&!M(u,"bpmn:TextAnnotation"))){if(it(u)&&x_(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var g=yi(l);typeof f>"u"&&(f=t.getExternalLabelBounds(u,g)),f&&e.resizeShape(u,f,LD)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}b_.$inject=["modeling","textRenderer","bpmnFactory"];function x_(e){return!e||!e.trim()}function In(e,t,n,i){Ot.call(this,e,t,n),this._bpmnRules=i}Me(In,Ot),In.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],In.prototype.getHandlers=function(){var e=Ot.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=qs,e["element.updateProperties"]=Ks,e["canvas.updateRoot"]=pu,e["lane.add"]=fh,e["lane.resize"]=Xs,e["lane.split"]=dh,e["lane.updateRefs"]=fu,e["group.updateRefs"]=Qs,e["id.updateClaim"]=du,e["element.setColor"]=yh,e["element.updateLabel"]=b_,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 __(){}__.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||qe(t.source||e.source),t.connectionEnd||qe(t.target||e.target)]};var hu=20,ID=5,gu=Math.round,w_=20,BD={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function ND(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function $D(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function E_(e,t,n){var i=On(t,e,ID),o=n.split(":")[0],r=gu((t.x-e.x)/2+e.x),a=gu((t.y-e.y)/2+e.y),s,c,l=$D(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=ND(i,o),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+hu*(/l/.test(o)?-1:1),y:f?a+hu:a}):(f=r===e.x,s={x:f?r+hu:r,y:e.y+hu*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:vh(e,s,c).concat(s),directions:c,turnNextDirections:f}}function FD(e,t,n){return E_(e,t,n)}function jD(e,t,n){var i=E_(t,e,S_(n));return{waypoints:i.waypoints.slice().reverse(),directions:S_(i.directions),turnNextDirections:i.turnNextDirections}}function HD(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=vh(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function S_(e){return e.split(":").reverse().join(":")}function zD(e,t,n){var i=gu((t.x-e.x)/2+e.x),o=gu((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 vh(e,t,n){if(n=n||"h:h",!ZD(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(C_(n)){var i=FD(e,t,n),o=jD(e,t,n),r=HD(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return zD(e,t,n)}function GD(e,t,n){var i=vh(e,t,n);return i.unshift(e),i.push(t),A_(i)}function VD(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=oS(r,"straight")[0]||"h:h",s=BD[a]||0,c=On(e,t,s),l=XD(c,a);n=n||qe(e),i=i||qe(t);var u=l.split(":"),p=M_(n,e,u[0],QD(c)),f=M_(i,t,u[1],c);return GD(p,f,l)}function WD(e,t,n,i,o,r){We(n)&&(o=n,r=i,n=qe(e),i=qe(t)),r=V({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&qD(e,t,n,i,r),c||(c=r.connectionEnd&&KD(t,e,i,o),c)||(c=r.connectionStart&&YD(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:VD(e,t,n,i,r)}function UD(e,t,n){return e>=t&&e<=n}function R_(e,t,n){var i={x:"width",y:"height"};return UD(t[e],n[e],n[e]+n[i[e]])}function qD(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"?R_(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:R_(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 YD(e,t,n,i){return bh(e,t,n,i)}function KD(e,t,n,i){var o=i.slice().reverse();return o=bh(e,t,n,o),o?o.reverse():null}function bh(e,t,n,i){function o(u){return u.length<3?!0:u.length>4?!1:!!Lt(u,function(p,f){var d=u[f-1];return d&&ws(p,d)<3})}function r(u,p,f){var d=yo(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(Zy(u[d],p,w_)||Zy(u[d],f,w_))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=bh(e,t,n,l)),c&&yo(c)?null:c}function XD(e,t){if(C_(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 ZD(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function C_(e){return e&&/t|r|b|l/.test(e)}function QD(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 M_(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 A_(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return Bf(o,r,n,0)||t.push(n),t},[])}var JD=-10,eL=40,tL={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},nL={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},xh={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Js={top:"t",right:"r",bottom:"b",left:"l"};function mu(e){this._elementRegistry=e}Me(mu,__),mu.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=P_(o&&o[0],n)),a||(a=P_(o&&o[o.length-1],i)),(M(e,"bpmn:Association")||M(e,"bpmn:DataAssociation"))&&o&&!T_(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=Hv(n,s)?tL:nL;return M(e,"bpmn:MessageFlow")?c=oL(n,i,u):(M(e,"bpmn:SequenceFlow")||T_(n,i))&&(n===i?c={preferredLayouts:uL(n,e,u)}:M(n,"bpmn:BoundaryEvent")?c={preferredLayouts:pL(n,i,a,u)}:ec(n)||ec(i)?c={preferredLayouts:u.subProcess,preserveDocking:aL(n)}:M(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:M(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=V(c,t),l=A_(WD(n,i,r,a,o,c))),l||[r,a]};function iL(e){var t=e.host;return On(qe(e),t,JD)}function oL(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:rL(e,t)}}function rL(e,t){return M(t,"bpmn:Participant")?"source":M(e,"bpmn:Participant")?"target":ec(t)?"source":ec(e)||M(t,"bpmn:Event")?"target":M(e,"bpmn:Event")?"source":null}function aL(e){return ec(e)?"target":"source"}function P_(e,t){return e?e.original||e:qe(t)}function T_(e,t){return M(t,"bpmn:Activity")&&M(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function ec(e){return M(e,"bpmn:SubProcess")&&ut(e)}function $r(e,t){return e===t}function sL(e,t){return t.indexOf(e)!==-1}function Da(e){var t=/right|left/.exec(e);return t&&t[0]}function La(e){var t=/top|bottom/.exec(e);return t&&t[0]}function k_(e,t){return xh[e]===t}function cL(e,t){var n=Da(e),i=xh[n];return t.indexOf(i)!==-1}function lL(e,t){var n=La(e),i=xh[n];return t.indexOf(i)!==-1}function O_(e){return e==="right"||e==="left"}function uL(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 pL(e,t,n,i){var o=qe(e),r=qe(t),a=iL(e),s,c,l=$r(e.host,t),u=sL(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=dL(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?La(e):Da(e),s=Js[a],c;return t?O_(e)?c=D_("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=D_("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function D_(e,t,n,i){var o=eL;return!(_h(e,i,n,o)||_h(e,i,{x:n.x+n.width,y:n.y+n.height},o)||_h(e,i,qe(t),o))}function _h(e,t,n,i){return Math.abs(t[e]-n[e])<i}function dL(e,t,n,i){if(n)return Js[e];var o=La(e),r=Da(e),a=La(t),s=Da(t);if(i){if($r(o,a)||k_(r,s))return Js[o]}else if($r(r,s)||k_(o,a))return Js[r];return Js[i?r:o]}function hL(e,t,n,i){if(n)return O_(e)?cL(e,t)||$r(e,t)?"h":"v":lL(e,t)||$r(e,t)?"v":"h";var o=La(e),r=Da(e),a=La(t),s=Da(t);return a&&!s?"v":s&&!a?"h":i?$r(o,a)?"h":"v":$r(r,s)?"v":"h"}mu.$inject=["elementRegistry"];function L_(e){return V({original:e.point.original||e.point},e.actual)}function sr(e,t){this._elementRegistry=e,this._graphicsFactory=t}sr.$inject=["elementRegistry","graphicsFactory"],sr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),o=this.getDockingPoint(e,n),r=e.waypoints.slice(i.idx+1,o.idx);return r.unshift(L_(i)),r.push(L_(o)),r},sr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,o,r,a;return o=n?0:i.length-1,r=i[o],a=this._getIntersection(t,e,n),{point:r,actual:a||r,idx:o}},sr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return Es(i,o,n)},sr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},sr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},sr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const wh={__init__:["modeling","bpmnUpdater"],__depends__:[D2,K2,Z2,Q2,Ux,JO,tD,sD,Ri,rh,Qx],bpmnFactory:["type",Mi],bpmnUpdater:["type",si],elementFactory:["type",or],modeling:["type",In],layouter:["type",mu],connectionDocking:["type",sr]};var gL=10,I_=50,mL=250;function Eh(e,t,n,i){for(var o;o=yL(e,n,t);)n=i(t,n,o);return n}function Sh(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 yL(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=bL(e);return Lt(o,function(r){if(r===n)return!1;var a=On(r,i,gL);return a==="intersect"})}function vL(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||I_,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||mL,c=t.reference||"start";r||(r=wL);function l(g,h){return o==="n"?c==="start"?He(g).top-He(h).bottom:c==="center"?He(g).top-qe(h).y:He(g).top-He(h).top:o==="w"?c==="start"?He(g).left-He(h).right:c==="center"?He(g).left-qe(h).x:He(g).left-He(h).left:o==="s"?c==="start"?He(h).top-He(g).bottom:c==="center"?qe(h).y-He(g).bottom:He(h).bottom-He(g).bottom:c==="start"?He(h).left-He(g).right:c==="center"?qe(h).x-He(g).right:He(h).right-He(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=ti(f,function(g,h){var m=h.distance,_=h.weight;return m<0||m>s||(g[String(m)]||(g[String(m)]=0),g[String(m)]+=1*_,(!g.distance||g[g.distance]<g[String(m)])&&(g.distance=m)),g},{});return d.distance||i}function bL(e){var t=Rh(e);return e.host&&(t=t.concat(Rh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Rh(i))},[]))),t}function Rh(e){return _L(e).concat(xL(e))}function xL(e){return e.incoming.map(function(t){return t.source})}function _L(e){return e.outgoing.map(function(t){return t.target})}function wL(){return!0}var EL=100;function B_(e,t,n){e.on("autoPlace",EL,function(i){var o=i.shape,r=i.source;return SL(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}}B_.$inject=["eventBus","modeling","canvas"];function SL(e,t,n){n||(n={});var i=n.defaultDistance||I_,o=qe(e),r=He(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 RL={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",B_],autoPlaceSelectionBehavior:["type",N_]};function $_(e,t,n){var i=Hv(e,n);if(M(t,"bpmn:TextAnnotation"))return ML(e,t,i);if(ot(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return AL(e,t,i);if(M(t,"bpmn:FlowNode"))return CL(e,t,i)}function CL(e,t,n){var i=He(e),o=qe(e),r=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=vL(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+F_(l,c,r)}:{x:o.x+F_(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Eh(e,t,u,Sh(f))}function F_(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function ML(e,t,n){var i=He(e),o=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};kt(e)&&(o=qe(e),n?(o.x+=100,o.y-=50):(o.x+=100,o.y+=50));var r={margin:n?-30:30,minDistance:20},a=n?{y:r}:{x:r};return Eh(e,t,o,Sh(a))}function AL(e,t,n){var i=He(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 Eh(e,t,o,Sh(a))}function j_(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return $_(o,i,t)})}j_.$inject=["eventBus","elementRegistry"];const yu={__depends__:[RL],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",j_]},PL=1500;class H_{constructor(t){t.on("moddleCopy.canCopyProperties",PL,({sourceElement:n,targetElement:i})=>{var r;if(!((r=n==null?void 0:n.$instanceOf)!=null&&r.call(n,_r)))return;const o=En(n);o!==void 0&&i.set("xml:lang",o)})}}zn(H_,"$inject",["eventBus"]);const z_={__init__:["translationLocaleCopy"],translationLocaleCopy:["type",H_]},G_=[Fv,Ps,wh,yu,Op,z_];function TL(e={}){am(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new va({container:t,moddleExtensions:e.moddleExtensions??Ic,additionalModules:[...G_,...e.additionalModules??[]]})}const V_={"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":"풀"},kL={이:["이","가"],을:["을","를"],와:["과","와"]};function OL(e,t){const[n,i]=kL[t],o=e.at(-1)??"",r=o.charCodeAt(0);return r>=44032&&r<=55203?e+((r-44032)%28===0?i:n):o>="0"&&o<="9"?e+("013678".includes(o)?n:i):e+`${n}(${i})`}const DL={"bpmn:StartEvent":"시작 이벤트","bpmn:EndEvent":"종료 이벤트","bpmn:IntermediateCatchEvent":"중간 이벤트","bpmn:IntermediateThrowEvent":"중간 이벤트","bpmn:BoundaryEvent":"경계 이벤트","bpmn:Task":"작업","bpmn:UserTask":"작업","bpmn:ServiceTask":"작업","bpmn:SendTask":"작업","bpmn:ReceiveTask":"작업","bpmn:ManualTask":"작업","bpmn:ScriptTask":"작업","bpmn:BusinessRuleTask":"작업","bpmn:CallActivity":"작업","bpmn:SubProcess":"서브프로세스","bpmn:ExclusiveGateway":"게이트웨이","bpmn:ParallelGateway":"게이트웨이","bpmn:InclusiveGateway":"게이트웨이","bpmn:EventBasedGateway":"게이트웨이","bpmn:ComplexGateway":"게이트웨이","bpmn:Participant":"풀","bpmn:Lane":"레인","bpmn:TextAnnotation":"주석","bpmn:Group":"그룹","bpmn:DataStoreReference":"데이터 저장소","bpmn:DataObjectReference":"데이터 객체","bpmn:SequenceFlow":"연결선","bpmn:MessageFlow":"메시지 연결선","bpmn:Association":"연관선"},LL="요소";function Ch(e){return(e&&DL[e.type])??LL}const W_=20;function IL(e){const t=e.replace(/\s+/g," ").trim();return t.length>W_?`${t.slice(0,W_)}…`:t}function vu(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:IL(o.name),a=r===void 0?i+Ch(o):r,s=r===void 0?a:`「${r}」`;return n?s+OL(a,n).slice(a.length):s}function BL(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&&Ch(r)===Ch(a);return[vu(e,t,i),vu(e,n,o,s?"다른 ":"")]}function NL(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 $L(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 bu={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function FL(e,t){const n=(o,r)=>vu(t,o,r),i=(o,r,a,s)=>BL(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)}의 ${bu[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)}의 ${bu[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${bu[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${bu[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 jL(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${vu(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const U_="기타",Mh={error:0,warning:1,info:2};function q_(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${ct(i)}`,source:"geometry",code:i.kind,severity:NL(i),targetRefs:$L(i),category:V_[i.kind]??U_,message:FL(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:V_[i.ruleId]??U_,message:jL(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 Ia(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function Ah(e,t){if(t===void 0||e.length===0)return!1;const n=Ia(e[0],t);return e.some(i=>Ia(i,t)!==n)}function K_(e,t){const n=Ah(e,t);return e.slice().sort((i,o)=>(n?Number(Ia(o,t))-Number(Ia(i,t)):0)||Mh[i.severity]-Mh[o.severity])}const X_="i18n-untranslated",Z_="i18n-review-requested",Ph="i18nDisplay.redrawn",Q_=[["untranslated",X_],["reviewRequested",Z_]];class Th{constructor(t,n,i,o,r,a,s,c){zn(this,"config");zn(this,"displayLocale");this.eventBus=t,this.elementRegistry=n,this.canvas=a,this.textRenderer=s,this.graphicsFactory=c;const l=o.drawShape.bind(o);o.drawShape=(f,d,g)=>this.withDisplayText(d,()=>l(f,d,g),f);const u=r.activate.bind(r);r.activate=f=>this.withDisplayText(f,()=>u(f));const p=r.update.bind(r);r.update=(f,d,g,h)=>{const m=this.resolve(f);if(!m||m.native)return p(f,d,g,h);(d??"").trim()!==(g??"").trim()&&i.execute(Pc,{element:f.labelTarget??f,locale:this.displayLocale,text:d,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",f=>{if(!this.config)return;const{element:d,newLabel:g,oldLabel:h}=f.context;(g??"")!==(h??"")&&i.execute(Pc,{element:d.labelTarget??d,locale:this.displayLocale,text:g??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:h??""})})}configure(t){!t&&!this.config||(this.config=t,this.displayLocale=t==null?void 0:t.designLocale,this.rerenderAll())}locales(){if(!this.config)return[];const{designLocale:t,companionLocales:n}=this.config;return[t,...n.filter(i=>i!==t)]}setDisplayLocale(t){if(this.config)return this.displayLocale=this.locales().includes(t)?t:this.config.designLocale,this.rerenderAll(),this.displayLocale}getDisplayLocale(){return this.displayLocale}rootLang(){var i,o,r;const t=(i=this.canvas.getRootElement())==null?void 0:i.businessObject,n=(t==null?void 0:t.$parent)??t;return((o=n==null?void 0:n.get)==null?void 0:o.call(n,"xml:lang"))??((r=n==null?void 0:n.$attrs)==null?void 0:r["xml:lang"])}resolve(t){if(!this.config||!this.displayLocale)return;const n=(t.labelTarget??t).businessObject,i=wr(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=Bo(n).filter(f=>En(f)),s=f=>f.body??"",c=a.find(f=>En(f)===o&&s(f)),l=No(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(En);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 Q_)r.toggle(g,(o==null?void 0:o.status)===d);if(!o||o.native)return n();const{target:a,key:s}=wr((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 Q_)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(Ph)}}zn(Th,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const J_={__depends__:[Op],__init__:["i18nDisplay"],i18nDisplay:["type",Th]};var HL=new Ir("ov"),zL=500;function Rn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=HL,this._overlayDefaults=V({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=GL(n.getContainer()),this._init()}Rn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Rn.prototype.get=function(e){if(Jn(e)&&(e={id:e}),Jn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?rt(t.overlays,ia({type:e.type})):t.overlays.slice():[]}else return e.type?rt(this._overlays,ia({type:e.type})):e.id?this._overlays[e.id]:null},Rn.prototype.add=function(e,t,n){if(hn(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=V({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Rn.prototype.remove=function(e){var t=this.get(e)||[];We(t)||(t=[t]);var n=this;z(t,function(i){var o=n._getOverlayContainer(i.element,!0);if(i&&(Xi(i.html),Xi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),o){var r=o.overlays.indexOf(i);r!==-1&&o.overlays.splice(r,1)}})},Rn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Rn.prototype.show=function(){xu(this._overlayRoot)},Rn.prototype.hide=function(){xu(this._overlayRoot,!1)},Rn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],il(this._overlayRoot)},Rn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=an(t);i=r.x,o=r.y}ew(n,i,o),Sn(e.html,"data-container-id",t.id)},Rn.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,o=t.left,r=t.top;if(t.right!==void 0){var a;i.waypoints?a=an(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=an(i).height:s=i.height,r=t.bottom*-1+s}ew(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Rn.prototype._createOverlayContainer=function(e){var t=$t('<div class="djs-overlays" />');Wn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Rn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";tw(this._overlayRoot,n)},Rn.prototype._getOverlayContainer=function(e,t){var n=Lt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Rn.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)),Jn(i)&&(i=$t(i)),r=this._getOverlayContainer(n),o=$t('<div class="djs-overlay" data-overlay-id="'+t+'">'),Wn(o,{position:"absolute"}),o.appendChild(i),e.type&&Rt(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();xu(o,a===s),e.htmlContainer=o,r.overlays.push(e),r.html.appendChild(o),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Rn.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),o=n&&n.minZoom,r=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(dn(o)&&o>t.scale||dn(r)&&r<t.scale))&&(c=!1),xu(a,c),this._updateOverlayScale(e,t)},Rn.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,o,r=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,o=1):(i=n.min,o=n.max),dn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),dn(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),dn(a)&&(s="scale("+a+","+a+")"),tw(r,s)},Rn.prototype._updateOverlaysVisibilty=function(e){var t=this;z(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Rn.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var o=i.element,r=t.get({element:o});z(r,function(c){t.remove(c.id)});var a=t._getOverlayContainer(o);if(a){Xi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",zL,function(i){var o=i.element,r=t._getOverlayContainer(o,!0);r&&(z(r.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(r))}),e.on("element.marker.update",function(i){var o=t._getOverlayContainer(i.element,!0);o&&Rt(o.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function GL(e){var t=$t('<div class="djs-overlay-container" />');return Wn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function ew(e,t,n){Wn(e,{left:t+"px",top:n+"px"})}function xu(e,t){e.style.display=t===!1?"none":""}function tw(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const _u={__init__:["overlays"],overlays:["type",Rn]};function kh(e,t){t.invoke(de,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}Me(kh,de),kh.$inject=["canvas","injector"];const VL={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",kh]};function Fr(e){return CSS.escape(e)}var WL={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function nw(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return WL[t]})}var UL="bjs-breadcrumbs-shown";function iw(e,t,n){var i=$t('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=Rt(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=ge(l),p=Lt(a,function(f){return f===u});p&&s()});function s(c){c&&(a=qL(c));var l=a.flatMap(function(p){var f=n.findRoot(to(p))||n.findRoot(p.id);if(!f&&M(p,"bpmn:Process")){var d=t.find(function(m){var _=ge(m);return _&&_.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=nw(p.name||p.id),h=$t('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var u=l.length>1;r.toggle(UL,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}iw.$inject=["eventBus","elementRegistry","canvas"];function qL(e){for(var t=ge(e),n=[],i=t;i;i=i.$parent)(M(i,"bpmn:SubProcess")||M(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function ow(e,t){var n=null,i=new YL;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})}ow.$inject=["eventBus","canvas"];function YL(){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 rw={x:180,y:160};function jr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}jr.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)})}},jr.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),XL(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},jr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=KL(e),i={x:n.x-rw.x,y:n.y-rw.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)})},jr.prototype._moveToDiPlane=function(e,t){var n=aw(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},jr.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},jr.$inject=["eventBus","moddle"];function aw(e){return M(e,"bpmndi:BPMNDiagram")?e:aw(e.$parent)}function KL(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=He(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),ul(t)}function XL(e,t){var n=e.$parent;return!(!M(n,"bpmn:SubProcess")||n===t.bpmnElement||ot(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var wu=250,ZL='<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>',QL="bjs-drilldown-empty";function cr(e,t,n,i,o){de.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=o;var r=this;this.executed("shape.toggleCollapse",wu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",wu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],wu,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;r._canDrillDown(l)&&r._addOverlay(l),r._updateDrilldownOverlay(s),r._updateDrilldownOverlay(c),r._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],wu,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;r._canDrillDown(l)&&r._addOverlay(l),r._updateDrilldownOverlay(s),r._updateDrilldownOverlay(c),r._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return r._canDrillDown(a)}).map(function(a){r._addOverlay(a)})})}Me(cr,de),cr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},cr.prototype._canDrillDown=function(e){var t=this._canvas;return M(e,"bpmn:SubProcess")&&t.findRoot(to(e))},cr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ge(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;Rt(i.html).toggle(QL,!o)}},cr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ge(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=$t('<button type="button" class="bjs-drilldown">'+ZL+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});r.setAttribute("title",s),r.addEventListener("click",function(){t.setRootElement(t.findRoot(to(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},cr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},cr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const JL={__depends__:[_u,rh,VL],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",iw],drilldownCentering:["type",ow],drilldownOverlayBehavior:["type",cr],subprocessCompatibility:["type",jr]};function lr(e){Gt.call(this,e)}Me(lr,Gt),lr.prototype._modules=[Fv,JL,_u,Ri,Ps],lr.prototype._moddleExtensions={};var Eu="keyboard.keydown",eI="keyboard.keyup",tI=1e3,sw="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 Un(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(sw));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Un.$inject=["config.keyboard","eventBus"],Un.prototype._keydownHandler=function(e){this._keyHandler(e,Eu)},Un.prototype._keyupHandler=function(e){this._keyHandler(e,eI)},Un.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Eu,i),n&&e.preventDefault()}},Un.prototype._isEventIgnored=function(e){return!1},Un.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(sw)),this.unbind(),e=this._node=this._target,Fe.bind(e,"keydown",this._keydownHandler),Fe.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Un.prototype.getBinding=function(){return this._node},Un.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Fe.unbind(e,"keydown",this._keydownHandler),Fe.unbind(e,"keyup",this._keyupHandler)),this._node=null},Un.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Un.prototype.addListener=function(e,t,n){bn(e)&&(n=t,t=e,e=tI),this._eventBus.on(n||Eu,e,t)},Un.prototype.removeListener=function(e,t){this._eventBus.off(t||Eu,e)},Un.prototype.hasModifier=pO,Un.prototype.isCmd=ri,Un.prototype.isShift=Yd,Un.prototype.isKey=mn;var nI=500;function Ba(e,t){var n=this;e.on("editorActions.init",nI,function(i){var o=i.editorActions;n.registerBindings(t,o)})}Ba.$inject=["eventBus","keyboard"],Ba.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(mO(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(yO(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(dO(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(gO(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(mn(["+","Add","="],o)&&ri(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(mn(["-","Subtract"],o)&&ri(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(mn("0",o)&&ri(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(mn(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const Oh={__init__:["keyboard","keyboardBindings"],keyboard:["type",Un],keyboardBindings:["type",Ba]};var iI={moveSpeed:50,moveSpeedAccelerated:200};function cw(e,t,n){var i=this;this._config=V({},iI,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})}}cw.$inject=["config.keyboardMove","keyboard","canvas"];const lw={__depends__:[Oh],__init__:["keyboardMove"],keyboardMove:["type",cw]};var oI=15;function uw(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=Or(s),p=Hi(u,c);if(!n.dragging&&rI(p)>oI&&(n.dragging=!0,l===0&&Rx(e),Yl("grab")),n.dragging){var f=n.last||n.start;p=Hi(u,f),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){Fe.unbind(document,"mousemove",o),Fe.unbind(document,"mouseup",r),n=null,Sx()}function a(s){if(!Mr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Or(s)},Fe.bind(document,"mousemove",o),Fe.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}uw.$inject=["eventBus","canvas"];function rI(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const pw={__init__:["moveCanvas"],moveCanvas:["type",uw]};function fw(e,t){var n=Wf(e.min),i=Wf(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function aI(e,t){return Math.max(e.min,Math.min(e.max,t))}var sI=Math.sign||function(e){return e>=0?1:-1},Dh={min:.2,max:4},dw=10,cI=.1,lI=.75;function oo(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Xn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||lI;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}oo.$inject=["config.zoomScroll","eventBus","canvas"],oo.prototype.scroll=function(t){this._canvas.scroll(t)},oo.prototype.reset=function(){this._canvas.zoom("fit-viewport")},oo.prototype.zoom=function(t,n){var i=fw(Dh,dw*2);this._totalDelta+=t,Math.abs(this._totalDelta)>cI&&(this._zoom(t,n,i),this._totalDelta=0)},oo.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Ob()&&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))*sI(t.deltaY)*r,this.zoom(a,c)}else o?a={dx:r*t.deltaY,dy:0}:a={dx:r*t.deltaX,dy:r*t.deltaY},this.scroll(a)}},oo.prototype.stepZoom=function(t,n){var i=fw(Dh,dw);this._zoom(t,n,i)},oo.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=Wf(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(aI(Dh,s),t)},oo.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&Fe[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},oo.prototype._init=function(e){this.toggle(e)};const hw={__init__:["zoomScroll"],zoomScroll:["type",oo]};function tc(e){lr.call(this,e)}Me(tc,lr),tc.prototype._navigationModules=[lw,pw,hw],tc.prototype._modules=[].concat(lr.prototype._modules,tc.prototype._navigationModules);function Lh(e){return e&&e[e.length-1]}function gw(e){return e.y}function mw(e){return e.x}var uI={left:mw,center:mw,right:function(e){return e.x+e.width},top:gw,middle:gw,bottom:function(e){return e.y+e.height}};function Na(e,t){this._modeling=e,this._rules=t}Na.$inject=["modeling","rules"],Na.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",i="width";return t.indexOf(e)!==-1&&(n="y",i="height"),{axis:n,dimension:i}},Na.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Na.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,o=n.dimension,r={},a={},s=!1,c,l,u;function p(f,d){return Math.round((f[i]+d[i]+d[o])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=Lh(t),r[e]=u[i]+u[o];else if(this._isType(e,["center","middle"])){if(z(t,function(f){var d=f[i]+Math.round(f[o]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=Ui(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return r[e]=Lh(c).center,r;l=t[0],t=Ui(t,function(f){return f[i]+f[o]}),u=Lh(t),r[e]=p(l,u)}return r},Na.prototype.trigger=function(e,t){var n=this._modeling,i,o=rt(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:o}),We(i)&&(o=i),!(o.length<2||!i)){var r=uI[t],a=Ui(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const pI={__init__:["alignElements"],alignElements:["type",Na]},fI=new Ir;function $a(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}$a.$inject=["eventBus"],$a.prototype.schedule=function(e,t=fI.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},$a.prototype._schedule=function(e,t){const n=dI();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(o){n.reject(o)}}catch(o){console.error("Scheduler#_schedule execution failed",o)}}),promise:n.promise}},$a.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},$a.prototype._cancel=function(e){clearTimeout(e.executionId)};function dI(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const hI={scheduler:["type",$a]};var gI="djs-element-hidden",Su=".entry",mI=1e3,yw=8,yI=300;function cn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}cn.$inject=["canvas","elementRegistry","eventBus","scheduler"],cn.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var o=i.target,r=We(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=We(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},cn.prototype._createContainer=function(){var e=$t('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},cn.prototype.registerProvider=function(e,t){t||(t=e,e=mI),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},cn.prototype.getEntries=function(e){var t=this._getProviders(),n=We(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return z(t,function(o){if(bn(o[n])){var r=o[n](e);bn(r)?i=r(i):z(r,function(a,s){i[s]=a})}}),i},cn.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=Sn(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},yI);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},cn.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var o=this._current.target,r=this._current.entries,a=r[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(bn(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},cn.prototype.open=function(e,t){if(!(!t&&this.isOpen(e))){var n=this._eventBus.fire("contextPad.open.allowed",{target:e});n!==!1&&(this.close(),this._updateAndOpen(e))}},cn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},cn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;z(t,function(o,r){var a=o.group||"default",s=$t(o.html||'<div class="entry" draggable="true"></div>'),c;Sn(s,"data-action",r),c=Et("[data-group="+Fr(a)+"]",n),c||(c=$t('<div class="group"></div>'),Sn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&vI(s,o.className),o.title&&Sn(s,"title",o.title),o.imageUrl&&(i=$t("<img>"),Sn(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Rt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},cn.prototype._createHtml=function(e){var t=this,n=$t('<div class="djs-context-pad"></div>');return ni.bind(n,Su,"click",function(i){t.trigger("click",i)}),ni.bind(n,Su,"dragstart",function(i){t.trigger("dragstart",i)}),ni.bind(n,Su,"mouseover",function(i){t.trigger("mouseover",i)}),ni.bind(n,Su,"mouseout",function(i){t.trigger("mouseout",i)}),Fe.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},cn.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&xI(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},cn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},cn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return We(e)!==We(n)?!1:We(e)?e.length===n.length&&Lo(e,function(i){return n.includes(i)}):n===e},cn.prototype.isShown=function(){return this.isOpen()&&Rt(this._current.html).has("open")},cn.prototype.show=function(){this.isOpen()&&(Rt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},cn.prototype.hide=function(){this.isOpen()&&(Rt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},cn.prototype._getPosition=function(e){if(!We(e)&&kt(e)){var t=this._canvas.viewbox(),n=bI(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+yw*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+yw*this._canvas.zoom(),top:s.top-a.top}},cn.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(i){i in n&&(t.style[i]=n[i]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},cn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=We(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,gI)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},cn.prototype._getTargetBounds=function(e){var t=this,n=We(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 vI(e,t){var n=Rt(e);t=We(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function bI(e){return e.waypoints[e.waypoints.length-1]}function xI(e,t){return e=We(e)?e:[e],t=We(t)?t:[t],e.length===t.length&&Lo(e,function(n){return t.includes(n)})}const vw={__depends__:[ql,hI,_u],contextPad:["type",cn]};var Ru,Wt,bw,ur,xw,_w,ww,Ih,Cu,nc,Ew,Bh,Nh,$h,Mu={},Au=[],_I=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Pu=Array.isArray;function Mo(e,t){for(var n in t)e[n]=t[n];return e}function Fh(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Sw(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?Ru.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 Tu(e,a,i,o,null)}function Tu(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??++bw,__i:-1,__u:0};return o==null&&Wt.vnode!=null&&Wt.vnode(r),r}function ku(e){return e.children}function Ou(e,t){this.props=e,this.context=t}function Hr(e,t){if(t==null)return e.__?Hr(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"?Hr(e):null}function wI(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=Mo({},t);r.__v=t.__v+1,Wt.vnode&&Wt.vnode(r),jh(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Hr(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,Ow(i,r,o),t.__e=t.__=null,r.__e!=n&&Rw(r)}}function Rw(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}),Rw(e)}function Cw(e){(!e.__d&&(e.__d=!0)&&ur.push(e)&&!Du.__r++||xw!=Wt.debounceRendering)&&((xw=Wt.debounceRendering)||_w)(Du)}function Du(){try{for(var e,t=1;ur.length;)ur.length>t&&ur.sort(ww),e=ur.shift(),t=ur.length,wI(e)}finally{ur.length=Du.__r=0}}function Mw(e,t,n,i,o,r,a,s,c,l,u){var p,f,d,g,h,m,_=i&&i.__k||Au,x=t.length;for(c=EI(n,t,_,c,x),p=0;p<x;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&_[d.__i]||Mu,d.__i=p,m=jh(e,d,f,o,r,a,s,c,l,u),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Hh(f.ref,null,d),u.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=Aw(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 EI(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]=Tu(null,a,null,null,null):Pu(a)?a=e.__k[r]=Tu(ku,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=Tu(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=SI(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=Hr(s)),Lw(s,s));return i}function Aw(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=Aw(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Hr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function SI(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 Pw(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||_I.test(t)?n:n+"px"}function Lu(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||Pw(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Pw(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(Ew,"$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[nc]=i[nc]:(n[nc]=Bh,e.addEventListener(t,r?$h:Nh,r)):e.removeEventListener(t,r?$h:Nh,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 Tw(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Cu]==null)t[Cu]=Bh++;else if(t[Cu]<n[nc])return;return n(Wt.event?Wt.event(t):t)}}}function jh(e,t,n,i,o,r,a,s,c,l){var u,p,f,d,g,h,m,_,x,y,v,E,w,T,P,O,B=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Wt.__b)&&u(t);e:if(typeof B=="function"){p=a.length;try{if(x=t.props,y=B.prototype&&B.prototype.render,v=(u=B.contextType)&&i[u.__c],E=u?v?v.props.value:u.__:i,n.__c?_=(f=t.__c=n.__c).__=f.__E:(y?t.__c=f=new B(x,E):(t.__c=f=new Ou(x,E),f.constructor=B,f.render=CI),v&&v.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&B.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Mo({},f.__s)),Mo(f.__s,B.getDerivedStateFromProps(x,f.__s))),g=f.props,h=f.state,f.__v=t,d)y&&B.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&B.getDerivedStateFromProps==null&&x!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(x,E),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(x,f.__s,E)===!1){t.__v!=n.__v&&(f.props=x,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function($){$&&($.__=t)}),Au.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Hr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(x,f.__s,E),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,m)})}if(f.context=E,f.props=x,f.__P=e,f.__e=!1,w=Wt.__r,T=0,y)f.state=f.__s,f.__d=!1,w&&w(t),u=f.render(f.props,f.state,f.context),Au.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,w&&w(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++T<25);f.state=f.__s,f.getChildContext!=null&&(i=Mo(Mo({},i),f.getChildContext())),y&&!d&&f.getSnapshotBeforeUpdate!=null&&(m=f.getSnapshotBeforeUpdate(g,h)),P=u!=null&&u.type===ku&&u.key==null?Dw(u.props.children):u,s=Mw(e,Pu(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),_&&(f.__E=f.__=null)}catch($){if(a.length=p,t.__v=null,c||r!=null){if($.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;r!=null&&(r[r.indexOf(s)]=null),t.__e=s}else if(r!=null)for(O=r.length;O--;)Fh(r[O])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),$.then||kw(t),Wt.__e($,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=RI(n.__e,t,n,i,o,r,a,c,l);return(u=Wt.diffed)&&u(t),128&t.__u?void 0:s}function kw(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(kw))}function Ow(e,t,n){for(var i=0;i<n.length;i++)Hh(n[i],n[++i],n[++i]);Wt.__c&&Wt.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Wt.__e(r,o.__v)}})}function Dw(e){return typeof e!="object"||e==null||e.__b>0?e:Pu(e)?e.map(Dw):e.constructor!==void 0?null:Mo({},e)}function RI(e,t,n,i,o,r,a,s,c){var l,u,p,f,d,g,h,m=n.props||Mu,_=t.props,x=t.type;if(x=="svg"?o="http://www.w3.org/2000/svg":x=="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==!!x&&(x?d.localName==x:d.nodeType==3)){e=d,r[l]=null;break}}if(e==null){if(x==null)return document.createTextNode(_);e=document.createElementNS(o,x,_.is&&_),s&&(Wt.__m&&Wt.__m(t,r),s=!1),r=null}if(x==null)m===_||s&&e.data==_||(e.data=_);else{if(r=x=="textarea"&&_.defaultValue!=null?null:r&&Ru.call(e.childNodes),!s&&r!=null)for(m={},l=0;l<e.attributes.length;l++)m[(d=e.attributes[l]).name]=d.value;for(l in m)d=m[l],l=="dangerouslySetInnerHTML"?p=d:l=="children"||l in _||l=="value"&&"defaultValue"in _||l=="checked"&&"defaultChecked"in _||Lu(e,l,null,d,o);for(l in _)d=_[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?g=d:l=="checked"?h=d:s&&typeof d!="function"||m[l]===d||Lu(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=""),Mw(t.type=="template"?e.content:e,Pu(f)?f:[f],t,n,i,x=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&Hr(n,0),s,c),r!=null)for(l=r.length;l--;)Fh(r[l]);s&&x!="textarea"||(l="value",x=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||x=="progress"&&!g||x=="option"&&g!=m[l])&&Lu(e,l,g,m[l],o),l="checked",h!=null&&h!=e[l]&&Lu(e,l,h,m[l],o))}return e}function Hh(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(o){Wt.__e(o,n)}}function Lw(e,t,n){var i,o;if(Wt.unmount&&Wt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Hh(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Wt.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&Lw(i[o],t,n||typeof e.type!="function");n||Fh(e.__e),e.__c=e.__=e.__e=void 0}function CI(e,t,n){return this.constructor(e,n)}function Iw(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Wt.__&&Wt.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],jh(t,e=t.__k=Sw(ku,null,[e]),o||Mu,Mu,t.namespaceURI,o?null:t.firstChild?Ru.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),Ow(r,e,a),e.props.children=null}Ru=Au.slice,Wt={__e:function(e,t,n,i){for(var o,r,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&r.getDerivedStateFromError!=null&&(o.setState(r.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,i||{}),a=o.__d),a)return o.__E=o}catch(s){e=s}throw e}},bw=0,Ou.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Mo({},this.state),typeof e=="function"&&(e=e(Mo({},n),this.props)),e&&Mo(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Cw(this))},Ou.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Cw(this))},Ou.prototype.render=ku,ur=[],_w=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ww=function(e,t){return e.__v.__b-t.__v.__b},Du.__r=0,Ih=Math.random().toString(8),Cu="__d"+Ih,nc="__a"+Ih,Ew=/(PointerCapture)$|Capture$/i,Bh=0,Nh=Tw(!1),$h=Tw(!0);var Bw=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,Bw(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},Nw=new Map;function MI(e){var t=Nw.get(this);return t||(t=new Map,Nw.set(this,t)),(t=Bw(this,t.get(e)||(t.set(e,t=(function(n){for(var i,o,r=1,a="",s="",c=[0],l=function(f){r===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):r===3&&(f||a)?(c.push(3,f,a),r=2):r===2&&a==="..."&&f?c.push(4,f,0):r===2&&a&&!f?c.push(5,0,!0,a):r>=5&&((a||!f&&r===5)&&(c.push(r,0,a,o),r=6),f&&(c.push(r,f,0,o),r=6)),a=""},u=0;u<n.length;u++){u&&(r===1&&l(),l(u));for(var p=0;p<n[u].length;p++)i=n[u][p],r===1?i==="<"?(l(),c=[c],r=3):a+=i:r===4?a==="--"&&i===">"?(r=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),r=1):r&&(i==="="?(r=5,o=a,a=""):i==="/"&&(r<5||n[u][p+1]===">")?(l(),r===3&&(c=c[0]),r=c,(c=c[0]).push(2,0,r),r=0):i===" "||i===" "||i===`
11
- `||i==="\r"?(l(),r=2):a+=i),r===3&&a==="!--"&&(r=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var Dt=MI.bind(Sw),Fa,ln,zh,$w,ic=0,Fw=[],yn=Wt,jw=yn.__b,Hw=yn.__r,zw=yn.diffed,Gw=yn.__c,Vw=yn.unmount,Ww=yn.__;function Iu(e,t){yn.__h&&yn.__h(ln,e,ic||t),ic=0;var n=ln.__H||(ln.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Gh(e){return ic=1,AI(qw,e)}function AI(e,t,n){var i=Iu(Fa++,2);if(i.t=e,!i.__c&&(i.__=[qw(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],l=i.t(c,s);c!==l&&(i.__N=[l,i.__[1]],i.__c.setState({}))}],i.__c=ln,!ln.__f)){var o=function(s,c,l){if(!i.__c.__H)return!0;var u=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){u=!0;var g=d.__[0];d.__=d.__N,d.__N=void 0,g!==d.__[0]&&(p=!0)}}),r){var f=r.call(this,s,c,l);return u?f||p:f}return!u||p};ln.__f=!0;var r=ln.shouldComponentUpdate,a=ln.componentWillUpdate;ln.componentWillUpdate=function(s,c,l){if(this.__e){var u=r;r=void 0,o(s,c,l),r=u}a&&a.call(this,s,c,l)},ln.shouldComponentUpdate=o}return i.__N||i.__}function Bu(e,t){var n=Iu(Fa++,3);!yn.__s&&Uh(n.__H,t)&&(n.__=e,n.u=t,ln.__H.__h.push(n))}function Vh(e,t){var n=Iu(Fa++,4);!yn.__s&&Uh(n.__H,t)&&(n.__=e,n.u=t,ln.__h.push(n))}function Nu(e){return ic=5,Ao(function(){return{current:e}},[])}function Ao(e,t){var n=Iu(Fa++,7);return Uh(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function oc(e,t){return ic=8,Ao(function(){return e},t)}function PI(){for(var e;e=Fw.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some($u),t.__h.some(Wh),t.__h=[]}catch(n){t.__h=[],yn.__e(n,e.__v)}}}yn.__b=function(e){ln=null,jw&&jw(e)},yn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ww&&Ww(e,t)},yn.__r=function(e){Hw&&Hw(e),Fa=0;var t=(ln=e.__c).__H;t&&(zh===ln?(t.__h=[],ln.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some($u),t.__h.some(Wh),t.__h=[],Fa=0)),zh=ln},yn.diffed=function(e){zw&&zw(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Fw.push(t)!==1&&$w===yn.requestAnimationFrame||(($w=yn.requestAnimationFrame)||TI)(PI)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),zh=ln=null},yn.__c=function(e,t){t.some(function(n){try{n.__h.some($u),n.__h=n.__h.filter(function(i){return!i.__||Wh(i)})}catch(i){t.some(function(o){o.__h&&(o.__h=[])}),t=[],yn.__e(i,n.__v)}}),Gw&&Gw(e,t)},yn.unmount=function(e){Vw&&Vw(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{$u(i)}catch(o){t=o}}),n.__H=void 0,t&&yn.__e(t,n.__v))};var Uw=typeof requestAnimationFrame=="function";function TI(e){var t,n=function(){clearTimeout(i),Uw&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Uw&&(t=requestAnimationFrame(n))}function $u(e){var t=ln,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ln=t}function Wh(e){var t=ln;e.__c=e.__(),ln=t}function Uh(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function qw(e,t){return typeof t=="function"?t(e):t}function kI(e){const{navigationStack:t,setNavigationStack:n}=e,i=Ao(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),o=t.length>0?()=>n([]):null,r=t.length>0?t[t.length-1].label:null;return Dt`
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}},Vt.prototype._setDefinitions=function(e){this._definitions=e},Vt.prototype.getModules=function(){return this._modules},Vt.prototype.clear=function(){this.getDefinitions()&&Ko.prototype.clear.call(this)},Vt.prototype.destroy=function(){Ko.prototype.destroy.call(this),Xi(this._container)},Vt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Vt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Vt.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=Rt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Vt.prototype.getDefinitions=function(){return this._definitions},Vt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Vt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),o=n.additionalModules||[],r=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(r,i,o),s=U(qi(n,["additionalModules"]),{canvas:U({},n.canvas,{container:e}),modules:a});Ko.call(this,s),n&&n.container&&this.attachTo(n.container)},Vt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Vt.prototype._createContainer=function(e){const t=$t('<div class="bjs-container"></div>');return Gn(t,{width:Bv(e.width),height:Bv(e.height),position:e.position}),t},Vt.prototype._createModdle=function(e){const t=U({},this._moddleExtensions,e.moddleExtensions);return new cm(t)},Vt.prototype._modules=[];function gl(e,t){return e.warnings=t,e}function iT(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 oT={width:"100%",height:"100%",position:"relative"};function Bv(e){return e+(Ue(e)?"px":"")}function rT(e,t){return t&&It(e.diagrams,function(n){return n.id===t})||null}function aT(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Ov+"</a>",i=$t(n);Gn(Rt("svg",i),Dv),Gn(i,Lv,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),$e.bind(i,"click",function(o){nT(),o.preventDefault()})}function wa(e){Vt.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)}Te(wa,Vt),wa.prototype._createModdle=function(e){var t=Vt.prototype._createModdle.call(this,e);return t.ids=new Ki([32,36,1]),t},wa.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,o;i.clear();for(o in t)i.claim(o,t[o])};function ut(e,t){return A(e,"bpmn:CallActivity")?!1:A(e,"bpmn:SubProcess")?(t=t||gt(e),t&&A(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):A(e,"bpmn:Participant")?!!he(e).processRef:!0}function xn(e){if(!(!A(e,"bpmn:Participant")&&!A(e,"bpmn:Lane"))){var t=gt(e).isHorizontal;return t===void 0?!0:t}}function sT(e){return e&&he(e).isInterrupting!==!1}function $n(e){return e&&!!he(e).triggeredByEvent}function _a(e,t){var n=he(e).eventDefinitions;return Io(n,function(i){return A(i,t)})}function cT(e){return _a(e,"bpmn:ErrorEventDefinition")}function lT(e){return _a(e,"bpmn:EscalationEventDefinition")}function uT(e){return _a(e,"bpmn:CompensateEventDefinition")}var Or={width:90,height:20},Nv=15;function Xo(e){return A(e,"bpmn:Event")||A(e,"bpmn:Gateway")||A(e,"bpmn:DataStoreReference")||A(e,"bpmn:DataObjectReference")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput")||A(e,"bpmn:SequenceFlow")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:Group")}function ml(e){return nt(e.label)}function pT(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=fT(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-=Nv:a+=Nv,{x:a,y:s}}function fT(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 Gf(e){return e.waypoints?pT(e.waypoints):A(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Or.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Or.height/2}}function dT(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Or.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=Gf(t),i=Or),U({x:n.x-i.width/2,y:n.y-i.height/2},i)}function $v(e){if(A(e,"bpmn:FlowElement")||A(e,"bpmn:Participant")||A(e,"bpmn:Lane")||A(e,"bpmn:SequenceFlow")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))return"name";if(A(e,"bpmn:TextAnnotation"))return"text";if(A(e,"bpmn:Group"))return"categoryValueRef"}function hT(e){var t=e.categoryValueRef;return t&&t.value||""}function mi(e){var t=e.businessObject,n=$v(t);if(n)return n==="categoryValueRef"?hT(t):t[n]||""}function gT(e,t){var n=e.businessObject,i=$v(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function mT(e){return nt(e)&&Xo(e.labelTarget)}var Ea=7;function Fv(e){let t=[];return G(e.incoming,n=>{A(n,"bpmn:Association")&&A(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),G(e.outgoing,n=>{A(n,"bpmn:Association")&&A(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Cs(e){const t=new Map;return G(Bf(e),n=>{G(Fv(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 Vf="hsl(225, 10%, 15%)",yT="white";function eo(e,t){return Io(e.eventDefinitions,function(n){return n.$type===t})}function vT(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function bT(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function at(e,t,n){var i=gt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||yT}function Ae(e,t,n){var i=gt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Vf}function Ms(e,t,n,i){var o=gt(e),r=o.get("label");return i||r&&r.get("color:color")||t||Ae(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 Tr(o)}function Wf(e,t){var n=e.x,i=e.y,o=e.width,r=e.height,a=[["M",n+t,i],["l",o-t*2,0],["a",t,t,0,0,1,t,t],["l",0,r-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-o,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-r],["a",t,t,0,0,1,t,-t],["z"]];return Tr(a)}function xT(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 Tr(s)}function wT(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 Tr(r)}function As(e,t={}){return{width:_i(e,t),height:ii(e,t)}}function _i(e,t={}){return Jn(t,"width")?t.width:e.width}function ii(e,t={}){return Jn(t,"height")?t.height:e.height}var _T=new Ki,ET=10,yl=3,ST=1.5,vl=10,RT=4,Sa=.95,CT=1,MT=.25;function Dr(e,t,n,i,o,r,a){mo.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u($){return n.computeStyle($,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Vf,strokeWidth:2,fill:"white"})}function p($){return n.computeStyle($,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Vf,strokeWidth:2})}function f($,C){var{ref:R={x:0,y:0},scale:V=1,element:Z,parentGfx:re=o._svg}=C,Re=Be("marker",{id:$,viewBox:"0 0 20 20",refX:R.x,refY:R.y,markerWidth:20*V,markerHeight:20*V,orient:"auto"});Ke(Re,Z);var Ze=Rt(":scope > defs",re);Ze||(Ze=Be("defs"),Ke(re,Ze)),Ke(Ze,Re)}function d($,C,R,V){var Z=_T.nextPrefixed("marker-");return m($,Z,C,R,V),"url(#"+Z+")"}function m($,C,R,V,Z){if(R==="sequenceflow-end"){var re=Be("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:Z,stroke:Z,strokeWidth:1})});f(C,{element:re,ref:{x:11,y:10},scale:.5,parentGfx:$})}if(R==="messageflow-start"){var Re=Be("circle",{cx:6,cy:6,r:3.5,...u({fill:V,stroke:Z,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Re,ref:{x:6,y:6},parentGfx:$})}if(R==="messageflow-end"){var Ze=Be("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:V,stroke:Z,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Ze,ref:{x:8.5,y:5},parentGfx:$})}if(R==="association-start"){var yt=Be("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:Z,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(C,{element:yt,ref:{x:1,y:10},scale:.5,parentGfx:$})}if(R==="association-end"){var Yt=Be("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:Z,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(C,{element:Yt,ref:{x:11,y:10},scale:.5,parentGfx:$})}if(R==="conditional-flow-marker"){var Et=Be("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:V,stroke:Z})});f(C,{element:Et,ref:{x:-1,y:10},scale:.5,parentGfx:$})}if(R==="conditional-default-flow-marker"){var pn=Be("path",{d:"M 6 4 L 10 16",...u({stroke:Z,fill:"none"})});f(C,{element:pn,ref:{x:0,y:10},scale:.5,parentGfx:$})}}function h($,C,R,V,Z={}){gn(V)&&(Z=V,V=0),V=V||0,Z=u(Z);var re=C/2,Re=R/2,Ze=Be("circle",{cx:re,cy:Re,r:Math.round((C+R)/4-V),...Z});return Ke($,Ze),Ze}function g($,C,R,V,Z,re){gn(Z)&&(re=Z,Z=0),Z=Z||0,re=u(re);var Re=Be("rect",{x:Z,y:Z,width:C-Z*2,height:R-Z*2,rx:V,ry:V,...re});return Ke($,Re),Re}function w($,C,R,V){var Z=C/2,re=R/2,Re=[{x:Z,y:0},{x:C,y:re},{x:Z,y:R},{x:0,y:re}],Ze=Re.map(function(Yt){return Yt.x+","+Yt.y}).join(" ");V=u(V);var yt=Be("polygon",{...V,points:Ze});return Ke($,yt),yt}function x($,C,R,V){R=p(R);var Z=bs(C,R,V);return Ke($,Z),Z}function y($,C,R){return x($,C,R,5)}function v($,C,R){R=p(R);var V=Be("path",{...R,d:C});return Ke($,V),V}function S($,C,R,V){return v(C,R,U({"data-marker":$},V))}function _($){return ke[$]}function T($){return function(C,R,V){return _($)(C,R,V)}}var P={"bpmn:MessageEventDefinition":function($,C,R={},V){var Z=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.235,my:.315}}),re=V?Ae(C,c,R.stroke):at(C,s,R.fill),Re=V?at(C,s,R.fill):Ae(C,c,R.stroke),Ze=v($,Z,{fill:re,stroke:Re,strokeWidth:1});return Ze},"bpmn:TimerEventDefinition":function($,C,R={}){var V=R.width||C.width,Z=R.height||C.height,re=R.width?1:2,Re=h($,V,Z,.2*Z,{fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke),strokeWidth:re}),Ze=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:V,containerHeight:Z,position:{mx:.5,my:.5}});v($,Ze,{stroke:Ae(C,c,R.stroke),strokeWidth:re});for(var yt=0;yt<12;yt++){var Yt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:V,containerHeight:Z,position:{mx:.5,my:.5}}),Et=V/2,pn=Z/2;v($,Yt,{strokeWidth:1,stroke:Ae(C,c,R.stroke),transform:"rotate("+yt*30+","+pn+","+Et+")"})}return Re},"bpmn:EscalationEventDefinition":function($,C,R={},V){var Z=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),re=V?Ae(C,c,R.stroke):at(C,s,R.fill);return v($,Z,{fill:re,stroke:Ae(C,c,R.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function($,C,R={}){var V=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.222}});return v($,V,{fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function($,C,R={},V){var Z=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.57,my:.263}}),re=V?Ae(C,c,R.stroke):at(C,s,R.fill);return v($,Z,{fill:re,stroke:Ae(C,c,R.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function($,C,R={},V){var Z=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.2,my:.722}}),re=V?Ae(C,c,R.stroke):at(C,s,R.fill);return v($,Z,{fill:re,stroke:Ae(C,c,R.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function($,C,R={},V){var Z=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.638,my:-.055}}),re=V?Ae(C,c,R.stroke):"none",Re=v($,Z,{fill:re,stroke:Ae(C,c,R.stroke),strokeWidth:1});return Tv(Re,45),Re},"bpmn:CompensateEventDefinition":function($,C,R={},V){var Z=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.22,my:.5}}),re=V?Ae(C,c,R.stroke):at(C,s,R.fill);return v($,Z,{fill:re,stroke:Ae(C,c,R.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function($,C,R={},V){var Z=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),re=V?Ae(C,c,R.stroke):at(C,s,R.fill);return v($,Z,{strokeWidth:1,fill:re,stroke:Ae(C,c,R.stroke)})},"bpmn:MultipleEventDefinition":function($,C,R={},V){var Z=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.211,my:.36}}),re=V?Ae(C,c,R.stroke):at(C,s,R.fill);return v($,Z,{fill:re,stroke:Ae(C,c,R.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function($,C,R={}){var V=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.458,my:.194}});return v($,V,{fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function($,C,R={}){var V=h($,C.width,C.height,8,{fill:Ae(C,c,R.stroke),stroke:Ae(C,c,R.stroke),strokeWidth:4});return V}};function D($,C,R={},V){var Z=he($),re=vT(Z),Re=V||$;return Z.get("eventDefinitions")&&Z.get("eventDefinitions").length>1?Z.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](C,Re,R,re):P["bpmn:MultipleEventDefinition"](C,Re,R,re):eo(Z,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](C,Re,R,re):eo(Z,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](C,Re,R,re):eo(Z,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](C,Re,R,re):eo(Z,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](C,Re,R,re):eo(Z,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](C,Re,R,re):eo(Z,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](C,Re,R,re):eo(Z,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](C,Re,R,re):eo(Z,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](C,Re,R,re):eo(Z,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](C,Re,R,re):eo(Z,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](C,Re,R,re):null}var N={ParticipantMultiplicityMarker:function($,C,R={}){var V=_i(C,R),Z=ii(C,R),re=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:V,containerHeight:Z,position:{mx:(V/2-6)/V,my:(Z-15)/Z}});S("participant-multiplicity",$,re,{strokeWidth:2,fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke)})},SubProcessMarker:function($,C,R={}){var V=g($,14,14,0,{strokeWidth:1,fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke)});Pn(V,C.width/2-7.5,C.height-20);var Z=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}});S("sub-process",$,Z,{fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke)})},ParallelMarker:function($,C,R){var V=_i(C,R),Z=ii(C,R),re=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:V,containerHeight:Z,position:{mx:(V/2+R.parallel)/V,my:(Z-20)/Z}});S("parallel",$,re,{fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke)})},SequentialMarker:function($,C,R){var V=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+R.seq)/C.width,my:(C.height-19)/C.height}});S("sequential",$,V,{fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke)})},CompensationMarker:function($,C,R){var V=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+R.compensation)/C.width,my:(C.height-13)/C.height}});S("compensation",$,V,{strokeWidth:1,fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke)})},LoopMarker:function($,C,R){var V=_i(C,R),Z=ii(C,R),re=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:V,containerHeight:Z,position:{mx:(V/2+R.loop)/V,my:(Z-7)/Z}});S("loop",$,re,{strokeWidth:1.5,fill:"none",stroke:Ae(C,c,R.stroke),strokeMiterlimit:.5})},AdhocMarker:function($,C,R){var V=_i(C,R),Z=ii(C,R),re=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:V,containerHeight:Z,position:{mx:(V/2+R.adhoc)/V,my:(Z-15)/Z}});S("adhoc",$,re,{strokeWidth:1,fill:Ae(C,c,R.stroke),stroke:Ae(C,c,R.stroke)})}};function j($,C,R,V){N[$](C,R,V)}function H($,C,R=[],V={}){V={fill:V.fill,stroke:V.stroke,width:_i(C,V),height:ii(C,V)};var Z=he(C),re=R.includes("SubProcessMarker");re?V={...V,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:V={...V,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},Z.get("isForCompensation")&&R.push("CompensationMarker"),A(Z,"bpmn:AdHocSubProcess")&&(R.push("AdhocMarker"),re||U(V,{compensation:V.compensation-18}));var Re=Z.get("loopCharacteristics"),Ze=Re&&Re.get("isSequential");Re&&(U(V,{compensation:V.compensation-18}),R.includes("AdhocMarker")&&U(V,{seq:-23,loop:-18,parallel:-24}),Ze===void 0&&R.push("LoopMarker"),Ze===!1&&R.push("ParallelMarker"),Ze===!0&&R.push("SequentialMarker")),R.includes("CompensationMarker")&&R.length===1&&U(V,{compensation:-8}),G(R,function(yt){j(yt,$,C,V)})}function Q($,C,R={}){R=U({size:{width:100}},R);var V=r.createText(C||"",R);return lt(V).add("djs-label"),Ke($,V),V}function ne($,C,R,V={}){var Z=he(C),re=As({x:C.x,y:C.y,width:C.width,height:C.height},V);return Q($,Z.name,{align:R,box:re,padding:7,style:{fill:Ms(C,l,c,V.stroke)}})}function W($,C,R={}){var V={width:C.width,height:C.height,x:C.width/2+C.x,y:C.height/2+C.y};return Q($,mi(C),{box:V,style:U({},r.getExternalStyle(),{fill:Ms(C,l,c,R.stroke)})})}function ee($,C,R,V={}){var Z=xn(R),re=Q($,C,{box:{height:30,width:Z?ii(R,V):_i(R,V)},align:"center-middle",style:{fill:Ms(R,l,c,V.stroke)}});if(Z){var Re=-1*ii(R,V);dl(re,0,-Re,270)}}function Se($,C,R={}){var{width:V,height:Z}=As(C,R);return g($,V,Z,vl,{...R,fill:at(C,s,R.fill),fillOpacity:Sa,stroke:Ae(C,c,R.stroke)})}function De($,C,R={}){var V=he(C),Z=at(C,s,R.fill),re=Ae(C,c,R.stroke);return(V.get("associationDirection")==="One"||V.get("associationDirection")==="Both")&&(R.markerEnd=d($,"association-end",Z,re)),V.get("associationDirection")==="Both"&&(R.markerStart=d($,"association-start",Z,re)),R=mt(R,["markerStart","markerEnd"]),y($,C.waypoints,{...R,stroke:re,strokeDasharray:"0, 5"})}function _e($,C,R={}){var V=at(C,s,R.fill),Z=Ae(C,c,R.stroke),re=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}}),Re=v($,re,{fill:V,fillOpacity:Sa,stroke:Z}),Ze=he(C);if(bT(Ze)){var yt=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}});v($,yt,{strokeWidth:2,fill:V,stroke:Z})}return Re}function Y($,C,R={}){return h($,C.width,C.height,{fillOpacity:Sa,...R,fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke)})}function ie($,C,R={}){return w($,C.width,C.height,{fill:at(C,s,R.fill),fillOpacity:Sa,stroke:Ae(C,c,R.stroke)})}function q($,C,R={}){var V=g($,_i(C,R),ii(C,R),0,{fill:at(C,s,R.fill),fillOpacity:R.fillOpacity||Sa,stroke:Ae(C,c,R.stroke),strokeWidth:1.5}),Z=he(C);if(A(Z,"bpmn:Lane")){var re=Z.get("name");ee($,re,C,R)}return V}function X($,C,R={}){var V=Se($,C,R),Z=ut(C);if($n(C)&&(Ce(V,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!Z)){var re=he(C).flowElements||[],Re=re.filter(Ze=>A(Ze,"bpmn:StartEvent"));Re.length===1&&ce(Re[0],$,R,C)}return ne($,C,Z?"center-top":"center-middle",R),Z?H($,C,void 0,R):H($,C,["SubProcessMarker"],R),V}function ce($,C,R,V){var Z=22,re={fill:at(V,s,R.fill),stroke:Ae(V,c,R.stroke),width:Z,height:Z},Re=he($).isInterrupting,Ze=Re?0:3,yt=Re?1:1.2,Yt=20,Et=(Z-Yt)/2,pn="translate("+Et+","+Et+")";h(C,Yt,Yt,{fill:re.fill,stroke:re.stroke,strokeWidth:yt,strokeDasharray:Ze,transform:pn}),D($,C,re,V)}function ye($,C,R={}){var V=Se($,C,R);return ne($,C,"center-middle",R),H($,C,void 0,R),V}var ke=this.handlers={"bpmn:AdHocSubProcess":function($,C,R={}){return ut(C)?R=mt(R,["fill","stroke","width","height"]):R=mt(R,["fill","stroke"]),X($,C,R)},"bpmn:Association":function($,C,R={}){return R=mt(R,["fill","stroke"]),De($,C,R)},"bpmn:BoundaryEvent":function($,C,R={}){var{renderIcon:V=!0}=R;R=mt(R,["fill","stroke"]);var Z=he(C),re=Z.get("cancelActivity");R={strokeWidth:1.5,fill:at(C,s,R.fill),fillOpacity:CT,stroke:Ae(C,c,R.stroke)},re||(R.strokeDasharray="6");var Re=Y($,C,R);return h($,C.width,C.height,yl,{...R,fill:"none"}),V&&D(C,$,R),Re},"bpmn:BusinessRuleTask":function($,C,R={}){R=mt(R,["fill","stroke"]);var V=ye($,C,R),Z=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),re=v($,Z);Ce(re,{fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke),strokeWidth:1});var Re=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ze=v($,Re);return Ce(Ze,{fill:Ae(C,c,R.stroke),stroke:Ae(C,c,R.stroke),strokeWidth:1}),V},"bpmn:CallActivity":function($,C,R={}){return R=mt(R,["fill","stroke"]),X($,C,{strokeWidth:5,...R})},"bpmn:ComplexGateway":function($,C,R={}){R=mt(R,["fill","stroke"]);var V=ie($,C,R),Z=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.26}});return v($,Z,{fill:Ae(C,c,R.stroke),stroke:Ae(C,c,R.stroke),strokeWidth:1}),V},"bpmn:DataInput":function($,C,R={}){R=mt(R,["fill","stroke"]);var V=i.getRawPath("DATA_ARROW"),Z=_e($,C,R);return v($,V,{fill:"none",stroke:Ae(C,c,R.stroke),strokeWidth:1}),Z},"bpmn:DataInputAssociation":function($,C,R={}){return R=mt(R,["fill","stroke"]),De($,C,{...R,markerEnd:d($,"association-end",at(C,s,R.fill),Ae(C,c,R.stroke))})},"bpmn:DataObject":function($,C,R={}){return R=mt(R,["fill","stroke"]),_e($,C,R)},"bpmn:DataObjectReference":T("bpmn:DataObject"),"bpmn:DataOutput":function($,C,R={}){R=mt(R,["fill","stroke"]);var V=i.getRawPath("DATA_ARROW"),Z=_e($,C,R);return v($,V,{strokeWidth:1,fill:Ae(C,c,R.stroke),stroke:Ae(C,c,R.stroke)}),Z},"bpmn:DataOutputAssociation":function($,C,R={}){return R=mt(R,["fill","stroke"]),De($,C,{...R,markerEnd:d($,"association-end",at(C,s,R.fill),Ae(C,c,R.stroke))})},"bpmn:DataStoreReference":function($,C,R={}){R=mt(R,["fill","stroke"]);var V=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:0,my:.133}});return v($,V,{fill:at(C,s,R.fill),fillOpacity:Sa,stroke:Ae(C,c,R.stroke),strokeWidth:2})},"bpmn:EndEvent":function($,C,R={}){var{renderIcon:V=!0}=R;R=mt(R,["fill","stroke"]);var Z=Y($,C,{...R,strokeWidth:4});return V&&D(C,$,R),Z},"bpmn:EventBasedGateway":function($,C,R={}){R=mt(R,["fill","stroke"]);var V=he(C),Z=ie($,C,R);h($,C.width,C.height,C.height*.2,{fill:at(C,"none",R.fill),stroke:Ae(C,c,R.stroke),strokeWidth:1});var re=V.get("eventGatewayType"),Re=!!V.get("instantiate");function Ze(){var Yt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:C.width,containerHeight:C.height,position:{mx:.36,my:.44}});v($,Yt,{fill:"none",stroke:Ae(C,c,R.stroke),strokeWidth:2})}if(re==="Parallel"){var yt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}});v($,yt,{fill:"none",stroke:Ae(C,c,R.stroke),strokeWidth:1})}else re==="Exclusive"&&(Re||h($,C.width,C.height,C.height*.26,{fill:"none",stroke:Ae(C,c,R.stroke),strokeWidth:1}),Ze());return Z},"bpmn:ExclusiveGateway":function($,C,R={}){R=mt(R,["fill","stroke"]);var V=ie($,C,R),Z=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.32,my:.3}}),re=gt(C);return re.get("isMarkerVisible")&&v($,Z,{fill:Ae(C,c,R.stroke),stroke:Ae(C,c,R.stroke),strokeWidth:1}),V},"bpmn:Gateway":function($,C,R={}){return R=mt(R,["fill","stroke"]),ie($,C,R)},"bpmn:Group":function($,C,R={}){return R=mt(R,["fill","stroke","width","height"]),g($,C.width,C.height,vl,{stroke:Ae(C,c,R.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:_i(C,R),height:ii(C,R)})},"bpmn:InclusiveGateway":function($,C,R={}){R=mt(R,["fill","stroke"]);var V=ie($,C,R);return h($,C.width,C.height,C.height*.24,{fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke),strokeWidth:2.5}),V},"bpmn:IntermediateEvent":function($,C,R={}){var{renderIcon:V=!0}=R;R=mt(R,["fill","stroke"]);var Z=Y($,C,{...R,strokeWidth:1.5});return h($,C.width,C.height,yl,{fill:"none",stroke:Ae(C,c,R.stroke),strokeWidth:1.5}),V&&D(C,$,R),Z},"bpmn:IntermediateCatchEvent":T("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":T("bpmn:IntermediateEvent"),"bpmn:Lane":function($,C,R={}){return R=mt(R,["fill","stroke","width","height"]),q($,C,{...R,fillOpacity:MT})},"bpmn:ManualTask":function($,C,R={}){R=mt(R,["fill","stroke"]);var V=ye($,C,R),Z=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return v($,Z,{fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke),strokeWidth:.5}),V},"bpmn:MessageFlow":function($,C,R={}){R=mt(R,["fill","stroke"]);var V=he(C),Z=gt(C),re=at(C,s,R.fill),Re=Ae(C,c,R.stroke),Ze=y($,C.waypoints,{markerEnd:d($,"messageflow-end",re,Re),markerStart:d($,"messageflow-start",re,Re),stroke:Re,strokeDasharray:"10, 11",strokeWidth:1.5});if(V.get("messageRef")){var yt=Ze.getPointAtLength(Ze.getTotalLength()/2),Yt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:yt.x,y:yt.y}}),Et={strokeWidth:1};Z.get("messageVisibleKind")==="initiating"?(Et.fill=re,Et.stroke=Re):(Et.fill=Re,Et.stroke=re);var pn=v($,Yt,Et),Fn=V.get("messageRef"),Dn=Fn.get("name"),Lt=Q($,Dn,{align:"center-top",fitBox:!0,style:{fill:Re}}),fn=pn.getBBox(),Wn=Lt.getBBox(),yr=yt.x-Wn.width/2,yi=yt.y+fn.height/2+ET;dl(Lt,yr,yi,0)}return Ze},"bpmn:ParallelGateway":function($,C,R={}){R=mt(R,["fill","stroke"]);var V=ie($,C,R),Z=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.2}});return v($,Z,{fill:Ae(C,c,R.stroke),stroke:Ae(C,c,R.stroke),strokeWidth:1}),V},"bpmn:Participant":function($,C,R={}){R=mt(R,["fill","stroke","width","height"]);var V=q($,C,R),Z=ut(C),re=xn(C),Re=he(C),Ze=Re.get("name");if(Z){var yt=re?[{x:30,y:0},{x:30,y:ii(C,R)}]:[{x:0,y:30},{x:_i(C,R),y:30}];x($,yt,{stroke:Ae(C,c,R.stroke),strokeWidth:ST}),ee($,Ze,C,R)}else{var Yt=As(C,R);re||(Yt.height=_i(C,R),Yt.width=ii(C,R));var Et=Q($,Ze,{box:Yt,align:"center-middle",style:{fill:Ms(C,l,c,R.stroke)}});if(!re){var pn=-1*ii(C,R);dl(Et,0,-pn,270)}}return Re.get("participantMultiplicity")&&j("ParticipantMultiplicityMarker",$,C,R),V},"bpmn:ReceiveTask":function($,C,R={}){R=mt(R,["fill","stroke"]);var V=he(C),Z=ye($,C,R),re;return V.get("instantiate")?(h($,28,28,20*.22,{fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke),strokeWidth:1}),re=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):re=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),v($,re,{fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke),strokeWidth:1}),Z},"bpmn:ScriptTask":function($,C,R={}){R=mt(R,["fill","stroke"]);var V=ye($,C,R),Z=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return v($,Z,{fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke),strokeWidth:1}),V},"bpmn:SendTask":function($,C,R={}){R=mt(R,["fill","stroke"]);var V=ye($,C,R),Z=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return v($,Z,{fill:Ae(C,c,R.stroke),stroke:at(C,s,R.fill),strokeWidth:1}),V},"bpmn:SequenceFlow":function($,C,R={}){R=mt(R,["fill","stroke"]);var V=at(C,s,R.fill),Z=Ae(C,c,R.stroke),re=y($,C.waypoints,{markerEnd:d($,"sequenceflow-end",V,Z),stroke:Z}),Re=he(C),{source:Ze}=C;if(Ze){var yt=he(Ze);Re.get("conditionExpression")&&A(yt,"bpmn:Activity")&&Ce(re,{markerStart:d($,"conditional-flow-marker",V,Z)}),yt.get("default")&&(A(yt,"bpmn:Gateway")||A(yt,"bpmn:Activity"))&&yt.get("default")===Re&&Ce(re,{markerStart:d($,"conditional-default-flow-marker",V,Z)})}return re},"bpmn:ServiceTask":function($,C,R={}){R=mt(R,["fill","stroke"]);var V=ye($,C,R);h($,10,10,{fill:at(C,s,R.fill),stroke:"none",transform:"translate(6, 6)"});var Z=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});v($,Z,{fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke),strokeWidth:1}),h($,10,10,{fill:at(C,s,R.fill),stroke:"none",transform:"translate(11, 10)"});var re=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return v($,re,{fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke),strokeWidth:1}),V},"bpmn:StartEvent":function($,C,R={}){var{renderIcon:V=!0}=R;R=mt(R,["fill","stroke"]);var Z=he(C);Z.get("isInterrupting")||(R={...R,strokeDasharray:"6"});var re=Y($,C,R);return V&&D(C,$,R),re},"bpmn:SubProcess":function($,C,R={}){return ut(C)?R=mt(R,["fill","stroke","width","height"]):R=mt(R,["fill","stroke"]),X($,C,R)},"bpmn:Task":function($,C,R={}){return R=mt(R,["fill","stroke"]),ye($,C,R)},"bpmn:TextAnnotation":function($,C,R={}){R=mt(R,["fill","stroke"]);var{width:V,height:Z}=As(C,R),re=g($,V,Z,0,0,{fill:"none",stroke:"none"}),Re=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:V,containerHeight:Z,position:{mx:0,my:0}});v($,Re,{stroke:Ae(C,c,R.stroke)});var Ze=he(C),yt=Ze.get("text")||"";return Q($,yt,{align:"left-top",box:As(C,R),padding:Ea,style:{fill:Ms(C,l,c,R.stroke)}}),re},"bpmn:Transaction":function($,C,R={}){ut(C)?R=mt(R,["fill","stroke","width","height"]):R=mt(R,["fill","stroke"]);var V=X($,C,{strokeWidth:1.5,...R}),Z=n.style(["no-fill","no-events"],{stroke:Ae(C,c,R.stroke),strokeWidth:1.5}),re=ut(C);return re||(R={}),g($,_i(C,R),ii(C,R),vl-yl,yl,Z),V},"bpmn:UserTask":function($,C,R={}){R=mt(R,["fill","stroke"]);var V=ye($,C,R),Z=15,re=12,Re=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:Z,y:re}});v($,Re,{fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke),strokeWidth:.5});var Ze=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:Z,y:re}});v($,Ze,{fill:at(C,s,R.fill),stroke:Ae(C,c,R.stroke),strokeWidth:.5});var yt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:Z,y:re}});return v($,yt,{fill:Ae(C,c,R.stroke),stroke:Ae(C,c,R.stroke),strokeWidth:.5}),V},label:function($,C,R={}){return W($,C,R)}};this._drawPath=v,this._renderer=_}Te(Dr,mo),Dr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Dr.prototype.canRender=function(e){return A(e,"bpmn:BaseElement")},Dr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Dr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Dr.prototype.getShapePath=function(e){return nt(e)?Wf(e,RT):A(e,"bpmn:Event")?jv(e):A(e,"bpmn:Activity")?Wf(e,vl):A(e,"bpmn:Gateway")?xT(e):wT(e)};function mt(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var AT=0,PT={width:150,height:50};function TT(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function kT(e){return gn(e)?U({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Uf=null;function OT(){return Uf||(Uf=document.createElement("canvas").getContext("2d")),Uf}function DT(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(Hv(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Hv(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function LT(e,t){var n=OT();if(!n)return{width:0,height:0};n.font=DT(t),"letterSpacing"in n&&(n.letterSpacing=Hv(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 IT(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=LT(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return BT(e,o,i,r);o=$T(o,r.width,t)}}function BT(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 zv="­";function NT(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===zv)&&o.pop();break}var a=o[o.length-1];return a&&a===zv&&(o[o.length-1]="-"),o.join("")}function $T(e,t,n){var i=Math.max(e.length*(n/t),1),o=NT(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function bl(e){this._config=U({},{size:PT,padding:AT,style:{},align:"center-top"},e||{})}bl.prototype.createText=function(e,t){return this.layoutText(e,t).element},bl.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},bl.prototype.layoutText=function(e,t){for(var n=U({},this._config.size,t.box),i=U({},this._config.style,t.style),o=TT(t.align||this._config.align),r=kT(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=FT(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(IT(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=ei(l,function(g,w,x){return g+(s||w.height)},0)+r.top+r.bottom,f=ei(l,function(g,w,x){return w.width>g?w.width:g},0),d=r.top;o.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||l[0].height)/4;var m=Be("text");Ce(m,i),G(l,function(g){var w;switch(d+=s||g.height,o.horizontal){case"left":w=r.left;break;case"right":w=(a?f:u)-r.right-g.width;break;default:w=Math.max(((a?f:u)-g.width)/2+r.left,0)}var x=Be("tspan");Ce(x,{x:w,y:d}),x.textContent=g.text,Ke(m,x)});var h={width:f,height:p};return{dimensions:h,element:m}};function FT(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var jT=12,HT=1.2,zT=40;function Gv(e){var t=U({fontFamily:"Arial, sans-serif",fontSize:jT,fontWeight:"normal",lineHeight:HT},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=U({},t,{fontSize:n},e&&e.externalStyle||{}),o=new bl({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Or.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:Ea});return{x:a.x,y:a.y,width:a.width,height:Math.max(zT,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,U({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Gv.$inject=["config.textRenderer"];function GT(){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=qT(i.d,{mx:o,my:r,e:a});return p}}var VT=/\{([^{}]+)\}/g,WT=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function UT(e,t,n){var i=n;return t.replace(WT,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 qT(e,t){return String(e).replace(VT,function(n,i){return UT(n,i,t)})}const YT={__init__:["bpmnRenderer"],bpmnRenderer:["type",Dr],textRenderer:["type",Gv],pathMap:["type",GT]};function KT(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Ps={translate:["value",KT]};function xl(e,t,n){return U({id:e.id,type:e.$type,businessObject:e,di:t},n)}function XT(e,t,n){var i=e.waypoint;return!i||i.length<2?[qe(t),qe(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function Vv(e,t,n){return new Error(`element ${Nn(t)} referenced by ${Nn(e)}#${n} not yet drawn`)}function xo(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}xo.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],xo.prototype.add=function(e,t,n){var i,o,r;if(A(t,"bpmndi:BPMNPlane")){var a=A(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(xl(e,t,a)),this._canvas.addRootElement(i)}else if(A(t,"bpmndi:BPMNShape")){var s=!ut(e,t),c=QT(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(xl(e,t,{collapsed:s,hidden:o,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),A(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),A(e,"bpmn:Lane")&&(r=0),A(e,"bpmn:DataStoreReference")&&(ZT(n,qe(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,r)}else if(A(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);o=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(xl(e,t,{hidden:o,source:u,target:p,waypoints:XT(t,u,p)})),A(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${Nn(t)} for element ${Nn(e)}`);return Xo(e)&&mi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},xo.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Nn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw Vv(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},xo.prototype.addLabel=function(e,t,n){var i,o,r;return i=dT(t,n),o=mi(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(xl(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!mi(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)},xo.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?Vv(e,i,t+"Ref"):new Error(`${Nn(e)}#${t} Ref not specified`)},xo.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},xo.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},xo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function ZT(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 QT(e){return A(e,"bpmn:Group")}const Wv={__depends__:[YT,{__depends__:[Ps],bpmnImporter:["type",xo]}]};function Ts(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function zi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function qf(e){return Math.log(e)/Math.log(10)}var JT=1e3;function de(e){this._eventBus=e}de.$inject=["eventBus"];function e2(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}de.prototype.on=function(e,t,n,i,o,r){if((bn(t)||Ue(t))&&(r=o,o=i,i=n,n=t,t=null),bn(n)&&(r=o,o=i,i=n,n=JT),gn(o)&&(r=o,o=!1),!bn(i))throw new Error("handlerFn must be a function");We(e)||(e=[e]);var a=this._eventBus;G(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,o?e2(i,r):i,r)})},de.prototype.canExecute=wo("canExecute"),de.prototype.preExecute=wo("preExecute"),de.prototype.preExecuted=wo("preExecuted"),de.prototype.execute=wo("execute"),de.prototype.executed=wo("executed"),de.prototype.postExecute=wo("postExecute"),de.prototype.postExecuted=wo("postExecuted"),de.prototype.revert=wo("revert"),de.prototype.reverted=wo("reverted");function wo(e){return function(n,i,o,r,a){(bn(n)||Ue(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var Yf=["top","bottom","left","right"],wl=10;function Kf(e,t){de.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(o){var r=o.context,a=r.connection,s=a.source,c=a.target,l=r.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(o){var r=o.context,a=r.shape,s=r.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(o){var r=o.context,a=r.elements,s=r.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(o){if(ml(o)&&!kt(o)){var r=i2(o);r&&i(o,r)}}function i(o,r){var a=qe(o),s=o.label,c=qe(s);if(s.parent){var l=ze(o),u;switch(r){case"top":u={x:a.x,y:l.top-wl-s.height/2};break;case"left":u={x:l.left-wl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+wl+s.height/2};break;case"right":u={x:l.right+wl+s.width/2,y:a.y};break}var p=zi(u,c);t.moveShape(s,p)}}}Te(Kf,de),Kf.$inject=["eventBus","modeling"];function t2(e){var t=e.host,n=qe(e),i=An(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=Yf.filter(function(a){return o.indexOf(a)===-1});return r}function n2(e){var t=qe(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return Uv(t,i)});return n}function i2(e){var t=qe(e.label),n=qe(e),i=Uv(n,t);if(o2(i)){var o=n2(e);if(e.host){var r=t2(e);o=o.concat(r)}var a=Yf.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?An(e.label,e)!=="intersect"?void 0:i:a[0]}}function Uv(e,t){return An(t,e,5)}function o2(e){return Yf.indexOf(e)!==-1}function Xf(e){de.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(A(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}Te(Xf,de),Xf.$inject=["eventBus"];var r2=1500;function Zf(e,t,n){e.invoke(de,this),this.preExecute("elements.delete",r2,function(o){var r=o.context,a=r.elements,s=i(a);s.length&&(r.elements=a.concat(s))}),t.on("shape.move.start",function(o){var r=o.context.shapes,a=i(r);a.length&&(o.context.shapes=r.concat(a))});function i(o){var r=rt(o,l=>A(l,"bpmn:Participant")||A(l,"bpmn:SubProcess"));if(!r.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>A(l,"bpmn:Artifact"))),c=new Set;return G(r,l=>{const u=new Set(oa(va(Array.from(s),rn(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Te(Zf,de),Zf.$inject=["injector","eventBus","canvas"];function Qf(e,t){e.invoke(de,this),this.postExecute("shape.move",function(n){var i=n.newParent,o=n.shape,r=rt(o.incoming.concat(o.outgoing),function(a){return A(a,"bpmn:Association")});G(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Te(Qf,de),Qf.$inject=["injector","modeling"];function Ra(e,t){for(Qn(t)&&(t=[t]);e=e.parent;)if(it(e,t))return e;return null}function qv(e,t){var n=Ra(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Ra(e,i),n)return xn(n);if(it(e,i))return xn(e);var o;for(o=he(e);o&&!A(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=he(a);return s&&s.get("processRef")===o});return r?xn(r):!0}var Yv=500;function _l(e,t){t.invoke(de,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Yv,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return Kv(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",Yv,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];Kv(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}_l.$inject=["bpmnReplace","injector"],Te(_l,de),_l.prototype._replaceShape=function(e,t){var n=a2(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function a2(e){var t=he(e),n=t.eventDefinitions;return n&&n[0]}function Kv(e,t){return!nt(e)&&it(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Jf(e,t){de.call(this,e);function n(i){return rt(i.attachers,function(o){return A(o,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var o=i.context.source,r=i.context.target,a=n(r);A(o,"bpmn:EventBasedGateway")&&A(r,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var o=i.context.oldSource,r=i.context.newSource;A(o,"bpmn:Gateway")&&A(r,"bpmn:EventBasedGateway")&&G(r.outgoing,function(a){var s=a.target,c=n(s);A(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Jf.$inject=["eventBus","modeling"],Te(Jf,de);function Xv(e){return e.create("bpmn:Category")}function s2(e){return e.create("bpmn:CategoryValue")}function Zv(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=s2(e)),n.$parent||(n.$parent=Xv(e)),n}function c2(e,t,n){return en(t.get("categoryValue"),e),e.$parent=t,en(n.get("rootElements"),t),t.$parent=n,e}function l2(e){var t=e.$parent;return t&&(Jt(t.get("categoryValue"),e),e.$parent=null),e}function u2(e){var t=e.$parent;return t&&(Jt(t.get("rootElements"),e),e.$parent=null),e}var p2=500;function ed(e,t,n){n.invoke(de,this);function i(c){return t.filter(function(l){return A(l,"bpmn:Group")&&!l.labelTarget}).map(he).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&&c2(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&u2(l),c&&!o(c,u)&&l2(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!A(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!A(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,he(l))},!0),this.executed(["shape.move","shape.resize"],p2,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,he(l))},!0),this.executed("group.updateRefs",function(c){Qv(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){Qv(c).forEach(function(l){s(l.categoryValue,l.category,he(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,he(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}ed.$inject=["bpmnjs","elementRegistry","injector"],Te(ed,de);function Qv(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function td(e,t,n){de.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",o,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",r,!0),this.postExecuted("element.updateProperties",a,!0);function i(g){const w=g.source,x=g.target;Ca(w)&&ks(x)&&u(x)}function o(g){const w=g.connection,x=g.source,y=g.target;Ca(x)&&El(y)&&(l(y),f(x,[w]))}function r(g){const w=g.newTarget,x=g.oldSource,y=g.oldTarget;if(y!==w){const v=x;ks(y)&&u(y),Ca(v)&&El(w)&&l(w)}}function a(g){const{element:w}=g;ks(w)?(p(w),d(w)):El(w)&&m(w)}function s(g){const{newData:w,oldShape:x}=g;if(Ca(g.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){const y=x.outgoing.find(({target:v})=>ks(v));y&&y.target&&(g._connectionTarget=y.target)}else if(!Ca(g.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){const y=x.outgoing.find(({target:v})=>El(v));y&&y.target&&(g._connectionTarget=y.target),h(x)}}function c(g){const{_connectionTarget:w,newShape:x}=g;w&&t.connect(x,w)}function l(g){t.updateProperties(g,{isForCompensation:!0})}function u(g){t.updateProperties(g,{isForCompensation:void 0})}function p(g){for(const w of g.incoming)n.canConnect(w.source,g)||t.removeConnection(w);for(const w of g.outgoing)n.canConnect(g,w.target)||t.removeConnection(w)}function f(g,w){g.outgoing.filter(v=>A(v,"bpmn:Association")).filter(v=>ks(v.target)&&!w.includes(v)).forEach(v=>t.removeConnection(v))}function d(g){const w=g.attachers.slice();w.length&&t.removeElements(w)}function m(g){const w=g.incoming.filter(x=>Ca(x.source));t.removeElements(w)}function h(g){const w=g.outgoing.filter(x=>A(x,"bpmn:SequenceFlow"));t.removeElements(w)}}Te(td,de),td.$inject=["eventBus","modeling","bpmnRules"];function ks(e){const t=he(e);return t&&t.get("isForCompensation")}function Ca(e){return e&&A(e,"bpmn:BoundaryEvent")&&_a(e,"bpmn:CompensateEventDefinition")}function El(e){return e&&A(e,"bpmn:Activity")&&!$n(e)}function nd(e){e.invoke(de,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,o=n.shape;A(i,"bpmn:Lane")&&!A(o,"bpmn:Lane")&&(n.parent=Ra(i,"bpmn:Participant"))})}nd.$inject=["injector"],Te(nd,de);function id(e,t){de.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,o=i.shape;if(A(o,"bpmn:DataObjectReference")&&o.type!=="label"){var r=t.create("bpmn:DataObject");r.isCollection=((a=o.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,o.businessObject.dataObjectRef=r}})}id.$inject=["eventBus","bpmnFactory"],Te(id,de);var od=20,rd=20,Jv=30,Sl=2e3;function ad(e,t,n){de.call(this,t),t.on(["create.start","shape.move.start"],Sl,function(o){var r=o.context,a=r.shape,s=e.getRootElement();if(!(!A(a,"bpmn:Participant")||!A(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!A(p,"bpmn:Group")&&!nt(p)&&!kt(p)});if(c.length){var l=rn(c),u=f2(a,l);U(a,u),r.createConstraints=d2(a,l)}}}),t.on("create.start",Sl,function(o){var r=o.context,a=r.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}A(a,"bpmn:Participant")&&A(s,"bpmn:Process")&&(t.on("element.hover",Sl,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var o=e.getRootElement();return A(o,"bpmn:Collaboration")?o:n.makeCollaboration()}this.preExecute("elements.create",Sl,function(o){var r=o.elements,a=o.parent,s=h2(r),c;s&&A(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=he(s).get("processRef"))},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;A(a,"bpmn:Participant")&&A(r,"bpmn:Process")&&(o.parent=i(),o.process=r,o.processRef=he(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)&&he(s).set("processRef",he(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)&&he(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)}ad.$inject=["canvas","eventBus","modeling"],Te(ad,de);function f2(e,t){t={width:t.width+od*2+Jv,height:t.height+rd*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 d2(e,t){return t=ze(t),{bottom:t.top+e.height/2-rd,left:t.right-e.width/2+od,top:t.bottom-e.height/2+rd,right:t.left+e.width/2-od-Jv}}function h2(e){return It(e,function(t){return A(t,"bpmn:Participant")})}var eb="__targetRef_placeholder";function sd(e,t){de.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],tb(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],tb(r));function n(a,s,c){var l=a.get("dataInputAssociations");return It(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=It(c,function(u){return u.name===eb});return!l&&s&&(l=t.create("bpmn:Property",{name:eb}),en(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||Jt(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,m=s.oldTarget||s.target,h=m&&m.businessObject,g=c.businessObject,w;h&&h!==p&&o(h,l),d&&d!==p&&o(d,l),p?(w=i(p,!0),g.targetRef=w):g.targetRef=null}}sd.$inject=["eventBus","bpmnFactory"],Te(sd,de);function tb(e){return function(t){var n=t.context,i=n.connection;if(A(i,"bpmn:DataInputAssociation"))return e(t)}}function Rl(e){this._bpmnUpdater=e}Rl.$inject=["bpmnUpdater"],Rl.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),[]},Rl.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 cd(e,t,n,i){de.call(this,i),t.registerHandler("dataStore.updateContainment",Rl);function o(){return n.filter(function(s){return A(s,"bpmn:Participant")&&he(s).processRef})[0]}function r(s){return s.children.filter(function(c){return A(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||o(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:gt(s),newSemanticParent:u.processRef||u,newDiParent:gt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;A(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(p){return A(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!A(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;A(l,"bpmn:DataStoreReference")&&l.type!=="label"&&A(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,p=l.parent;if(!A(u,"bpmn:Collaboration")&&A(l,"bpmn:DataStoreReference")&&l.type!=="label"&&A(p,"bpmn:Collaboration")){var f=A(u,"bpmn:Participant")?u:m2(u,"bpmn:Participant");a(l,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();it(l,["bpmn:Participant","bpmn:SubProcess"])&&A(u,"bpmn:Collaboration")&&r(u).filter(function(p){return g2(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){A(u,"bpmn:Process")&&a(f,u)})})}cd.$inject=["canvas","commandStack","elementRegistry","eventBus"],Te(cd,de);function g2(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 m2(e,t){for(;e.parent;){if(A(e.parent,t))return e.parent;e=e.parent}}var Cl=Math.max,Ml=Math.min,y2=20;function nb(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function v2(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 b2(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 Al(e,t,n){var i=t[e],o=n.min&&n.min[e],r=n.max&&n.max[e];return Ue(o)&&(i=(/top|left/.test(e)?Ml:Cl)(i,o)),Ue(r)&&(i=(/top|left/.test(e)?Cl:Ml)(i,r)),i}function x2(e,t){if(!t)return e;var n=ze(e);return ul({top:Al("top",n,t),right:Al("right",n,t),bottom:Al("bottom",n,t),left:Al("left",n,t)})}function w2(e,t,n,i){var o=ze(t),r={top:/n/.test(e)?o.bottom-n.height:o.top,left:/w/.test(e)?o.right-n.width:o.left,bottom:/s/.test(e)?o.top+n.height:o.bottom,right:/e/.test(e)?o.left+n.width:o.right},a=i?ze(i):r,s={top:Ml(r.top,a.top),left:Ml(r.left,a.left),bottom:Cl(r.bottom,a.bottom),right:Cl(r.right,a.right)};return ul(s)}function Os(e,t){return typeof e<"u"?e:y2}function _2(e,t){var n,i,o,r;return typeof t=="object"?(n=Os(t.left),i=Os(t.right),o=Os(t.top),r=Os(t.bottom)):n=i=o=r=Os(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function E2(e){return!(e.waypoints||e.type==="label")}function ib(e,t){var n;if(e.length===void 0?n=rt(e.children,E2):n=e,n.length)return _2(rn(n),t)}var Zo=Math.abs;function S2(e,t){return nb(ze(t),ze(e))}var R2=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Ei=30;function Pl(e,t){return t=t||[],e.children.filter(function(n){A(n,"bpmn:Lane")&&(Pl(n,t),t.push(n))}),t}function Qo(e){return e.children.filter(function(t){return A(t,"bpmn:Lane")})}function Si(e){return Ra(e,R2)||e}function C2(e,t){var n=Si(e),i=A(n,"bpmn:Process")?[]:[n],o=Pl(n,i),r=ze(e),a=ze(t),s=S2(e,t),c=[],l=xn(e);return o.forEach(function(u){if(u!==e){var p=l?0:s.top,f=l?s.right:0,d=l?0:s.bottom,m=l?s.left:0,h=ze(u);s.top&&(Zo(h.bottom-r.top)<10&&(d=a.top-h.bottom),Zo(h.top-r.top)<5&&(p=a.top-h.top)),s.left&&(Zo(h.right-r.left)<10&&(f=a.left-h.right),Zo(h.left-r.left)<5&&(m=a.left-h.left)),s.bottom&&(Zo(h.top-r.bottom)<10&&(p=a.bottom-h.top),Zo(h.bottom-r.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(Zo(h.left-r.right)<10&&(m=a.right-h.left),Zo(h.right-r.right)<5&&(f=a.right-h.right)),(p||f||d||m)&&c.push({shape:u,newBounds:b2(u,{top:p,right:f,bottom:d,left:m})})}}),c}var M2=500;function ld(e,t){de.call(this,e);function n(i,o){var r=xn(i),a=Qo(o),s=[],c=[],l=[],u=[];if(kr(a,function(g){return r?g.y>i.y?c.push(g):s.push(g):g.x>i.x?u.push(g):l.push(g),g.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,m,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&&(m=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(m.movingShapes,m.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",M2,function(i){var o=i.context,r=o.hints,a=o.shape,s=o.oldParent;A(a,"bpmn:Lane")&&(r&&r.nested||n(a,s))})}ld.$inject=["eventBus","spaceTool"],Te(ld,de);var ob=500;function Tl(e,t){t.invoke(de,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",ob,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return rb(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",ob,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;rb(a,P2(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}Tl.$inject=["bpmnReplace","injector"],Te(Tl,de),Tl.prototype._replaceShape=function(e){var t=A2(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function A2(e){var t=he(e),n=t.eventDefinitions;return n&&n[0]}function rb(e,t){return!nt(e)&&A(e,"bpmn:BoundaryEvent")&&!t}function P2(e,t){return e.indexOf(t)!==-1}var kl=Math.round,T2=Math.max;function k2(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 O2(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var ab=10;function D2(e,t){var n,i;for(n=0;i=e[n];n++)if(_s(i,t)<=ab)return{point:e[n],bendpoint:!0,index:n};return null}function L2(e,t){var n=pv(k2(t,ab),O2(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=T2(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:kl(i.x+o.x)/2,y:kl(i.y+o.y)/2},index:i.segment2}:{point:{x:kl(i.x),y:kl(i.y)},index:i.segment2}:null}function ud(e,t){return D2(e,t)||L2(e,t)}function pd(e,t,n){de.call(this,e);function i(o,r,a){var s=r.waypoints,c,l,u,p,f,d,m,h=o.outgoing.slice(),g=o.incoming.slice(),w;Ue(a.width)?w=qe(a):w=a;var x=ud(s,w);if(x){if(c=s.slice(0,x.index),l=s.slice(x.index+(x.bendpoint?1:0)),!c.length||!l.length)return;u=x.bendpoint?s[x.index]:w,(c.length===1||!sb(o,c[c.length-1]))&&c.push(cb(u)),(l.length===1||!sb(o,l[0]))&&l.unshift(cb(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?m=n.connect(o,f,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||w),m=r));var y=[].concat(d&&rt(g,function(v){return v.source===d.source})||[],m&&rt(h,function(v){return v.target===m.target})||[]);y.length&&n.removeElements(y)}this.preExecute("elements.move",function(o){var r=o.newParent,a=o.shapes,s=o.delta,c=a[0];if(!(!c||!r)){r&&r.waypoints&&(o.newParent=r=r.parent);var l=qe(c),u={x:l.x+s.x,y:l.y+s.y},p=It(r.children,function(f){var d=t.canInsert(a,f);return d&&ud(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)}Te(pd,de),pd.$inject=["eventBus","bpmnRules","modeling"];function sb(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 cb(e){return U({},e)}function fd(e,t){de.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,o=i.connection,r=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&Ma(o)){var c=[];A(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&Ma(l)):c=a.incoming.filter(l=>l!==o&&Ma(l)&&A(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,o=i.newShape;if(A(o,"bpmn:EventBasedGateway")){var r=o.outgoing.filter(Ma).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(Ma).forEach(function(s){const c=a.incoming.filter(Ma).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}fd.$inject=["eventBus","modeling"],Te(fd,de);function Ma(e){return A(e,"bpmn:SequenceFlow")}var Ol=1500,lb=2e3;function ub(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"],Ol,function(i){var o=i.context,r=o.shape||i.shape,a=i.hover;A(a,"bpmn:Lane")&&!it(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Si(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(r.labelTarget||it(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"],Ol,function(i){var o=i.hover;A(o,"bpmn:Lane")&&(i.hover=Si(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Ol,function(i){var o=i.context,r=i.hover,a=o.type;A(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Si(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Ol,function(i){var o=i.context,r=o.start;A(r,"bpmn:Lane")&&(o.start=Si(r)||r)}),t.on("shape.move.start",lb,function(i){var o=i.shape;A(o,"bpmn:Lane")&&(i.shape=Si(o)||o)}),t.on("spaceTool.move",lb,function(i){var o=i.hover;o&&A(o,"bpmn:Lane")&&(i.hover=Si(o))})}ub.$inject=["elementRegistry","eventBus","canvas"];var pb=770;function dd(e,t,n,i){n.invoke(de,this);function o(s,c){var l=he(s),u=c.categoryValue||l.categoryValueRef;u||(u=Zv(e,l));var p=c.category||u.$parent||Xv(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=he(s),u=c.categoryValue||l.categoryValueRef,p=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=p,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;A(l,"bpmn:Group")&&o(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;A(l,"bpmn:Group")&&r(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=he(l);if(!(!A(l,"bpmn:Group")||l.labelTarget)){var p=c.categoryValue=u.categoryValueRef;p&&(c.category=p.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!A(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,f=he(l);p&&(f.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!A(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!he(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!A(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!he(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||he(l).categoryValueRef||o(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||r(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",pb,function(s){var c=s.descriptor,l=s.element;if(!(!A(l,"bpmn:Group")||l.labelTarget)){var u=he(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",pb,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})}dd.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Te(dd,de);function hd(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 fb(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=hd(i,o,r,a),l=hd(i,o,r,s),u;c&&l?db(c,r)>db(l,r)?u=l:u=c:u=c||l,i.original=u}function n(i){var o=i.waypoints;t(o[0],o[1],qe(i.source)),t(o[o.length-1],o[o.length-2],qe(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}fb.$inject=["eventBus"];function db(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function gd(e){de.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,o=he(i),r=gt(i);if(it(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}gd.$inject=["eventBus"],Te(gd,de);function hb(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function gb(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function I2(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 B2(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 md(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=B2([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=md(e,t),i={x:n.x-e.x,y:n.y-e.y};return hb(i)}function Ds(e,t){return hb({x:e.x-t.x,y:e.y-t.y})}var yb=Math.sqrt,vb=Math.min,N2=Math.max,bb=Math.abs;function xb(e){return Math.pow(e,2)}function Ls(e,t){return yb(xb(e.x-t.x)+xb(e.y-t.y))}function $2(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],_b(i,o)?l=[i]:(r=Ls(e,i),a=Ls(e,o),c=vb(r,a),l=F2(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:_b(i,l[0])?n:n+1}),l.length===2&&(s=H2(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Ls(i,s)/Ls(i,o)}),p=Ls(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function F2(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 m=yb(d),h=-p+m,g=-p-m,w={x:e.x-o*h,y:e.y-r*h};if(d===0)return[w];var x={x:e.x-o*g,y:e.y-r*g};return[w,x].filter(function(y){return j2(y,e,t)})}function j2(e,t,n){return wb(e.x,t.x,n.x)&&wb(e.y,t.y,n.y)}function wb(e,t,n){return e>=vb(t,n)-Dl&&e<=N2(t,n)+Dl}function H2(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Dl=.1;function _b(e,t){return bb(e.x-t.x)<=Dl&&bb(e.y-t.y)<=Dl}function z2(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=Sb(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 Eb(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=$2(e,n),c=s.segmentIndex,l=z2(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Rb(n,c),p=Rb(t,l),f=s.position,d=V2(u,f),m=G2(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,g=s.bendpointIndex,w=n[g];if(t.indexOf(w)!==-1)return a;if(h===0){var x=t[g];return o=x.x-s.position.x,r=x.y-s.position.y,{delta:{x:o,y:r},point:{x:e.x+o,y:e.y+r}}}h<0&&g!==0&&g<n.length-1&&(d=Sb(n,g))}var y={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},v=I2({x:e.x-f.x,y:e.y-f.y},m);return o=y.x+v.x-e.x,r=y.y+v.y-e.y,{point:vo(y),delta:vo({x:o,y:r})}}function Sb(e,t){var n=Ds(e[t-1],e[t]),i=Ds(e[t],e[t+1]),o=n/(n+i);return o}function G2(e,t){var n=gb(e),i=gb(t);return i-n}function Rb(e,t){return[e[t],e[t+1]]}function V2(e,t){var n=Ds(e[0],e[1]),i=Ds(e[0],t);return n===0?0:i/n}function W2(e,t,n,i){var o=qe(e);return Eb(o,t,n,i).delta}function Is(e,t,n){var i=Ts(t),o=Ts(n),r=zi(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return vo({x:o.x+a.x,y:o.y+a.y})}function Cb(e,t,n){var i=Ts(e),o=Ts(t),r=Ts(n),a=zi(e,i),s=zi(i,o),c=U2(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 vo({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function U2(e,t,n){var i=ze(t),o=ze(n);if(q2(i,o))return null;var r=An(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=An(n,s),c!==r?null:a}function q2(e,t){return Y2(e,t)||K2(e,t)}function Y2(e,t){return e.right!==t.right&&e.left!==t.left}function K2(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Mb="name",Ab="text";function yd(e,t,n,i){de.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{he(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if(Mb in l&&t.updateLabel(c,l[Mb]),Ab in l&&A(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Ab]||"");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;nt(l)||!Xo(l)||mi(l)&&t.updateLabel(l,mi(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function r(a){var s=a.context,c=s.connection,l=c.label,u=U({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),W2(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=he(c);u&&Xo(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(!(!nt(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(mi(c)||"",{box:u,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=u.y!==c.y,m=c.y+c.height;s.newBounds={width:u.width,height:f,x:u.x,y:d?m-f:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(ml(c)){var p=c.label,f=qe(p),d=Q2(u),m=Z2(f,d),h=X2(m,u,l);t.moveShape(p,h)}})}Te(yd,de),yd.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function X2(e,t,n){var i=Is(e,t,n);return vo(zi(i,e))}function Z2(e,t){if(t.length){var n=J2(e,t);return md(e,n)}}function Q2(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 J2(e,t){var n=t.map(function(o){return{line:o,distance:mb(e,o)}}),i=Ui(n,"distance");return i[0].line}function ek(e,t,n,i){return Eb(e,t,n,i).point}function vd(e,t){de.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=U({},r.hints),c=r.newWaypoints||a.waypoints,l=r.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),ek(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)})})}Te(vd,de),vd.$inject=["eventBus","modeling"];function Ll(e,t,n){var i=Bl(e),o=Tb(i,t),r=i[0];return o.length?o[o.length-1]:Is(r.original||r,n,t)}function Il(e,t,n){var i=Bl(e),o=Tb(i,t),r=i[i.length-1];return o.length?o[0]:Is(r.original||r,n,t)}function bd(e,t,n){var i=Bl(e),o=Pb(t,n),r=i[0];return Is(r.original||r,o,t)}function xd(e,t,n){var i=Bl(e),o=Pb(t,n),r=i[i.length-1];return Is(r.original||r,o,t)}function Pb(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Bl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Tb(e,t){var n=In(e,nk);return rt(n,function(i){return tk(i,t)})}function tk(e,t){return An(t,e,1)==="intersect"}function nk(e){return e.original||e}function wd(e,t){de.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(ik(i,o)){var r=ok(i);r.incoming.forEach(function(a){var s=Il(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=Ll(a,o,i);t.reconnectStart(a,o,s)})}},!0)}wd.$inject=["eventBus","modeling"],Te(wd,de);function ik(e,t){return A(e,"bpmn:Participant")&&ut(e)&&A(t,"bpmn:Participant")&&!ut(t)}function ok(e){var t=xs([e]),n=[],i=[];return t.forEach(function(o){o!==e&&(o.incoming.forEach(function(r){A(r,"bpmn:MessageFlow")&&n.push(r)}),o.outgoing.forEach(function(r){A(r,"bpmn:MessageFlow")&&i.push(r)}))},[]),{incoming:n,outgoing:i}}const rk=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function kb(e){const t=he(e);if(!A(t,"bpmn:BoundaryEvent")&&!(A(t,"bpmn:StartEvent")&&$n(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:rk.some(i=>A(n[0],i))}function Ob(e){return A(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function _d(e,t){e.invoke(de,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!kb(o))return;const a=Ob(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=he(i).get(a),l=he(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}_d.$inject=["injector","modeling"],Te(_d,de);function Ed(e,t){de.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=gt(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}Te(Ed,de),Ed.$inject=["eventBus","modeling"];function Sd(e,t,n){de.call(this,e),this.preExecute("shape.delete",function(i){var o=i.context.shape;if(!(o.incoming.length!==1||o.outgoing.length!==1)){var r=o.incoming[0],a=o.outgoing[0];if(!(!A(r,"bpmn:SequenceFlow")||!A(a,"bpmn:SequenceFlow"))&&t.canConnect(r.source,a.target,r)){var s=ak(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}Te(Sd,de),Sd.$inject=["eventBus","bpmnRules","modeling"];function Aa(e){return e.original||e}function ak(e,t){var n=hd(Aa(e[e.length-2]),Aa(e[e.length-1]),Aa(t[1]),Aa(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Aa(e[0]),Aa(t[t.length-1])]}function Rd(e,t){de.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,o=i.parent;A(i,"bpmn:Participant")&&(n.collaborationRoot=o)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var o=t.makeProcess(),r=i.children.slice();t.moveElements(r,{x:0,y:0},o)}},!0)}Rd.$inject=["eventBus","modeling"],Te(Rd,de);function Cd(e,t,n,i){de.call(this,e);var o=i.get("dragging",!1);function r(c){var l=c.source,u=c.target,p=c.parent;if(p){var f,d;A(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(f="bpmn:MessageFlow")),A(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,m;d=n.canConnect(p,f),!(!d||d.type===u.type)&&(m=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=m,o&&s(u,m))}function s(c,l){var u=o.context(),p=u&&u.payload.previousSelection,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;G(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=It(p.outgoing,aa({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})})}Te(Cd,de),Cd.$inject=["eventBus","modeling","bpmnRules","injector"];function Nl(e,t,n,i,o,r){i.invoke(de,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=r,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=ei(l,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];G(s.closure.topLevel,function(f){$n(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})})}Te(Nl,de),Nl.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,o=this._selection;G(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)},Nl.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var sk=1500,ck={width:140,height:120},Md={width:300,height:60},Ad={width:60,height:300},$l={width:300,height:150},Fl={width:150,height:300},Db={width:140,height:120},Lb={width:100,height:40};function Ib(e){e.on("resize.start",sk,function(t){var n=t.context,i=n.shape,o=n.direction,r=n.balanced;(A(i,"bpmn:Lane")||A(i,"bpmn:Participant"))&&(n.resizeConstraints=dk(i,o,r)),A(i,"bpmn:SubProcess")&&ut(i)&&(n.minDimensions=Db),A(i,"bpmn:TextAnnotation")&&(n.minDimensions=Lb)})}Ib.$inject=["eventBus"];var Jo=Math.abs,lk=Math.min,uk=Math.max;function Bb(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function Pa(e,t,n){return Bb(e,t,n,lk)}function Ta(e,t,n){return Bb(e,t,n,uk)}var pk={top:20,left:50,right:20,bottom:20},fk={top:50,left:20,right:20,bottom:20};function dk(e,t,n){var i=Si(e),o=!0,r=!0,a=Pl(i,[i]),s=ze(e),c={},l={},u=xn(e),p=u?Md:Ad;/n/.test(t)?l.top=s.bottom-p.height:/e/.test(t)?l.right=s.left+p.width:/s/.test(t)?l.bottom=s.top+p.height:/w/.test(t)&&(l.left=s.right-p.width),a.forEach(function(m){var h=ze(m);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&&Jo(s.top-h.bottom)<10&&Ta(c,"top",h.top+p.height),Jo(s.top-h.top)<5&&Pa(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&Jo(s.right-h.left)<10&&Pa(c,"right",h.right-p.width),Jo(s.right-h.right)<5&&Ta(l,"right",h.left+p.width)),/s/.test(t)&&(n&&Jo(s.bottom-h.top)<10&&Pa(c,"bottom",h.bottom-p.height),Jo(s.bottom-h.bottom)<5&&Ta(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&Jo(s.left-h.right)<10&&Ta(c,"left",h.left+p.width),Jo(s.left-h.left)<5&&Pa(l,"left",h.right-p.width))});var f=i.children.filter(function(m){return!m.hidden&&!m.waypoints&&(A(m,"bpmn:FlowElement")||A(m,"bpmn:Artifact"))}),d=u?pk:fk;return f.forEach(function(m){var h=ze(m);/n/.test(t)&&(!u||o)&&Pa(l,"top",h.top-d.top),/e/.test(t)&&(u||r)&&Ta(l,"right",h.right+d.right),/s/.test(t)&&(!u||r)&&Ta(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||o)&&Pa(l,"left",h.left-d.left)}),{min:l,max:c}}function Nb(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function ka(e){return e.originalEvent||e.srcEvent}function Pd(e){Nb(e),Nb(ka(e))}function Lr(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 $b(){return/mac/i.test(navigator.platform)}function Fb(e,t){return(ka(e)||e).button===t}function er(e){return Fb(e,0)}function hk(e){return Fb(e,1)}function Bs(e){var t=ka(e)||e;return er(e)?$b()?t.metaKey:t.ctrlKey:!1}function jl(e){var t=ka(e)||e;return er(e)&&t.shiftKey}var jb=1001;function Hb(e,t){e.on("resize.start",jb+500,function(n){var i=n.context,o=i.shape;(A(o,"bpmn:Lane")||A(o,"bpmn:Participant"))&&(i.balanced=!Bs(n))}),e.on("resize.end",jb,function(n){var i=n.context,o=i.shape,r=i.canExecute,a=i.newBounds;if(A(o,"bpmn:Lane")||A(o,"bpmn:Participant"))return r&&(a=mv(a),t.resizeLane(o,a,i.balanced)),!1})}Hb.$inject=["eventBus","modeling"];var gk=500;function Td(e,t,n,i,o){n.invoke(de,this);function r(u){return it(u,["bpmn:ReceiveTask","bpmn:SendTask"])||mk(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!It(f,aa({id:u.id}))}function s(u){if(A(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(A(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(A(u,"bpmn:MessageEventDefinition"))return"messageRef";if(A(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(it(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(it(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=he(p),d=c(f),m;d&&!a(d)&&(m=e.getDefinitions().get("rootElements"),en(m,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");Jt(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!r(f))){var d=he(f),m=c(d);m&&(p.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",gk,function(u){var p=u.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,o.create(d.$type))),l(f,d),delete p.referencedRootElement)})}Td.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Te(Td,de);function mk(e,t){return We(t)||(t=[t]),Io(t,function(n){return _a(e,n)})}var zb=Math.max;function Gb(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,o=t.start,r={};return G(n,function(a){var s=a.id;A(a,"bpmn:Participant")&&(r[s]=vk(a,i,o)),A(a,"bpmn:Lane")&&(r[s]=xn(a)?Md:Ad),A(a,"bpmn:SubProcess")&&ut(a)&&(r[s]=Db),A(a,"bpmn:TextAnnotation")&&(r[s]=Lb),A(a,"bpmn:Group")&&(r[s]=ck)}),r})}Gb.$inject=["eventBus"];function yk(e){return e==="x"}function vk(e,t,n){var i=xn(e);if(!wk(e))return i?$l:Fl;var o=yk(t),r={};return o?i?r=$l:r={width:xk(e,n,o),height:Fl.height}:i?r={width:$l.width,height:bk(e,n,o)}:r=Fl,r}function bk(e,t,n){var i;return i=_k(e,t,n),zb($l.height,i)}function xk(e,t,n){var i;return i=Ek(e,t,n),zb(Fl.width,i)}function wk(e){return!!Qo(e).length}function _k(e,t,n){var i=Qo(e),o;return o=kd(i,t,n),e.height-o.height+Md.height}function Ek(e,t,n){var i=Qo(e),o;return o=kd(i,t,n),e.width-o.width+Ad.width}function kd(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=Qo(o),r.length?kd(r,t,n):o}var Vb="_plane";function Wb(e){var t=e.id;return Sk(t)}function to(e){var t=e.id;return A(e,"bpmn:SubProcess")?Ub(t):t}function Ir(e){return Ub(e)}function Hl(e){var t=gt(e);return A(t,"bpmndi:BPMNPlane")}function Ub(e){return e+Vb}function Sk(e){return e.replace(new RegExp(Vb+"$"),"")}var qb=400,Rk=600,Yb={x:180,y:160};function _o(e,t,n,i,o,r,a){de.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=o,this._bpmnjs=r,this._elementRegistry=a;var s=this;function c(p){return A(p,"bpmn:SubProcess")&&!ut(p)}function l(p){var f=p.shape,d=p.newRootElement,m=he(f);d=s._addDiagram(d||m),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=he(f);s._removeDiagram(d);var m=p.newRootElement=a.get(to(d));e.removeRootElement(m)}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;G(f,function(d){if(c(d)){var m=a.get(to(d));if(!(!m||!d.children||!d.children.length)){var h=Kb(d);s._showRecursively(h),s._moveChildrenToShape(h,m)}}})},!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;!A(f,"bpmn:SubProcess")||!ut(f)||G(Cs([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(to(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(to(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,m=e.findRoot(to(f));if(!(!d||!m)){var h=d.children;n.moveElements(h,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(A(f,"bpmn:SubProcess")){var d=p.properties,m=p.oldProperties,h=m.id,g=d.id;if(h!==g){if(Hl(f)){a.updateId(f,Ir(g)),a.updateId(h,g);return}var w=a.get(Ir(h));w&&a.updateId(Ir(h),Ir(g))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(A(f,"bpmn:SubProcess")){var d=p.properties,m=p.oldProperties,h=m.id,g=d.id;if(h!==g){if(Hl(f)){a.updateId(f,Ir(h)),a.updateId(g,h);return}var w=a.get(Ir(g));w&&a.updateId(w,Ir(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Hl(f)){var d=f,m=a.get(Wb(d));!m||m===d||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",qb,function(p){var f=p.shape;A(f,"bpmn:SubProcess")&&(ut(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",qb,function(p){var f=p.shape;A(f,"bpmn:SubProcess")&&(ut(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",Rk,function(p){var f=p.shape;if(A(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(ut(f))s._moveChildrenToShape(d.children.slice(),f),G(Cs(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),G(h.associations,g=>{n.moveConnection(g,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var m=Kb(f);s._moveChildrenToShape(m,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var m=to(f),h=a.get(m);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,m=p.elements,h=d.parent,g=A(gt(h),"bpmndi:BPMNPlane");if(g){var w=Wb(h),x=It(m,function(y){return y.id===w});x&&(f.parent=x.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}Te(_o,de),_o.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var o=rn(i),r;if(!t.x)r={x:Yb.x-o.x,y:Yb.y-o.y};else{var a=qe(t),s=qe(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},_o.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Fv(e).map(i=>i.annotation));n.size&&G(Cs(e.children),i=>{n.has(i.annotation)&&G(i.associations,o=>{t.removeConnection(o)})})},_o.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(o){o.hidden=!!t,i=i.concat(o),o.children&&(i=i.concat(n._showRecursively(o.children,o.collapsed||t)))}),i},_o.prototype._addDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),n.push(e.di.$parent),e},_o.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),o=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=o;var r=n.createRoot({id:to(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},_o.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=It(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},_o.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function Ck(e){var t=[];return G(Cs(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Kb(e){return e.children.slice().concat(Ck(e.children)).concat(Mk(e))}function Mk(e){return Bf(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Od(e,t){e.invoke(de,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,o=n.context.newShape;if(!(!A(o,"bpmn:SubProcess")||A(o,"bpmn:AdHocSubProcess")||!(A(i,"bpmn:Task")||A(i,"bpmn:CallActivity"))||!ut(o))){var r=Ak(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}Od.$inject=["injector","modeling"],Te(Od,de);function Ak(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Dd(e,t){de.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;A(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&A(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,o=i.shape,r=i.hints||{};if(!(!A(o,"bpmn:TextAnnotation")||r.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,mi(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}}})}Te(Dd,de),Dd.$inject=["eventBus","textRenderer"];function Ld(e,t){de.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(ut(i))return;var o=xs(i);o.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();G(s,function(l){r(l,!0)}),G(c,function(l){r(l,!1)})});function r(a,s){o.indexOf(a.source)!==-1&&o.indexOf(a.target)!==-1||A(a,"bpmn:Association")&&(A(a.source,"bpmn:TextAnnotation")||A(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,qe(i)):t.reconnectStart(a,i,qe(i)))}},!0)}Te(Ld,de),Ld.$inject=["eventBus","modeling"];var Id=500;function Bd(e,t,n){de.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function o(a,s){var c=a.children,l=s,u,p;return u=Pk(c).concat([a]),p=ib(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"],Id,function(a){var s=a.context,c=s.shape;A(c,"bpmn:SubProcess")&&(c.collapsed?gt(c).isExpanded=!1:(i(c.children),gt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Id,function(a){var s=a.context,c=s.shape;c.collapsed?gt(c).isExpanded=!1:gt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Id,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"})})}Te(Bd,de),Bd.$inject=["eventBus","elementFactory","modeling"];function Pk(e){return e.filter(function(t){return!t.hidden})}function Nd(e,t,n,i){t.invoke(de,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;nt(a)||(A(a,"bpmn:Participant")&&ut(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(o){var r=o.context,a=r.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var o=e.getRootElement(),r=o.businessObject;A(o,"bpmn:Collaboration")&&n.ids.unclaim(r.id)})}Te(Nd,de),Nd.$inject=["canvas","injector","moddle","modeling"];function $d(e,t){de.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;Tk(o,r)&&t.updateProperties(r,{default:null})})}Te($d,de),$d.$inject=["eventBus","modeling"];function Tk(e,t){if(!A(e,"bpmn:SequenceFlow"))return!1;var n=he(t),i=he(e);return n.get("default")===i}var kk=500,Ok=5e3,Xb=["shape.create","shape.delete","shape.move","shape.resize"],Zb=[...Xb,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Fd(e,t){de.call(this,e);var n;function i(){return n=n||new Dk,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(Zb,Ok,function(){i()}),this.postExecuted(Zb,kk,function(){r()}),this.preExecute(Xb,function(a){var s=a.context,c=s.shape,l=o();!c||c.labelTarget||(A(c,"bpmn:Lane")&&l.addLane(c),A(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}Fd.$inject=["eventBus","modeling"],Te(Fd,de);function Dk(){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 Lk=500,Ik=5e3,Qb=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Jb=[...Qb,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function jd(e,t){de.call(this,e);var n;function i(){return n=n||new Bk,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(Jb,Ik,function(){i()}),this.postExecuted(Jb,Lk,function(){r()}),this.preExecute(Qb,function(a){var s=a.context.connection||a.context.shape,c=o();!s||s.labelTarget||(A(s,"bpmn:FlowElement")&&c.addFlowElement(s),A(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;A(s,"bpmn:Group")&&o().addGroup(s)})}jd.$inject=["eventBus","modeling"],Te(jd,de);function Bk(){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 Hd(e,t){de.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)Nk(r)&&!Fk(r)&&t.updateProperties(r,{isForCompensation:void 0})})}Te(Hd,de),Hd.$inject=["eventBus","modeling"];function Nk(e){const t=he(e);return t&&t.isForCompensation}function $k(e){return e&&A(e,"bpmn:BoundaryEvent")&&_a(e,"bpmn:CompensateEventDefinition")}function Fk(e){return e.incoming.filter(n=>$k(n.source)).length>0}const jk={__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",Kf],appendBehavior:["type",Xf],associationBehavior:["type",Qf],attachEventBehavior:["type",_l],artifactBehavior:["type",Zf],boundaryEventBehavior:["type",Jf],categoryRootElementReferenceBehavior:["type",ed],compensateBoundaryEventBehaviour:["type",td],createBehavior:["type",nd],createDataObjectBehavior:["type",id],createParticipantBehavior:["type",ad],dataInputAssociationBehavior:["type",sd],dataStoreBehavior:["type",cd],deleteLaneBehavior:["type",ld],detachEventBehavior:["type",Tl],dropOnFlowBehavior:["type",pd],eventBasedGatewayBehavior:["type",fd],fixHoverBehavior:["type",ub],groupBehavior:["type",dd],importDockingFix:["type",fb],isHorizontalFix:["type",gd],labelBehavior:["type",yd],layoutConnectionBehavior:["type",vd],messageFlowBehavior:["type",wd],nonInterruptingBehavior:["type",_d],removeElementBehavior:["type",Sd],removeEmbeddedLabelBoundsBehavior:["type",Ed],removeParticipantBehavior:["type",Rd],replaceConnectionBehavior:["type",Cd],replaceElementBehaviour:["type",Nl],resizeBehavior:["type",Ib],resizeLaneBehavior:["type",Hb],rootElementReferenceBehavior:["type",Td],spaceToolBehavior:["type",Gb],subProcessPlaneBehavior:["type",_o],subProcessStartEventBehavior:["type",Od],textAnnotationBehavior:["type",Dd],toggleCollapseConnectionBehaviour:["type",Ld],toggleElementCollapseBehaviour:["type",Bd],unclaimIdBehavior:["type",Nd],unsetDefaultFlowBehavior:["type",$d],updateFlowNodeRefsBehavior:["type",Fd],updateCategoryValueRefsBehavior:["type",jd],setCompensationActivityAfterPasteBehavior:["type",Hd]};function zd(e){this._commandStack=e.get("commandStack",!1)}zd.$inject=["injector"],zd.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const no={__init__:["rules"],rules:["type",zd]};function Ri(e){de.call(this,e),this.init()}Ri.$inject=["eventBus"],Te(Ri,de),Ri.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)})},Ri.prototype.init=function(){};function ex(e,t){var n=An(e,t,-15);return n!=="intersect"?n:null}function Tn(e){Ri.call(this,e)}Te(Tn,Ri),Tn.$inject=["eventBus"],Tn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return Hk(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 Gl(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Gl(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 dx(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return kt(i)&&!Vl(t,i)?!1:Lo(t,function(o){return kt(o)?Gl(o.source,o.target,o):o.host?Ns(o,o.host,null,n):Ud(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 sx(a)&&!n.includes(a.host)})?!1:Ns(n,t,null,i)||px(n,t,i)||fx(n,t)||Vl(n,t)}),this.addRule("shape.create",function(e){return Ud(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Ns(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return vx(n,t)})},Tn.prototype.canConnectMessageFlow=mx,Tn.prototype.canConnectSequenceFlow=yx,Tn.prototype.canConnectDataAssociation=qd,Tn.prototype.canConnectAssociation=hx,Tn.prototype.canConnectCompensationAssociation=gx,Tn.prototype.canMove=fx,Tn.prototype.canAttach=Ns,Tn.prototype.canReplace=px,Tn.prototype.canDrop=Oa,Tn.prototype.canInsert=Vl,Tn.prototype.canCreate=Ud,Tn.prototype.canConnect=Gl,Tn.prototype.canResize=dx,Tn.prototype.canCopy=vx;function Hk(e){return Gd(e)?null:it(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Gd(e){return!e||nt(e)}function tx(e){do{if(A(e,"bpmn:Process"))return he(e);if(A(e,"bpmn:Participant"))return he(e).processRef||he(e)}while(e=e.parent)}function Vd(e){return A(e,"bpmn:TextAnnotation")}function Wd(e){return A(e,"bpmn:Group")&&!e.labelTarget}function nx(e){return A(e,"bpmn:BoundaryEvent")&&io(e,"bpmn:CompensateEventDefinition")}function zl(e){return he(e).isForCompensation}function zk(e,t){var n=tx(e),i=tx(t);return n===i}function Gk(e){return A(e,"bpmn:InteractionNode")&&!A(e,"bpmn:BoundaryEvent")&&(!A(e,"bpmn:Event")||A(e,"bpmn:ThrowEvent")&&rx(e,"bpmn:MessageEventDefinition"))}function Vk(e){return A(e,"bpmn:InteractionNode")&&!zl(e)&&(!A(e,"bpmn:Event")||A(e,"bpmn:CatchEvent")&&rx(e,"bpmn:MessageEventDefinition"))&&!(A(e,"bpmn:BoundaryEvent")&&!io(e,"bpmn:MessageEventDefinition"))}function ix(e){for(var t=e;t=t.parent;){if(A(t,"bpmn:FlowElementsContainer"))return he(t);if(A(t,"bpmn:Participant"))return he(t).processRef}return null}function ox(e,t){var n=ix(e),i=ix(t);return n===i}function io(e,t){var n=he(e);return!!It(n.eventDefinitions||[],function(i){return A(i,t)})}function rx(e,t){var n=he(e);return(n.eventDefinitions||[]).every(function(i){return A(i,t)})}function Wk(e){return A(e,"bpmn:FlowNode")&&!A(e,"bpmn:EndEvent")&&!$n(e)&&!(A(e,"bpmn:IntermediateThrowEvent")&&io(e,"bpmn:LinkEventDefinition"))&&!nx(e)&&!zl(e)}function Uk(e){return A(e,"bpmn:FlowNode")&&!A(e,"bpmn:StartEvent")&&!A(e,"bpmn:BoundaryEvent")&&!$n(e)&&!(A(e,"bpmn:IntermediateCatchEvent")&&io(e,"bpmn:LinkEventDefinition"))&&!zl(e)}function qk(e){return A(e,"bpmn:ReceiveTask")||A(e,"bpmn:IntermediateCatchEvent")&&(io(e,"bpmn:MessageEventDefinition")||io(e,"bpmn:TimerEventDefinition")||io(e,"bpmn:ConditionalEventDefinition")||io(e,"bpmn:SignalEventDefinition"))}function Yk(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function ax(e,t){var n=Yk(t);return n.indexOf(e)!==-1}function Gl(e,t,n){if(Gd(e)||Gd(t))return null;if(!A(n,"bpmn:DataAssociation")){if(mx(e,t))return{type:"bpmn:MessageFlow"};if(yx(e,t))return{type:"bpmn:SequenceFlow"}}var i=qd(e,t);return i||(gx(e,t)?{type:"bpmn:Association",associationDirection:"One"}:hx(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Oa(e,t){return nt(e)||Wd(e)?!0:A(t,"bpmn:Participant")&&!ut(t)?!1:A(e,"bpmn:Participant")?A(t,"bpmn:Process")||A(t,"bpmn:Collaboration"):it(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:A(e,"bpmn:Lane")?A(t,"bpmn:Participant")||A(t,"bpmn:Lane"):A(e,"bpmn:BoundaryEvent")&&!Kk(e)?!1:A(e,"bpmn:FlowElement")&&!A(e,"bpmn:DataStoreReference")?A(t,"bpmn:FlowElementsContainer")?ut(t):it(t,["bpmn:Participant","bpmn:Lane"]):A(e,"bpmn:DataStoreReference")&&A(t,"bpmn:Collaboration")?Io(he(t).get("participants"),function(n){return!!n.get("processRef")}):it(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?it(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):A(e,"bpmn:MessageFlow")?A(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function Kk(e){return he(e).cancelActivity&&(cx(e)||lx(e))}function sx(e){return!nt(e)&&A(e,"bpmn:BoundaryEvent")}function Xk(e){return A(e,"bpmn:Lane")}function Zk(e){return sx(e)||A(e,"bpmn:IntermediateThrowEvent")&&cx(e)?!0:A(e,"bpmn:IntermediateCatchEvent")&&lx(e)}function cx(e){var t=he(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function lx(e){return ux(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function ux(e,t){return t.some(function(n){return io(e,n)})}function Qk(e){return A(e,"bpmn:ReceiveTask")&&It(e.incoming,function(t){return A(t.source,"bpmn:EventBasedGateway")})}function Ns(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return nt(o)||!Zk(o)||$n(t)||!A(t,"bpmn:Activity")||zl(t)||i&&!ex(i,t)||Qk(t)?!1:"attach"}function px(e,t,n){if(!t)return!1;var i={replacements:[]};return G(e,function(o){$n(t)||A(o,"bpmn:StartEvent")&&o.type!=="label"&&Oa(o,t)&&(sT(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(cT(o)||lT(o)||uT(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),ux(o,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&A(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"})),A(t,"bpmn:Transaction")||io(o,"bpmn:CancelEventDefinition")&&o.type!=="label"&&(A(o,"bpmn:EndEvent")&&Oa(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),A(o,"bpmn:BoundaryEvent")&&Ns(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function fx(e,t){return Io(e,Xk)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Oa(n,t)})}function Ud(e,t,n,i){return t?nt(e)||Wd(e)?!0:Oa(e,t)||Vl(e,t):!1}function dx(e,t,n){return A(e,"bpmn:SubProcess")?ut(e)&&(!t||t.width>=100&&t.height>=80):A(e,"bpmn:Lane")||A(e,"bpmn:Participant")?!0:Vd(e)?n?n==="e"||n==="w":!0:Wd(e)?!0:nt(e)?n?n==="e"||n==="w":!0:!1}function Jk(e,t){var n=Vd(e),i=Vd(t);return(n||i)&&n!==i}function hx(e,t){return ax(t,e)||ax(e,t)?!1:Jk(e,t)?!0:!!qd(e,t)}function gx(e,t){return ox(e,t)&&nx(e)&&A(t,"bpmn:Activity")&&!tO(t,e)&&!$n(t)}function mx(e,t){return xx(e)&&!xx(t)?!1:Gk(e)&&Vk(t)&&!zk(e,t)}function yx(e,t){return Wk(e)&&Uk(t)&&ox(e,t)&&!(A(e,"bpmn:EventBasedGateway")&&!qk(t))}function qd(e,t){return it(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&it(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:it(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&it(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Vl(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:it(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!nt(t)&&A(e,"bpmn:FlowNode")&&!A(e,"bpmn:BoundaryEvent")&&Oa(e,t.parent)}function Yd(e,t){return e&&t&&e.indexOf(t)!==-1}function vx(e,t){return nt(t)?!0:!(A(t,"bpmn:Lane")&&!Yd(e,t.parent)||A(t,"bpmn:MessageFlow")&&!eO(e,t))}function eO(e,t){var n=bx(t.source),i=bx(t.target);return Yd(e,n)&&Yd(e,i)}function bx(e){for(;e;e=e.parent)if(A(e,"bpmn:Participant"))return e;return null}function xx(e){return Ra(e,"bpmn:Process")||Ra(e,"bpmn:Collaboration")}function tO(e,t){return e.attachers.includes(t)}const nO={__depends__:[no],__init__:["bpmnRules"],bpmnRules:["type",Tn]};var iO=2e3;function wx(e,t){e.on("saveXML.start",iO,n);function n(){var i=t.getRootElements();G(i,function(o){var r=gt(o),a,s;a=xs([o]),a=rt(a,function(c){return c!==o&&!c.labelTarget}),s=In(a,gt),r.set("planeElement",s)})}}wx.$inject=["eventBus","canvas"];const oO={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",wx]};function Wl(e){de.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,o=i.shape||i.connection,r=i.parent,a=t.getOrdering(o,r);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,o=i.shape||i.connection,r=i.newParent||o.parent,a=t.getOrdering(o,r);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}Wl.prototype.getOrdering=function(e,t){return null},Te(Wl,de);function Kd(e,t){Wl.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=It(n,function(c){return it(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&&!it(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||A(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=o(a);c.containers&&(s=r(a,s,c.containers));var l=s.children.indexOf(a),u=jg(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}}}Kd.$inject=["eventBus","canvas"],Te(Kd,Wl);const rO={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Kd]};function $s(){}$s.prototype.get=function(){return this._data},$s.prototype.set=function(e){this._data=e},$s.prototype.clear=function(){var e=this._data;return delete this._data,e},$s.prototype.isEmpty=function(){return!this._data};const aO={clipboard:["type",$s]};var _x=1500;function Ex(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",_x,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",_x,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=Lr(a),c=document.elementFromPoint(s.x,s.y),sO(c)}}Ex.$inject=["elementRegistry","eventBus","injector"];function sO(e){return Pr(e,"svg, .djs-element",!0)}const cO={__init__:["hoverFix"],hoverFix:["type",Ex]};function lO(e){return!0}function Ul(e){return er(e)||hk(e)}var Sx=500;function Rx(e,t,n){var i=this;function o(P,D,N){if(!s(P,D)){var j,H,Q;N?H=t.getGraphics(N):(j=D.delegateTarget||D.target,j&&(H=j,N=t.get(H))),!(!H||!N)&&(Q=e.fire(P,{element:N,gfx:H,originalEvent:D}),Q===!1&&(D.stopPropagation(),D.preventDefault()))}}var r={};function a(P){return r[P]}function s(P,D){var N=l[P]||er;return!N(D)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":lO,"element.mousedown":Ul,"element.mouseup":Ul,"element.click":Ul,"element.dblclick":Ul};function u(P,D,N){var j=c[P];if(!j)throw new Error("unmapped DOM event name <"+P+">");return o(j,D,N)}var p="svg, .djs-element";function f(P,D,N,j){var H=r[N]=function(Q){o(N,Q)};j&&(l[N]=j),H.$delegate=ti.bind(P,p,D,H)}function d(P,D,N){var j=a(N);j&&ti.unbind(P,D,j.$delegate)}function m(P){G(c,function(D,N){f(P,N,D)})}function h(P){G(c,function(D,N){d(P,N,D)})}e.on("canvas.destroy",function(P){h(P.svg)}),e.on("canvas.init",function(P){m(P.svg)}),e.on(["shape.added","connection.added"],function(P){var D=P.element,N=P.gfx;e.fire("interactionEvents.createHit",{element:D,gfx:N})}),e.on(["shape.changed","connection.changed"],Sx,function(P){var D=P.element,N=P.gfx;e.fire("interactionEvents.updateHit",{element:D,gfx:N})}),e.on("interactionEvents.createHit",Sx,function(P){var D=P.element,N=P.gfx;i.createDefaultHit(D,N)}),e.on("interactionEvents.updateHit",function(P){var D=P.element,N=P.gfx;i.updateDefaultHit(D,N)});var g=S("djs-hit djs-hit-stroke"),w=S("djs-hit djs-hit-click-stroke"),x=S("djs-hit djs-hit-all"),y=S("djs-hit djs-hit-no-move"),v={all:x,"click-stroke":w,stroke:g,"no-move":y};function S(P,D){return D=U({stroke:"white",strokeWidth:15},D||{}),n.cls(P,["no-fill","no-border"],D)}function _(P,D){var N=v[D];if(!N)throw new Error("invalid hit type <"+D+">");return Ce(P,N),P}function T(P,D){Ke(P,D)}this.removeHits=function(P){var D=gs(".djs-hit",P);G(D,on)},this.createDefaultHit=function(P,D){var N=P.waypoints,j=P.isFrame,H;return N?this.createWaypointsHit(D,N):(H=j?"stroke":"all",this.createBoxHit(D,H,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,D){var N=bs(D);return _(N,"stroke"),T(P,N),N},this.createBoxHit=function(P,D,N){N=U({x:0,y:0},N);var j=Be("rect");return _(j,D),Ce(j,N),T(P,j),j},this.updateDefaultHit=function(P,D){var N=Rt(".djs-hit",D);if(N)return P.waypoints?If(N,P.waypoints):Ce(N,{width:P.width,height:P.height}),N},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Rx.$inject=["eventBus","elementRegistry","styles"];const ql={__init__:["interactionEvents"],interactionEvents:["type",Rx]};function Da(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var o=i.element;n.deselect(o)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}Da.$inject=["eventBus","canvas"],Da.prototype.deselect=function(e){if(this._selectedElements.has(e)){var t=this.get();this._selectedElements.delete(e),this._eventBus.fire("selection.changed",{oldSelection:t,newSelection:this.get()})}},Da.prototype.get=function(){return Array.from(this._selectedElements)},Da.prototype.isSelected=function(e){return this._selectedElements.has(e)},Da.prototype.select=function(e,t){var n=this.get();We(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?G(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Cx="hover",Mx="selected";function Ax(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,Cx)}),t.on("element.out",function(o){i(o.element,Cx)}),t.on("selection.changed",function(o){function r(l){i(l,Mx)}function a(l){n(l,Mx)}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)})}Ax.$inject=["canvas","eventBus"];function Px(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;We(l)?t.select(l):t.select(s.filter(uO))}}),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=It(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(er(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=jl(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}Px.$inject=["eventBus","selection","canvas","elementRegistry"];function uO(e){return!e.hidden}const Ci={__init__:["selectionVisuals","selectionBehavior"],__depends__:[ql],selection:["type",Da],selectionVisuals:["type",Ax],selectionBehavior:["type",Px]};var pO=/^djs-cursor-.*$/;function Yl(e){var t=Ct(document.body);t.removeMatching(pO),e&&t.add("djs-cursor-"+e)}function Tx(){Yl(null)}var fO=5e3;function kx(e,t){t=t||"element.click";function n(){return!1}return e.once(t,fO,n),function(){e.off(t,n)}}var dO=["c","C"],hO=["v","V"],gO=["d","D"],mO=["x","X"],yO=["y","Y"],Ox=["z","Z"];function vO(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function oi(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function yn(e,t){return e=We(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Xd(e){return e.shiftKey}function bO(e){return oi(e)&&yn(dO,e)}function xO(e){return oi(e)&&yn(hO,e)}function wO(e){return oi(e)&&yn(gO,e)}function _O(e){return oi(e)&&yn(mO,e)}function EO(e){return oi(e)&&!Xd(e)&&yn(Ox,e)}function SO(e){return oi(e)&&(yn(yO,e)||yn(Ox,e)&&Xd(e))}var La=Math.round,Dx="djs-drag-active";function Br(e){e.preventDefault()}function RO(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function CO(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Lx(e,t,n,i){var o={threshold:5,trapClick:!0},r;function a(y){var v=t.viewbox(),S=t._container.getBoundingClientRect();return{x:v.x+(y.x-S.left)/v.scale,y:v.y+(y.y-S.top)/v.scale}}function s(y,v){v=v||r;var S=e.createEvent(U({},v.payload,v.data,{isTouch:v.isTouch}));return e.fire("drag."+y,S)===!1?!1:e.fire(v.prefix+"."+y,S)}function c(y){var v=y.filter(function(S){return i.get(S.id)});v.length&&n.select(v)}function l(y,v){var S=r.payload,_=r.displacement,T=r.globalStart,P=Lr(y),D=zi(P,T),N=r.localStart,j=a(P),H=zi(j,N);if(!r.active&&(v||CO(D)>r.threshold)){if(U(S,{x:La(N.x+_.x),y:La(N.y+_.y),dx:0,dy:0},{originalEvent:y}),s("start")===!1)return g();r.active=!0,r.keepSelection||(S.previousSelection=n.get(),n.select(null)),r.cursor&&Yl(r.cursor),t.addMarker(t.getRootElement(),Dx)}Pd(y),r.active&&(U(S,{x:La(j.x+_.x),y:La(j.y+_.y),dx:La(H.x),dy:La(H.y)},{originalEvent:y}),s("move"))}function u(y){var v,S=!0;r.active&&(y&&(r.payload.originalEvent=y,Pd(y)),S=s("end")),S===!1&&s("rejected"),v=w(S!==!0),s("ended",v)}function p(y){yn("Escape",y)&&(Br(y),g())}function f(y){var v;r.active&&(v=kx(e),setTimeout(v,400),Br(y)),u(y)}function d(y){l(y)}function m(y){var v=r.payload;v.hoverGfx=y.gfx,v.hover=y.element,s("hover")}function h(y){s("out");var v=r.payload;v.hoverGfx=null,v.hover=null}function g(y){var v;if(r){var S=r.active;S&&s("cancel"),v=w(y),S&&s("canceled",v)}}function w(y){var v,S;s("cleanup"),Tx(),r.trapClick?S=f:S=u,$e.unbind(document,"mousemove",l),$e.unbind(document,"dragstart",Br),$e.unbind(document,"selectstart",Br),$e.unbind(document,"mousedown",S,!0),$e.unbind(document,"mouseup",S,!0),$e.unbind(document,"keyup",p),$e.unbind(document,"touchstart",d,!0),$e.unbind(document,"touchcancel",g,!0),$e.unbind(document,"touchmove",l,!0),$e.unbind(document,"touchend",u,!0),e.off("element.hover",m),e.off("element.out",h),t.removeMarker(t.getRootElement(),Dx);var _=r.payload.previousSelection;return y!==!1&&_&&!n.get().length&&c(_),v=r,r=null,v}function x(y,v,S,_){r&&g(!1),typeof v=="string"&&(_=S,S=v,v=null),_=U({},o,_||{});var T=_.data||{},P,D,N,j,H;if(_.trapClick?j=f:j=u,y?(P=ka(y)||y,D=Lr(y),Pd(y),P.type==="dragstart"&&Br(P)):(P=null,D={x:0,y:0}),N=a(D),v||(v=N),H=RO(P),r=U({prefix:S,data:T,payload:{},globalStart:D,displacement:zi(v,N),localStart:N,isTouch:H},_),_.manual||(H?($e.bind(document,"touchstart",d,!0),$e.bind(document,"touchcancel",g,!0),$e.bind(document,"touchmove",l,!0),$e.bind(document,"touchend",u,!0)):($e.bind(document,"mousemove",l),$e.bind(document,"dragstart",Br),$e.bind(document,"selectstart",Br),$e.bind(document,"mousedown",j,!0),$e.bind(document,"mouseup",j,!0)),$e.bind(document,"keyup",p),e.on("element.hover",m),e.on("element.out",h)),s("init")===!1)return g(),!1;_.autoActivate&&l(y,!0)}e.on("diagram.destroy",g),this.init=x,this.move=l,this.hover=m,this.out=h,this.end=u,this.cancel=g,this.context=function(){return r},this.setOptions=function(y){U(o,y)}}Lx.$inject=["eventBus","canvas","selection","elementRegistry"];const Eo={__depends__:[cO,Ci],dragging:["type",Lx]};function Nr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Nr.prototype.next=function(){return this._prefix+ ++this._counter};const MO=new Nr("ps");var AO=["marker-start","marker-mid","marker-end"],PO=["circle","ellipse","line","path","polygon","polyline","path","rect"];function tr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}tr.$inject=["elementRegistry","eventBus","canvas","styles"],tr.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")},tr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},tr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=Mf(n);return this._cloneMarkers(Yo(o),i),Ce(o,this._styles.cls(i,[])),Ke(t,o),Ce(o,"data-preview-support-element-id",e.id),o},tr.prototype.addFrame=function(e,t){var n=Be("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Ke(t,n),Ce(n,"data-preview-support-element-id",e.id),n},tr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),DO(e)&&AO.forEach(function(o){if(Ce(e,o)){var r=TO(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},tr.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,MO.next()].join("-"),a=Rt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Mf(n);s.id=r,lt(s).add(o);var c=Rt(":scope > defs",e);c||(c=Be("defs"),Ke(e,c)),Ke(c,s);var l=OO(s.id);Ce(t,i,l)};function TO(e,t,n){var i=kO(Ce(e,t));return Rt("marker#"+i,n||document)}function kO(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function OO(e){return"url(#"+e+")"}function DO(e){return PO.indexOf(e.nodeName)!==-1}const Ia={__init__:["previewSupport"],previewSupport:["type",tr]};var LO="drop-ok",Ix="drop-not-ok",Bx="attach-ok",Nx="new-parent",$x="create",IO=2e3;function Fx(e,t,n,i,o){function r(c,l,u,p,f){if(!l)return!1;c=rt(c,function(x){var y=x.labelTarget;return!x.parent&&!(nt(x)&&c.indexOf(y)!==-1)});var d=It(c,function(x){return!kt(x)}),m=!1,h=!1,g=!1;Hx(c)&&(m=o.allowed("shape.attach",{position:u,shape:d,target:l})),m||(Hx(c)?g=o.allowed("shape.create",{position:u,shape:d,source:p,target:l}):g=o.allowed("elements.create",{elements:c,position:u,target:l}));var w=f.connectionTarget;return g||m?(d&&p&&(h=o.allowed("connection.create",{source:w===p?d:p,target:w===p?p:d,hints:{targetParent:l,targetAttach:m}})),{attach:m,connect:h}):g===null||m===null?null:!1}function a(c,l){[Bx,LO,Ix,Nx].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 m={x:c.x,y:c.y},h=l.canExecute=p&&r(u,p,m,f,d);p&&h!==null&&(l.target=p,h&&h.attach?a(p,Bx):a(p,h?Nx:Ix))}),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,m=l.canExecute,h=m&&m.attach,g=m&&m.connect,w=l.hints||{};if(m===!1||!d)return!1;jx(c);var x={x:c.x,y:c.y};g?p=i.appendShape(u,p,x,d,{attach:h,connection:g===!0?{}:g,connectionTarget:w.connectionTarget}):(f=i.createElements(f,x,d,U({},w,{attach:h})),p=It(f,function(y){return!kt(y)})),U(l,{elements:f,shape:p}),U(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===$x&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],IO,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){We(l)||(l=[l]);var p=It(l,function(m){return!kt(m)});if(p){u=U({elements:l,hints:{},shape:p},u||{}),G(l,function(m){Ue(m.x)||(m.x=0),Ue(m.y)||(m.y=0)});var f=rt(l,function(m){return!m.hidden}),d=rn(f);G(l,function(m){kt(m)&&(m.waypoints=In(m.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),U(m,{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2})}),t.init(c,$x,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}Fx.$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 Hx(e){return e&&e.length===1&&!kt(e[0])}var BO=750;function zx(e,t,n,i,o){function r(a){var s=Be("g");Ce(s,o.cls("djs-drag-group",["no-events"]));var c=Be("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(Yo(u),l)):(u=n._createContainer("shape",c),n.drawShape(Yo(u),l),Pn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",BO,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(),Ke(p,u)),Pn(u,a.x,a.y)):on(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&on(c)})}zx.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Kl={__depends__:[Eo,Ia,no,Ci],__init__:["create","createPreview"],create:["type",Fx],createPreview:["type",zx]};function Zd(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)})}Zd.$inject=["eventBus"],Zd.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||NO(0,0)};function NO(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 Fs={__init__:["mouse"],mouse:["type",Zd]};var Gx=2e3;function ri(e,t,n,i,o,r,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=o,this._modeling=r,this._mouse=a,this._rules=s,o.on("copyPaste.copyElement",function(c){var l=c.descriptor,u=c.element,p=c.elementsSet;l.priority=1,l.id=u.id,p.has(u.parent)&&(l.parent=u.parent.id),$O(u)&&(l.priority=2,l.host=u.host.id),kt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=FO(u)),nt(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),G(["x","y","width","height"],function(f){Ue(u[f])&&(l[f]=u[f])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",Gx,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",Gx,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;U(l,{createElementsBehavior:!1})})}ri.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],ri.prototype.copy=function(e,t={}){var n,i;return We(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(We(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},ri.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var o=t.hints,r=this._createElements(i);if(t.element&&t.point)return this._paste(r,t.element,t.point,o);this._create.start(this._mouse.getLastMoveEvent(),r,{hints:o})}}},ri.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},ri.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(o){return n[o.id]});return i.length>0&&this._modeling.removeElements(i),t},ri.prototype._getElementIdsFromTree=function(e){var t={};return G(e,function(n){G(n,function(i){i.id&&(t[i.id]=!0)})}),t},ri.prototype._paste=function(e,t,n,i){G(e,function(r){Ue(r.x)||(r.x=0),Ue(r.y)||(r.y=0)});var o=rn(e);return G(e,function(r){kt(r)&&(r.waypoints=In(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),U(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,U({},i))},ri.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return G(e,function(r,a){r=Ui(r,"priority"),G(r,function(s){var c=U({},qi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(kt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),o.push(l);return}if(nt(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),o.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),o.push(l)})}),o},ri.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(qi(e,["id"]));return t},ri.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(qi(e,["id"]));return t},ri.prototype.createShape=function(e){var t=this._elementFactory.createShape(qi(e,["id"]));return t},ri.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(kt(e)&&(!n.has(e.source)||!n.has(e.target))||nt(e)&&!n.has(e.labelTarget))},ri.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=sl(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 m={element:p,depth:f};o.push(m),r.set(p,m);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}kr(a,function(p,f,d){if(nt(p))return;G(p.labels,function(g){c(g,d)});function m(g){g&&g.length&&G(g,function(w){G(w.labels,function(x){c(x,d)}),c(w,d)})}G([p.attachers,p.incoming,p.outgoing],m),c(p,d);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=In(o,function(p){return p.element});var u=new Set(e);return o=In(o,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),o=Ui(o,function(p){return p.descriptor.priority}),e=In(o,function(p){return p.element}),G(o,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,u)){Wx(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){Wx(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function $O(e){return!!e.host}function FO(e){return In(e.waypoints,function(t){return t=Vx(t),t.original&&(t.original=Vx(t.original)),t})}function Vx(e){return U({},e)}function Wx(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const jO={__depends__:[aO,Kl,Fs,no],__init__:["copyPaste"],copyPaste:["type",ri]};function Qd(e,t,n){We(n)||(n=[n]),G(n,function(i){_r(e[i])||(t[i]=e[i])})}var Jd=750;function Ux(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",Jd,function(c){var l=c.descriptor,u=c.element,p=he(u);if(nt(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(gt(u),!0);d.bpmnElement=f,Qd(f,l,"name"),Qd(d,l,"isExpanded"),p.default&&(l.default=p.default.id)});var o="-bpmn-js-refs";function r(c){return c[o]=c[o]||{}}function a(c,l){c[o]=l}function s(c,l,u){var p=he(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(he(c).attachedToRef=he(l[c.host])),qi(u,ei(u,function(f,d,m){var h=d.element,g=d.property;return m===c.id&&(h.set(g,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(nt(u)){u.businessObject=he(l[u.labelTarget]),u.di=gt(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,Qd(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",Jd,function(c){var l=c.descriptor,u=c.element;if(A(u,"bpmn:Participant")){var p=he(u);p.processRef&&(l.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;A(l,"bpmn:SubProcess")&&G(Cs(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",Jd,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}Ux.$inject=["bpmnFactory","eventBus","moddleCopy"];const HO=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],zO=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function js(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 Ui(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=gn(o)&&o.$descriptor;if(a&&zO.includes(a))return r;if(a&&HO.includes(a)||a&&s&&!It(s.properties,aa({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:o}=i;if(A(o,"bpmn:ExtensionElements")&&(!o.values||!o.values.length))return!1})}js.$inject=["eventBus","bpmnFactory","moddle"],js.prototype.copyElement=function(e,t,n,i=!1){n&&!We(n)&&(n=[n]),n=n||eh(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||(We(o)&&(n=o),G(n,r=>{let a;Jn(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!hn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},js.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 gn(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):We(e)?ei(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):gn(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},js.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 eh(e,t){return ei(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const qx={__depends__:[jO],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Ux],moddleCopy:["type",js]};var Yx=Math.round;function th(e,t){this._modeling=e,this._eventBus=t}th.$inject=["modeling","eventBus"],th.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,o=this._eventBus;o.fire("replace.start",{element:e,attrs:t,hints:n});var r=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,l=Yx(s+r/2),u=Yx(c+a/2),p=i.replaceShape(e,U({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Kx(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}Kx.$inject=["selection","eventBus"];const GO={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Kx],replace:["type",th]};function VO(e,t,n){We(n)||(n=[n]),G(n,function(i){_r(e[i])||(t[i]=e[i])})}var WO=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function UO(e,t){var n=e&&Jn(e,"collapsed")?e.collapsed:!ut(e),i;return t&&(Jn(t,"collapsed")||Jn(t,"isExpanded"))?i=Jn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Xx(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(Xl(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&UO(s,c))return i.toggleCollapse(s),s;var f=e.create(u),d={type:u,businessObject:f};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),VO(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var m=eh(p.$descriptor),h=eh(f.$descriptor,!0),g=qO(m,h);U(f,Bi(c,WO));var w=rt(g,function(v){return v==="eventDefinitions"?Zx(s,c.eventDefinitionType):v==="loopCharacteristics"?!$n(f):Jn(f,v)||v==="processRef"&&c.isExpanded===!1||v==="triggeredByEvent"?!1:v==="isForCompensation"?!$n(f):!0});if(f=n.copyElement(p,f,w),c.eventDefinitionType&&(Zx(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),A(p,"bpmn:Activity")){if(Xl(p))d.isExpanded=ut(s);else if(c&&Jn(c,"isExpanded")){d.isExpanded=c.isExpanded;var x=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=x.width,d.height=x.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}ut(s)&&!A(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Xl(p)&&!Xl(f)&&(l.moveChildren=!1),A(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var y=xn(s);gt(s).isHorizontal||(gt(d).isHorizontal=y),d.width=y?s.width:t.getDefaultSize(d).width,d.height=y?t.getDefaultSize(d).height:s.height}return r.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,it(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&it(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!A(p,"bpmn:BoundaryEvent")&&A(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}Xx.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Xl(e){return A(e,"bpmn:SubProcess")}function Zx(e,t){var n=he(e);return t&&n.get("eventDefinitions").some(function(i){return A(i,t)})}function qO(e,t){return e.filter(function(n){return t.includes(n)})}const Qx={__depends__:[qx,GO,Ci],bpmnReplace:["type",Xx]};var YO=250;function $r(e){this._eventBus=e,this._tools=[],this._active=null}$r.$inject=["eventBus"],$r.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)},$r.prototype.isActive=function(e){return e&&this._active===e},$r.prototype.length=function(e){return this._tools.length},$r.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},$r.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),G(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,YO,function(o){this._active&&(KO(o)||this.setActive(null))},this)};function KO(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Pr(t,'.group[data-group="tools"]')}const Zl={__depends__:[Eo],__init__:["toolManager"],toolManager:["type",$r]};function XO(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 ZO(e,t){var n=[],i=new Set(e);G(t,function(r){i.add(r)});var o=new Set;return i.forEach(function(r){var a=r.incoming,s=r.outgoing;G(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 QO(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 nh=Math.abs,JO=Math.round,So={x:"width",y:"height"},Jx="crosshair",nr={n:"top",w:"left",s:"bottom",e:"right"},eD=1500,Ql={n:"s",w:"e",s:"n",e:"w"},Jl=20;function Mi(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&&tw(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,f=l.movingShapes,d=l.resizingShapes,m=l.start;if(l.initialized){tw(c);var h={x:0,y:0};h[u]=JO(c["d"+u]),s.makeSpace(f,d,h,p,m),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Mi.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Mi.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Jx,data:{context:{reactivate:n}},trapClick:!1})},Mi.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Jx,data:{context:{}}})},Mi.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},Mi.prototype.init=function(e,t){var n=nh(e.dx)>nh(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(nh(i)<5)return!1;i<0&&(i*=-1),Bs(e)&&(i*=-1);var r=XO(n,i),a=this._canvas.getRootElement();!jl(e)&&e.hover&&(a=e.hover);var s=[...xs(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=tD(c,n,r,o,l);return U(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),Yl("resize-"+(n==="x"?"ew":"ns")),!0},Mi.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 m=d.label;m&&!s.has(m)&&(s.add(m),r.push(m))}function f(d){c.has(d)||(c.add(d),a.push(d))}return G(e,function(d){if(!(!d.parent||nt(d))){if(kt(d)){u.push(d);return}var m=d[t],h=m+d[So[t]];if(nD(d)&&(n>0&&qe(d)[t]>i||n<0&&qe(d)[t]<i)){l.push(d);return}if(n>0&&m>i||n<0&&h<i){p(d);return}if(m<i&&h>i&&o.allowed("shape.resize",{shape:d})){f(d);return}}}),G(r,function(d){var m=d.attachers;m&&G(m,function(h){p(h)})}),G(l,function(d){var m=d.host;(s.has(m)||c.has(m))&&p(d)}),G(u,function(d){var m=d.source,h=d.target,g=d.label;(s.has(m)||c.has(m))&&(s.has(h)||c.has(h))&&g&&p(g)}),{movingShapes:r,resizingShapes:a}},Mi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Mi.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function ew(e){return{top:e.top-Jl,right:e.right+Jl,bottom:e.bottom+Jl,left:e.left-Jl}}function tw(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;Ue(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Ue(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Ue(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),Ue(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function tD(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 G(a,function(f){var d=f.attachers,m=f.children,h=ze(f),g=rt(m,function(H){return!kt(H)&&!nt(H)&&!u.has(H)&&!p.has(H)}),w=rt(m,function(H){return!kt(H)&&!nt(H)&&u.has(H)}),x,y,v,S=[],_=[],T,P,D,N;g.length&&(y=ew(ze(rn(g))),x=i-h[nr[n]]+y[nr[n]],n==="n"?s.bottom=l=Ue(l)?Math.min(l,x):x:n==="w"?s.right=l=Ue(l)?Math.min(l,x):x:n==="s"?s.top=c=Ue(c)?Math.max(c,x):x:n==="e"&&(s.left=c=Ue(c)?Math.max(c,x):x)),w.length&&(v=ew(ze(rn(w))),x=i-v[nr[Ql[n]]]+h[nr[Ql[n]]],n==="n"?s.bottom=l=Ue(l)?Math.min(l,x):x:n==="w"?s.right=l=Ue(l)?Math.min(l,x):x:n==="s"?s.top=c=Ue(c)?Math.max(c,x):x:n==="e"&&(s.left=c=Ue(c)?Math.max(c,x):x)),d&&d.length&&(d.forEach(function(H){u.has(H)?S.push(H):_.push(H)}),S.length&&(T=ze(rn(S.map(qe))),P=h[nr[Ql[n]]]-(T[nr[Ql[n]]]-i)),_.length&&(D=ze(rn(_.map(qe))),N=D[nr[n]]-(h[nr[n]]-i)),n==="n"?(x=Math.min(P||1/0,N||1/0),s.bottom=l=Ue(l)?Math.min(l,x):x):n==="w"?(x=Math.min(P||1/0,N||1/0),s.right=l=Ue(l)?Math.min(l,x):x):n==="s"?(x=Math.max(P||-1/0,N||-1/0),s.top=c=Ue(c)?Math.max(c,x):x):n==="e"&&(x=Math.max(P||-1/0,N||-1/0),s.left=c=Ue(c)?Math.max(c,x):x));var j=o&&o[f.id];j&&(n==="n"?(x=i+f[So[t]]-j[So[t]],s.bottom=l=Ue(l)?Math.min(l,x):x):n==="w"?(x=i+f[So[t]]-j[So[t]],s.right=l=Ue(l)?Math.min(l,x):x):n==="s"?(x=i-f[So[t]]+j[So[t]],s.top=c=Ue(c)?Math.max(c,x):x):n==="e"&&(x=i-f[So[t]]+j[So[t]],s.left=c=Ue(c)?Math.max(c,x):x))}),s}}function nD(e){return!!e.host}var ih="djs-dragging",nw="djs-resizing",iD=250,eu=Math.max;function iw(e,t,n,i,o){function r(a,s){G(a,function(c){o.addDragger(c,s),n.addMarker(c,ih)})}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=Be("g");Ce(u,i.cls("djs-crosshair-group",["no-events"])),Ke(s,u);var p=Be("path");Ce(p,"d",l.x),lt(p).add("djs-crosshair"),Ke(u,p);var f=Be("path");Ce(f,"d",l.y),lt(f).add("djs-crosshair"),Ke(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Pn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&on(c)}),e.on("spaceTool.move",iD,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=Be("path"),Ce(c,"d","M0,0 L0,0"),lt(c).add("djs-crosshair"),Ke(f,c),s.line=c;var d=Be("g");Ce(d,i.cls("djs-drag-group",["no-events"])),Ke(n.getActiveLayer(),d),r(u,d);var m=new Set(u);G(p,function(_){m.add(_)});var h=new Set,g=s.movingConnections=[];m.forEach(function(_){G(_.outgoing,function(T){h.has(T)||!kt(T)||!m.has(T.target)||(h.add(T),g.push(T))})}),r(g,d),s.dragGroup=d}if(!s.frameGroup){var w=Be("g");Ce(w,i.cls("djs-frame-group",["no-events"])),Ke(n.getActiveLayer(),w);var x=[];G(p,function(_){var T=o.addFrame(_,w),P=T.getBBox();x.push({element:T,initialBounds:P}),n.addMarker(_,nw)}),s.frameGroup=w,s.frames=x}var y={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Ce(c,{d:y[l]});var v={x:"y",y:"x"},S={x:a.dx,y:a.dy};S[v[s.axis]]=0,Pn(s.dragGroup,S.x,S.y),G(s.frames,function(_){var T=_.element,P=_.initialBounds,D,N;s.direction==="e"?Ce(T,{width:eu(P.width+S.x,5)}):(D=eu(P.width-S.x,5),Ce(T,{width:D,x:P.x+P.width-D})),s.direction==="s"?Ce(T,{height:eu(P.height+S.y,5)}):(N=eu(P.height-S.y,5),Ce(T,{height:N,y:P.y+P.height-N}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;G(c,function(m){n.removeMarker(m,ih)}),G(l,function(m){n.removeMarker(m,ih)}),f&&(on(p),on(f)),G(u,function(m){n.removeMarker(m,nw)}),d&&on(d)})}iw.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const oD={__init__:["spaceToolPreview"],__depends__:[Eo,no,Zl,Ia,Fs],spaceTool:["type",Mi],spaceToolPreview:["type",iw]};function tu(e,t){e.invoke(Mi,this),this._canvas=t}tu.$inject=["injector","canvas"],Te(tu,Mi),tu.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=oa(va(o.children.filter(l=>A(l,"bpmn:Artifact")),rn(r))));const s=[...e,...a];var c=Mi.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(A(l,"bpmn:TextAnnotation")||rD(l)&&(t==="y"&&xn(l)||t==="x"&&!xn(l)))}),c};function rD(e){return A(e,"bpmn:Participant")&&!he(e).processRef}const ow={__depends__:[oD],spaceTool:["type",tu]};function Wt(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)}Wt.$inject=["eventBus","injector"],Wt.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()},Wt.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},Wt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Wt.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()}},Wt.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()}},Wt.prototype.register=function(e,t){this._setHandler(e,t)},Wt.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)},Wt.prototype.canUndo=function(){return!!this._getUndoAction()},Wt.prototype.canRedo=function(){return!!this._getRedoAction()},Wt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Wt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Wt.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)})},Wt.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},Wt.prototype._createId=function(){return this._uid++},Wt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Wt.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()},Wt.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)},Wt.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:Hg("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Wt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=We(e)?e:[e],t.dirty=t.dirty.concat(e))},Wt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Wt.prototype._revertedAction=function(e){this._stackIdx--},Wt.prototype._getHandler=function(e){return this._handlerMap[e]},Wt.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 aD={commandStack:["type",Wt]};function ir(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 sD=250,rw=1400;function oh(e,t,n){de.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",rw,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=aw(a),r.validatedShapes=aw(s)}),i&&t.on("shape.move.start",sD,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",rw,function(o){var r=o.context,a=r.closure,s=a.enclosedElements,c=[];G(s,function(l){G(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;ir(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=Nf(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&&(en(s.labels,a,c),a.labelTarget=s)})}Te(oh,de),oh.$inject=["injector","eventBus","modeling"];function aw(e){var t=new Set(e);return rt(e,function(n){return!t.has(n.labelTarget)})}const cD={__init__:["labelSupport"],labelSupport:["type",oh]};var lD=251,sw=1401,cw="attach-ok";function rh(e,t,n,i,o){de.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",sw,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=uD(c),s.validatedShapes=pD(l)}),r&&t.on("shape.move.start",lD,function(a){var s=a.context,c=s.shapes,l=ah(c);G(l,function(u){r.makeDraggable(s,u,!0),G(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,cw),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,cw)}))}}),this.preExecuted("elements.move",sw,function(a){var s=a.context,c=s.closure,l=s.shapes,u=ah(l);G(u,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=rt(c,function(p){var f=p.host;return fD(p)&&!dD(c,f)}),G(u,function(p){o.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;G(s,function(c){G(c.attachers,function(l){G(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)}),G(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;ir(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&&G(l.attachers,function(u){var p=Cb(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&&G(p,function(d){var m=Cb(d,l,u);o.moveShape(d,m,d.parent),G(d.labels,function(h){o.moveShape(h,m,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;ir(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}Te(rh,de),rh.$inject=["injector","eventBus","canvas","rules","modeling"];function ah(e){return Sp(In(e,function(t){return t.attachers||[]}))}function uD(e){var t=ah(e);return dS("id",e,t)}function pD(e){var t=ra(e,"id");return rt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function fD(e){return!!e.host}function dD(e,t){return e.indexOf(t)!==-1}const hD={__depends__:[no],__init__:["attachSupport"],attachSupport:["type",rh]};function lw(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(tv(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)})}lw.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const sh={__init__:["changeSupport"],changeSupport:["type",lw]};function Ai(e){this._model=e}Ai.$inject=["moddle"],Ai.prototype._needsId=function(e){return it(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"])},Ai.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;A(e,"bpmn:Activity")?t="Activity":A(e,"bpmn:Event")?t="Event":A(e,"bpmn:Gateway")?t="Gateway":it(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))},Ai.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Ai.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Ai.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",U({bpmnElement:e,bounds:this.createDiBounds()},t))},Ai.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Ai.prototype.createDiWaypoints=function(e){var t=this;return In(e,function(n){return t.createDiWaypoint(n)})},Ai.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Bi(e,["x","y"]))},Ai.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",U({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Ai.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",U({bpmnElement:e},t))};function ai(e,t,n){de.call(this,e),this._bpmnFactory=t;var i=this;function o(d){var m=d.context,h=m.hints||{},g;!m.cropped&&h.createElementsBehavior!==!1&&(g=m.connection,g.waypoints=n.getCroppedWaypoints(g),m.cropped=!0)}this.executed(["connection.layout","connection.create"],o),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function r(d){var m=d.context;i.updateParent(m.shape||m.connection,m.oldParent)}function a(d){var m=d.context,h=m.shape||m.connection,g=m.parent||m.newParent;i.updateParent(h,g)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],si(r)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],si(a));function s(d){var m=d.context,h=m.oldRoot,g=h.children;G(g,function(w){A(w,"bpmn:BaseElement")&&i.updateParent(w)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var m=d.context.shape;A(m,"bpmn:BaseElement")&&i.updateBounds(m)}this.executed(["shape.move","shape.create","shape.resize"],si(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],si(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function l(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],si(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],si(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],si(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],si(u)),this.executed("connection.reconnect",si(function(d){var m=d.context,h=m.connection,g=m.oldSource,w=m.newSource,x=he(h),y=he(g),v=he(w);x.conditionExpression&&!it(v,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=x.conditionExpression,delete x.conditionExpression),g!==w&&y.default===x&&(m.oldDefault=y.default,delete y.default)})),this.reverted("connection.reconnect",si(function(d){var m=d.context,h=m.connection,g=m.oldSource,w=m.newSource,x=he(h),y=he(g),v=he(w);m.oldConditionExpression&&(x.conditionExpression=m.oldConditionExpression),m.oldDefault&&(y.default=m.oldDefault,delete v.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],si(p)),this.reverted(["element.updateAttachment"],si(p)),this.executed("element.updateLabel",si(f)),this.reverted("element.updateLabel",si(f));function f(d){const{element:m}=d.context,h=mi(m),g=gt(m),w=g&&g.get("label");Xo(m)||Hl(m)||(h&&!w?g.set("label",t.create("bpmndi:BPMNLabel")):!h&&w&&g.set("label",void 0))}}Te(ai,de),ai.$inject=["eventBus","bpmnFactory","connectionDocking"],ai.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},ai.prototype.updateParent=function(e,t){if(!nt(e)&&!(A(e,"bpmn:DataStoreReference")&&e.parent&&A(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=gt(e),r=n&&n.businessObject,a=gt(n);A(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),A(e,"bpmn:DataOutputAssociation")&&(e.source?r=e.source.businessObject:r=null),A(e,"bpmn:DataInputAssociation")&&(e.target?r=e.target.businessObject:r=null),this.updateSemanticParent(i,r),A(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(o,a)}},ai.prototype.updateBounds=function(e){var t=gt(e),n=mD(e);if(n){var i=zi(n,t.get("bounds"));U(n,{x:e.x+i.x,y:e.y+i.y})}var o=nt(e)?this._getLabel(t):t,r=o.bounds;r||(r=this._bpmnFactory.createDiBounds(),o.set("bounds",r)),U(r,{x:e.x,y:e.y,width:e.width,height:e.height})},ai.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,o;A(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Jt(i,e)),A(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),en(o,e))}},ai.prototype.updateDiConnection=function(e,t,n){var i=gt(e),o=gt(t),r=gt(n);i.sourceElement&&i.sourceElement.bpmnElement!==he(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==he(n)&&(i.targetElement=n&&r)},ai.prototype.updateDiParent=function(e,t){if(t&&!A(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Jt(n,e),e.$parent=null)}};function gD(e){for(;e&&!A(e,"bpmn:Definitions");)e=e.$parent;return e}ai.prototype.getLaneSet=function(e){var t,n;return A(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(A(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},ai.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))&&(A(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(A(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(A(e,"bpmn:FlowElement")){if(t){if(A(t,"bpmn:Participant"))t=t.processRef;else if(A(t,"bpmn:Lane"))do t=t.$parent.$parent;while(A(t,"bpmn:Lane"))}i="flowElements"}else if(A(e,"bpmn:Artifact")){for(;t&&!A(t,"bpmn:Process")&&!A(t,"bpmn:SubProcess")&&!A(t,"bpmn:Collaboration");)if(A(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(A(e,"bpmn:MessageFlow"))i="messageFlows";else if(A(e,"bpmn:Participant")){i="participants";var o=e.processRef,r;o&&(r=gD(e.$parent||t),e.$parent&&(Jt(r.get("rootElements"),o),o.$parent=null),t&&(en(r.get("rootElements"),o),o.$parent=r))}else A(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":A(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),Jt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Jt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},ai.prototype.updateConnectionWaypoints=function(e){var t=gt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},ai.prototype.updateConnection=function(e){var t=e.connection,n=he(t),i=t.source,o=he(i),r=t.target,a=he(t.target),s;if(A(n,"bpmn:DataAssociation"))A(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=o,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):A(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||o,this.updateSemanticParent(n,o,s),n.targetRef=a);else{var c=A(n,"bpmn:SequenceFlow");n.sourceRef!==o&&(c&&(Jt(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(Jt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,r)},ai.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function si(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;A(i,"bpmn:BaseElement")&&e(t)}}function mD(e){if(A(e,"bpmn:Activity")){var t=gt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function or(e,t){bo.call(this),this._bpmnFactory=e,this._moddle=t}Te(or,bo),or.$inject=["bpmnFactory","moddle"],or.prototype._baseCreate=bo.prototype.create,or.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,U({type:"label",di:n},Or,t))}return this.createElement(e,t)},or.prototype.createElement=function(e,t){t=U({},t||{});var n,i=t.businessObject,o=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!vD(o)){var r=U({},o||{},{id:i.id+"_di"});e==="root"?o=this._bpmnFactory.createDiPlane(i,r):e==="connection"?o=this._bpmnFactory.createDiEdge(i,r):o=this._bpmnFactory.createDiShape(i,r)}A(i,"bpmn:Group")&&(t=U({isFrame:!0},t)),t=yD(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=ch(o,t,"isExpanded")),it(i,["bpmn:Lane","bpmn:Participant"])&&(t=ch(o,t,"isHorizontal")),A(i,"bpmn:SubProcess")&&(t.collapsed=!ut(i,o)),A(i,"bpmn:ExclusiveGateway")&&(Jn(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),hn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),hn(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,o),t=U({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},or.prototype.getDefaultSize=function(e,t){var n=he(e);if(t=t||gt(e),A(n,"bpmn:SubProcess"))return ut(n,t)?{width:350,height:200}:{width:100,height:80};if(A(n,"bpmn:Task"))return{width:100,height:80};if(A(n,"bpmn:Gateway"))return{width:50,height:50};if(A(n,"bpmn:Event"))return{width:36,height:36};if(A(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return ut(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return A(n,"bpmn:Lane")?{width:400,height:100}:A(n,"bpmn:DataObjectReference")?{width:36,height:50}:A(n,"bpmn:DataStoreReference")?{width:50,height:50}:A(n,"bpmn:TextAnnotation")?{width:100,height:40}:A(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},or.prototype.createParticipantShape=function(e){return gn(e)||(e={isExpanded:e}),e=U({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function yD(e,t,n){return G(n,function(i){t=ch(e,t,i)}),t}function ch(e,t,n){return t[n]===void 0?t:(e[n]=t[n],qi(t,[n]))}function vD(e){return it(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function nu(e,t){this._modeling=e,this._canvas=t}nu.$inject=["modeling","canvas"],nu.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;G(n,function(o){var r={x:0,y:0};hn(i.left)?r.x=i.left-o.x:hn(i.right)?r.x=i.right-o.width-o.x:hn(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:hn(i.top)?r.y=i.top-o.y:hn(i.bottom)?r.y=i.bottom-o.height-o.y:hn(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},nu.prototype.postExecute=function(e){};function iu(e){this._modeling=e}iu.$inject=["modeling"],iu.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},iu.prototype.postExecute=function(e){var t=e.hints||{};bD(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 bD(e,t){return Io(e.outgoing,function(n){return n.target===t})}function ou(e,t){this._canvas=e,this._layouter=t}ou.$inject=["canvas","layouter"],ou.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},ou.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var ru=Math.round;function lh(e){this._modeling=e}lh.$inject=["modeling"],lh.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,a=this._modeling;G(t,function(p){Ue(p.x)||(p.x=0),Ue(p.y)||(p.y=0)});var s=rt(t,function(p){return!p.hidden}),c=rn(s);G(t,function(p){kt(p)&&(p.waypoints=In(p.waypoints,function(f){return{x:ru(f.x-c.x-c.width/2+o.x),y:ru(f.y-c.y-c.height/2+o.y)}})),U(p,{x:ru(p.x-c.x-c.width/2+o.x),y:ru(p.y-c.y-c.height/2+o.y)})});var l=new Set(sl(t)),u={};G(t,function(p){if(kt(p)){u[p.id]=Ue(i)?a.createConnection(u[p.source.id],u[p.target.id],i,p,p.parent||n,r):a.createConnection(u[p.source.id],u[p.target.id],p,p.parent||n,r);return}var f=U({},r);l.has(p)||(f.autoResize=!1),nt(p)&&(f=qi(f,["attach"])),u[p.id]=Ue(i)?a.createShape(p,Bi(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Bi(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=oa(u)};var uw=Math.round;function rr(e){this._canvas=e}rr.$inject=["canvas"],rr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,o=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?U(t,n):U(t,{x:n.x-uw(t.width/2),y:n.y-uw(t.height/2)}),this._canvas.addShape(t,i,o),t},rr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Hs(e){rr.call(this,e)}Te(Hs,rr),Hs.$inject=["canvas"];var xD=rr.prototype.execute;Hs.prototype.execute=function(e){var t=e.shape;return _D(t),t.labelTarget=e.labelTarget,xD.call(this,e)};var wD=rr.prototype.revert;Hs.prototype.revert=function(e){return e.shape.labelTarget=null,wD.call(this,e)};function _D(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function zs(e,t){this._canvas=e,this._modeling=t}zs.$inject=["canvas","modeling"],zs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;ir(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ir(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},zs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Nf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},zs.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,en(n.children,t,i),this._canvas.addConnection(t,n),t};function uh(e,t){this._modeling=e,this._elementRegistry=t}uh.$inject=["modeling","elementRegistry"],uh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;G(i,function(o){n.get(o.id)&&(o.waypoints?t.removeConnection(o):t.removeShape(o))})};function Gs(e,t){this._canvas=e,this._modeling=t}Gs.$inject=["canvas","modeling"],Gs.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;ir(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ir(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),ir(n.children,function(i){kt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Gs.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Nf(i.children,n),t.removeShape(n),n},Gs.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return en(i.children,n,o),t.addShape(n,i),n};function au(e){this._modeling=e}au.$inject=["modeling"];var pw={x:"y",y:"x"};au.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(g,w){g.range.min=Math.min(w[i],g.range.min),g.range.max=Math.max(w[i]+w[o],g.range.max)}function a(g){return g[i]+g[o]/2}function s(g){return g.length-1}function c(g){return g.max-g.min}function l(g,w){var x={y:0};x[i]=g-a(w),x[i]&&(x[pw[i]]=0,t.moveElements([w],x,w.parent))}var u=n[0],p=s(n),f=n[p],d,m,h=0;G(n,function(g,w){var x,y,v;if(g.elements.length<2){w&&w!==n.length-1&&(r(g,g.elements[0]),h+=c(g.range));return}x=Ui(g.elements,i),y=x[0],w===p&&(y=x[s(x)]),v=a(y),g.range=null,G(x,function(S){if(l(v,S),g.range===null){g.range={min:S[i],max:S[i]+S[o]};return}r(g,S)}),w&&w!==n.length-1&&(h+=c(g.range))}),m=Math.abs(f.range.min-u.range.max),d=Math.round((m-h)/(n.length-1)),!(d<n.length-1)&&G(n,function(g,w){var x={},y;g===u||g===f||(y=n[w-1],g.range.max=0,G(g.elements,function(v,S){x[pw[i]]=0,x[i]=y.range.max-v[i]+d,g.range.min!==v[i]&&(x[i]+=v[i]-g.range.min),x[i]&&t.moveElements([v],x,v.parent),g.range.max=Math.max(v[i]+v[o],S?g.range.max:0)}))})},au.prototype.postExecute=function(e){};function su(e,t){this._layouter=e,this._canvas=t}su.$inject=["layouter","canvas"],su.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return U(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},su.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function ph(){}ph.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=Jt(r.children,t),en(i.children,t,o),t.parent=i,G(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},ph.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return Jt(n.children,t),en(i.children,t,o),t.parent=i,G(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 fh(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}fh.prototype.add=function(e,t){return this.addAll([e],t)},fh.prototype.addAll=function(e,t){var n=QA(e,!!t,this);return U(this,n),this};function Vs(e){this._modeling=e}Vs.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Vs.prototype.moveClosure=function(e,t,n,i,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),G(a,function(p){r.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),G(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&&bd(p,p.source,t),connectionEnd:d&&xd(p,p.target,t)})})},Vs.prototype.getClosure=function(e){return new fh().addAll(e,!0)};function cu(e){this._helper=new Vs(e)}cu.$inject=["modeling"],cu.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},cu.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 Fr(e){this._modeling=e,this._helper=new Vs(e)}Fr.$inject=["modeling"],Fr.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=Bi(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=Jt(r.children,t),en(i.children,t,o),U(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Fr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(G(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:xd(r,t,n)})}),G(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:bd(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Fr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return en(n.children,t,i),U(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},Fr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Fr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Ws(e){this._modeling=e}Ws.$inject=["modeling"],Ws.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 We(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},Ws.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||fw(We(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||fw(We(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},Ws.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 fw(e){return e.original||e}function Ro(e,t){this._modeling=e,this._rules=t}Ro.$inject=["modeling","rules"],Ro.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,o=e.oldShape,r=e.newData,a=e.hints||{},s;function c(m,h,g){return i.allowed("connection.reconnect",{connection:g,source:m,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();G(f,function(m){var h=m.source,g=c(h,s,m);g&&t.reconnectEnd(m,s,Il(m,s,u),a)}),G(d,function(m){var h=m.target,g=c(s,h,m);g&&t.reconnectStart(m,s,Ll(m,s,u),a)})},Ro.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Ro.prototype.execute=function(e){},Ro.prototype.revert=function(e){},Ro.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Ro.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Ro.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Us(e){this._modeling=e}Us.$inject=["modeling"],Us.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},U(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Us.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(G(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:Il(r,n,i)})}),G(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:Ll(r,n,i)})}))},Us.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return U(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function ar(e){this._modeling=e}ar.$inject=["modeling"],ar.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),G(o,function(s){a[s.id]=SD(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(ZO(i,o),t,n,r,i,o,a)},ar.prototype.execute=function(){},ar.prototype.revert=function(){},ar.prototype.moveShapes=function(e,t){var n=this;G(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},ar.prototype.resizeShapes=function(e,t,n){var i=this;G(e,function(o){var r=QO(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},ar.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);G(e,function(u){var p=u.source,f=u.target,d=ED(u),m=hw(n),h={},g=c.has(p)||l.has(p),w=c.has(f)||l.has(f);g&&w?(d=In(d,function(x){return gw(x,i,n)&&(x[m]=x[m]+t[m]),x.original&&gw(x.original,i,n)&&(x.original[m]=x.original[m]+t[m]),x}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(g||w)&&(c.has(p)?h.connectionStart=bd(u,p,t):c.has(f)?h.connectionEnd=xd(u,f,t):l.has(p)?h.connectionStart=Ll(u,p,a[p.id]):l.has(f)&&(h.connectionEnd=Il(u,f,a[f.id])),s._modeling.layoutConnection(u,h))})};function dw(e){return U({},e)}function ED(e){return In(e.waypoints,function(t){return t=dw(t),t.original&&(t.original=dw(t.original)),t})}function hw(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function gw(e,t,n){var i=hw(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function SD(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function lu(e){this._modeling=e}lu.$inject=["modeling"],lu.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=mw(n),t.collapsed=!t.collapsed;var i=yw(n,t.collapsed);return[t].concat(i)},lu.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=vw(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function mw(e){var t={};return G(e,function(n){t[n.id]=n.hidden,n.children&&(t=U({},t,mw(n.children)))}),t}function yw(e,t){var n=[];return G(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(yw(i.children,i.collapsed||t)))}),n}function vw(e,t){var n=[];return G(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(vw(i.children,t)))}),n}function uu(e){this._modeling=e}uu.$inject=["modeling"],uu.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=bw(i,t),xw(n,t),t.host=n,t},uu.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,bw(n,t),xw(i,t,o),t};function bw(e,t){return Jt(e&&e.attachers,t)}function xw(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),en(i,t,n)}}function dh(){}dh.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},dh.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Ot(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Ot.$inject=["eventBus","elementFactory","commandStack"],Ot.prototype.getHandlers=function(){return{"shape.append":iu,"shape.create":rr,"shape.delete":Gs,"shape.move":Fr,"shape.resize":Us,"shape.replace":Ro,"shape.toggleCollapse":lu,spaceTool:ar,"label.create":Hs,"connection.create":ou,"connection.delete":zs,"connection.move":ph,"connection.layout":su,"connection.updateWaypoints":dh,"connection.reconnect":Ws,"elements.create":lh,"elements.move":cu,"elements.delete":uh,"elements.distribute":au,"elements.align":nu,"element.updateAttachment":uu}},Ot.prototype.registerHandlers=function(e){G(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Ot.prototype.moveShape=function(e,t,n,i,o){typeof i=="object"&&(o=i,i=null);var r={shape:e,delta:t,newParent:n,newParentIndex:i,hints:o||{}};this._commandStack.execute("shape.move",r)},Ot.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Ot.prototype.moveElements=function(e,t,n,i){i=i||{};var o=i.attach,r=n,a;o===!0?(a=n,r=n.parent):o===!1&&(a=null);var s={shapes:e,delta:t,newParent:r,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},Ot.prototype.moveConnection=function(e,t,n,i,o){typeof i=="object"&&(o=i,i=void 0);var r={connection:e,delta:t,newParent:n,newParentIndex:i,hints:o||{}};this._commandStack.execute("connection.move",r)},Ot.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Ot.prototype.createConnection=function(e,t,n,i,o,r){typeof n=="object"&&(r=o,o=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:o,parentIndex:n,connection:i,hints:r};return this._commandStack.execute("connection.create",a),a.connection},Ot.prototype.createShape=function(e,t,n,i,o){typeof i!="number"&&(o=i,i=void 0),o=o||{};var r=o.attach,a,s;e=this._create("shape",e),r?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:o};return this._commandStack.execute("shape.create",c),c.shape},Ot.prototype.createElements=function(e,t,n,i,o){We(e)||(e=[e]),typeof i!="number"&&(o=i,i=void 0),o=o||{};var r={position:t,elements:e,parent:n,parentIndex:i,hints:o};return this._commandStack.execute("elements.create",r),r.elements},Ot.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var o={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",o),o.shape},Ot.prototype.appendShape=function(e,t,n,i,o){o=o||{},t=this._create("shape",t);var r={source:e,position:n,target:i,shape:t,connection:o.connection,connectionParent:o.connectionParent,hints:o};return this._commandStack.execute("shape.append",r),r.shape},Ot.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Ot.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Ot.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Ot.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Ot.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Ot.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Ot.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},Ot.prototype.createSpace=function(e,t,n,i,o){var r={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:o};this._commandStack.execute("spaceTool",r)},Ot.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Ot.prototype.reconnect=function(e,t,n,i,o){var r={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:o||{}};this._commandStack.execute("connection.reconnect",r)},Ot.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,U(i,{docking:"source"}))},Ot.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,U(i,{docking:"target"}))},Ot.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Ot.prototype._create=function(e,t){return NP(t)?t:this._elementFactory.create(e,t)},Ot.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function qs(e){this._elementRegistry=e}qs.$inject=["elementRegistry"],qs.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||RD(n,Mc(i));return ww(n,i),e.oldProperties=r,e.changed=o,o},qs.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return ww(n,t),i},qs.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return A(e,"bpmn:DataObject")?CD(e,t):[]};function RD(e,t){return ei(t,function(n,i){return n[i]=e.get(i),n},{})}function ww(e,t){G(t,function(n,i){e.set(i,n)})}function CD(e,t){return t.filter(function(n){return A(n,"bpmn:DataObjectReference")&&he(n).dataObjectRef===e})}var Ys="default",Co="id",_w="di",MD={width:0,height:0};function Ks(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Ks.$inject=["elementRegistry","moddle","modeling","textRenderer"],Ks.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=OD(e.properties),s=e.oldProperties||AD(t,a);return Ew(a,r)&&(o.unclaim(r[Co]),i.updateId(t,a[Co]),o.claim(a[Co],r)),Ys in a&&(a[Ys]&&n.push(i.get(a[Ys].id)),r[Ys]&&n.push(i.get(r[Ys].id))),Sw(t,a),e.oldProperties=s,e.changed=n,n},Ks.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&he(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,MD)}},Ks.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 Sw(t,i),Ew(n,o)&&(a.unclaim(n[Co]),r.updateId(t,i[Co]),a.claim(i[Co],o)),e.changed};function Ew(e,t){return Co in e&&e[Co]!==t[Co]}function AD(e,t){var n=Mc(t),i=e.businessObject,o=gt(e);return ei(n,function(r,a){return a!==_w?r[a]=i.get(a):r[a]=PD(o,Mc(t.di)),r},{})}function PD(e,t){return ei(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Sw(e,t){var n=e.businessObject,i=gt(e);G(t,function(o,r){r!==_w?n.set(r,o):i&&TD(i,o)})}function TD(e,t){G(t,function(n,i){e.set(i,n)})}var kD=["default"];function OD(e){var t=U({},e);return kD.forEach(function(n){n in e&&(t[n]=he(t[n]))}),t}function pu(e,t){this._canvas=e,this._modeling=t}pu.$inject=["canvas","modeling"],pu.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=t.getRootElement(),r=o.businessObject,a=r.$parent,s=gt(o);return t.setRootElement(n),t.removeRootElement(o),en(a.rootElements,i),i.$parent=a,Jt(a.rootElements,r),r.$parent=null,o.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=o,[]},pu.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=e.oldRoot,r=o.businessObject,a=i.$parent,s=gt(n);return t.setRootElement(o),t.removeRootElement(n),Jt(a.rootElements,i),i.$parent=null,en(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function hh(e,t){this._modeling=e,this._spaceTool=t}hh.$inject=["modeling","spaceTool"],hh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,o=e.location,r=Si(i),a=r===i,s=a?i:i.parent,c=Qo(s),l=xn(i);if(l?o==="left"?o="top":o==="right"&&(o="bottom"):o==="top"?o="left":o==="bottom"&&(o="right"),!c.length){var u=l?{x:i.x+Ei,y:i.y,width:i.width-Ei,height:i.height}:{x:i.x,y:i.y+Ei,width:i.width,height:i.height-Ei};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];kr(r,function(v){return p.push(v),v.label&&p.push(v.label),v===i?[]:rt(v.children,function(S){return S!==i})});var f,d,m,h,g;o==="top"?(f=-120,d=i.y,m=d+10,h="n",g="y"):o==="left"?(f=-120,d=i.x,m=d+10,h="w",g="x"):o==="bottom"?(f=120,d=i.y+i.height,m=d-10,h="s",g="y"):o==="right"&&(f=120,d=i.x+i.width,m=d-10,h="e",g="x");var w=t.calculateAdjustments(p,g,f,m),x=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(w.movingShapes,w.resizingShapes,x,h,m);var y=l?{x:i.x+(a?Ei:0),y:d-(o==="top"?120:0),width:i.width-(a?Ei:0),height:120}:{x:d-(o==="left"?120:0),y:i.y+(a?Ei:0),width:120,height:i.height-(a?Ei:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},y,s)};function gh(e){this._modeling=e}gh.$inject=["modeling"],gh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=Qo(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=xn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,f;for(f=0;f<i;f++)f===i-1?l=s-c*f:l=c,u=a?{x:n.x+Ei,y:n.y+f*c,width:n.width-Ei,height:l}:{x:n.x+f*c,y:n.y+Ei,width:l,height:n.height-Ei},f<r?t.resizeShape(o[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function Xs(e,t){this._modeling=e,this._spaceTool=t}Xs.$inject=["modeling","spaceTool"],Xs.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Xs.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=C2(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},Xs.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ze(e),o=ze(t),r=nb(o,i),a=Si(e),s=[],c=[];kr(a,function(m){return s.push(m),(A(m,"bpmn:Lane")||A(m,"bpmn:Participant"))&&c.push(m),m.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 Zs="flowNodeRef",mh="lanes";function fu(){}fu.prototype._computeUpdates=function(e,t){var n=[],i=[],o={},r=[];function a(u,p){var f=ze(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=Si(u);return o[p.id]||(o[p.id]=Pl(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=Si(u);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return A(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),r.forEach(function(u){var p=u.businessObject,f=p.get(mh),d=f.slice(),m=l(u);i.push({flowNode:p,remove:d,add:m})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(Zs).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},fu.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(mh);n.remove.forEach(function(r){Jt(o,r),Jt(r.get(Zs),i)}),n.add.forEach(function(r){en(o,r),en(r.get(Zs),i)})}),[]},fu.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get(mh);n.add.forEach(function(r){Jt(o,r),Jt(r.get(Zs),i)}),n.remove.forEach(function(r){en(o,r),en(r.get(Zs),i)})}),[]};var yh="categoryValueRef";function Qs(e,t){this._bpmnFactory=e,this._elementRegistry=t}Qs.$inject=["bpmnFactory","elementRegistry"],Qs.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(x,y,v){if(y){var S=a.get(x);S||(S={},a.set(x,S)),!(v&&S.present)&&(!v&&S.past||(v?S.present={categoryValue:y,root:vh(x)}:S.past={categoryValue:y}))}}function c(x){o.set(x,he(x))}function l(){n.filter(function(x){return A(x,"bpmn:FlowElement")&&!nt(x)&&x.parent}).forEach(c)}function u(x){var y=he(x),v=y.get("categoryValueRef");return v||(v=Zv(i,y),r.push(DD(x,v))),v}function p(x){return x.reduce(function(y,v){var S=vh(v),_=y.get(S);return _||(_=[],y.set(S,_)),_.push(v),y},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(x){return A(x,"bpmn:Group")&&!nt(x)&&x.parent}).forEach(function(x){var y=he(x).get("categoryValueRef");if(!y){var v=vh(x),S=f.get(v)||[],_=va(S,x),T=Object.keys(_).length>0;T&&(y=u(x))}s(x,y,!0)}),t.forEach(function(x){s(x.groupShape,x.categoryValue,!1)}),r.length&&l();var d=Array.from(o.keys()),m=Array.from(a.values()).reduce(function(x,y){return y.present&&x.add(y.present.categoryValue),y.past&&x.add(y.past.categoryValue),x},new Set),h=new Map,g=p(d);a.forEach(function(x,y){var v=x.present;if(v){var S=g.get(v.root)||[],_=va(S,y);S.forEach(function(T){if(_[T.id]){var P=h.get(T);P||(P=new Set,h.set(T,P)),P.add(v.categoryValue)}})}});var w=d.reduce(function(x,y){var v=o.get(y),S=v.get(yh),_=new Set(S),T=h.get(y)||new Set,P=Array.from(T).filter(function(N){return!_.has(N)}),D=S.filter(function(N){return m.has(N)&&!T.has(N)});return(P.length||D.length)&&x.push({businessObject:v,categoryValuesToAdd:P,categoryValuesToRemove:D}),x},[]);return{flowElements:w,groups:r}},Qs.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),LD(t.groups),BD(t.flowElements),[]},Qs.prototype.revert=function(e){var t=e.updates;return ND(t.flowElements),ID(t.groups),[]};function DD(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function LD(e){e.forEach(function(t){he(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function ID(e){e.forEach(function(t){he(t.groupShape).categoryValueRef=null})}function BD(e){e.forEach(function(t){var n=t.businessObject,i=n.get(yh);t.categoryValuesToRemove.forEach(function(o){Jt(i,o)}),t.categoryValuesToAdd.forEach(function(o){en(i,o,!0)})})}function ND(e){e.forEach(function(t){var n=t.businessObject,i=n.get(yh);t.categoryValuesToAdd.forEach(function(o){Jt(i,o)}),t.categoryValuesToRemove.forEach(function(o){en(i,o,!0)})})}function vh(e){for(;e.parent;)e=e.parent;return e}function du(e){this._moddle=e}du.$inject=["moddle"],du.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),[]},du.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 $D={fill:void 0,stroke:void 0};function bh(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Qn(t)){var n=FD(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}bh.$inject=["commandStack"],bh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||$D,i=this,o={};"fill"in n&&U(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&U(o,{"border-color":this._normalizeColor(n.stroke)}),G(t,function(r){var a=kt(r)?Bi(o,["border-color"]):o,s=gt(r);if(jD(a),nt(r)){if(!s||!A(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:r,moddleElement:s.label,properties:{color:o["border-color"]}})}else{if(!it(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function FD(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 jD(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var HD={width:0,height:0};function Rw(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return gT(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!nt(l)&&Xo(l)&&!ml(l)&&!Cw(p)){var f=7,d=Gf(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=mi(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(!(!nt(u)&&!A(u,"bpmn:TextAnnotation"))){if(nt(u)&&Cw(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var m=mi(l);typeof f>"u"&&(f=t.getExternalLabelBounds(u,m)),f&&e.resizeShape(u,f,HD)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}Rw.$inject=["modeling","textRenderer","bpmnFactory"];function Cw(e){return!e||!e.trim()}function kn(e,t,n,i){Ot.call(this,e,t,n),this._bpmnRules=i}Te(kn,Ot),kn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],kn.prototype.getHandlers=function(){var e=Ot.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=qs,e["element.updateProperties"]=Ks,e["canvas.updateRoot"]=pu,e["lane.add"]=hh,e["lane.resize"]=Xs,e["lane.split"]=gh,e["lane.updateRefs"]=fu,e["group.updateRefs"]=Qs,e["id.updateClaim"]=du,e["element.setColor"]=bh,e["element.updateLabel"]=Rw,e},kn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},kn.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)},kn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},kn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},kn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},kn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},kn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},kn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},kn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},kn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},kn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},kn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},kn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},kn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Mw(){}Mw.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||qe(t.source||e.source),t.connectionEnd||qe(t.target||e.target)]};var hu=20,zD=5,gu=Math.round,Aw=20,GD={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function VD(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function WD(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Pw(e,t,n){var i=An(t,e,zD),o=n.split(":")[0],r=gu((t.x-e.x)/2+e.x),a=gu((t.y-e.y)/2+e.y),s,c,l=WD(o,i),u=/h|r|l/.test(o),p=!1,f=!1;return l?(s=u?{x:r,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=VD(i,o),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+hu*(/l/.test(o)?-1:1),y:f?a+hu:a}):(f=r===e.x,s={x:f?r+hu:r,y:e.y+hu*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:xh(e,s,c).concat(s),directions:c,turnNextDirections:f}}function UD(e,t,n){return Pw(e,t,n)}function qD(e,t,n){var i=Pw(t,e,Tw(n));return{waypoints:i.waypoints.slice().reverse(),directions:Tw(i.directions),turnNextDirections:i.turnNextDirections}}function YD(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var o=n+":"+i,r=xh(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function Tw(e){return e.split(":").reverse().join(":")}function KD(e,t,n){var i=gu((t.x-e.x)/2+e.x),o=gu((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:o},{x:t.x,y:o}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function xh(e,t,n){if(n=n||"h:h",!oL(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Ow(n)){var i=UD(e,t,n),o=qD(e,t,n),r=YD(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return KD(e,t,n)}function XD(e,t,n){var i=xh(e,t,n);return i.unshift(e),i.push(t),Lw(i)}function ZD(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=pS(r,"straight")[0]||"h:h",s=GD[a]||0,c=An(e,t,s),l=iL(c,a);n=n||qe(e),i=i||qe(t);var u=l.split(":"),p=Dw(n,e,u[0],rL(c)),f=Dw(i,t,u[1],c);return XD(p,f,l)}function QD(e,t,n,i,o,r){We(n)&&(o=n,r=i,n=qe(e),i=qe(t)),r=U({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&&nL(t,e,i,o),c)||(c=r.connectionStart&&tL(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:ZD(e,t,n,i,r)}function JD(e,t,n){return e>=t&&e<=n}function kw(e,t,n){var i={x:"width",y:"height"};return JD(t[e],n[e],n[e]+n[i[e]])}function eL(e,t,n,i,o){var r={},a,s;return s=An(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),o.preserveDocking==="target"?kw(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:kw(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 tL(e,t,n,i){return wh(e,t,n,i)}function nL(e,t,n,i){var o=i.slice().reverse();return o=wh(e,t,n,o),o?o.reverse():null}function wh(e,t,n,i){function o(u){return u.length<3?!0:u.length>4?!1:!!It(u,function(p,f){var d=u[f-1];return d&&_s(p,d)<3})}function r(u,p,f){var d=yo(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(iv(u[d],p,Aw)||iv(u[d],f,Aw))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=wh(e,t,n,l)),c&&yo(c)?null:c}function iL(e,t){if(Ow(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 oL(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Ow(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 Dw(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 Lw(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return $f(o,r,n,0)||t.push(n),t},[])}var aL=-10,sL=40,cL={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},lL={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},_h={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Js={top:"t",right:"r",bottom:"b",left:"l"};function mu(e){this._elementRegistry=e}Te(mu,Mw),mu.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=Iw(o&&o[0],n)),a||(a=Iw(o&&o[o.length-1],i)),(A(e,"bpmn:Association")||A(e,"bpmn:DataAssociation"))&&o&&!Bw(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=qv(n,s)?cL:lL;return A(e,"bpmn:MessageFlow")?c=pL(n,i,u):(A(e,"bpmn:SequenceFlow")||Bw(n,i))&&(n===i?c={preferredLayouts:yL(n,e,u)}:A(n,"bpmn:BoundaryEvent")?c={preferredLayouts:vL(n,i,a,u)}:ec(n)||ec(i)?c={preferredLayouts:u.subProcess,preserveDocking:dL(n)}:A(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:A(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=U(c,t),l=Lw(QD(n,i,r,a,o,c))),l||[r,a]};function uL(e){var t=e.host;return An(qe(e),t,aL)}function pL(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:fL(e,t)}}function fL(e,t){return A(t,"bpmn:Participant")?"source":A(e,"bpmn:Participant")?"target":ec(t)?"source":ec(e)||A(t,"bpmn:Event")?"target":A(e,"bpmn:Event")?"source":null}function dL(e){return ec(e)?"target":"source"}function Iw(e,t){return e?e.original||e:qe(t)}function Bw(e,t){return A(t,"bpmn:Activity")&&A(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function ec(e){return A(e,"bpmn:SubProcess")&&ut(e)}function jr(e,t){return e===t}function hL(e,t){return t.indexOf(e)!==-1}function Ba(e){var t=/right|left/.exec(e);return t&&t[0]}function Na(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Nw(e,t){return _h[e]===t}function gL(e,t){var n=Ba(e),i=_h[n];return t.indexOf(i)!==-1}function mL(e,t){var n=Na(e),i=_h[n];return t.indexOf(i)!==-1}function $w(e){return e==="right"||e==="left"}function yL(e,t,n){var i=t.waypoints,o=i&&i.length&&An(i[0],e);return o==="top"?n.loop.fromTop:o==="right"?n.loop.fromRight:o==="left"?n.loop.fromLeft:n.loop.fromBottom}function vL(e,t,n,i){var o=qe(e),r=qe(t),a=uL(e),s,c,l=jr(e.host,t),u=hL(a,["top","right","bottom","left"]),p=An(r,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?bL(a,u,e,t,n,i):(s=xL(a,p,u,i.isHorizontal),c=wL(a,p,u,i.isHorizontal),[s+":"+c])}function bL(e,t,n,i,o,r){var a=t?e:r.isHorizontal?Na(e):Ba(e),s=Js[a],c;return t?$w(e)?c=Fw("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=Fw("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function Fw(e,t,n,i){var o=sL;return!(Eh(e,i,n,o)||Eh(e,i,{x:n.x+n.width,y:n.y+n.height},o)||Eh(e,i,qe(t),o))}function Eh(e,t,n,i){return Math.abs(t[e]-n[e])<i}function xL(e,t,n,i){if(n)return Js[e];var o=Na(e),r=Ba(e),a=Na(t),s=Ba(t);if(i){if(jr(o,a)||Nw(r,s))return Js[o]}else if(jr(r,s)||Nw(o,a))return Js[r];return Js[i?r:o]}function wL(e,t,n,i){if(n)return $w(e)?gL(e,t)||jr(e,t)?"h":"v":mL(e,t)||jr(e,t)?"v":"h";var o=Na(e),r=Ba(e),a=Na(t),s=Ba(t);return a&&!s?"v":s&&!a?"h":i?jr(o,a)?"h":"v":jr(r,s)?"v":"h"}mu.$inject=["elementRegistry"];function jw(e){return U({original:e.point.original||e.point},e.actual)}function sr(e,t){this._elementRegistry=e,this._graphicsFactory=t}sr.$inject=["elementRegistry","graphicsFactory"],sr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),o=this.getDockingPoint(e,n),r=e.waypoints.slice(i.idx+1,o.idx);return r.unshift(jw(i)),r.push(jw(o)),r},sr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,o,r,a;return o=n?0:i.length-1,r=i[o],a=this._getIntersection(t,e,n),{point:r,actual:a||r,idx:o}},sr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return Es(i,o,n)},sr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},sr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},sr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Sh={__init__:["modeling","bpmnUpdater"],__depends__:[jk,nO,oO,rO,Qx,aD,cD,hD,Ci,sh,ow],bpmnFactory:["type",Ai],bpmnUpdater:["type",ai],elementFactory:["type",or],modeling:["type",kn],layouter:["type",mu],connectionDocking:["type",sr]};var _L=10,Hw=50,EL=250;function Rh(e,t,n,i){for(var o;o=SL(e,n,t);)n=i(t,n,o);return n}function Ch(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 SL(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=CL(e);return It(o,function(r){if(r===n)return!1;var a=An(r,i,_L);return a==="intersect"})}function RL(e,t){t||(t={});function n(m){return m.source===e?1:-1}var i=t.defaultDistance||Hw,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||EL,c=t.reference||"start";r||(r=PL);function l(m,h){return o==="n"?c==="start"?ze(m).top-ze(h).bottom:c==="center"?ze(m).top-qe(h).y:ze(m).top-ze(h).top:o==="w"?c==="start"?ze(m).left-ze(h).right:c==="center"?ze(m).left-qe(h).x:ze(m).left-ze(h).left:o==="s"?c==="start"?ze(h).top-ze(m).bottom:c==="center"?qe(h).y-ze(m).bottom:ze(h).bottom-ze(m).bottom:c==="start"?ze(h).left-ze(m).right:c==="center"?qe(h).x-ze(m).right:ze(h).right-ze(m).right}var u=e.incoming.filter(r).map(function(m){var h=a(m),g=h<0?l(m.source,e):l(e,m.source);return{id:m.source.id,distance:g,weight:h}}),p=e.outgoing.filter(r).map(function(m){var h=a(m),g=h>0?l(e,m.target):l(m.target,e);return{id:m.target.id,distance:g,weight:h}}),f=u.concat(p).reduce(function(m,h){return m[h.id+"__weight_"+h.weight]=h,m},{}),d=ei(f,function(m,h){var g=h.distance,w=h.weight;return g<0||g>s||(m[String(g)]||(m[String(g)]=0),m[String(g)]+=1*w,(!m.distance||m[m.distance]<m[String(g)])&&(m.distance=g)),m},{});return d.distance||i}function CL(e){var t=Mh(e);return e.host&&(t=t.concat(Mh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Mh(i))},[]))),t}function Mh(e){return AL(e).concat(ML(e))}function ML(e){return e.incoming.map(function(t){return t.source})}function AL(e){return e.outgoing.map(function(t){return t.target})}function PL(){return!0}var TL=100;function zw(e,t,n){e.on("autoPlace",TL,function(i){var o=i.shape,r=i.source;return kL(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}}zw.$inject=["eventBus","modeling","canvas"];function kL(e,t,n){n||(n={});var i=n.defaultDistance||Hw,o=qe(e),r=ze(e);return{x:r.right+i+t.width/2,y:o.y}}function Gw(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Gw.$inject=["eventBus","selection"];const OL={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",zw],autoPlaceSelectionBehavior:["type",Gw]};function Vw(e,t,n){var i=qv(e,n);if(A(t,"bpmn:TextAnnotation"))return LL(e,t,i);if(it(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return IL(e,t,i);if(A(t,"bpmn:FlowNode"))return DL(e,t,i)}function DL(e,t,n){var i=ze(e),o=qe(e),r=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=RL(e,{filter:function(d){return A(d,"bpmn:SequenceFlow")},direction:r.directionHint}),s=30,c=r.minDistance,l=r.baseOrientation;A(e,"bpmn:BoundaryEvent")&&(l=An(e,e.host,-25),l.indexOf(r.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:o.y+Ww(l,c,r)}:{x:o.x+Ww(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Rh(e,t,u,Ch(f))}function Ww(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function LL(e,t,n){var i=ze(e),o=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};kt(e)&&(o=qe(e),n?(o.x+=100,o.y-=50):(o.x+=100,o.y+=50));var r={margin:n?-30:30,minDistance:20},a=n?{y:r}:{x:r};return Rh(e,t,o,Ch(a))}function IL(e,t,n){var i=ze(e),o=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},r={margin:30,minDistance:30},a=n?{x:r}:{y:r};return Rh(e,t,o,Ch(a))}function Uw(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return Vw(o,i,t)})}Uw.$inject=["eventBus","elementRegistry"];const yu={__depends__:[OL],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Uw]},BL=1500;class qw{constructor(t){t.on("moddleCopy.canCopyProperties",BL,({sourceElement:n,targetElement:i})=>{var r;if(!((r=n==null?void 0:n.$instanceOf)!=null&&r.call(n,Er)))return;const o=_n(n);o!==void 0&&i.set("xml:lang",o)})}}jn(qw,"$inject",["eventBus"]);const Yw={__init__:["translationLocaleCopy"],translationLocaleCopy:["type",qw]},Kw=[Wv,Ps,Sh,yu,Lp,Yw];function NL(e={}){pm(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new wa({container:t,moddleExtensions:e.moddleExtensions??Ic,additionalModules:[...Kw,...e.additionalModules??[]]})}const Xw={"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":"풀"},$L={이:["이","가"],을:["을","를"],와:["과","와"]};function FL(e,t){const[n,i]=$L[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 jL={"bpmn:StartEvent":"시작 이벤트","bpmn:EndEvent":"종료 이벤트","bpmn:IntermediateCatchEvent":"중간 이벤트","bpmn:IntermediateThrowEvent":"중간 이벤트","bpmn:BoundaryEvent":"경계 이벤트","bpmn:Task":"작업","bpmn:UserTask":"작업","bpmn:ServiceTask":"작업","bpmn:SendTask":"작업","bpmn:ReceiveTask":"작업","bpmn:ManualTask":"작업","bpmn:ScriptTask":"작업","bpmn:BusinessRuleTask":"작업","bpmn:CallActivity":"작업","bpmn:SubProcess":"서브프로세스","bpmn:ExclusiveGateway":"게이트웨이","bpmn:ParallelGateway":"게이트웨이","bpmn:InclusiveGateway":"게이트웨이","bpmn:EventBasedGateway":"게이트웨이","bpmn:ComplexGateway":"게이트웨이","bpmn:Participant":"풀","bpmn:Lane":"레인","bpmn:TextAnnotation":"주석","bpmn:Group":"그룹","bpmn:DataStoreReference":"데이터 저장소","bpmn:DataObjectReference":"데이터 객체","bpmn:SequenceFlow":"연결선","bpmn:MessageFlow":"메시지 연결선","bpmn:Association":"연관선"},HL="요소";function Ah(e){return(e&&jL[e.type])??HL}const Zw=20;function zL(e){const t=e.replace(/\s+/g," ").trim();return t.length>Zw?`${t.slice(0,Zw)}…`:t}function vu(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:zL(o.name),a=r===void 0?i+Ah(o):r,s=r===void 0?a:`「${r}」`;return n?s+FL(a,n).slice(a.length):s}function GL(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&&Ah(r)===Ah(a);return[vu(e,t,i),vu(e,n,o,s?"다른 ":"")]}function VL(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 WL(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 bu={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function UL(e,t){const n=(o,r)=>vu(t,o,r),i=(o,r,a,s)=>GL(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)}의 ${bu[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)}의 ${bu[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${bu[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${bu[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 qL(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${vu(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const Qw="기타",Ph={error:0,warning:1,info:2};function Jw(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${ct(i)}`,source:"geometry",code:i.kind,severity:VL(i),targetRefs:WL(i),category:Xw[i.kind]??Qw,message:UL(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:Xw[i.ruleId]??Qw,message:qL(i,t)});return n}function e_(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function $a(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function Th(e,t){if(t===void 0||e.length===0)return!1;const n=$a(e[0],t);return e.some(i=>$a(i,t)!==n)}function t_(e,t){const n=Th(e,t);return e.slice().sort((i,o)=>(n?Number($a(o,t))-Number($a(i,t)):0)||Ph[i.severity]-Ph[o.severity])}const n_="i18n-untranslated",i_="i18n-review-requested",kh="i18nDisplay.redrawn",o_=[["untranslated",n_],["reviewRequested",i_]];class Oh{constructor(t,n,i,o,r,a,s,c){jn(this,"config");jn(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,m)=>this.withDisplayText(d,()=>l(f,d,m),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,m,h)=>{const g=this.resolve(f);if(!g||g.native)return p(f,d,m,h);(d??"").trim()!==(m??"").trim()&&i.execute(Pc,{element:f.labelTarget??f,locale:this.displayLocale,text:d,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",f=>{if(!this.config)return;const{element:d,newLabel:m,oldLabel:h}=f.context;(m??"")!==(h??"")&&i.execute(Pc,{element:d.labelTarget??d,locale:this.displayLocale,text:m??"",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=Sr(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=Bo(n).filter(f=>_n(f)),s=f=>f.body??"",c=a.find(f=>_n(f)===o&&s(f)),l=No(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(_n);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,m]of o_)r.toggle(m,(o==null?void 0:o.status)===d);if(!o||o.native)return n();const{target:a,key:s}=Sr((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 o_)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(kh)}}jn(Oh,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const r_={__depends__:[Lp],__init__:["i18nDisplay"],i18nDisplay:["type",Oh]};var YL=new Nr("ov"),KL=500;function Sn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=YL,this._overlayDefaults=U({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=XL(n.getContainer()),this._init()}Sn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Sn.prototype.get=function(e){if(Qn(e)&&(e={id:e}),Qn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?rt(t.overlays,aa({type:e.type})):t.overlays.slice():[]}else return e.type?rt(this._overlays,aa({type:e.type})):e.id?this._overlays[e.id]:null},Sn.prototype.add=function(e,t,n){if(gn(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=U({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Sn.prototype.remove=function(e){var t=this.get(e)||[];We(t)||(t=[t]);var n=this;G(t,function(i){var o=n._getOverlayContainer(i.element,!0);if(i&&(Xi(i.html),Xi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),o){var r=o.overlays.indexOf(i);r!==-1&&o.overlays.splice(r,1)}})},Sn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Sn.prototype.show=function(){xu(this._overlayRoot)},Sn.prototype.hide=function(){xu(this._overlayRoot,!1)},Sn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],il(this._overlayRoot)},Sn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=rn(t);i=r.x,o=r.y}a_(n,i,o),En(e.html,"data-container-id",t.id)},Sn.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,o=t.left,r=t.top;if(t.right!==void 0){var a;i.waypoints?a=rn(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=rn(i).height:s=i.height,r=t.bottom*-1+s}a_(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Sn.prototype._createOverlayContainer=function(e){var t=$t('<div class="djs-overlays" />');Gn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Sn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";s_(this._overlayRoot,n)},Sn.prototype._getOverlayContainer=function(e,t){var n=It(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Sn.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,o,r;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),Qn(i)&&(i=$t(i)),r=this._getOverlayContainer(n),o=$t('<div class="djs-overlay" data-overlay-id="'+t+'">'),Gn(o,{position:"absolute"}),o.appendChild(i),e.type&&Ct(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();xu(o,a===s),e.htmlContainer=o,r.overlays.push(e),r.html.appendChild(o),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Sn.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),o=n&&n.minZoom,r=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(hn(o)&&o>t.scale||hn(r)&&r<t.scale))&&(c=!1),xu(a,c),this._updateOverlayScale(e,t)},Sn.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,o,r=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,o=1):(i=n.min,o=n.max),hn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),hn(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),hn(a)&&(s="scale("+a+","+a+")"),s_(r,s)},Sn.prototype._updateOverlaysVisibilty=function(e){var t=this;G(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Sn.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var o=i.element,r=t.get({element:o});G(r,function(c){t.remove(c.id)});var a=t._getOverlayContainer(o);if(a){Xi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",KL,function(i){var o=i.element,r=t._getOverlayContainer(o,!0);r&&(G(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&&Ct(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 XL(e){var t=$t('<div class="djs-overlay-container" />');return Gn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function a_(e,t,n){Gn(e,{left:t+"px",top:n+"px"})}function xu(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 wu={__init__:["overlays"],overlays:["type",Sn]};function Dh(e,t){t.invoke(de,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}Te(Dh,de),Dh.$inject=["canvas","injector"];const ZL={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Dh]};function Hr(e){return CSS.escape(e)}var QL={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function c_(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return QL[t]})}var JL="bjs-breadcrumbs-shown";function l_(e,t,n){var i=$t('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=Ct(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=he(l),p=It(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(to(p))||n.findRoot(p.id);if(!f&&A(p,"bpmn:Process")){var d=t.find(function(g){var w=he(g);return w&&w.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var m=c_(p.name||p.id),h=$t('<li><span class="bjs-crumb"><a title="'+m+'">'+m+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var u=l.length>1;r.toggle(JL,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}l_.$inject=["eventBus","elementRegistry","canvas"];function eI(e){for(var t=he(e),n=[],i=t;i;i=i.$parent)(A(i,"bpmn:SubProcess")||A(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function u_(e,t){var n=null,i=new tI;e.on("root.set",function(o){var r=o.element,a=t.viewbox(),s=i.get(r);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=r,!(!A(r,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}u_.$inject=["eventBus","canvas"];function tI(){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 p_={x:180,y:160};function zr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}zr.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)})}},zr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(r){var a=r.bpmnElement;if(a){var s=a.$parent;A(a,"bpmn:SubProcess")&&!r.isExpanded&&n.push(a),iI(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},zr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=nI(e),i={x:n.x-p_.x,y:n.y-p_.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)})},zr.prototype._moveToDiPlane=function(e,t){var n=f_(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},zr.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},zr.$inject=["eventBus","moddle"];function f_(e){return A(e,"bpmndi:BPMNDiagram")?e:f_(e.$parent)}function nI(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=ze(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),ul(t)}function iI(e,t){var n=e.$parent;return!(!A(n,"bpmn:SubProcess")||n===t.bpmnElement||it(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var _u=250,oI='<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>',rI="bjs-drilldown-empty";function cr(e,t,n,i,o){de.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=o;var r=this;this.executed("shape.toggleCollapse",_u,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",_u,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],_u,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;r._canDrillDown(l)&&r._addOverlay(l),r._updateDrilldownOverlay(s),r._updateDrilldownOverlay(c),r._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],_u,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;r._canDrillDown(l)&&r._addOverlay(l),r._updateDrilldownOverlay(s),r._updateDrilldownOverlay(c),r._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return r._canDrillDown(a)}).map(function(a){r._addOverlay(a)})})}Te(cr,de),cr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},cr.prototype._canDrillDown=function(e){var t=this._canvas;return A(e,"bpmn:SubProcess")&&t.findRoot(to(e))},cr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=he(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;Ct(i.html).toggle(rI,!o)}},cr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=he(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=$t('<button type="button" class="bjs-drilldown">'+oI+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});r.setAttribute("title",s),r.addEventListener("click",function(){t.setRootElement(t.findRoot(to(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},cr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},cr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const aI={__depends__:[wu,sh,ZL],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",l_],drilldownCentering:["type",u_],drilldownOverlayBehavior:["type",cr],subprocessCompatibility:["type",zr]};function lr(e){Vt.call(this,e)}Te(lr,Vt),lr.prototype._modules=[Wv,aI,wu,Ci,Ps],lr.prototype._moddleExtensions={};var Eu="keyboard.keydown",sI="keyboard.keyup",cI=1e3,d_="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 Vn(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(d_));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Vn.$inject=["config.keyboard","eventBus"],Vn.prototype._keydownHandler=function(e){this._keyHandler(e,Eu)},Vn.prototype._keyupHandler=function(e){this._keyHandler(e,sI)},Vn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Eu,i),n&&e.preventDefault()}},Vn.prototype._isEventIgnored=function(e){return!1},Vn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(d_)),this.unbind(),e=this._node=this._target,$e.bind(e,"keydown",this._keydownHandler),$e.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Vn.prototype.getBinding=function(){return this._node},Vn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),$e.unbind(e,"keydown",this._keydownHandler),$e.unbind(e,"keyup",this._keyupHandler)),this._node=null},Vn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Vn.prototype.addListener=function(e,t,n){bn(e)&&(n=t,t=e,e=cI),this._eventBus.on(n||Eu,e,t)},Vn.prototype.removeListener=function(e,t){this._eventBus.off(t||Eu,e)},Vn.prototype.hasModifier=vO,Vn.prototype.isCmd=oi,Vn.prototype.isShift=Xd,Vn.prototype.isKey=yn;var lI=500;function Fa(e,t){var n=this;e.on("editorActions.init",lI,function(i){var o=i.editorActions;n.registerBindings(t,o)})}Fa.$inject=["eventBus","keyboard"],Fa.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(EO(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(SO(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(bO(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(xO(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(wO(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(_O(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(yn(["+","Add","="],o)&&oi(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(yn(["-","Subtract"],o)&&oi(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(yn("0",o)&&oi(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(yn(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const Lh={__init__:["keyboard","keyboardBindings"],keyboard:["type",Vn],keyboardBindings:["type",Fa]};var uI={moveSpeed:50,moveSpeedAccelerated:200};function h_(e,t,n){var i=this;this._config=U({},uI,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})}}h_.$inject=["config.keyboardMove","keyboard","canvas"];const g_={__depends__:[Lh],__init__:["keyboardMove"],keyboardMove:["type",h_]};var pI=15;function m_(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function o(s){var c=n.start,l=n.button,u=Lr(s),p=zi(u,c);if(!n.dragging&&fI(p)>pI&&(n.dragging=!0,l===0&&kx(e),Yl("grab")),n.dragging){var f=n.last||n.start;p=zi(u,f),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){$e.unbind(document,"mousemove",o),$e.unbind(document,"mouseup",r),n=null,Tx()}function a(s){if(!Pr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Lr(s)},$e.bind(document,"mousemove",o),$e.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}m_.$inject=["eventBus","canvas"];function fI(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const y_={__init__:["moveCanvas"],moveCanvas:["type",m_]};function v_(e,t){var n=qf(e.min),i=qf(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function dI(e,t){return Math.max(e.min,Math.min(e.max,t))}var hI=Math.sign||function(e){return e>=0?1:-1},Ih={min:.2,max:4},b_=10,gI=.1,mI=.75;function oo(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Yn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||mI;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}oo.$inject=["config.zoomScroll","eventBus","canvas"],oo.prototype.scroll=function(t){this._canvas.scroll(t)},oo.prototype.reset=function(){this._canvas.zoom("fit-viewport")},oo.prototype.zoom=function(t,n){var i=v_(Ih,b_*2);this._totalDelta+=t,Math.abs(this._totalDelta)>gI&&(this._zoom(t,n,i),this._totalDelta=0)},oo.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||$b()&&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))*hI(t.deltaY)*r,this.zoom(a,c)}else o?a={dx:r*t.deltaY,dy:0}:a={dx:r*t.deltaX,dy:r*t.deltaY},this.scroll(a)}},oo.prototype.stepZoom=function(t,n){var i=v_(Ih,b_);this._zoom(t,n,i)},oo.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=qf(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(dI(Ih,s),t)},oo.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&$e[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},oo.prototype._init=function(e){this.toggle(e)};const x_={__init__:["zoomScroll"],zoomScroll:["type",oo]};function tc(e){lr.call(this,e)}Te(tc,lr),tc.prototype._navigationModules=[g_,y_,x_],tc.prototype._modules=[].concat(lr.prototype._modules,tc.prototype._navigationModules);function Bh(e){return e&&e[e.length-1]}function w_(e){return e.y}function __(e){return e.x}var yI={left:__,center:__,right:function(e){return e.x+e.width},top:w_,middle:w_,bottom:function(e){return e.y+e.height}};function ja(e,t){this._modeling=e,this._rules=t}ja.$inject=["modeling","rules"],ja.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}},ja.prototype._isType=function(e,t){return t.indexOf(e)!==-1},ja.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=Bh(t),r[e]=u[i]+u[o];else if(this._isType(e,["center","middle"])){if(G(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=Ui(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return r[e]=Bh(c).center,r;l=t[0],t=Ui(t,function(f){return f[i]+f[o]}),u=Bh(t),r[e]=p(l,u)}return r},ja.prototype.trigger=function(e,t){var n=this._modeling,i,o=rt(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:o}),We(i)&&(o=i),!(o.length<2||!i)){var r=yI[t],a=Ui(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const vI={__init__:["alignElements"],alignElements:["type",ja]},bI=new Nr;function Ha(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Ha.$inject=["eventBus"],Ha.prototype.schedule=function(e,t=bI.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Ha.prototype._schedule=function(e,t){const n=xI();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}},Ha.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Ha.prototype._cancel=function(e){clearTimeout(e.executionId)};function xI(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const wI={scheduler:["type",Ha]};var _I="djs-element-hidden",Su=".entry",EI=1e3,E_=8,SI=300;function sn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}sn.$inject=["canvas","elementRegistry","eventBus","scheduler"],sn.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=We(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=We(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},sn.prototype._createContainer=function(){var e=$t('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},sn.prototype.registerProvider=function(e,t){t||(t=e,e=EI),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},sn.prototype.getEntries=function(e){var t=this._getProviders(),n=We(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return G(t,function(o){if(bn(o[n])){var r=o[n](e);bn(r)?i=r(i):G(r,function(a,s){i[s]=a})}}),i},sn.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=En(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},SI);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},sn.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var o=this._current.target,r=this._current.entries,a=r[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(bn(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},sn.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))}},sn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},sn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;G(t,function(o,r){var a=o.group||"default",s=$t(o.html||'<div class="entry" draggable="true"></div>'),c;En(s,"data-action",r),c=Rt("[data-group="+Hr(a)+"]",n),c||(c=$t('<div class="group"></div>'),En(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&RI(s,o.className),o.title&&En(s,"title",o.title),o.imageUrl&&(i=$t("<img>"),En(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Ct(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},sn.prototype._createHtml=function(e){var t=this,n=$t('<div class="djs-context-pad"></div>');return ti.bind(n,Su,"click",function(i){t.trigger("click",i)}),ti.bind(n,Su,"dragstart",function(i){t.trigger("dragstart",i)}),ti.bind(n,Su,"mouseover",function(i){t.trigger("mouseover",i)}),ti.bind(n,Su,"mouseout",function(i){t.trigger("mouseout",i)}),$e.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},sn.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()&&MI(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},sn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},sn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return We(e)!==We(n)?!1:We(e)?e.length===n.length&&Lo(e,function(i){return n.includes(i)}):n===e},sn.prototype.isShown=function(){return this.isOpen()&&Ct(this._current.html).has("open")},sn.prototype.show=function(){this.isOpen()&&(Ct(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},sn.prototype.hide=function(){this.isOpen()&&(Ct(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},sn.prototype._getPosition=function(e){if(!We(e)&&kt(e)){var t=this._canvas.viewbox(),n=CI(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+E_*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+E_*this._canvas.zoom(),top:s.top-a.top}},sn.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")},sn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=We(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,_I)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},sn.prototype._getTargetBounds=function(e){var t=this,n=We(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 RI(e,t){var n=Ct(e);t=We(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function CI(e){return e.waypoints[e.waypoints.length-1]}function MI(e,t){return e=We(e)?e:[e],t=We(t)?t:[t],e.length===t.length&&Lo(e,function(n){return t.includes(n)})}const S_={__depends__:[ql,wI,wu],contextPad:["type",sn]};var Ru,Ut,R_,ur,C_,M_,A_,Nh,Cu,nc,P_,$h,Fh,jh,Mu={},Au=[],AI=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Pu=Array.isArray;function Mo(e,t){for(var n in t)e[n]=t[n];return e}function Hh(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function T_(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?Ru.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 Tu(e,a,i,o,null)}function Tu(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??++R_,__i:-1,__u:0};return o==null&&Ut.vnode!=null&&Ut.vnode(r),r}function ku(e){return e.children}function Ou(e,t){this.props=e,this.context=t}function Gr(e,t){if(t==null)return e.__?Gr(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"?Gr(e):null}function PI(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=Mo({},t);r.__v=t.__v+1,Ut.vnode&&Ut.vnode(r),zh(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Gr(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,$_(i,r,o),t.__e=t.__=null,r.__e!=n&&k_(r)}}function k_(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}),k_(e)}function O_(e){(!e.__d&&(e.__d=!0)&&ur.push(e)&&!Du.__r++||C_!=Ut.debounceRendering)&&((C_=Ut.debounceRendering)||M_)(Du)}function Du(){try{for(var e,t=1;ur.length;)ur.length>t&&ur.sort(A_),e=ur.shift(),t=ur.length,PI(e)}finally{ur.length=Du.__r=0}}function D_(e,t,n,i,o,r,a,s,c,l,u){var p,f,d,m,h,g,w=i&&i.__k||Au,x=t.length;for(c=TI(n,t,w,c,x),p=0;p<x;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&w[d.__i]||Mu,d.__i=p,g=zh(e,d,f,o,r,a,s,c,l,u),m=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Gh(f.ref,null,d),u.push(d.ref,d.__c||m,d)),h==null&&m!=null&&(h=m),4&d.__u?(c=L_(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&g!==void 0?c=g:m&&(c=m.nextSibling),d.__u&=-7);return n.__e=h,c}function TI(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]=Tu(null,a,null,null,null):Pu(a)?a=e.__k[r]=Tu(ku,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=Tu(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=kI(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=Gr(s)),j_(s,s));return i}function L_(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=L_(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Gr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function kI(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 I_(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||AI.test(t)?n:n+"px"}function Lu(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||I_(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||I_(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(P_,"$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[nc]=i[nc]:(n[nc]=$h,e.addEventListener(t,r?jh:Fh,r)):e.removeEventListener(t,r?jh:Fh,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 B_(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Cu]==null)t[Cu]=$h++;else if(t[Cu]<n[nc])return;return n(Ut.event?Ut.event(t):t)}}}function zh(e,t,n,i,o,r,a,s,c,l){var u,p,f,d,m,h,g,w,x,y,v,S,_,T,P,D,N=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Ut.__b)&&u(t);e:if(typeof N=="function"){p=a.length;try{if(x=t.props,y=N.prototype&&N.prototype.render,v=(u=N.contextType)&&i[u.__c],S=u?v?v.props.value:u.__:i,n.__c?w=(f=t.__c=n.__c).__=f.__E:(y?t.__c=f=new N(x,S):(t.__c=f=new Ou(x,S),f.constructor=N,f.render=DI),v&&v.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&N.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Mo({},f.__s)),Mo(f.__s,N.getDerivedStateFromProps(x,f.__s))),m=f.props,h=f.state,f.__v=t,d)y&&N.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&N.getDerivedStateFromProps==null&&x!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(x,S),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(x,f.__s,S)===!1){t.__v!=n.__v&&(f.props=x,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(j){j&&(j.__=t)}),Au.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Gr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(x,f.__s,S),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=S,f.props=x,f.__P=e,f.__e=!1,_=Ut.__r,T=0,y)f.state=f.__s,f.__d=!1,_&&_(t),u=f.render(f.props,f.state,f.context),Au.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,_&&_(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++T<25);f.state=f.__s,f.getChildContext!=null&&(i=Mo(Mo({},i),f.getChildContext())),y&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),P=u!=null&&u.type===ku&&u.key==null?F_(u.props.children):u,s=D_(e,Pu(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(j){if(a.length=p,t.__v=null,c||r!=null){if(j.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;r!=null&&(r[r.indexOf(s)]=null),t.__e=s}else if(r!=null)for(D=r.length;D--;)Hh(r[D])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),j.then||N_(t),Ut.__e(j,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=OI(n.__e,t,n,i,o,r,a,c,l);return(u=Ut.diffed)&&u(t),128&t.__u?void 0:s}function N_(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(N_))}function $_(e,t,n){for(var i=0;i<n.length;i++)Gh(n[i],n[++i],n[++i]);Ut.__c&&Ut.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Ut.__e(r,o.__v)}})}function F_(e){return typeof e!="object"||e==null||e.__b>0?e:Pu(e)?e.map(F_):e.constructor!==void 0?null:Mo({},e)}function OI(e,t,n,i,o,r,a,s,c){var l,u,p,f,d,m,h,g=n.props||Mu,w=t.props,x=t.type;if(x=="svg"?o="http://www.w3.org/2000/svg":x=="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==!!x&&(x?d.localName==x:d.nodeType==3)){e=d,r[l]=null;break}}if(e==null){if(x==null)return document.createTextNode(w);e=document.createElementNS(o,x,w.is&&w),s&&(Ut.__m&&Ut.__m(t,r),s=!1),r=null}if(x==null)g===w||s&&e.data==w||(e.data=w);else{if(r=x=="textarea"&&w.defaultValue!=null?null:r&&Ru.call(e.childNodes),!s&&r!=null)for(g={},l=0;l<e.attributes.length;l++)g[(d=e.attributes[l]).name]=d.value;for(l in g)d=g[l],l=="dangerouslySetInnerHTML"?p=d:l=="children"||l in w||l=="value"&&"defaultValue"in w||l=="checked"&&"defaultChecked"in w||Lu(e,l,null,d,o);for(l in w)d=w[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?m=d:l=="checked"?h=d:s&&typeof d!="function"||g[l]===d||Lu(e,l,d,g[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=""),D_(t.type=="template"?e.content:e,Pu(f)?f:[f],t,n,i,x=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&Gr(n,0),s,c),r!=null)for(l=r.length;l--;)Hh(r[l]);s&&x!="textarea"||(l="value",x=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[l]||x=="progress"&&!m||x=="option"&&m!=g[l])&&Lu(e,l,m,g[l],o),l="checked",h!=null&&h!=e[l]&&Lu(e,l,h,g[l],o))}return e}function Gh(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){Ut.__e(o,n)}}function j_(e,t,n){var i,o;if(Ut.unmount&&Ut.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Gh(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Ut.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&j_(i[o],t,n||typeof e.type!="function");n||Hh(e.__e),e.__c=e.__=e.__e=void 0}function DI(e,t,n){return this.constructor(e,n)}function H_(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Ut.__&&Ut.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],zh(t,e=t.__k=T_(ku,null,[e]),o||Mu,Mu,t.namespaceURI,o?null:t.firstChild?Ru.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),$_(r,e,a),e.props.children=null}Ru=Au.slice,Ut={__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}},R_=0,Ou.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Mo({},this.state),typeof e=="function"&&(e=e(Mo({},n),this.props)),e&&Mo(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),O_(this))},Ou.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),O_(this))},Ou.prototype.render=ku,ur=[],M_=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,A_=function(e,t){return e.__v.__b-t.__v.__b},Du.__r=0,Nh=Math.random().toString(8),Cu="__d"+Nh,nc="__a"+Nh,P_=/(PointerCapture)$|Capture$/i,$h=0,Fh=B_(!1),jh=B_(!0);var z_=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,z_(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},G_=new Map;function LI(e){var t=G_.get(this);return t||(t=new Map,G_.set(this,t)),(t=z_(this,t.get(e)||(t.set(e,t=(function(n){for(var i,o,r=1,a="",s="",c=[0],l=function(f){r===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):r===3&&(f||a)?(c.push(3,f,a),r=2):r===2&&a==="..."&&f?c.push(4,f,0):r===2&&a&&!f?c.push(5,0,!0,a):r>=5&&((a||!f&&r===5)&&(c.push(r,0,a,o),r=6),f&&(c.push(r,f,0,o),r=6)),a=""},u=0;u<n.length;u++){u&&(r===1&&l(),l(u));for(var p=0;p<n[u].length;p++)i=n[u][p],r===1?i==="<"?(l(),c=[c],r=3):a+=i:r===4?a==="--"&&i===">"?(r=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),r=1):r&&(i==="="?(r=5,o=a,a=""):i==="/"&&(r<5||n[u][p+1]===">")?(l(),r===3&&(c=c[0]),r=c,(c=c[0]).push(2,0,r),r=0):i===" "||i===" "||i===`
11
+ `||i==="\r"?(l(),r=2):a+=i),r===3&&a==="!--"&&(r=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var Dt=LI.bind(T_),za,cn,Vh,V_,ic=0,W_=[],vn=Ut,U_=vn.__b,q_=vn.__r,Y_=vn.diffed,K_=vn.__c,X_=vn.unmount,Z_=vn.__;function Iu(e,t){vn.__h&&vn.__h(cn,e,ic||t),ic=0;var n=cn.__H||(cn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Wh(e){return ic=1,II(J_,e)}function II(e,t,n){var i=Iu(za++,2);if(i.t=e,!i.__c&&(i.__=[J_(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=cn,!cn.__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 m=d.__[0];d.__=d.__N,d.__N=void 0,m!==d.__[0]&&(p=!0)}}),r){var f=r.call(this,s,c,l);return u?f||p:f}return!u||p};cn.__f=!0;var r=cn.shouldComponentUpdate,a=cn.componentWillUpdate;cn.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)},cn.shouldComponentUpdate=o}return i.__N||i.__}function Bu(e,t){var n=Iu(za++,3);!vn.__s&&Yh(n.__H,t)&&(n.__=e,n.u=t,cn.__H.__h.push(n))}function Uh(e,t){var n=Iu(za++,4);!vn.__s&&Yh(n.__H,t)&&(n.__=e,n.u=t,cn.__h.push(n))}function Nu(e){return ic=5,Ao(function(){return{current:e}},[])}function Ao(e,t){var n=Iu(za++,7);return Yh(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function oc(e,t){return ic=8,Ao(function(){return e},t)}function BI(){for(var e;e=W_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some($u),t.__h.some(qh),t.__h=[]}catch(n){t.__h=[],vn.__e(n,e.__v)}}}vn.__b=function(e){cn=null,U_&&U_(e)},vn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Z_&&Z_(e,t)},vn.__r=function(e){q_&&q_(e),za=0;var t=(cn=e.__c).__H;t&&(Vh===cn?(t.__h=[],cn.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some($u),t.__h.some(qh),t.__h=[],za=0)),Vh=cn},vn.diffed=function(e){Y_&&Y_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(W_.push(t)!==1&&V_===vn.requestAnimationFrame||((V_=vn.requestAnimationFrame)||NI)(BI)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Vh=cn=null},vn.__c=function(e,t){t.some(function(n){try{n.__h.some($u),n.__h=n.__h.filter(function(i){return!i.__||qh(i)})}catch(i){t.some(function(o){o.__h&&(o.__h=[])}),t=[],vn.__e(i,n.__v)}}),K_&&K_(e,t)},vn.unmount=function(e){X_&&X_(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{$u(i)}catch(o){t=o}}),n.__H=void 0,t&&vn.__e(t,n.__v))};var Q_=typeof requestAnimationFrame=="function";function NI(e){var t,n=function(){clearTimeout(i),Q_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Q_&&(t=requestAnimationFrame(n))}function $u(e){var t=cn,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),cn=t}function qh(e){var t=cn;e.__c=e.__(),cn=t}function Yh(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function J_(e,t){return typeof t=="function"?t(e):t}function $I(e){const{navigationStack:t,setNavigationStack:n}=e,i=Ao(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),o=t.length>0?()=>n([]):null,r=t.length>0?t[t.length-1].label:null;return Dt`
12
12
  <div class="djs-popup-breadcrumbs">
13
13
  ${o&&Dt`
14
14
  <button
@@ -41,7 +41,7 @@
41
41
  </span>
42
42
  `}
43
43
  </div>
44
- `}function Yw(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=Yw(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Fu(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Yw(e))&&(i&&(i+=" "),i+=t);return i}function OI(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:o,title:r}=e,a=Ao(()=>DI(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return Dt`
44
+ `}function e0(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=e0(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Fu(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=e0(e))&&(i&&(i+=" "),i+=t);return i}function FI(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:o,title:r}=e,a=Ao(()=>jI(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return Dt`
45
45
  <div class="djs-popup-header">
46
46
  <h3 class="djs-popup-title" title=${r}>${r}</h3>
47
47
  ${a.map(l=>Dt`
@@ -50,7 +50,7 @@
50
50
  ${l.entries.map(u=>Dt`
51
51
  <li key=${u.id}>
52
52
  <${s(u)?"button":"span"}
53
- class=${LI(u,u===i)}
53
+ class=${HI(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 DI(e){return e.reduce((t,n)=>{const i=n.group||"default",o=t.find(r=>r.id===i);return o?o.entries.push(n):t.push({id:i,entries:[n]}),t},[])}function LI(e,t){return Fu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Kw(e,t){return`${e}-entry-${t.id}`}function II(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:o,onMouseLeave:r,onAction:a}=e,s=(l,u)=>{if(!n.disabled)return a(l,n,u)},c=!n.entries;return Dt`
73
+ `}function jI(e){return e.reduce((t,n)=>{const i=n.group||"default",o=t.find(r=>r.id===i);return o?o.entries.push(n):t.push({id:i,entries:[n]}),t},[])}function HI(e,t){return Fu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function t0(e,t){return`${e}-entry-${t.id}`}function zI(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:o,onMouseLeave:r,onAction:a}=e,s=(l,u)=>{if(!n.disabled)return a(l,n,u)},c=!n.entries;return Dt`
74
74
  <li
75
75
  class=${Fu("entry",{selected:i,disabled:n.disabled})}
76
76
  data-id=${n.id}
77
- id=${Kw(t,n)}
77
+ id=${t0(t,n)}
78
78
  role="option"
79
79
  aria-selected=${i||void 0}
80
80
  aria-haspopup=${n.entries?"true":void 0}
@@ -131,7 +131,7 @@
131
131
  </div>
132
132
  `}
133
133
  </li>
134
- `}function BI(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:o,idPrefix:r,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=Nu();Vh(()=>{if(!o||!o.current)return;const h=p.current;if(!h)return;const m=h.querySelector(".selected");m&&NI(m)},[t]);const f=()=>{o.current=!1},d=h=>{o.current||n(h)},g=()=>{o.current||n(null)};return Dt`
134
+ `}function GI(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:o,idPrefix:r,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=Nu();Uh(()=>{if(!o||!o.current)return;const h=p.current;if(!h)return;const g=h.querySelector(".selected");g&&VI(g)},[t]);const f=()=>{o.current=!1},d=h=>{o.current||n(h)},m=()=>{o.current||n(null)};return Dt`
135
135
  <div
136
136
  class="djs-popup-results"
137
137
  ref=${p}
@@ -144,7 +144,7 @@
144
144
  >
145
145
  ${i.map(h=>Dt`
146
146
  ${h.name&&Dt`
147
- <div key=${h.id} id=${Xw(r,h)} class="entry-header" title=${h.name}>
147
+ <div key=${h.id} id=${n0(r,h)} class="entry-header" title=${h.name}>
148
148
  ${h.name}
149
149
  </div>
150
150
  `}
@@ -152,52 +152,52 @@
152
152
  class="djs-popup-group"
153
153
  data-group=${h.id}
154
154
  role="group"
155
- aria-labelledby=${h.name?Xw(r,h):void 0}
155
+ aria-labelledby=${h.name?n0(r,h):void 0}
156
156
  >
157
- ${h.entries.map(m=>Dt`
158
- <${II}
159
- key=${m.id}
157
+ ${h.entries.map(g=>Dt`
158
+ <${zI}
159
+ key=${g.id}
160
160
  idPrefix=${r}
161
- entry=${m}
162
- selected=${m===t}
163
- onMouseEnter=${()=>d(m)}
164
- onMouseLeave=${g}
161
+ entry=${g}
162
+ selected=${g===t}
163
+ onMouseEnter=${()=>d(g)}
164
+ onMouseLeave=${m}
165
165
  ...${u}
166
166
  />
167
167
  `)}
168
168
  </ul>
169
169
  `)}
170
170
  </div>
171
- `}function Xw(e,t){return`${e}-group-${t.id}`}function NI(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const $I=new Ir("djs-popup");function FI(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]=Gh([]);Bu(()=>{m([])},[f]);const[_,x]=Gh(""),y=_.trim().length>0,v=Ao(()=>zI(f),[f]),E=Ao(()=>dn(l)?v.length>5:!1,[l,v]),w=Ao(()=>{const U=h.length?h[h.length-1].entries:f;return E?y?p(v.filter(({searchable:Y})=>Y!==!1),_,{keys:["label","search","description"]}).map(({item:Y})=>Y):U.filter(({rank:Y=0})=>Y>=0):U},[E,y,v,_,p,h,f]),T=Ao(()=>y?w.length?[{id:"default",entries:w}]:[]:GI(w),[w,y]),[P,O]=Gh(w[0]),B=Nu(null),$=Nu(!1),H=Ao(()=>$I.next(),[]),Q=`${H}-results`,J=P&&Kw(H,P);Bu(()=>{const U=B.current;U&&w.includes(U)?O(U):O(w[0]),B.current=null},[w]);const X=oc(U=>{const Y=HI(T);let he=Y.indexOf(P)+U;he<0&&(he=Y.length-1),he>=Y.length&&(he=0),$.current=!0,O(Y[he])},[T,P]),me=oc(U=>{U>0&&P&&P.entries&&($.current=!0,m(Y=>[...Y,P])),U<0&&h.length>0&&($.current=!0,B.current=h[h.length+U],m(Y=>Y.slice(0,U)))},[P,h]),Ae=oc((U,Y,re)=>{if(!(!Y||Y.disabled))return Y.entries?(U.preventDefault(),me(1)):n(U,Y,re)},[n,me]),Oe=oc(U=>{if(U.key==="Enter"&&P){const Y=U.target;return!!Mr(Y,"a, button",!0)||P.disabled?void 0:Ae(U,P)}if(U.key==="Backspace"){const Y=U.target;if(!(Ef(Y,"input")&&Y.value!==""))return me(-1),U.preventDefault()}if(U.key==="ArrowUp")return X(-1),U.preventDefault();if(U.key==="ArrowDown")return X(1),U.preventDefault();if(U.key==="ArrowRight")return me(1),U.preventDefault();if(U.key==="ArrowLeft")return me(-1),U.preventDefault()},[P,X,me,Ae]),Ee=oc(U=>{Ef(U.target,"input")&&x(()=>U.target.value)},[x]);Bu(()=>(d(),()=>{g()}),[]);const W=!y&&h.length>0,ne=(a||o.length>0)&&!W;return Dt`
172
- <${Zw}
171
+ `}function n0(e,t){return`${e}-group-${t.id}`}function VI(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const WI=new Nr("djs-popup");function UI(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:m}=e,[h,g]=Wh([]);Bu(()=>{g([])},[f]);const[w,x]=Wh(""),y=w.trim().length>0,v=Ao(()=>KI(f),[f]),S=Ao(()=>hn(l)?v.length>5:!1,[l,v]),_=Ao(()=>{const q=h.length?h[h.length-1].entries:f;return S?y?p(v.filter(({searchable:X})=>X!==!1),w,{keys:["label","search","description"]}).map(({item:X})=>X):q.filter(({rank:X=0})=>X>=0):q},[S,y,v,w,p,h,f]),T=Ao(()=>y?_.length?[{id:"default",entries:_}]:[]:XI(_),[_,y]),[P,D]=Wh(_[0]),N=Nu(null),j=Nu(!1),H=Ao(()=>WI.next(),[]),Q=`${H}-results`,ne=P&&t0(H,P);Bu(()=>{const q=N.current;q&&_.includes(q)?D(q):D(_[0]),N.current=null},[_]);const W=oc(q=>{const X=YI(T);let ye=X.indexOf(P)+q;ye<0&&(ye=X.length-1),ye>=X.length&&(ye=0),j.current=!0,D(X[ye])},[T,P]),ee=oc(q=>{q>0&&P&&P.entries&&(j.current=!0,g(X=>[...X,P])),q<0&&h.length>0&&(j.current=!0,N.current=h[h.length+q],g(X=>X.slice(0,q)))},[P,h]),Se=oc((q,X,ce)=>{if(!(!X||X.disabled))return X.entries?(q.preventDefault(),ee(1)):n(q,X,ce)},[n,ee]),De=oc(q=>{if(q.key==="Enter"&&P){const X=q.target;return!!Pr(X,"a, button",!0)||P.disabled?void 0:Se(q,P)}if(q.key==="Backspace"){const X=q.target;if(!(Rf(X,"input")&&X.value!==""))return ee(-1),q.preventDefault()}if(q.key==="ArrowUp")return W(-1),q.preventDefault();if(q.key==="ArrowDown")return W(1),q.preventDefault();if(q.key==="ArrowRight")return ee(1),q.preventDefault();if(q.key==="ArrowLeft")return ee(-1),q.preventDefault()},[P,W,ee,Se]),_e=oc(q=>{Rf(q.target,"input")&&x(()=>q.target.value)},[x]);Bu(()=>(d(),()=>{m()}),[]);const Y=!y&&h.length>0,ie=(a||o.length>0)&&!Y;return Dt`
172
+ <${i0}
173
173
  onClose=${t}
174
- onKeyup=${Ee}
175
- onKeydown=${Oe}
174
+ onKeyup=${_e}
175
+ onKeydown=${De}
176
176
  className=${i}
177
177
  position=${r}
178
178
  width=${s}
179
179
  scale=${c}
180
180
  navigationStack=${h}
181
181
  >
182
- ${ne&&Dt`
183
- <${OI}
182
+ ${ie&&Dt`
183
+ <${FI}
184
184
  headerEntries=${o}
185
185
  onSelect=${n}
186
186
  selectedEntry=${P}
187
- setSelectedEntry=${O}
187
+ setSelectedEntry=${D}
188
188
  title=${a}
189
189
  />
190
190
  `}
191
- ${W&&Dt`
192
- <${kI}
191
+ ${Y&&Dt`
192
+ <${$I}
193
193
  navigationStack=${h}
194
- setNavigationStack=${m}
194
+ setNavigationStack=${g}
195
195
  />
196
196
  `}
197
197
  ${f.length>0&&Dt`
198
198
  <div class="djs-popup-body">
199
199
 
200
- ${E&&Dt`
200
+ ${S&&Dt`
201
201
  <div class="djs-popup-search">
202
202
  <svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
203
203
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
@@ -209,7 +209,7 @@
209
209
  aria-label="${a||"Search"}"
210
210
  aria-expanded="true"
211
211
  aria-controls=${Q}
212
- aria-activedescendant=${J||void 0}
212
+ aria-activedescendant=${ne||void 0}
213
213
  aria-autocomplete="list"
214
214
  />
215
215
  </div>
@@ -217,21 +217,21 @@
217
217
 
218
218
  ${y&&Dt`
219
219
  <div class="djs-popup-search-count" aria-live="polite">
220
- ${w.length} ${w.length===1?"result":"results"} found
220
+ ${_.length} ${_.length===1?"result":"results"} found
221
221
  </div>
222
222
  `}
223
223
 
224
- <${BI}
224
+ <${GI}
225
225
  groupedEntries=${T}
226
226
  selectedEntry=${P}
227
- setSelectedEntry=${O}
228
- keyboardSelection=${$}
229
- onAction=${Ae}
227
+ setSelectedEntry=${D}
228
+ keyboardSelection=${j}
229
+ onAction=${Se}
230
230
  idPrefix=${H}
231
231
  id=${Q}
232
232
  ariaLabel=${a||"Results"}
233
- tabIndex=${E?-1:0}
234
- ariaActivedescendant=${E?void 0:J||void 0}
233
+ tabIndex=${S?-1:0}
234
+ ariaActivedescendant=${S?void 0:ne||void 0}
235
235
  />
236
236
 
237
237
  ${P&&P.documentationRef&&Dt`
@@ -239,7 +239,7 @@
239
239
  <a
240
240
  class="djs-popup-footer-docs"
241
241
  href=${P.documentationRef}
242
- onClick=${U=>U.stopPropagation()}
242
+ onClick=${q=>q.stopPropagation()}
243
243
  aria-label=${P.label?`Open entry documentation for ${P.label}`:"Open entry documentation"}
244
244
  target="_blank"
245
245
  rel="noopener"
@@ -254,14 +254,14 @@
254
254
  `}
255
255
  </div>
256
256
  `}
257
- ${u&&w.length===0&&Dt`
258
- <div class="djs-popup-no-results">${bn(u)?u(_):u}</div>
257
+ ${u&&_.length===0&&Dt`
258
+ <div class="djs-popup-no-results">${bn(u)?u(w):u}</div>
259
259
  `}
260
- </${Zw}>
261
- `}function Zw(e){const{onClose:t,onKeydown:n,onKeyup:i,className:o,children:r,navigationStack:a,position:s}=e,c=Nu();return Vh(()=>{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]),Vh(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),Bu(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!Mr(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",l),document.body.addEventListener("click",u,!0),()=>{document.documentElement.removeEventListener("keydown",l),document.body.removeEventListener("click",u,!0)}},[]),Dt`
260
+ </${i0}>
261
+ `}function i0(e){const{onClose:t,onKeydown:n,onKeyup:i,className:o,children:r,navigationStack:a,position:s}=e,c=Nu();return Uh(()=>{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]),Uh(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),Bu(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!Pr(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",l),document.body.addEventListener("click",u,!0),()=>{document.documentElement.removeEventListener("keydown",l),document.body.removeEventListener("click",u,!0)}},[]),Dt`
262
262
  <div
263
263
  class=${Fu("djs-popup",o)}
264
- style=${jI(e)}
264
+ style=${qI(e)}
265
265
  onKeydown=${n}
266
266
  onKeyup=${i}
267
267
  ref=${c}
@@ -269,10 +269,10 @@
269
269
  >
270
270
  ${r}
271
271
  </div>
272
- `}function jI(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:dn(t)?n:void 0,maxWidth:dn(t)?"unset":void 0,"transform-origin":"top left"}}function HI(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function zI(e){const t=[];function n(i){i.forEach(o=>{if(o.entries){n(o.entries);return}t.push(o)})}return n(e),t}function GI(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 VI="data-id",Qw=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],WI=1e3;function Ut(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var o=dn(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()})}Ut.$inject=["config.popupMenu","eventBus","canvas","search"],Ut.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:o,options:r}=this._current,a=Jw(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),l=this._updateScale(this._current.container);Iw(Dt`
273
- <${FI}
272
+ `}function qI(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:hn(t)?n:void 0,maxWidth:hn(t)?"unset":void 0,"transform-origin":"top left"}}function YI(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function KI(e){const t=[];function n(i){i.forEach(o=>{if(o.entries){n(o.entries);return}t.push(o)})}return n(e),t}function XI(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 ZI="data-id",o0=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],QI=1e3;function qt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var o=hn(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:o},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",r=>{const a=this.isOpen()&&this._current.target;r.element===a&&this.refresh()})}qt.$inject=["config.popupMenu","eventBus","canvas","search"],qt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:o,options:r}=this._current,a=r0(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),l=this._updateScale(this._current.container);H_(Dt`
273
+ <${UI}
274
274
  onClose=${f=>this.close(f)}
275
- onSelect=${(f,d,g)=>this.trigger(f,d,g)}
275
+ onSelect=${(f,d,m)=>this.trigger(f,d,m)}
276
276
  position=${c}
277
277
  className=${t}
278
278
  entries=${a}
@@ -284,7 +284,7 @@
284
284
  searchFn=${this._search}
285
285
  ...${{...r}}
286
286
  />
287
- `,this._current.container)},Ut.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()},Ut.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()},Ut.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)}},Ut.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Ut.prototype.reset=function(){const e=this._current.container;Iw(null,e),Xi(e)},Ut.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Ut.prototype._onOpened=function(){this._emit("opened")},Ut.prototype._onClosed=function(){this._emit("closed")},Ut.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=$t(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Ut.prototype._bindAutoClose=function(){this._eventBus.once(Qw,this.close,this)},Ut.prototype._unbindAutoClose=function(){this._eventBus.off(Qw,this.close,this)},Ut.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),dn(n)&&e<n&&(o=n),dn(i)&&e>i&&(o=i)),o},Ut.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}},Ut.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},Ut.prototype.registerProvider=function(e,t,n){n||(n=t,t=WI),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Ut.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Ut.prototype._getEntries=function(e,t){var n={};return z(t,function(i){if(!i.getPopupMenuEntries){z(i.getEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=qi(r,["id"])});return}var o=i.getPopupMenuEntries(e);bn(o)?n=o(n):z(o,function(r,a){n[a]=r})}),n},Ut.prototype._getHeaderEntries=function(e,t){var n={};return z(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;z(i.getHeaderEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=qi(r,["id"])});return}var o=i.getPopupMenuHeaderEntries(e);bn(o)?n=o(n):z(o,function(r,a){n[a]=r})}),n},Ut.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>bn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Ut.prototype.isOpen=function(){return!!this._current},Ut.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let o=Mr(e.delegateTarget||e.target,".entry",!0),r=Sn(o,VI);t={id:r,...this._getEntry(r)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(bn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Ut.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 Jw(e,t=[]){return Object.entries(e).map(([n,i])=>{const o={id:n,...i};return o.entries?o.entries=Jw(o.entries,[...t,...e0(o.search)]):t.length&&(o.search=[...t,...e0(o.search)]),o})}function e0(e){return e?We(e)?e:[e]:[]}function UI(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=qI(r,o,i);return a?{item:r,tokens:a}:[]}).sort(YI(i))}function qI(e,t,n){const{matchedWords:i,tokens:o}=n.reduce((r,a)=>{const s=e[a],{tokens:c,matchedWords:l}=We(s)?s.reduce((u,p)=>{const{tokens:f,matchedWords:d}=r0(p,t);return{tokens:[...u.tokens,f],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):r0(s,t);return{tokens:{...r.tokens,[a]:c},matchedWords:{...r.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:o}function YI(e){return(t,n)=>{let i=0,o=1;for(const r of e){const a=KI(t.tokens[r],n.tokens[r]);if(a!==0){i+=a*o,o*=t0;continue}const s=XI(t.item[r],n.item[r]);if(s!==0){i+=s*o,o*=t0;continue}}return i}}function KI(e,t){return n0(t)-n0(e)}const t0=.5,ja={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function n0(e){const t=e.reduce((s,c)=>s+i0(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 i0(e){if(We(e))return Math.max(...e.map(i0));const t=Math.log(e.value.length);return e.match?(e.start?e.end?ja.FULL:e.wordEnd?ja.START_FULL_WORD:ja.START_WORD_PART:e.wordStart?ja.WORD_START:ja.WORD_PART)*t:ja.NO_MATCH*t}function o0(e=""){return We(e)?e.join(", "):e}function XI(e,t){return o0(e).localeCompare(o0(t))}function r0(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},o=t.map(ZI),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)),_=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:_,start:d,end:g,all:h});const x=h?t:[u];for(const y of x)i[y.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function ZI(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const a0={search:["value",UI]},qh={__depends__:[a0],__init__:["popupMenu"],popupMenu:["type",Ut]};var s0={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
+ `,this._current.container)},qt.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");var o=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(o===!1)return;this.isOpen()&&this.close();const{entries:r,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:r,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},qt.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:o}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:o},this._emit("refresh"),this._render()},qt.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),o=this._getHeaderEntries(e,n),r=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:o,emptyPlaceholder:r,empty:!(Object.keys(i).length||Object.keys(o).length)}},qt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},qt.prototype.reset=function(){const e=this._current.container;H_(null,e),Xi(e)},qt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},qt.prototype._onOpened=function(){this._emit("opened")},qt.prototype._onClosed=function(){this._emit("closed")},qt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=$t(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},qt.prototype._bindAutoClose=function(){this._eventBus.once(o0,this.close,this)},qt.prototype._unbindAutoClose=function(){this._eventBus.off(o0,this.close,this)},qt.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,o=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),hn(n)&&e<n&&(o=n),hn(i)&&e>i&&(o=i)),o},qt.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),o={},r=t.x,a=t.y;return t.x+i.width>n.width&&(o.x=!0),t.y+i.height>n.height&&(o.y=!0),o.x&&o.y?(r=t.x-i.width,a=t.y-i.height):o.x?(r=t.x-i.width,a=t.y):o.y&&t.y<i.height?(r=t.x,a=10):o.y&&(r=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:r,y:a}},qt.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length?!0:this._getContext(e,t).empty},qt.prototype.registerProvider=function(e,t,n){n||(n=t,t=QI),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},qt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},qt.prototype._getEntries=function(e,t){var n={};return G(t,function(i){if(!i.getPopupMenuEntries){G(i.getEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=qi(r,["id"])});return}var o=i.getPopupMenuEntries(e);bn(o)?n=o(n):G(o,function(r,a){n[a]=r})}),n},qt.prototype._getHeaderEntries=function(e,t){var n={};return G(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;G(i.getHeaderEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=qi(r,["id"])});return}var o=i.getPopupMenuHeaderEntries(e);bn(o)?n=o(n):G(o,function(r,a){n[a]=r})}),n},qt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>bn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},qt.prototype.isOpen=function(){return!!this._current},qt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let o=Pr(e.delegateTarget||e.target,".entry",!0),r=En(o,ZI);t={id:r,...this._getEntry(r)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(bn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},qt.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};function r0(e,t=[]){return Object.entries(e).map(([n,i])=>{const o={id:n,...i};return o.entries?o.entries=r0(o.entries,[...t,...a0(o.search)]):t.length&&(o.search=[...t,...a0(o.search)]),o})}function a0(e){return e?We(e)?e:[e]:[]}function JI(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=eB(r,o,i);return a?{item:r,tokens:a}:[]}).sort(tB(i))}function eB(e,t,n){const{matchedWords:i,tokens:o}=n.reduce((r,a)=>{const s=e[a],{tokens:c,matchedWords:l}=We(s)?s.reduce((u,p)=>{const{tokens:f,matchedWords:d}=p0(p,t);return{tokens:[...u.tokens,f],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):p0(s,t);return{tokens:{...r.tokens,[a]:c},matchedWords:{...r.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:o}function tB(e){return(t,n)=>{let i=0,o=1;for(const r of e){const a=nB(t.tokens[r],n.tokens[r]);if(a!==0){i+=a*o,o*=s0;continue}const s=iB(t.item[r],n.item[r]);if(s!==0){i+=s*o,o*=s0;continue}}return i}}function nB(e,t){return c0(t)-c0(e)}const s0=.5,Ga={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function c0(e){const t=e.reduce((s,c)=>s+l0(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 l0(e){if(We(e))return Math.max(...e.map(l0));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Ga.FULL:e.wordEnd?Ga.START_FULL_WORD:Ga.START_WORD_PART:e.wordStart?Ga.WORD_START:Ga.WORD_PART)*t:Ga.NO_MATCH*t}function u0(e=""){return We(e)?e.join(", "):e}function iB(e,t){return u0(e).localeCompare(u0(t))}function p0(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},o=t.map(oB),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,m=f===e.length,h=!!((l=s.groups)!=null&&l.all),g=d||/\s/.test(e.charAt(p-1)),w=m||/\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:g,wordEnd:w,start:d,end:m,all:h});const x=h?t:[u];for(const y of x)i[y.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function oB(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const f0={search:["value",JI]},Kh={__depends__:[f0],__init__:["popupMenu"],popupMenu:["type",qt]};var d0={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>`},QI=900;function Ha(e,t,n,i){e.registerProvider(QI,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Ha.$inject=["contextPad","popupMenu","translate","canvas"],Ha.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Ha.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Ha.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${s0.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);V(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Ha.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),o={x:i.left,y:i.bottom+t};return o};var JI=["left","center","right","top","middle","bottom"];function rc(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}rc.$inject=["popupMenu","alignElements","translate","rules"],rc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},rc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},rc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return z(JI,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:s0[r],action:function(){t.trigger(e,r),i.close()}}}),o};function ju(e){Si.call(this,e)}ju.$inject=["eventBus"],Me(ju,Si),ju.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=rt(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=sl(n),n.length<2?!1:n})};const eB={__depends__:[pI,vw,qh],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Ha],alignElementsMenuProvider:["type",rc],bpmnAlignElements:["type",ju]};function Po(e,t,n,i){de.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],function(r){var a=r.context,s=a.hints||{},c=a.shape,l=a.parent||a.newParent;s.autoResize!==!1&&o._expand([c],l)}),this.postExecuted(["elements.move"],function(r){var a=r.context,s=wp(ta(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=na(s,function(p){return p.parent.id});z(u,function(p,f){We(l)&&(p=p.filter(function(d){return Lt(l,ia({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"],Me(Po,de),Po.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=He(an(e)),r=He(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),ul(V({},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(tB(i,t)){var o=nB(Ii(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 tB(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function nB(e,t){var n="";return e=He(e),t=He(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function Hu(e){e.invoke(Po,this)}Hu.$inject=["injector"],Me(Hu,Po),Hu.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 ac(e){Si.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}ac.$inject=["eventBus"],Me(ac,Si),ac.prototype.canResize=function(e,t){return!1};function zu(e,t){ac.call(this,e),this._modeling=t}Me(zu,ac),zu.$inject=["eventBus","modeling"],zu.prototype.canResize=function(e,t){if(M(t.di,"bpmndi:BPMNPlane")||!M(t,"bpmn:Participant")&&!M(t,"bpmn:Lane")&&!M(t,"bpmn:SubProcess"))return!1;var n=!0;return z(e,function(i){if(M(i,"bpmn:Lane")||it(i)){n=!1;return}}),n};const iB={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Hu],bpmnAutoResizeProvider:["type",zu]};function za(e,t,n){this._canvas=n,this._opts=V({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(o){var r=i._toBorderPoint(o);i.startScroll(r)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}za.$inject=["config.autoScroll","eventBus","canvas"],za.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,o=t.getContainer().getBoundingClientRect(),r=[e.x,e.y,o.width-e.x,o.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)oB(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 oB(e,t,n){return t<e&&e<n}za.prototype.stopScroll=function(){clearTimeout(this._scrolling)},za.prototype.setOptions=function(e){this._opts=V({},this._opts,e)},za.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Or(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const rB={__depends__:[Eo],__init__:["autoScroll"],autoScroll:["type",za]};var c0="djs-bendpoint",l0="djs-segment-dragger";function aB(e,t){var n=Or(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 Yh(e,t,n){var i=aB(e,n),o=cd(t,i);return o}function Kh(e,t){var n=Be("g");lt(n).add(c0),Ke(e,n);var i=Be("circle");Se(i,{cx:0,cy:0,r:4}),lt(i).add("djs-visual"),Ke(n,i);var o=Be("circle");return Se(o,{cx:0,cy:0,r:10}),lt(o).add("djs-hit"),Ke(n,o),t&&lt(n).add(t),n}function sB(e,t,n,i){var o=Be("g");Ke(e,o);var r=18,a=6,s=11,c=lB(t,n,i),l=a+s,u=Be("rect");Se(u,{x:-r/2,y:-a/2,width:r,height:a}),lt(u).add("djs-visual"),Ke(o,u);var p=Be("rect");return Se(p,{x:-c/2,y:-l/2,width:c,height:l}),lt(p).add("djs-hit"),Ke(o,p),Sv(o,i==="v"?90:0),o}function u0(e,t,n){var i=Be("g"),o=Nf(t,n),r=yo(t,n);return Ke(e,i),sB(i,t,n,r),lt(i).add(l0),lt(i).add(r==="h"?"horizontal":"vertical"),Dn(i,o.x,o.y),i}function Xh(e){return Math.abs(Math.round(e*2/3))}function cB(e,t){var n=uB(e,t);return hd(e,n)}function lB(e,t,n){var i=t.x-e.x,o=t.y-e.y;return Xh(n==="h"?i:o)}function uB(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=ub(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function p0(e,t,n,i,o){function r(y,v,E){var w=y.index,T=y.point,P,O,B,$,H,Q;return w<=0||y.bendpoint?!1:(P=v[w-1],O=v[w],B=Nf(P,O),$=yo(P,O),H=Math.abs(T.x-B.x),Q=Math.abs(T.y-B.y),$&&H<=E&&Q<=E)}function a(y,v){var E=y.waypoints,w,T,P,O;return v.index<=0||v.bendpoint||(w={start:E[v.index-1],end:E[v.index]},T=yo(w.start,w.end),!T)?null:(T==="h"?P=w.end.x-w.start.x:P=w.end.y-w.start.y,O=Xh(P)/2,O)}function s(y,v){var E=v.waypoints,w=Yh(t,E,y),T;if(w){T=a(v,w);var P;if(r(w,E,T)?P=o.start(y,v,w.index):P=i.start(y,v,w.index,!w.bendpoint),P!==!1)return!0}}function c(y,v,E){Fe.bind(y,v,function(w){n.triggerMouseEvent(v,w,E),w.stopPropagation()})}function l(y,v){var E=t.getLayer("overlays"),w=Et('.djs-bendpoints[data-element-id="'+Fr(y.id)+'"]',E);return!w&&v&&(w=Be("g"),Se(w,{"data-element-id":y.id}),lt(w).add("djs-bendpoints"),Ke(E,w),c(w,"mousedown",y),c(w,"click",y),c(w,"dblclick",y)),w}function u(y,v){return Et('.djs-segment-dragger[data-segment-idx="'+y+'"]',v)}function p(y,v){v.waypoints.forEach(function(E,w){var T=Kh(y);Ke(y,T),Dn(T,E.x,E.y)}),Kh(y,"floating")}function f(y,v){for(var E=v.waypoints,w,T,P,O=1;O<E.length;O++)w=E[O-1],T=E[O],yo(w,T)&&(P=u0(y,w,T),Se(P,{"data-segment-idx":O}),c(P,"mousemove",v))}function d(y){z(gs("."+c0,y),function(v){rn(v)})}function g(y){z(gs("."+l0,y),function(v){rn(v)})}function h(y){var v=l(y);return v||(v=l(y,!0),p(v,y),f(v,y)),v}function m(y){var v=l(y);v&&(g(v),d(v),f(v,y),p(v,y))}function _(y,v){var E=Et(".floating",y),w=v.point;E&&(Dn(E,w.x,w.y),lt(E).add("positioned"))}function x(y,v,E){var w=u(v.index,y),T=E[v.index-1],P=E[v.index],O=v.point,B=Nf(T,P),$=yo(T,P),H,Q;w&&(H=pB(w),Q={x:O.x-B.x,y:O.y-B.y},$==="v"&&(Q={x:Q.y,y:Q.x}),Dn(H,Q.x,Q.y))}e.on("connection.changed",function(y){m(y.element)}),e.on("connection.remove",function(y){var v=l(y.element);v&&rn(v)}),e.on("element.marker.update",function(y){var v=y.element,E;v.waypoints&&(E=h(v),y.add?lt(E).add(y.marker):lt(E).remove(y.marker))}),e.on("element.mousemove",function(y){var v=y.element,E=v.waypoints,w,T;if(E){if(w=l(v,!0),T=Yh(t,E,y.originalEvent),!T)return;_(w,T),T.bendpoint||x(w,T,E)}}),e.on("element.mousedown",function(y){if(er(y)){var v=y.originalEvent,E=y.element;if(E.waypoints)return s(v,E)}}),e.on("selection.changed",function(y){var v=y.newSelection,E=v[0];E&&E.waypoints&&h(E)}),e.on("element.hover",function(y){var v=y.element;v.waypoints&&h(v)}),e.on("element.out",function(y){var v=y.element;if(v.waypoints){var E=l(v);if(E){var w=Et(".floating",E);w&&lt(w).remove("positioned")}}}),e.on("element.updateId",function(y){var v=y.element,E=y.newId;if(v.waypoints){var w=l(v);w&&Se(w,{"data-element-id":E})}}),this.addHandles=h,this.updateHandles=m,this.getBendpointsContainer=l,this.getSegmentDragger=u}p0.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function pB(e){return Et(".djs-visual",e)}var f0=Math.round,zr="reconnectStart",Gr="reconnectEnd",sc="updateWaypoints";function Zh(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=zr:!l&&c===d.length-1?g=Gr:g=sc;var h=g===sc?"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===sc?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=o.allowed(g,{connection:c,source:f===zr?p:l,target:f===Gr?p:u}),d){s.source=f===zr?p:l,s.target=f===Gr?p:u;return}d===!1&&(d=s.allowed=o.allowed(g,{connection:c,source:f===Gr?p:u,target:f===zr?p:l})),d&&(s.source=f===Gr?p:u,s.target=f===zr?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!==sc&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,p=s.insert,f=u.waypoints.slice(),d=s.source,g=s.target,h=s.type,m=s.hints||{},_={x:f0(a.x),y:f0(a.y)};if(!c)return!1;h===sc?(p?f.splice(l,0,_):f[l]=_,m.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),r.updateWaypoints(u,yP(f),m)):(h===zr?(m.docking="source",Gu(s)&&(m.docking="target",m.newWaypoints=f.reverse())):h===Gr&&(m.docking="target",Gu(s)&&(m.docking="source",m.newWaypoints=f.reverse())),r.reconnect(u,d,g,_,m))},this)}Zh.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Zh.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 Gu(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===zr)return t&&i&&t===i&&n!==i;if(o===Gr)return t&&n&&t===n&&n!==i}var fB="reconnectStart",dB="reconnectEnd",d0="updateWaypoints",cc="connect-ok",Vu="connect-not-ok",h0="connect-hover",g0="djs-updating",m0="djs-dragging",y0=1100;function v0(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=Kh(i.getLayer("overlays"));lt(f).add("djs-dragging"),i.addMarker(c,m0),i.addMarker(c,g0)}),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,h0),l===d0)return;s?(i.removeMarker(c,Vu),i.addMarker(c,cc)):s===!1&&(i.removeMarker(c,cc),i.addMarker(c,Vu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],y0,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,h0),i.removeMarker(s,c?cc:Vu))}),n.on("bendpoint.move.move",function(r){var a=r.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,f=a.connection,d=f.source,g=f.target,h=f.waypoints.slice(),m={x:r.x,y:r.y},_=a.hints||{},x={};o&&(_.connectionStart&&(x.connectionStart=_.connectionStart),_.connectionEnd&&(x.connectionEnd=_.connectionEnd),p===fB?Gu(a)?(x.connectionEnd=x.connectionEnd||m,x.source=g,x.target=u||d,h=h.reverse()):(x.connectionStart=x.connectionStart||m,x.source=u||d,x.target=g):p===dB?Gu(a)?(x.connectionStart=x.connectionStart||m,x.source=u||g,x.target=d,h=h.reverse()):(x.connectionEnd=x.connectionEnd||m,x.source=d,x.target=u||g):(x.noCropping=!0,x.noLayout=!0,h[c]=m),p===d0&&(h=e.cropWaypoints(f,h)),x.waypoints=h,o.drawPreview(a,s,x)),Dn(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],y0,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,rn(c),i.removeMarker(s,g0),i.removeMarker(s,m0),l&&(i.removeMarker(l,cc),i.removeMarker(l,u?cc:Vu)),o&&o.cleanUp(a)})}v0.$inject=["bendpointMove","injector","eventBus","canvas"];var b0="connect-hover",x0="djs-updating";function _0(e,t,n){return Qh(e,t,e[t]+n)}function Qh(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 Qh(t,i,s)}function w0(e){return e==="x"?"y":"x"}function E0(e,t,n){var i,o;return e.original?e.original:(i=qe(t),o=w0(n),Qh(e,o,i[o]))}function S0(e,t,n,i,o,r){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var g,h=n.getGraphics(f),m=d-1,_=d,x=f.waypoints,y=x[m],v=x[_],E=Yh(n,x,p),w,T,P;if(w=yo(y,v),!!w)return T=w==="v"?"x":"y",m===0&&(y=E0(y,f.source,T)),_===x.length-1&&(v=E0(v,f.target,T)),E?P=E.point:P={x:(y.x+v.x)/2,y:(y.y+v.y)/2},g={connection:f,segmentStartIndex:m,segmentEndIndex:_,segmentStart:y,segmentEnd:v,axis:T,dragPosition:P},i.init(p,P,"connectionSegment.move",{cursor:T==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:h,context:g}})};function s(p,f){if(!a)return f;var d=p.waypoints,g;return p.waypoints=f,g=a.getCroppedWaypoints(p),p.waypoints=d,g}function c(p){o.update("connection",p.connection,p.connectionGfx)}function l(p,f,d){var g=p.newWaypoints,h=p.segmentStartIndex+f,m=g[h],_=p.segmentEndIndex+f,x=g[_],y=w0(p.axis),v=hB(d,m,x,y);Dn(p.draggerGfx,v.x,v.y)}function u(p,f){var d=0,g=p.filter(function(h,m){return Bf(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=u0(g,f.segmentStart,f.segmentEnd),lt(f.draggerGfx).add("djs-dragging"),n.addMarker(d,x0)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,m=f.segmentStart,_=f.segmentEnd,x=f.axis,y=f.originalWaypoints.slice(),v=_0(m,x,p["d"+x]),E=_0(_,x,p["d"+x]),w=y.length,T=0;y[g]=v,y[h]=E;var P,O;g<2&&(P=On(d.source,v),g===1?P==="intersect"&&(y.shift(),y[0]=v,T--):P!=="intersect"&&(y.unshift(m),T++)),h>w-3&&(O=On(d.target,E),h===w-2?O==="intersect"&&(y.pop(),y[y.length-1]=E):O!=="intersect"&&y.push(_)),f.newWaypoints=d.waypoints=s(d,y),l(f,T,p),f.newSegmentStartIndex=g+T,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,b0)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,b0)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&rn(f.draggerGfx),n.removeMarker(d,x0)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,g=f.newWaypoints,h=f.newSegmentStartIndex;g=g.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var m=u(g,h),_=m.waypoints,x=s(d,_),y=m.segmentOffset,v={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+y}};r.updateWaypoints(d,x,v)})}S0.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var gB=Math.abs,R0=Math.round;function mB(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],gB(o-e)<=n)return o}function C0(e){return{x:e.x,y:e.y}}function M0(e){return{x:e.x+e.width,y:e.y+e.height}}function Ai(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:R0(e.x+e.width/2),y:R0(e.y+e.height/2)}}function Ga(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function un(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,o=e[t],r=e.snapped=e.snapped||{};return n===!1?r[t]=!1:(r[t]=!0,i=n-o,e[t]+=i,e["d"+t]+=i),o}function A0(e){return e.children||[]}var yB=Math.abs,P0=Math.round,Jh=10;function T0(e){function t(r,a){if(We(r)){for(var s=r.length;s--;)if(yB(r[s]-a)<=Jh)return r[s]}else{r=+r;var c=a%r;if(c<Jh)return a-c;if(c>r-Jh)return a-c+r}return a}function n(r,a){if(r.waypoints)return cB(a,r);if(r.width)return{x:P0(r.width/2+r.x),y:P0(r.height/2+r.y)}}function i(r){var a=r.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[l[p-1],u,f,l[d+1]];return p<2&&h.unshift(n(c.source,r)),d>l.length-3&&h.unshift(n(c.target,r)),a.snapPoints=s={horizontal:[],vertical:[]},z(h,function(m){m&&(m=m.original||m,g==="y"&&s.horizontal.push(m.y),g==="x"&&s.vertical.push(m.x))}),s}e.on("connectionSegment.move.move",1500,function(r){var a=i(r),s=r.x,c=r.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var p=s-l,f=c-u;V(r,{dx:r.dx-p,dy:r.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&un(r,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&un(r,"y",u)}});function o(r){var a=r.snapPoints,s=r.connection.waypoints,c=r.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return r.snapPoints=a={horizontal:[],vertical:[]},z(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(r){var a=r.context,s=a.hover,c=s&&n(s,r);!kt(s)||!c||!c.x||!c.y||(un(r,"x",c.x),un(r,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var a=r.context,s=o(a),c=a.hover,l=c&&n(c,r),u=r.x,p=r.y,f,d;if(s){f=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var g=u-f,h=p-d;V(r,{dx:r.dx-g,dy:r.dy-h,x:r.x-g,y:r.y-h}),(g||s.vertical.indexOf(u)!==-1)&&un(r,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&un(r,"y",d)}})}T0.$inject=["eventBus"];const vB={__depends__:[Eo,no],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",p0],bendpointMove:["type",Zh],bendpointMovePreview:["type",v0],connectionSegmentMove:["type",S0],bendpointSnapping:["type",T0]};function k0(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),!ea(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!ea(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:eg(s)?u:l,connectionEnd:eg(s)?l:u};hn(c)&&(d=c),s.connection=n.connect(p,f,d,g)}),this.start=function(a,s,c,l){hn(c)||(l=c,c=qe(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}k0.$inject=["eventBus","dragging","modeling","rules"];function eg(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var bB=1100,xB=900,O0="connect-ok",D0="connect-not-ok";function L0(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;eg(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?O0:D0)}),t.on(["connect.out","connect.cleanup"],bB,function(o){var r=o.hover;r&&(n.removeMarker(r,O0),n.removeMarker(r,D0))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}L0.$inject=["injector","eventBus","canvas"];const tg={__depends__:[Ri,no,Eo],__init__:["connectPreview"],connect:["type",k0],connectPreview:["type",L0]};var _B="djs-dragger";function To(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)}To.$inject=["injector","canvas","graphicsFactory","elementFactory"],To.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()),ms(i),o||(o=e.getConnection=wB(function(h,m,_){return g.getConnection(h,m,_)})),t&&(d=o(t,r,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:r,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[r?qe(r):c,a?qe(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)"})},To.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||qe(n),r=t.connectionEnd||qe(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);Ke(e,s)},To.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&&Es(r,s,!0)||e,t=i&&Es(a,s,!1)||t,[e,t]},To.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&rn(e.connectionPreviewGfx)},To.prototype.getConnection=function(e){var t=EB(e);return this._elementFactory.createConnection(t)},To.prototype.createConnectionPreviewGfx=function(){var e=Be("g");return Se(e,{pointerEvents:"none"}),lt(e).add(_B),Ke(this._canvas.getActiveLayer(),e),e},To.prototype.createNoopConnection=function(e,t){return bs([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function wB(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 EB(e){return hn(e)?e:{}}const SB={__init__:["connectionPreview"],connectionPreview:["type",To]},Wu="complex-preview";class I0{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(Wu);n.filter(s=>!RB(s)).forEach(s=>{let c;kt(s)?(c=this._graphicsFactory._createContainer("connection",Be("g")),this._graphicsFactory.drawConnection(Yo(c),s)):(c=this._graphicsFactory._createContainer("shape",Be("g")),this._graphicsFactory.drawShape(Yo(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);kt(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",Be("g"));this._graphicsFactory.drawShape(Yo(l),s,{width:c.width,height:c.height}),Dn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){ms(this._canvas.getLayer(Wu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Wu)}hide(){this._canvas.hideLayer(Wu)}}I0.$inject=["canvas","graphicsFactory","previewSupport"];function RB(e){return e.hidden}const CB={__depends__:[Oa],__init__:["complexPreview"],complexPreview:["type",I0]},B0=Math.round;function Uu(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}Uu.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(V({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;V(l,{x:u.x-B0(l.width/2),y:u.y-B0(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=>!ea(d))})},Uu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Uu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const MB={__depends__:[yu,CB,wh],__init__:["appendPreview"],appendPreview:["type",Uu]};var N0=Math.min,$0=Math.max;function ng(e){e.preventDefault()}function lc(e){e.stopPropagation()}function AB(e){return e.nodeType===Node.TEXT_NODE}function PB(e){return[].slice.call(e)}function zi(e){this.container=e.container,this.parent=$t('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Et("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Xn(this.autoResize,this),this.handlePaste=Xn(this.handlePaste,this)}zi.prototype.create=function(e,t,n,i){var o=this,r=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=Ii(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);V(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var l=Ii(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return V(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&V(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,Fe.bind(a,"keydown",this.keyHandler),Fe.bind(a,"mousedown",lc),Fe.bind(a,"paste",o.handlePaste),Fe.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Fe.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},zi.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)}},zi.prototype.insertText=function(e){e=TB(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},zi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=PB(a.childNodes),c,l;if(AB(a)){var u=n.textContent;n.textContent=u.substring(0,o)+e+u.substring(r),c=n,l=o+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[o]),c=p,l=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(g,h){h===f?g.textContent=n.textContent.substring(0,o)+e+i.textContent.substring(r):h>f&&h<=d&&Xi(g)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},zi.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})}},zi.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,o=parseInt(this.style.minHeight)||0,r=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=$t('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(g){ng(g),lc(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,Fe.bind(document,"mousemove",f),Fe.bind(document,"mouseup",d)},f=function(g){ng(g),lc(g);var h=N0($0(l+g.clientX-s,i),r),m=N0($0(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){ng(g),lc(g),Fe.unbind(document,"mousemove",f,!1),Fe.unbind(document,"mouseup",d,!1)};Fe.bind(n,"mousedown",p)}V(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)},zi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Fe.unbind(t,"keydown",this.keyHandler),Fe.unbind(t,"mousedown",lc),Fe.unbind(t,"input",this.autoResize),Fe.unbind(t,"paste",this.handlePaste),Fe.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Xi(n)),Xi(e)},zi.prototype.getValue=function(){return this.content.innerText.trim()},zi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},zi.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 TB(e){return e.replace(/\r\n|\r|\n/g,`
316
- `)}function li(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new zi({container:t.getContainer(),keyHandler:Xn(this._handleKey,this),resizeHandler:Xn(this._handleResize,this),focusoutHandler:Xn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}li.$inject=["eventBus","canvas"],li.prototype.registerProvider=function(e){this._providers.push(e)},li.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},li.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},li.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},li.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},li.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},li.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()}},li.prototype.getValue=function(){return this._textbox.getValue()},li.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()},li.prototype._handleResize=function(e){this._fire("resize",e)},li.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},li.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Lt(this._providers,function(i){return(t=i.activate(e))?i:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};const F0={__depends__:[ql],__init__:["directEditing"],directEditing:["type",li]};function kB(e){return function(t){var n=t.target,i=ge(e),o=i.eventDefinitions&&i.eventDefinitions[0],r=i.$type===n.type,a=(o&&o.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===ut(e);return!r||!a||!s||!c}}const OB={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 fe(e,t={}){var n=OB[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var DB=[fe("none-start-event",{actionName:"replace-with-none-start"}),fe("none-intermediate-throwing"),fe("none-end-event",{actionName:"replace-with-none-end"}),fe("message-start"),fe("timer-start"),fe("conditional-start"),fe("signal-start")],LB=[fe("none-start-event",{actionName:"replace-with-none-start"}),fe("none-intermediate-throwing"),fe("none-end-event",{actionName:"replace-with-none-end"})],IB=[fe("none-start-event",{actionName:"replace-with-none-start"}),fe("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),fe("none-end-event",{actionName:"replace-with-none-end"}),fe("message-intermediate-catch"),fe("message-intermediate-throw"),fe("timer-intermediate-catch"),fe("escalation-intermediate-throw"),fe("conditional-intermediate-catch"),fe("link-intermediate-catch"),fe("link-intermediate-throw"),fe("compensation-intermediate-throw"),fe("signal-intermediate-catch"),fe("signal-intermediate-throw")],BB=[fe("none-start-event",{actionName:"replace-with-none-start"}),fe("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),fe("none-end-event",{actionName:"replace-with-none-end"}),fe("message-end"),fe("escalation-end"),fe("error-end"),fe("cancel-end"),fe("compensation-end"),fe("signal-end"),fe("terminate-end")],NB=[fe("exclusive-gateway"),fe("parallel-gateway"),fe("inclusive-gateway"),fe("complex-gateway"),fe("event-based-gateway")],$B=[fe("transaction"),fe("event-subprocess"),fe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),fe("collapsed-subprocess")],FB=[fe("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),fe("transaction"),fe("event-subprocess"),fe("collapsed-ad-hoc-subprocess")],j0=[fe("transaction"),fe("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),fe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),fe("event-subprocess")],jB=j0,H0=[fe("task"),fe("user-task"),fe("service-task"),fe("send-task"),fe("receive-task"),fe("manual-task"),fe("rule-task"),fe("script-task"),fe("call-activity"),fe("collapsed-subprocess"),fe("expanded-subprocess"),fe("collapsed-ad-hoc-subprocess"),fe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],HB=[fe("data-store-reference")],zB=[fe("data-object-reference")],GB=[fe("message-boundary"),fe("timer-boundary"),fe("escalation-boundary"),fe("conditional-boundary"),fe("error-boundary"),fe("cancel-boundary"),fe("signal-boundary"),fe("compensation-boundary"),fe("non-interrupting-message-boundary"),fe("non-interrupting-timer-boundary"),fe("non-interrupting-escalation-boundary"),fe("non-interrupting-conditional-boundary"),fe("non-interrupting-signal-boundary")],VB=[fe("message-start"),fe("timer-start"),fe("conditional-start"),fe("signal-start"),fe("error-start"),fe("escalation-start"),fe("compensation-start"),fe("non-interrupting-message-start"),fe("non-interrupting-timer-start"),fe("non-interrupting-conditional-start"),fe("non-interrupting-signal-start"),fe("non-interrupting-escalation-start")],WB=[{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"}],UB=[fe("expanded-pool"),fe("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],qB={"bpmn:MessageEventDefinition":[fe("message-start"),fe("message-intermediate-catch"),fe("message-intermediate-throw"),fe("message-end")],"bpmn:TimerEventDefinition":[fe("timer-start"),fe("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[fe("conditional-start"),fe("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[fe("signal-start"),fe("signal-intermediate-catch"),fe("signal-intermediate-throw"),fe("signal-end")],"bpmn:ErrorEventDefinition":[fe("error-start"),fe("error-end")],"bpmn:EscalationEventDefinition":[fe("escalation-start"),fe("escalation-intermediate-throw"),fe("escalation-end")],"bpmn:CompensateEventDefinition":[fe("compensation-start"),fe("compensation-intermediate-throw"),fe("compensation-end")]};const z0={"start-event-non-interrupting":`
315
+ </svg>`},rB=900;function Va(e,t,n,i){e.registerProvider(rB,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Va.$inject=["contextPad","popupMenu","translate","canvas"],Va.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},Va.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Va.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${d0.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);U(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Va.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 aB=["left","center","right","top","middle","bottom"];function rc(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}rc.$inject=["popupMenu","alignElements","translate","rules"],rc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},rc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},rc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return G(aB,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:d0[r],action:function(){t.trigger(e,r),i.close()}}}),o};function ju(e){Ri.call(this,e)}ju.$inject=["eventBus"],Te(ju,Ri),ju.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=rt(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=sl(n),n.length<2?!1:n})};const sB={__depends__:[vI,S_,Kh],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Va],alignElementsMenuProvider:["type",rc],bpmnAlignElements:["type",ju]};function Po(e,t,n,i){de.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],function(r){var a=r.context,s=a.hints||{},c=a.shape,l=a.parent||a.newParent;s.autoResize!==!1&&o._expand([c],l)}),this.postExecuted(["elements.move"],function(r){var a=r.context,s=Sp(oa(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=ra(s,function(p){return p.parent.id});G(u,function(p,f){We(l)&&(p=p.filter(function(d){return It(l,aa({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"],Te(Po,de),Po.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=ze(rn(e)),r=ze(t),a={};return o.top-r.top<i.top&&(a.top=o.top-n.top),o.left-r.left<i.left&&(a.left=o.left-n.left),r.right-o.right<i.right&&(a.right=o.right+n.right),r.bottom-o.bottom<i.bottom&&(a.bottom=o.bottom+n.bottom),ul(U({},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(cB(i,t)){var o=lB(Bi(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 cB(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function lB(e,t){var n="";return e=ze(e),t=ze(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function Hu(e){e.invoke(Po,this)}Hu.$inject=["injector"],Te(Hu,Po),Hu.prototype.resize=function(e,t,n){A(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function ac(e){Ri.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}ac.$inject=["eventBus"],Te(ac,Ri),ac.prototype.canResize=function(e,t){return!1};function zu(e,t){ac.call(this,e),this._modeling=t}Te(zu,ac),zu.$inject=["eventBus","modeling"],zu.prototype.canResize=function(e,t){if(A(t.di,"bpmndi:BPMNPlane")||!A(t,"bpmn:Participant")&&!A(t,"bpmn:Lane")&&!A(t,"bpmn:SubProcess"))return!1;var n=!0;return G(e,function(i){if(A(i,"bpmn:Lane")||nt(i)){n=!1;return}}),n};const uB={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Hu],bpmnAutoResizeProvider:["type",zu]};function Wa(e,t,n){this._canvas=n,this._opts=U({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(o){var r=i._toBorderPoint(o);i.startScroll(r)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Wa.$inject=["config.autoScroll","eventBus","canvas"],Wa.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++)pB(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 pB(e,t,n){return t<e&&e<n}Wa.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Wa.prototype.setOptions=function(e){this._opts=U({},this._opts,e)},Wa.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Lr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const fB={__depends__:[Eo],__init__:["autoScroll"],autoScroll:["type",Wa]};var h0="djs-bendpoint",g0="djs-segment-dragger";function dB(e,t){var n=Lr(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 Xh(e,t,n){var i=dB(e,n),o=ud(t,i);return o}function Zh(e,t){var n=Be("g");lt(n).add(h0),Ke(e,n);var i=Be("circle");Ce(i,{cx:0,cy:0,r:4}),lt(i).add("djs-visual"),Ke(n,i);var o=Be("circle");return Ce(o,{cx:0,cy:0,r:10}),lt(o).add("djs-hit"),Ke(n,o),t&&lt(n).add(t),n}function hB(e,t,n,i){var o=Be("g");Ke(e,o);var r=18,a=6,s=11,c=mB(t,n,i),l=a+s,u=Be("rect");Ce(u,{x:-r/2,y:-a/2,width:r,height:a}),lt(u).add("djs-visual"),Ke(o,u);var p=Be("rect");return Ce(p,{x:-c/2,y:-l/2,width:c,height:l}),lt(p).add("djs-hit"),Ke(o,p),Tv(o,i==="v"?90:0),o}function m0(e,t,n){var i=Be("g"),o=Ff(t,n),r=yo(t,n);return Ke(e,i),hB(i,t,n,r),lt(i).add(g0),lt(i).add(r==="h"?"horizontal":"vertical"),Pn(i,o.x,o.y),i}function Qh(e){return Math.abs(Math.round(e*2/3))}function gB(e,t){var n=yB(e,t);return md(e,n)}function mB(e,t,n){var i=t.x-e.x,o=t.y-e.y;return Qh(n==="h"?i:o)}function yB(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 y0(e,t,n,i,o){function r(y,v,S){var _=y.index,T=y.point,P,D,N,j,H,Q;return _<=0||y.bendpoint?!1:(P=v[_-1],D=v[_],N=Ff(P,D),j=yo(P,D),H=Math.abs(T.x-N.x),Q=Math.abs(T.y-N.y),j&&H<=S&&Q<=S)}function a(y,v){var S=y.waypoints,_,T,P,D;return v.index<=0||v.bendpoint||(_={start:S[v.index-1],end:S[v.index]},T=yo(_.start,_.end),!T)?null:(T==="h"?P=_.end.x-_.start.x:P=_.end.y-_.start.y,D=Qh(P)/2,D)}function s(y,v){var S=v.waypoints,_=Xh(t,S,y),T;if(_){T=a(v,_);var P;if(r(_,S,T)?P=o.start(y,v,_.index):P=i.start(y,v,_.index,!_.bendpoint),P!==!1)return!0}}function c(y,v,S){$e.bind(y,v,function(_){n.triggerMouseEvent(v,_,S),_.stopPropagation()})}function l(y,v){var S=t.getLayer("overlays"),_=Rt('.djs-bendpoints[data-element-id="'+Hr(y.id)+'"]',S);return!_&&v&&(_=Be("g"),Ce(_,{"data-element-id":y.id}),lt(_).add("djs-bendpoints"),Ke(S,_),c(_,"mousedown",y),c(_,"click",y),c(_,"dblclick",y)),_}function u(y,v){return Rt('.djs-segment-dragger[data-segment-idx="'+y+'"]',v)}function p(y,v){v.waypoints.forEach(function(S,_){var T=Zh(y);Ke(y,T),Pn(T,S.x,S.y)}),Zh(y,"floating")}function f(y,v){for(var S=v.waypoints,_,T,P,D=1;D<S.length;D++)_=S[D-1],T=S[D],yo(_,T)&&(P=m0(y,_,T),Ce(P,{"data-segment-idx":D}),c(P,"mousemove",v))}function d(y){G(gs("."+h0,y),function(v){on(v)})}function m(y){G(gs("."+g0,y),function(v){on(v)})}function h(y){var v=l(y);return v||(v=l(y,!0),p(v,y),f(v,y)),v}function g(y){var v=l(y);v&&(m(v),d(v),f(v,y),p(v,y))}function w(y,v){var S=Rt(".floating",y),_=v.point;S&&(Pn(S,_.x,_.y),lt(S).add("positioned"))}function x(y,v,S){var _=u(v.index,y),T=S[v.index-1],P=S[v.index],D=v.point,N=Ff(T,P),j=yo(T,P),H,Q;_&&(H=vB(_),Q={x:D.x-N.x,y:D.y-N.y},j==="v"&&(Q={x:Q.y,y:Q.x}),Pn(H,Q.x,Q.y))}e.on("connection.changed",function(y){g(y.element)}),e.on("connection.remove",function(y){var v=l(y.element);v&&on(v)}),e.on("element.marker.update",function(y){var v=y.element,S;v.waypoints&&(S=h(v),y.add?lt(S).add(y.marker):lt(S).remove(y.marker))}),e.on("element.mousemove",function(y){var v=y.element,S=v.waypoints,_,T;if(S){if(_=l(v,!0),T=Xh(t,S,y.originalEvent),!T)return;w(_,T),T.bendpoint||x(_,T,S)}}),e.on("element.mousedown",function(y){if(er(y)){var v=y.originalEvent,S=y.element;if(S.waypoints)return s(v,S)}}),e.on("selection.changed",function(y){var v=y.newSelection,S=v[0];S&&S.waypoints&&h(S)}),e.on("element.hover",function(y){var v=y.element;v.waypoints&&h(v)}),e.on("element.out",function(y){var v=y.element;if(v.waypoints){var S=l(v);if(S){var _=Rt(".floating",S);_&&lt(_).remove("positioned")}}}),e.on("element.updateId",function(y){var v=y.element,S=y.newId;if(v.waypoints){var _=l(v);_&&Ce(_,{"data-element-id":S})}}),this.addHandles=h,this.updateHandles=g,this.getBendpointsContainer=l,this.getSegmentDragger=u}y0.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function vB(e){return Rt(".djs-visual",e)}var v0=Math.round,Vr="reconnectStart",Wr="reconnectEnd",sc="updateWaypoints";function Jh(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,m;!l&&c===0?m=Vr:!l&&c===d.length-1?m=Wr:m=sc;var h=m===sc?"connection.updateWaypoints":"connection.reconnect",g=o.allowed(h,{connection:s,source:p,target:f});if(g===!1&&(g=o.allowed(h,{connection:s,source:f,target:p})),g!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:g,bendpointIndex:c,connection:s,source:p,target:f,insert:l,type:m}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var m=f===sc?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=o.allowed(m,{connection:c,source:f===Vr?p:l,target:f===Wr?p:u}),d){s.source=f===Vr?p:l,s.target=f===Wr?p:u;return}d===!1&&(d=s.allowed=o.allowed(m,{connection:c,source:f===Wr?p:u,target:f===Vr?p:l})),d&&(s.source=f===Wr?p:u,s.target=f===Vr?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!==sc&&(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,m=s.target,h=s.type,g=s.hints||{},w={x:v0(a.x),y:v0(a.y)};if(!c)return!1;h===sc?(p?f.splice(l,0,w):f[l]=w,g.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),r.updateWaypoints(u,SP(f),g)):(h===Vr?(g.docking="source",Gu(s)&&(g.docking="target",g.newWaypoints=f.reverse())):h===Wr&&(g.docking="target",Gu(s)&&(g.docking="source",g.newWaypoints=f.reverse())),r.reconnect(u,d,m,w,g))},this)}Jh.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Jh.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 Gu(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===Vr)return t&&i&&t===i&&n!==i;if(o===Wr)return t&&n&&t===n&&n!==i}var bB="reconnectStart",xB="reconnectEnd",b0="updateWaypoints",cc="connect-ok",Vu="connect-not-ok",x0="connect-hover",w0="djs-updating",_0="djs-dragging",E0=1100;function S0(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=Zh(i.getLayer("overlays"));lt(f).add("djs-dragging"),i.addMarker(c,_0),i.addMarker(c,w0)}),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,x0),l===b0)return;s?(i.removeMarker(c,Vu),i.addMarker(c,cc)):s===!1&&(i.removeMarker(c,cc),i.addMarker(c,Vu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],E0,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,x0),i.removeMarker(s,c?cc:Vu))}),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,m=f.target,h=f.waypoints.slice(),g={x:r.x,y:r.y},w=a.hints||{},x={};o&&(w.connectionStart&&(x.connectionStart=w.connectionStart),w.connectionEnd&&(x.connectionEnd=w.connectionEnd),p===bB?Gu(a)?(x.connectionEnd=x.connectionEnd||g,x.source=m,x.target=u||d,h=h.reverse()):(x.connectionStart=x.connectionStart||g,x.source=u||d,x.target=m):p===xB?Gu(a)?(x.connectionStart=x.connectionStart||g,x.source=u||m,x.target=d,h=h.reverse()):(x.connectionEnd=x.connectionEnd||g,x.source=d,x.target=u||m):(x.noCropping=!0,x.noLayout=!0,h[c]=g),p===b0&&(h=e.cropWaypoints(f,h)),x.waypoints=h,o.drawPreview(a,s,x)),Pn(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],E0,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,on(c),i.removeMarker(s,w0),i.removeMarker(s,_0),l&&(i.removeMarker(l,cc),i.removeMarker(l,u?cc:Vu)),o&&o.cleanUp(a)})}S0.$inject=["bendpointMove","injector","eventBus","canvas"];var R0="connect-hover",C0="djs-updating";function M0(e,t,n){return eg(e,t,e[t]+n)}function eg(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function wB(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 eg(t,i,s)}function A0(e){return e==="x"?"y":"x"}function P0(e,t,n){var i,o;return e.original?e.original:(i=qe(t),o=A0(n),eg(e,o,i[o]))}function T0(e,t,n,i,o,r){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var m,h=n.getGraphics(f),g=d-1,w=d,x=f.waypoints,y=x[g],v=x[w],S=Xh(n,x,p),_,T,P;if(_=yo(y,v),!!_)return T=_==="v"?"x":"y",g===0&&(y=P0(y,f.source,T)),w===x.length-1&&(v=P0(v,f.target,T)),S?P=S.point:P={x:(y.x+v.x)/2,y:(y.y+v.y)/2},m={connection:f,segmentStartIndex:g,segmentEndIndex:w,segmentStart:y,segmentEnd:v,axis:T,dragPosition:P},i.init(p,P,"connectionSegment.move",{cursor:T==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:h,context:m}})};function s(p,f){if(!a)return f;var d=p.waypoints,m;return p.waypoints=f,m=a.getCroppedWaypoints(p),p.waypoints=d,m}function c(p){o.update("connection",p.connection,p.connectionGfx)}function l(p,f,d){var m=p.newWaypoints,h=p.segmentStartIndex+f,g=m[h],w=p.segmentEndIndex+f,x=m[w],y=A0(p.axis),v=wB(d,g,x,y);Pn(p.draggerGfx,v.x,v.y)}function u(p,f){var d=0,m=p.filter(function(h,g){return $f(p[g-1],p[g+1],h)?(d=g<=f?d-1:d,!1):!0});return{waypoints:m,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,m=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=m0(m,f.segmentStart,f.segmentEnd),lt(f.draggerGfx).add("djs-dragging"),n.addMarker(d,C0)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,m=f.segmentStartIndex,h=f.segmentEndIndex,g=f.segmentStart,w=f.segmentEnd,x=f.axis,y=f.originalWaypoints.slice(),v=M0(g,x,p["d"+x]),S=M0(w,x,p["d"+x]),_=y.length,T=0;y[m]=v,y[h]=S;var P,D;m<2&&(P=An(d.source,v),m===1?P==="intersect"&&(y.shift(),y[0]=v,T--):P!=="intersect"&&(y.unshift(g),T++)),h>_-3&&(D=An(d.target,S),h===_-2?D==="intersect"&&(y.pop(),y[y.length-1]=S):D!=="intersect"&&y.push(w)),f.newWaypoints=d.waypoints=s(d,y),l(f,T,p),f.newSegmentStartIndex=m+T,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,R0)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,R0)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&on(f.draggerGfx),n.removeMarker(d,C0)}),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,m=f.newWaypoints,h=f.newSegmentStartIndex;m=m.map(function(S){return{original:S.original,x:Math.round(S.x),y:Math.round(S.y)}});var g=u(m,h),w=g.waypoints,x=s(d,w),y=g.segmentOffset,v={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+y}};r.updateWaypoints(d,x,v)})}T0.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var _B=Math.abs,k0=Math.round;function EB(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],_B(o-e)<=n)return o}function O0(e){return{x:e.x,y:e.y}}function D0(e){return{x:e.x+e.width,y:e.y+e.height}}function Pi(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:k0(e.x+e.width/2),y:k0(e.y+e.height/2)}}function Ua(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function ln(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 L0(e){return e.children||[]}var SB=Math.abs,I0=Math.round,tg=10;function B0(e){function t(r,a){if(We(r)){for(var s=r.length;s--;)if(SB(r[s]-a)<=tg)return r[s]}else{r=+r;var c=a%r;if(c<tg)return a-c;if(c>r-tg)return a-c+r}return a}function n(r,a){if(r.waypoints)return gB(a,r);if(r.width)return{x:I0(r.width/2+r.x),y:I0(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,m=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:[]},G(h,function(g){g&&(g=g.original||g,m==="y"&&s.horizontal.push(g.y),m==="x"&&s.vertical.push(g.x))}),s}e.on("connectionSegment.move.move",1500,function(r){var a=i(r),s=r.x,c=r.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var p=s-l,f=c-u;U(r,{dx:r.dx-p,dy:r.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&ln(r,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&ln(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:[]},G(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(r){var a=r.context,s=a.hover,c=s&&n(s,r);!kt(s)||!c||!c.x||!c.y||(ln(r,"x",c.x),ln(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 m=u-f,h=p-d;U(r,{dx:r.dx-m,dy:r.dy-h,x:r.x-m,y:r.y-h}),(m||s.vertical.indexOf(u)!==-1)&&ln(r,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&ln(r,"y",d)}})}B0.$inject=["eventBus"];const RB={__depends__:[Eo,no],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",y0],bendpointMove:["type",Jh],bendpointMovePreview:["type",S0],connectionSegmentMove:["type",T0],bendpointSnapping:["type",B0]};function N0(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),!ia(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!ia(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,m={connectionStart:ng(s)?u:l,connectionEnd:ng(s)?l:u};gn(c)&&(d=c),s.connection=n.connect(p,f,d,m)}),this.start=function(a,s,c,l){gn(c)||(l=c,c=qe(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}N0.$inject=["eventBus","dragging","modeling","rules"];function ng(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var CB=1100,MB=900,$0="connect-ok",F0="connect-not-ok";function j0(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},m=f,h=d;ng(r)&&(m=d,h=f),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:m,connectionEnd:h})}),t.on("connect.hover",MB,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?$0:F0)}),t.on(["connect.out","connect.cleanup"],CB,function(o){var r=o.hover;r&&(n.removeMarker(r,$0),n.removeMarker(r,F0))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}j0.$inject=["injector","eventBus","canvas"];const ig={__depends__:[Ci,no,Eo],__init__:["connectPreview"],connect:["type",N0],connectPreview:["type",j0]};var AB="djs-dragger";function To(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)}To.$inject=["injector","canvas","graphicsFactory","elementFactory"],To.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,m=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),ms(i),o||(o=e.getConnection=PB(function(h,g,w){return m.getConnection(h,g,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?qe(r):c,a?qe(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)"})},To.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||qe(n),r=t.connectionEnd||qe(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);Ke(e,s)},To.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&&Es(r,s,!0)||e,t=i&&Es(a,s,!1)||t,[e,t]},To.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&on(e.connectionPreviewGfx)},To.prototype.getConnection=function(e){var t=TB(e);return this._elementFactory.createConnection(t)},To.prototype.createConnectionPreviewGfx=function(){var e=Be("g");return Ce(e,{pointerEvents:"none"}),lt(e).add(AB),Ke(this._canvas.getActiveLayer(),e),e},To.prototype.createNoopConnection=function(e,t){return bs([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function PB(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 TB(e){return gn(e)?e:{}}const kB={__init__:["connectionPreview"],connectionPreview:["type",To]},Wu="complex-preview";class H0{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(Wu);n.filter(s=>!OB(s)).forEach(s=>{let c;kt(s)?(c=this._graphicsFactory._createContainer("connection",Be("g")),this._graphicsFactory.drawConnection(Yo(c),s)):(c=this._graphicsFactory._createContainer("shape",Be("g")),this._graphicsFactory.drawShape(Yo(c),s),Pn(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const l=this._previewSupport.addDragger(s,a);kt(s)?Pn(l,c.x,c.y):Pn(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",Be("g"));this._graphicsFactory.drawShape(Yo(l),s,{width:c.width,height:c.height}),Pn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){ms(this._canvas.getLayer(Wu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Wu)}hide(){this._canvas.hideLayer(Wu)}}H0.$inject=["canvas","graphicsFactory","previewSupport"];function OB(e){return e.hidden}const DB={__depends__:[Ia],__init__:["complexPreview"],complexPreview:["type",H0]},z0=Math.round;function Uu(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}Uu.prototype.create=function(e,t,n){const i=this._complexPreview,o=this._connectionDocking,r=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,l=r.createShape(U({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;U(l,{x:u.x-z0(l.width/2),y:u.y-z0(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=>!ia(d))})},Uu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Uu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const LB={__depends__:[yu,DB,Sh],__init__:["appendPreview"],appendPreview:["type",Uu]};var G0=Math.min,V0=Math.max;function og(e){e.preventDefault()}function lc(e){e.stopPropagation()}function IB(e){return e.nodeType===Node.TEXT_NODE}function BB(e){return[].slice.call(e)}function Gi(e){this.container=e.container,this.parent=$t('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Rt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Yn(this.autoResize,this),this.handlePaste=Yn(this.handlePaste,this)}Gi.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=Bi(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);U(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var l=Bi(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return U(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&U(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,$e.bind(a,"keydown",this.keyHandler),$e.bind(a,"mousedown",lc),$e.bind(a,"paste",o.handlePaste),$e.bind(a,"focusout",this.focusoutHandler),i.autoResize&&$e.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},Gi.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)}},Gi.prototype.insertText=function(e){e=NB(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Gi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=BB(a.childNodes),c,l;if(IB(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(m,h){h===f?m.textContent=n.textContent.substring(0,o)+e+i.textContent.substring(r):h>f&&h<=d&&Xi(m)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Gi.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})}},Gi.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,o=parseInt(this.style.minHeight)||0,r=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=$t('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(m){og(m),lc(m),s=m.clientX,c=m.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,$e.bind(document,"mousemove",f),$e.bind(document,"mouseup",d)},f=function(m){og(m),lc(m);var h=G0(V0(l+m.clientX-s,i),r),g=G0(V0(u+m.clientY-c,o),a);t.style.width=h+"px",t.style.height=g+"px",e.resizeHandler({width:l,height:u,dx:m.clientX-s,dy:m.clientY-c})},d=function(m){og(m),lc(m),$e.unbind(document,"mousemove",f,!1),$e.unbind(document,"mouseup",d,!1)};$e.bind(n,"mousedown",p)}U(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Gi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),$e.unbind(t,"keydown",this.keyHandler),$e.unbind(t,"mousedown",lc),$e.unbind(t,"input",this.autoResize),$e.unbind(t,"paste",this.handlePaste),$e.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Xi(n)),Xi(e)},Gi.prototype.getValue=function(){return this.content.innerText.trim()},Gi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Gi.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 NB(e){return e.replace(/\r\n|\r|\n/g,`
316
+ `)}function ci(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Gi({container:t.getContainer(),keyHandler:Yn(this._handleKey,this),resizeHandler:Yn(this._handleResize,this),focusoutHandler:Yn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}ci.$inject=["eventBus","canvas"],ci.prototype.registerProvider=function(e){this._providers.push(e)},ci.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},ci.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},ci.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},ci.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},ci.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},ci.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),o=this.getValue(),r=e.context.text;(o!==r||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,o,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},ci.prototype.getValue=function(){return this._textbox.getValue()},ci.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;if(t===27)return e.preventDefault(),this.cancel();if(t===13&&!e.shiftKey)return e.preventDefault(),this.complete()},ci.prototype._handleResize=function(e){this._fire("resize",e)},ci.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},ci.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=It(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 W0={__depends__:[ql],__init__:["directEditing"],directEditing:["type",ci]};function $B(e){return function(t){var n=t.target,i=he(e),o=i.eventDefinitions&&i.eventDefinitions[0],r=i.$type===n.type,a=(o&&o.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===ut(e);return!r||!a||!s||!c}}const FB={task:{label:"Task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},"user-task":{label:"User task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},"service-task":{label:"Service task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},"send-task":{label:"Send task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},"receive-task":{label:"Receive task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},"manual-task":{label:"Manual task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},"rule-task":{label:"Business rule task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},"script-task":{label:"Script task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},"call-activity":{label:"Call activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},transaction:{label:"Transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},"event-subprocess":{label:"Event sub-process",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},"collapsed-subprocess":{label:"Sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},"expanded-subprocess":{label:"Sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},"collapsed-ad-hoc-subprocess":{label:"Ad-hoc sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},"expanded-ad-hoc-subprocess":{label:"Ad-hoc sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},"exclusive-gateway":{label:"Exclusive gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},"parallel-gateway":{label:"Parallel gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},"inclusive-gateway":{label:"Inclusive gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},"complex-gateway":{label:"Complex gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},"event-based-gateway":{label:"Event-based gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}},"data-store-reference":{label:"Data store reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}},"data-object-reference":{label:"Data object reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}},"expanded-pool":{label:"Expanded pool/participant",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},"collapsed-pool":{label:"Empty pool/participant",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}},"none-start-event":{label:"Start event",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},"none-intermediate-throwing":{label:"Intermediate throw event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},"none-boundary-event":{label:"Boundary event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:BoundaryEvent"}},"none-end-event":{label:"End event",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},"message-start":{label:"Message start event",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},"timer-start":{label:"Timer start event",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},"conditional-start":{label:"Conditional start event",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},"signal-start":{label:"Signal start event",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},"error-start":{label:"Error start event",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},"escalation-start":{label:"Escalation start event",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},"compensation-start":{label:"Compensation start event",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},"non-interrupting-message-start":{label:"Message start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},"non-interrupting-timer-start":{label:"Timer start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},"non-interrupting-conditional-start":{label:"Conditional start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},"non-interrupting-signal-start":{label:"Signal start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},"non-interrupting-escalation-start":{label:"Escalation start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}},"message-intermediate-catch":{label:"Message intermediate catch event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"message-intermediate-throw":{label:"Message intermediate throw event",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"timer-intermediate-catch":{label:"Timer intermediate catch event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},"escalation-intermediate-throw":{label:"Escalation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"conditional-intermediate-catch":{label:"Conditional intermediate catch event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},"link-intermediate-catch":{label:"Link intermediate catch event",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"link-intermediate-throw":{label:"Link intermediate throw event",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"compensation-intermediate-throw":{label:"Compensation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-intermediate-catch":{label:"Signal intermediate catch event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"signal-intermediate-throw":{label:"Signal intermediate throw event",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"message-boundary":{label:"Message boundary event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},"timer-boundary":{label:"Timer boundary event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},"escalation-boundary":{label:"Escalation boundary event",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},"conditional-boundary":{label:"Conditional boundary event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},"error-boundary":{label:"Error boundary event",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},"cancel-boundary":{label:"Cancel boundary event",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},"signal-boundary":{label:"Signal boundary event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},"compensation-boundary":{label:"Compensation boundary event",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},"non-interrupting-message-boundary":{label:"Message boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},"non-interrupting-timer-boundary":{label:"Timer boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},"non-interrupting-escalation-boundary":{label:"Escalation boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},"non-interrupting-conditional-boundary":{label:"Conditional boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},"non-interrupting-signal-boundary":{label:"Signal boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}},"message-end":{label:"Message end event",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"escalation-end":{label:"Escalation end event",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"error-end":{label:"Error end event",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},"cancel-end":{label:"Cancel end event",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},"compensation-end":{label:"Compensation end event",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-end":{label:"Signal end event",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"terminate-end":{label:"Terminate end event",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}};function fe(e,t={}){var n=FB[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var jB=[fe("none-start-event",{actionName:"replace-with-none-start"}),fe("none-intermediate-throwing"),fe("none-end-event",{actionName:"replace-with-none-end"}),fe("message-start"),fe("timer-start"),fe("conditional-start"),fe("signal-start")],HB=[fe("none-start-event",{actionName:"replace-with-none-start"}),fe("none-intermediate-throwing"),fe("none-end-event",{actionName:"replace-with-none-end"})],zB=[fe("none-start-event",{actionName:"replace-with-none-start"}),fe("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),fe("none-end-event",{actionName:"replace-with-none-end"}),fe("message-intermediate-catch"),fe("message-intermediate-throw"),fe("timer-intermediate-catch"),fe("escalation-intermediate-throw"),fe("conditional-intermediate-catch"),fe("link-intermediate-catch"),fe("link-intermediate-throw"),fe("compensation-intermediate-throw"),fe("signal-intermediate-catch"),fe("signal-intermediate-throw")],GB=[fe("none-start-event",{actionName:"replace-with-none-start"}),fe("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),fe("none-end-event",{actionName:"replace-with-none-end"}),fe("message-end"),fe("escalation-end"),fe("error-end"),fe("cancel-end"),fe("compensation-end"),fe("signal-end"),fe("terminate-end")],VB=[fe("exclusive-gateway"),fe("parallel-gateway"),fe("inclusive-gateway"),fe("complex-gateway"),fe("event-based-gateway")],WB=[fe("transaction"),fe("event-subprocess"),fe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),fe("collapsed-subprocess")],UB=[fe("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),fe("transaction"),fe("event-subprocess"),fe("collapsed-ad-hoc-subprocess")],U0=[fe("transaction"),fe("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),fe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),fe("event-subprocess")],qB=U0,q0=[fe("task"),fe("user-task"),fe("service-task"),fe("send-task"),fe("receive-task"),fe("manual-task"),fe("rule-task"),fe("script-task"),fe("call-activity"),fe("collapsed-subprocess"),fe("expanded-subprocess"),fe("collapsed-ad-hoc-subprocess"),fe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],YB=[fe("data-store-reference")],KB=[fe("data-object-reference")],XB=[fe("message-boundary"),fe("timer-boundary"),fe("escalation-boundary"),fe("conditional-boundary"),fe("error-boundary"),fe("cancel-boundary"),fe("signal-boundary"),fe("compensation-boundary"),fe("non-interrupting-message-boundary"),fe("non-interrupting-timer-boundary"),fe("non-interrupting-escalation-boundary"),fe("non-interrupting-conditional-boundary"),fe("non-interrupting-signal-boundary")],ZB=[fe("message-start"),fe("timer-start"),fe("conditional-start"),fe("signal-start"),fe("error-start"),fe("escalation-start"),fe("compensation-start"),fe("non-interrupting-message-start"),fe("non-interrupting-timer-start"),fe("non-interrupting-conditional-start"),fe("non-interrupting-signal-start"),fe("non-interrupting-escalation-start")],QB=[{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"}],JB=[fe("expanded-pool"),fe("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],eN={"bpmn:MessageEventDefinition":[fe("message-start"),fe("message-intermediate-catch"),fe("message-intermediate-throw"),fe("message-end")],"bpmn:TimerEventDefinition":[fe("timer-start"),fe("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[fe("conditional-start"),fe("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[fe("signal-start"),fe("signal-intermediate-catch"),fe("signal-intermediate-throw"),fe("signal-end")],"bpmn:ErrorEventDefinition":[fe("error-start"),fe("error-end")],"bpmn:EscalationEventDefinition":[fe("escalation-start"),fe("escalation-intermediate-throw"),fe("escalation-end")],"bpmn:CompensateEventDefinition":[fe("compensation-start"),fe("compensation-intermediate-throw"),fe("compensation-end")]};const Y0={"start-event-non-interrupting":`
317
317
  <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
318
318
  <g transform="translate(0 995.64)">
319
319
  <path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>
@@ -324,7 +324,7 @@
324
324
  <circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
325
325
  <circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
326
326
  </g>
327
- </svg>`};function Pi(e,t,n,i,o,r,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=o,this._rules=r,this._translate=a,this._moddleCopy=s,this._register()}Pi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Pi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Pi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if(We(e)||!n.allowed("shape.replace",{element:e}))return{};var a=kB(e);return M(t,"bpmn:DataObjectReference")?this._createEntries(e,HB):M(t,"bpmn:DataStoreReference")&&!M(e.parent,"bpmn:Collaboration")?this._createEntries(e,zB):(M(t,"bpmn:Event")&&!M(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=qB[o]||[],!jn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")&&(i=rt(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),M(t,"bpmn:StartEvent")&&!M(t.$parent,"bpmn:SubProcess")?(r=rt(DB.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:Participant")?(r=rt(UB,function(c){return ut(e)!==c.target.isExpanded}),this._createEntries(e,r)):M(t,"bpmn:StartEvent")&&jn(t.$parent)?(r=rt(VB.concat(i),function(c){var l=c.target,u=l.isInterrupting!==!1,p=t.isInterrupting===u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):M(t,"bpmn:StartEvent")&&!jn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")?(r=rt(LB.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:EndEvent")?(r=rt(BB.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,r)):M(t,"bpmn:BoundaryEvent")?(r=rt(GB,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):M(t,"bpmn:IntermediateCatchEvent")||M(t,"bpmn:IntermediateThrowEvent")?(r=rt(IB.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:Gateway")?(r=rt(NB,a),this._createEntries(e,r)):M(t,"bpmn:Transaction")?(r=rt(j0,a),this._createEntries(e,r)):jn(t)&&ut(e)?(r=rt(jB,a),this._createEntries(e,r)):M(t,"bpmn:AdHocSubProcess")&&ut(e)?(r=rt(FB,a),this._createEntries(e,r)):M(t,"bpmn:SubProcess")&&ut(e)?(r=rt($B,a),this._createEntries(e,r)):M(t,"bpmn:SubProcess")&&!ut(e)?(r=rt(H0,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,WB):M(t,"bpmn:FlowNode")?(r=rt(H0,a),this._createEntries(e,r)):{})},Pi.prototype.getPopupMenuHeaderEntries=function(e){var t={};return M(e,"bpmn:Activity")&&!jn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),M(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),M(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Rb(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Pi.prototype._createEntries=function(e,t){var n={},i=this;return z(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},Pi.prototype._createSequenceFlowEntries=function(e,t){var n=ge(e),i={},o=this._modeling,r=this._moddle,a=this;return z(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&M(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=r.create("bpmn:FormalExpression",{body:""});o.updateProperties(e,{conditionExpression:c})})});break;default:M(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e,{conditionExpression:void 0})})}),(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:void 0})})})}}),i},Pi.prototype._createEntry=function(e,t,n){var i=this._translate,o=this._bpmnReplace.replaceElement,r=function(){return o(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||r,{label:i(a),className:e.className,action:n}},Pi.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&M(p,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:u.options.isSequential}):(p=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var o=ge(e),r=o.loopCharacteristics,a,s,c;return r&&(a=r.isSequential,s=r.isSequential===void 0,c=r.isSequential!==void 0&&!r.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Pi.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function o(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var r=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:r,action:o}}},Pi.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function o(a,s){var c=s.active,l;c||(l=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:l})}var r=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!r,action:o}}},Pi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ge(e),i=this,o=Cb(e),r=M(e,"bpmn:BoundaryEvent")?z0["intermediate-event-non-interrupting"]:z0["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 YB={__depends__:[qh,Ux,yu],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Pi]};function uc(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(!(!Bs(d)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}uc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],uc.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&V(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,o){t.removeElements(o.slice())}}}}),n},uc.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return We(t)?Lo(e,n=>t.includes(n)):t},uc.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])&&V(u,g()),u;var p=e.businessObject;function f(y,v){o.start(y,v)}function d(y,v){n.removeElements([v])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(y){var v=5,E=t.getPad(y).html,w=E.getBoundingClientRect(),T={x:w.left,y:w.bottom+v};return T}function m(y,v,E,w){function T(B,$){var H=i.createShape(V({type:y},w));r.start(B,H,{source:$})}var P=s?function(B,$){var H=i.createShape(V({type:y},w));s.append($,H)}:T,O=s?function(B,$){return l.create($,y,w),()=>{l.cleanUp()}}:null;return{group:"model",className:v,title:E,action:{dragstart:T,click:P,hover:O}}}function _(y){return function(v,E){n.splitLane(E,y),t.open(E,!0)}}if(ot(p,["bpmn:Lane","bpmn:Participant"])&&ut(e)){var x=Qo(e);V(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(y,v){n.addLane(v,"top")}}}}),x.length<2&&((xn(e)?e.height>=120:e.width>=120)&&V(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:_(2)}}}),(xn(e)?e.height>=180:e.width>=180)&&V(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:_(3)}}})),V(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(y,v){n.addLane(v,"bottom")}}}})}return M(p,"bpmn:FlowNode")&&(M(p,"bpmn:EventBasedGateway")?V(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"})}):G0(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?V(u,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!M(p,"bpmn:EndEvent")&&!p.isForCompensation&&!G0(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!jn(p)&&V(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")||V(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(y,v){var E=V(h(v),{cursor:{x:y.x,y:y.y}});a.open(v,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),M(p,"bpmn:SequenceFlow")&&V(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),M(p,"bpmn:MessageFlow")&&V(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),ot(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(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")&&V(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),ot(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(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")&&V(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&V(u,g()),u};function G0(e,t,n){var i=e.$instanceOf(t),o=!1,r=e.eventDefinitions||[];return z(r,function(a){a.$type===n&&(o=!0)}),i&&o}const KB={__depends__:[MB,F0,vw,Ri,tg,Kl,YB],__init__:["contextPadProvider"],contextPadProvider:["type",uc]};var XB={horizontal:["x","width"],vertical:["y","height"]},V0=5;function ko(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return We(i)?i:i?n:[]})}ko.$inject=["modeling","rules"],ko.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},ko.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},ko.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(z(t,function(r){o=r(o,n,i)}),o):e},ko.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=Ui(e,i);return z(r,function(a,s){var c=n._findRange(a,i,o),l,u=t[t.length-1];u&&n._hasIntersection(u.range,c)?t[t.length-1].elements.push(a):(l={range:c,elements:[a]},t.push(l))}),t},ko.prototype._setOrientation=function(e){var t=XB[e];this._axis=t[0],this._dimension=t[1]},ko.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)},ko.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+V0,max:t+n-V0}};const ZB={__init__:["distributeElements"],distributeElements:["type",ko]};function qu(e){Si.call(this,e)}qu.$inject=["eventBus"],Me(qu,Si),qu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=rt(t,function(n){var i=ot(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=sl(t),t.length<3?!1:t})};var W0={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
+ </svg>`};function Ti(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()}Ti.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Ti.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Ti.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if(We(e)||!n.allowed("shape.replace",{element:e}))return{};var a=$B(e);return A(t,"bpmn:DataObjectReference")?this._createEntries(e,YB):A(t,"bpmn:DataStoreReference")&&!A(e.parent,"bpmn:Collaboration")?this._createEntries(e,KB):(A(t,"bpmn:Event")&&!A(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=eN[o]||[],!$n(t.$parent)&&A(t.$parent,"bpmn:SubProcess")&&(i=rt(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),A(t,"bpmn:StartEvent")&&!A(t.$parent,"bpmn:SubProcess")?(r=rt(jB.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:Participant")?(r=rt(JB,function(c){return ut(e)!==c.target.isExpanded}),this._createEntries(e,r)):A(t,"bpmn:StartEvent")&&$n(t.$parent)?(r=rt(ZB.concat(i),function(c){var l=c.target,u=l.isInterrupting!==!1,p=t.isInterrupting===u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):A(t,"bpmn:StartEvent")&&!$n(t.$parent)&&A(t.$parent,"bpmn:SubProcess")?(r=rt(HB.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:EndEvent")?(r=rt(GB.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!A(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,r)):A(t,"bpmn:BoundaryEvent")?(r=rt(XB,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!A(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):A(t,"bpmn:IntermediateCatchEvent")||A(t,"bpmn:IntermediateThrowEvent")?(r=rt(zB.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:Gateway")?(r=rt(VB,a),this._createEntries(e,r)):A(t,"bpmn:Transaction")?(r=rt(U0,a),this._createEntries(e,r)):$n(t)&&ut(e)?(r=rt(qB,a),this._createEntries(e,r)):A(t,"bpmn:AdHocSubProcess")&&ut(e)?(r=rt(UB,a),this._createEntries(e,r)):A(t,"bpmn:SubProcess")&&ut(e)?(r=rt(WB,a),this._createEntries(e,r)):A(t,"bpmn:SubProcess")&&!ut(e)?(r=rt(q0,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,r)):A(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,QB):A(t,"bpmn:FlowNode")?(r=rt(q0,a),this._createEntries(e,r)):{})},Ti.prototype.getPopupMenuHeaderEntries=function(e){var t={};return A(e,"bpmn:Activity")&&!$n(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),A(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),A(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),kb(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Ti.prototype._createEntries=function(e,t){var n={},i=this;return G(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},Ti.prototype._createSequenceFlowEntries=function(e,t){var n=he(e),i={},o=this._modeling,r=this._moddle,a=this;return G(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(A(n.sourceRef,"bpmn:ExclusiveGateway")||A(n.sourceRef,"bpmn:InclusiveGateway")||A(n.sourceRef,"bpmn:ComplexGateway")||A(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&A(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=r.create("bpmn:FormalExpression",{body:""});o.updateProperties(e,{conditionExpression:c})})});break;default:A(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e,{conditionExpression:void 0})})}),(A(n.sourceRef,"bpmn:ExclusiveGateway")||A(n.sourceRef,"bpmn:InclusiveGateway")||A(n.sourceRef,"bpmn:ComplexGateway")||A(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:void 0})})})}}),i},Ti.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}},Ti.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&A(p,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:u.options.isSequential}):(p=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var o=he(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"}}}},Ti.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}}},Ti.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}}},Ti.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=he(e),i=this,o=Ob(e),r=A(e,"bpmn:BoundaryEvent")?Y0["intermediate-event-non-interrupting"]:Y0["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 tN={__depends__:[Kh,Qx,yu],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Ti]};function uc(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 m=d.context,h=m.shape;if(!(!Bs(d)||!i.isOpen(h))){var g=i.getEntries(h);g.replace&&g.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}uc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],uc.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&U(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,o){t.removeElements(o.slice())}}}}),n},uc.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return We(t)?Lo(e,n=>t.includes(n)):t},uc.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,o=this._connect,r=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&U(u,m()),u;var p=e.businessObject;function f(y,v){o.start(y,v)}function d(y,v){n.removeElements([v])}function m(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(y){var v=5,S=t.getPad(y).html,_=S.getBoundingClientRect(),T={x:_.left,y:_.bottom+v};return T}function g(y,v,S,_){function T(N,j){var H=i.createShape(U({type:y},_));r.start(N,H,{source:j})}var P=s?function(N,j){var H=i.createShape(U({type:y},_));s.append(j,H)}:T,D=s?function(N,j){return l.create(j,y,_),()=>{l.cleanUp()}}:null;return{group:"model",className:v,title:S,action:{dragstart:T,click:P,hover:D}}}function w(y){return function(v,S){n.splitLane(S,y),t.open(S,!0)}}if(it(p,["bpmn:Lane","bpmn:Participant"])&&ut(e)){var x=Qo(e);U(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(y,v){n.addLane(v,"top")}}}}),x.length<2&&((xn(e)?e.height>=120:e.width>=120)&&U(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:w(2)}}}),(xn(e)?e.height>=180:e.width>=180)&&U(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:w(3)}}})),U(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(y,v){n.addLane(v,"bottom")}}}})}return A(p,"bpmn:FlowNode")&&(A(p,"bpmn:EventBasedGateway")?U(u,{"append.receive-task":g("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):K0(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?U(u,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!A(p,"bpmn:EndEvent")&&!p.isForCompensation&&!K0(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!$n(p)&&U(u,{"append.end-event":g("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":g("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":g("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":g("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||U(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(y,v){var S=U(h(v),{cursor:{x:y.x,y:y.y}});a.open(v,"bpmn-replace",S,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),A(p,"bpmn:SequenceFlow")&&U(u,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),A(p,"bpmn:MessageFlow")&&U(u,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),it(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&U(u,{"append.text-annotation":g("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}}}),A(p,"bpmn:TextAnnotation")&&U(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),it(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&U(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),A(p,"bpmn:Group")&&U(u,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&U(u,m()),u};function K0(e,t,n){var i=e.$instanceOf(t),o=!1,r=e.eventDefinitions||[];return G(r,function(a){a.$type===n&&(o=!0)}),i&&o}const nN={__depends__:[LB,W0,S_,Ci,ig,Kl,tN],__init__:["contextPadProvider"],contextPadProvider:["type",uc]};var iN={horizontal:["x","width"],vertical:["y","height"]},X0=5;function ko(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return We(i)?i:i?n:[]})}ko.$inject=["modeling","rules"],ko.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},ko.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},ko.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(G(t,function(r){o=r(o,n,i)}),o):e},ko.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=Ui(e,i);return G(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},ko.prototype._setOrientation=function(e){var t=iN[e];this._axis=t[0],this._dimension=t[1]},ko.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)},ko.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+X0,max:t+n-X0}};const oN={__init__:["distributeElements"],distributeElements:["type",ko]};function qu(e){Ri.call(this,e)}qu.$inject=["eventBus"],Te(qu,Ri),qu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=rt(t,function(n){var i=it(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=sl(t),t.length<3?!1:t})};var Z0={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>`},QB=900;function pc(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",QB,this)}pc.$inject=["popupMenu","distributeElements","translate","rules"],pc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},pc.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},pc.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:W0.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:W0.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const JB={__depends__:[qh,ZB],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",qu],distributeElementsMenuProvider:["type",pc]};var U0="is not a registered action",eN="is already registered";function Ti(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Ti.$inject=["eventBus","injector"],Ti.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),o=e.get("zoomScroll",!1),r=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),r&&i&&this.register("copy",function(){var u=i.get();if(u.length)return r.copy(u)}),r&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return r.duplicate(u)}),r&&this.register("paste",function(){r.paste()}),r&&i&&s&&this.register("cut",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u});if(p!==!1){var f=We(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&&(We(p)?f=p:f=u,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Ti.prototype.trigger=function(e,t){if(!this._actions[e])throw ig(e,U0);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Ti.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);z(e,function(i,o){n._registerAction(o,i)})},Ti.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw ig(e,eN);this._actions[e]=t},Ti.prototype.unregister=function(e){if(!this.isRegistered(e))throw ig(e,U0);this._actions[e]=void 0},Ti.prototype.getActions=function(){return Object.keys(this._actions)},Ti.prototype.isRegistered=function(e){return!!this._actions[e]};function ig(e,t){return new Error(e+" "+t)}const tN={__init__:["editorActions"],editorActions:["type",Ti]};function Yu(e){e.invoke(Ti,this)}Me(Yu,Ti),Yu.$inject=["injector"],Yu.prototype._registerDefaultActions=function(e){Ti.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),o=e.get("spaceTool",!1),r=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),l=e.get("alignElements",!1),u=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var g=t.getRootElement(),h=n.filter(function(m){return m!==g});return i.select(h),h}),o&&this._registerAction("spaceTool",function(){o.toggle()}),r&&this._registerAction("lassoTool",function(){r.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(g){var h=i.get(),m=g.type;h.length&&c.trigger(h,m)}),i&&l&&this._registerAction("alignElements",function(g){var h=i.get(),m=[],_=g.type;h.length&&(m=rt(h,function(x){return!M(x,"bpmn:Lane")}),l.trigger(m,_))}),i&&f&&this._registerAction("setColor",function(g){var h=i.get();h.length&&f.setColor(h,g)}),i&&u&&this._registerAction("directEditing",function(){var g=i.get();g.length&&u.activate(g[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,m;M(g,"bpmn:Collaboration")?m=n.filter(function(_){return M(_.parent,"bpmn:Collaboration")}):m=n.filter(function(_){return _!==g&&!M(_.parent,"bpmn:SubProcess")}),h=an(m),f.moveElements(m,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const nN={__depends__:[tN],editorActions:["type",Yu]};function q0(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;ot(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}q0.$inject=["eventBus"];function Vr(e,t){de.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var o=i.context,r=o.hints||{},a=r.autoResize;if(a){var s=o.shape,c=o.newBounds;Jn(a)?o.newBounds=n.snapComplex(c,a):o.newBounds=n.snapSimple(s,c)}})}Vr.$inject=["eventBus","gridSnapping","modeling"],Me(Vr,de),Vr.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},Vr.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},Vr.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),V(e,r),e},Vr.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),V(e,r),e};var iN=2e3;function Y0(e,t){e.on(["spaceTool.move","spaceTool.end"],iN,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)}})}Y0.$inject=["eventBus","gridSnapping"];const oN={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Vr],gridSnappingSpaceToolBehavior:["type",Y0]};var Ku=10;function og(e,t,n){return n||(n="round"),Math[n](e/t)*t}var rN=1200,aN=800;function pr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",aN,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"],rN,function(r){var a=r.originalEvent;if(!(!o.active||a&&ri(a))){var s=r.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=cN(r,l,e);p&&(u.offset=p);var f=sN(r,l);f&&V(u,f),Ga(r,l)||o.snapEvent(r,l,u)})}})}pr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);un(e,t,i)},pr.prototype.getGridSpacing=function(){return Ku},pr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=og(e,Ku);var i,o;return t&&t.min&&(i=t.min,Ue(i)&&(i=og(i+n,Ku,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,Ue(o)&&(o=og(o+n,Ku,"floor"),e=Math.min(e,o))),e-=n,e},pr.prototype.isActive=function(){return this.active},pr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},pr.prototype.toggleActive=function(){this.setActive(!this.active)},pr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function sN(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&&(Xu(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&&(Xu(t)?X0(s)?a.x.max=c.left:a.x.min=c.right:K0(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(Xu(t)?X0(s)?a.x.min=l.left:a.x.max=l.right:K0(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function cN(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,a=r.snapLocation,s=r.snapOffset;return s&&Ue(s[t])||(s||(s=r.snapOffset={}),Ue(s[t])||(s[t]=0),!o)||(n.get(o.id)||(Xu(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 Xu(e){return e==="x"}function K0(e){return e.indexOf("n")!==-1}function X0(e){return e.indexOf("w")!==-1}const lN={__depends__:[oN],__init__:["gridSnapping"],gridSnapping:["type",pr]};var uN=2e3;function Z0(e,t,n){e.on("autoPlace",uN,function(i){var o=i.source,r=qe(o),a=i.shape,s=$_(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")&&(pN(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}Z0.$inject=["eventBus","gridSnapping","elementRegistry"];function pN(e){return e==="x"}var fN=1750;function Q0(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}))}})}Q0.$inject=["canvas","eventBus","gridSnapping"];var dN=3e3;function Zu(e,t,n){de.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],dN,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))})}Zu.$inject=["eventBus","gridSnapping","modeling"],Me(Zu,de),Zu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=yN(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 gN(e){return e==="h"}function mN(e){return e==="v"}function yN(e,t,n){var i=yo(t,n),o={};return gN(i)&&(o.y=e.snapValue(t.y)),mN(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=V({},t,o),n=V({},n,o)),[t,n]}const vN={__depends__:[lN,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Z0],gridSnappingParticipantBehavior:["type",Q0],gridSnappingLayoutConnectionBehavior:["type",Zu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",q0]};var bN=30,J0=30;function fc(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var o=i.element,r=i.gfx;if(M(o,"bpmn:Lane"))return n._createParticipantHit(o,r);if(M(o,"bpmn:Participant"))return ut(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(M(o,"bpmn:SubProcess"))return ut(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}fc.$inject=["eventBus","interactionEvents"],fc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},fc.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=xn(e)?{width:bN,height:e.height}:{width:e.width,height:J0};return this._interactionEvents.createBoxHit(t,"all",n),!0},fc.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:J0}),!0};const xN={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",fc]};function Qu(e){e.invoke(Ba,this)}Me(Qu,Ba),Qu.$inject=["injector"],Qu.prototype.registerBindings=function(e,t){Ba.prototype.registerBindings.call(this,e,t);function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("selectElements",function(i){var o=i.keyEvent;if(e.isKey(["a","A"],o)&&e.isCmd(o))return t.trigger("selectElements"),!0}),n("find",function(i){var o=i.keyEvent;if(e.isKey(["f","F"],o)&&e.isCmd(o))return t.trigger("find"),!0}),n("spaceTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["s","S"],o))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["l","L"],o))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["h","H"],o))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["c","C"],o))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["e","E"],o))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["r","R"],o))return t.trigger("replaceElement",o),!0})};const _N={__depends__:[Oh],__init__:["keyboardBindings"],keyboardBindings:["type",Qu]};var wN={moveSpeed:1,moveSpeedAccelerated:10},EN=1500,eE="left",tE="up",nE="right",iE="down",SN={ArrowLeft:eE,Left:eE,ArrowUp:tE,Up:tE,ArrowRight:nE,Right:nE,ArrowDown:iE,Down:iE},RN={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function oE(e,t,n,i,o){var r=this;this._config=V({},wN,e||{}),t.addListener(EN,function(a){var s=a.keyEvent,c=SN[s.key];if(c&&!t.isCmd(s)){var l=t.isShift(s);return r.moveSelection(c,l),!0}}),this.moveSelection=function(a,s){var c=o.get();if(c.length){var l=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=RN[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}oE.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const CN={__depends__:[Oh,Ri],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",oE]};var rE=10;function dc(e,t,n,i){this._dragging=i,this._rules=t;var o=this;function r(c,l){var u=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=l,d=pk(u,p,l),c.newBounds=dk(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:He(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=uv(p),!MN(l,p))return;n.resizeShape(l,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var l={x:c.dx,y:c.dy};r(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}dc.prototype.canResize=function(e){var t=this._rules,n=Ii(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},dc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=V({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,aE(t,r),"resize",{autoActivate:!0,cursor:AN(r),data:{shape:t,context:o}})},dc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:rE,height:rE},o=Zv(t,e.childrenBoxPadding),hk(n,t,i,o)},dc.$inject=["eventBus","rules","modeling","dragging"];function MN(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function aE(e,t){var n=qe(e),i=He(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 AN(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 sE="djs-resizing",cE="resize-not-ok",PN=500;function lE(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,sE)),s.width>5&&Se(c,{x:s.x,width:s.width}),s.height>5&&Se(c,{y:s.y,height:s.height}),r.canExecute?lt(c).remove(cE):lt(c).add(cE)}function o(r){var a=r.shape,s=r.frame;s&&rn(r.frame),t.removeMarker(a,sE)}e.on("resize.move",PN,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}lE.$inject=["eventBus","canvas","previewSupport"];var Ju=-6,ep=8,tp=20,hc="djs-resizer",TN=["n","w","s","e","nw","ne","se","sw"];function fr(e,t,n,i){this._resize=i,this._canvas=t;var o=this;e.on("selection.changed",function(r){var a=r.newSelection;o.removeResizers(),a.length===1&&z(a,Xn(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}fr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){er(r)&&i.activate(r,e,n)}Fe.bind(t,"mousedown",o),Fe.bind(t,"touchstart",o)},fr.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=kN(i),a=Be("g");lt(a).add(hc),lt(a).add(hc+"-"+e.id),lt(a).add(hc+"-"+i),Ke(o,a);var s=Be("rect");Se(s,{x:-ep/2+r.x,y:-ep/2+r.y,width:ep,height:ep}),lt(s).add(hc+"-visual"),Ke(a,s);var c=Be("rect");return Se(c,{x:-tp/2+r.x,y:-tp/2+r.y,width:tp,height:tp}),lt(c).add(hc+"-hit"),Ke(a,c),dl(a,t,n),a},fr.prototype.createResizer=function(e,t){var n=aE(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},fr.prototype.addResizer=function(e){var t=this;kt(e)||z(TN,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},fr.prototype.removeResizers=function(){var e=this._getResizersParent();ms(e)},fr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},fr.$inject=["eventBus","canvas","selection","resize"];function kN(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Ju:e.indexOf("w")!==-1&&(t.x=Ju),e.indexOf("s")!==-1?t.y=-Ju:e.indexOf("n")!==-1&&(t.y=Ju),t}const uE={__depends__:[no,Eo,Oa],__init__:["resize","resizePreview","resizeHandles"],resize:["type",dc],resizePreview:["type",lE],resizeHandles:["type",fr]};var ON=2e3;function gc(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"],ON,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){r.removeResizers()}),e.on("create.end",500,function(c){var l=c.context,u=l.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||ot(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}gc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],gc.prototype.activate=function(e){var t=yi(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);V(n,i);var o={},r=n.style||{};return V(r,{backgroundColor:null,border:null}),(ot(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||pE(e))&&V(o,{centerVertically:!0}),Xo(e)&&(V(o,{resizable:!0,autoResize:!0}),V(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),M(e,"bpmn:TextAnnotation")&&(V(o,{resizable:!0,autoResize:!0}),V(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),V(n,{options:o,style:r}),n}},gc.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")||IN(e)){var g=xn(e),h=g?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:o.y-30*a/2}:{width:i.width,height:30*a};V(r,h),V(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(LN(e)){var m=xn(e),_=m?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:o.x-i.height/2,y:o.y-i.width/2};V(r,_),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?null:"rotate(-90deg)"})}(ot(e,["bpmn:Task","bpmn:CallActivity"])||pE(e))&&(V(r,{width:i.width,height:i.height}),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),DN(e)&&(V(r,{width:i.width,x:i.x}),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var x=1,y=i.width+2*x;if(n.labelTarget&&(V(r,{width:y,height:i.height+2*x,x:i.x-x,y:i.y-x}),V(d,{fontSize:l+"px",lineHeight:u})),Xo(n)&&!ml(n)&&!it(n)){var v=Hf(e),E=t.getAbsoluteBBox({x:v.x,y:v.y,width:0,height:0}),w=l,T=Tr.width*a+2*x;V(r,{width:T,height:w+2*x,x:E.x-T/2,y:E.y-w/2-x}),V(d,{fontSize:l+"px",lineHeight:u})}return M(e,"bpmn:TextAnnotation")&&(V(r,{width:i.width+2*x,height:i.height+2*x,x:i.x-x,y:i.y-x,minWidth:30*a,minHeight:10*a}),V(d,{textAlign:"left",paddingTop:xa*a+"px",paddingBottom:xa*a+"px",paddingLeft:xa*a+"px",paddingRight:xa*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:r,style:d}},gc.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}),BN(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function pE(e){return M(e,"bpmn:SubProcess")&&!ut(e)}function DN(e){return M(e,"bpmn:SubProcess")&&ut(e)}function LN(e){return M(e,"bpmn:Participant")&&!ut(e)}function IN(e){return M(e,"bpmn:Participant")&&ut(e)}function BN(e){return!e||!e.trim()}var fE="djs-element-hidden",dE="djs-label-hidden";function hE(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=Be("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=Be("path");Se(p,{d:u,strokeWidth:2,stroke:NN(r)}),Ke(s,p),Ke(o,s),Dn(s,r.x,r.y)}M(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,fE):(M(r,"bpmn:Task")||M(r,"bpmn:CallActivity")||M(r,"bpmn:SubProcess")||M(r,"bpmn:Participant")||M(r,"bpmn:Lane"))&&t.addMarker(r,dE)}),e.on("directEditing.resize",function(c){if(M(r,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(r.height/a.height*(l+u),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:p,position:{mx:0,my:0}});Se(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,fE),t.removeMarker(r,dE)),r=void 0,a=void 0,s&&(rn(s),s=void 0)})}hE.$inject=["eventBus","canvas","pathMap"];function NN(e,t){var n=dt(e);return n.get("stroke")||t||"black"}const $N={__depends__:[rh,uE,F0],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",gc],labelEditingPreview:["type",hE]};var FN=500,jN=1e3;function ro(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function o(r){dP(r)||i.createOutline(r)}e.on("element.hover",function(r){o(r.element)}),e.on("selection.changed",function(r){z(r.newSelection,o)}),e.on(["shape.changed","connection.changed"],FN,function(r){var a=r.element,s=r.gfx,c=Et(".djs-outline",s);c&&i.updateOutline(a,c)})}ro.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Et(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Ke(t,n),this.updateOutline(e,n)),n},ro.prototype._createOutlineGfx=function(){var e=Be("rect");return Se(e,V({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},ro.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},ro.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&z(i,function(o){n=n||o.updateOutline(t,e)}),n||Se(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},ro.prototype.updateConnectionOutline=function(e,t){var n=an(t);Se(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},ro.prototype.registerProvider=function(e,t){t||(t=e,e=jN),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},ro.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},ro.prototype.getOutline=function(e){var t,n=this._getProviders();return z(n,function(i){bn(i.getOutline)&&(t=t||i.getOutline(e))}),t},ro.$inject=["eventBus","styles","elementRegistry"];var np=6;function rg(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)})}rg.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");ms(t);var n=e.length>1,i=this._canvas.getContainer();if(lt(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=HN(an(e)),r=Be("rect");Se(r,V({rx:3},o)),lt(r).add("djs-selection-outline"),Ke(t,r)}},rg.$inject=["eventBus","canvas","selection"];function HN(e){return{x:e.x-np,y:e.y-np,width:e.width+np*2,height:e.height+np*2}}const ag={__depends__:[Ri],__init__:["outline","multiSelectionOutline"],outline:["type",ro],multiSelectionOutline:["type",rg]},gE=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],mE={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},zN=15,ip=2;function yE(e,t,n,i,o){const r=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(g=>ot(g,gE));if(f.length===1){const g=f[0];it(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(f.length===2){const g=f.find(it),h=f.find(m=>{var _;return(_=m.labels)==null?void 0:_.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!ot(p,gE)||!u(p)||(it(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=bs([qe(f),qe(p)],mE),g=d.getAttribute("d"),m=o.isSelected(p)?c(p):l(p),_=Es(m,g);if(!_)return;const y=o.isSelected(f)?c(f):l(f),v=Es(y,g)||qe(f);Ds(v,_)<zN||(Df(d,[v,_]),Ke(r,d))}function s(){gs(`.${mE.class}`,r).forEach(rn)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+dr(f,"x")-ip,y:p.y+dr(f,"y")-ip,width:dr(f,"width")+ip*2,height:dr(f,"height")+ip*2};return Gf(d,dr(f,"rx"))}if(f.cx){const d=dr(f,"r"),g={x:p.x+dr(f,"cx")-d,y:p.y+dr(f,"cy")-d,width:d*2,height:d*2};return Lv(g)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}yE.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function dr(e,t){return parseFloat(Se(e,t)||0)}const GN={__depends__:[Ri,ag],__init__:["labelLink"],labelLink:["type",yE]};var VN=new Ir("tt");function WN(e){var t=$t('<div class="djs-tooltip-container" />');return Wn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function UN(e,t,n){Wn(e,{left:t+"px",top:n+"px"})}function sg(e,t){e.style.display=t===!1?"none":""}var vE="djs-tooltip",cg="."+vE;function Qn(e,t){this._eventBus=e,this._canvas=t,this._ids=VN,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=WN(t.getContainer());var n=this;ni.bind(this._tooltipRoot,cg,"mousedown",function(i){i.stopPropagation()}),ni.bind(this._tooltipRoot,cg,"mouseover",function(i){n.trigger("mouseover",i)}),ni.bind(this._tooltipRoot,cg,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Qn.$inject=["eventBus","canvas"],Qn.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=V({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Qn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Sn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Qn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Qn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Qn.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)}},Qn.prototype.remove=function(e){var t=this.get(e);t&&(Xi(t.html),Xi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Qn.prototype.show=function(){sg(this._tooltipRoot)},Qn.prototype.hide=function(){sg(this._tooltipRoot,!1)},Qn.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},Qn.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)),Jn(n)&&(n=$t(n)),i=$t('<div data-tooltip-id="'+t+'" class="'+vE+'">'),Wn(i,{position:"absolute"}),i.appendChild(n),e.type&&Rt(i).add("djs-tooltip-"+e.type),e.className&&Rt(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Qn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;UN(n,t.x,t.y)},Qn.prototype._updateTooltipVisibilty=function(e){z(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),sg(i,o))})},Qn.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 qN={__init__:["tooltips"],tooltips:["type",Qn]};var YN="flow elements must be children of pools/participants",KN="Data object must be placed within a pool/participant.";function bE(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(YN)):M(a,"bpmn:DataObjectReference")&&i(o,n(KN)))})}bE.$inject=["eventBus","tooltips","translate"];const XN={__depends__:[qN],__init__:["modelingFeedback"],modelingFeedback:["type",bE]};var ZN=500,QN=1250,JN=1500,op=Math.round;function e$(e){return{x:e.x+op(e.width/2),y:e.y+op(e.height/2)}}function xE(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",JN,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=t$(u),V(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",QN,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",ZN,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=op(l.x),l.y=op(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(er(s)){var c=Aa(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(hn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!lt(s.target).has("djs-hit-no-move")){var p=e$(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}xE.$inject=["eventBus","dragging","modeling","selection","rules"];function t$(e){var t=na(e,"id");return rt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var _E=499,lg="djs-dragging",wE="drop-ok",EE="drop-not-ok",SE="new-parent",RE="attach-ok";function CE(e,t,n,i){function o(c){var l=r(c),u=n$(l);return u}function r(c){var l=xs(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[RE,wE,EE,SE].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,lg),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",_E,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,f=o(u);if(!l.dragGroup){var d=Be("g");Se(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();Ke(g,d),l.dragGroup=d}f.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=wp([p,r(u)]):p=r(u),z(p,function(h){t.addMarker(h,lg)}),l.allDraggedElements=p,l.differentParents=i$(u)}),e.on("shape.move.move",_E,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,RE):l.canExecute&&f&&p.id!==f.id?a(p,SE):a(p,l.canExecute?wE:EE)),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;z(u,function(f){t.removeMarker(f,lg)}),p&&rn(p)}),this.makeDraggable=s}CE.$inject=["eventBus","canvas","styles","previewSupport"];function n$(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=rt(e,function(i){return kt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function i$(e){return rS(na(e,function(t){return t.parent&&t.parent.id}))!==1}const o$={__depends__:[ql,Ri,ag,no,Eo,Oa],__init__:["move","movePreview"],move:["type",xE],movePreview:["type",CE]};var ME=".djs-palette-toggle",AE=".entry",r$=ME+", "+AE,ug="djs-palette-",a$="shown",pg="open",PE="two-column",s$=1e3;function pn(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var o=i.tool;n.updateToolHighlight(o)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}pn.$inject=["eventBus","canvas"],pn.prototype.registerProvider=function(e,t){t||(t=e,e=s$),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},pn.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(l$,{})},pn.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},pn.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=$t(pn.HTML_MARKUP);n.appendChild(i),Rt(n).add(ug+a$),ni.bind(i,r$,"click",function(o){var r=o.delegateTarget;if(Ef(r,ME))return e.toggle();e.trigger("click",o)}),Fe.bind(i,"mousedown",function(o){o.stopPropagation()}),ni.bind(i,AE,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},pn.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},pn.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=Rt(n),a=Rt(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(PE,o),a.toggle(ug+PE,o),"open"in e&&(r.toggle(pg,e.open),a.toggle(ug+pg,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},pn.prototype._update=function(){var e=Et(".djs-palette-entries",this._container),t=this._entries=this.getEntries();il(e),z(t,function(n,i){var o=n.group||"default",r=Et("[data-group="+Fr(o)+"]",e);r||(r=$t('<div class="group"></div>'),Sn(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=$t(a);if(r.appendChild(s),!n.separator&&(Sn(s,"data-action",i),n.title&&Sn(s,"title",n.title),n.className&&c$(s,n.className),n.imageUrl)){var c=$t("<img>");Sn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},pn.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=Sn(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},pn.prototype.triggerEntry=function(e,t,n,i){var o=this._entries,r,a;if(r=o[e],!!r&&(a=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:n})!==!1)){if(bn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},pn.prototype._layoutChanged=function(){this._toggleState({})},pn.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},pn.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},pn.prototype.open=function(){this._toggleState({open:!0})},pn.prototype.toggle=function(){this.isOpen()?this.close():this.open()},pn.prototype.isActiveTool=function(e){return e&&this._activeTool===e},pn.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Et(".djs-palette-entries",this._container),this._toolsContainer=Et("[data-group=tools]",t)),n=this._toolsContainer,z(n.children,function(i){var o=i.getAttribute("data-action");if(o){var r=Rt(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},pn.prototype.isOpen=function(){return Rt(this._container).has(pg)},pn.prototype._getParentContainer=function(){return this._canvas.getContainer()},pn.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function c$(e,t){var n=Rt(e),i=We(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function l$(e,t){var n=t.getPaletteEntries();return bn(n)?n(e):(z(n,function(i,o){e[o]=i}),e)}const u$={__init__:["palette"],palette:["type",pn]};var TE="crosshair",kE="selected",p$="djs-dragging-active-lasso";function hr(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=Be("rect");Se(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Ke(f,d),l(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&Se(f,{x:d.x,y:d.y,width:d.width,height:d.height});var g=p.marked,h=p.lastMarked;if(g&&h){for(const m of h)g.has(m)||t.removeMarker(m,kE);for(const m of g)h.has(m)||t.addMarker(m,kE)}},remove:function(p){this.update(p),p.frame&&rn(p.frame),l(!1)}};function l(p){lt(t.getContainer()).toggle(p$,p)}function u(p){var f=i.getAll();return new Set(ta(ga(f,p)))}r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=OE(p),f.add=jl(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=OE(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(jl(p))return s.activateLasso(p.originalEvent),!0})}hr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],hr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:TE,data:{context:{}},keepSelection:!0})},hr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:TE,data:{context:{}},keepSelection:!0})},hr.prototype._select=function(e){this._selection.select(e)},hr.prototype.select=function(e,t,n=[]){var i=ta(ga(e,t));this._select([...n,...i])},hr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},hr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function OE(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__:[Zl,Fs],__init__:["lassoTool"],lassoTool:["type",hr]};var fg=1500,DE="grab";function Va(e,t,n,i,o,r){this._dragging=n,this._mouse=r;var a=this,s=i.get("keyboard",!1);o.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",fg,function(c){if(Bs(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(fg,function(c){if(!(!LE(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(fg,function(c){!LE(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!Bs(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Va.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Va.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:DE,data:{context:n||{}}})},Va.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:DE,data:{context:{reactivate:n}}})},Va.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Va.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function LE(e){return mn("Space",e)}const d$={__depends__:[Zl,Fs],__init__:["handTool"],handTool:["type",Va]};var IE="connect-ok",BE="connect-not-ok";function Wa(e,t,n,i,o,r,a){var s=this;this._dragging=t,this._rules=r,this._mouse=a,o.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var l=c.context,u=c.hover,p=l.canStartConnect=s.canStartConnect(u);p!==null&&(l.startTarget=u,i.addMarker(u,p?IE:BE))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?IE:BE)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(u);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,p)}),!1})}Wa.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Wa.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Wa.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Wa.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Wa.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const h$={__depends__:[tg,no,Eo,Zl,Fs],globalConnect:["type",Wa]};function dg(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)}dg.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],dg.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,o=this._lassoTool,r=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,g,h){function m(_){var x=n.createShape(V({type:p},h));t.start(_,x)}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 V(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 g$={__depends__:[u$,Kl,Qx,f$,d$,h$,Ps],__init__:["paletteProvider"],paletteProvider:["type",dg]};var m$=250;function hg(e,t,n,i,o){de.call(this,e);function r(s){var c=s.canExecute.replacements;z(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);V(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=Et('[data-element-id="'+Fr(f.id)+'"]',s.dragGroup);g&&Se(g,{display:"none"});var h=o.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;z(c,function(l,u){var p=Et('[data-element-id="'+Fr(u)+'"]',s.dragGroup);p&&Se(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",m$,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}hg.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Me(hg,de);const y$={__depends__:[Oa],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",hg]};var v$=1250,gg=40,b$=20,x$=10,NE=20,$E=["x","y"],_$=Math.abs;function FE(e){e.on(["connect.hover","connect.move","connect.end"],v$,function(t){var n=t.context,i=n.canExecute,o=n.start,r=n.hover,a=n.source,s=n.target;t.originalEvent&&ri(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&r&&w$(t,r,C$(r)),r&&R$(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Ai(o),ot(r,["bpmn:Event","bpmn:Gateway"])&&jE(t,Ai(r)),ot(r,["bpmn:Task","bpmn:SubProcess"])&&E$(t,r),M(a,"bpmn:BoundaryEvent")&&s===a.host&&S$(t)):HE(i,"bpmn:MessageFlow")?(M(o,"bpmn:Event")&&(n.connectionStart=Ai(o)),M(r,"bpmn:Event")&&jE(t,Ai(r))):n.connectionStart=n.initialConnectionStart)})}FE.$inject=["eventBus"];function w$(e,t,n){$E.forEach(function(i){var o=zE(i,t);e[i]<t[i]+n?un(e,i,t[i]+n):e[i]>t[i]+o-n&&un(e,i,t[i]+o-n)})}function E$(e,t){var n=Ai(t);$E.forEach(function(i){M$(e,t,i)&&un(e,i,n[i])})}function S$(e){var t=e.context,n=t.source,i=t.target;if(!A$(t)){var o=Ai(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;_$(c-o[s])<gg&&(c>o[s]?l=o[s]+gg:l=o[s]-gg,un(e,s,l))})}}function jE(e,t){un(e,"x",t.x),un(e,"y",t.y)}function HE(e,t){return e&&e.type===t}function R$(e,t){return Io(t,function(n){return HE(e,n)})}function zE(e,t){return e==="x"?t.width:t.height}function C$(e){return M(e,"bpmn:Task")?x$:b$}function M$(e,t,n){return e[n]>t[n]+NE&&e[n]<t[n]+zE(n,t)-NE}function A$(e){var t=e.hover,n=e.source;return t&&n&&t===n}function gr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}gr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},gr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},gr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},gr.prototype.getSnapLocations=function(){return this._snapLocations},gr.prototype.setSnapLocations=function(e){this._snapLocations=e},gr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new rp,n.initDefaults(this._defaultSnaps)),n};function rp(){this._snapValues={}}rp.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},rp.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&mB(e[n],o[n],i)},rp.prototype.initDefaults=function(e){var t=this;z(e||{},function(n,i){z(n,function(o){t.add(i,o)})})};var P$=1250;function ao(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(o){i.initSnap(o)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],P$,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&ri(o.originalEvent))&&!(Ga(o)||!c)){var l=s.pointsForTarget(c);l.initialized||(l=i.addSnapTargetPoints(l,a,c),l.initialized=!0),n.snap(o,l)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}ao.$inject=["elementRegistry","eventBus","snapping"],ao.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new gr);var r;t.get(i.id)?r=Ai(i,e):r={x:e.x+Ai(i).x,y:e.y+Ai(i).y};var a={x:r.x-i.width/2,y:r.y-i.height/2},s={x:r.x+i.width/2,y:r.y+i.height/2};return o.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),it(i)||(o.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),o.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),o},ao.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return z(i,function(o){if(it(o)){it(t)&&e.add("mid",Ai(o));return}if(kt(o)){if(o.waypoints.length<3)return;var r=o.waypoints.slice(1,-1);z(r,function(a){e.add("mid",a)});return}e.add("mid",Ai(o))}),!Ue(t.x)||!Ue(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Ai(t)),e},ao.prototype.getSnapTargets=function(e,t){return A0(t).filter(function(n){return!T$(n)})};function T$(e){return!!e.hidden}var GE=1500;function Ua(e,t){t.invoke(ao,this),e.on(["create.move","create.end"],GE,L$),e.on(["create.move","create.end","shape.move.move","shape.move.end"],GE,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!Ga(n)&&k$(n,r)})}Me(Ua,ao),Ua.$inject=["eventBus","injector"],Ua.prototype.initSnap=function(e){var t=ao.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return z(n.outgoing,function(o){var r=o.waypoints[0];r=r.original||r,t.setSnapOrigin(o.id+"-docking",WE(r,i,e))}),z(n.incoming,function(o){var r=o.waypoints[o.waypoints.length-1];r=r.original||r,t.setSnapOrigin(o.id+"-docking",WE(r,i,e))}),M(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ua.prototype.addSnapTargetPoints=function(e,t,n){ao.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);z(i,function(r){(D$(r)||O$([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",C0(r)),e.add("bottom-right",M0(r)))});var o=this._elementRegistry;return z(t.incoming,function(r){if(o.get(t.id)){VE(i,r.source)||e.add("mid",qe(r.source));var a=r.waypoints[0];e.add(r.id+"-docking",a.original||a)}}),z(t.outgoing,function(r){if(o.get(t.id)){VE(i,r.target)||e.add("mid",qe(r.target));var a=r.waypoints[r.waypoints.length-1];e.add(r.id+"-docking",a.original||a)}}),M(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Ua.prototype.getSnapTargets=function(e,t){return ao.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!M(n,"bpmn:Lane")})};function k$(e,t){var n=He(t),i=Yb(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=qe(r),/top/.test(i)?un(e,"y",n.top-a.y):/bottom/.test(i)&&un(e,"y",n.bottom-a.y),/left/.test(i)?un(e,"x",n.left-a.x):/right/.test(i)&&un(e,"x",n.right-a.x)}function O$(e,t){return e.every(function(n){return M(n,t)})}function D$(e){return M(e,"bpmn:SubProcess")&&ut(e)?!0:M(e,"bpmn:Participant")}function L$(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,o=n.right,r=n.bottom,a=n.left;(a&&a>=e.x||o&&o<=e.x)&&un(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&un(e,"y",e.y)}}function VE(e,t){return e.indexOf(t)!==-1}function WE(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var I$=1250;function mc(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],I$,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&ri(i.originalEvent))&&!Ga(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),$$(s)&&un(i,"x",i.x),F$(s)&&un(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}mc.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new gr);var r=UE(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},mc.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return z(o,function(r){e.add("corner",M0(r)),e.add("corner",C0(r))}),e.add("corner",UE(t,i)),e},mc.$inject=["eventBus","snapping"],mc.prototype.getSnapTargets=function(e,t){return A0(t).filter(function(n){return!B$(n,e)&&!kt(n)&&!N$(n)&&!it(n)})};function UE(e,t){var n=qe(e),i=He(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 B$(e,t){return e.host===t}function N$(e){return!!e.hidden}function $$(e){return e==="n"||e==="s"}function F$(e){return e==="e"||e==="w"}var j$=7,H$=1e3;function mr(e){this._canvas=e,this._asyncHide=Sp(Xn(this.hide,this),H$)}mr.$inject=["canvas"],mr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:Ga(e,"x"),y:Ga(e,"y")};z(o,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(z(["x","y"],function(l){var u;r[l]||(u=t.snap(c,a,l,j$),u!==void 0&&(r[l]={value:u,originValue:u-s[l]}))}),r.x&&r.y)return!1}),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),z(["x","y"],function(a){var s=r[a];hn(s)&&un(e,a,s.originValue)})},mr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Be("path");return Se(n,{d:"M0,0 L0,0"}),lt(n).add("djs-snap-line"),Ke(t,n),{update:function(i){Ue(i)?e==="horizontal"?Se(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Se(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Se(n,{display:"none"})}}},mr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},mr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},mr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},mr.prototype.hide=function(){z(this._snapLines,function(e){e.update()})};const z$={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",ao],resizeSnapping:["type",mc],snapping:["type",mr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",FE],createMoveSnapping:["type",Ua]};var qE=300;function Qe(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=Et(Qe.INPUT_SELECTOR,this._container),this._resultsContainer=Et(Qe.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Qe.$inject=["canvas","eventBus","selection","translate"],Qe.prototype._bindEvents=function(){var e=this;function t(n,i,o,r){e._eventMaps.push({el:n,type:o,listener:ni.bind(n,i,o,r)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Qe.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Qe.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Qe.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Qe.INPUT_SELECTOR,"keydown",function(n){mn("ArrowUp",n)&&n.preventDefault(),mn("ArrowDown",n)&&n.preventDefault()}),t(this._container,Qe.INPUT_SELECTOR,"keyup",function(n){if(mn("Escape",n))return e.close();if(mn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(mn("ArrowUp",n))return e._scrollToDirection(!0);if(mn("ArrowDown",n))return e._scrollToDirection();mn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Qe.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ni.unbind(e.el,e.type,e.listener)})},Qe.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(o){return!t._canvas.getRootElements().includes(o.element)}),!n.length){this._selection.select(null);return}n.forEach(function(o){var r=o.element.id,a=t._createResultNode(o,r);t._results[r]={element:o.element,node:a}});var i=Et(Qe.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Qe.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Qe.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)}},Qe.prototype._clearResults=function(){il(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Qe.prototype._getCurrentResult=function(){return Et(Qe.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Qe.prototype._createResultNode=function(e,t){var n=$t(Qe.RESULT_HTML);return e.primaryTokens.length>0&&YE(n,e.primaryTokens,Qe.RESULT_PRIMARY_HTML),YE(n,e.secondaryTokens,Qe.RESULT_SECONDARY_HTML),Sn(n,Qe.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Qe.prototype.registerProvider=function(e){this._searchProvider=e},Qe.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,Rt(this._canvas.getContainer()).add("djs-search-open"),Rt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Qe.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,Rt(this._canvas.getContainer()).remove("djs-search-open"),Rt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Qe.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Qe.prototype.isOpen=function(){return this._open},Qe.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Rt(t).remove(Qe.RESULT_SELECTED_CLASS);var n=Sn(e,Qe.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Rt(e).add(Qe.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:qE}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Qe.prototype._select=function(e){var t=Sn(e,Qe.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:qE}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Qe.prototype._getBoxHtml=function(){const e=$t(Qe.BOX_HTML),t=Et(Qe.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function YE(e,t,n){var i=G$(t),o=$t(n);o.innerHTML=i,e.appendChild(o)}function G$(e){var t="";return e.forEach(function(n){var i=nw(n.value||n.matched||n.normal),o=n.match||n.matched;o?t+='<b class="'+Qe.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Qe.CONTAINER_SELECTOR=".djs-search-container",Qe.INPUT_SELECTOR=".djs-search-input input",Qe.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Qe.RESULT_SELECTOR=".djs-search-result",Qe.RESULT_SELECTED_CLASS="djs-search-result-selected",Qe.RESULT_SELECTED_SELECTOR="."+Qe.RESULT_SELECTED_CLASS,Qe.RESULT_ID_ATTRIBUTE="data-result-id",Qe.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Qe.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
+ </svg>`},rN=900;function pc(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",rN,this)}pc.$inject=["popupMenu","distributeElements","translate","rules"],pc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},pc.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},pc.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:Z0.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Z0.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const aN={__depends__:[Kh,oN],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",qu],distributeElementsMenuProvider:["type",pc]};var Q0="is not a registered action",sN="is already registered";function ki(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}ki.$inject=["eventBus","injector"],ki.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=We(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&&(We(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)})},ki.prototype.trigger=function(e,t){if(!this._actions[e])throw rg(e,Q0);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},ki.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);G(e,function(i,o){n._registerAction(o,i)})},ki.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw rg(e,sN);this._actions[e]=t},ki.prototype.unregister=function(e){if(!this.isRegistered(e))throw rg(e,Q0);this._actions[e]=void 0},ki.prototype.getActions=function(){return Object.keys(this._actions)},ki.prototype.isRegistered=function(e){return!!this._actions[e]};function rg(e,t){return new Error(e+" "+t)}const cN={__init__:["editorActions"],editorActions:["type",ki]};function Yu(e){e.invoke(ki,this)}Te(Yu,ki),Yu.$inject=["injector"],Yu.prototype._registerDefaultActions=function(e){ki.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 m=t.getRootElement(),h=n.filter(function(g){return g!==m});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(m){var h=i.get(),g=m.type;h.length&&c.trigger(h,g)}),i&&l&&this._registerAction("alignElements",function(m){var h=i.get(),g=[],w=m.type;h.length&&(g=rt(h,function(x){return!A(x,"bpmn:Lane")}),l.trigger(g,w))}),i&&f&&this._registerAction("setColor",function(m){var h=i.get();h.length&&f.setColor(h,m)}),i&&u&&this._registerAction("directEditing",function(){var m=i.get();m.length&&u.activate(m[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var m=t.getRootElement(),h,g;A(m,"bpmn:Collaboration")?g=n.filter(function(w){return A(w.parent,"bpmn:Collaboration")}):g=n.filter(function(w){return w!==m&&!A(w.parent,"bpmn:SubProcess")}),h=rn(g),f.moveElements(g,{x:-h.x,y:-h.y},m)}),i&&d&&this._registerAction("replaceElement",function(m){d.triggerEntry("replace","click",m)})};const lN={__depends__:[cN],editorActions:["type",Yu]};function J0(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;it(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}J0.$inject=["eventBus"];function Ur(e,t){de.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var o=i.context,r=o.hints||{},a=r.autoResize;if(a){var s=o.shape,c=o.newBounds;Qn(a)?o.newBounds=n.snapComplex(c,a):o.newBounds=n.snapSimple(s,c)}})}Ur.$inject=["eventBus","gridSnapping","modeling"],Te(Ur,de),Ur.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},Ur.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},Ur.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),o=/e/.test(t),r={};return r.width=n.snapValue(e.width,{min:e.width}),o&&(i?(r.x=n.snapValue(e.x,{max:e.x}),r.width+=n.snapValue(e.x-r.x,{min:e.x-r.x})):e.x=e.x+e.width-r.width),U(e,r),e},Ur.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),o=/s/.test(t),r={};return r.height=n.snapValue(e.height,{min:e.height}),i&&(o?(r.y=n.snapValue(e.y,{max:e.y}),r.height+=n.snapValue(e.y-r.y,{min:e.y-r.y})):e.y=e.y+e.height-r.height),U(e,r),e};var uN=2e3;function eE(e,t){e.on(["spaceTool.move","spaceTool.end"],uN,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)}})}eE.$inject=["eventBus","gridSnapping"];const pN={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Ur],gridSnappingSpaceToolBehavior:["type",eE]};var Ku=10;function ag(e,t,n){return n||(n="round"),Math[n](e/t)*t}var fN=1200,dN=800;function pr(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"],fN,function(r){var a=r.originalEvent;if(!(!o.active||a&&oi(a))){var s=r.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=gN(r,l,e);p&&(u.offset=p);var f=hN(r,l);f&&U(u,f),Ua(r,l)||o.snapEvent(r,l,u)})}})}pr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);ln(e,t,i)},pr.prototype.getGridSpacing=function(){return Ku},pr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=ag(e,Ku);var i,o;return t&&t.min&&(i=t.min,Ue(i)&&(i=ag(i+n,Ku,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,Ue(o)&&(o=ag(o+n,Ku,"floor"),e=Math.min(e,o))),e-=n,e},pr.prototype.isActive=function(){return this.active},pr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},pr.prototype.toggleActive=function(){this.setActive(!this.active)},pr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function hN(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&&(Xu(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&&(Xu(t)?nE(s)?a.x.max=c.left:a.x.min=c.right:tE(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(Xu(t)?nE(s)?a.x.min=l.left:a.x.max=l.right:tE(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function gN(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,a=r.snapLocation,s=r.snapOffset;return s&&Ue(s[t])||(s||(s=r.snapOffset={}),Ue(s[t])||(s[t]=0),!o)||(n.get(o.id)||(Xu(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 Xu(e){return e==="x"}function tE(e){return e.indexOf("n")!==-1}function nE(e){return e.indexOf("w")!==-1}const mN={__depends__:[pN],__init__:["gridSnapping"],gridSnapping:["type",pr]};var yN=2e3;function iE(e,t,n){e.on("autoPlace",yN,function(i){var o=i.source,r=qe(o),a=i.shape,s=Vw(o,a,n);return["x","y"].forEach(function(c){var l={};s[c]!==r[c]&&(s[c]>r[c]?l.min=s[c]:l.max=s[c],A(a,"bpmn:TextAnnotation")&&(vN(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}iE.$inject=["eventBus","gridSnapping","elementRegistry"];function vN(e){return e==="x"}var bN=1750;function oE(e,t,n){t.on(["create.start","shape.move.start"],bN,function(i){var o=i.context,r=o.shape,a=e.getRootElement();if(!(!A(r,"bpmn:Participant")||!A(a,"bpmn:Process")||!a.children.length)){var s=o.createConstraints;s&&(r.width=n.snapValue(r.width,{min:r.width}),r.height=n.snapValue(r.height,{min:r.height}))}})}oE.$inject=["canvas","eventBus","gridSnapping"];var xN=3e3;function Zu(e,t,n){de.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],xN,function(o){var r=o.context,a=r.connection,s=r.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||wN(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Zu.$inject=["eventBus","gridSnapping","modeling"],Te(Zu,de),Zu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=SN(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function wN(e){return e.length>3}function _N(e){return e==="h"}function EN(e){return e==="v"}function SN(e,t,n){var i=yo(t,n),o={};return _N(i)&&(o.y=e.snapValue(t.y)),EN(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=U({},t,o),n=U({},n,o)),[t,n]}const RN={__depends__:[mN,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",iE],gridSnappingParticipantBehavior:["type",oE],gridSnappingLayoutConnectionBehavior:["type",Zu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",J0]};var CN=30,rE=30;function fc(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var o=i.element,r=i.gfx;if(A(o,"bpmn:Lane"))return n._createParticipantHit(o,r);if(A(o,"bpmn:Participant"))return ut(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(A(o,"bpmn:SubProcess"))return ut(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}fc.$inject=["eventBus","interactionEvents"],fc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},fc.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=xn(e)?{width:CN,height:e.height}:{width:e.width,height:rE};return this._interactionEvents.createBoxHit(t,"all",n),!0},fc.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:rE}),!0};const MN={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",fc]};function Qu(e){e.invoke(Fa,this)}Te(Qu,Fa),Qu.$inject=["injector"],Qu.prototype.registerBindings=function(e,t){Fa.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 AN={__depends__:[Lh],__init__:["keyboardBindings"],keyboardBindings:["type",Qu]};var PN={moveSpeed:1,moveSpeedAccelerated:10},TN=1500,aE="left",sE="up",cE="right",lE="down",kN={ArrowLeft:aE,Left:aE,ArrowUp:sE,Up:sE,ArrowRight:cE,Right:cE,ArrowDown:lE,Down:lE},ON={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 uE(e,t,n,i,o){var r=this;this._config=U({},PN,e||{}),t.addListener(TN,function(a){var s=a.keyEvent,c=kN[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=ON[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}uE.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const DN={__depends__:[Lh,Ci],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",uE]};var pE=10;function dc(e,t,n,i){this._dragging=i,this._rules=t;var o=this;function r(c,l){var u=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=l,d=v2(u,p,l),c.newBounds=x2(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:ze(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=mv(p),!LN(l,p))return;n.resizeShape(l,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var l={x:c.dx,y:c.dy};r(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}dc.prototype.canResize=function(e){var t=this._rules,n=Bi(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},dc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=U({shape:t},n),r=o.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,fE(t,r),"resize",{autoActivate:!0,cursor:IN(r),data:{shape:t,context:o}})},dc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:pE,height:pE},o=ib(t,e.childrenBoxPadding),w2(n,t,i,o)},dc.$inject=["eventBus","rules","modeling","dragging"];function LN(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function fE(e,t){var n=qe(e),i=ze(e),o={x:n.x,y:n.y};return t.indexOf("n")!==-1?o.y=i.top:t.indexOf("s")!==-1&&(o.y=i.bottom),t.indexOf("e")!==-1?o.x=i.right:t.indexOf("w")!==-1&&(o.x=i.left),o}function IN(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 dE="djs-resizing",hE="resize-not-ok",BN=500;function gE(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,dE)),s.width>5&&Ce(c,{x:s.x,width:s.width}),s.height>5&&Ce(c,{y:s.y,height:s.height}),r.canExecute?lt(c).remove(hE):lt(c).add(hE)}function o(r){var a=r.shape,s=r.frame;s&&on(r.frame),t.removeMarker(a,dE)}e.on("resize.move",BN,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}gE.$inject=["eventBus","canvas","previewSupport"];var Ju=-6,ep=8,tp=20,hc="djs-resizer",NN=["n","w","s","e","nw","ne","se","sw"];function fr(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&&G(a,Yn(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}fr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){er(r)&&i.activate(r,e,n)}$e.bind(t,"mousedown",o),$e.bind(t,"touchstart",o)},fr.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=$N(i),a=Be("g");lt(a).add(hc),lt(a).add(hc+"-"+e.id),lt(a).add(hc+"-"+i),Ke(o,a);var s=Be("rect");Ce(s,{x:-ep/2+r.x,y:-ep/2+r.y,width:ep,height:ep}),lt(s).add(hc+"-visual"),Ke(a,s);var c=Be("rect");return Ce(c,{x:-tp/2+r.x,y:-tp/2+r.y,width:tp,height:tp}),lt(c).add(hc+"-hit"),Ke(a,c),dl(a,t,n),a},fr.prototype.createResizer=function(e,t){var n=fE(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},fr.prototype.addResizer=function(e){var t=this;kt(e)||G(NN,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},fr.prototype.removeResizers=function(){var e=this._getResizersParent();ms(e)},fr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},fr.$inject=["eventBus","canvas","selection","resize"];function $N(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Ju:e.indexOf("w")!==-1&&(t.x=Ju),e.indexOf("s")!==-1?t.y=-Ju:e.indexOf("n")!==-1&&(t.y=Ju),t}const mE={__depends__:[no,Eo,Ia],__init__:["resize","resizePreview","resizeHandles"],resize:["type",dc],resizePreview:["type",gE],resizeHandles:["type",fr]};var FN=2e3;function gc(e,t,n,i,o,r,a){this._bpmnFactory=t,this._canvas=n,this._modeling=o,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],FN,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){r.removeResizers()}),e.on("create.end",500,function(c){var l=c.context,u=l.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||it(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}gc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],gc.prototype.activate=function(e){var t=mi(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);U(n,i);var o={},r=n.style||{};return U(r,{backgroundColor:null,border:null}),(it(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||yE(e))&&U(o,{centerVertically:!0}),Xo(e)&&(U(o,{resizable:!0,autoResize:!0}),U(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),A(e,"bpmn:TextAnnotation")&&(U(o,{resizable:!0,autoResize:!0}),U(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),U(n,{options:o,style:r}),n}},gc.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(A(e,"bpmn:Lane")||zN(e)){var m=xn(e),h=m?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:o.y-30*a/2}:{width:i.width,height:30*a};U(r,h),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(HN(e)){var g=xn(e),w=g?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:o.x-i.height/2,y:o.y-i.width/2};U(r,w),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(it(e,["bpmn:Task","bpmn:CallActivity"])||yE(e))&&(U(r,{width:i.width,height:i.height}),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),jN(e)&&(U(r,{width:i.width,x:i.x}),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var x=1,y=i.width+2*x;if(n.labelTarget&&(U(r,{width:y,height:i.height+2*x,x:i.x-x,y:i.y-x}),U(d,{fontSize:l+"px",lineHeight:u})),Xo(n)&&!ml(n)&&!nt(n)){var v=Gf(e),S=t.getAbsoluteBBox({x:v.x,y:v.y,width:0,height:0}),_=l,T=Or.width*a+2*x;U(r,{width:T,height:_+2*x,x:S.x-T/2,y:S.y-_/2-x}),U(d,{fontSize:l+"px",lineHeight:u})}return A(e,"bpmn:TextAnnotation")&&(U(r,{width:i.width+2*x,height:i.height+2*x,x:i.x-x,y:i.y-x,minWidth:30*a,minHeight:10*a}),U(d,{textAlign:"left",paddingTop:Ea*a+"px",paddingBottom:Ea*a+"px",paddingLeft:Ea*a+"px",paddingRight:Ea*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:r,style:d}},gc.prototype.update=function(e,t,n,i){var o,r;A(e,"bpmn:TextAnnotation")&&(r=this._canvas.getAbsoluteBBox(e),o={x:e.x,y:e.y,width:e.width/r.width*i.width,height:e.height/r.height*i.height}),GN(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function yE(e){return A(e,"bpmn:SubProcess")&&!ut(e)}function jN(e){return A(e,"bpmn:SubProcess")&&ut(e)}function HN(e){return A(e,"bpmn:Participant")&&!ut(e)}function zN(e){return A(e,"bpmn:Participant")&&ut(e)}function GN(e){return!e||!e.trim()}var vE="djs-element-hidden",bE="djs-label-hidden";function xE(e,t,n){var i=this,o=t.getDefaultLayer(),r,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(r=l.element.label||l.element,A(r,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(r),s=Be("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=Be("path");Ce(p,{d:u,strokeWidth:2,stroke:VN(r)}),Ke(s,p),Ke(o,s),Pn(s,r.x,r.y)}A(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,vE):(A(r,"bpmn:Task")||A(r,"bpmn:CallActivity")||A(r,"bpmn:SubProcess")||A(r,"bpmn:Participant")||A(r,"bpmn:Lane"))&&t.addMarker(r,bE)}),e.on("directEditing.resize",function(c){if(A(r,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(r.height/a.height*(l+u),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:p,position:{mx:0,my:0}});Ce(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,vE),t.removeMarker(r,bE)),r=void 0,a=void 0,s&&(on(s),s=void 0)})}xE.$inject=["eventBus","canvas","pathMap"];function VN(e,t){var n=gt(e);return n.get("stroke")||t||"black"}const WN={__depends__:[sh,mE,W0],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",gc],labelEditingPreview:["type",xE]};var UN=500,qN=1e3;function ro(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function o(r){xP(r)||i.createOutline(r)}e.on("element.hover",function(r){o(r.element)}),e.on("selection.changed",function(r){G(r.newSelection,o)}),e.on(["shape.changed","connection.changed"],UN,function(r){var a=r.element,s=r.gfx,c=Rt(".djs-outline",s);c&&i.updateOutline(a,c)})}ro.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Rt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Ke(t,n),this.updateOutline(e,n)),n},ro.prototype._createOutlineGfx=function(){var e=Be("rect");return Ce(e,U({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},ro.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},ro.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&G(i,function(o){n=n||o.updateOutline(t,e)}),n||Ce(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},ro.prototype.updateConnectionOutline=function(e,t){var n=rn(t);Ce(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},ro.prototype.registerProvider=function(e,t){t||(t=e,e=qN),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},ro.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},ro.prototype.getOutline=function(e){var t,n=this._getProviders();return G(n,function(i){bn(i.getOutline)&&(t=t||i.getOutline(e))}),t},ro.$inject=["eventBus","styles","elementRegistry"];var np=6;function sg(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)})}sg.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");ms(t);var n=e.length>1,i=this._canvas.getContainer();if(lt(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=YN(rn(e)),r=Be("rect");Ce(r,U({rx:3},o)),lt(r).add("djs-selection-outline"),Ke(t,r)}},sg.$inject=["eventBus","canvas","selection"];function YN(e){return{x:e.x-np,y:e.y-np,width:e.width+np*2,height:e.height+np*2}}const cg={__depends__:[Ci],__init__:["outline","multiSelectionOutline"],outline:["type",ro],multiSelectionOutline:["type",sg]},wE=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],_E={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},KN=15,ip=2;function EE(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(m=>it(m,wE));if(f.length===1){const m=f[0];nt(m)?a(m,m.labelTarget):(d=m.labels)!=null&&d.length&&a(m.labels[0],m)}if(f.length===2){const m=f.find(nt),h=f.find(g=>{var w;return(w=g.labels)==null?void 0:w.includes(m)});m&&h&&a(m,h)}}),e.on("shape.changed",function({element:p}){var f;!it(p,wE)||!u(p)||(nt(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=bs([qe(f),qe(p)],_E),m=d.getAttribute("d"),g=o.isSelected(p)?c(p):l(p),w=Es(g,m);if(!w)return;const y=o.isSelected(f)?c(f):l(f),v=Es(y,m)||qe(f);Ds(v,w)<KN||(If(d,[v,w]),Ke(r,d))}function s(){gs(`.${_E.class}`,r).forEach(on)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+dr(f,"x")-ip,y:p.y+dr(f,"y")-ip,width:dr(f,"width")+ip*2,height:dr(f,"height")+ip*2};return Wf(d,dr(f,"rx"))}if(f.cx){const d=dr(f,"r"),m={x:p.x+dr(f,"cx")-d,y:p.y+dr(f,"cy")-d,width:d*2,height:d*2};return jv(m)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}EE.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function dr(e,t){return parseFloat(Ce(e,t)||0)}const XN={__depends__:[Ci,cg],__init__:["labelLink"],labelLink:["type",EE]};var ZN=new Nr("tt");function QN(e){var t=$t('<div class="djs-tooltip-container" />');return Gn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function JN(e,t,n){Gn(e,{left:t+"px",top:n+"px"})}function lg(e,t){e.style.display=t===!1?"none":""}var SE="djs-tooltip",ug="."+SE;function Xn(e,t){this._eventBus=e,this._canvas=t,this._ids=ZN,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=QN(t.getContainer());var n=this;ti.bind(this._tooltipRoot,ug,"mousedown",function(i){i.stopPropagation()}),ti.bind(this._tooltipRoot,ug,"mouseover",function(i){n.trigger("mouseover",i)}),ti.bind(this._tooltipRoot,ug,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Xn.$inject=["eventBus","canvas"],Xn.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=U({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Xn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(En(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Xn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Xn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Xn.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)}},Xn.prototype.remove=function(e){var t=this.get(e);t&&(Xi(t.html),Xi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Xn.prototype.show=function(){lg(this._tooltipRoot)},Xn.prototype.hide=function(){lg(this._tooltipRoot,!1)},Xn.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},Xn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,o=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),Qn(n)&&(n=$t(n)),i=$t('<div data-tooltip-id="'+t+'" class="'+SE+'">'),Gn(i,{position:"absolute"}),i.appendChild(n),e.type&&Ct(i).add("djs-tooltip-"+e.type),e.className&&Ct(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Xn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;JN(n,t.x,t.y)},Xn.prototype._updateTooltipVisibilty=function(e){G(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),lg(i,o))})},Xn.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",Xn]};var t$="flow elements must be children of pools/participants",n$="Data object must be placed within a pool/participant.";function RE(e,t,n){function i(o,r,a){t.add({position:{x:o.x+5,y:o.y+5},type:"error",timeout:2e3,html:"<div>"+r+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(o){var r=o.context,a=r.shape,s=r.target;A(s,"bpmn:Collaboration")&&(A(a,"bpmn:FlowNode")?i(o,n(t$)):A(a,"bpmn:DataObjectReference")&&i(o,n(n$)))})}RE.$inject=["eventBus","tooltips","translate"];const i$={__depends__:[e$],__init__:["modelingFeedback"],modelingFeedback:["type",RE]};var o$=500,r$=1250,a$=1500,op=Math.round;function s$(e){return{x:e.x+op(e.width/2),y:e.y+op(e.height/2)}}function CE(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",a$,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=c$(u),U(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",o$,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=op(l.x),l.y=op(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(er(s)){var c=ka(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(gn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!lt(s.target).has("djs-hit-no-move")){var p=s$(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}CE.$inject=["eventBus","dragging","modeling","selection","rules"];function c$(e){var t=ra(e,"id");return rt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var ME=499,pg="djs-dragging",AE="drop-ok",PE="drop-not-ok",TE="new-parent",kE="attach-ok";function OE(e,t,n,i){function o(c){var l=r(c),u=l$(l);return u}function r(c){var l=xs(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[kE,AE,PE,TE].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,pg),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",ME,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,f=o(u);if(!l.dragGroup){var d=Be("g");Ce(d,n.cls("djs-drag-group",["no-events"]));var m=t.getActiveLayer();Ke(m,d),l.dragGroup=d}f.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=Sp([p,r(u)]):p=r(u),G(p,function(h){t.addMarker(h,pg)}),l.allDraggedElements=p,l.differentParents=u$(u)}),e.on("shape.move.move",ME,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,kE):l.canExecute&&f&&p.id!==f.id?a(p,TE):a(p,l.canExecute?AE:PE)),Pn(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;G(u,function(f){t.removeMarker(f,pg)}),p&&on(p)}),this.makeDraggable=s}OE.$inject=["eventBus","canvas","styles","previewSupport"];function l$(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=rt(e,function(i){return kt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function u$(e){return fS(ra(e,function(t){return t.parent&&t.parent.id}))!==1}const p$={__depends__:[ql,Ci,cg,no,Eo,Ia],__init__:["move","movePreview"],move:["type",CE],movePreview:["type",OE]};var DE=".djs-palette-toggle",LE=".entry",f$=DE+", "+LE,fg="djs-palette-",d$="shown",dg="open",IE="two-column",h$=1e3;function un(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()})}un.$inject=["eventBus","canvas"],un.prototype.registerProvider=function(e,t){t||(t=e,e=h$),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},un.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(m$,{})},un.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},un.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=$t(un.HTML_MARKUP);n.appendChild(i),Ct(n).add(fg+d$),ti.bind(i,f$,"click",function(o){var r=o.delegateTarget;if(Rf(r,DE))return e.toggle();e.trigger("click",o)}),$e.bind(i,"mousedown",function(o){o.stopPropagation()}),ti.bind(i,LE,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},un.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},un.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=Ct(n),a=Ct(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(IE,o),a.toggle(fg+IE,o),"open"in e&&(r.toggle(dg,e.open),a.toggle(fg+dg,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},un.prototype._update=function(){var e=Rt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();il(e),G(t,function(n,i){var o=n.group||"default",r=Rt("[data-group="+Hr(o)+"]",e);r||(r=$t('<div class="group"></div>'),En(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=$t(a);if(r.appendChild(s),!n.separator&&(En(s,"data-action",i),n.title&&En(s,"title",n.title),n.className&&g$(s,n.className),n.imageUrl)){var c=$t("<img>");En(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},un.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=En(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},un.prototype.triggerEntry=function(e,t,n,i){var o=this._entries,r,a;if(r=o[e],!!r&&(a=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:n})!==!1)){if(bn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},un.prototype._layoutChanged=function(){this._toggleState({})},un.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},un.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},un.prototype.open=function(){this._toggleState({open:!0})},un.prototype.toggle=function(){this.isOpen()?this.close():this.open()},un.prototype.isActiveTool=function(e){return e&&this._activeTool===e},un.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Rt(".djs-palette-entries",this._container),this._toolsContainer=Rt("[data-group=tools]",t)),n=this._toolsContainer,G(n.children,function(i){var o=i.getAttribute("data-action");if(o){var r=Ct(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},un.prototype.isOpen=function(){return Ct(this._container).has(dg)},un.prototype._getParentContainer=function(){return this._canvas.getContainer()},un.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function g$(e,t){var n=Ct(e),i=We(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function m$(e,t){var n=t.getPaletteEntries();return bn(n)?n(e):(G(n,function(i,o){e[o]=i}),e)}const y$={__init__:["palette"],palette:["type",un]};var BE="crosshair",NE="selected",v$="djs-dragging-active-lasso";function hr(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=Be("rect");Ce(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Ke(f,d),l(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&Ce(f,{x:d.x,y:d.y,width:d.width,height:d.height});var m=p.marked,h=p.lastMarked;if(m&&h){for(const g of h)m.has(g)||t.removeMarker(g,NE);for(const g of m)h.has(g)||t.addMarker(g,NE)}},remove:function(p){this.update(p),p.frame&&on(p.frame),l(!1)}};function l(p){lt(t.getContainer()).toggle(v$,p)}function u(p){var f=i.getAll();return new Set(oa(va(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=$E(p),f.add=jl(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=$E(p),m=u(d),h=f.initialMarked.union(m);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(jl(p))return s.activateLasso(p.originalEvent),!0})}hr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],hr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:BE,data:{context:{}},keepSelection:!0})},hr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:BE,data:{context:{}},keepSelection:!0})},hr.prototype._select=function(e){this._selection.select(e)},hr.prototype.select=function(e,t,n=[]){var i=oa(va(e,t));this._select([...n,...i])},hr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},hr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function $E(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 b$={__depends__:[Zl,Fs],__init__:["lassoTool"],lassoTool:["type",hr]};var hg=1500,FE="grab";function qa(e,t,n,i,o,r){this._dragging=n,this._mouse=r;var a=this,s=i.get("keyboard",!1);o.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",hg,function(c){if(Bs(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(hg,function(c){if(!(!jE(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(hg,function(c){!jE(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!Bs(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}qa.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],qa.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:FE,data:{context:n||{}}})},qa.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:FE,data:{context:{reactivate:n}}})},qa.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},qa.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function jE(e){return yn("Space",e)}const x$={__depends__:[Zl,Fs],__init__:["handTool"],handTool:["type",qa]};var HE="connect-ok",zE="connect-not-ok";function Ya(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?HE:zE))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?HE:zE)}),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})}Ya.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Ya.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Ya.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Ya.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Ya.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const w$={__depends__:[ig,no,Eo,Zl,Fs],globalConnect:["type",Ya]};function gg(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)}gg.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],gg.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,m,h){function g(w){var x=n.createShape(U({type:p},h));t.start(w,x)}return{group:f,className:d,title:m,action:{dragstart:g,click:g}}}function l(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function u(p){t.start(p,n.createParticipantShape())}return U(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){r.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){o.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:l,click:l}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:u,click:u}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const _$={__depends__:[y$,Kl,ow,b$,x$,w$,Ps],__init__:["paletteProvider"],paletteProvider:["type",gg]};var E$=250;function mg(e,t,n,i,o){de.call(this,e);function r(s){var c=s.canExecute.replacements;G(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);U(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var m=Rt('[data-element-id="'+Hr(f.id)+'"]',s.dragGroup);m&&Ce(m,{display:"none"});var h=o.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;G(c,function(l,u){var p=Rt('[data-element-id="'+Hr(u)+'"]',s.dragGroup);p&&Ce(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",E$,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}mg.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Te(mg,de);const S$={__depends__:[Ia],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",mg]};var R$=1250,yg=40,C$=20,M$=10,GE=20,VE=["x","y"],A$=Math.abs;function WE(e){e.on(["connect.hover","connect.move","connect.end"],R$,function(t){var n=t.context,i=n.canExecute,o=n.start,r=n.hover,a=n.source,s=n.target;t.originalEvent&&oi(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&r&&P$(t,r,D$(r)),r&&O$(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Pi(o),it(r,["bpmn:Event","bpmn:Gateway"])&&UE(t,Pi(r)),it(r,["bpmn:Task","bpmn:SubProcess"])&&T$(t,r),A(a,"bpmn:BoundaryEvent")&&s===a.host&&k$(t)):qE(i,"bpmn:MessageFlow")?(A(o,"bpmn:Event")&&(n.connectionStart=Pi(o)),A(r,"bpmn:Event")&&UE(t,Pi(r))):n.connectionStart=n.initialConnectionStart)})}WE.$inject=["eventBus"];function P$(e,t,n){VE.forEach(function(i){var o=YE(i,t);e[i]<t[i]+n?ln(e,i,t[i]+n):e[i]>t[i]+o-n&&ln(e,i,t[i]+o-n)})}function T$(e,t){var n=Pi(t);VE.forEach(function(i){L$(e,t,i)&&ln(e,i,n[i])})}function k$(e){var t=e.context,n=t.source,i=t.target;if(!I$(t)){var o=Pi(n),r=An(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;A$(c-o[s])<yg&&(c>o[s]?l=o[s]+yg:l=o[s]-yg,ln(e,s,l))})}}function UE(e,t){ln(e,"x",t.x),ln(e,"y",t.y)}function qE(e,t){return e&&e.type===t}function O$(e,t){return Io(t,function(n){return qE(e,n)})}function YE(e,t){return e==="x"?t.width:t.height}function D$(e){return A(e,"bpmn:Task")?M$:C$}function L$(e,t,n){return e[n]>t[n]+GE&&e[n]<t[n]+YE(n,t)-GE}function I$(e){var t=e.hover,n=e.source;return t&&n&&t===n}function gr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}gr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},gr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},gr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},gr.prototype.getSnapLocations=function(){return this._snapLocations},gr.prototype.setSnapLocations=function(e){this._snapLocations=e},gr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new rp,n.initDefaults(this._defaultSnaps)),n};function rp(){this._snapValues={}}rp.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},rp.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&EB(e[n],o[n],i)},rp.prototype.initDefaults=function(e){var t=this;G(e||{},function(n,i){G(n,function(o){t.add(i,o)})})};var B$=1250;function ao(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(o){i.initSnap(o)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],B$,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&oi(o.originalEvent))&&!(Ua(o)||!c)){var l=s.pointsForTarget(c);l.initialized||(l=i.addSnapTargetPoints(l,a,c),l.initialized=!0),n.snap(o,l)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}ao.$inject=["elementRegistry","eventBus","snapping"],ao.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new gr);var r;t.get(i.id)?r=Pi(i,e):r={x:e.x+Pi(i).x,y:e.y+Pi(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}),nt(i)||(o.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),o.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),o},ao.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return G(i,function(o){if(nt(o)){nt(t)&&e.add("mid",Pi(o));return}if(kt(o)){if(o.waypoints.length<3)return;var r=o.waypoints.slice(1,-1);G(r,function(a){e.add("mid",a)});return}e.add("mid",Pi(o))}),!Ue(t.x)||!Ue(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Pi(t)),e},ao.prototype.getSnapTargets=function(e,t){return L0(t).filter(function(n){return!N$(n)})};function N$(e){return!!e.hidden}var KE=1500;function Ka(e,t){t.invoke(ao,this),e.on(["create.move","create.end"],KE,H$),e.on(["create.move","create.end","shape.move.move","shape.move.end"],KE,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!Ua(n)&&$$(n,r)})}Te(Ka,ao),Ka.$inject=["eventBus","injector"],Ka.prototype.initSnap=function(e){var t=ao.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return G(n.outgoing,function(o){var r=o.waypoints[0];r=r.original||r,t.setSnapOrigin(o.id+"-docking",ZE(r,i,e))}),G(n.incoming,function(o){var r=o.waypoints[o.waypoints.length-1];r=r.original||r,t.setSnapOrigin(o.id+"-docking",ZE(r,i,e))}),A(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ka.prototype.addSnapTargetPoints=function(e,t,n){ao.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);G(i,function(r){(j$(r)||F$([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",O0(r)),e.add("bottom-right",D0(r)))});var o=this._elementRegistry;return G(t.incoming,function(r){if(o.get(t.id)){XE(i,r.source)||e.add("mid",qe(r.source));var a=r.waypoints[0];e.add(r.id+"-docking",a.original||a)}}),G(t.outgoing,function(r){if(o.get(t.id)){XE(i,r.target)||e.add("mid",qe(r.target));var a=r.waypoints[r.waypoints.length-1];e.add(r.id+"-docking",a.original||a)}}),A(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Ka.prototype.getSnapTargets=function(e,t){return ao.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!A(n,"bpmn:Lane")})};function $$(e,t){var n=ze(t),i=ex(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=qe(r),/top/.test(i)?ln(e,"y",n.top-a.y):/bottom/.test(i)&&ln(e,"y",n.bottom-a.y),/left/.test(i)?ln(e,"x",n.left-a.x):/right/.test(i)&&ln(e,"x",n.right-a.x)}function F$(e,t){return e.every(function(n){return A(n,t)})}function j$(e){return A(e,"bpmn:SubProcess")&&ut(e)?!0:A(e,"bpmn:Participant")}function H$(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,o=n.right,r=n.bottom,a=n.left;(a&&a>=e.x||o&&o<=e.x)&&ln(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&ln(e,"y",e.y)}}function XE(e,t){return e.indexOf(t)!==-1}function ZE(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var z$=1250;function mc(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],z$,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&oi(i.originalEvent))&&!Ua(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),W$(s)&&ln(i,"x",i.x),U$(s)&&ln(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}mc.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new gr);var r=QE(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},mc.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return G(o,function(r){e.add("corner",D0(r)),e.add("corner",O0(r))}),e.add("corner",QE(t,i)),e},mc.$inject=["eventBus","snapping"],mc.prototype.getSnapTargets=function(e,t){return L0(t).filter(function(n){return!G$(n,e)&&!kt(n)&&!V$(n)&&!nt(n)})};function QE(e,t){var n=qe(e),i=ze(e),o={x:n.x,y:n.y};return t.indexOf("n")!==-1?o.y=i.top:t.indexOf("s")!==-1&&(o.y=i.bottom),t.indexOf("e")!==-1?o.x=i.right:t.indexOf("w")!==-1&&(o.x=i.left),o}function G$(e,t){return e.host===t}function V$(e){return!!e.hidden}function W$(e){return e==="n"||e==="s"}function U$(e){return e==="e"||e==="w"}var q$=7,Y$=1e3;function mr(e){this._canvas=e,this._asyncHide=Cp(Yn(this.hide,this),Y$)}mr.$inject=["canvas"],mr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:Ua(e,"x"),y:Ua(e,"y")};G(o,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(G(["x","y"],function(l){var u;r[l]||(u=t.snap(c,a,l,q$),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),G(["x","y"],function(a){var s=r[a];gn(s)&&ln(e,a,s.originValue)})},mr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Be("path");return Ce(n,{d:"M0,0 L0,0"}),lt(n).add("djs-snap-line"),Ke(t,n),{update:function(i){Ue(i)?e==="horizontal"?Ce(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Ce(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Ce(n,{display:"none"})}}},mr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},mr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},mr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},mr.prototype.hide=function(){G(this._snapLines,function(e){e.update()})};const K$={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",ao],resizeSnapping:["type",mc],snapping:["type",mr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",WE],createMoveSnapping:["type",Ka]};var JE=300;function Je(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=Rt(Je.INPUT_SELECTOR,this._container),this._resultsContainer=Rt(Je.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Je.$inject=["canvas","eventBus","selection","translate"],Je.prototype._bindEvents=function(){var e=this;function t(n,i,o,r){e._eventMaps.push({el:n,type:o,listener:ti.bind(n,i,o,r)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Je.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Je.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Je.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Je.INPUT_SELECTOR,"keydown",function(n){yn("ArrowUp",n)&&n.preventDefault(),yn("ArrowDown",n)&&n.preventDefault()}),t(this._container,Je.INPUT_SELECTOR,"keyup",function(n){if(yn("Escape",n))return e.close();if(yn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(yn("ArrowUp",n))return e._scrollToDirection(!0);if(yn("ArrowDown",n))return e._scrollToDirection();yn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Je.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ti.unbind(e.el,e.type,e.listener)})},Je.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=Rt(Je.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Je.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Je.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)}},Je.prototype._clearResults=function(){il(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Je.prototype._getCurrentResult=function(){return Rt(Je.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Je.prototype._createResultNode=function(e,t){var n=$t(Je.RESULT_HTML);return e.primaryTokens.length>0&&e1(n,e.primaryTokens,Je.RESULT_PRIMARY_HTML),e1(n,e.secondaryTokens,Je.RESULT_SECONDARY_HTML),En(n,Je.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Je.prototype.registerProvider=function(e){this._searchProvider=e},Je.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,Ct(this._canvas.getContainer()).add("djs-search-open"),Ct(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Je.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,Ct(this._canvas.getContainer()).remove("djs-search-open"),Ct(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Je.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Je.prototype.isOpen=function(){return this._open},Je.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Ct(t).remove(Je.RESULT_SELECTED_CLASS);var n=En(e,Je.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Ct(e).add(Je.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:JE}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Je.prototype._select=function(e){var t=En(e,Je.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:JE}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Je.prototype._getBoxHtml=function(){const e=$t(Je.BOX_HTML),t=Rt(Je.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function e1(e,t,n){var i=X$(t),o=$t(n);o.innerHTML=i,e.appendChild(o)}function X$(e){var t="";return e.forEach(function(n){var i=c_(n.value||n.matched||n.normal),o=n.match||n.matched;o?t+='<b class="'+Je.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Je.CONTAINER_SELECTOR=".djs-search-container",Je.INPUT_SELECTOR=".djs-search-input input",Je.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Je.RESULT_SELECTOR=".djs-search-result",Je.RESULT_SELECTED_CLASS="djs-search-result-selected",Je.RESULT_SELECTED_SELECTOR="."+Je.RESULT_SELECTED_CLASS,Je.RESULT_ID_ATTRIBUTE="data-result-id",Je.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Je.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>`,Qe.RESULT_HTML='<div class="djs-search-result"></div>',Qe.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Qe.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const V$={__depends__:[Ps,_u,Ri],searchPad:["type",Qe]};function mg(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}mg.$inject=["elementRegistry","searchPad","canvas","search"],mg.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!it(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:yi(i),id:i.id})),e,{keys:["label","id"]}).map(W$)};function W$(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const U$={__depends__:[V$,a0],__init__:["bpmnSearch"],bpmnSearch:["type",mg]},q$="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",Y$="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",K$={width:36,height:50},X$={width:50,height:50};function KE(e,t,n){return Be("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ki=5;function ap(e,t){this._styles=t,e.registerProvider(this)}ap.$inject=["outline","styles"],ap.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(lT(e))return n=Be("rect"),Se(n,V({x:-ki,y:-ki,rx:4,width:e.width+ki*2,height:e.height+ki*2},t)),n;if(!it(e))return M(e,"bpmn:Gateway")?(n=Be("rect"),V(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Se(n,V({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):ot(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Be("rect"),Se(n,V({x:-ki,y:-ki,rx:14,width:e.width+ki*2,height:e.height+ki*2},t))):M(e,"bpmn:EndEvent")?(n=Be("circle"),Se(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+ki+1},t))):M(e,"bpmn:Event")?(n=Be("circle"),Se(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+ki},t))):M(e,"bpmn:DataObjectReference")&&XE(e,"bpmn:DataObjectReference")?n=KE(q$,{x:-6,y:-6},t):M(e,"bpmn:DataStoreReference")&&XE(e,"bpmn:DataStoreReference")&&(n=KE(Y$,{x:-6,y:-6},t)),n},ap.prototype.updateOutline=function(e,t){if(!it(e))return ot(e,["bpmn:SubProcess","bpmn:Group"])?(Se(t,{width:e.width+ki*2,height:e.height+ki*2}),!0):!!ot(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function XE(e,t){var n;return t==="bpmn:DataObjectReference"?n=K$:t==="bpmn:DataStoreReference"&&(n=X$),e.width===n.width&&e.height===n.height}const Z$={__depends__:[ag],__init__:["outlineProvider"],outlineProvider:["type",ap]};var Q$='<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>';function so(e){va.call(this,e)}Me(so,va),so.Viewer=lr,so.NavigatedViewer=tc,so.prototype.createDiagram=function(){return this.importXML(Q$)},so.prototype._interactionModules=[lw,pw,hw],so.prototype._modelingModules=[eB,yu,rB,iB,vB,tg,SB,KB,Hx,Kl,JB,nN,vN,xN,_N,CN,$N,GN,wh,XN,o$,g$,y$,uE,z$,U$,Z$],so.prototype._modules=[].concat(lr.prototype._modules,so.prototype._interactionModules,so.prototype._modelingModules);var sp=50,J$=new Ir,ZE={min:.2,max:4},e5=10,t5=.1,n5=250,i5=100,o5=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=J$.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||lp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=cp({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);yg(p,r._canvas),r._update()}function s(u){return function(f){var d=vg(f);(!r._state._svgClientRect||lp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(d);var g=cp({x:d.x-r._state._svgClientRect.left,y:d.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),h=i.viewbox(),m=a5(g,h),_=r._viewportDom.getBoundingClientRect(),x={x:d.x-_.left+1,y:d.y-_.top+1};V(r._state,{cachedViewbox:h,initialDragPosition:{x:d.x,y:d.y},isDragging:!0,offsetViewport:m,offsetViewportDom:x,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),Fe.bind(document,"mousemove",c),Fe.bind(document,"mouseup",l)}}function c(u){var p=vg(u);if(r._state.isDragging){(!r._state._svgClientRect||lp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var f=r._state.offsetViewportDom,d=r._state.viewportClientRect,g=r._state.parentClientRect;V(r._viewportDom.style,{top:p.y-f.y-g.top+"px",left:p.x-f.x-g.left+"px"});var h=JE(g,{top:p.y-f.y-g.top,left:p.x-f.x-g.left,width:d.width,height:d.height});V(r._overlay.style,{clipPath:h});var m=cp({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);yg({x:m.x-r._state.offsetViewport.x,y:m.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=vg(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),V(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),Fe.unbind(document,"mousemove",c),Fe.unbind(document,"mouseup",l))}Fe.bind(this._viewportDom,"mousedown",s(!1)),Fe.bind(this._svg,"mousedown",s(!0)),Fe.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||lp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!p5(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)>t5){var d=f>0?1:-1,g=Math.log(i.zoom())/Math.log(10),h=d5(ZE,e5*2),m=Math.round(g/h)*h;m+=h*d;var _=Math.pow(10,m);i.zoom(h5(ZE,_),x),r._state.zoomDelta=0;var x=cp({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);yg(x,r._canvas),r._update()}}}),Fe.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",n5,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");Rt(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");Rt(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");Rt(o).add("map"),n.appendChild(o);var r=this._svg=Be("svg");Se(r,{width:"100%",height:"100%"}),Ke(o,r);var a=this._elementsGroup=Be("g");Ke(r,a);var s=this._viewportGroup=Be("g");Ke(r,s);var c=this._viewport=Be("rect");lt(c).add("viewport"),Ke(s,c),Fe.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");Rt(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");Rt(u).add("overlay"),this._parent.appendChild(u)},Bn.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=Ue(this._config.debounceDelay)?this._config.debounceDelay:i5,n=Ue(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:o5,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-sp,o=o-sp,r=r+sp*2,a=a+sp*2,this._lastViewbox={x:i,y:o,width:r,height:a},Se(this._svg,{viewBox:i+", "+o+", "+r+", "+a}),Se(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var l=this._state._parentClientRect=this._parent.getBoundingClientRect(),u=this._viewport.getBoundingClientRect(),p={top:u.top-l.top,left:u.left-l.left,width:u.width,height:u.height};V(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var f=JE(l,p);V(this._overlay.style,{clipPath:f})}}},Bn.prototype.open=function(){V(this._state,{isOpen:!0}),Rt(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};Sn(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(){V(this._state,{isOpen:!1}),Rt(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};Sn(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=Et("#"+Fr(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=Et("#"+Fr(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=c5(e);return s!==-1?a?l5(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),r5(e)?(n=e.parent,i=0,o=0,typeof n.x<"u"&&typeof n.y<"u"&&(i=-n.x,o=-n.y),Se(r,{transform:"translate("+i+" "+o+")"})):(i=e.x,o=e.y,a&&(n=e.parent,i-=n.x,o-=n.y),Se(r,{transform:"translate("+i+" "+o+")"})),e.children&&e.children.length&&e.children.forEach(function(c){t._addElement(c)}),r}}},Bn.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&rn(t)},Bn.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=Yo(t),n)){var i=g5(Rf(n));return Se(i,{id:this._prefixId(e.id)}),i}},Bn.prototype._clear=function(){ms(this._elementsGroup)},Bn.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function r5(e){return e.waypoints}function a5(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 cp(e,t,n){var i=t.getBoundingClientRect(),o=s5(n,i.width/i.height),r=QE(e.x,0,i.width,o.x,o.x+o.width),a=QE(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function yg(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 s5(e,t){var n=e.width/e.height,i=V({},{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;V(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;V(i,{x:s,width:a})}return i}function QE(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function c5(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function l5(e,t,n){var i=u5(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function u5(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function lp(e){return e.width===0&&e.height===0}function p5(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 d5(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 JE(e,t){var n=[co(t.left,t.top),co(t.left+t.width,t.top),co(t.left+t.width,t.top+t.height),co(t.left,t.top+t.height),co(t.left,e.height),co(e.width,e.height),co(e.width,0),co(0,0),co(0,e.height),co(t.left,e.height)].join(", ");return"polygon("+n+")"}function co(e,t){return e+"px "+t+"px"}function e1(e){return Lo(e,function(t){return hn(t)?e1(t):Ue(t)&&isFinite(t)})}function vg(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function g5(e){return gs("[id]",e).forEach(function(t){t.remove()}),e}var m5={__init__:["minimap"],minimap:["type",Bn]};const t1={closed:"미니맵",open:"접기"};class n1{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(Ph,()=>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?t1.open:t1.closed)}}zn(n1,"$inject",["eventBus","minimap","canvas"]);const y5={__depends__:[m5],__init__:["minimapI18n"],minimapI18n:["type",n1]},v5=ve.defineComponent({__name:"BpmnModelerView",props:{xml:{},labelFontFamily:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=ve.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=Wp(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 ve.onMounted(async()=>{a=new so({container:r.value,moddleExtensions:Ic,additionalModules:[J_,y5,z_],...i.labelFontFamily?{textRenderer:{defaultStyle:{fontFamily:i.labelFontFamily}}}:{}}),i.xml&&await s(i.xml),o("ready")}),ve.watch(()=>i.xml,l=>{l&&a&&s(l)}),ve.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(ve.openBlock(),ve.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),bg=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},b5=bg(v5,[["__scopeId","data-v-5f6ddcd2"]]),x5=["title","aria-expanded"],_5=["title","onClick"],w5={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},E5={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},S5={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},R5={key:0,class:"bwl-validation__body"},C5={key:0,class:"bwl-validation__empty"},M5={key:1,class:"bwl-validation__empty"},A5={key:2,class:"bwl-validation__list"},P5=["onClick"],T5={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},k5={class:"bwl-validation__msg"},O5=["title"],D5=bg(ve.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=ve.computed(()=>q_(n.issues.value,n.describeElement)),o=ve.computed(()=>Y_(i.value)),r=g=>Ia(g,n.changeScope.value),a=ve.computed(()=>Ah(i.value,n.changeScope.value)),s=ve.ref({error:!0,warning:!0,info:!0}),c=ve.computed(()=>K_(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=ve.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)=>(ve.openBlock(),ve.createElementBlock("section",{class:ve.normalizeClass(["bwl-validation",{"is-open":l.value}])},[ve.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=m=>l.value=!l.value)},[ve.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(ve.openBlock(),ve.createElementBlock("svg",{class:ve.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[ve.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=ve.createElementVNode("span",null,"검증",-1))],8,x5),ve.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=ve.withModifiers(()=>{},["stop"]))},[(ve.openBlock(),ve.createElementBlock(ve.Fragment,null,ve.renderList(u,m=>ve.createElementVNode("button",{key:m,type:"button",class:ve.normalizeClass(["bwl-validation__count",[`is-${m}`,{"is-off":!s.value[m]}]]),title:l.value?`${p[m]} ${s.value[m]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:_=>f(m)},[(ve.openBlock(),ve.createElementBlock("svg",w5,[h[4]||(h[4]=ve.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),m==="error"?(ve.openBlock(),ve.createElementBlock("path",E5)):(ve.openBlock(),ve.createElementBlock("path",S5))])),ve.createElementVNode("span",null,ve.toDisplayString(o.value[m]),1)],10,_5)),64))])]),l.value?(ve.openBlock(),ve.createElementBlock("div",R5,[i.value.length===0?(ve.openBlock(),ve.createElementBlock("p",C5,"발견된 문제가 없습니다.")):c.value.length===0?(ve.openBlock(),ve.createElementBlock("p",M5," 선택한 심각도에 해당하는 항목이 없습니다. ")):(ve.openBlock(),ve.createElementBlock("ul",A5,[(ve.openBlock(!0),ve.createElementBlock(ve.Fragment,null,ve.renderList(c.value,m=>(ve.openBlock(),ve.createElementBlock("li",{key:m.key,class:ve.normalizeClass(["bwl-validation__item",[`is-${m.severity}`,{"is-clickable":m.targetRefs.length>0}]]),onClick:_=>d(m)},[h[5]||(h[5]=ve.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(m)?(ve.openBlock(),ve.createElementBlock("span",T5,"이번 변경")):ve.createCommentVNode("",!0),ve.createElementVNode("span",k5,ve.toDisplayString(m.message),1),ve.createElementVNode("span",{class:"bwl-validation__cat",title:m.code},ve.toDisplayString(m.category),9,O5)],10,P5))),128))]))])):ve.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),L5={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},I5=["aria-checked","title","data-locale","onClick"],B5={class:"bwl-locale__label"},N5={key:0,class:"bwl-locale__badge"},$5=bg(ve.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=ve.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?(ve.openBlock(),ve.createElementBlock("div",L5,[(ve.openBlock(!0),ve.createElementBlock(ve.Fragment,null,ve.renderList(o.value,s=>(ve.openBlock(),ve.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:ve.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=>ve.unref(n).setDisplayLocale(s.locale)},[ve.createElementVNode("span",B5,ve.toDisplayString(s.label),1),s.pending>0?(ve.openBlock(),ve.createElementBlock("span",N5,ve.toDisplayString(s.pending),1)):ve.createCommentVNode("",!0)],10,I5))),128))])):ve.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);ee.ADDABLE_FLOW_NODE_TYPES=wc,ee.APPLY_BPMN_OPS_SCHEMA=AS,ee.BPMN_EVENT_DEFINITION_TYPES=Sc,ee.BPMN_MODDLE_EXTENSIONS=Ic,ee.BWL_MODDLE_SCHEMA=Og,ee.BWL_NS=kg,ee.BWL_PREFIX=bp,ee.BWL_REVIEW_REQUEST_TYPE=Cc,ee.BWL_SIDES=xp,ee.BpmnDisplayLocaleSwitcher=$5,ee.BpmnModelerView=b5,ee.BpmnValidationPanel=D5,ee.EDITOR=ZM,ee.FLOW_LABEL_INDENT=fm,ee.GROUP_BORDER_MIN_RUN=Up,ee.GROUP_BORDER_NEAR=la,ee.HEADLESS_BPMN_MODULES=G_,ee.HEADLESS_TEXT_METRICS=sa,ee.I18N_DISPLAY_REDRAWN_EVENT=Ph,ee.I18N_NS=uS,ee.I18N_PREFIX=Ng,ee.I18N_REVIEW_REQUESTED_CLASS=Z_,ee.I18N_TRANSLATION_TYPE=_r,ee.I18N_UNTRANSLATED_CLASS=X_,ee.I18nDisplay=Th,ee.I18nDisplayModule=J_,ee.IR_EVENT_DEFINITIONS=Ec,ee.IR_FLOW_NODE_TYPES=br,ee.IR_TEXT_LOCALES=Rc,ee.LABEL_FORK_MARGIN=Kp,ee.LABEL_SHAPE_MIN_DEPTH=Sm,ee.SET_TRANSLATIONS_COMMAND=Ap,ee.SEVERITY_ORDER=Mh,ee.SYMBOLIC_OP_KINDS=$g,ee.SYMBOLIC_OP_SCHEMA=Fg,ee.SetTranslationsHandler=Pp,ee.TranslationCommands=kp,ee.TranslationCommandsModule=Op,ee.TranslationStateIndex=oA,ee.UNDO_EPISODE_COMMAND=_p,ee.UPDATE_TRANSLATION_COMMAND=Pc,ee.UpdateTranslationHandler=Mp,ee.applyBpmnOpBatch=Cy,ee.applyBpmnOps=vy,ee.applyLocaleBackfill=iA,ee.applyTranslationLocaleRestore=lA,ee.approximateTextWidth=ca,ee.auditBpmnGeometry=Mm,ee.auditBpmnGeometryXml=SC,ee.auditBpmnSemantics=vf,ee.auditBpmnSemanticsXml=FM,ee.auditGeometry=pt,ee.auditTargetsOf=Vn,ee.axisSegmentsOf=on,ee.blackBoxNameRect=qp,ee.buildBpmnOpBatch=qM,ee.buildRegistryIndex=Pm,ee.collectTranslationStates=Dy,ee.containerBoundarySegments=pa,ee.countBySeverity=Y_,ee.createBpmnEditorController=QM,ee.createBpmnModdle=om,ee.createHeadlessBpmnModeler=TL,ee.crossedShapesOf=zt,ee.crossingCost=hi,ee.describeProcess=wy,ee.describeProcessXml=DM,ee.diffBpmnElements=Ry,ee.diffBpmnElementsXml=WM,ee.documentLocalesOf=is,ee.edgeCrossCount=ls,ee.edgeCrossingPairsOf=ho,ee.edgeCrossingStatsOf=bm,ee.executeAsUndoEpisode=Lg,ee.followMovedEdgeLabels=ty,ee.forwardThreePointCandidates=zc,ee.geometryFindingKey=ct,ee.inferScriptLocale=nl,ee.installHeadlessBpmnDom=am,ee.irEventDefinitionOf=vp,ee.isAddableFlowNodeType=Pg,ee.isChangeScopeMixed=Ah,ee.isEdgeOverlapFinding=Yp,ee.isInChangeScope=Ia,ee.isIrEventDefinition=Tg,ee.isIrFlowNodeType=Ag,ee.isIrTextLocale=eS,ee.labelRectsOf=Ho,ee.labelShapeDepth=Rm,ee.labelSlot=wr,ee.lineCrossesLabel=Bi,ee.lineThroughLabel=hm,ee.lineThroughShapeLabel=Em,ee.loadBpmnXml=aa,ee.localeTextsOf=Cp,ee.lowerOps=my,ee.oppositeOverlapCount=uC,ee.oppositeOverlapOf=pm,ee.planBackEdgeBoundaryClearance=zm,ee.planCrossPoolRoute=Nm,ee.planEdgeRepair=ef,ee.planLabelLineClearance=ff,ee.planLabelPlacement=Qm,ee.planLocaleBackfill=nA,ee.planMiddleSegmentShifts=km,ee.planOppositeOverlapRepair=Wm,ee.planSegmentDetours=Hc,ee.planShapeLabelClearance=oy,ee.planTranslationLocaleRestore=cA,ee.redockIntroducedDetachedEndpoints=ay,ee.repairIntroducedBoundaryHugging=Gm,ee.repairIntroducedCrossings=tf,ee.repairIntroducedEdgeCrossings=Om,ee.repairIntroducedFakeMerges=qm,ee.repairIntroducedLabelLines=ny,ee.repairIntroducedOppositeOverlaps=Zm,ee.repairIntroducedShapeLabelLines=ry,ee.repairIntroducedSharedSegmentLabels=iy,ee.rerouteIntroducedCrossPoolEdges=$m,ee.resolverServicesOf=py,ee.reviewRequestValuesOf=Tp,ee.reviewRequestsOf=No,ee.rootLangOf=Rp,ee.saveBpmnXml=QR,ee.sceneCrossingCost=vm,ee.sceneFromDefinitions=Cm,ee.sceneFromRegistry=Ge,ee.segmentShapeClearance=cs,ee.shapesUnderLabel=us,ee.sharedEndpointCrossingPairsOf=Ni,ee.sharedSegmentUnderLabel=jc,ee.sharedSpansOf=Fc,ee.sortPanelIssues=K_,ee.toPanelIssues=q_,ee.touchedElements=UM,ee.translationLocale=En,ee.translationsOf=Bo,ee.unreadableOverlapCount=di,ee.unreadableOverlapOf=Cr,ee.validateOps=uy,ee.warningMessages=Wp,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})}));
343
+ </div>`,Je.RESULT_HTML='<div class="djs-search-result"></div>',Je.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Je.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const Z$={__depends__:[Ps,wu,Ci],searchPad:["type",Je]};function vg(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}vg.$inject=["elementRegistry","searchPad","canvas","search"],vg.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!nt(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:mi(i),id:i.id})),e,{keys:["label","id"]}).map(Q$)};function Q$(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const J$={__depends__:[Z$,f0],__init__:["bpmnSearch"],bpmnSearch:["type",vg]},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",t5="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",n5={width:36,height:50},i5={width:50,height:50};function t1(e,t,n){return Be("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Oi=5;function ap(e,t){this._styles=t,e.registerProvider(this)}ap.$inject=["outline","styles"],ap.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(mT(e))return n=Be("rect"),Ce(n,U({x:-Oi,y:-Oi,rx:4,width:e.width+Oi*2,height:e.height+Oi*2},t)),n;if(!nt(e))return A(e,"bpmn:Gateway")?(n=Be("rect"),U(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Ce(n,U({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):it(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Be("rect"),Ce(n,U({x:-Oi,y:-Oi,rx:14,width:e.width+Oi*2,height:e.height+Oi*2},t))):A(e,"bpmn:EndEvent")?(n=Be("circle"),Ce(n,U({cx:e.width/2,cy:e.height/2,r:e.width/2+Oi+1},t))):A(e,"bpmn:Event")?(n=Be("circle"),Ce(n,U({cx:e.width/2,cy:e.height/2,r:e.width/2+Oi},t))):A(e,"bpmn:DataObjectReference")&&n1(e,"bpmn:DataObjectReference")?n=t1(e5,{x:-6,y:-6},t):A(e,"bpmn:DataStoreReference")&&n1(e,"bpmn:DataStoreReference")&&(n=t1(t5,{x:-6,y:-6},t)),n},ap.prototype.updateOutline=function(e,t){if(!nt(e))return it(e,["bpmn:SubProcess","bpmn:Group"])?(Ce(t,{width:e.width+Oi*2,height:e.height+Oi*2}),!0):!!it(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function n1(e,t){var n;return t==="bpmn:DataObjectReference"?n=n5:t==="bpmn:DataStoreReference"&&(n=i5),e.width===n.width&&e.height===n.height}const o5={__depends__:[cg],__init__:["outlineProvider"],outlineProvider:["type",ap]};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 so(e){wa.call(this,e)}Te(so,wa),so.Viewer=lr,so.NavigatedViewer=tc,so.prototype.createDiagram=function(){return this.importXML(r5)},so.prototype._interactionModules=[g_,y_,x_],so.prototype._modelingModules=[sB,yu,fB,uB,RB,ig,kB,nN,qx,Kl,aN,lN,RN,MN,AN,DN,WN,XN,Sh,i$,p$,_$,S$,mE,K$,J$,o5],so.prototype._modules=[].concat(lr.prototype._modules,so.prototype._interactionModules,so.prototype._modelingModules);var sp=50,a5=new Nr,i1={min:.2,max:4},s5=10,c5=.1,l5=250,u5=100,p5=2e3;function On(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=a5.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||lp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=cp({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);bg(p,r._canvas),r._update()}function s(u){return function(f){var d=xg(f);(!r._state._svgClientRect||lp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(d);var m=cp({x:d.x-r._state._svgClientRect.left,y:d.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),h=i.viewbox(),g=d5(m,h),w=r._viewportDom.getBoundingClientRect(),x={x:d.x-w.left+1,y:d.y-w.top+1};U(r._state,{cachedViewbox:h,initialDragPosition:{x:d.x,y:d.y},isDragging:!0,offsetViewport:g,offsetViewportDom:x,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),$e.bind(document,"mousemove",c),$e.bind(document,"mouseup",l)}}function c(u){var p=xg(u);if(r._state.isDragging){(!r._state._svgClientRect||lp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var f=r._state.offsetViewportDom,d=r._state.viewportClientRect,m=r._state.parentClientRect;U(r._viewportDom.style,{top:p.y-f.y-m.top+"px",left:p.x-f.x-m.left+"px"});var h=r1(m,{top:p.y-f.y-m.top,left:p.x-f.x-m.left,width:d.width,height:d.height});U(r._overlay.style,{clipPath:h});var g=cp({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);bg({x:g.x-r._state.offsetViewport.x,y:g.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=xg(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),U(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),$e.unbind(document,"mousemove",c),$e.unbind(document,"mouseup",l))}$e.bind(this._viewportDom,"mousedown",s(!1)),$e.bind(this._svg,"mousedown",s(!0)),$e.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||lp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!v5(u,r._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,f=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*b5(u.deltaY)*-p;if(r._state.zoomDelta+=f,Math.abs(r._state.zoomDelta)>c5){var d=f>0?1:-1,m=Math.log(i.zoom())/Math.log(10),h=x5(i1,s5*2),g=Math.round(m/h)*h;g+=h*d;var w=Math.pow(10,g);i.zoom(w5(i1,w),x),r._state.zoomDelta=0;var x=cp({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);bg(x,r._canvas),r._update()}}}),$e.bind(this._toggle,"click",function(u){u.preventDefault(),u.stopPropagation(),r.toggle()}),n.on(["shape.added","connection.added"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._addElement(u.element),r._scheduleUpdate()}),n.on(["shape.removed","connection.removed"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._removeElement(u.element),r._scheduleUpdate()}),n.on("elements.changed",l5,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)})}On.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],On.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");Ct(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");Ct(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");Ct(o).add("map"),n.appendChild(o);var r=this._svg=Be("svg");Ce(r,{width:"100%",height:"100%"}),Ke(o,r);var a=this._elementsGroup=Be("g");Ke(r,a);var s=this._viewportGroup=Be("g");Ke(r,s);var c=this._viewport=Be("rect");lt(c).add("viewport"),Ke(s,c),$e.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");Ct(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");Ct(u).add("overlay"),this._parent.appendChild(u)},On.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=Ue(this._config.debounceDelay)?this._config.debounceDelay:u5,n=Ue(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:p5,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)}},On.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)})}},On.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(a1(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-sp,o=o-sp,r=r+sp*2,a=a+sp*2,this._lastViewbox={x:i,y:o,width:r,height:a},Ce(this._svg,{viewBox:i+", "+o+", "+r+", "+a}),Ce(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var l=this._state._parentClientRect=this._parent.getBoundingClientRect(),u=this._viewport.getBoundingClientRect(),p={top:u.top-l.top,left:u.left-l.left,width:u.width,height:u.height};U(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var f=r1(l,p);U(this._overlay.style,{clipPath:f})}}},On.prototype.open=function(){U(this._state,{isOpen:!0}),Ct(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};En(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},On.prototype.close=function(){U(this._state,{isOpen:!1}),Ct(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};En(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},On.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},On.prototype.isOpen=function(){return this._state.isOpen},On.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)}},On.prototype._updateElementId=function(e,t){try{var n=Rt("#"+Hr(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},On.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},On.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=Rt("#"+Hr(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=g5(e);return s!==-1?a?m5(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),f5(e)?(n=e.parent,i=0,o=0,typeof n.x<"u"&&typeof n.y<"u"&&(i=-n.x,o=-n.y),Ce(r,{transform:"translate("+i+" "+o+")"})):(i=e.x,o=e.y,a&&(n=e.parent,i-=n.x,o-=n.y),Ce(r,{transform:"translate("+i+" "+o+")"})),e.children&&e.children.length&&e.children.forEach(function(c){t._addElement(c)}),r}}},On.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&on(t)},On.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=Yo(t),n)){var i=_5(Mf(n));return Ce(i,{id:this._prefixId(e.id)}),i}},On.prototype._clear=function(){ms(this._elementsGroup)},On.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function f5(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 cp(e,t,n){var i=t.getBoundingClientRect(),o=h5(n,i.width/i.height),r=o1(e.x,0,i.width,o.x,o.x+o.width),a=o1(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function bg(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 h5(e,t){var n=e.width/e.height,i=U({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var o=i.width*(1/t),r=i.y-(o-i.height)/2;U(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;U(i,{x:s,width:a})}return i}function o1(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function g5(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function m5(e,t,n){var i=y5(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function y5(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function lp(e){return e.width===0&&e.height===0}function v5(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var b5=Math.sign||function(e){return e>=0?1:-1};function x5(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 w5(e,t){return Math.max(e.min,Math.min(e.max,t))}function r1(e,t){var n=[co(t.left,t.top),co(t.left+t.width,t.top),co(t.left+t.width,t.top+t.height),co(t.left,t.top+t.height),co(t.left,e.height),co(e.width,e.height),co(e.width,0),co(0,0),co(0,e.height),co(t.left,e.height)].join(", ");return"polygon("+n+")"}function co(e,t){return e+"px "+t+"px"}function a1(e){return Lo(e,function(t){return gn(t)?a1(t):Ue(t)&&isFinite(t)})}function xg(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function _5(e){return gs("[id]",e).forEach(function(t){t.remove()}),e}var E5={__init__:["minimap"],minimap:["type",On]};const s1={closed:"미니맵",open:"접기"};class c1{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(kh,()=>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)}}jn(c1,"$inject",["eventBus","minimap","canvas"]);const S5={__depends__:[E5],__init__:["minimapI18n"],minimapI18n:["type",c1]},R5=ve.defineComponent({__name:"BpmnModelerView",props:{xml:{},labelFontFamily:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=ve.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=qp(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 ve.onMounted(async()=>{a=new so({container:r.value,moddleExtensions:Ic,additionalModules:[r_,S5,Yw],...i.labelFontFamily?{textRenderer:{defaultStyle:{fontFamily:i.labelFontFamily}}}:{}}),i.xml&&await s(i.xml),o("ready")}),ve.watch(()=>i.xml,l=>{l&&a&&s(l)}),ve.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(ve.openBlock(),ve.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),wg=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},C5=wg(R5,[["__scopeId","data-v-5f6ddcd2"]]),M5=["title","aria-expanded"],A5=["title","onClick"],P5={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},T5={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},k5={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},O5={key:0,class:"bwl-validation__body"},D5={key:0,class:"bwl-validation__empty"},L5={key:1,class:"bwl-validation__empty"},I5={key:2,class:"bwl-validation__list"},B5=["onClick"],N5={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},$5={class:"bwl-validation__msg"},F5=["title"],j5=wg(ve.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=ve.computed(()=>Jw(n.issues.value,n.describeElement)),o=ve.computed(()=>e_(i.value)),r=m=>$a(m,n.changeScope.value),a=ve.computed(()=>Th(i.value,n.changeScope.value)),s=ve.ref({error:!0,warning:!0,info:!0}),c=ve.computed(()=>t_(i.value.filter(m=>s.value[m.severity]),n.changeScope.value)),l=ve.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function f(m){if(!l.value){l.value=!0;return}s.value[m]=!s.value[m]}function d(m){const h=m.targetRefs[0];h&&n.requestFocus(h)}return(m,h)=>(ve.openBlock(),ve.createElementBlock("section",{class:ve.normalizeClass(["bwl-validation",{"is-open":l.value}])},[ve.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=g=>l.value=!l.value)},[ve.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(ve.openBlock(),ve.createElementBlock("svg",{class:ve.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[ve.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=ve.createElementVNode("span",null,"검증",-1))],8,M5),ve.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=ve.withModifiers(()=>{},["stop"]))},[(ve.openBlock(),ve.createElementBlock(ve.Fragment,null,ve.renderList(u,g=>ve.createElementVNode("button",{key:g,type:"button",class:ve.normalizeClass(["bwl-validation__count",[`is-${g}`,{"is-off":!s.value[g]}]]),title:l.value?`${p[g]} ${s.value[g]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:w=>f(g)},[(ve.openBlock(),ve.createElementBlock("svg",P5,[h[4]||(h[4]=ve.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),g==="error"?(ve.openBlock(),ve.createElementBlock("path",T5)):(ve.openBlock(),ve.createElementBlock("path",k5))])),ve.createElementVNode("span",null,ve.toDisplayString(o.value[g]),1)],10,A5)),64))])]),l.value?(ve.openBlock(),ve.createElementBlock("div",O5,[i.value.length===0?(ve.openBlock(),ve.createElementBlock("p",D5,"발견된 문제가 없습니다.")):c.value.length===0?(ve.openBlock(),ve.createElementBlock("p",L5," 선택한 심각도에 해당하는 항목이 없습니다. ")):(ve.openBlock(),ve.createElementBlock("ul",I5,[(ve.openBlock(!0),ve.createElementBlock(ve.Fragment,null,ve.renderList(c.value,g=>(ve.openBlock(),ve.createElementBlock("li",{key:g.key,class:ve.normalizeClass(["bwl-validation__item",[`is-${g.severity}`,{"is-clickable":g.targetRefs.length>0}]]),onClick:w=>d(g)},[h[5]||(h[5]=ve.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(g)?(ve.openBlock(),ve.createElementBlock("span",N5,"이번 변경")):ve.createCommentVNode("",!0),ve.createElementVNode("span",$5,ve.toDisplayString(g.message),1),ve.createElementVNode("span",{class:"bwl-validation__cat",title:g.code},ve.toDisplayString(g.category),9,F5)],10,B5))),128))]))])):ve.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),H5={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},z5=["aria-checked","title","data-locale","onClick"],G5={class:"bwl-locale__label"},V5={key:0,class:"bwl-locale__badge"},W5=wg(ve.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=ve.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?(ve.openBlock(),ve.createElementBlock("div",H5,[(ve.openBlock(!0),ve.createElementBlock(ve.Fragment,null,ve.renderList(o.value,s=>(ve.openBlock(),ve.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:ve.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=>ve.unref(n).setDisplayLocale(s.locale)},[ve.createElementVNode("span",G5,ve.toDisplayString(s.label),1),s.pending>0?(ve.openBlock(),ve.createElementBlock("span",V5,ve.toDisplayString(s.pending),1)):ve.createCommentVNode("",!0)],10,z5))),128))])):ve.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);J.ADDABLE_FLOW_NODE_TYPES=_c,J.APPLY_BPMN_OPS_SCHEMA=IS,J.BPMN_EVENT_DEFINITION_TYPES=Sc,J.BPMN_MODDLE_EXTENSIONS=Ic,J.BWL_MODDLE_SCHEMA=Ng,J.BWL_NS=Bg,J.BWL_PREFIX=wp,J.BWL_REVIEW_REQUEST_TYPE=Cc,J.BWL_SIDES=_p,J.BpmnDisplayLocaleSwitcher=W5,J.BpmnModelerView=C5,J.BpmnValidationPanel=j5,J.EDITOR=oA,J.FLOW_LABEL_INDENT=ym,J.GROUP_BORDER_MIN_RUN=Yp,J.GROUP_BORDER_NEAR=fa,J.HEADLESS_BPMN_MODULES=Kw,J.HEADLESS_TEXT_METRICS=ua,J.I18N_DISPLAY_REDRAWN_EVENT=kh,J.I18N_NS=yS,J.I18N_PREFIX=zg,J.I18N_REVIEW_REQUESTED_CLASS=i_,J.I18N_TRANSLATION_TYPE=Er,J.I18N_UNTRANSLATED_CLASS=n_,J.I18nDisplay=Oh,J.I18nDisplayModule=r_,J.IR_EVENT_DEFINITIONS=Ec,J.IR_FLOW_NODE_TYPES=wr,J.IR_TEXT_LOCALES=Rc,J.LABEL_FORK_MARGIN=Zp,J.LABEL_SHAPE_MIN_DEPTH=Pm,J.SET_TRANSLATIONS_COMMAND=Tp,J.SEVERITY_ORDER=Ph,J.SYMBOLIC_OP_KINDS=Gg,J.SYMBOLIC_OP_SCHEMA=Vg,J.SetTranslationsHandler=kp,J.TranslationCommands=Dp,J.TranslationCommandsModule=Lp,J.TranslationStateIndex=pA,J.UNDO_EPISODE_COMMAND=Ep,J.UPDATE_TRANSLATION_COMMAND=Pc,J.UpdateTranslationHandler=Pp,J.applyBpmnOpBatch=Oy,J.applyBpmnOps=Sy,J.applyLocaleBackfill=uA,J.applyTranslationLocaleRestore=mA,J.approximateTextWidth=pa,J.auditBpmnGeometry=Om,J.auditBpmnGeometryXml=kC,J.auditBpmnSemantics=xf,J.auditBpmnSemanticsXml=UM,J.auditGeometry=pt,J.auditTargetsOf=zn,J.axisSegmentsOf=nn,J.blackBoxNameRect=Kp,J.buildBpmnOpBatch=eA,J.buildRegistryIndex=Lm,J.collectTranslationStates=Fy,J.containerBoundarySegments=ha,J.countBySeverity=e_,J.createBpmnEditorController=rA,J.createBpmnModdle=lm,J.createHeadlessBpmnModeler=NL,J.crossedShapesOf=zt,J.crossingCost=di,J.describeProcess=Ay,J.describeProcessXml=jM,J.diffBpmnElements=ky,J.diffBpmnElementsXml=QM,J.documentLocalesOf=is,J.edgeCrossCount=ls,J.edgeCrossingPairsOf=ho,J.edgeCrossingStatsOf=Sm,J.executeAsUndoEpisode=Fg,J.followMovedEdgeLabels=ay,J.forwardThreePointCandidates=zc,J.geometryFindingKey=ct,J.inferScriptLocale=nl,J.installHeadlessBpmnDom=pm,J.irEventDefinitionOf=xp,J.isAddableFlowNodeType=Lg,J.isChangeScopeMixed=Th,J.isEdgeOverlapFinding=Xp,J.isInChangeScope=$a,J.isIrEventDefinition=Ig,J.isIrFlowNodeType=Dg,J.isIrTextLocale=sS,J.labelRectsOf=Ho,J.labelShapeDepth=Tm,J.labelSlot=Sr,J.lineCrossesLabel=Ni,J.lineThroughLabel=bm,J.lineThroughShapeLabel=Am,J.loadBpmnXml=la,J.localeTextsOf=Ap,J.lowerOps=_y,J.oppositeOverlapCount=yC,J.oppositeOverlapOf=mm,J.planBackEdgeBoundaryClearance=qm,J.planCrossPoolRoute=zm,J.planEdgeRepair=nf,J.planLabelLineClearance=hf,J.planLabelPlacement=iy,J.planLocaleBackfill=lA,J.planMiddleSegmentShifts=Bm,J.planOppositeOverlapRepair=Xm,J.planSegmentDetours=Hc,J.planShapeLabelClearance=ly,J.planTranslationLocaleRestore=gA,J.redockIntroducedDetachedEndpoints=py,J.repairIntroducedBoundaryHugging=Ym,J.repairIntroducedCrossings=of,J.repairIntroducedEdgeCrossings=Nm,J.repairIntroducedFakeMerges=Qm,J.repairIntroducedLabelLines=sy,J.repairIntroducedOppositeOverlaps=ny,J.repairIntroducedShapeLabelLines=uy,J.repairIntroducedSharedSegmentLabels=cy,J.rerouteIntroducedCrossPoolEdges=Gm,J.resolverServicesOf=my,J.reviewRequestValuesOf=Op,J.reviewRequestsOf=No,J.rootLangOf=Mp,J.saveBpmnXml=rC,J.sceneCrossingCost=Em,J.sceneFromDefinitions=km,J.sceneFromRegistry=Ge,J.segmentShapeClearance=cs,J.shapesUnderLabel=us,J.sharedEndpointCrossingPairsOf=$i,J.sharedSegmentUnderLabel=jc,J.sharedSpansOf=Fc,J.sortPanelIssues=t_,J.toPanelIssues=Jw,J.touchedElements=JM,J.translationLocale=_n,J.translationsOf=Bo,J.unreadableOverlapCount=fi,J.unreadableOverlapOf=Ar,J.validateOps=gy,J.warningMessages=qp,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})}));