@g1cloud/bpmn-modeler-next 5.0.0-beta.44 → 5.0.0-beta.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bpmn-modeler.js +9811 -9791
- package/dist/bpmn-modeler.umd.cjs +65 -65
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
(function(J,ye){typeof exports=="object"&&typeof module<"u"?ye(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],ye):(J=typeof globalThis<"u"?globalThis:J||self,ye(J.BpmnModeler={},J.Vue))})(this,(function(J,ye){"use strict";var D3=Object.defineProperty;var L3=(J,ye,_r)=>ye in J?D3(J,ye,{enumerable:!0,configurable:!0,writable:!0,value:_r}):J[ye]=_r;var Bn=(J,ye,_r)=>L3(J,typeof ye!="symbol"?ye+"":ye,_r);const _r=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],Ec=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function Ng(e){return _r.includes(e)}function $g(e){return Ec.includes(e)}const Sc=["timer"],Rc={timer:"bpmn:TimerEventDefinition"};function Fg(e){return typeof e=="string"&&Sc.includes(e)}function Rp(e){if(e.length===1)return Sc.find(t=>Rc[t]===e[0])}const Cc=["ko","en","ja","zh"];function mS(e){return typeof e=="string"&&Cc.includes(e)}const jg="http://g1project.net/spec/bpmn/bwl/1.0",Cp="bwl",Mp=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Mc="bwl:ReviewRequest",Hg={name:"bwl-hints",uri:jg,prefix:Cp,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"}]}]},Ap="bwl.undoEpisode",zg=new WeakSet;function yS(e){zg.has(e)||(e.register(Ap,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),zg.add(e))}function Gg(e,t){yS(e);const n={run:t};if(e.execute(Ap,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function Pp(e){return Array.prototype.concat.apply([],e)}const is=Object.prototype.toString,vS=Object.prototype.hasOwnProperty;function Er(e){return e===void 0}function dn(e){return e!==void 0}function ia(e){return e==null}function We(e){return is.call(e)==="[object Array]"}function hn(e){return is.call(e)==="[object Object]"}function Ue(e){return is.call(e)==="[object Number]"}function bn(e){const t=is.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Jn(e){return is.call(e)==="[object String]"}function bS(e){if(!We(e))throw new Error("must supply array")}function ei(e,t){return!ia(e)&&vS.call(e,t)}function Lt(e,t){const n=Pc(t);let i;return z(e,function(o,r){if(n(o,r))return i=o,!1}),i}function Vg(e,t){const n=Pc(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=Pc(t);let i=[];return z(e,function(o,r){n(o,r)&&i.push(o)}),i}function z(e,t){let n,i;if(Er(e))return;const o=We(e)?SS:ES;for(let r in e)if(ei(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function xS(e,t){if(Er(e))return[];bS(e);const n=Pc(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 Bo(e,t){return!!ti(e,function(n,i,o){return n&&t(i,o)},!0)}function No(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 Ac(e){return e&&Object.keys(e)||[]}function wS(e){return Ac(e).length}function oa(e){return Nn(e,t=>t)}function ra(e,t,n={}){return t=Tp(t),z(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function Wg(e,...t){e=Tp(e);let n={};return z(t,o=>ra(o,e,n)),Nn(n,function(o,r){return o[0]})}const _S=Wg;function qi(e,t){t=Tp(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 aa(e){return function(t){return Bo(e,function(n,i){return t[i]===n})}}function Tp(e){return bn(e)?e:t=>t[e]}function Pc(e){return bn(e)?e:t=>t===e}function ES(e){return e}function SS(e){return Number(e)}function kp(e,t){let n,i,o,r;function a(p){let f=Date.now(),d=p?0:r+t-f;if(d>0)return s(d);e.apply(o,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=r=i=o=void 0}function l(){n&&a(!0),c()}function u(...p){r=Date.now(),i=p,o=this,n||s(t)}return u.flush=l,u.cancel=c,u}function Kn(e,t){return e.bind(t)}function q(e,...t){return Object.assign(e,...t)}function RS(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)&&ia(s)&&(s=i[o]=isNaN(+a)?{}:[]),Er(a)?Er(n)?delete i[o]:i[o]=n:i=s}),e}function Ni(e,t){let n={},i=Object(e);return z(t,function(o){o in i&&(n[o]=e[o])}),n}function Yi(e,t){let n={},i=Object(e);return z(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function A(e,t){var n=ge(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function it(e,t){return No(t,function(n){return A(e,n)})}function ge(e){return e&&e.businessObject||e}function dt(e){return e&&e.di}const CS="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Ug="i18n",Sr="i18n:Translation";function Rr(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 $o(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,Sr)})}function Sn(e){return e.get("xml:lang")}function Fo(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,Mc)})}function os(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,o,r)=>i!==t&&r.indexOf(i)===o)]}function Op(e){var n,i;const t=((n=e==null?void 0:e.get)==null?void 0:n.call(e,"xml:lang"))??((i=e==null?void 0:e.$attrs)==null?void 0:i["xml:lang"]);return typeof t=="string"&&t?t:void 0}function Dp(e,t,n){const i=Rr(e);if(!i)return{};const o=i.target[i.key]??"",r=$o(e).filter(u=>Sn(u)),a=u=>u.body??"",s=o?r.filter(u=>a(u)===o).map(Sn):[],c=o?s.length?s:[n??t.designLocale]:[],l={};for(const u of os(t)){if(c.includes(u)){l[u]=o;continue}const p=r.find(f=>Sn(f)===u&&a(f));p&&(l[u]=a(p))}return l}const Tc="bwl.updateTranslation";class Lp{constructor(t){this.moddle=t}execute(t){const{element:n,text:i,designLocale:o,locales:r,rootLang:a,nameChangedFrom:s}=t,c=n.businessObject,l=Rr(c),u=[];t.undo=u;const p=$o(c).filter(T=>Sn(T)),f=s??(l?l.target[l.key]??"":""),d=a??o,h=(T=>{if(!T)return[];const N=p.filter(j=>j.body===T).map(Sn);return N.length?N:[d]})(f),m=s!==void 0&&f&&!h.includes(t.locale)?h[0]:t.locale,w=T=>{var N;return((N=p.find(j=>Sn(j)===T&&j.body))==null?void 0:N.body)??(h.includes(T)?f:"")},y=T=>Fo(c).some(N=>N.locale===T),v=w(m);if(v===i)return[];const x=!!v&&!y(m),E=x?r.filter(T=>T!==m&&w(T)&&!y(T)):[],M=()=>{let T=c.extensionElements;return T||(T=this.moddle.create("bpmn:ExtensionElements",{values:[]}),T.$parent=c,c.extensionElements=T,u.push(()=>delete c.extensionElements)),T.get("values")},D=(T,N)=>{const j=M();let V=j.find(Q=>{var ne;return((ne=Q.$instanceOf)==null?void 0:ne.call(Q,Sr))&&Sn(Q)===T});if(V){const Q=V.body;V.body=N,u.push(()=>V.body=Q)}else V=this.moddle.create(Sr,{body:N}),V.set("xml:lang",T),V.$parent=c.extensionElements,j.push(V),u.push(()=>j.splice(j.indexOf(V),1))},P=T=>{const N=M(),j=N.indexOf(T);N.splice(j,1),u.push(()=>N.splice(j,0,T))};if(s===void 0){if(m===o&&l){if(f&&!p.some(N=>N.body===f)){const N=a&&a!==o?a:void 0;N&&D(N,f)}const T=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{T?l.target[l.key]=f:delete l.target[l.key]})}D(m,i)}else(p.some(T=>Sn(T)===m)||!f&&m!==d)&&D(m,i);if(!x)for(const T of Fo(c).filter(N=>N.locale===m))P(T);for(const T of E){const N=M(),j=this.moddle.create(Mc,{locale:T,sourceLocale:m,previous:v});j.$parent=c.extensionElements,N.push(j),u.push(()=>N.splice(N.indexOf(j),1))}for(const T of Fo(c).filter(N=>N.sourceLocale===m&&(N.previous??"")===i))P(T);return u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}Bn(Lp,"$inject",["moddle"]);const Ip="bwl.setTranslations",MS=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class Bp{constructor(t){this.moddle=t}execute(t){const{element:n,texts:i,confirm:o=[],designLocale:r,locales:a,rootLang:s,before:c}=t,l=n.businessObject,u=[];if(t.undo=u,!Rr(l))return[];const p=()=>{let w=l.extensionElements;return w||(w=this.moddle.create("bpmn:ExtensionElements",{values:[]}),w.$parent=l,l.extensionElements=w,u.push(()=>delete l.extensionElements)),w.get("values")},f=w=>{const y=p(),v=y.indexOf(w);v<0||(y.splice(v,1),u.push(()=>y.splice(v,0,w)))},d=w=>$o(l).find(y=>Sn(y)===w);if(i===null)for(const w of a){const y=d(w);y&&f(y)}else if(i)for(const w of a){const y=i[w];if(y===void 0)continue;const v=d(w);if(v){if(v.body===y)continue;const M=v.body;v.body=y,u.push(()=>v.body=M);continue}if(w===r&&(s??r)===r)continue;const x=p(),E=this.moddle.create(Sr,{body:y});E.set("xml:lang",w),E.$parent=l.extensionElements,x.push(E),u.push(()=>x.splice(x.indexOf(E),1))}const h=[...i===null?[]:c.requests.filter(w=>!o.includes(w.locale)&&!(i&&i[w.locale]!==void 0&&i[w.locale]!==c.texts[w.locale])&&!(i&&w.sourceLocale&&i[w.sourceLocale]===w.previous))];for(const w of Fo(l)){const y=h.findIndex(v=>MS(w,v));y>=0?h.splice(y,1):f(w)}for(const w of h){const y=p(),v=this.moddle.create(Mc,{locale:w.locale,...w.sourceLocale?{sourceLocale:w.sourceLocale}:{},previous:w.previous});v.$parent=l.extensionElements,y.push(v),u.push(()=>y.splice(y.indexOf(v),1))}const m=l.extensionElements;return m&&!m.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=m)),u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}Bn(Bp,"$inject",["moddle"]);function Np(e){return Fo(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class $p{constructor(t){t.registerHandler(Tc,Lp),t.registerHandler(Ip,Bp)}}Bn($p,"$inject",["commandStack"]);const Fp={__init__:["translationCommands"],translationCommands:["type",$p]},qg=["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"],AS={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},PS={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(Cc.map(e=>[e,{type:"string"}])),additionalProperties:!1},TS={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},kS={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},OS={type:"string",enum:[...Sc],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},DS={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Ec]},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},LS={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},IS={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},BS={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},NS={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},$S={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},FS={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},jS={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},HS={type:"object",description:"그룹 — members(요소 id 목록)가 bwl:members 힌트로 기록되고 바운즈는 멤버 bbox 로 산출된다.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},members:{type:"array",items:{type:"string"}}},required:["id"],additionalProperties:!1},zS={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Mp]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function Mn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const GS={"participant.add":Mn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Mn("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":Mn("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":Mn("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:[...Ec]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":Mn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Mn("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":Mn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Mn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":Mn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Mn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":Mn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Mn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Mn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Mn("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":Mn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Mn("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":Mn("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...Cc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":Mn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Yg={anyOf:qg.map(e=>GS[e])},VS={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:TS,irParticipant:kS,irNode:DS,irFlowCondition:LS,irSequenceFlow:IS,irMessageFlow:BS,irDataStore:NS,irDataAssociation:$S,irTextAnnotation:FS,irAssociation:jS,irGroup:HS,bwlPlacement:zS,eventDefinition:OS,localeTexts:PS,nullableString:AS,symbolicOp:Yg}};function jp(){}jp.prototype.get=function(e){return this.$model.properties.get(this,e)},jp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Kg(e,t){this.model=e,this.properties=t}Kg.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(jp.prototype);z(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var o=e.ns.name;function r(a){n.define(this,"$type",{value:o,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),z(a,Kn(function(s,c){this.set(c,s)},this))}return r.prototype=i,r.hasType=i.$instanceOf=this.model.hasType,n.defineModel(r,t),n.defineDescriptor(r,e),r};var WS=q(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Xg=q(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function Hp(e,t){var n=Xg[e];return n?n(t):t}function zp(e){return!!WS[e]}function Zg(e){return!!Xg[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 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 Ni(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=$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},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||(z(e.properties,Kn(function(r){r=q({},r,{name:r.ns.localName,inherited:t}),Object.defineProperty(r,"definedBy",{value:e});var a=r.replaces,s=r.redefines;a||s?this.redefineProperty(r,a||s,a):(r.isBody&&this.setBodyProperty(r),r.isId&&this.setIdProperty(r),this.addProperty(r))},this)),i.push(e),n[o]=e)};function jo(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,z(e,Kn(this.registerPackage,this))}jo.prototype.getPackage=function(e){return this.packageMap[e]},jo.prototype.getPackages=function(){return this.packages},jo.prototype.registerPackage=function(e){e=q({},e);var t=this.packageMap;Qg(t,e,"prefix"),Qg(t,e,"uri"),z(e.types,Kn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},jo.prototype.registerType=function(e,t){e=q({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:q({},e.meta||{})});var n=$n(e.name,t.prefix),i=n.name,o=Object.create(null);z(e.properties,Kn(function(r){var a=$n(r.name,n.prefix),s=a.name;zp(r.type)||(r.type=$n(r.type,a.prefix).name),q(r,{ns:a,name:s}),o[s]=r},this)),q(e,{ns:n,name:i,propertiesByName:o}),z(e.extends,Kn(function(r){var a=$n(r,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},jo.prototype.mapTypes=function(e,t,n){var i=zp(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=$n(c,zp(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)},jo.prototype.getEffectiveDescriptor=function(e){var t=$n(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},jo.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Qg(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Cr(e){this.model=e}Cr.prototype.set=function(e,t,n){if(!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;US(n)?i?delete e[o]:delete e.$attrs[Gp(t)]:i?o in e?e[o]=n:Jg(e,i,n):e.$attrs[Gp(t)]=n},Cr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Gp(t)];var i=n.name;return!e[i]&&n.isMany&&Jg(e,n,[]),e[i]},Cr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=q({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Cr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Cr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Cr.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const o=n.config.strict;if(typeof o<"u"){const r=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(o)throw r;typeof console<"u"&&console.warn(r)}return null};function US(e){return typeof e>"u"}function Jg(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Gp(e){return e.replace(/^:/,"")}function xi(e,t={}){this.properties=new Cr(this),this.factory=new Kg(this,this.properties),this.registry=new jo(e,this.properties),this.typeCache=Object.create(null),this.config=t}xi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},xi.prototype.getType=function(e){var t=this.typeCache,n=Jn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},xi.prototype.createAny=function(e,t,n){var i=$n(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){RS(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},xi.prototype.getPackage=function(e){return this.registry.getPackage(e)},xi.prototype.getPackages=function(){return this.registry.getPackages()},xi.prototype.getElementDescriptor=function(e){return e.$descriptor},xi.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},xi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},xi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var em=String.fromCharCode,qS=Object.prototype.hasOwnProperty,YS=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,rs={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(rs).forEach(function(e){rs[e.toUpperCase()]=rs[e]});function KS(e,t,n,i){return i?qS.call(rs,i)?rs[i]:"&"+i+";":em(t||parseInt(n,16))}function Mr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(YS,KS):e}var tm="non-whitespace outside of root node";function Ho(e){return new Error(e)}function XS(e){return"missing namespace for prefix <"+e+">"}function kc(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 nm=Symbol("nameCache");function Vp(e){return e+"$uri"}function QS(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Vp(i)]=n;return t}function Oc(){return{line:0,column:0}}function JS(e){throw e}function im(e){if(!this)return new im(e);var t=e&&e.proxy,n,i,o,r,a=JS,s,c,l,u,p=Oc,f=!1,d=!1,g="",h=!1,m=!1,w=null,y=!1,v,x,E,M;function D(j){j instanceof Error||(j=Ho(j)),w=j,a(j,p)}function P(j){s&&(j instanceof Error||(j=Ho(j)),s(j,p))}this.on=function(j,V){if(typeof V!="function")throw Ho("required args <name, cb>");switch(j){case"openTag":i=V;break;case"text":n=V;break;case"closeTag":o=V;break;case"error":a=V;break;case"warn":s=V;break;case"cdata":r=V;break;case"attention":u=V;break;case"question":l=V;break;case"comment":c=V;break;default:throw Ho("unsupported event: "+j)}return this},this.ns=function(j){if(typeof j>"u"&&(j={}),typeof j!="object")throw Ho("required args <nsMap={}>");var V=Object.create(null),Q;for(Q in j)V[Q]=j[Q];return m=!0,M=V,this};function T(){v=m?[]:null,x=m?QS(M):null,E=[],p=Oc,y=!1,w=null,d=!1,g=""}this.parse=function(j){if(typeof j!="string")throw Ho("required args <xml=string>");if(f)throw Ho("parse during stream; call end() first");return T(),N(j),p=Oc,y=!1,w},this.write=function(j){if(typeof j!="string")throw Ho("required args <xml=string>");return f||(T(),f=!0),w||(g=N(g+j,!0)||""),this},this.end=function(){return f||T(),f=!1,w||N(g),g="",p=Oc,y=!1,w},this.stop=function(){y=!0};function N(j,V=!1){var Q=null,ne=null,W,te=0,xe=!1,Oe=!1,we=0,K=0,oe,Y,X,ce,me,Ie,$,C,S,G="",Z=0,ae;function Ce(_t,un){var zn=_t.indexOf(":");if(zn===-1)return _t;var In=x[_t.substring(0,zn)];return In?un===In?_t.substr(zn+1):In+_t.substr(zn):(P(XS(_t.substring(0,zn))),null)}function Ze(){if(ae!==null)return ae;var _t,un,zn=m&&x.xmlns,In=m&&h?[]:null,Dt=Z,pn=G,Un=pn.length,br,yi,vi,Qn,Kt,Do={},hp=new Set,bi,ft,St;e:for(;Dt<Un;Dt++)if(bi=!1,ft=pn.charCodeAt(Dt),!(ft===32||ft<14&&ft>8)){for((ft<65||ft>122||ft>90&&ft<97)&&ft!==95&&ft!==58&&(P("illegal first char attribute name"),bi=!0),St=Dt+1;St<Un;St++)if(ft=pn.charCodeAt(St),!(ft>96&&ft<123||ft>64&&ft<91||ft>47&&ft<59||ft===46||ft===45||ft===95)){if(ft===32||ft<14&&ft>8){P("missing attribute value"),Dt=St;continue e}if(ft===61)break;P("illegal attribute name char"),bi=!0}if(Kt=pn.substring(Dt,St),Kt==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),bi=!0),ft=pn.charCodeAt(St+1),ft===34)St=pn.indexOf('"',Dt=St+2),St===-1&&(St=pn.indexOf("'",Dt),St!==-1&&(P("attribute value quote missmatch"),bi=!0));else if(ft===39)St=pn.indexOf("'",Dt=St+2),St===-1&&(St=pn.indexOf('"',Dt),St!==-1&&(P("attribute value quote missmatch"),bi=!0));else for(P("missing attribute value quotes"),bi=!0,St=St+1;St<Un&&(ft=pn.charCodeAt(St+1),!(ft===32||ft<14&&ft>8));St++);for(St===-1&&(P("missing closing quotes"),St=Un,bi=!0),bi||(vi=pn.substring(Dt,St)),Dt=St;St+1<Un&&(ft=pn.charCodeAt(St+1),!(ft===32||ft<14&&ft>8));St++)Dt===St&&(P("illegal character after attribute end"),bi=!0);if(Dt=St+1,bi)continue e;if(hp.has(Kt)){P("attribute <"+Kt+"> already defined");continue}if(hp.add(Kt),!m){Do[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(_t=Mr(vi),un=Vp(yi),Qn=M[_t],!Qn){if(yi==="xmlns"||un in x&&x[un]!==_t)do Qn="ns"+te++;while(typeof x[Qn]<"u");else Qn=yi;M[_t]=Qn}x[yi]!==Qn&&(br||(x=ZS(x),br=!0),x[yi]=Qn,yi==="xmlns"&&(x[Vp(Qn)]=_t,zn=Qn),x[un]=_t),Do[Kt]=vi;continue}In.push(Kt,vi);continue}Kt=Ce(Kt,zn),Kt!==null&&(Do[Kt]=vi)}if(h)for(Dt=0,Un=In.length;Dt<Un;Dt++)Kt=Ce(In[Dt++],zn),vi=In[Dt],Kt!==null&&(Do[Kt]=vi);return ae=Do}function gt(){for(var _t=/(\r\n|\r|\n)/g,un=0,zn=0,In=0,Dt=K,pn,Un;we>=In&&(pn=_t.exec(j),!(!pn||(Dt=pn[0].length+pn.index,Dt>we)));)un+=1,In=Dt;return we==-1?(zn=Dt,Un=j.substring(K)):K===0?Un=j.substring(K,we):(zn=we-In,Un=K==-1?j.substring(we):j.substring(we,K+1)),{data:Un,line:un,column:zn}}for(p=gt,t&&(S=Object.create({},{name:kc(function(){return $}),originalName:kc(function(){return C}),attrs:kc(Ze),ns:kc(function(){return x})}));K!==-1;){if(j.charCodeAt(K)===60?we=K:we=j.indexOf("<",K),we===-1){if(V)return j.substring(K);if(E.length)return D("unexpected end of file");if(!d)return D("missing start tag");K<j.length&&j.substring(K).trim()&&P(tm);return}if(d||(d=!0),K!==we){if(E.length){if(n&&(n(j.substring(K,we),Mr,p),y))return}else if(j.substring(K,we).trim()&&(P(tm),y))return}if(ce=j.charCodeAt(we+1),ce===33){if(X=j.charCodeAt(we+2),X===91&&j.substr(we+3,6)==="CDATA["){if(K=j.indexOf("]]>",we),K===-1)return V?j.substring(we):D("unclosed cdata");if(r&&(r(j.substring(we+9,K),p),y))return;K+=3;continue}if(X===45&&j.charCodeAt(we+3)===45){if(K=j.indexOf("-->",we),K===-1)return V?j.substring(we):D("unclosed comment");if(c&&(c(j.substring(we+4,K),Mr,p),y))return;K+=3;continue}}if(ce===63){if(K=j.indexOf("?>",we),K===-1)return V?j.substring(we):D("unclosed question");if(l&&(l(j.substring(we,K+2),p),y))return;K+=2;continue}for(oe=we+1;;oe++){if(me=j.charCodeAt(oe),isNaN(me))return V?j.substring(we):(K=-1,D("unclosed tag"));if(me===34)X=j.indexOf('"',oe+1),oe=X!==-1?X:oe;else if(me===39)X=j.indexOf("'",oe+1),oe=X!==-1?X:oe;else if(me===62){K=oe;break}}if(ce===33){if(u&&(u(j.substring(we,K+1),Mr,p),y))return;K+=1;continue}if(ae={},ce===47){if(xe=!1,Oe=!0,!E.length)return D("missing open tag");if(oe=$=E.pop(),X=we+2+oe.length,j.substring(we+2,X)!==oe)return D("closing tag mismatch");for(;X<K;X++)if(ce=j.charCodeAt(X),!(ce===32||ce>8&&ce<14))return D("close tag")}else{if(j.charCodeAt(K-1)===47?(oe=$=j.substring(we+1,K-1),xe=!0,Oe=!0):(oe=$=j.substring(we+1,K),xe=!0,Oe=!1),!(ce>96&&ce<123||ce>64&&ce<91||ce===95||ce===58))return D("illegal first char nodeName");for(X=1,Y=oe.length;X<Y;X++)if(ce=oe.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){$=oe.substring(0,X),ae=null;break}return D("invalid nodeName")}Oe||E.push($)}if(m){W=x,xe&&(Oe||v.push(W),ae===null&&(h=oe.indexOf("xmlns",X)!==-1)&&(Z=X,G=oe,Ze(),h=!1)),C=$,ne!==x&&(Q=x[nm],Q===void 0&&(Q=x[nm]=Object.create(null)),ne=x);var Yt=Q[$];if(Yt!==void 0)$=Yt;else{if(ce=$.indexOf(":"),ce!==-1){if(Ie=x[$.substring(0,ce)],!Ie)return D("missing namespace on <"+C+">");$=$.substr(ce+1)}else Ie=x.xmlns;Ie&&($=Ie+":"+$),Q[C]=$}}if(xe&&(Z=X,G=oe,i&&(t?i(S,Mr,Oe,p):i($,Ze,Mr,Oe,p),y)))return;if(Oe){if(o&&(o(t?S:$,Mr,xe,p),y))return;m&&(xe?x=W:x=v.pop())}K+=1}}}function om(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Wp={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},rm="property";function am(e){return e.xml&&e.xml.serialize}function eR(e){const t=am(e);return t!==rm&&(t||null)}function tR(e){return e.charAt(0).toUpperCase()+e.slice(1)}function sm(e,t){return om(t)?e.prefix+":"+tR(e.localName):e.name}function nR(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 iR(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 nR(r,a)}function zo(e){return new Error(e)}function ho(e){return e.$descriptor}function oR(e){q(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw zo("expected element");var n=this.elementsById,i=ho(t),o=i.idProperty,r;if(o&&(r=t.get(o.name),r)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(r))throw new Error("illegal ID <"+r+">");if(n[r])throw zo("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function as(){}as.prototype.handleEnd=function(){},as.prototype.handleText=function(){},as.prototype.handleNode=function(){};function Up(){}Up.prototype=Object.create(as.prototype),Up.prototype.handleNode=function(){return this};function sa(){}sa.prototype=Object.create(as.prototype),sa.prototype.handleText=function(e){this.body=(this.body||"")+e};function ss(e,t){this.property=e,this.context=t}ss.prototype=Object.create(sa.prototype),ss.prototype.handleNode=function(e){if(this.element)throw zo("expected no sub nodes");return this.element=this.createReference(e),this},ss.prototype.handleEnd=function(){this.element.id=this.body},ss.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function qp(e,t){this.element=t,this.propertyDesc=e}qp.prototype=Object.create(sa.prototype),qp.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Hp(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Dc(){}Dc.prototype=Object.create(sa.prototype),Dc.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function Gn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Gn.prototype=Object.create(Dc.prototype),Gn.prototype.addReference=function(e){this.context.addReference(e)},Gn.prototype.handleText=function(e){var t=this.element,n=ho(t),i=n.bodyProperty;if(!i)throw zo("unexpected body text <"+e+">");sa.prototype.handleText.call(this,e)},Gn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=ho(t),i=n.bodyProperty;i&&e!==void 0&&(e=Hp(i.type,e),t.set(i.name,e))},Gn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=ho(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=Hp(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=ho(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=eR(s);if(l){const u=e.attributes[l];if(u){const p=iR(u,e.ns,o),f=o.getType(p);return q({},s,{effectiveType:ho(f).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=sm(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 q({},s,{effectiveType:ho(u).name})}else if(s=Lt(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw zo("unrecognized element <"+n.name+">")},Gn.prototype.toString=function(){return"ElementDescriptor["+ho(this.type).name+"]"},Gn.prototype.valueHandler=function(e,t){return new qp(e,t)},Gn.prototype.referenceHandler=function(e){return new ss(e,this.context)},Gn.prototype.handler=function(e){return e==="Element"?new ca(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?(q(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function Yp(e,t,n){Gn.call(this,e,t,n)}Yp.prototype=Object.create(Gn.prototype),Yp.prototype.createElement=function(e){var t=e.name,n=$n(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&sm(n,r)||t;if(!o.hasType(a))throw zo("unexpected element <"+e.originalName+">");return Gn.prototype.createElement.call(this,e)};function ca(e,t,n){this.model=e,this.context=n}ca.prototype=Object.create(Dc.prototype),ca.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)},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 Kp(e){e instanceof xi&&(e={model:e}),q(this,{lax:!1},e)}Kp.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 oR(q({},t,{rootHandler:i})),s=new im({proxy:!0}),c=rR();i.context=a,c.push(i);function l(E,M,D){var P=M(),T=P.line,N=P.column,j=P.data;j.charAt(0)==="<"&&j.indexOf(" ")!==-1&&(j=j.slice(0,j.indexOf(" "))+">");var V="unparsable content "+(j?j+" ":"")+`detected
|
|
1
|
+
(function(J,be){typeof exports=="object"&&typeof module<"u"?be(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],be):(J=typeof globalThis<"u"?globalThis:J||self,be(J.BpmnModeler={},J.Vue))})(this,(function(J,be){"use strict";var B3=Object.defineProperty;var N3=(J,be,Er)=>be in J?B3(J,be,{enumerable:!0,configurable:!0,writable:!0,value:Er}):J[be]=Er;var Fn=(J,be,Er)=>N3(J,typeof be!="symbol"?be+"":be,Er);const Er=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],Rc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function $g(e){return Er.includes(e)}function Fg(e){return Rc.includes(e)}const Cc=["timer"],Mc={timer:"bpmn:TimerEventDefinition"};function jg(e){return typeof e=="string"&&Cc.includes(e)}function Cp(e){if(e.length===1)return Cc.find(t=>Mc[t]===e[0])}const Ac=["ko","en","ja","zh"];function vS(e){return typeof e=="string"&&Ac.includes(e)}const Hg="http://g1project.net/spec/bpmn/bwl/1.0",Mp="bwl",Ap=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Pc="bwl:ReviewRequest",zg={name:"bwl-hints",uri:Hg,prefix:Mp,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"}]}]},Pp="bwl.undoEpisode",Gg=new WeakSet;function bS(e){Gg.has(e)||(e.register(Pp,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Gg.add(e))}function Vg(e,t){bS(e);const n={run:t};if(e.execute(Pp,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function Tp(e){return Array.prototype.concat.apply([],e)}const rs=Object.prototype.toString,xS=Object.prototype.hasOwnProperty;function Sr(e){return e===void 0}function gn(e){return e!==void 0}function ra(e){return e==null}function Ue(e){return rs.call(e)==="[object Array]"}function mn(e){return rs.call(e)==="[object Object]"}function qe(e){return rs.call(e)==="[object Number]"}function wn(e){const t=rs.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Jn(e){return rs.call(e)==="[object String]"}function wS(e){if(!Ue(e))throw new Error("must supply array")}function ei(e,t){return!ra(e)&&xS.call(e,t)}function Bt(e,t){const n=kc(t);let i;return z(e,function(o,r){if(n(o,r))return i=o,!1}),i}function Wg(e,t){const n=kc(t);let i=Ue(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=kc(t);let i=[];return z(e,function(o,r){n(o,r)&&i.push(o)}),i}function z(e,t){let n,i;if(Sr(e))return;const o=Ue(e)?CS:RS;for(let r in e)if(ei(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function _S(e,t){if(Sr(e))return[];wS(e);const n=kc(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 No(e,t){return!!ti(e,function(n,i,o){return n&&t(i,o)},!0)}function $o(e,t){return!!Bt(e,t)}function jn(e,t){let n=[];return z(e,function(i,o){n.push(t(i,o))}),n}function Tc(e){return e&&Object.keys(e)||[]}function ES(e){return Tc(e).length}function aa(e){return jn(e,t=>t)}function sa(e,t,n={}){return t=kp(t),z(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function Ug(e,...t){e=kp(e);let n={};return z(t,o=>sa(o,e,n)),jn(n,function(o,r){return o[0]})}const SS=Ug;function Ui(e,t){t=kp(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)}),jn(n,i=>i.v)}function ca(e){return function(t){return No(e,function(n,i){return t[i]===n})}}function kp(e){return wn(e)?e:t=>t[e]}function kc(e){return wn(e)?e:t=>t===e}function RS(e){return e}function CS(e){return Number(e)}function Op(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 q(e,...t){return Object.assign(e,...t)}function MS(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];gn(a)&&ra(s)&&(s=i[o]=isNaN(+a)?{}:[]),Sr(a)?Sr(n)?delete i[o]:i[o]=n:i=s}),e}function Bi(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 A(e,t){var n=me(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function ot(e,t){return $o(t,function(n){return A(e,n)})}function me(e){return e&&e.businessObject||e}function ht(e){return e&&e.di}const AS="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",qg="i18n",Rr="i18n:Translation";function Cr(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 Fo(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,Rr)})}function Sn(e){return e.get("xml:lang")}function jo(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,Pc)})}function as(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,o,r)=>i!==t&&r.indexOf(i)===o)]}function Dp(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 Lp(e,t,n){const i=Cr(e);if(!i)return{};const o=i.target[i.key]??"",r=Fo(e).filter(u=>Sn(u)),a=u=>u.body??"",s=o?r.filter(u=>a(u)===o).map(Sn):[],c=o?s.length?s:[n??t.designLocale]:[],l={};for(const u of as(t)){if(c.includes(u)){l[u]=o;continue}const p=r.find(f=>Sn(f)===u&&a(f));p&&(l[u]=a(p))}return l}const Oc="bwl.updateTranslation";class Ip{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=Cr(c),u=[];t.undo=u;const p=Fo(c).filter(T=>Sn(T)),f=s??(l?l.target[l.key]??"":""),d=a??o,h=(T=>{if(!T)return[];const $=p.filter(j=>j.body===T).map(Sn);return $.length?$:[d]})(f),m=s!==void 0&&f&&!h.includes(t.locale)?h[0]:t.locale,w=T=>{var $;return(($=p.find(j=>Sn(j)===T&&j.body))==null?void 0:$.body)??(h.includes(T)?f:"")},y=T=>jo(c).some($=>$.locale===T),v=w(m);if(v===i)return[];const x=!!v&&!y(m),E=x?r.filter(T=>T!==m&&w(T)&&!y(T)):[],C=()=>{let T=c.extensionElements;return T||(T=this.moddle.create("bpmn:ExtensionElements",{values:[]}),T.$parent=c,c.extensionElements=T,u.push(()=>delete c.extensionElements)),T.get("values")},D=(T,$)=>{const j=C();let G=j.find(Q=>{var te;return((te=Q.$instanceOf)==null?void 0:te.call(Q,Rr))&&Sn(Q)===T});if(G){const Q=G.body;G.body=$,u.push(()=>G.body=Q)}else G=this.moddle.create(Rr,{body:$}),G.set("xml:lang",T),G.$parent=c.extensionElements,j.push(G),u.push(()=>j.splice(j.indexOf(G),1))},P=T=>{const $=C(),j=$.indexOf(T);$.splice(j,1),u.push(()=>$.splice(j,0,T))};if(s===void 0){if(m===o&&l){if(f&&!p.some($=>$.body===f)){const $=a&&a!==o?a:void 0;$&&D($,f)}const T=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{T?l.target[l.key]=f:delete l.target[l.key]})}D(m,i)}else(p.some(T=>Sn(T)===m)||!f&&m!==d)&&D(m,i);if(!x)for(const T of jo(c).filter($=>$.locale===m))P(T);for(const T of E){const $=C(),j=this.moddle.create(Pc,{locale:T,sourceLocale:m,previous:v});j.$parent=c.extensionElements,$.push(j),u.push(()=>$.splice($.indexOf(j),1))}for(const T of jo(c).filter($=>$.sourceLocale===m&&($.previous??"")===i))P(T);return u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}Fn(Ip,"$inject",["moddle"]);const Bp="bwl.setTranslations",PS=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class Np{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,!Cr(l))return[];const p=()=>{let w=l.extensionElements;return w||(w=this.moddle.create("bpmn:ExtensionElements",{values:[]}),w.$parent=l,l.extensionElements=w,u.push(()=>delete l.extensionElements)),w.get("values")},f=w=>{const y=p(),v=y.indexOf(w);v<0||(y.splice(v,1),u.push(()=>y.splice(v,0,w)))},d=w=>Fo(l).find(y=>Sn(y)===w);if(i===null)for(const w of a){const y=d(w);y&&f(y)}else if(i)for(const w of a){const y=i[w];if(y===void 0)continue;const v=d(w);if(v){if(v.body===y)continue;const C=v.body;v.body=y,u.push(()=>v.body=C);continue}if(w===r&&(s??r)===r)continue;const x=p(),E=this.moddle.create(Rr,{body:y});E.set("xml:lang",w),E.$parent=l.extensionElements,x.push(E),u.push(()=>x.splice(x.indexOf(E),1))}const h=[...i===null?[]:c.requests.filter(w=>!o.includes(w.locale)&&!(i&&i[w.locale]!==void 0&&i[w.locale]!==c.texts[w.locale])&&!(i&&w.sourceLocale&&i[w.sourceLocale]===w.previous))];for(const w of jo(l)){const y=h.findIndex(v=>PS(w,v));y>=0?h.splice(y,1):f(w)}for(const w of h){const y=p(),v=this.moddle.create(Pc,{locale:w.locale,...w.sourceLocale?{sourceLocale:w.sourceLocale}:{},previous:w.previous});v.$parent=l.extensionElements,y.push(v),u.push(()=>y.splice(y.indexOf(v),1))}const m=l.extensionElements;return m&&!m.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=m)),u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}Fn(Np,"$inject",["moddle"]);function $p(e){return jo(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class Fp{constructor(t){t.registerHandler(Oc,Ip),t.registerHandler(Bp,Np)}}Fn(Fp,"$inject",["commandStack"]);const jp={__init__:["translationCommands"],translationCommands:["type",Fp]},Yg=["participant.add","participant.update","node.add","node.update","sequenceFlow.add","sequenceFlow.update","messageFlow.add","messageFlow.update","dataStore.add","dataStore.update","dataAssociation.add","association.add","annotation.add","annotation.update","group.add","group.update","translation.confirm","element.remove"],TS={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},kS={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(Ac.map(e=>[e,{type:"string"}])),additionalProperties:!1},OS={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},DS={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},LS={type:"string",enum:[...Cc],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},IS={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Rc]},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},BS={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},NS={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},$S={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},FS={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},jS={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},HS={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},zS={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},GS={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},VS={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Ap]},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 WS={"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:[...Rc]},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:[...Ac],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":Pn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Kg={anyOf:Yg.map(e=>WS[e])},US={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:OS,irParticipant:DS,irNode:IS,irFlowCondition:BS,irSequenceFlow:NS,irMessageFlow:$S,irDataStore:FS,irDataAssociation:jS,irTextAnnotation:HS,irAssociation:zS,irGroup:GS,bwlPlacement:VS,eventDefinition:LS,localeTexts:kS,nullableString:TS,symbolicOp:Kg}};function Hp(){}Hp.prototype.get=function(e){return this.$model.properties.get(this,e)},Hp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Xg(e,t){this.model=e,this.properties=t}Xg.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Hp.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 qS=q(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Zg=q(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function zp(e,t){var n=Zg[e];return n?n(t):t}function Gp(e){return!!qS[e]}function Qg(e){return!!Zg[e]}function Hn(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 Bi(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=Hn(o[0],i),a=Hn(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=q({},r,{name:r.ns.localName,inherited:t}),Object.defineProperty(r,"definedBy",{value:e});var a=r.replaces,s=r.redefines;a||s?this.redefineProperty(r,a||s,a):(r.isBody&&this.setBodyProperty(r),r.isId&&this.setIdProperty(r),this.addProperty(r))},this)),i.push(e),n[o]=e)};function Ho(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,z(e,Xn(this.registerPackage,this))}Ho.prototype.getPackage=function(e){return this.packageMap[e]},Ho.prototype.getPackages=function(){return this.packages},Ho.prototype.registerPackage=function(e){e=q({},e);var t=this.packageMap;Jg(t,e,"prefix"),Jg(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)},Ho.prototype.registerType=function(e,t){e=q({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:q({},e.meta||{})});var n=Hn(e.name,t.prefix),i=n.name,o=Object.create(null);z(e.properties,Xn(function(r){var a=Hn(r.name,n.prefix),s=a.name;Gp(r.type)||(r.type=Hn(r.type,a.prefix).name),q(r,{ns:a,name:s}),o[s]=r},this)),q(e,{ns:n,name:i,propertiesByName:o}),z(e.extends,Xn(function(r){var a=Hn(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},Ho.prototype.mapTypes=function(e,t,n){var i=Gp(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=Hn(c,Gp(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)},Ho.prototype.getEffectiveDescriptor=function(e){var t=Hn(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},Ho.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Jg(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Mr(e){this.model=e}Mr.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;YS(n)?i?delete e[o]:delete e.$attrs[Vp(t)]:i?o in e?e[o]=n:em(e,i,n):e.$attrs[Vp(t)]=n},Mr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Vp(t)];var i=n.name;return!e[i]&&n.isMany&&em(e,n,[]),e[i]},Mr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=q({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Mr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Mr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Mr.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 YS(e){return typeof e>"u"}function em(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Vp(e){return e.replace(/^:/,"")}function bi(e,t={}){this.properties=new Mr(this),this.factory=new Xg(this,this.properties),this.registry=new Ho(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=Jn(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=Hn(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}),z(n,function(a,s){mn(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 tm=String.fromCharCode,KS=Object.prototype.hasOwnProperty,XS=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,ss={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(ss).forEach(function(e){ss[e.toUpperCase()]=ss[e]});function ZS(e,t,n,i){return i?KS.call(ss,i)?ss[i]:"&"+i+";":tm(t||parseInt(n,16))}function Ar(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(XS,ZS):e}var nm="non-whitespace outside of root node";function zo(e){return new Error(e)}function QS(e){return"missing namespace for prefix <"+e+">"}function Dc(e){return{get:e,enumerable:!0}}function JS(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var im=Symbol("nameCache");function Wp(e){return e+"$uri"}function eR(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Wp(i)]=n;return t}function Lc(){return{line:0,column:0}}function tR(e){throw e}function om(e){if(!this)return new om(e);var t=e&&e.proxy,n,i,o,r,a=tR,s,c,l,u,p=Lc,f=!1,d=!1,g="",h=!1,m=!1,w=null,y=!1,v,x,E,C;function D(j){j instanceof Error||(j=zo(j)),w=j,a(j,p)}function P(j){s&&(j instanceof Error||(j=zo(j)),s(j,p))}this.on=function(j,G){if(typeof G!="function")throw zo("required args <name, cb>");switch(j){case"openTag":i=G;break;case"text":n=G;break;case"closeTag":o=G;break;case"error":a=G;break;case"warn":s=G;break;case"cdata":r=G;break;case"attention":u=G;break;case"question":l=G;break;case"comment":c=G;break;default:throw zo("unsupported event: "+j)}return this},this.ns=function(j){if(typeof j>"u"&&(j={}),typeof j!="object")throw zo("required args <nsMap={}>");var G=Object.create(null),Q;for(Q in j)G[Q]=j[Q];return m=!0,C=G,this};function T(){v=m?[]:null,x=m?eR(C):null,E=[],p=Lc,y=!1,w=null,d=!1,g=""}this.parse=function(j){if(typeof j!="string")throw zo("required args <xml=string>");if(f)throw zo("parse during stream; call end() first");return T(),$(j),p=Lc,y=!1,w},this.write=function(j){if(typeof j!="string")throw zo("required args <xml=string>");return f||(T(),f=!0),w||(g=$(g+j,!0)||""),this},this.end=function(){return f||T(),f=!1,w||$(g),g="",p=Lc,y=!1,w},this.stop=function(){y=!0};function $(j,G=!1){var Q=null,te=null,V,ee=0,Ee=!1,Pe=!1,Se=0,K=0,oe,Y,Z,ce,xe,ke,N,M,S,W="",X=0,re;function Re(bt,on){var Mn=bt.indexOf(":");if(Mn===-1)return bt;var An=x[bt.substring(0,Mn)];return An?on===An?bt.substr(Mn+1):An+bt.substr(Mn):(P(QS(bt.substring(0,Mn))),null)}function et(){if(re!==null)return re;var bt,on,Mn=m&&x.xmlns,An=m&&h?[]:null,Nt=X,xn=W,Nn=xn.length,xr,vi,lo,ui,dn,uo={},Kr=new Set,Wn,mt,At;e:for(;Nt<Nn;Nt++)if(Wn=!1,mt=xn.charCodeAt(Nt),!(mt===32||mt<14&&mt>8)){for((mt<65||mt>122||mt>90&&mt<97)&&mt!==95&&mt!==58&&(P("illegal first char attribute name"),Wn=!0),At=Nt+1;At<Nn;At++)if(mt=xn.charCodeAt(At),!(mt>96&&mt<123||mt>64&&mt<91||mt>47&&mt<59||mt===46||mt===45||mt===95)){if(mt===32||mt<14&&mt>8){P("missing attribute value"),Nt=At;continue e}if(mt===61)break;P("illegal attribute name char"),Wn=!0}if(dn=xn.substring(Nt,At),dn==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),Wn=!0),mt=xn.charCodeAt(At+1),mt===34)At=xn.indexOf('"',Nt=At+2),At===-1&&(At=xn.indexOf("'",Nt),At!==-1&&(P("attribute value quote missmatch"),Wn=!0));else if(mt===39)At=xn.indexOf("'",Nt=At+2),At===-1&&(At=xn.indexOf('"',Nt),At!==-1&&(P("attribute value quote missmatch"),Wn=!0));else for(P("missing attribute value quotes"),Wn=!0,At=At+1;At<Nn&&(mt=xn.charCodeAt(At+1),!(mt===32||mt<14&&mt>8));At++);for(At===-1&&(P("missing closing quotes"),At=Nn,Wn=!0),Wn||(lo=xn.substring(Nt,At)),Nt=At;At+1<Nn&&(mt=xn.charCodeAt(At+1),!(mt===32||mt<14&&mt>8));At++)Nt===At&&(P("illegal character after attribute end"),Wn=!0);if(Nt=At+1,Wn)continue e;if(Kr.has(dn)){P("attribute <"+dn+"> already defined");continue}if(Kr.add(dn),!m){uo[dn]=lo;continue}if(h){if(vi=dn==="xmlns"?"xmlns":dn.charCodeAt(0)===120&&dn.substr(0,6)==="xmlns:"?dn.substr(6):null,vi!==null){if(bt=Ar(lo),on=Wp(vi),ui=C[bt],!ui){if(vi==="xmlns"||on in x&&x[on]!==bt)do ui="ns"+ee++;while(typeof x[ui]<"u");else ui=vi;C[bt]=ui}x[vi]!==ui&&(xr||(x=JS(x),xr=!0),x[vi]=ui,vi==="xmlns"&&(x[Wp(ui)]=bt,Mn=ui),x[on]=bt),uo[dn]=lo;continue}An.push(dn,lo);continue}dn=Re(dn,Mn),dn!==null&&(uo[dn]=lo)}if(h)for(Nt=0,Nn=An.length;Nt<Nn;Nt++)dn=Re(An[Nt++],Mn),lo=An[Nt],dn!==null&&(uo[dn]=lo);return re=uo}function yt(){for(var bt=/(\r\n|\r|\n)/g,on=0,Mn=0,An=0,Nt=K,xn,Nn;Se>=An&&(xn=bt.exec(j),!(!xn||(Nt=xn[0].length+xn.index,Nt>Se)));)on+=1,An=Nt;return Se==-1?(Mn=Nt,Nn=j.substring(K)):K===0?Nn=j.substring(K,Se):(Mn=Se-An,Nn=K==-1?j.substring(Se):j.substring(Se,K+1)),{data:Nn,line:on,column:Mn}}for(p=yt,t&&(S=Object.create({},{name:Dc(function(){return N}),originalName:Dc(function(){return M}),attrs:Dc(et),ns:Dc(function(){return x})}));K!==-1;){if(j.charCodeAt(K)===60?Se=K:Se=j.indexOf("<",K),Se===-1){if(G)return j.substring(K);if(E.length)return D("unexpected end of file");if(!d)return D("missing start tag");K<j.length&&j.substring(K).trim()&&P(nm);return}if(d||(d=!0),K!==Se){if(E.length){if(n&&(n(j.substring(K,Se),Ar,p),y))return}else if(j.substring(K,Se).trim()&&(P(nm),y))return}if(ce=j.charCodeAt(Se+1),ce===33){if(Z=j.charCodeAt(Se+2),Z===91&&j.substr(Se+3,6)==="CDATA["){if(K=j.indexOf("]]>",Se),K===-1)return G?j.substring(Se):D("unclosed cdata");if(r&&(r(j.substring(Se+9,K),p),y))return;K+=3;continue}if(Z===45&&j.charCodeAt(Se+3)===45){if(K=j.indexOf("-->",Se),K===-1)return G?j.substring(Se):D("unclosed comment");if(c&&(c(j.substring(Se+4,K),Ar,p),y))return;K+=3;continue}}if(ce===63){if(K=j.indexOf("?>",Se),K===-1)return G?j.substring(Se):D("unclosed question");if(l&&(l(j.substring(Se,K+2),p),y))return;K+=2;continue}for(oe=Se+1;;oe++){if(xe=j.charCodeAt(oe),isNaN(xe))return G?j.substring(Se):(K=-1,D("unclosed tag"));if(xe===34)Z=j.indexOf('"',oe+1),oe=Z!==-1?Z:oe;else if(xe===39)Z=j.indexOf("'",oe+1),oe=Z!==-1?Z:oe;else if(xe===62){K=oe;break}}if(ce===33){if(u&&(u(j.substring(Se,K+1),Ar,p),y))return;K+=1;continue}if(re={},ce===47){if(Ee=!1,Pe=!0,!E.length)return D("missing open tag");if(oe=N=E.pop(),Z=Se+2+oe.length,j.substring(Se+2,Z)!==oe)return D("closing tag mismatch");for(;Z<K;Z++)if(ce=j.charCodeAt(Z),!(ce===32||ce>8&&ce<14))return D("close tag")}else{if(j.charCodeAt(K-1)===47?(oe=N=j.substring(Se+1,K-1),Ee=!0,Pe=!0):(oe=N=j.substring(Se+1,K),Ee=!0,Pe=!1),!(ce>96&&ce<123||ce>64&&ce<91||ce===95||ce===58))return D("illegal first char nodeName");for(Z=1,Y=oe.length;Z<Y;Z++)if(ce=oe.charCodeAt(Z),!(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){N=oe.substring(0,Z),re=null;break}return D("invalid nodeName")}Pe||E.push(N)}if(m){V=x,Ee&&(Pe||v.push(V),re===null&&(h=oe.indexOf("xmlns",Z)!==-1)&&(X=Z,W=oe,et(),h=!1)),M=N,te!==x&&(Q=x[im],Q===void 0&&(Q=x[im]=Object.create(null)),te=x);var It=Q[N];if(It!==void 0)N=It;else{if(ce=N.indexOf(":"),ce!==-1){if(ke=x[N.substring(0,ce)],!ke)return D("missing namespace on <"+M+">");N=N.substr(ce+1)}else ke=x.xmlns;ke&&(N=ke+":"+N),Q[M]=N}}if(Ee&&(X=Z,W=oe,i&&(t?i(S,Ar,Pe,p):i(N,et,Ar,Pe,p),y)))return;if(Pe){if(o&&(o(t?S:N,Ar,Ee,p),y))return;m&&(Ee?x=V:x=v.pop())}K+=1}}}function rm(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Up={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},am="property";function sm(e){return e.xml&&e.xml.serialize}function nR(e){const t=sm(e);return t!==am&&(t||null)}function iR(e){return e.charAt(0).toUpperCase()+e.slice(1)}function cm(e,t){return rm(t)?e.prefix+":"+iR(e.localName):e.name}function oR(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 rR(e,t,n){const i=Hn(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=Hn(o);var a=n.getPackage(r.prefix);return oR(r,a)}function Go(e){return new Error(e)}function go(e){return e.$descriptor}function aR(e){q(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Go("expected element");var n=this.elementsById,i=go(t),o=i.idProperty,r;if(o&&(r=t.get(o.name),r)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(r))throw new Error("illegal ID <"+r+">");if(n[r])throw Go("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function cs(){}cs.prototype.handleEnd=function(){},cs.prototype.handleText=function(){},cs.prototype.handleNode=function(){};function qp(){}qp.prototype=Object.create(cs.prototype),qp.prototype.handleNode=function(){return this};function la(){}la.prototype=Object.create(cs.prototype),la.prototype.handleText=function(e){this.body=(this.body||"")+e};function ls(e,t){this.property=e,this.context=t}ls.prototype=Object.create(la.prototype),ls.prototype.handleNode=function(e){if(this.element)throw Go("expected no sub nodes");return this.element=this.createReference(e),this},ls.prototype.handleEnd=function(){this.element.id=this.body},ls.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Yp(e,t){this.element=t,this.propertyDesc=e}Yp.prototype=Object.create(la.prototype),Yp.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=zp(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Ic(){}Ic.prototype=Object.create(la.prototype),Ic.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function Un(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Un.prototype=Object.create(Ic.prototype),Un.prototype.addReference=function(e){this.context.addReference(e)},Un.prototype.handleText=function(e){var t=this.element,n=go(t),i=n.bodyProperty;if(!i)throw Go("unexpected body text <"+e+">");la.prototype.handleText.call(this,e)},Un.prototype.handleEnd=function(){var e=this.body,t=this.element,n=go(t),i=n.bodyProperty;i&&e!==void 0&&(e=zp(i.type,e),t.set(i.name,e))},Un.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=go(n),o=this.context,r=new n({}),a=this.model,s;return 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=zp(u.type,c):l==="xmlns"?l=":"+l:(s=Hn(l,i.ns.prefix),a.getPackage(s.prefix)&&o.addWarning({message:"unknown attribute <"+l+">",element:r,property:l,value:c})),r.set(l,c))}),r},Un.prototype.getPropertyForNode=function(e){var t=e.name,n=Hn(t),i=this.type,o=this.model,r=go(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=nR(s);if(l){const u=e.attributes[l];if(u){const p=rR(u,e.ns,o),f=o.getType(p);return q({},s,{effectiveType:go(f).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=cm(n,c),u=o.getType(l);if(s=Bt(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return q({},s,{effectiveType:go(u).name})}else if(s=Bt(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw Go("unrecognized element <"+n.name+">")},Un.prototype.toString=function(){return"ElementDescriptor["+go(this.type).name+"]"},Un.prototype.valueHandler=function(e,t){return new Yp(e,t)},Un.prototype.referenceHandler=function(e){return new ls(e,this.context)},Un.prototype.handler=function(e){return e==="Element"?new ua(this.model,e,this.context):new Un(this.model,e,this.context)},Un.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,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?(q(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function Kp(e,t,n){Un.call(this,e,t,n)}Kp.prototype=Object.create(Un.prototype),Kp.prototype.createElement=function(e){var t=e.name,n=Hn(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&cm(n,r)||t;if(!o.hasType(a))throw Go("unexpected element <"+e.originalName+">");return Un.prototype.createElement.call(this,e)};function ua(e,t,n){this.model=e,this.context=n}ua.prototype=Object.create(Ic.prototype),ua.prototype.createElement=function(e){var t=e.name,n=Hn(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},ua.prototype.handleChild=function(e){var t=new ua(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,o;return i!==void 0&&(o=n.$children=n.$children||[],o.push(i),i.$parent=n),t},ua.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Xp(e){e instanceof bi&&(e={model:e}),q(this,{lax:!1},e)}Xp.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Un?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var o=this.model,r=this.lax,a=new aR(q({},t,{rootHandler:i})),s=new om({proxy:!0}),c=sR();i.context=a,c.push(i);function l(E,C,D){var P=C(),T=P.line,$=P.column,j=P.data;j.charAt(0)==="<"&&j.indexOf(" ")!==-1&&(j=j.slice(0,j.indexOf(" "))+">");var G="unparsable content "+(j?j+" ":"")+`detected
|
|
2
2
|
line: `+T+`
|
|
3
|
-
column:
|
|
4
|
-
nested error: `+E.message;if(D)return a.addWarning({message:
|
|
5
|
-
`,
|
|
6
|
-
`),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function _R(e){e=q({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new xR,r=new wR(o,e.format);e.preamble&&r.append(aR);var a=new zt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(ER(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function ER(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Wp)n[i]=Wp[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 Ic(e,t){xi.call(this,e,t)}Ic.prototype=Object.create(xi.prototype),Ic.prototype.fromXML=function(e,t,n){Jn(t)||(n=t,t="bpmn:Definitions");var i=new Kp(q({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},Ic.prototype.toXML=function(e,t){var n=new _R(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var SR="BPMN20",RR="http://www.omg.org/spec/BPMN/20100524/MODEL",CR="bpmn",MR=[],AR=[{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"}]}],PR=[{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"}]}],TR={tagAlias:"lowerCase",typePrefix:"t"},kR={name:SR,uri:RR,prefix:CR,associations:MR,types:AR,enumerations:PR,xml:TR},OR="BPMNDI",DR="http://www.omg.org/spec/BPMN/20100524/DI",LR="bpmndi",IR=[{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"]}],BR=[{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"}]}],NR=[],$R={name:OR,uri:DR,prefix:LR,types:IR,enumerations:BR,associations:NR},FR="DC",jR="http://www.omg.org/spec/DD/20100524/DC",HR="dc",zR=[{name:"Boolean"},{name:"Integer"},{name:"Real"},{name:"String"},{name:"Font",properties:[{name:"name",type:"String",isAttr:!0},{name:"size",type:"Real",isAttr:!0},{name:"isBold",type:"Boolean",isAttr:!0},{name:"isItalic",type:"Boolean",isAttr:!0},{name:"isUnderline",type:"Boolean",isAttr:!0},{name:"isStrikeThrough",type:"Boolean",isAttr:!0}]},{name:"Point",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0}]},{name:"Bounds",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0},{name:"width",type:"Real",isAttr:!0},{name:"height",type:"Real",isAttr:!0}]}],GR=[],VR={name:FR,uri:jR,prefix:HR,types:zR,associations:GR},WR="DI",UR="http://www.omg.org/spec/DD/20100524/DI",qR="di",YR=[{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"}]}],KR=[],XR={tagAlias:"lowerCase"},ZR={name:WR,uri:UR,prefix:qR,types:YR,associations:KR,xml:XR},QR="bpmn.io colors for BPMN",JR="http://bpmn.io/schema/bpmn/biocolor/1.0",eC="bioc",tC=[{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"}]}],nC=[],iC=[],oC={name:QR,uri:JR,prefix:eC,types:tC,enumerations:nC,associations:iC},rC="BPMN in Color",aC="http://www.omg.org/spec/BPMN/non-normative/color/1.0",sC="color",cC=[{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"}]}],lC=[],uC=[],pC={name:rC,uri:aC,prefix:sC,types:cC,enumerations:lC,associations:uC};const fC={bpmn:kR,bpmndi:$R,dc:VR,di:ZR,bioc:oC,color:pC};function fm(e,t){const n=q({},fC,e);return new Ic(n,t)}const dC={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"}},Bc={[Ug]:dC,[Cp]:Hg};function dm(){return fm(Bc)}const hm=dm();async function la(e){const{rootElement:t,warnings:n}=await hm.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function hC(e){const{xml:t}=await hm.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},gC=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function mC(e){const t=ua;return gC.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*mC(i);return n}function gm(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&yC(e),vC(e),bC(e),xC(e)}function yC(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 vC(e){if(e.SVGMatrix)return;class t{constructor(){Bn(this,"a",1);Bn(this,"b",0);Bn(this,"c",0);Bn(this,"d",1);Bn(this,"e",0);Bn(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 bC(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 xC(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 Nc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),wC=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),_C=1,$c=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),EC=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 mm=20,Fc=5,ym=3,SC=8,fa=15,Jp=50,vm=12,RC=vm*1.2;function ef(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>pa(r,vm))),o=n.length*RC;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-o/2,width:i,height:o}}const bm=1;function tn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],o=e.waypoints[n+1];Math.abs(i.y-o.y)<.5&&Math.abs(i.x-o.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,o.x),hi:Math.max(i.x,o.x),dir:o.x>i.x?1:-1}):Math.abs(i.x-o.x)<.5&&Math.abs(i.y-o.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,o.y),hi:Math.max(i.y,o.y),dir:o.y>i.y?1:-1})}return t}function Pr(e,t){let n=null;const i=e.type!==t.type,r=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of tn(e))for(const s of tn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>bm)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>=mm&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function tf(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function xm(e,t){const n=Pr(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function CC(e,t){let n=0;for(const i of t)i.id!==e.id&&xm(e,i)&&n++;return n}function fi(e,t){let n=0;for(const i of t)i.id!==e.id&&Pr(e,i)&&n++;return n}const wm=15,_m=20;function MC(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-_m||t.at>n[1]+_m)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 nf=20;function jc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>bm)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<mm||n.push([o-nf,r+nf])}return n}function Hc(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of tn(e)){const r=MC(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of jc(o,tn(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const AC=10,PC=1,TC=(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 kC(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 of(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 OC=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,da=1;function $i(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 Em(e,t){const n=e.label;if(!n)return null;if(tn(e).some(i=>$i(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(tn(i).some(o=>$i(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=>$i(n,o)))return i.id;return null}function jt(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(kC(e.waypoints[r],e.waypoints[r+1],o,EC)){i.push(o);break}}return i}const cs=(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))},DC=(e,t,n,i)=>Rm(e,t,n,i)?0:Math.min(cs(e,n,i),cs(t,n,i),cs(n,e,t),cs(i,e,t)),Sm=(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 ls(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,cs({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(Sm(e,s)||Sm(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,DC(e,t,s[l],s[(l+1)%s.length]));return c}function Rm(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 rf=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Cm(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(Rm(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function us(e,t){let n=0;for(const i of t)i.id===e.id||rf(e,i)||Cm(e,i)&&n++;return n}function di(e,t){let n=0;for(const i of t)i.id===e.id||rf(e,i)||us(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Mm(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)us(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function go(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(us(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 Fi(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(rf(n[i],n[o])&&Cm(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 Am(e){const t=go(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:LC(e)}}function LC(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 Pm(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!$c.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 Tm(e){var n;const t=(n=Ht(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const o=Ht(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 km=e=>e?{members:e}:{},Fn=e=>e.shapes.filter(t=>!t.container);function IC(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 BC(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 Om(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(tn(i).some(o=>$i(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=>$i(n,o)))return i.id;return null}function Go(e){const t=[];for(const n of e.shapes)n.label&&t.push({owner:n.id,rect:n.label});for(const n of e.edges)n.label&&t.push({owner:n.id,rect:n.label});return t}const Dm=3;function Lm(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 ps(e,t){const n=[];for(const i of t.shapes){if(i.container||$c.has(i.type))continue;const o=Lm(e,i);o>=Dm&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function af(e){const t=[],n=e.filter(o=>o.type==="bpmn:Participant"),i=(o,r)=>o.x<=r.x&&o.y<=r.y&&o.x+o.width>=r.x+r.width&&o.y+o.height>=r.y+r.height;for(let o=0;o<n.length;o++)for(let r=o+1;r<n.length;r++){const a=n[o],s=n[r];a.x+a.width<=s.x||s.x+s.width<=a.x||a.y+a.height<=s.y||s.y+s.height<=a.y||t.push({pools:[a.id,s.id],contained:i(a,s)||i(s,a)})}return t}function pt(e,t={}){const n=[],i=e.shapes.filter(y=>!y.container);for(const y of e.edges)for(const v of jt(y,i))n.push({kind:"edge-crosses-shape",edge:y.id,shape:v.id});const o=e.shapes.filter(y=>y.container&&wC.has(y.type));if(o.length){const y=(v,x)=>{const E=e.shapes.find(M=>M.id===x);return!!E&&E.x>=v.x&&E.y>=v.y&&E.x+E.width<=v.x+v.width&&E.y+E.height<=v.y+v.height};for(const v of e.edges)for(const x of jt(v,o))v.endpoints.includes(x.id)||v.endpoints.some(E=>y(x,E))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:x.id})}for(const y of e.edges){if(y.waypoints.length<2)continue;const v=[[y.source,y.waypoints[0]],[y.target,y.waypoints[y.waypoints.length-1]]];for(const[x,E]of v){if(!x)continue;const M=e.shapes.find(N=>N.id===x);if(!M||M.container)continue;const D=Math.max(M.x-E.x,E.x-(M.x+M.width),0),P=Math.max(M.y-E.y,E.y-(M.y+M.height),0),T=Math.hypot(D,P);T>AC&&n.push({kind:"edge-endpoint-detached",edge:y.id,shape:x,distance:Math.round(T)})}}for(const y of af(e.shapes))n.push({kind:"pool-overlap",...y});const r=i.filter(y=>!y.attached);for(let y=0;y<r.length;y++)for(let v=y+1;v<r.length;v++){const x=r[y],E=r[v];if(!of(x,E,_C))continue;const M=x.id<E.id?[x.id,E.id]:[E.id,x.id];n.push({kind:"shape-overlap",shapes:M,identical:OC(x,E)})}const a=e.shapes.filter(y=>y.type==="bpmn:Group"&&Array.isArray(y.members)&&y.members.length>0);for(let y=0;y<a.length;y++)for(let v=y+1;v<a.length;v++){const x=a[y],E=a[v],M=Math.min(x.x+x.width,E.x+E.width)-Math.max(x.x,E.x),D=Math.min(x.y+x.height,E.y+E.height)-Math.max(x.y,E.y);if(M<=Fc||D<=Fc)continue;const P=x.id<E.id?[x.id,E.id]:[E.id,x.id],T=new Set(E.members);if(x.members.some(j=>T.has(j))){const j=Pm(e,a,{x:Math.max(x.x,E.x),y:Math.max(x.y,E.y),right:Math.min(x.x+x.width,E.x+E.width),bottom:Math.min(x.y+x.height,E.y+E.height)});j.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:P,shapes:j});continue}const N=x.x<=E.x&&x.y<=E.y&&x.x+x.width>=E.x+E.width&&x.y+x.height>=E.y+E.height?x.id:E.x<=x.x&&E.y<=x.y&&E.x+E.width>=x.x+x.width&&E.y+E.height>=x.y+x.height?E.id:void 0;n.push({kind:"group-overlap-unintended",groups:P,...N?{container:N}:{}})}const s=new Set(a.flatMap(y=>[...y.members])),c=y=>e.shapes.filter(v=>!v.container&&!$c.has(v.type)&&v.x>=y.x&&v.y>=y.y&&v.x+v.width<=y.x+y.width&&v.y+v.height<=y.y+y.height);for(const y of a){const v=c(y);if(!v.length)continue;const x=new Set(y.members),E=v.filter(M=>!x.has(M.id));E.some(M=>s.has(M.id))&&(E.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:y.id,shapes:E.map(M=>M.id).sort()}))}for(const y of a){const v=new Set(c(y).map(T=>T.id)),x=new Set(y.members),E=new Set([...v].filter(T=>!x.has(T)&&s.has(T)));if(!E.size)continue;let M=!1,D=!1,P=!1;for(const T of e.edges){if(T.type!=="bpmn:SequenceFlow"||!T.source||!T.target)continue;const N=E.has(T.source),j=E.has(T.target);!N&&j&&!v.has(T.source)?M=!0:N&&!j&&!v.has(T.target)?D=!0:N&&j&&(P=!0)}M&&D&&P&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:y.id,shapes:[...E].sort()})}const l=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<l.length;y++)for(let v=y+1;v<l.length;v++)for(let x=v+1;x<l.length;x++){const E=[l[y],l[v],l[x]],M={x:Math.max(...E.map(T=>T.x)),y:Math.max(...E.map(T=>T.y)),right:Math.min(...E.map(T=>T.x+T.width)),bottom:Math.min(...E.map(T=>T.y+T.height))};if(M.right-M.x<=Fc||M.bottom-M.y<=Fc)continue;const D=Pm(e,[],M);if(!D.length)continue;const P=E.map(T=>T.id).sort();n.push({kind:"group-stack-unreadable",groups:P,shapes:D})}for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||$c.has(v.type)||v.width<=0||v.height<=0)continue;const x=[["top",y.y,"h",y.x,y.x+y.width],["bottom",y.y+y.height,"h",y.x,y.x+y.width],["left",y.x,"v",y.y,y.y+y.height],["right",y.x+y.width,"v",y.y,y.y+y.height]];for(const[E,M,D,P,T]of x){const N=D==="h"?v.x:v.y,j=D==="h"?v.x+v.width:v.y+v.height;if(!(N<T&&P<j))continue;const V=D==="h"?v.y:v.x,Q=D==="h"?v.y+v.height:v.x+v.width;if(!(V<M&&M<Q))continue;const ne=Math.min(M-V,Q-M);ne<SC||n.push({kind:"group-cuts-shape",group:y.id,shape:v.id,side:E,depth:ne})}}const u=t.includeObservationOnly?e.shapes.filter(y=>y.type==="bpmn:Group"&&y.width>0&&y.height>0):[];if(u.length){const y=new Map(e.shapes.filter(v=>!v.container).map(v=>[v.id,{x:v.x+v.width/2,y:v.y+v.height/2}]));for(const v of e.edges){if(v.type!=="bpmn:SequenceFlow"&&v.type!=="bpmn:MessageFlow")continue;const x=tn(v);if(x.length)for(const E of u){const M=E.x+E.width,D=E.y+E.height,P=v.endpoints.some(N=>{const j=y.get(N);return!!j&&E.x<j.x&&j.x<M&&E.y<j.y&&j.y<D});let T=null;for(const N of x){const[j,V,Q]=N.axis==="v"?[E.y,D,[["left",E.x],["right",M]]]:[E.x,M,[["top",E.y],["bottom",D]]],ne=Math.min(N.hi,V)-Math.max(N.lo,j);if(ne<Jp)continue;const W=N.axis==="v"?E.x<N.at&&N.at<M:E.y<N.at&&N.at<D;if(!(W&&P))for(const[te,xe]of Q){const Oe=Math.abs(N.at-xe);Oe<=fa&&(!T||Oe<T.distance)&&(T={side:te,inside:W,distance:Oe,length:ne})}}T&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:E.id,side:T.side,inside:T.inside,distance:Math.round(T.distance),length:Math.round(T.length)})}}}const p=e.shapes.filter(y=>y.container&&y.type!=="bpmn:Group"&&y.type!=="bpmn:Lane");for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of p){const x=y.x<v.x+v.width&&v.x<y.x+y.width,E=y.y<v.y+v.height&&v.y<y.y+y.height,M=[["top",y.y,v.y,x],["bottom",y.y+y.height,v.y+v.height,x],["left",y.x,v.x,E],["right",y.x+y.width,v.x+v.width,E]];for(const[D,P,T,N]of M)N&&Math.abs(P-T)<=ym&&n.push({kind:"group-on-container-boundary",group:y.id,container:v.id,side:D})}const f=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<f.length;y++)for(let v=y+1;v<f.length;v++){const x=f[y],E=f[v],M=x.x<E.x+E.width&&E.x<x.x+x.width,D=x.y<E.y+E.height&&E.y<x.y+x.height,P=[["x",x.x+x.width,E.x,D],["x",E.x+E.width,x.x,D],["y",x.y+x.height,E.y,M],["y",E.y+E.height,x.y,M]];for(const[T,N,j,V]of P)if(V&&Math.abs(N-j)<=ym){n.push({kind:"group-on-group-boundary",groups:x.id<E.id?[x.id,E.id]:[E.id,x.id],axis:T});break}}for(let y=0;y<e.edges.length;y++)for(let v=y+1;v<e.edges.length;v++){const x=e.edges[y],E=e.edges[v],M=Pr(x,E);if(!M)continue;const D=x.id<E.id?[x.id,E.id]:[E.id,x.id];n.push({kind:M.kind==="opposite"?"edge-overlap-opposite":M.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:D,axis:M.axis,length:Math.round(M.length)})}for(const y of e.edges){if(!y.label)continue;const v=Hc(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=Em(y,e);v&&n.push({kind:"label-over-line",edge:y.id,line:v})}if(t.includeObservationOnly){for(const y of e.edges)if(!(!y.label||y.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:x}of ps(y.label,e))n.push({kind:"label-over-shape",edge:y.id,shape:v,depth:Math.round(x)})}const d=new Set(i.map(y=>y.id)),g=e.shapes.filter(y=>y.type==="bpmn:Participant"&&y.label);for(const y of[...i,...g.filter(v=>!d.has(v.id))]){if(!y.label)continue;const v=Om(y,e);v&&n.push({kind:"label-over-line",edge:y.id,line:v})}const h=new Set(e.shapes.filter(y=>y.type==="bpmn:TextAnnotation").map(y=>y.id));for(const y of g)for(const{owner:v,rect:x}of Go(e))v===y.id||h.has(v)||of(y.label,x,da)&&n.push({kind:"pool-name-over-label",pool:y.id,label:v});const m=Go(e);for(const y of i)if(y.type==="bpmn:TextAnnotation")for(const{owner:v,rect:x}of m)v!==y.id&&of(y,x,da)&&n.push({kind:"annotation-over-label",annotation:y.id,label:v});const w=new Map(e.shapes.map(y=>[y.id,y]));for(const y of i){const v=y.parent??IC(y,e,w);if(!v)continue;const x=w.get(v);!x||!x.container||TC(x,y,PC)||y.type==="bpmn:TextAnnotation"&&!BC(y,x,e)||n.push({kind:"shape-outside-container",shape:y.id,container:x.id})}return n.sort((y,v)=>ct(y).localeCompare(ct(v)))}const Ht=e=>typeof e=="object"&&e!==null?e:void 0,Qt=e=>typeof e=="number"?e:0,mo=e=>{const t=Ht(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function NC(e){const t=Ht(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=mo(r);a&&n.push(a)}}return n}function $C(e){const t=Ht(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:mo(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:mo(t.targetRef);return n&&i?{source:n,target:i}:{}}function FC(e,t){const n=Ht(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=mo(n);return o?t.get(o):void 0}if(Nc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return mo(n)}function Im(e){var a,s,c,l,u;const t=[],n=[],i=((a=Ht(e))==null?void 0:a.diagrams)??[],o=new Map,r=new Set;for(const p of((s=Ht(e))==null?void 0:s.rootElements)??[]){const f=Ht(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=Ht(d),h=mo(g),m=mo(g==null?void 0:g.processRef);h&&m?o.set(m,h):h&&r.add(h)}}for(const p of i){const f=Ht((c=Ht(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=Ht(g);if(!h)continue;const m=Ht(h.bpmnElement),w=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!w)continue;const y=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",v=Ht(h.bounds);if(v){const E=h.isExpanded===!1&&y!=="bpmn:Participant",M=Ht((l=Ht(h.label))==null?void 0:l.bounds),D={id:w,type:y,x:Qt(v.x),y:Qt(v.y),width:Qt(v.width),height:Qt(v.height),container:Nc.has(y)&&!E,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:FC(m,o)}:{},...M?{label:{x:Qt(M.x),y:Qt(M.y),width:Qt(M.width),height:Qt(M.height)}}:{},...y==="bpmn:Group"?km(Tm(m)):{}},P=h.isHorizontal!==!1,T=typeof(m==null?void 0:m.name)=="string"?m.name:"";r.has(w)&&P&&T&&(D.label=ef(D,T)),t.push(D);continue}const x=h.waypoint;if(Array.isArray(x)){const E=Ht((u=Ht(h.label))==null?void 0:u.bounds);n.push({id:w,type:y,waypoints:x.map(M=>{var D,P;return{x:Qt((D=Ht(M))==null?void 0:D.x),y:Qt((P=Ht(M))==null?void 0:P.y)}}),endpoints:NC(m),...$C(m),...E?{label:{x:Qt(E.x),y:Qt(E.y),width:Qt(E.width),height:Qt(E.height)}}:{}})}}}return{shapes:t,edges:n}}function Bm(e){return pt(Im(e),{includeObservationOnly:!0})}async function jC(e){const{definitions:t,warnings:n}=await la(e);return{findings:Bm(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=Ht(r.label),m=mo(r.source),w=mo(r.target);n.push({id:r.id,type:a,waypoints:s.map(y=>({x:Qt(y.x),y:Qt(y.y)})),endpoints:[m,w].filter(y=>!!y),...m&&w?{source:m,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=Ht(r.businessObject),l=Ht(r.label);let u=Ht(r.parent);for(;u&&u.type==="bpmn:Lane";)u=Ht(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&Nc.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:Nc.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"?km(Tm(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=Ht(r.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=ef(d,g)),t.push(d)}return{shapes:t,edges:n}}const HC={"bpmn:Participant":"participant","bpmn:Lane":"lane","bpmn:SequenceFlow":"sequenceFlow","bpmn:MessageFlow":"messageFlow","bpmn:DataStoreReference":"dataStore","bpmn:DataInputAssociation":"dataAssociation","bpmn:DataOutputAssociation":"dataAssociation","bpmn:TextAnnotation":"annotation","bpmn:Association":"association","bpmn:Group":"group"};function zC(e,t){const n=HC[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Nm(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function $m(e){const t=()=>e.getAll().filter(n=>n.type!=="label"&&!("labelTarget"in n&&n.labelTarget));return{isCollaboration:()=>t().some(n=>n.type==="bpmn:Participant"),categoryOf:n=>{const i=e.get(n);if(!(!i||i.type==="label"))return zC(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Nm(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?Nm(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 Rp(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:Fo(i.businessObject).map(o=>o.locale)}}}const sf=20,GC=4,Ve=(e,t)=>Math.abs(e-t)<.5;function zc(e,t,n,i=sf){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 Fm(e,t,n,i=sf){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 jm(e,t,n=sf){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 Gc(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 Vc=30,VC=[0,-25,25,-40,40];function WC(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+Vc:s-Vc,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return VC.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}]).filter(f=>jt({...e,endpoints:[],waypoints:f},[n]).length===0)}const cf=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],ga=(e,t,n)=>jt({...e,waypoints:t},n).length;function Wc(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 Gc(e,t))if(ga(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(tn),c=p=>tn({...e,waypoints:p}).some(f=>jc(f,s).length>0),l=WC(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 g=t.filter(y=>!e.endpoints.includes(y.id)&&jt({...e,waypoints:d},[y]).length>0),h=g.length>=2?Fm(d[0],d[1],g):null,w=(h?h.map(y=>[d[0],...y,d[1]]):g.length===1?(zc(d[0],d[1],g[0])??[]).map(y=>[d[0],...y,d[1]]):g.length===0?[d]:[]).filter(y=>ga(e,y,t)===0&&y.length<=o.length).sort((y,v)=>Number(u(v))-Number(u(y)));if(w.length)return w.find(y=>!c(y))??w[0]}}}for(let p=0;p+1<o.length;p++){const f=o[p],d=o[p+1],g=t.filter(w=>!e.endpoints.includes(w.id)&&jt({...e,waypoints:[f,d]},[w]).length>0);if(g.length<2)continue;const h=Fm(f,d,g);if(!h)continue;const m=h.map(w=>cf(o,p,w)).filter(w=>ga(e,w,t)===0).sort((w,y)=>Number(u(y))-Number(u(w)));if(m.length)return m.find(w=>!c(w))??m[0]}for(let p=0;p<GC&&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)||jt({...e,waypoints:[g,h]},[m]).length===0)continue;const w=zc(g,h,m),y=w?w.map(x=>cf(o,d,x)):jm(o,m)??[];if(!y.length)continue;const v=[...y].sort((x,E)=>Number(u(E))-Number(u(x)));for(const x of v){const E=ga(e,x,t);if(E<r){o=x,r=E,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&r===0?o:null}function lf(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=Fn(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=jt(p,a);if(!n&&h.length&&h.every(x=>x.type==="bpmn:TextAnnotation")){s.add(u);continue}const m=Wc(p,a,g,r.edges);if(!m){h.some(x=>x.type==="bpmn:TextAnnotation")&&s.add(u);continue}const w=r.edges.filter(x=>x.id!==u),y=fi(p,w);fi({...p,waypoints:m},w)>y||o.updateWaypoints(f,m)}return s}const UC=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 Uc(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 uf=(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),pf=(e,t)=>us(e,[t])>0;function Hm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=Fn(r);let s=r;const c=new Set(pt(r).map(ct));for(const[l,u]of go(r))if(!t.has(`${l}|${u}`))for(const[p,f]of[[l,u],[u,l]]){if(n.has(p))continue;const d=s.edges.find(D=>D.id===p),g=s.edges.find(D=>D.id===f);if(!d||!g)continue;const h=i.get(p);if(!h)continue;const m=Uc(h),w=UC(g),y=[...Gc(d,a)??[]],v=Wc(d,[...a,...w],m,r.edges);v&&y.push(v);for(let D=0;D+1<d.waypoints.length;D++)for(const P of w)for(const T of zc(d.waypoints[D],d.waypoints[D+1],P)??[])y.push(cf(d.waypoints,D,T));const x=s.edges.filter(D=>D.id!==p),E=D=>({...s,edges:s.edges.map(P=>P.id===p?{...P,waypoints:D}:P)}),M=y.find(D=>{const P={...d,waypoints:D};return pf(P,g)||!uf(D,m)||x.some(T=>T.id!==f&&!pf(d,T)&&pf(P,T))?!1:pt(E(D)).every(T=>c.has(ct(T)))});if(M){o.updateWaypoints(h,M),s=E(M);break}}}const qC=["top","bottom","left","right"],zm={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},fs=20,YC=20;function KC(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 XC=(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 Gm(e,t,n,i){const o=zm[t],r=zm[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])>=fs?[e,n]:null;let h;if(d===-g){const w=e[p]+d*fs,y=n[p]-d*fs;if(d*(y-w)<0)return null;h=Math.round((e[p]+n[p])/2)}else h=d>0?Math.max(e[p],n[p])+Vc:Math.min(e[p],n[p])-Vc;const m=(w,y)=>a?{x:y,y:w}:{x:w,y};return[e,m(h,e[f]),m(h,n[f]),n]}const c=a?{x:e.x,y:n.y}:{x:n.x,y:e.y},l=a?o.y*(c.y-e.y):o.x*(c.x-e.x),u=s?r.y*(c.y-n.y):r.x*(c.x-n.x);return l>=fs&&u>=fs?[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?KC(a,r):null;if(!s)return[];const c=[];for(const l of qC){const u=XC(t,l),p=o?Gm(u,l,a,s):Gm(a,s,u,l);p&&c.push(p)}return c}const Vm=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 QC(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 Fi(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(T=>T.id===l),f=c.edges.find(T=>T.id===u);if(!p||!f||p.type!=="bpmn:SequenceFlow"||f.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!Fi({edges:[p,f]}).length)continue;const d=p.endpoints.find(T=>f.endpoints.includes(T)),g=d?a.get(d):void 0;if(!g||g.container)continue;const h=i.get(l),m=i.get(u);if(!h||!m)continue;const w=T=>n.has(T.id)?[T.waypoints]:[T.waypoints,...ZC(T,g,a)],y=T=>T.length-2,v=w(p).flatMap(T=>w(f).map(N=>({pa:T,pb:N}))).filter(({pa:T,pb:N})=>T!==p.waypoints||N!==f.waypoints).map(T=>({...T,cost:Vm(T.pa)+Vm(T.pb)+YC*(y(T.pa)+y(T.pb))})).sort((T,N)=>T.cost-N.cost),x=Uc(h),E=Uc(m),M=Fi(c).length,D=new Set(go(c).map(([T,N])=>`${T}|${N}`)),P=v.find(({pa:T,pb:N})=>{const j={...p,waypoints:T},V={...f,waypoints:N};if(Fi({edges:[j,V]}).length||Pr(j,V)||!uf(T,x)||!uf(N,E))return!1;const Q={...c,edges:c.edges.map(ne=>ne.id===l?j:ne.id===u?V:ne)};return Fi(Q).length>=M||go(Q).some(([ne,W])=>!D.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(m,P.pb),c={...c,edges:c.edges.map(T=>T.id===l?{...p,waypoints:P.pa}:T.id===u?{...f,waypoints:P.pb}:T)})}}const JC=40,eM=20;function tM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>{const u=Ge(i),p=Fi(u);return{keys:new Set(pt(u).map(ct)),crossings:go(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(jt({...f,waypoints:u},Fn(p)).map(d=>d.id)):null},s=l=>!!l&&l.type==="bpmn:Participant"&&!(l.children??[]).length&&n.has(l.id),c=i.getAll().filter(l=>l.type==="bpmn:MessageFlow"&&!t.has(l.id));for(const l of c){const u=l.source,p=l.target,f=s(u)?u:s(p)?p:void 0;if(!f)continue;const d=f===u?p:u;if(!d||d.type==="bpmn:Participant")continue;const g=d.x+d.width/2;if(g>=f.x+10&&g<=f.x+f.width-10)continue;const h=g>f.x+f.width,m=f.y>d.y,w=m?d.y+d.height:d.y,y=m?f.y:f.y+f.height,v=Math.round((w+y)/2),x=N=>f===u?[...N].reverse():N,E=(l.waypoints??[]).map(N=>({x:N.x,y:N.y})),M=r(l.id),D=a(l.id,E)??new Set,P=h?f.x+f.width:f.x,T=f.x+f.width/2;for(let N=Math.min(JC,f.width/4);h?P-N>T:P+N<T;N+=eM){const j=Math.round(h?P-N:P+N),V=x([{x:g,y:w},{x:g,y:v},{x:j,y:v},{x:j,y}]),Q=a(l.id,V);if(!Q||[...Q].some(W=>!D.has(W)))continue;o.updateWaypoints(l,V);const ne=r(l.id);if(ne.crossings<=M.crossings&&ne.shared<=M.shared&&ne.mine<=M.mine&&[...ne.keys].every(W=>M.keys.has(W)))break;o.updateWaypoints(l,E)}}}const nM=10;function Wm(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 Um(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(V=>V.type==="bpmn:Participant"&&V.container),i=t.shapes.find(V=>V.id===e.endpoints[0]),o=t.shapes.find(V=>V.id===e.endpoints[1]);if(!i||!o)return null;const r=Wm(i,n),a=Wm(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(V=>V.id!==r.id&&V.id!==a.id&&V.y>=c.y+c.height&&V.y+V.height<=l.y).sort((V,Q)=>V.y-Q.y);if(!u.length)return null;const p=u[0],f=u[u.length-1],d=(c.y+c.height+p.y)/2,g=(f.y+f.height+l.y)/2,h=s?d:g,m=s?g:d,w=e.waypoints[0],y=e.waypoints[e.waypoints.length-1],v=Fn(t),x=t.edges.filter(V=>V.id!==e.id),E=di(e,x),M=jt(e,v).length;if(E===0&&M===0||M===0&&e.waypoints.length===2)return null;const D=Math.min(...u.map(V=>V.x)),P=Math.max(...u.map(V=>V.x+V.width)),T=(w.x+y.x)/2,N=V=>V.filter((Q,ne)=>ne===0||!(Ve(Q.x,V[ne-1].x)&&Ve(Q.y,V[ne-1].y)));let j;for(let V=D;V<=P;V+=nM){const Q=N([w,{x:w.x,y:h},{x:V,y:h},{x:V,y:m},{x:y.x,y:m},y]),ne={...e,waypoints:Q};if(jt(ne,v).length>0)continue;const W=di(ne,x),te=Math.abs(V-T);(!j||W<j.cross||W===j.cross&&te<j.detour)&&(j={pts:Q,cross:W,detour:te})}return j&&(M>0?j.cross<=E:j.cross<E)?j.pts:null}const iM=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function oM(e,t,n){var l,u;const{elementRegistry:i}=e,o=e.modeling,r=new Map(t.shapes.map(p=>[p.id,p])),a=Ge(i),s=new Map(a.shapes.map(p=>[p.id,p])),c=Fn(a);for(const p of t.edges){if(!iM.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 w=h.x-d.x,y=h.y-d.y;if(Ve(w,0)&&Ve(y,0)||!Ve(m.x-g.x,w)||!Ve(m.y-g.y,y))continue;const v=p.waypoints.map(M=>({x:M.x+w,y:M.y+y})),x=f.waypoints.map(M=>({x:M.x,y:M.y}));x.length===v.length&&x.every((M,D)=>Ve(M.x,v[D].x)&&Ve(M.y,v[D].y))||x.length===2&&(Ve(x[0].x,x[1].x)||Ve(x[0].y,x[1].y))&&jt({...p,waypoints:x},c).length===0||jt({...p,waypoints:v},c).length>0||o.updateWaypoints(f,v)}}function qm(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=Um(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const ff=20,Ym=10,ji=10,df=40,rM=6,aM=40,Km=50;function sM(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<=rM})}function hf(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 cM(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 gf(e,t,n){if(t>n)return[];const i=[Math.min(Math.max(e,t),n)];for(let o=Ym;o<=n-t;o+=Ym)e+o<=n&&i.push(e+o),e-o>=t&&i.push(e-o);return i}function lM(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,te)=>te>W.x+ji&&te<W.x+W.width-ji,g=(W,te)=>W.width<=2*df?W.x+W.width/2:Math.min(Math.max(te,W.x+df),W.x+W.width-df),h=Math.max(e.x,t.x)+ji,m=Math.min(e.x+e.width,t.x+t.width)-ji;if(h<=m){const W=!a&&d(t,p)?p:!s&&d(e,f)?f:Math.round((h+m)/2);r.push([{x:W,y:l},{x:W,y:u}])}const w=s?g(t,p):f,y=a?g(e,f):p;if(!a&&!d(e,w)){const W=w<e.x?e.x:e.x+e.width;for(const te of gf(e.y+e.height/2,e.y+ji,e.y+e.height-ji))r.push([{x:W,y:te},{x:w,y:te},{x:w,y:u}])}if(!s&&!d(t,y)){const W=y<t.x?t.x:t.x+t.width;for(const te of gf(t.y+t.height/2,t.y+ji,t.y+t.height-ji))r.push([{x:y,y:l},{x:y,y:te},{x:W,y:te}])}const v=(W,te)=>{if(Math.abs(te-W)<2*ji)return[];const xe=Math.min(W,te)+ji,Oe=Math.max(W,te)-ji;return gf(Math.round((W+te)/2),xe,Oe)};if(!a&&n)for(const W of v(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 v(u,c?i.y:i.y+i.height))r.push([{x:y,y:l},{x:y,y:W},{x:f,y:W},{x:f,y:u}]);const x=Math.min(y,w),E=Math.max(y,w),M=[];for(const[W,te]of o.filter(xe=>xe.x<E&&xe.x+xe.width>x).map(xe=>[xe.y,xe.y+xe.height]).sort((xe,Oe)=>xe[0]-Oe[0])){const xe=M[M.length-1];xe&&W<=xe[1]?xe[1]=Math.max(xe[1],te):M.push([W,te])}const D=[];for(let W=1;W<M.length;W++)M[W][0]-M[W-1][1]>=aM&&D.push(Math.round((M[W-1][1]+M[W][0])/2));M.length&&D.push(M[0][0]-Km,M[M.length-1][1]+Km);const P=(W,te)=>te<W.y?W.y:te>W.y+W.height?W.y+W.height:void 0,T=new Set([a?e.id:n==null?void 0:n.id,s?t.id:i==null?void 0:i.id].filter(W=>!!W)),N=e.y+e.height/2,j=t.y+t.height/2,V=j>N?1:-1,Q=(W,te,xe)=>o.some(Oe=>!T.has(Oe.id)&&Oe.x<W&&W<Oe.x+Oe.width&&Oe.y<Math.max(te,xe)-1&&Oe.y+Oe.height>Math.min(te,xe)+1),ne=[];for(const W of D){const te=P(e,W),xe=P(t,W);te===void 0||xe===void 0||(W-N)*V<0&&Q(y,te,W)||(W-j)*V>0&&Q(w,xe,W)||ne.push({pts:[{x:y,y:te},{x:y,y:W},{x:w,y:W},{x:w,y:xe}],len:Math.abs(W-te)+(E-x)+Math.abs(xe-W)})}return{inPools:r,outside:ne.sort((W,te)=>W.len-te.len).map(W=>W.pts)}}function uM(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:go(d).length,shared:Fi(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),w=new Map(m.shapes.map(K=>[K.id,K])),y=s(g),v=s(h),x=new Set([y,v].filter(K=>!!K)),E=m.shapes.filter(K=>K.type==="bpmn:Participant"),M=(d.waypoints??[]).map(K=>({x:K.x,y:K.y})),D=hf(M,x,E);if(D<ff)return"skip";if(t.has(d.id)){const K=r.get(d.id);if(K&&l(K,M)||D-(K?hf(K,x,a):0)<ff)return"skip"}const P=w.get(g.id),T=w.get(h.id),N=m.edges.find(K=>K.id===d.id);if(!P||!T||!N)return"skip";const j=Fn(m),V=new Set(jt(N,j).map(K=>K.id)),Q=Go(m).filter(K=>K.owner!==d.id&&K.owner!==P.id&&K.owner!==T.id),ne=[...m.shapes.filter(K=>!K.container&&K.id!==P.id&&K.id!==T.id),...Q.map(K=>K.rect)],W=K=>tn({...N,waypoints:K}).some(oe=>sM(oe,ne)),te=lM(P,T,y?w.get(y):void 0,v?w.get(v):void 0,E),xe=K=>K.map((oe,Y)=>({pts:oe,i:Y,key:oe.length*2+(W(oe)?1:0)})).sort((oe,Y)=>oe.key-Y.key||oe.i-Y.i).map(oe=>oe.pts),Oe=[...xe(te.inPools),...xe(te.outside)],we=c();for(const K of Oe){if(hf(K,x,E)>=ff)continue;const oe={...N,waypoints:K};if(jt(oe,j).some(ce=>!V.has(ce.id))||tn(oe).some(ce=>cM(ce,m.shapes)||Q.some(me=>$i(me.rect,ce))))continue;o.updateWaypoints(d,K);const X=c();if(X.crossings<=we.crossings&&X.shared<=we.shared&&[...X.keys].every(ce=>we.keys.has(ce)))return"fixed";o.updateWaypoints(d,M)}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 Hi=[25,-25,40,-40],ma=35;function pM(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=dM(e,t,s,u,n),f=p===null?[[u,0]]:[[u,0],[p,fM]];for(const[d,g]of f)for(const h of[0,...Hi])if(!(Math.abs(h)>=e.width/2-5))for(const m of[0,...Hi]){if(Math.abs(m)>=t.width/2-5)continue;const w=i+h,y=o+m,v=[{x:w,y:c},{x:w,y:d},{x:y,y:d},{x:y,y:l}];g&&jt({endpoints:[],waypoints:v},a).length||r.push({pts:v,cost:g+Math.abs(m)+Math.abs(h)})}}return r}const fM=45,qc=20;function dM(e,t,n,i,o){if(!o.length)return null;const r=e.x+e.width/2,a=t.x+t.width/2,s=Math.min(r,a),c=Math.max(r,a),l=n?Math.min(e.y,t.y):Math.max(e.y+e.height,t.y+t.height),u=o.filter(m=>m.container&&(m.type==="bpmn:Lane"||m.type==="bpmn:Participant")&&r>=m.x&&r<=m.x+m.width&&e.y>=m.y&&e.y+e.height<=m.y+m.height).sort((m,w)=>m.width*m.height-w.width*w.height)[0];if(!u)return null;const p=o.filter(m=>!m.container&&m.id!==e.id&&m.id!==t.id),f=p.filter(m=>m.x<c&&m.x+m.width>s&&(n?m.y<l&&m.y+m.height>i:m.y+m.height>l&&m.y<i));if(!f.length)return null;const d=[...p,...p.flatMap(m=>m.label?[m.label]:[])].filter(m=>m.x<c&&m.x+m.width>s);if(n){let m=Math.min(...f.map(y=>y.y));for(let y=!0;y;){y=!1;for(const v of d)v.y<m&&v.y<l&&v.y+v.height>m-qc&&(m=v.y,y=!0)}const w=Math.max(u.y,...d.filter(y=>y.y+y.height<=m).map(y=>y.y+y.height));return m-w>=qc?Math.round((m+w)/2):null}let g=Math.max(...f.map(m=>m.y+m.height));for(let m=!0;m;){m=!1;for(const w of d)w.y+w.height>g&&w.y+w.height>l&&w.y<g+qc&&(g=w.y+w.height,m=!0)}const h=Math.min(u.y+u.height,...d.filter(m=>m.y>=g).map(m=>m.y));return h-g>=qc?Math.round((g+h)/2):null}function Yc(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 pM(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 y of[0,...Hi]){if(Math.abs(y)>=i.width/2-5)continue;const v=r+y;p.push({pts:[{x:n.x,y:o},{x:v,y:o},{x:v,y:c}],cost:Math.abs(y)});for(const x of[0,...Hi]){if(Math.abs(x)>=n.width/2-5)continue;const E=a+x;p.push({pts:[{x:E,y:l},{x:E,y:u},{x:v,y:u},{x:v,y:c}],cost:Math.abs(y)+Math.abs(x)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const y of[0,...Hi]){if(Math.abs(y)>=n.width/2-5)continue;const v=a+y;p.push({pts:[{x:v,y:g},{x:v,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(y)})}const h=60,m=s?i.y+i.height:i.y,w=s?i.y+i.height+ma:i.y-ma;for(const y of[0,...Hi]){if(Math.abs(y)>=i.width/2-5)continue;const v=r+y;for(const x of[0,...Hi]){if(Math.abs(x)>=n.width/2-5)continue;const E=a+x;p.push({pts:[{x:E,y:g},{x:E,y:w},{x:v,y:w},{x:v,y:m}],cost:h+Math.abs(y)+Math.abs(x)})}}return p}const Kc=30;function Xm(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)<Kc||Math.abs(i.y-(s.y+s.height))<Kc)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)<Kc||Math.abs(i.x-(s.x+s.width))<Kc)return!0}}return!1}const Xc=40;function hM(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-Xc,a=o.x+o.width+Xc,s=o.y-Xc,c=o.y+o.height+Xc;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(M=>M.container),i=new Map(t.shapes.map(M=>[M.id,M])),o=Fn(t),r=t.edges.filter(M=>M.id!==e.id),a=fi(e,r),s=di(e,r),c=M=>hM(M,t.shapes,e.endpoints)+(Xm(M,n)?1:0),l=c(e.waypoints),u=M=>{if(!M)return;const D=M.x+M.width/2,P=M.y+M.height/2;return n.find(T=>T.type==="bpmn:Lane"&&D>=T.x&&D<=T.x+T.width&&P>=T.y&&P<=T.y+T.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=M=>{if(!d||!f)return!1;for(let D=1;D<M.length-2;D++){const P=M[D],T=M[D+1];if(Ve(P.y,T.y)&&!Ve(P.x,T.x)&&P.y>f.y&&P.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),w=(M=>{if(!M)return;const D=M.x+M.width/2,P=M.y+M.height/2;return n.filter(T=>T.type==="bpmn:Participant"&&D>=T.x&&D<=T.x+T.width&&P>=T.y&&P<=T.y+T.height).sort((T,N)=>T.width*T.height-N.width*N.height)[0]})(i.get(e.endpoints[0]??"")),y=M=>{if(!w)return 0;let D=0;for(let P=1;P<M.length-1;P++){const T=M[P];(T.x<w.x||T.x>w.x+w.width||T.y<w.y||T.y>w.y+w.height)&&D++}return D},v=y(e.waypoints);if(!Xm(e.waypoints,n)&&!(d&&!h)&&v===0)return null;const x=M=>M.reduce((D,P,T)=>T?D+Math.abs(P.x-M[T-1].x)+Math.abs(P.y-M[T-1].y):0,0);let E;for(const{pts:M,cost:D}of Yc(e,i)){const P={...e,waypoints:M};if(jt(P,o).length>0)continue;const T=fi(P,r);if(T>a)continue;const N=y(M);if(N>v)continue;const j=N<v&&T===0;if(!j&&di(P,r)>s)continue;const V=c(M),Q=g(M);if(!j&&!(Q&&!h)&&V>=l)continue;const W=Q?0:1,te=x(M);(!E||N<E.out||N===E.out&&(W<E.lane||W===E.lane&&(T<E.opp||T===E.opp&&(V<E.sc||V===E.sc&&(D<E.cost||D===E.cost&&te<E.len)))))&&(E={pts:M,out:N,sc:V,lane:W,opp:T,cost:D,len:te})}return(E==null?void 0:E.pts)??null}function gM(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 mM(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=Fn(s),u=s.edges.filter(m=>m.id!==a),p=jt(c,l).length,f=fi(c,u),d=di(c,u),g=n.has(a)?new Set(pt(s).map(ct)):null,h=Gc(c,s.shapes);h.length===2&&gM(c,s)&&h.reverse();for(const m of h){if(m.length>=c.waypoints.length)continue;const w={...c,waypoints:m};if(jt(w,l).length>p||fi(w,u)>f||di(w,u)>d)continue;if(g){const v=new Set(pt({...s,edges:s.edges.map(M=>M.id===a?w:M)}).map(ct)),x=[...v].filter(M=>!g.has(M)).length,E=[...g].filter(M=>!v.has(M)).length;if(x>E)continue}const y=i.get(a);y&&o.updateWaypoints(y,m);break}}}function Qm(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 mf(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 Hi){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 Jm=e=>e==="bpmn:SequenceFlow"||e==="bpmn:MessageFlow";function yM(e,t,n){const i=e.waypoints;if(i.length<2||!Jm(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(!Jm(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 Hi){const h=(a?o.y:o.x)+g;if(!f(u,h)||i.length===2&&(!p||!f(p,h)))continue;const m=i.map(w=>({...w}));for(const w of[m[0],m[1]])a?w.y=h:w.x=h;d.push({pts:m,cost:Math.abs(g)})}return d}function vM(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const o=i.y+i.height<=n.y,r=n.y+n.height<=i.y;if(!o&&!r)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,l=n.y+n.height/2,u=i.x+i.width/2,p=i.y+i.height/2,f=a?n.x+n.width:n.x,d=r?n.y+n.height:n.y,g=a?i.x:i.x+i.width,h=r?i.y:i.y+i.height,m=[];for(const w of[0,...Hi])Math.abs(w)<i.width/2-5&&m.push({pts:[{x:f,y:l},{x:u+w,y:l},{x:u+w,y:h}],cost:Math.abs(w)}),Math.abs(w)<i.height/2-5&&m.push({pts:[{x:c,y:d},{x:c,y:p+w},{x:g,y:p+w}],cost:Math.abs(w)});return m}function yf(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,...Hi]){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 ey(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Fn(t),o=t.edges.filter(d=>d.id!==e.id),r=fi(e,o);if(r===0)return null;const a=di(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=[...Yc(e,n),...yf(e,n),...mf(e,n),...yM(e,o,n)];for(const{pts:d,cost:g}of f){const h={...e,waypoints:d};if(jt(h,i).length>0)continue;const m=fi(h,o),w=di(h,o),y=r-m+(p-u(d));if(m>=r||w-a>y)continue;const v=c(d);(!s||m<s.opposite||m===s.opposite&&(w<s.cross||w===s.cross&&(g<s.cost||g===s.cost&&v<s.len)))&&(s={pts:d,opposite:m,cross:w,cost:g,len:v})}return(s==null?void 0:s.pts)??null}function ty(e,t){var i;let n=0;for(const o of t)o.id!==e.id&&((i=Pr(e,o))==null?void 0:i.kind)==="unrelated"&&n++;return n}function bM(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=Fn(t),o=t.edges.filter(f=>f.id!==e.id),r=ty(e,o);if(r===0)return null;const a=fi(e,o),s=di(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=[...Yc(e,n),...yf(e,n),...vM(e,n),...mf(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(jt(g,i).length>0)continue;const h=ty(g,o);if(h>=r)continue;const m=fi(g,o);if(m-h>a-r)continue;const w=di(g,o);if(w-s>(r-h)*l)continue;const y=c(f);(!u||h<u.fake||h===u.fake&&(m<u.unreadable||m===u.unreadable&&(w<u.cross||w===u.cross&&(d<u.cost||d===u.cost&&y<u.length))))&&(u={pts:f,fake:h,unreadable:m,cross:w,cost:d,length:y})}return(u==null?void 0:u.pts)??null}function ny(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=bM(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function iy(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 oy(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Pr(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,o]=e.endpoints,[r,a]=t.endpoints,s=[i,o].filter(u=>u&&(u===r||u===a)).length;return!(!!o&&o===r||!!a&&a===i)||s!==1?!1:iy(e,n)&&iy(t,n)}function ry(e,t,n){let i=0;for(const o of t)o.id!==e.id&&oy(e,o,n)&&i++;return i}function xM(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=Fn(t),o=t.edges.filter(f=>f.id!==e.id),r=ry(e,o,n);if(r===0)return null;const a=fi(e,o),s=di(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=[...Yc(e,n),...yf(e,n),...mf(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(jt(g,i).length>0)continue;const h=ry(g,o,n);if(h>=r)continue;const m=fi(g,o);if(m-h>a-r)continue;const w=di(g,o);if(w-s>(r-h)*l)continue;const y=c(f);(!u||h<u.chain||h===u.chain&&(m<u.unreadable||m===u.unreadable&&(w<u.cross||w===u.cross&&(d<u.cost||d===u.cost&&y<u.length))))&&(u={pts:f,chain:h,unreadable:m,cross:w,cost:d,length:y})}return(u==null?void 0:u.pts)??null}function wM(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||!oy(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=xM(p,u);if(!f)continue;const d=i.get(l);d&&o.updateWaypoints(d,f)}}function ay(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=pt(r).filter(u=>tf(u)&&!t.has(ct(u)));if(!a.length)return;const s=new Set;for(const u of a)if(tf(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=ey(f,p);if(!d)continue;const g=i.get(u);g&&o.updateWaypoints(g,d)}}const _M=10,EM=(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 sy(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Hc(e,i))return null;const o=Fn(t),r=i.flatMap(tn);for(const a of tn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of jc(a,r))s=s.flatMap(([h,m])=>{const w=[];return d>h&&w.push([h,Math.min(m,d)]),g<m&&w.push([Math.max(h,g),m]),w.filter(([y,v])=>v>y)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,g])=>g-d>=c+_M*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-wm}:{x:a.at+An+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(!Hc({...e,label:f},i)&&!o.some(d=>!e.endpoints.includes(d.id)&&EM(f,d)))return f}return null}const An=8;function vf(e,t){const n=e.label;if(!n)return null;const i=tn(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(tn),...t.shapes.filter(f=>f.container).flatMap(ha)],l=f=>!c.some(d=>$i(f,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+An,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const f of[s.at+An,s.at-An-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-An-n.height,s.at+An])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 cy=30,SM=(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},ly=(e,t)=>SM({x:e.x+e.width/2,y:e.y+e.height/2},t);function RM(e,t){const n=e.label;if(!n)return null;const i=tn(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(tn),...t.shapes.filter(c=>c.container).flatMap(ha)],r=Go(t).filter(c=>c.owner!==e.id).map(c=>c.rect),a=(c,l)=>c.x<l.x+l.width&&l.x<c.x+c.width&&c.y<l.y+l.height&&l.y<c.y+c.height,s=c=>!o.some(l=>$i(c,l))&&!ps(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+An,c.at-An-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+An,c.at-An-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 uy(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((M,D)=>M.x-u[D].x===d&&M.y-u[D].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 M=o.edges.find(j=>j.id===c);if(!(M!=null&&M.label)||!ps(M.label,o).length)continue;let D={...M.label,x:l.label.x,y:l.label.y};if((ps(D,o).length||ly(D,M.waypoints)>cy)&&(D=null),!D&&ly(M.label,M.waypoints)>cy&&(D=RM(M,o)),!D)continue;const P=D,T={...o,edges:o.edges.map(j=>j.id===c?{...j,label:P}:j)},N=pt(T);if(N.some(j=>!r.has(ct(j))))continue;i.moveElements([f],{x:P.x-f.x,y:P.y-f.y}),o=T,r=new Set(N.map(ct));continue}const m=l.label.x+d-f.x,w=l.label.y+g-f.y;if(m===0&&w===0)continue;const y=o.edges.find(M=>M.id===c);if(!(y!=null&&y.label))continue;const v={...y.label,x:y.label.x+m,y:y.label.y+w},x={...o,edges:o.edges.map(M=>M.id===c?{...M,label:v}:M)},E=pt(x);E.some(M=>!r.has(ct(M)))||(i.moveElements([f],{x:m,y:w}),o=x,r=new Set(E.map(ct)))}}function py(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=vf(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 fy(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=sy(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 dy(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(tn),...t.shapes.filter(f=>f.container).flatMap(ha)],o=i.filter(f=>$i(n,f));if(!o.length)return null;const r=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=Go(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>$i(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-An-n.height},{...n,y:f.at+An}):l.push({...n,x:f.at-An-n.width},{...n,x:f.at+An});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+An},{...n,x:u-n.width/2,y:e.y-An-n.height},{...n,x:e.x+e.width+An,y:p-n.height/2},{...n,x:e.x-An-n.width,y:p-n.height/2}),l.find(c)??null}function hy(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=dy(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 CM(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 gy(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 w=h?o.shapes.find(v=>v.id===h):void 0;if(!w)continue;const y=CM(w,l[m]);y.x===l[m].x&&y.y===l[m].y||(l[m]=y,p=!0)}if(!p)continue;const f={...o,edges:o.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=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 bf=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function my(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 MM(e,t,n){const i=[],o=n?os(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 my(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(!bf(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[d,g]of Object.entries(u))typeof g!="string"||g===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${d}`}),p=!1):o.includes(d)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:d,locales:o}),p=!1);if(!p)continue;const f=o.filter(d=>!(d in u));f.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:f})}}),i}function wi(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function AM(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(bf(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=my(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,f=wi(c.participant,"name",a(u));c.participant.lanes&&(f.lanes=c.participant.lanes.map((d,g)=>wi(d,"name",a(p[g])))),s.push({...c,participant:f});break}case"participant.update":{const[u,...p]=l,f=wi(c,"name",a(u));c.lanes&&(f.lanes=c.lanes.map((d,g)=>wi(d,"name",a(p[g])))),s.push(f);break}case"node.add":s.push({...c,node:wi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:wi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:wi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:wi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:wi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:wi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(wi(c,"text",a(l[0])));break;default:s.push(bf(l[0].map)?wi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const PM=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,yy=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),vy={"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}]},ds=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Zc=e=>typeof e=="string"&&e!=="";function TM(e){const t=[];function n(i,o,r,a){if(a===null){Zc(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!ds(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)Zc(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!ds(i)||!Zc(i.kind)||!(i.kind in vy)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of vy[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(!ds(f))break;f=f[g]}if(!ds(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;ds(c)&&!Zc(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"&&!$g(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&&!Fg(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 by(e,t,n={}){const i=TM(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(h,m,w){if(!PM.test(m)){o.push({kind:"id-invalid",opIndex:h,id:m});return}if(t.categoryOf(m)!==void 0||r.has(m)){o.push({kind:"id-duplicate",opIndex:h,id:m});return}r.set(m,{...w,opIndex:h})}e.forEach((h,m)=>{var w;switch(h.kind){case"participant.add":s(m,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(y=>y.id)});for(const y of h.participant.lanes??[])s(m,y.id,{category:"lane"});break;case"node.add":s(m,h.node.id,{category:"flowNode",participant:h.node.participant});break;case"sequenceFlow.add":s(m,h.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(m,h.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(m,h.dataStore.id,{category:"dataStore"});for(const y of h.associations??[])y.id&&s(m,y.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(m,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(m,h.association.id,{category:"association"});break;case"annotation.add":s(m,h.annotation.id,{category:"annotation"}),(w=h.association)!=null&&w.id&&s(m,h.association.id,{category:"association"});break;case"group.add":s(m,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(y=>y.id));for(const y of h.lanes)t.categoryOf(y.id)===void 0&&s(m,y.id,{category:"lane"})}break}});const c=h=>{var m;return((m=r.get(h))==null?void 0:m.category)??t.categoryOf(h)},l=h=>{const m=r.get(h);return m?m.category==="participant"?h:m.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,m,w,y){const v=c(m);if(v===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:w});return}if(y&&!y.includes(v)){o.push({kind:"ref-category",opIndex:h,ref:m,role:w,expected:y.join("|"),actual:v});return}return v}const p=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),f=new Map;for(const h of e)h.kind==="node.add"?f.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&f.set(h.id,h.eventDefinition);const d=h=>f.has(h)?f.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,m)=>{var w,y;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:v,lane:x}=h.node;if(v===void 0){(p||x!==void 0)&&o.push({kind:"participant-required",opIndex:m,id:h.node.id});break}if(u(m,v,"participant",["participant"])===void 0)break;x!==void 0&&((((w=r.get(v))==null?void 0:w.lanes)??a.get(v)??t.lanesOf(v)).includes(x)||o.push({kind:"lane-unknown",opIndex:m,lane:x,participant:v}));break}case"sequenceFlow.add":{const{id:v,source:x,target:E,name:M,condition:D}=h.flow,P=u(m,x,"source",["flowNode"]),T=u(m,E,"target",["flowNode"]);P&&T&&l(x)!==l(E)&&o.push({kind:"flow-cross-pool",opIndex:m,id:v}),M!==void 0&&D!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:v});break}case"messageFlow.add":{const{id:v,source:x,target:E}=h.flow,M=u(m,x,"source",["flowNode","participant"]),D=u(m,E,"target",["flowNode","participant"]);if(M&&D){const P=l(x),T=l(E);P!==void 0&&P===T&&o.push({kind:"message-flow-same-pool",opIndex:m,id:v})}for(const P of[x,E])d(P)&&o.push({kind:"message-flow-timer-endpoint",opIndex:m,id:v,ref:P});break}case"dataStore.add":{for(const v of h.associations??[]){if([v.source,v.target].filter(M=>M===h.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:m,source:v.source,target:v.target});continue}const E=v.source===h.dataStore.id?v.target:v.source;u(m,E,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:v,target:x}=h.association,E=u(m,v,"source"),M=u(m,x,"target");if(E&&M){const D=new Set([E,M]);D.has("dataStore")&&D.has("flowNode")||o.push({kind:"data-association-ends",opIndex:m,source:v,target:x})}break}case"association.add":{const{id:v,source:x,target:E}=h.association,M=u(m,x,"source"),D=u(m,E,"target");M&&D&&M!=="annotation"&&D!=="annotation"&&o.push({kind:"association-detached",opIndex:m,annotation:v??`${x}->${E}`});break}case"annotation.add":{if(h.association){const{source:v,target:x}=h.association;if(v!==h.annotation.id&&x!==h.annotation.id)o.push({kind:"association-detached",opIndex:m,annotation:h.annotation.id});else{const E=v===h.annotation.id?x:v;u(m,E,"association")}}h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.add":{for(const v of h.group.members??[]){const x=u(m,v,"member");x&&yy.has(x)&&o.push({kind:"ref-category",opIndex:m,ref:v,role:"member",expected:"shape",actual:x})}break}case"participant.update":{if(g(m,h.id,"participant")===void 0)break;if(h.lanes){const v=t.lanesOf(h.id),x=h.lanes.map(P=>P.id);for(const P of v)x.includes(P)||o.push({kind:"lane-shrink-unsupported",opIndex:m,participant:h.id,lane:P});for(const P of x)t.categoryOf(P)!==void 0&&!v.includes(P)&&o.push({kind:"id-duplicate",opIndex:m,id:P});const E=x.filter(P=>v.includes(P)),M=P=>E.every((T,N)=>T===P[N]),D=(((y=t.laneDeclarationOrderOf)==null?void 0:y.call(t,h.id))??v).filter(P=>v.includes(P));E.length===v.length&&!M(v)&&!M(D)&&o.push({kind:"lane-reorder-unsupported",opIndex:m,participant:h.id})}break}case"node.update":{if(g(m,h.id,"flowNode")===void 0)break;if(h.lane!==void 0){const v=t.participantOf(h.id);(v?a.get(v)??t.lanesOf(v):[]).includes(h.lane)||o.push({kind:"lane-unknown",opIndex:m,lane:h.lane,participant:v??""})}break}case"sequenceFlow.update":{if(g(m,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:h.id}),h.source!==void 0||h.target!==void 0){const v=h.source===void 0||u(m,h.source,"source",["flowNode"])!==void 0,x=h.target===void 0||u(m,h.target,"target",["flowNode"])!==void 0,E=t.endpointsOf(h.id),M=h.source??(E==null?void 0:E.source),D=h.target??(E==null?void 0:E.target);v&&x&&M!==void 0&&D!==void 0&&new Set([l(M),l(D),l(h.id)]).size>1&&o.push({kind:"flow-cross-pool",opIndex:m,id:h.id})}break}case"messageFlow.update":g(m,h.id,"messageFlow");break;case"dataStore.update":g(m,h.id,"dataStore");break;case"annotation.update":{if(g(m,h.id,"annotation")===void 0)break;h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.update":{if(g(m,h.id,"group")===void 0)break;for(const v of h.members??[]){const x=u(m,v,"member");x&&yy.has(x)&&o.push({kind:"ref-category",opIndex:m,ref:v,role:"member",expected:"shape",actual:x})}break}case"translation.confirm":g(m,h.id);break;case"element.remove":{g(m,h.id)==="lane"&&o.push({kind:"ref-category",opIndex:m,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),o.push(...MM(e,t,n.i18n)),o;function g(h,m,w){if(r.has(m)){o.push({kind:"target-added-in-batch",opIndex:h,id:m});return}const y=t.categoryOf(m);if(y===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:"target"});return}if(w&&y!==w){o.push({kind:"ref-category",opIndex:h,ref:m,role:"target",expected:w,actual:y});return}return y}}function xy(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 Qc(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Jc={"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]},Pn=10,kM=300,OM=160,wy=20,xf=100,_y=40,DM=10,LM=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function Ey(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 el=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function tl(e,t,n,i,o){const r=n,a=Ey(e,t,i),s=a??i,c=(Q,ne,W=s)=>{const[te,xe]=Jc[Q];let Oe={x:t.x+t.width/2+te*(t.width/2+r.width/2+ne),y:t.y+t.height/2+xe*(t.height/2+r.height/2+ne)};const we=W.x+Pn+r.width/2,K=W.x+W.width-Pn-r.width/2,oe=W.y+Pn+r.height/2,Y=W.y+W.height-Pn-r.height/2,X={x:Math.min(K,Math.max(we,Oe.x)),y:Math.min(Y,Math.max(oe,Oe.y))};return(X.x!==Oe.x||X.y!==Oe.y)&&(Oe=Math.abs(X.x-(t.x+t.width/2))<(t.width+r.width)/2+Pn&&Math.abs(X.y-(t.y+t.height/2))<(t.height+r.height)/2+Pn?{x:t.x+t.width+Pn+r.width/2,y:X.y}:X),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 W,te;if(!o.selfId)return!1;const ne=e.get(Q);return!!ne&&(((W=ne.source)==null?void 0:W.id)===o.selfId||((te=ne.target)==null?void 0:te.id)===o.selfId)},f=u.edges.filter(Q=>!p(Q.id)).flatMap(tn),d=Go(u).filter(Q=>Q.owner!==o.selfId).map(Q=>Q.rect),g=Q=>({x0:Q.x-r.width/2-Pn,x1:Q.x+r.width/2+Pn,y0:Q.y-r.height/2-Pn,y1:Q.y+r.height/2+Pn}),h=Q=>{const ne=g(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)},m=Q=>{const ne=g(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=g(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)},y=u.shapes.filter(Q=>Q.type==="bpmn:Group").flatMap(Q=>[{axis:"h",at:Q.y,lo:Q.x,hi:Q.x+Q.width},{axis:"h",at:Q.y+Q.height,lo:Q.x,hi:Q.x+Q.width},{axis:"v",at:Q.x,lo:Q.y,hi:Q.y+Q.height},{axis:"v",at:Q.x+Q.width,lo:Q.y,hi:Q.y+Q.height}]),v=Q=>{const ne=g(Q);return y.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)},x=Q=>h(Q)||m(Q)||w(Q)||v(Q),E=Q=>Q.x-r.width/2>=i.x&&Q.x+r.width/2<=i.x+i.width&&Q.y-r.height/2>=i.y&&Q.y+r.height/2<=i.y+i.height,M=Q=>E(Q)&&(!a||el(Q,r,a));if(o.placement){const Q=we=>we.startsWith("top")?we.replace(/^top/,"bottom"):we.replace(/^bottom/,"top"),ne=we=>we.endsWith("left")?we.replace(/left$/,"right"):we.replace(/right$/,"left"),W=o.placement.side,te=[W,Q(W),ne(W),Q(ne(W)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],xe=o.placement.offset??50;let Oe=c(W,xe);if(x(Oe)||a&&!el(Oe,r,a)){const we=(K,oe)=>{const Y=new Set;for(const X of te){if(Y.has(X))continue;Y.add(X);const ce=c(X,xe,K);if(oe(ce)&&!x(ce))return Oe=ce,!0}return!1};!we(s,M)&&a&&we(i,E)}return Oe}const D=o.from,P=s.x+Pn+r.width/2,T=s.x+s.width-Pn-r.width/2,N=s.y+Pn+r.height/2,j=s.y+s.height-Pn-r.height/2;let V={x:Math.min(T,Math.max(P,D.x)),y:Math.min(j,Math.max(N,D.y))};if(x(V)){const Q=(t.width+r.width)/2+Pn,W=[{x:V.x+Q,y:V.y},{x:V.x-Q,y:V.y},{x:V.x,y:V.y-r.height-Pn},{x:V.x,y:V.y+r.height+Pn}].filter(M).find(te=>!x(te));W&&(V=W)}return V}function Gt(e,t){return e.filter(n=>n.kind===t)}function Sy(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 Ry extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}function Cy(e,t){var q1,Y1,K1,X1,Z1,Q1,J1,eS,tS,nS,iS,oS,rS,aS,sS,cS,lS,uS,pS,fS,dS,hS,gS;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 _=p(b);if(!_)throw new Error(`하강 참조 해소 실패: ${b}`);return _},d=b=>{let _=b.parent;for(;_;){if(_.type==="bpmn:Participant")return _;_=_.parent}},g=new Map;for(const b of r.filter(_=>!("waypoints"in _&&_.waypoints)&&_.type!=="bpmn:Lane"&&_.type!=="label"&&typeof _.x=="number"))g.set(b.id,{x:b.x,y:b.y});const h=Gt(e,"participant.add"),m=Gt(e,"node.add"),w=Gt(e,"sequenceFlow.add"),y=Gt(e,"messageFlow.add"),v=Gt(e,"dataStore.add"),x=Gt(e,"dataAssociation.add"),E=Gt(e,"annotation.add"),M=Gt(e,"group.add"),D=new Map(m.map(b=>[b.node.id,b])),P=Sy(e,b=>{var _,R;return(R=(_=p(b))==null?void 0:_.source)==null?void 0:R.id}),T=new Set([...P.values()].map(b=>b.flow.id)),N=w.filter(b=>!T.has(b.flow.id)),j=new Set([...P.values()].map(b=>b.flow.target)),V=b=>Gt(e,"sequenceFlow.update").filter(_=>_.target===b).length+(j.has(b)?1:0),Q=(b,_,R)=>{var I;const k=b.businessObject,L=(((I=k.extensionElements)==null?void 0:I.values)??[]).filter(B=>B.$type!==_),O=R?[...L,i.create(_,R)]:L;if(!O.length){k.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const F=i.create("bpmn:ExtensionElements",{values:O});O.forEach(B=>{B.$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 _=p(b.id);_&&n.removeElements([_])}const W=b=>r.filter(_=>{var R;return _.type==="bpmn:Lane"&&((R=d(_))==null?void 0:R.id)===b}).sort((_,R)=>_.y-R.y);for(const b of Gt(e,"participant.update")){const _=f(b.id);if(b.name!==void 0&&n.updateProperties(_,{name:b.name??void 0}),!b.lanes)continue;const R=W(b.id);if(!R.length){n.splitLane(_,b.lanes.length),W(b.id).forEach((O,F)=>{const I=b.lanes[F];I&&n.updateProperties(O,{id:I.id,name:I.name})});continue}const k=new Set(R.map(O=>O.id)),L=b.lanes.reduce((O,F,I)=>k.has(F.id)?I:O,-1);b.lanes.forEach((O,F)=>{if(k.has(O.id)){n.updateProperties(f(O.id),{name:O.name});return}const I=F===L+1&&L>=0,B=F===0?n.addLane(W(b.id)[0],"top"):I?n.addLane(W(b.id).at(-1),"bottom"):n.addLane(f(b.lanes[F-1].id),"bottom");n.updateProperties(B,{id:O.id,name:O.name})})}const te=150,xe=130,Oe=80,we=90,K=180,oe=30,Y=30,X=(b,_,R,k,L)=>{const O=R-_.width/2,F=k-_.height/2;return(b.children??[]).find(I=>!("waypoints"in I&&I.waypoints)&&I.type!=="bpmn:Lane"&&I.type!=="label"&&!(L!=null&&L.has(I.id))&&typeof I.x=="number"&&O<I.x+I.width+Y&&O+_.width+Y>I.x&&F<I.y+I.height&&F+_.height>I.y)},ce=new Set;for(const b of h){ce.add(`pool:${b.participant.id}`);for(const _ of b.participant.lanes??[])ce.add(_.id)}const me=new Map;for(const b of m){const _=b.node.lane??`pool:${b.node.participant??""}`;let R=me.get(_);R||me.set(_,R=new Set([0])),b.band!==void 0&&R.add(b.band)}const Ie=new Map;for(const[b,_]of me){if(!ce.has(b))continue;const R=[..._].sort((O,F)=>O-F),k=R.map((O,F)=>F===0?0:F%2===1?Math.ceil(F/2):-(F/2)),L=Math.min(...k);Ie.set(b,new Map(R.map((O,F)=>[O,k[F]-L])))}{const b=new Map;for(const _ of h)(_.participant.lanes??[]).forEach((R,k)=>b.set(R.id,k));for(const[_,R]of Ie){if(!b.has(_)||R.size<2)continue;const k=b.get(_),L=R.get(0)??0,O=new Set;for(const le of m){if(le.node.lane!==_||(le.band??0)!==0||!le.node.type.endsWith("Gateway"))continue;const ve={in:new Set,out:new Set,cross:new Set};for(const re of N){const fe=re.flow.source===le.node.id;if(!fe&&re.flow.target!==le.node.id)continue;const Pe=D.get(fe?re.flow.target:re.flow.source);if(!Pe||Pe.node.participant!==le.node.participant||!Pe.node.lane)continue;let _e,ee=!1;if(Pe.node.lane!==_){const se=b.get(Pe.node.lane);if(se===void 0)continue;_e=se>k?"down":"up",ee=!0}else{const se=R.get(Pe.band??0)??L;_e=se>L?"down":se<L?"up":void 0}_e&&(ve[fe?"out":"in"].add(_e),ee&&ve.cross.add(_e))}for(const re of["up","down"])ve.in.has(re)&&ve.out.has(re)&&ve.cross.has(re)&&O.add(re)}if(O.size!==1)continue;const[F]=O,I=Math.max(...R.values()),B=F==="down"?I:0;if(L===B)continue;const H=[...R.entries()].filter(([le])=>le!==0).sort((le,ve)=>le[1]-ve[1]),U=[...Array(I+1).keys()].filter(le=>le!==B),ie=new Map([[0,B]]);H.forEach(([le],ve)=>ie.set(le,U[ve])),Ie.set(_,ie)}}const $=b=>{var _;return(((_=me.get(b))==null?void 0:_.size)??0)>1},C=b=>b.band??(b.node.lane||!$(`pool:${b.node.participant??""}`)?void 0:0),S=new Map,G=b=>S.get(b.node.id)??C(b),Z=new Set,ae=new Set;{const b=new Map;for(const k of N)b.set(k.flow.target,(b.get(k.flow.target)??0)+1);const _=k=>{const L=[],O=new Set([k]),F=[k];for(;F.length;){const I=F.shift();L.push(I);for(const B of N)B.flow.source!==I||O.has(B.flow.target)||(b.get(B.flow.target)??0)!==1||(O.add(B.flow.target),F.push(B.flow.target))}return L},R=(k,L)=>{var O;return((O=Ie.get(k))==null?void 0:O.get(L))??L};for(const k of m){if(!k.node.type.endsWith("Gateway"))continue;const L=k.node.lane??`pool:${k.node.participant??""}`,O=Ie.get(L);if(!O||O.size<2)continue;const F=G(k);if(F===void 0||R(L,F)!==R(L,0))continue;const I=R(L,F),B=N.filter(re=>re.flow.source===k.node.id).map(re=>D.get(re.flow.target)).filter(re=>!!re&&(re.node.lane??`pool:${re.node.participant??""}`)===L),H=B.filter(re=>{const fe=G(re);return fe!==void 0&&R(L,fe)===I&&(b.get(re.node.id)??0)===1}),U=B.some(re=>{const fe=G(re);return fe!==void 0&&R(L,fe)>I});if(H.length!==1||!U)continue;const ie=new Set(B.flatMap(re=>_(re.node.id)));if(!N.some(re=>re.flow.target===k.node.id&&ie.has(re.flow.source)))continue;const ve=new Map;for(const[re,fe]of O)ve.set(re,fe+1);ve.set(-1,0),Ie.set(L,ve);for(const re of _(H[0].node.id))D.has(re)&&(S.set(re,-1),ae.add(re));Z.add(k.node.id)}}const Ce=(b,_)=>{var R;return((R=Ie.get(b))==null?void 0:R.get(_))??_},Ze=(b,_,R,k)=>{const L=b?p(b):_?p(_):void 0;if(!L)return!1;const O=b?L.y+Math.min(L.height/2,we):L.y+Oe;return Math.abs(O+Ce(b??`pool:${_??""}`,R)*te-k)<=te/2},gt=new Map;for(const[b,_]of me){let R=0;for(const k of _)R=Math.max(R,Ce(b,k));gt.set(b,R)}const Yt=b=>K+te*b,_t=(b,_,R)=>{const k=u().children.filter(L=>!("waypoints"in L&&L.waypoints)&&L.type!=="label"&&L.id!==_&&typeof L.y=="number"&&L.y>=b);k.length&&n.moveElements(k,{x:0,y:R})},un=(b,_,R)=>{const k=b.type==="bpmn:Participant"?b:void 0;if(!k||k.children.some(I=>I.type==="bpmn:Lane"))return;const L=R+_.height/2+oe-k.y;if(k.height>=L)return;const O=L-k.height,F=k.y+k.height;n.resizeShape(k,{x:k.x,y:k.y,width:k.width,height:L}),_t(F,k.id,O)},zn=(b,_)=>{const R=_-b.height;if(R<=0)return;const k=d(b)??b,L=[],O=B=>{L.push(B);for(const H of B.children??[])O(H)};O(k);const F=b.y+b.height-10,I=l.calculateAdjustments(L,"y",R,F);l.makeSpace(I.movingShapes,I.resizingShapes,{x:0,y:R},"s",F)},In=(b,_,R)=>{if(b){const F=f(b),I=Yt(_);if(F.height>=I)return;const B=I-F.height,H=d(F),U=H?H.y+H.height:F.y+F.height;zn(F,I),_t(U,H==null?void 0:H.id,B);return}if(!R)return;const k=te*(_+1);if(R.height>=k)return;const L=k-R.height,O=R.y+R.height;n.resizeShape(R,{x:R.x,y:R.y,width:R.width,height:k}),_t(O,R.id,L)},Dt=new Map;for(const b of N)Dt.set(b.flow.target,(Dt.get(b.flow.target)??0)+1);const pn=b=>(Dt.get(b)??0)<=1,Un=new Set(m.map(b=>b.node.id).filter(b=>V(b)===1&&!N.some(_=>_.flow.target===b||_.flow.source===b&&D.has(_.flow.target)))),br=new Map,yi=(b,_)=>{if(!b)return;const R=p(b);if(!R||R.height>=Yt(_))return;const k=R.y+R.height-10,L=d(R);if(L)return new Set((L.children??[]).filter(O=>O.type!=="bpmn:Lane"&&typeof O.y=="number"&&O.y>k).map(O=>O.id))},vi=(b,_,R)=>{if(!b)return!0;const k=p(b);return k?R-_.height/2>=k.y&&R+_.height/2<=k.y+k.height:!0},Qn=h.map((b,_)=>({op:b,declared:_}));Qn.sort((b,_)=>{const R=b.op.order??Number.POSITIVE_INFINITY,k=_.op.order??Number.POSITIVE_INFINITY;return R!==k?R-k:b.declared-_.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));const Do=r.getAll().filter(b=>b.type==="bpmn:Participant"&&b.parent===u()),hp=(()=>{if(!Do.length)return;const b=Do.filter(L=>!Ay(L)),_=b.length?b:Do,R=Math.min(..._.map(L=>L.x)),k=Math.max(..._.map(L=>L.x+L.width));return k>R?{x:R,width:k-R}:void 0})();for(const{op:b}of Qn){const _=b.participant,R=m.filter(fe=>fe.node.participant===_.id).length,k=((q1=_.lanes)==null?void 0:q1.length)??0,L=Math.max(1200,R*160+300),O=(_.lanes??[]).map(fe=>Yt(gt.get(fe.id)??0)),F=O.reduce((fe,Pe)=>fe+Pe,0);k&&F<300&&(O[k-1]+=300-F);const I=Math.max(300,te*((gt.get(`pool:${_.id}`)??0)+1)),B=_.blackBox||R+k===0?120:k?Math.max(300,F):I,H=_.blackBox?hp:void 0,U=(H==null?void 0:H.x)??100,ie=(H==null?void 0:H.width)??L,le=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:_.id,name:_.name,...b.order!==void 0?{"bwl:poolOrder":b.order}:{},..._.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:ie,height:B,isExpanded:!0}),ve=n.createShape(le,{x:U+ie/2,y:Kt+B/2},u()),re=_.lanes??[];if(re.length&&n.splitLane(ve,re.length),re.length){const fe=r.filter(Pe=>{var _e;return Pe.type==="bpmn:Lane"&&((_e=d(Pe))==null?void 0:_e.id)===_.id}).sort((Pe,_e)=>Pe.y-_e.y);if(fe.forEach((Pe,_e)=>{const ee=re[_e];ee&&n.updateProperties(Pe,{id:ee.id,name:ee.name})}),O.some(Pe=>Pe!==ve.height/k)){let Pe=ve.y;fe.forEach((_e,ee)=>{const se=O[ee];n.resizeShape(_e,{x:_e.x,y:Pe,width:_e.width,height:se}),Pe+=se})}}Kt=ve.y+ve.height+60}const bi=b=>{var k;const _=D.get(b);if(_)return _.node.participant??"";const R=p(b);return R?R.type==="bpmn:Participant"?R.id:((k=d(R))==null?void 0:k.id)??"":""},ft=new Map,St=b=>{let _=ft.get(b);return _||ft.set(b,_={nodes:[],flows:[]}),_};for(const b of m)St(b.node.participant??"").nodes.push(b);for(const b of N)St(bi(b.flow.source)).flows.push(b);const gp=b=>{var _;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((_=b.condition)==null?void 0:_.label)})},Cg=(b,_,R)=>o.createShape({type:Qc(b.type),...b.eventDefinition?{eventDefinitionType:Rc[b.eventDefinition]}:{},businessObject:i.create(Qc(b.type),{id:b.id,name:b.name,..._!==void 0?{"bwl:band":_}:{},...R!==void 0?{"bwl:afterColumn":R}:{}})}),t3=[...Qn.map(({op:b})=>b.participant.id).filter(b=>ft.has(b)),...[...ft.keys()].filter(b=>!h.some(_=>_.participant.id===b))],Mg=b=>b.endsWith("Gateway");for(const b of t3){const _=ft.get(b),R=b?f(b):void 0,k=R?R.x+150:250;let L=R?R.y+80:120;const O=(ee,se,ue)=>{if(ee){const be=f(ee);return be.y+Math.min(be.height/2,we)+Ce(ee,se??0)*te}return se!==void 0&&R?R.y+Oe+Ce(`pool:${b}`,se)*te:ue},F=(ee,se,ue)=>{if(ee){const be=f(ee);return be.y+Math.min(be.height/2,we)+se*te}return R?R.y+Oe+se*te:ue},I=ee=>ee.participant?f(ee.participant):u(),B=(ee,se,ue,be,et,ot,Mt,Ft)=>{const Ee=ue!==void 0||be!==void 0,Re=ke=>{const Me=()=>In(ue,ke,R);Ft?Ft(Me):Me()},De=Ce(ue??`pool:${b}`,be??0);if((be===void 0||Ze(ue,b,be,Mt??Number.NaN))&&Mt!==void 0&&vi(ue,se,Mt)&&!X(ee,se,et,Mt))return{x:et,y:Mt};if(Ee)for(let ke=0;ke<4;ke++){const Me=F(ue,De+ke,ot);if(!X(ee,se,et,Me,yi(ue,De+ke)))return Re(De+ke),{x:et,y:Me}}const Se=O(ue,be,ot);Ee?Re(De):Ft?Ft(()=>un(ee,se,se.y+se.height/2)):un(ee,se,Se);let he=et;for(let ke=0;ke<64;ke++){const Me=X(ee,se,he,Se);if(!Me)break;he=Me.x+Me.width+xe+se.width/2}return{x:he,y:Se}},H=new Set(_.flows.map(ee=>ee.flow.target)),U=new Map,ie=ee=>{if(ee===void 0)return;const se=r.get(ee);if(!(!se||typeof se.x!="number"||typeof se.width!="number"))return se.x+se.width+xe};for(const ee of _.nodes){if(H.has(ee.node.id))continue;const se=Cg(ee.node,ee.band,ee.afterColumn),ue=C(ee),be=ee.node.lane?`${ee.node.lane}|${ue??""}`:ue!==void 0?`band:${ue}`:"",et=I(ee.node),ot=U.get(be)??k,Mt=ie(ee.afterColumn),Ft=Mt===void 0?ot:Math.max(ot,Mt);let Ee;const Re=B(et,se,ee.node.lane,ue,Ft,L,void 0,Un.has(ee.node.id)&&ee.node.participant!==void 0?De=>Ee=De:void 0);if(Ee?n.createShape(se,Re,et,{autoResize:!1}):n.createShape(se,Re,et),Ee){const De=ee.node.lane?f(ee.node.lane):et;br.set(ee.node.id,{container:De,relCy:Re.y-De.y,grow:Ee})}U.set(be,Re.x+se.width+xe),!ee.node.lane&&ue===void 0&&(L+=160)}const le=new Set,ve=new Map,re=new Map,fe=new Map;if(b&&ce.has(`pool:${b}`)){const ee=new Map;for(const Ee of _.flows)ee.set(Ee.flow.target,(ee.get(Ee.flow.target)??0)+1);const se=Ee=>O(Ee.node.lane,G(Ee),Number.NaN),ue=new Set,be=Ee=>{var Se;const Re=(Se=D.get(Ee))==null?void 0:Se.node.participant;if(Re)return p(Re);const De=p(Ee);if(De)return De.type==="bpmn:Participant"?De:d(De)},et=Ee=>{const Re=[],De=new Set([Ee]),Se=[Ee];for(;Se.length;){const he=Se.shift(),ke=D.get(he);ke&&Re.push(ke);for(const Me of _.flows)Me.flow.source!==he||De.has(Me.flow.target)||(ee.get(Me.flow.target)??0)!==1||(De.add(Me.flow.target),Se.push(Me.flow.target))}return Re},ot=Ee=>{if(!R)return;const Re=new Set(Ee.map(he=>he.node.id));let De=!1,Se=!1;for(const he of y){if(!Re.has(he.flow.source))continue;const ke=be(he.flow.target);!ke||ke.id===R.id||(ke.y<R.y?De=!0:Se=!0)}return De&&!Se?"up":Se&&!De?"down":void 0};for(const Ee of _.nodes){if(!Mg(Ee.node.type))continue;const Re=O(Ee.node.lane,C(Ee),Number.NaN);if(Number.isNaN(Re))continue;const De=[];for(const Me of _.flows){if(Me.flow.source!==Ee.node.id)continue;const st=D.get(Me.flow.target);if(!st||st.node.lane!==Ee.node.lane||(ee.get(st.node.id)??0)!==1)continue;const yt=C(st);if(yt===void 0)continue;const vn=O(st.node.lane,yt,Number.NaN);if(Number.isNaN(vn))continue;const qn=et(st.node.id),It=ot(qn);It&&De.push({subtree:qn,band:yt,row:vn,dir:It})}if(!De.some(Me=>Me.dir==="up")||!De.some(Me=>Me.dir==="down")||!De.some(Me=>Me.dir==="up"&&De.some(st=>st.dir==="down"&&st.row<Me.row)))continue;const he=[...De].sort((Me,st)=>Me.row-st.row);[...De.filter(Me=>Me.dir==="up"),...De.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 yt=he[st].band;if(yt!==Me.band){ue.add(Ee.node.id);for(const vn of Me.subtree)C(vn)===Me.band&&S.set(vn.node.id,yt)}})}const Mt=Ee=>{if(!R)return;const Re=new Set(Ee.map(he=>he.node.id));let De=!1,Se=!1;for(const he of y){if(!Re.has(he.flow.target))continue;const ke=be(he.flow.source);!ke||ke.id===R.id||(ke.y<R.y?De=!0:Se=!0)}return De&&!Se?"up":Se&&!De?"down":void 0};for(const Ee of _.nodes){if(!Mg(Ee.node.type))continue;const Re=Ee.node.lane??`pool:${b}`,De=Ie.get(Re);if(!De||De.size<2)continue;const Se=De.get(0);if(Se===void 0)continue;const he=Math.max(...De.values()),ke=Se===he&&Se!==0?"down":void 0;if(!ke)continue;const Me=[];for(const It of _.flows){if(It.flow.source!==Ee.node.id)continue;const wn=D.get(It.flow.target);if(!wn||wn.node.lane!==Ee.node.lane||(ee.get(wn.node.id)??0)!==1)continue;const _n=G(wn);_n!==void 0&&Me.push({t:wn,subtree:et(wn.node.id),band:_n})}const st=Me.find(It=>(De.get(It.band)??It.band)===Se);if(!st||Mt(st.subtree)===ke||ot(st.subtree)===ke)continue;const yt=Me.find(It=>It!==st&&Mt(It.subtree)===ke);if(!yt)continue;const vn=st.band,qn=yt.band;for(const It of st.subtree)G(It)===vn&&S.set(It.node.id,qn);for(const It of yt.subtree)G(It)===qn&&S.set(It.node.id,vn);ue.add(Ee.node.id)}for(const Ee of _.nodes){if(!Mg(Ee.node.type))continue;const Re=se(Ee);if(Number.isNaN(Re)||E.some(Me=>{var st,yt;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&&((yt=Me.placement)==null?void 0:yt.side.startsWith("bottom"))}))continue;let Se,he=!1,ke;for(const Me of _.flows){if(Me.flow.source!==Ee.node.id)continue;const st=D.get(Me.flow.target);if(!st||!st.node.lane&&C(st)===void 0)continue;const yt=se(st);Number.isNaN(yt)||(Math.abs(yt-Re)<.5&&(he=!0),yt>Re?!Se||yt>Se.row?Se={id:st.node.id,row:yt,count:1}:yt===Se.row&&Se.count++:yt<Re&&st.node.lane===Ee.node.lane&&(!ke||yt>ke.row?ke={op:st,row:yt,count:1}:yt===ke.row&&ke.count++))}Se&&Se.count===1&&(ee.get(Se.id)??0)===1&&!ue.has(Ee.node.id)&&le.add(Se.id),!he&&ke&&ke.count===1&&(ee.get(ke.op.node.id)??0)===1&&!Z.has(Ee.node.id)&&ve.set(ke.op.node.id,{lane:Ee.node.lane,band:G(Ee)})}const Ft=new Map;for(const Ee of y)Ft.set(Ee.flow.target,[...Ft.get(Ee.flow.target)??[],Ee]);for(const Ee of _.nodes){const Re=Ft.get(Ee.node.id);if(!Re||Re.length!==1||!ee.get(Ee.node.id)||!Ee.node.lane&&C(Ee)===void 0||ae.has(Ee.node.id))continue;const De=(Y1=D.get(Re[0].flow.source))==null?void 0:Y1.node.participant,Se=De?p(De):void 0;if(!Se||!R||Se.id===R.id)continue;const he=Ee.node.lane??`pool:${b}`,ke=Ie.get(he);if(!ke)continue;const Me=ke.get(0)??0,st=(ke.get(G(Ee)??0)??Me)-Me;if(st===0)continue;const yt=Se.y<R.y;if(yt&&st<0||!yt&&st>0)continue;let vn;for(const[qn,It]of ke){const wn=It-Me;(yt&&wn<0&&(!vn||wn<vn.row)||!yt&&wn>0&&(!vn||wn>vn.row))&&(vn={band:qn,row:wn})}vn&&re.set(Ee.node.id,{lane:Ee.node.lane,band:vn.band})}}const Pe=new Set;let _e=0;for(;_e++<_.nodes.length+2;){for(let ue=0;ue<_.nodes.length+_.flows.length+2;ue++){let be=!1;for(const et of _.flows){const ot=et.flow;if(Pe.has(ot.id))continue;const Mt=p(ot.source);if(!Mt)continue;const Ft=p(ot.target),Ee=D.get(ot.target);if(!Ft&&Ee){const Re=Cg(Ee.node,Ee.band),De=G(Ee);if(Ee.node.lane||De!==void 0){const Se=I(Ee.node),he=Mt,ke=he.x+(fe.get(ot.source)??0)+he.width+xe,Me=ve.get(ot.target)??re.get(ot.target),st=B(Se,Re,Me?Me.lane:Ee.node.lane,Me?Me.band:De,le.has(ot.target)?he.x+he.width/2:ke,Number.NaN,Me||!pn(ot.target)?void 0:he.y+he.height/2),yt=n.createShape(Re,st,Se);le.has(ot.target)&&fe.set(ot.target,ke-(yt.x+yt.width/2)),n.connect(Mt,yt,{type:"bpmn:SequenceFlow",businessObject:gp(ot)})}else s.append(Mt,Re,{connection:{type:"bpmn:SequenceFlow",businessObject:gp(ot)}})}else if(Ft)n.connect(Mt,Ft,{type:"bpmn:SequenceFlow",businessObject:gp(ot)});else continue;Pe.add(ot.id),be=!0}if(!be)break}const ee=_.nodes.filter(ue=>!p(ue.node.id));if(!ee.length)break;const se=ee[0];{const ue=Cg(se.node,se.band),be=I(se.node),et=C(se);n.createShape(ue,B(be,ue,se.node.lane,et,k,L),be),!se.node.lane&&et===void 0&&(L+=160)}}}const y1=new Map;for(const[b,_]of P){const R=p(b),k=p(_.flow.target);if(!(R!=null&&R.target)||!k)continue;const L=R.label&&{x:R.label.x,y:R.label.y,width:R.label.width,height:R.label.height};y1.set(b,{waypoints:R.waypoints.map(I=>({x:I.x,y:I.y})),label:L});const O=R.target,F=I=>({x:I.x+I.width/2,y:I.y+I.height/2});n.reconnect(R,k,O,[F(k),F(O)]),n.layoutConnection(R,{waypoints:[]})}const Yr=40,mp=b=>{const _=U=>U.kind==="label-over-line"||U.kind==="label-over-shape"||U.kind==="label-on-shared-segment"?U.edge===b.id:U.kind==="annotation-over-label"||U.kind==="pool-name-over-label"?U.label===b.id:!1,R=()=>new Map(pt(Ge(r)).filter(U=>!_(U)).map(U=>[ct(U),U])),k=R(),L=U=>[...U].filter(([ie])=>!k.has(ie)).map(([,ie])=>ie),O=U=>L(U).length<=[...k.keys()].filter(ie=>!U.has(ie)).length,F=b.waypoints.map(U=>({x:U.x,y:U.y})),I=b.label,B=I&&{x:I.x,y:I.y};n.layoutConnection(b,{waypoints:[]});const H=R();if(!O(H)){if(L(H).every(U=>U.kind==="edge-crosses-shape"&&U.edge===b.id)){const U=Ge(r),ie=U.edges.find(fe=>fe.id===b.id),le=Fn(U),ve=ie?jt(ie,le):[],re=ie&&ve.length&&!ve.every(fe=>fe.type==="bpmn:TextAnnotation")?Wc(ie,le,Uc(b),U.edges):null;if(re&&(n.updateWaypoints(b,re),O(R())))return}n.updateWaypoints(b,F),I&&B&&(I.x!==B.x||I.y!==B.y)&&n.moveElements([I],{x:B.x-I.x,y:B.y-I.y})}},v1=5,Li=10,b1=200,vc=new Set([...N.map(b=>b.flow.id),...y.map(b=>b.flow.id),...Gt(e,"sequenceFlow.update").map(b=>b.id),...Gt(e,"messageFlow.update").map(b=>b.id)].filter(b=>!!b)),n3=(b,_,R,k,L,O)=>{const F=new Set(b.map(ee=>ee.id)),I=Math.min(...b.map(ee=>ee.x))+_-Li,B=Math.max(...b.map(ee=>ee.x+ee.width))+_+b1+Li,H=Math.min(...b.map(ee=>ee.y+Math.min(0,...R)))-Li,U=Math.max(...b.map(ee=>ee.y+ee.height+Math.max(0,...R)))+Li,ie=r.getAll().filter(ee=>{if(ee.type!=="bpmn:SequenceFlow"&&ee.type!=="bpmn:MessageFlow")return!1;const se=ee;return vc.has(se.id)||!se.waypoints||se.waypoints.length<2||[se.source,se.target].some(be=>!be||F.has(be.id)||be.x>=k)?!1:se.waypoints.some((be,et)=>{const ot=se.waypoints[et+1];return!!ot&&Math.max(be.x,ot.x)>=I&&Math.min(be.x,ot.x)<=B&&Math.max(be.y,ot.y)>=H&&Math.min(be.y,ot.y)<=U})});if(!ie.length)return 0;const le=ee=>{const se=new Map;for(const ue of b)for(const be of R){const et={id:ue.id,type:ue.type,x:ue.x+_+ee,y:ue.y+be,width:ue.width,height:ue.height};for(const ot of ie){let Mt=1/0;for(let Ee=0;Ee+1<ot.waypoints.length;Ee++)Mt=Math.min(Mt,ls(ot.waypoints[Ee],ot.waypoints[Ee+1],et));const Ft=`${ot.id}|${ue.id}`;se.set(Ft,Math.min(se.get(Ft)??1/0,Mt))}}return se},ve=[...le(0)].filter(([,ee])=>ee<=v1).map(([ee])=>ee);if(!ve.length)return 0;let re=0;for(let ee=1;ee<=b1;ee++){const se=le(ee);if([...se.values()].every(ue=>ue>v1)&&ve.every(ue=>(se.get(ue)??1/0)>=Li)){re=ee;break}}if(!re)return 0;const fe=Math.min(...b.map(ee=>ee.x))+_+re,Pe=new Set(ve.map(ee=>ee.slice(0,ee.indexOf("|"))));return ie.some(ee=>ee.type==="bpmn:SequenceFlow"&&Pe.has(ee.id)&&ee.waypoints.some((se,ue)=>{const be=ee.waypoints[ue+1];if(!be||Math.min(se.y,be.y)>O||Math.max(se.y,be.y)<O||se.y===be.y)return!1;const et=se.x+(O-se.y)*(be.x-se.x)/(be.y-se.y);return et>L&&et<fe}))?0:re},Kr=(b,_=()=>!0)=>{const R=p(b);if(!R)return[];const k=[R],L=new Set([b]);for(let O=0;O<k.length;O++){const F=k[O].id;for(const I of N){const B=I.flow.target;if(I.flow.source!==F||L.has(B)||!D.has(B))continue;L.add(B);const H=p(B);H&&_(H)&&k.push(H)}}return k},i3=(b,_=()=>!0)=>{const R=p(b);if(!R)return[];const k=[R],L=new Set([b]);for(let O=0;O<k.length;O++){const F=k[O].id;for(const I of N){const B=I.flow.source;if(I.flow.target!==F||L.has(B)||!D.has(B))continue;L.add(B);const H=p(B);H&&_(H)&&k.push(H)}}return k},Ii=30,Bi=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",Xa=(b,_)=>_f(n,b,_),Za=(b,_,R=!1)=>{const k=new Set(b.flatMap(B=>B.subtree.map(H=>H.id)));for(const B of b){const H=(B.pool.children??[]).filter(Bi).filter(ie=>!k.has(ie.id));if(B.subtree.some(ie=>H.some(le=>ie.x+_<le.x+le.width+Ii&&ie.x+_+ie.width+Ii>le.x&&ie.y<le.y+le.height&&ie.y+ie.height>le.y)))return null}const L=b.map(B=>B.pool.width),O=R?r.filter(B=>Array.isArray(B.waypoints)).map(B=>({c:B,wps:B.waypoints.map(H=>({x:H.x,y:H.y}))})):[],F=r.filter(B=>B.type==="label").map(B=>({label:B,x:B.x,y:B.y}));n.moveElements(b.flatMap(B=>B.subtree),{x:_,y:0});const I=b.map(B=>{const U=Math.max(...B.subtree.map(ie=>ie.x+ie.width))+My-(B.pool.x+B.pool.width);return U>0&&Xa(B.pool,B.pool.width+U),U});return()=>{n.moveElements(b.flatMap(B=>B.subtree),{x:-_,y:0}),b.forEach((B,H)=>{I[H]>0&&Xa(B.pool,L[H])});for(const{c:B,wps:H}of O){const U=B.waypoints??[];U.length===H.length&&U.every((le,ve)=>Math.abs(le.x-H[ve].x)<=.5&&Math.abs(le.y-H[ve].y)<=.5)||n.updateWaypoints(B,H.map(le=>({x:le.x,y:le.y})))}for(let B=0;B<3;B++){let H=0;for(const U of F){const ie=U.x-U.label.x,le=U.y-U.label.y;Math.abs(ie)<=.5&&Math.abs(le)<=.5||(n.moveElements([U.label],{x:ie,y:le}),H++)}if(!H)break}}},Ag=b=>{var L,O;const _=new Map,R=new Map;for(const F of r.getAll()){if(F.type!=="bpmn:Participant")continue;const I=F;(I.children??[]).length||(_.set(I.id,I),R.set(I.id,[]))}for(const F of r.getAll()){if(F.type!=="bpmn:MessageFlow")continue;const I=F,B=(L=I.source)==null?void 0:L.id,H=(O=I.target)==null?void 0:O.id;B&&H&&R.has(B)&&R.get(B).push(H),B&&H&&R.has(H)&&R.get(H).push(B)}const k=[];for(const[F,I]of R)I.length&&I.every(B=>b.has(B))&&k.push(_.get(F));return k},x1=(b,_)=>{if(!b.length)return null;const R=new Set(b.map(U=>U.id)),k=r.getAll().filter(U=>U.type==="bpmn:Participant"&&!R.has(U.id)),L=Math.min(...k.filter(U=>(U.children??[]).length>0).map(U=>U.x)),O=new Set(b.filter(U=>Math.abs(U.x-L)<=2).map(U=>U.id));if(b.some(U=>{const ie=O.has(U.id)?U.x:U.x+_,le=O.has(U.id)?U.width+_:U.width;return k.some(ve=>ie<ve.x+ve.width+Ii&&ie+le+Ii>ve.x&&U.y<ve.y+ve.height&&U.y+U.height>ve.y)}))return null;const I=r.filter(U=>U.type==="label").map(U=>({label:U,x:U.x,y:U.y})),B=b.filter(U=>!O.has(U.id)),H=b.filter(U=>O.has(U.id)).map(U=>({pool:U,was:{x:U.x,y:U.y,width:U.width,height:U.height}}));B.length&&n.moveElements(B,{x:_,y:0});for(const{pool:U,was:ie}of H)n.resizeShape(U,{...ie,width:ie.width+_});return()=>{for(const{pool:U,was:ie}of H)n.resizeShape(U,ie);B.length&&n.moveElements(B,{x:-_,y:0});for(let U=0;U<3;U++){let ie=0;for(const le of I){const ve=le.x-le.label.x,re=le.y-le.label.y;Math.abs(ve)<=.5&&Math.abs(re)<=.5||(n.moveElements([le.label],{x:ve,y:re}),ie++)}if(!ie)break}}},w1=(b,_,R)=>{const k=R.x+R.width/2,L=_.y>R.y,O=L?R.y+R.height:R.y,F=L?_.y:_.y+_.height,I=b.source===_?[{x:k,y:F},{x:k,y:O}]:[{x:k,y:O},{x:k,y:F}],B=Ge(r),H={...B.edges.find(U=>U.id===b.id),waypoints:I};return jt(H,Fn(B)).length?!1:(n.updateWaypoints(b,I),!0)},o3=()=>{const b=r.filter(F=>F.type==="bpmn:Participant"),_=Math.min(...b.filter(F=>(F.children??[]).length>0).map(F=>F.x)),R=F=>h.some(I=>I.participant.id===F.id),k=F=>!!F&&F.type==="bpmn:Participant"&&!(F.children??[]).length&&Math.abs(F.x-_)<=2&&!R(F),L=F=>!!F&&F.type==="bpmn:Participant"&&(F.children??[]).length>0&&!R(F),O=new Set;for(const F of r.getAll()){if(F.type!=="bpmn:MessageFlow")continue;const I=F;if((I.waypoints??[]).length!==2)continue;const B=[I.source,I.target].find(ie=>k(ie)||L(ie)),H=B===I.source?I.target:I.source;if(!B||!H||H.type==="bpmn:Participant")continue;const U=H.x+H.width/2;L(B)&&(U<B.x||U>B.x+B.width)||O.add(I.id)}return O},r3=b=>{var R;const _=new Map;for(const k of b){const L=r.get(k);if(!L||(L.waypoints??[]).length===2)continue;const O=((R=L.source)==null?void 0:R.type)==="bpmn:Participant"?L.source:L.target,F=O===L.source?L.target:L.source;if(F.x+F.width/2<=O.x+O.width)continue;const I=_.get(O.id)??{pool:O,msgs:[]};I.msgs.push({conn:L,other:F}),_.set(O.id,I)}for(const{pool:k,msgs:L}of _.values()){const O=Math.max(...L.map(({other:re})=>re.x+re.width/2))+xf;if(r.getAll().some(re=>{if(re.type!=="bpmn:Participant"||re.id===k.id)return!1;const fe=re;return k.x<fe.x+fe.width+Ii&&O+Ii>fe.x&&k.y<fe.y+fe.height&&k.y+k.height>fe.y}))continue;const I={x:k.x,y:k.y,width:k.width,height:k.height},B=[...k.incoming??[],...k.outgoing??[]],H=B.map(re=>({c:re,wps:(re.waypoints??[]).map(fe=>({x:fe.x,y:fe.y}))})),U=B.flatMap(re=>{const fe=re.label;return fe?[{label:fe,x:fe.x,y:fe.y}]:[]}),ie=xr();Xa(k,O-k.x);const le=L.filter(({conn:re,other:fe})=>w1(re,k,fe)).length,ve=xr();if(!(le>0&&ve.messages>ie.messages&&ve.lines>=ie.lines)){Xa(k,I.width);for(const{c:re,wps:fe}of H){const Pe=re.waypoints??[];Pe.length===fe.length&&Pe.every((ee,se)=>Math.abs(ee.x-fe[se].x)<=.5&&Math.abs(ee.y-fe[se].y)<=.5)||n.updateWaypoints(re,fe.map(ee=>({x:ee.x,y:ee.y})))}for(let re=0;re<3;re++){let fe=0;for(const Pe of U){const _e=Pe.x-Pe.label.x,ee=Pe.y-Pe.label.y;Math.abs(_e)<=.5&&Math.abs(ee)<=.5||(n.moveElements([Pe.label],{x:_e,y:ee}),fe++)}if(!fe)break}}}},_1=()=>{let b=0;for(const _ of r.getAll()){if(_.type!=="bpmn:DataInputAssociation"&&_.type!=="bpmn:DataOutputAssociation")continue;const R=_.waypoints??[];for(let k=1;k<R.length;k++)b+=Math.hypot(R[k].x-R[k-1].x,R[k].y-R[k-1].y)}return b},E1=()=>{let b=0;for(const _ of r.getAll()){if(_.type!=="bpmn:Association")continue;const R=_.waypoints??[];for(let k=1;k<R.length;k++)b+=Math.hypot(R[k].x-R[k-1].x,R[k].y-R[k-1].y)}return b},a3=b=>{const _=[];for(const R of r.getAll()){if(R.type!=="bpmn:TextAnnotation")continue;const k=R;if(b.has(k.id))continue;const O=[...k.incoming??[],...k.outgoing??[]].filter(B=>B.type==="bpmn:Association").map(B=>B.source===k?B.target:B.source);if(!O.length||O.some(B=>B===void 0))continue;const F=B=>{if(!("waypoints"in B&&B.waypoints))return[B.id];const H=B,U=[H.source,H.target];return U.some(ie=>!ie)?[]:U.map(ie=>ie.id)},I=O.flatMap(B=>F(B));I.length&&I.every(B=>b.has(B))&&_.push(k)}return _},S1=()=>pt(Ge(r)).filter(b=>b.kind==="edge-crosses-shape").length,R1=b=>{const _=(b.children??[]).filter(Bi);let R=0;for(let k=0;k<_.length;k++)for(let L=k+1;L<_.length;L++){const O=_[k],F=_[L];O.x<F.x+F.width&&O.x+O.width>F.x&&O.y<F.y+F.height&&O.y+O.height>F.y&&R++}return R},xr=()=>{const b=Ge(r),_=R=>R.length>=2&&(R.every(k=>Math.abs(k.x-R[0].x)<.01)||R.every(k=>Math.abs(k.y-R[0].y)<.01));return{messages:b.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length,lines:b.edges.filter(R=>_(R.waypoints)).length}},C1=b=>{const _=new Map;for(const k of r.getAll()){if(k.type!=="bpmn:MessageFlow")continue;const L=k;if(!L.waypoints||L.waypoints.length!==2)continue;const O=L.source,F=L.target;if(!O||!F)continue;const I=b.has(O.id);if(I===b.has(F.id))continue;const B=I?F:O,H=d(B);if(!H||b.has(B.id))continue;const U=_.get(H.id);U?B.x<U.minX&&(U.minX=B.x):_.set(H.id,{pool:H,minX:B.x})}const R=[];for(const{pool:k,minX:L}of _.values()){const O=(k.children??[]).filter(F=>Bi(F)&&!b.has(F.id)&&F.x>=L);O.length&&R.push({subtree:O,pool:k})}return R},s3=(b,_,R)=>{const k=new Map(_.map(F=>[F.pool.id,{subtree:[...F.subtree],pool:F.pool}])),L=new Set(b);for(const F of _)for(const I of F.subtree)L.add(I.id);let O=!1;for(;;){let F=0;for(const I of C1(L)){if(I.pool===R)continue;const B=k.get(I.pool.id);B?B.subtree.push(...I.subtree):k.set(I.pool.id,{subtree:[...I.subtree],pool:I.pool});for(const H of I.subtree)L.add(H.id);F+=I.subtree.length}if(!F)break;O=!0}return O?[...k.values()]:null},c3=(b,_)=>{const R=new Map;for(const L of r.getAll()){if(L.type!=="bpmn:DataInputAssociation"&&L.type!=="bpmn:DataOutputAssociation")continue;const O=L,F=O.waypoints;if(!F||F.length<2||!F.every(ve=>Math.abs(ve.x-F[0].x)<1))continue;const I=O.source,B=O.target;if(!I||!B)continue;const H=b.has(I.id);if(H===b.has(B.id))continue;const U=H?B:I,ie=d(U);if(!ie||ie===_||ie===d(H?I:B))continue;const le=R.get(ie.id);le?U.x<le.minX&&(le.minX=U.x):R.set(ie.id,{pool:ie,minX:U.x})}const k=[];for(const{pool:L,minX:O}of R.values()){const F=(L.children??[]).filter(I=>Bi(I)&&!b.has(I.id)&&I.x>=O);F.length&&k.push({subtree:F,pool:L})}return k},M1=b=>{const _=Ge(r),R=_.shapes.filter(L=>b.has(L.id)),k=new Set;for(const L of _.edges)if(!(L.type!=="bpmn:SequenceFlow"&&L.type!=="bpmn:MessageFlow"))for(const O of jt(L,R))k.add(`${L.id}|${O.id}`);return k},Pg=new Map,l3=Gt(e,"sequenceFlow.update").flatMap(b=>{if(b.target!==void 0)return[{id:b.id,target:b.target,source:b.source}];const _=P.get(b.id);return _?[{id:b.id,target:_.flow.target,source:_.flow.source}]:[]});for(const b of l3){if(b.target===void 0)continue;const _=D.get(b.target);if(!_)continue;const R=p(b.target),k=p(b.id);if(!R||!k)continue;const L=b.source!==void 0?p(b.source):k.source,O=k.target;if(!L||!O||O.id===R.id)continue;const F=y1.get(k.id)??{waypoints:k.waypoints,label:k.label},I=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,B=I?F.waypoints[1].y:void 0,H=I&&F.label?{x:F.label.x,y:F.label.y}:void 0,U=H&&F.label&&Math.abs(H.y+F.label.height/2-B)<=te/5&&H.x+F.label.width>I.x?H.x+F.label.width+6:void 0,ie=(L.outgoing??[]).filter(Be=>Be.type==="bpmn:SequenceFlow"&&Be.id!==k.id&&Be.target&&!vc.has(Be.id)),le=new Set(ie.map(Be=>Be.target.id)),ve=Be=>{const At={type:"bpmn:Task",x:Be.x+2,y:Be.y+2,width:Be.width-4,height:Be.height-4};return ie.find(wt=>(wt.waypoints??[]).some((fn,Ne)=>!!wt.waypoints[Ne+1]&&ls(fn,wt.waypoints[Ne+1],At)===0))},re=Kr(b.target),fe=new Set(re.map(Be=>Be.id)),Pe=br.has(b.target)?{autoResize:!1}:void 0,_e=Math.min(...re.map(Be=>Be.x)),ee=Math.max(...re.map(Be=>Be.x+Be.width)),se=L.x+L.width,ue=O.x+O.width<=L.x,be=(()=>{if(!ue)return;const Be=d(R),At=((Be==null?void 0:Be.children)??[]).filter(Fe=>Bi(Fe)&&!fe.has(Fe.id)&&Fe.type!=="bpmn:Group"&&Fe.type!=="bpmn:Participant"),wt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],fn=r.getAll().filter(Fe=>{if(!wt.includes(Fe.type))return!1;const Bt=Fe;return Bt.id===k.id||vc.has(Bt.id)||!Bt.waypoints||Bt.waypoints.length<2?!1:![Bt.source,Bt.target].some(Pt=>!Pt||fe.has(Pt.id))}),Ne=(Fe,Bt)=>re.every(Pt=>{var Jr;const bt={id:Pt.id,type:Pt.type,x:Pt.x+Fe,y:Pt.y+Bt,width:Pt.width,height:Pt.height};return Be&&(bt.x<Be.x||bt.x+bt.width>Be.x+Be.width||bt.y<Be.y||bt.y+bt.height>Be.y+Be.height)||!vi((Jr=D.get(Pt.id))==null?void 0:Jr.node.lane,Pt,Pt.y+Bt+Pt.height/2)||At.some(Yn=>bt.x<Yn.x+Yn.width+Li&&bt.x+bt.width+Li>Yn.x&&bt.y<Yn.y+Yn.height+Li&&bt.y+bt.height+Li>Yn.y)?!1:fn.every(Yn=>{for(let po=0;po+1<Yn.waypoints.length;po++)if(ls(Yn.waypoints[po],Yn.waypoints[po+1],bt)<Li)return!1;return!0})}),Xe=L.x+L.width/2,vt=L.y+L.height/2,Qe=F.waypoints??[],Ct=Qe.length>=2&&Math.abs(Qe[0].y-Qe[1].y)<1&&Qe[1].x<Qe[0].x;return[...B!==void 0?[{cx:Xe,cy:B}]:[],...Ct?[{cx:L.x-Yr-R.width/2,cy:Qe[0].y}]:[],{cx:Xe,cy:vt+te},{cx:Xe,cy:vt-te}].find(Fe=>Ne(Fe.cx-(R.x+R.width/2),Fe.cy-(R.y+R.height/2)))})(),et=ue&&!be?se:O.x,ot=R.y+R.height/2,Mt=n3(re,se+Yr-_e,[0,L.y+L.height/2-ot,O.y+O.height/2-ot],et,se,L.y+L.height/2),Ft=se+Yr+Mt,Ee=(()=>{if(U===void 0)return 0;const Be=se+Yr,At=L.y+L.height/2-R.height/2,wt={x:Be,y:At,width:ee-_e,height:R.height},fn=d(L);return((fn==null?void 0:fn.children)??[]).some(Xe=>Bi(Xe)&&!fe.has(Xe.id)&&Xe.id!==L.id&&Xe.id!==O.id&&Xe.type!=="bpmn:Group"&&Xe.type!=="bpmn:Participant"&&Xe.x<wt.x+wt.width&&Xe.x+Xe.width>wt.x&&Xe.y<wt.y+wt.height&&Xe.y+Xe.height>wt.y)||ve(wt)?Math.max(0,U-Be):0})(),Re=be?0:ee-_e+Yr*2+Mt+Ee-(ue?0:O.x-se);let De=[];if(Re>0){const Be=d(R),At=(Be==null?void 0:Be.children)??[],wt=Qe=>Qe.type==="bpmn:Lane";De=(()=>{const Qe=new Set;for(const He of At)Bi(He)&&!fe.has(He.id)&&He.id!==L.id&&He.x>=et&&Qe.add(He.id);const Ct=[];for(const He of At){if(He.type!=="bpmn:DataStoreReference"&&He.type!=="bpmn:DataObjectReference")continue;const Fe=He,Pt=[...Fe.incoming??[],...Fe.outgoing??[]].filter(bt=>bt.type==="bpmn:DataInputAssociation"||bt.type==="bpmn:DataOutputAssociation").map(bt=>bt.source===Fe?bt.target:bt.source);Pt.length&&Pt.every(bt=>bt!==void 0&&Qe.has(bt.id))&&Ct.push(Fe)}return Ct})();const Ne=At.filter(Qe=>!("waypoints"in Qe&&Qe.waypoints)&&!wt(Qe)&&Qe.type!=="label"&&!fe.has(Qe.id)&&Qe.id!==L.id&&Qe.x>=et),Xe=Ne.flatMap(Qe=>Qe.labels??[]),vt=Be?[Be,...At.filter(Qe=>wt(Qe))]:[];if(Ne.length){const Qe=new Set(Ne.map(tt=>tt.id)),Ct=C1(Qe),He=Ct.length?s3(Qe,Ct,Be):null,Fe=tt=>{const xt=new Set(Qe);for(const Nt of tt)for(const Io of Nt.subtree)xt.add(Io.id);return a3(xt)},Bt=Fe(Ct),Pt=He?Fe(He):Bt,bt=Ag(Qe),Jr=new Set(Qe);for(const tt of Ct)for(const xt of tt.subtree)Jr.add(xt.id);const Yn=Ct.length?Ag(Jr):bt,po=(()=>{if(!He)return[];const tt=new Set(Qe);for(const xt of He)for(const Nt of xt.subtree)tt.add(Nt.id);return Ag(tt)})(),ts=He??Ct,ea=(()=>{const tt=new Set(Qe);for(const xt of ts)for(const Nt of xt.subtree)tt.add(Nt.id);return c3(tt,Be)})(),Bg=ea.length?Fe([...ts,...ea]):Bt,Ui=new Set([...Ne,...vt].map(tt=>tt.id)),mt=At.filter(tt=>{const xt=tt.labelTarget;return tt.type==="label"&&!!xt&&"waypoints"in xt&&!!xt.source&&!!xt.target&&Ui.has(xt.source.id)&&Ui.has(xt.target.id)}),En=o3();n.createSpace([...Ne,...Xe,...mt],vt,{x:Re,y:0},"e",et-1);const Xt=(tt,xt,Nt)=>{const Io=xr(),_p=Nt?M1(Nt):null,Ep=Za(tt,Re,!!Nt);if(!Ep)return!1;const wc=xt.length?x1(xt,Re):null,Sp=xr(),Zt=!!Nt&&!!_p&&[...M1(Nt)].some(na=>!_p.has(na));return Sp.messages>Io.messages&&Sp.lines>=Io.lines&&!Zt?!0:(wc==null||wc(),Ep(),!1)},ui=ea.length>0&&Xt([...ts,...ea],He?po:Yn,new Set(ea.flatMap(tt=>tt.subtree.map(xt=>xt.id)))),ta=!ui&&He?Xt(He,po):!1;let fo=ui||ta;!fo&&Ct.length&&(fo=Xt(Ct,Yn));const ns=ui?Bg:ta?Pt:Bt;if(!fo){for(const tt of Ct){const xt=xr(),Nt=Za([tt],Re);if(!Nt)continue;const Io=xr();(Io.messages<=xt.messages||Io.lines<xt.lines)&&Nt()}if(bt.length){const tt=xr(),xt=x1(bt,Re);if(xt){const Nt=xr();(Nt.messages<=tt.messages||Nt.lines<tt.lines)&&xt()}}}if(r3(En),ns.length){const tt=()=>new Set(pt(Ge(r)).map(Nt=>ct(Nt))),xt=Nt=>{const Io=E1(),_p=tt(),Ep=Nt.map(Zt=>({a:Zt,x:Zt.x,y:Zt.y})),wc=r.filter(Zt=>Zt.type==="label").map(Zt=>({label:Zt,x:Zt.x,y:Zt.y}));n.moveElements(Nt,{x:Re,y:0});const Sp=[...tt()].filter(Zt=>!_p.has(Zt));if(E1()<Io&&Sp.length===0)return!0;for(const{a:Zt,x:na,y:_c}of Ep)(Zt.x!==na||Zt.y!==_c)&&n.moveElements([Zt],{x:na-Zt.x,y:_c-Zt.y});for(const Zt of wc){const na=Zt.x-Zt.label.x,_c=Zt.y-Zt.label.y;(na!==0||_c!==0)&&n.moveElements([Zt.label],{x:na,y:_c})}return!1};if(!xt(ns)&&ns.length>1)for(const Nt of ns)xt([Nt])}}}const Se=_.node.lane!==void 0?p(_.node.lane):_.node.participant!==void 0?p(_.node.participant):void 0,he=Be=>{if(!Se)return!0;const At=Be.y+Be.height/2;return At>=Se.y&&At<=Se.y+Se.height},ke=!he(L)&&he(O),Me=Be=>Be.y+Be.height/2,st=()=>{const Be=L.x+L.width,At=O.x,wt=Me(O)-R.height/2,fn=Me(O)+R.height/2;return!r.getAll().some(Ne=>Bi(Ne)&&Ne.type!=="bpmn:Participant"&&Ne.type!=="bpmn:Group"&&Ne.type!=="bpmn:TextAnnotation"&&Ne.id!==L.id&&Ne.id!==O.id&&Ne.id!==R.id&&Ne.x<At&&Ne.x+Ne.width>Be&&Ne.y<fn&&Ne.y+Ne.height>wt)},yt=!ke&&_.band!==void 0&&he(O)&&!Ze(_.node.lane,_.node.participant,_.band,Me(L))&&Ze(_.node.lane,_.node.participant,_.band,Me(O))&&O.x>=L.x+L.width&&st(),vn=ke||yt?O:L,qn=vn.y+vn.height/2,It=qn-(R.y+R.height/2),wn=_.band!==void 0,_n=wn?[R]:re,es=(_.band===void 0||Ze(_.node.lane,_.node.participant,_.band,qn))&&pn(b.target)&&_n.every(Be=>{var At;return vi((At=D.get(Be.id))==null?void 0:At.node.lane,Be,Be.y+Be.height/2+It)}),O3=Be=>Math.abs(Be.y+Be.height/2-(R.y+R.height/2))<=te/2;if(es&&wn){const Be=Math.abs(It)<=te/2?re.filter(Ne=>Ne.id!==R.id&&O3(Ne)):[],At=R.y+R.height/2,fn=_.band!==void 0&&!Ze(_.node.lane,_.node.participant,_.band,At)?re.filter(Ne=>{var Xe,vt;return Ne.id!==R.id&&!Be.includes(Ne)&&((Xe=D.get(Ne.id))==null?void 0:Xe.band)===_.band&&((vt=D.get(Ne.id))==null?void 0:vt.node.lane)===_.node.lane&&(Math.abs(Ne.y+Ne.height/2-At)<=te/2||Ze(_.node.lane,_.node.participant,_.band,Ne.y+Ne.height/2))}).map(Ne=>({t:Ne,dy:qn-(Ne.y+Ne.height/2)})).filter(({dy:Ne})=>Ne!==0):[];if(n.moveElements(re,{x:Ft-_e,y:0},void 0,Pe),n.moveElements([R],{x:0,y:It},void 0,Pe),Be.length){const Ne=()=>new Set(pt(Ge(r)).map(Fe=>ct(Fe))),Xe=Ne(),vt=r.filter(Fe=>Fe.type==="label").map(Fe=>({label:Fe,x:Fe.x,y:Fe.y}));n.moveElements(Be,{x:0,y:It});const Qe=Ne(),Ct=[...Qe].filter(Fe=>!Xe.has(Fe)).length,He=[...Xe].filter(Fe=>!Qe.has(Fe)).length;if(Ct>He){n.moveElements(Be,{x:0,y:-It});for(const Fe of vt){const Bt=Fe.x-Fe.label.x,Pt=Fe.y-Fe.label.y;(Bt!==0||Pt!==0)&&n.moveElements([Fe.label],{x:Bt,y:Pt})}}}if(fn.length){const Ne=new Set(re.map(Xe=>Xe.id));for(const{t:Xe,dy:vt}of fn)X(Xe.parent,Xe,Xe.x+Xe.width/2,Xe.y+Xe.height/2+vt,Ne)||n.moveElements([Xe],{x:0,y:vt})}}else n.moveElements(re,{x:Ft-_e,y:es?It:0},void 0,Pe);const Wi=d(R);if(!es&&_.node.lane===void 0&&_.band!==void 0&&Wi){const Be=Wi.y+Oe+Ce(`pool:${_.node.participant??""}`,_.band)*te,At=Be-(R.y+R.height/2);At!==0&&!X(Wi,R,R.x+R.width/2,Be,fe)&&n.moveElements([R],{x:0,y:At},void 0,Pe)}if(be)n.moveElements(re,{x:be.cx-(R.x+R.width/2),y:be.cy-(R.y+R.height/2)},void 0,Pe);else if(Wi){const Be=(Wi.children??[]).filter(Ne=>Bi(Ne)&&!fe.has(Ne.id)&&Ne.type!=="bpmn:Group"&&Ne.type!=="bpmn:Participant"),At=(Ne,Xe,vt,Qe,Ct)=>Ne.x+Xe<Ct.x+Ct.width+Qe&&Ne.x+Xe+Ne.width+Qe>Ct.x&&Ne.y+vt<Ct.y+Ct.height+Qe&&Ne.y+vt+Ne.height+Qe>Ct.y,wt=Be.find(Ne=>At(R,0,0,0,Ne)),fn=wt?void 0:ve(R);if(wt||fn){const Ne=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Xe=r.getAll().filter(mt=>{if(!Ne.includes(mt.type))return!1;const En=mt;return vc.has(En.id)||!En.waypoints||En.waypoints.length<2?!1:![En.source,En.target].some(Xt=>!Xt||fe.has(Xt.id))}),vt=(mt,En,Xt)=>{var ui;return vi((ui=D.get(mt.id))==null?void 0:ui.node.lane,mt,mt.y+Xt+mt.height/2)&&mt.x+En>=Wi.x&&mt.x+En+mt.width<=Wi.x+Wi.width&&mt.y+Xt>=Wi.y&&mt.y+Xt+mt.height<=Wi.y+Wi.height},Qe=(mt,En)=>re.every(Xt=>vt(Xt,mt,En)&&!Be.some(ui=>At(Xt,mt,En,Li,ui))&&Xe.every(ui=>{const ta={id:Xt.id,type:Xt.type,x:Xt.x+mt,y:Xt.y+En,width:Xt.width,height:Xt.height};for(let fo=0;fo+1<ui.waypoints.length;fo++)if(ls(ui.waypoints[fo],ui.waypoints[fo+1],ta)<Li)return!1;return!0})),Ct=R.y+R.height/2,He=[B,O.y+O.height/2].filter(mt=>mt!==void 0&&Math.abs(mt-Ct)>=1),Fe=wt&&le.has(wt.id)?wt:fn==null?void 0:fn.target,Bt=Fe?Fe.x-R.x:0,Pt=Math.max(...re.map(mt=>mt.x+mt.width)),bt=[...Bt!==0?[Bt]:[],...Mt!==0?[-Mt]:[],0],Jr=U===void 0?[]:bt.map(mt=>Math.max(mt,U-R.x)),Yn=mt=>Pt+mt+Yr<=O.x,po=[...new Set([...Jr,...bt])].filter(Yn),ts=wt&&le.has(wt.id)?[wt.x+wt.width+Yr-R.x]:[],ea=U===void 0?[]:ts.map(mt=>Math.max(mt,U-R.x)),Bg=[...new Set([...ea,...ts])].filter(mt=>Yn(mt)&&!po.includes(mt));let Ui;for(const mt of[po,Bg]){for(const En of He){for(const Xt of mt)if(Qe(Xt,En-Ct)){Ui={dx:Xt,dy:En-Ct};break}if(Ui)break}if(Ui)break}if(Ui){const mt=tt=>{const xt=tt;return[xt.edge,xt.other,...Array.isArray(xt.edges)?xt.edges:[]].some(Nt=>typeof Nt=="string"&&vc.has(Nt))},En=()=>new Set(pt(Ge(r)).filter(tt=>!mt(tt)).map(tt=>ct(tt))),Xt=En(),ui=r.filter(tt=>tt.type==="label").map(tt=>({label:tt,x:tt.x,y:tt.y}));n.moveElements(re,{x:Ui.dx,y:Ui.dy},void 0,Pe);const ta=En(),fo=[...ta].filter(tt=>!Xt.has(tt)).length,ns=[...Xt].filter(tt=>!ta.has(tt)).length;if(fo>ns){n.moveElements(re,{x:-Ui.dx,y:-Ui.dy},void 0,Pe);for(const tt of ui){const xt=tt.x-tt.label.x,Nt=tt.y-tt.label.y;(xt!==0||Nt!==0)&&n.moveElements([tt.label],{x:xt,y:Nt})}}else I&&Pg.set(k.id,{exit:I,channelY:B,label:H})}}}{const Be=new Set(re.map(Xe=>Xe.id)),At=new Set(N.map(Xe=>Xe.flow.id)),wt=20,fn=Xe=>{const vt=Xe.source,Qe=Xe.target,Ct=Math.min(vt.x,Qe.x)-wt,He=Math.max(vt.x+vt.width,Qe.x+Qe.width)+wt,Fe=Math.min(vt.y,Qe.y)-wt,Bt=Math.max(vt.y+vt.height,Qe.y+Qe.height)+wt;return Xe.waypoints.some(Pt=>Pt.x<Ct||Pt.x>He||Pt.y<Fe||Pt.y>Bt)},Ne=new Map;for(const Xe of re)for(const vt of[...Xe.incoming??[],...Xe.outgoing??[]])(P.has(vt.id)||vt.id!==b.id&&At.has(vt.id))&&!(Be.has(vt.source.id)&&Be.has(vt.target.id))&&Ne.set(vt.id,vt);for(const Xe of Ne.values())fn(Xe)&&mp(Xe)}const uo=De.length?d(De[0]):void 0;if(uo){const Be={assoc:_1(),overlaps:R1(uo),crosses:S1()},At=De.map(He=>({st:He,x:He.x})),wt=r.filter(He=>He.type==="label").map(He=>({label:He,x:He.x,y:He.y})),fn=Math.min(...De.flatMap(He=>[...He.incoming??[],...He.outgoing??[]].filter(Fe=>Fe.type==="bpmn:DataInputAssociation"||Fe.type==="bpmn:DataOutputAssociation").map(Fe=>(Fe.source===He?Fe.target:Fe.source).x))),Ne=new Set(De.map(He=>He.id)),Xe=(uo.children??[]).filter(Bi).filter(He=>!Ne.has(He.id));let vt=fn;for(const He of[...De].sort((Fe,Bt)=>Fe.x-Bt.x)){let Fe=vt;for(let Bt=0;Bt<100;Bt++){const Pt=Xe.find(bt=>Fe<bt.x+bt.width+Ii&&Fe+He.width+Ii>bt.x&&He.y<bt.y+bt.height&&He.y+He.height>bt.y);if(!Pt)break;Fe=Pt.x+Pt.width+Ii}Fe!==He.x&&n.moveElements([He],{x:Fe-He.x,y:0}),vt=Fe+He.width+Ii}const Qe=vt+150-(uo.x+uo.width);Qe>0&&Xa(uo,uo.width+Qe);const Ct={assoc:_1(),overlaps:R1(uo),crosses:S1()};if(Ct.assoc>=Be.assoc||Ct.overlaps>Be.overlaps||Ct.crosses>Be.crosses){for(const{st:He,x:Fe}of At)He.x!==Fe&&n.moveElements([He],{x:Fe-He.x,y:0});Qe>0&&Xa(uo,uo.width-Qe);for(const He of wt){const Fe=He.x-He.label.x,Bt=He.y-He.label.y;(Fe!==0||Bt!==0)&&n.moveElements([He.label],{x:Fe,y:Bt})}}}}for(const[b,_]of br){const R=p(b);if(!R)continue;const k=_.container,L=Math.abs(R.y+R.height/2-k.y-_.relCy)>=.5,O=R.label,F=Math.min(R.y,O&&!O.hidden?O.y:R.y),I=Math.max(R.y+R.height,O&&!O.hidden?O.y+O.height:0);if(L&&F>=k.y&&I<=k.y+k.height)continue;const B=R.y;_.grow(),R.y!==B&&n.moveElements([R],{x:0,y:B-R.y},void 0,{autoResize:!1})}const A1=(b,_)=>{const R=_.target===b,k=f(_.source),L=f(_.target),O=R?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(k,L,_.id?{type:O,businessObject:i.create(O,{id:_.id})}:{type:O})},P1=b=>{for(const _ of h){if(!_.participant.blackBox)continue;const R=p(_.participant.id);if(!R)continue;const k=[];for(const O of y){const F=O.flow.source===_.participant.id?O.flow.target:O.flow.target===_.participant.id?O.flow.source:void 0,I=F?p(F):void 0;I&&typeof I.x=="number"&&I.type!=="bpmn:Participant"&&k.push(I)}if(!k.length)continue;if(!b&&_.order===void 0){const O=(()=>{var I;const F=new Map;for(const B of k){const H=d(B);if(!H)continue;const U=F.get(H.id);U?U.n+=1:F.set(H.id,{shape:H,n:1})}return(I=[...F.values()].sort((B,H)=>H.n-B.n)[0])==null?void 0:I.shape})();if(O){const F=H=>H.reduce((U,ie)=>U+ie,0)/H.length,I=F(k.map(H=>H.y+H.height/2))<O.y+O.height/2,B=r.filter(H=>H.type==="bpmn:Participant"&&H.id!==_.participant.id&&H.id!==O.id).filter(H=>I?H.y+H.height<=O.y+5:H.y>=O.y+O.height-5);if(B.length){const H=[...B.reduce((ue,be)=>ue.set(be.y,(ue.get(be.y)??0)+1),new Map)].sort((ue,be)=>be[1]-ue[1]||(I?be[0]-ue[0]:ue[0]-be[0]))[0][0],U=Math.min(R.width,kM),ie=OM,le=k.map(ue=>ue.x+ue.width/2),ve=Math.round(F(le)-U/2),re=Math.max(...le)+xf,fe=ue=>({x:ue,width:Math.max(U,re-ue)}),Pe=B.filter(ue=>Math.min(ue.y+ue.height,H+ie)-Math.max(ue.y,H)>0),_e=ue=>{const be=fe(ue);return Pe.some(et=>et.x<be.x+be.width&&be.x<et.x+et.width)},ee=ue=>{const be=fe(ue);return le.filter(et=>et>=be.x+10&&et<=be.x+be.width-10).length},se=(()=>{if(!_e(ve))return ve;const ue=ee(ve);return Pe.flatMap(be=>[be.x+be.width+wy,be.x-wy-U]).map(be=>Math.round(be)).filter(be=>!_e(be)&&ee(be)>=ue).sort((be,et)=>Math.abs(be-ve)-Math.abs(et-ve))[0]??ve})();if(se!==R.x||H!==R.y||U!==R.width||ie!==R.height){const ue=()=>new Set(pt(Ge(r)).map(Ee=>ct(Ee))),be=ue(),et={x:R.x,y:R.y,width:R.width,height:R.height};n.resizeShape(R,{x:se,y:H,width:U,height:ie});const ot=ue(),Mt=[...ot].filter(Ee=>!be.has(Ee)).length,Ft=[...be].filter(Ee=>!ot.has(Ee)).length;Mt>Ft&&n.resizeShape(R,et)}}}}const L=Math.max(...k.map(O=>O.x+O.width/2))+xf;if(L>R.x+R.width&&n.resizeShape(R,{x:R.x,y:R.y,width:L-R.x,height:R.height}),!!b)for(const O of y){const F=p(O.flow.id),I=O.flow.source===_.participant.id?O.flow.target:O.flow.target===_.participant.id?O.flow.source:void 0,B=I?p(I):void 0;if(!F||!B||B.type==="bpmn:Participant")continue;const H=B.x+B.width/2;H<R.x+10||H>R.x+R.width-10||w1(F,R,B)}}};P1(!1);for(const b of y){const _=b.flow;n.connect(f(_.source),f(_.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:_.id,name:_.name})})}{const R=new Set([...N.map(B=>B.flow.id),...y.map(B=>B.flow.id)].filter(B=>!!B)),k=r.filter(B=>!!B.waypoints),L=(B,H)=>Math.abs(H.x-B.x)<2?"L":Math.abs(H.x-(B.x+B.width))<2?"R":Math.abs(H.y-B.y)<2?"T":Math.abs(H.y-(B.y+B.height))<2?"B":void 0,O=new Map,F=(B,H,U)=>{if(!B||!H||typeof B.x!="number")return;const ie=L(B,H);if(!ie)return;let le=O.get(B.id);le||O.set(B.id,le=new Map),le.set(ie,[...le.get(ie)??[],U])};for(const B of k){const H=B.waypoints;!H||H.length<2||(F(B.source,H[0],{id:B.id,dir:"out"}),F(B.target,H[H.length-1],{id:B.id,dir:"in"}))}const I=new Set;for(const[B,H]of O){const U=p(B);if(!U||typeof U.x!="number")continue;const ie=ee=>{var ue;const se=(ue=p(ee.id))==null?void 0:ue.source;return!!se&&typeof se.x=="number"&&se.x+se.width/2>U.x+U.width/2};if(![...H.values()].some(ee=>ee.length>=3&&ee.some(se=>se.dir==="out")&&ee.some(se=>se.dir==="in"&&R.has(se.id)&&ie(se))))continue;const ve=d(U);if(!ve||I.has(ve.id)||(ve.children??[]).some(ee=>ee.type==="bpmn:Lane"))continue;const re=(K1=H.get("T"))!=null&&K1.length?(X1=H.get("B"))!=null&&X1.length?void 0:"B":"T";if(!re||(re==="T"?U.y-ve.y:ve.y+ve.height-(U.y+U.height))>=te)continue;const Pe=(ve.children??[]).filter(ee=>!("waypoints"in ee&&ee.waypoints)&&ee.type!=="label"&&typeof ee.x=="number"),_e=ve.y+ve.height;n.resizeShape(ve,{x:ve.x,y:ve.y,width:ve.width,height:ve.height+te}),_t(_e,ve.id,te),re==="T"&&Pe.length&&n.moveElements(Pe,{x:0,y:te}),I.add(ve.id)}}const Tg=20,T1=4,u3=3,p3=2,f3=[10,30,80],Lo=()=>{const b=Ge(r);return{bad:pt(b).filter(_=>_.kind==="edge-crosses-shape"||_.kind==="edge-overlap-opposite"||_.kind==="edge-overlap-mixed").length,crossings:Mm(b),straight:b.edges.filter(_=>_.type==="bpmn:MessageFlow"&&_.waypoints.length===2).length}},Qa=b=>{const _=Ge(r),R=_.edges.find(k=>k.id===b);return R?jt(R,Fn(_)).length:0},yp=b=>Qa(b)>0,vp=b=>Ge(r).edges.filter(_=>_.type==="bpmn:MessageFlow"&&_.id!==b&&_.waypoints.length===2).length,k1=(b,_,R)=>Za([{subtree:b,pool:_}],R),O1=(b,_)=>_.bad>b.bad||_.crossings>b.crossings&&_.straight<=b.straight&&_.bad>=b.bad,Ja=(b,_)=>O1(b,_)||_.straight<b.straight,Xr=(b,_,R=()=>!0,k=O1,L=!1)=>{const O=Lo(),F=Za(b,_,L);if(!F)return!1;const I=Lo();return k(O,I)||!R()?(F(),!1):!0},d3=(b,_,R,k=()=>!0)=>Xr([{subtree:b,pool:_}],R,k),Zr=b=>{var _;return!!((_=D.get(b))!=null&&_.node.participant)},bc=new Map;for(const b of y){if(!Zr(b.flow.target))continue;const _=bc.get(b.flow.target)??[];_.push(b),bc.set(b.flow.target,_)}const bp=[...bc.keys()],kg=new Set(N.map(b=>b.flow.target)),D1=b=>Qn.findIndex(({op:_})=>_.participant.id===b);bp.sort((b,_)=>{var L,O;const R=kg.has(b)?1:0,k=kg.has(_)?1:0;return R!==k?R-k:D1((L=D.get(b))==null?void 0:L.node.participant)-D1((O=D.get(_))==null?void 0:O.node.participant)});const wr=b=>b.x+b.width/2,h3=b=>{const _=new Map;for(const L of r.getAll()){const O=L;if(!O.waypoints||!O.source||!O.target)continue;(_.get(O.source.id)??_.set(O.source.id,[]).get(O.source.id)).push(O.target.id)}const R=new Set([b]),k=[b];for(let L=0;L<k.length;L++)for(const O of _.get(k[L])??[])R.has(O)||(R.add(O),k.push(O));return R},g3=(b,_)=>{const R=h3(_);let k;for(const L of r.getAll()){const O=L;if(O.type!=="bpmn:MessageFlow"||!O.source||!O.target||O.target.id!==b||R.has(O.source.id))continue;const F=O.source;if(typeof F.x!="number"||F.type==="bpmn:Participant")continue;const I=wr(F);(k===void 0||I>k)&&(k=I)}return k},Og=(b,_)=>{const R=p(b.flow.source);if(R)return R.type==="bpmn:Participant"?g3(R.id,_):wr(R)},L1=b=>{let _;for(const R of bc.get(b)??[]){const k=Og(R,b);k!==void 0&&(!_||k>_.cx)&&(_={op:R,cx:k})}return _==null?void 0:_.op},m3=b=>{const _=L1(b),R=p(b),k=_?Og(_,b):void 0;return R&&k!==void 0?k-wr(R):void 0},y3=b=>{const _=m3(b);return _!==void 0&&Math.abs(_)<Tg},xp=(b,_,R,k,L)=>{var O;for(let F=!0;F;){F=!1;for(const I of y){if(I.flow.id===R)continue;const B=_.has(I.flow.source),H=_.has(I.flow.target);if(B===H||k(B?I.flow.source:I.flow.target))continue;const U=B?I.flow.target:I.flow.source;if(L(U)||!Zr(U))continue;const ie=p(I.flow.id);if(!(ie!=null&&ie.waypoints)||ie.waypoints.length!==2)continue;const le=p(U),ve=(O=D.get(U))==null?void 0:O.node.participant;if(!le||!ve)continue;const re=Kr(U,fe=>fe.x>=le.x).filter(fe=>!_.has(fe.id));if(!(!re.length||re.some(fe=>L(fe.id)))){for(const fe of re)_.add(fe.id);b.set(ve,[...b.get(ve)??[],...re]),F=!0}}}return[...b].map(([F,I])=>({subtree:I,pool:f(F)}))},I1=(b,_,R,k,L)=>xp(new Map([[_,[...b]]]),new Set(b.map(O=>O.id)),k,O=>O===R,O=>O===L),Dg=b=>{const _=L1(b);if(!_)return null;const R=p(b),k=p(_.flow.source),L=Og(_,b);if(!R||!k||L===void 0)return null;const O=L-wr(R);if(O>=Tg){const F=D.get(b).node.participant,I=Kr(b,B=>B.x>=R.x);return{groups:I1(I,F,b,_.flow.id,_.flow.source),dx:O}}if(-O>=Tg&&Zr(_.flow.source)){const F=D.get(_.flow.source).node.participant,I=Kr(_.flow.source,B=>B.x>=k.x&&!y3(B.id));return{groups:I1(I,F,_.flow.source,_.flow.id,b),dx:-O}}return null},B1=()=>bp.map(b=>({id:b,plan:Dg(b)})).filter(b=>!!b.plan).sort((b,_)=>Math.min(...b.plan.groups.flatMap(R=>R.subtree.map(k=>k.x)))-Math.min(..._.plan.groups.flatMap(R=>R.subtree.map(k=>k.x)))).map(b=>b.id);for(let b=0;b<3;b++){const _=Lo(),R=[];for(const L of B1()){const O=Dg(L);if(!O)continue;const F=Za(O.groups,O.dx);F&&R.push(F)}if(!R.length)break;if(!Ja(_,Lo()))continue;for(const L of R.reverse())L();let k=!1;for(const L of B1()){const O=Dg(L);O&&Xr(O.groups,O.dx,()=>!0,Ja)&&(k=!0)}if(!k)break}for(const b of bp){if(kg.has(b))continue;const _=D.get(b);if(!_||_.node.lane!==void 0)continue;const R=C(_);if(R===void 0)continue;const k=p(b),L=k?d(k):void 0;if(!k||!L)continue;const O=L.y+Oe+Ce(`pool:${_.node.participant??""}`,R)*te,F=O-(k.y+k.height/2);F!==0&&!X(L,k,k.x+k.width/2,O)&&n.moveElements([k],{x:0,y:F})}const N1=()=>{const b=r.filter(k=>k.type==="bpmn:Participant"),_=new Map(b.map(k=>[k.id,k]));let R=0;for(const{pools:[k,L]}of af(b)){const O=_.get(k),F=_.get(L);R+=(Math.min(O.x+O.width,F.x+F.width)-Math.max(O.x,F.x))*(Math.min(O.y+O.height,F.y+F.height)-Math.max(O.y,F.y))}return R},$1=new Set;for(let b=0,_=!0;_&&b<u3;b++){_=!1;for(const R of bp.flatMap(k=>bc.get(k)??[])){if($1.has(R.flow.id)||!yp(R.flow.id))continue;const k=p(R.flow.target);if(!k)continue;const L=f(D.get(R.flow.target).node.participant),O=Kr(R.flow.target,U=>U.x>=k.x),F=k.width+xe,I=Qa(R.flow.id),B=vp(R.flow.id),H=N1();for(let U=1;U<=T1;U++){const ie=()=>Qa(R.flow.id)<I&&vp(R.flow.id)>=B&&N1()<=H;if(d3(O,L,F*U,ie)){$1.add(R.flow.id),_=!0;break}}}}const Lg=y.map(b=>({id:b.flow.id,source:b.flow.source,target:b.flow.target,preexisting:!1})),F1=new Set(Lg.map(b=>b.id));for(const b of r.filter(_=>_.type==="bpmn:MessageFlow"))F1.has(b.id)||!b.source||!b.target||b.source.type==="bpmn:Participant"!=(b.target.type==="bpmn:Participant")&&Lg.push({id:b.id,source:b.source.id,target:b.target.id,preexisting:!0});for(const b of Lg){if(!yp(b.id))continue;const _=p(b.source),R=p(b.target);if(!_||!R)continue;let k,L,O;if(b.preexisting){const[I,B]=_.type==="bpmn:Participant"?[R,_]:[_,R];if(k=wr(I),k<B.x||k>B.x+B.width)continue;[L,O]=I.y<B.y?[I.y+I.height,B.y]:[B.y+B.height,I.y]}else{if(_.type==="bpmn:Participant"||R.type==="bpmn:Participant"||(k=_.x+_.width/2,Math.abs(k-(R.x+R.width/2))>15))continue;[L,O]=_.y<R.y?[_.y+_.height,R.y]:[R.y+R.height,_.y]}const F=[...D.values()].map(I=>p(I.node.id)).filter(I=>!!I&&I.id!==_.id&&I.id!==R.id).filter(I=>I.x<=k&&k<=I.x+I.width&&I.y+I.height>L&&I.y<O).sort((I,B)=>I.x-B.x);for(const I of F){const B=(Z1=D.get(I.id))==null?void 0:Z1.node.participant,H=B?p(B):void 0;if(!B||!H)continue;const U=[...D.values()].filter(se=>se.node.participant===B).map(se=>se.node.id),ie=se=>se.map(ue=>p(ue)).filter(ue=>!!ue),ve=[i3(I.id,se=>{var ue;return((ue=D.get(se.id))==null?void 0:ue.node.participant)===B}),ie(U)].filter(se=>se.length).map(se=>[{subtree:se,pool:H}]);if(b.preexisting){const se=ie(U);se.length&&ve.push(xp(new Map([[B,[...se]]]),new Set(se.map(ue=>ue.id)),b.id,()=>!1,ue=>ue===_.id||ue===R.id))}const re=I.width+xe,fe=Qa(b.id),Pe=vp(b.id),_e=()=>Qa(b.id)<fe&&vp(b.id)>=Pe;let ee=!1;for(const se of ve){for(let ue=1;ue<=T1;ue++)if(Xr(se,re*ue,_e)){ee=!0;break}if(ee)break}if(!yp(b.id))break}}const wp=()=>{var _;const b=new Set;for(const R of pt(Ge(r)))R.kind!=="edge-crosses-shape"||F1.has(R.edge)||((_=p(R.edge))==null?void 0:_.type)==="bpmn:MessageFlow"&&b.add(`${R.edge}>${R.shape}`);return b},v3=(b,_)=>Lo().bad>=b&&[...wp()].some(R=>!_.has(R)),j1=b=>{var _,R;return Qa(b)===0&&((R=(_=p(b))==null?void 0:_.waypoints)==null?void 0:R.length)===2},b3=(b,_,R)=>{const k=new Set(b.flatMap(O=>O.subtree.map(F=>F.id))),L=[...wp()].filter(O=>!R.has(O)).map(O=>O.split(">")[1]);return[...new Set(L)].filter(O=>k.has(O)&&O!==_.source&&O!==_.target)},x3=(b,_,R,k,L)=>{const O=b.map(H=>({...H,subtree:H.subtree.filter(U=>!L.includes(U.id))})).filter(H=>H.subtree.length),F=new Set(O.flatMap(H=>H.subtree.map(U=>U.id))),I=()=>L.every(H=>{const U=p(H);return!!U&&N.filter(ie=>ie.flow.target===H&&F.has(ie.flow.source)).every(ie=>{const le=p(ie.flow.source);return!!le&&le.x+le.width<=U.x})});return Xr(O,_,()=>j1(R.id)&&[...wp()].every(H=>k.has(H))&&I(),Ja,!0)};for(const b of y){if(!yp(b.flow.id))continue;const _=p(b.flow.id);if(((Q1=_==null?void 0:_.waypoints)==null?void 0:Q1.length)!==2)continue;const R=p(b.flow.source),k=p(b.flow.target);if(!R||!k||R.type==="bpmn:Participant"||k.type==="bpmn:Participant"||!Zr(b.flow.source)||!Zr(b.flow.target)||Math.abs(wr(R)-wr(k))>p3)continue;const L=wr(R),O=_.waypoints.map(fe=>fe.y),[F,I]=[Math.min(...O),Math.max(...O)],B=Fn(Ge(r)).filter(fe=>fe.id!==R.id&&fe.id!==k.id&&fe.x<L&&L<fe.x+fe.width&&F<fe.y+fe.height&&fe.y<I);if(!B.length)continue;const H=(J1=D.get(b.flow.source))==null?void 0:J1.node.participant,U=(eS=D.get(b.flow.target))==null?void 0:eS.node.participant;if(!H||!U)continue;const ie=new Map;for(const[fe,Pe,_e]of[[b.flow.source,R,H],[b.flow.target,k,U]]){const ee=ie.get(_e)??[],se=Kr(fe,ue=>ue.x>=Pe.x).filter(ue=>!ee.some(be=>be.id===ue.id));ie.set(_e,[...ee,...se])}const le=new Set([...ie.values()].flat().map(fe=>fe.id)),ve=xp(ie,le,b.flow.id,fe=>fe===b.flow.source||fe===b.flow.target,()=>!1),re=Math.max(...B.map(fe=>fe.x+fe.width));for(const fe of f3){const Pe=re+fe-L;if(Pe<=0)continue;const _e=Lo().bad,ee=wp();let se=[],ue=!0;const be=()=>!j1(b.flow.id)||ue&&(se=b3(ve,b.flow,ee),se.length)?!1:!v3(_e,ee);if(Xr(ve,Pe,be,Ja))break;if(se.length&&(x3(ve,Pe,b.flow,ee,se)||(ue=!1,Xr(ve,Pe,be,Ja))))break}}{const b=R=>R.y+R.height/2,_=[];for(const R of D.keys()){if(!Zr(R))continue;const k=N.filter(F=>F.flow.target===R);if(k.length!==1)continue;const L=p(k[0].flow.source),O=p(R);!L||!O||!D.has(L.id)||Math.abs(b(L)-b(O))>1||O.x-(L.x+L.width)<=xe+1||_.push({id:R,pred:L,node:O})}_.sort((R,k)=>R.node.x-k.node.x);for(const{id:R}of _){const k=D.get(R),L=p(R),O=p(N.find(Pe=>Pe.flow.target===R).flow.source);if(!L||!O)continue;const F=L.x-(O.x+O.width);if(F<=xe+1)continue;const I=f(k.node.participant),B=Kr(R,Pe=>Pe.x>=L.x),H=-(F-xe),U=(Pe,_e)=>_e.bad>Pe.bad||_e.crossings>=Pe.crossings||_e.straight<Pe.straight,ie=xp(new Map([[k.node.participant,[...B]]]),new Set(B.map(Pe=>Pe.id)),"",()=>!1,()=>!1),le=ie.some(Pe=>Pe.pool!==I)||ie.reduce((Pe,_e)=>Pe+_e.subtree.length,0)>B.length,ve=Lo(),re=k1(B,I,H);if(!re)continue;const fe=Lo();if(le&&!U(ve,fe)){re();const Pe=Za(ie,H);if(Pe){const _e=Lo();if(!U(ve,_e)&&_e.bad<=fe.bad&&_e.crossings<=fe.crossings)continue;Pe()}k1(B,I,H);continue}U(ve,fe)&&re()}}P1(!0);const w3=10,_3=400,E3=b=>[...b.incoming??[],...b.outgoing??[]].filter(_=>_.type==="bpmn:DataInputAssociation"||_.type==="bpmn:DataOutputAssociation").map(_=>_.source===b?_.target:_.source).filter(_=>!!_&&typeof _.y=="number"),S3=r.filter(b=>b.type==="bpmn:DataStoreReference"&&g.has(b.id)),R3=(b,_)=>{const R=b.x+b.width/2,k=b.y+b.height/2;let L;for(const O of S3){if((d(O)??u())!==_||O.y<b.y+b.height)continue;const F=Math.abs(O.x+O.width/2-R);F>_3||F<O.width||!E3(O).some(B=>B.height===b.height&&Math.abs(B.y+B.height/2-k)<=w3&&O.y>=B.y+B.height)||(!L||F<L.dx||F===L.dx&&O.id<L.id)&&(L={dx:F,id:O.id,cy:O.y+O.height/2})}return L==null?void 0:L.cy};for(const b of v){const _=b.associations??[],R=_.map(O=>O.source===b.dataStore.id?O.target:O.source).map(p).find(Boolean),k=R?d(R)??u():u(),L=R?{x:R.x+R.width/2,y:R3(R,k)??R.y+R.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,k);for(const O of _)A1(b.dataStore.id,O)}for(const b of x){const R=f(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;A1(R,b.association)}let H1=0;const Qr=10,z1=40,C3=(b,_)=>{const R=_.map(B=>d(B)).filter(B=>!!B);for(const B of R){const H=Qr,U=B.y,ie=B.y+B.height,le=B.x,ve=B.x+B.width;if(Math.abs(b.y-U)<H){const re=U+H-b.y;b.y+=re,b.height-=re}if(Math.abs(b.y+b.height-ie)<H&&(b.height=ie-H-b.y),Math.abs(b.x-le)<H){const re=le+H-b.x;b.x+=re,b.width-=re}Math.abs(b.x+b.width-ve)<H&&(b.width=ve-H-b.x)}if(!R.length)return;const k=Math.min(...R.map(B=>B.y)),L=Math.max(...R.map(B=>B.y+B.height)),O=k-b.y,F=b.y+b.height-L,I=z1-Qr;if(O>0!=F>0)if(O>0&&O<I){const B=O+Qr;b.y+=B,b.height-=B}else F>0&&F<I&&(b.height-=F+Qr)},M3=(b,_)=>{const R=Qr,k=30,L=r.filter(O=>O.type==="bpmn:Group"&&O.id!==_);for(const O of L){const F=O.x,I=O.x+O.width,B=O.y,H=O.y+O.height,U=b.y<H&&B<b.y+b.height,ie=b.x<I&&F<b.x+b.width;if(U){if(Math.abs(b.x-I)<R){const le=Math.min(I+R-b.x,k);le>0&&b.width-le>0&&(b.x+=le,b.width-=le)}if(Math.abs(b.x+b.width-F)<R){const le=Math.min(b.x+b.width-(F-R),k);le>0&&b.width-le>0&&(b.width-=le)}}if(ie){if(Math.abs(b.y-H)<R){const le=Math.min(H+R-b.y,k);le>0&&b.height-le>0&&(b.y+=le,b.height-=le)}if(Math.abs(b.y+b.height-B)<R){const le=Math.min(b.y+b.height-(B-R),k);le>0&&b.height-le>0&&(b.height-=le)}}}},Ig=(b,_)=>{const R=z1,k=Math.min(...b.map(B=>B.x))-R,L=Math.min(...b.map(B=>B.y))-R,O=Math.max(...b.map(B=>B.x+B.width))+R,F=Math.max(...b.map(B=>B.y+B.height))+R,I={x:k,y:L,width:O-k,height:F-L};return C3(I,b),M3(I,_),I};for(const b of M){const _=(b.group.members??[]).map(p).filter(L=>!!L);let R;_.length?R=Ig(_,b.group.id):(R={x:300+H1*350,y:40,width:300,height:200},H1++);const k=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:R.width,height:R.height},{x:R.x+R.width/2,y:R.y+R.height/2},u());b.group.name&&n.updateLabel(k,b.group.name),(tS=b.group.members)!=null&&tS.length&&Q(k,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=r.filter(L=>!!L.waypoints),_=new Map,R=(L,O)=>{!L||!O||(_.has(L)||_.set(L,new Set),_.get(L).add(O))};for(const L of b){const O=(nS=L.source)==null?void 0:nS.id,F=(iS=L.target)==null?void 0:iS.id;R(O,F),((oS=L.type)!=null&&oS.includes("DataOutputAssociation")||(rS=L.type)!=null&&rS.includes("DataInputAssociation")||L.type==="bpmn:Association")&&R(F,O)}const k=r.filter(L=>L.type==="bpmn:Group");for(const L of k){const F=(((aS=L.businessObject.extensionElements)==null?void 0:aS.values)??[]).find(_e=>_e.$type==="bwl:Members"),I=((F==null?void 0:F.refs)??"").split(" ").filter(Boolean);if(!I.length)continue;const B=new Set(I),H=[...I];for(;H.length;){const _e=H.shift();for(const ee of _.get(_e)??[])B.has(ee)||(B.add(ee),H.push(ee))}const U=L.x,ie=L.x+L.width,le=L.y,ve=L.y+L.height,re=_e=>N.filter(ee=>ee.flow.target===_e).length,fe=_e=>{var se;const ee=((se=p(_e))==null?void 0:se.type)??"";if(ee==="bpmn:StartEvent"&&re(_e)===0)return!1;if(ee.endsWith("Gateway")){const ue=N.filter(be=>be.flow.target===_e).map(be=>be.flow.source);if(ue.length&&ue.every(be=>{var et;return((et=p(be))==null?void 0:et.type)==="bpmn:StartEvent"&&re(be)===0}))return!1}return!0},Pe=r.filter(_e=>Bi(_e)).filter(_e=>_e.type!=="bpmn:Group"&&_e.type!=="bpmn:Participant"&&_e.type!=="bpmn:TextAnnotation"&&!B.has(_e.id)&&Zr(_e.id)&&fe(_e.id)&&_e.x<ie&&_e.x+_e.width>U&&_e.y<ve&&_e.y+_e.height>le);if(Pe.length)for(const _e of[-1,1]){const ee=Pe.filter(Re=>(Re.x+Re.width-U<=ie-Re.x?-1:1)===_e);if(!ee.length)continue;const se=[];for(const Re of ee){const De=se.find(Se=>Se.some(he=>Re.y<he.y+he.height&&Re.y+Re.height>he.y));De?De.push(Re):se.push([Re])}const ue=new Map;for(const Re of se){let De=_e<0?U-Qr:ie+Qr;for(const Se of[...Re].sort((he,ke)=>_e<0?ke.x-he.x:he.x-ke.x)){const he=_e<0?Math.min(Se.x,De-Se.width):Math.max(Se.x,De);De=_e<0?he-Ii:he+Se.width+Ii,he!==Se.x&&Math.sign(he-Se.x)===_e&&ue.set(Se.id,he-Se.x)}}const be=new Map,et=Re=>be.get(Re)===Re||!be.get(Re)?Re:et(be.get(Re));for(const Re of ee)be.set(Re.id,Re.id);for(const Re of y){const De=ue.has(Re.flow.source)?Re.flow.source:void 0,Se=ue.has(Re.flow.target)?Re.flow.target:void 0;if(!De||!Se)continue;const he=p(Re.flow.id);((sS=he==null?void 0:he.waypoints)==null?void 0:sS.length)===2&&be.set(et(De),et(Se))}const ot=new Map;for(const Re of ee){if(!ue.has(Re.id))continue;const De=et(Re.id);ot.set(De,[...ot.get(De)??[],Re])}const Mt=[...ot.values()].sort((Re,De)=>_e<0?Math.min(...Re.map(Se=>Se.x))-Math.min(...De.map(Se=>Se.x)):Math.max(...De.map(Se=>Se.x))-Math.max(...Re.map(Se=>Se.x))),Ft=[];let Ee=!0;for(const Re of Mt){const De=Re.map(ke=>ue.get(ke.id)??0).reduce((ke,Me)=>Math.abs(Me)>Math.abs(ke)?Me:ke,0),Se=new Map;let he=!0;for(const ke of Re){const Me=d(ke);if(!Me){he=!1;break}Se.has(Me.id)||Se.set(Me.id,{subtree:[],pool:Me}),Se.get(Me.id).subtree.push(ke)}he&&Xr([...Se.values()],De,()=>!0,Ja)?Ft.push({shapes:Re,dx:De}):Ee=!1}if(!Ee)for(const Re of Ft.reverse())n.moveElements(Re.shapes,{x:-Re.dx,y:0})}}}{const b=new Set([...M.map(_=>_.group.id),...Gt(e,"group.update").map(_=>_.id)]);for(const _ of r.filter(R=>R.type==="bpmn:Group")){if(b.has(_.id))continue;const k=(((cS=_.businessObject.extensionElements)==null?void 0:cS.values)??[]).find(I=>I.$type==="bwl:Members"),L=((k==null?void 0:k.refs)??"").split(" ").filter(Boolean).map(p).filter(I=>!!I);!L.length||!L.some(I=>{const B=g.get(I.id);return!B||B.x!==I.x||B.y!==I.y})||!L.some(I=>I.x<_.x||I.y<_.y||I.x+I.width>_.x+_.width||I.y+I.height>_.y+_.height)||n.resizeShape(_,Ig(L,_.id))}}{const _=new Map(Go(Ge(r)).map(I=>[I.owner,I.rect])),R=r.filter(I=>!!I.waypoints),k=new Map,L=(I,B)=>{!I||!B||(k.has(I)||k.set(I,new Set),k.get(I).add(B))};for(const I of R){const B=(lS=I.source)==null?void 0:lS.id,H=(uS=I.target)==null?void 0:uS.id;L(B,H),((pS=I.type)!=null&&pS.includes("DataOutputAssociation")||(fS=I.type)!=null&&fS.includes("DataInputAssociation")||I.type==="bpmn:Association")&&L(H,B)}const O=I=>N.filter(B=>B.flow.target===I).length,F=I=>{var H;const B=((H=p(I))==null?void 0:H.type)??"";if(B==="bpmn:StartEvent"&&O(I)===0)return!1;if(B.endsWith("Gateway")){const U=N.filter(ie=>ie.flow.target===I).map(ie=>ie.flow.source);if(U.length&&U.every(ie=>{var le;return((le=p(ie))==null?void 0:le.type)==="bpmn:StartEvent"&&O(ie)===0}))return!1}return!0};for(const I of r.filter(B=>B.type==="bpmn:Group")){const H=(((dS=I.businessObject.extensionElements)==null?void 0:dS.values)??[]).find(he=>he.$type==="bwl:Members"),U=((H==null?void 0:H.refs)??"").split(" ").filter(Boolean);if(!U.length)continue;const ie=U.map(p).filter(he=>!!he);if(!ie.length||!(M.some(he=>he.group.id===I.id)||Gt(e,"group.update").some(he=>he.id===I.id)||ie.some(he=>{const ke=g.get(he.id);return!ke||ke.x!==he.x||ke.y!==he.y})))continue;const ve=new Set(U),re=[...U];for(;re.length;){const he=re.shift();for(const ke of k.get(he)??[])ve.has(ke)||(ve.add(ke),re.push(ke))}const fe=I.x,Pe=I.x+I.width,_e=I.y,ee=I.y+I.height,se=he=>{const ke=_.get(he.id),Me={x:he.x,y:he.y,width:he.width,height:he.height};return ke?[Me,{x:ke.x,y:ke.y,width:ke.width,height:ke.height}]:[Me]},ue=ie.flatMap(se),be=Math.min(...ue.map(he=>he.x)),et=Math.max(...ue.map(he=>he.x+he.width)),ot=Math.min(...ue.map(he=>he.y)),Mt=Math.max(...ue.map(he=>he.y+he.height)),Ft={L:be-fe,R:Pe-et,T:ot-_e,B:ee-Mt},Ee=new Set(U),Re=he=>he.x>=fe&&he.x+he.width<=Pe&&he.y>=_e&&he.y+he.height<=ee,De=r.filter(he=>Bi(he)).filter(he=>he.type!=="bpmn:Group"&&he.type!=="bpmn:Participant"&&he.type!=="bpmn:TextAnnotation"&&!Ee.has(he.id)&&(!ve.has(he.id)||!Re(he))&&F(he.id)&&he.x<Pe&&he.x+he.width>fe&&he.y<ee&&he.y+he.height>_e);if(!De.length)continue;const Se={L:0,R:0,T:0,B:0};for(const he of De){const ke=se(he),Me=Math.min(...ke.map(_n=>_n.x)),st=Math.max(...ke.map(_n=>_n.x+_n.width)),yt=Math.min(...ke.map(_n=>_n.y)),vn=Math.max(...ke.map(_n=>_n.y+_n.height)),qn={L:st-fe,R:Pe-Me,T:vn-_e,B:ee-yt},It=["L","R","T","B"].filter(_n=>qn[_n]<=Ft[_n]+.001);if(!It.length)continue;const wn=It.reduce((_n,es)=>qn[es]<qn[_n]?es:_n,It[0]);Se[wn]=Math.max(Se[wn],Math.min(qn[wn]+10,Ft[wn]))}!Se.L&&!Se.R&&!Se.T&&!Se.B||n.resizeShape(I,{x:I.x+Se.L,y:I.y+Se.T,width:I.width-Se.L-Se.R,height:I.height-Se.T-Se.B})}}const G1=b=>{const _=b.waypoints;if(_!=null&&_.length){const k=_[Math.floor((_.length-1)/2)];return{x:k.x,y:k.y,width:0,height:0}}const R=b;return{x:R.x,y:R.y,width:R.width,height:R.height}};let xc=0;const V1=12,W1=14,A3=15,P3=300,T3=b=>{const _=b.split(`
|
|
7
|
-
`),R=Math.max(..._.map(O=>pa(O,V1))),k=Math.max(100,Math.min(P3,Math.ceil(R)+W1)),L=_.reduce((O,F)=>O+Math.max(1,Math.ceil((pa(F,V1)+W1)/k)),0);return{width:k,height:Math.max(30,L*A3+10)}};for(const b of E){const _=b.association,R=((hS=b.placement)==null?void 0:hS.anchor)??(_?_.source===b.annotation.id?_.target:_.source:void 0),k=R?p(R):void 0,L=k?G1(k):void 0,O=T3(b.annotation.text??"");let F;if(L&&b.placement){const[U,ie]=Jc[b.placement.side],le=b.placement.offset??50;F={x:L.x+L.width/2+U*(L.width/2+O.width/2+le),y:L.y+L.height/2+ie*(L.height/2+O.height/2+le)}}else L?(F={x:L.x+L.width/2+180+xc%3*260,y:L.y-110-xc%2*95},xc++):(F={x:300+xc*260,y:60},xc++);const I=k?d(k)??u():u(),B=I;L&&typeof B.x=="number"&&typeof B.width=="number"&&B.type==="bpmn:Participant"&&(F=tl(r,L,O,B,b.placement?{placement:b.placement}:{from:F}));const H=n.createShape({type:"bpmn:TextAnnotation",width:O.width,height:O.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},F,I);if(_){const U=ie=>ie===b.annotation.id?H:f(ie);n.connect(U(_.source),U(_.target),_.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:_.id})}:{type:"bpmn:Association"})}b.placement&&Q(H,"bwl:Placement",ne(b.placement))}for(const b of Gt(e,"association.add")){const _=b.association;n.connect(f(_.source),f(_.target),_.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:_.id})}:{type:"bpmn:Association"})}const k3=(b,_,R,k)=>{const L=b.parent;if(!L)return k;const O=b.x+b.width/2,F=new Set([b.id]);if(!X(L,b,O,k,F))return k;const I=_?_.y+Math.min(_.height/2,we):R?R.y+Oe:void 0;if(I===void 0)return k;const B=Math.floor((k-I)/te+1e-6);for(let H=1;H<=3;H++){const U=B+H,ie=I+U*te,le=yi(_==null?void 0:_.id,U);if(!X(L,b,O,ie,le?new Set([...F,...le]):F))return In(_==null?void 0:_.id,U,R),ie}return k},U1=()=>new Set(r.getAll().filter(b=>b.type!=="label").map(b=>b.id));for(const b of Gt(e,"node.update")){let _=f(b.id);if(b.type&&Qc(b.type)!==_.type){const R=_.x+_.width/2,k=_.y+_.height/2,L=U1();_=c.replaceElement(_,{type:Qc(b.type),...b.eventDefinition?{eventDefinitionType:Rc[b.eventDefinition]}:{}});const O=U1(),F=[...L].filter(H=>H!==b.id&&!O.has(H));if(F.length)throw new Ry({kind:"type-change-drops-elements",opIndex:e.indexOf(b),id:b.id,type:b.type,dropped:F});const I=Math.round(R-(_.x+_.width/2)),B=Math.round(k-(_.y+_.height/2));if(I!==0||B!==0){n.moveShape(_,{x:I,y:B});for(const H of[..._.incoming??[],..._.outgoing??[]])mp(H)}}if(b.name!==void 0&&n.updateProperties(_,{name:b.name??void 0}),b.lane||b.band!==void 0){b.band!==void 0&&n.updateProperties(_,{"bwl:band":b.band});const R=_.y+_.height/2,k=d(_),L=b.lane?f(b.lane):((k==null?void 0:k.children)??[]).find(F=>F.type==="bpmn:Lane"&&R>=F.y&&R<=F.y+F.height);b.band!==void 0&&In(L==null?void 0:L.id,b.band,k);const O=L?L.y+(b.band===void 0?L.height/2:Math.min(L.height/2,we)+Ce(L.id,b.band)*te):b.band!==void 0&&k?k.y+Oe+Ce(`pool:${k.id}`,b.band)*te:void 0;if(O!==void 0){const F=k3(_,L,k,O),I=F===O?O-R:F-(_.y+_.height/2);I!==0&&n.moveElements([_],{x:0,y:I})}}}for(const b of Gt(e,"sequenceFlow.update")){const _=f(b.id),R=P.get(b.id);if(R){const k=H=>({x:H.x+H.width/2,y:H.y+H.height/2}),L=f(R.flow.source),O=f(R.flow.target),F=n.connect(L,O,{type:"bpmn:SequenceFlow",businessObject:gp(R.flow)}),I=Pg.get(b.id),B=O.y+O.height/2;I&&O.x>I.exit.x&&Math.abs(B-I.exit.y)>1?n.updateWaypoints(F,[I.exit,{x:I.exit.x,y:B},{x:O.x,y:B}]):(n.reconnect(F,L,O,[k(L),k(O)]),Math.abs(B-(L.y+L.height/2))>1&&mp(F))}else if(b.source!==void 0||b.target!==void 0){const k=_,L=b.source!==void 0?f(b.source):k.source,O=b.target!==void 0?f(b.target):k.target,F=H=>({x:H.x+H.width/2,y:H.y+H.height/2});n.reconnect(k,L,O,[F(L),F(O)]);const I=Pg.get(k.id),B=O.y+O.height/2;if(I&&O.x>I.exit.x&&Math.abs(B-I.exit.y)>1){n.updateWaypoints(k,[I.exit,{x:I.exit.x,y:B},{x:O.x,y:B}]);const H=k.label;if(H&&I.label){const ie=Math.abs(I.label.y+H.height/2-I.channelY)<=te/5&&I.label.x+H.width>I.exit.x,le=I.exit.x+6,ve=O.x-6-H.width,re=ie?ve>=le?{x:Math.max(le,Math.min(I.label.x,ve)),y:I.label.y+(B-I.channelY)}:void 0:I.label;re&&(re.x!==H.x||re.y!==H.y)&&n.moveElements([H],{x:re.x-H.x,y:re.y-H.y})}}else Math.abs(B-(L.y+L.height/2))>1&&mp(k)}b.name!==void 0&&n.updateProperties(_,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(_,{name:((gS=b.condition)==null?void 0:gS.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 _=f(b.id);if(b.text!==void 0&&n.updateProperties(_,{text:b.text}),b.placement===null)Q(_,"bwl:Placement",null);else if(b.placement){const R=f(b.placement.anchor),k=G1(R),L=d(R)??u(),O=typeof L.x=="number"&&typeof L.width=="number"&&L.type==="bpmn:Participant",[F,I]=Jc[b.placement.side],B=b.placement.offset??50,H={x:k.x+k.width/2+F*(k.width/2+_.width/2+B),y:k.y+k.height/2+I*(k.height/2+_.height/2+B)},U=O?tl(r,k,{width:_.width,height:_.height},L,{placement:b.placement,selfId:b.id}):H;n.moveElements([_],{x:U.x-(_.x+_.width/2),y:U.y-(_.y+_.height/2)}),Q(_,"bwl:Placement",ne(b.placement))}}for(const b of Gt(e,"group.update")){const _=f(b.id);if(b.name!==void 0&&n.updateLabel(_,b.name??""),b.members){const R=b.members.map(p).filter(k=>!!k);R.length&&n.resizeShape(_,Ig(R,b.id)),Q(_,"bwl:Members",{refs:b.members.join(" ")})}}}function wf(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 IM(e,t,n,i){const{elementRegistry:o}=e,r=e.modeling,a=[...t.incoming??[],...t.outgoing??[]].filter(d=>d.type==="bpmn:Association");if(!a.length)return 0;const s=d=>d.map(g=>g.original?{x:g.x,y:g.y,original:{x:g.original.x,y:g.original.y}}:{x:g.x,y:g.y}),c=(d,g)=>d.length===g.length&&d.every((h,m)=>{var w,y,v,x;return h.x===g[m].x&&h.y===g[m].y&&((w=h.original)==null?void 0:w.x)===((y=g[m].original)==null?void 0:y.x)&&((v=h.original)==null?void 0:v.y)===((x=g[m].original)==null?void 0:x.y)}),l=a.map(d=>s(d.waypoints)),u=new Set(a.map(d=>d.id));r.moveElements([t],{x:n,y:i});const p=Ge(o),f=[...go(p),...Fi(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 BM(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(wf))].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 te=d.x+d.width/2,xe=d.y+d.height/2;h=i.getAll().find(Oe=>{if(Oe.type!=="bpmn:Participant")return!1;const we=Oe;return typeof we.x=="number"&&typeof we.width=="number"&&te>=we.x&&te<=we.x+we.width&&xe>=we.y&&xe<=we.y+we.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const w=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(te=>te.$type==="bwl:Placement"),y=[...d.incoming??[],...d.outgoing??[]].find(te=>te.type==="bpmn:Association"),v=(w!=null&&w.anchor?i.get(w.anchor):void 0)??(y?((p=y.source)==null?void 0:p.id)===f?y.target:y.source:void 0);if(!v)continue;const x=v.waypoints,E=x!=null&&x.length?{x:x[Math.floor((x.length-1)/2)].x,y:x[Math.floor((x.length-1)/2)].y,width:0,height:0}:{x:v.x,y:v.y,width:v.width,height:v.height},M={width:d.width,height:d.height},D={x:d.x+d.width/2,y:d.y+d.height/2},P=w==null?void 0:w.side,T=Ey(i,E,h),N=[];if(P&&P in Jc&&N.push(tl(i,E,M,h,{placement:{side:P,offset:(w==null?void 0:w.offset)??null},selfId:f})),T&&!el(D,M,T))for(const te of LM)N.push(tl(i,E,M,h,{placement:{side:te,offset:null},selfId:f}));for(const[te,xe]of[[-1,0],[1,0],[0,-1],[0,1]])for(let Oe=1;Oe<=DM;Oe++)N.push({x:D.x+te*_y*Oe,y:D.y+xe*_y*Oe});const j={...s,edges:s.edges.filter(te=>te.id!==(y==null?void 0:y.id))},V=r(j),Q=V.filter(te=>wf(te).includes(f)).length;if(!Q)continue;let ne,W=!1;for(const te of N){const xe=te.x-D.x,Oe=te.y-D.y;if(!xe&&!Oe||te.x-M.width/2<h.x||te.x+M.width/2>h.x+h.width||te.y-M.height/2<h.y||te.y+M.height/2>h.y+h.height||T&&!el(te,M,T))continue;const we={...j,shapes:j.shapes.map(X=>X.id===f?{...X,x:X.x+xe,y:X.y+Oe}:X)},K=r(we),oe=K.filter(X=>wf(X).includes(f)).length;if(oe>=Q||K.length>V.length)continue;const Y=Math.abs(xe)+Math.abs(Oe);if(W||((!ne||oe<ne.mine||oe===ne.mine&&(K.length<ne.all||K.length===ne.all&&Y<ne.dist))&&(ne={x:te.x,y:te.y,mine:oe,all:K.length,dist:Y}),ne.mine===0&&ne.all<V.length&&(W=!0)),oe===0&&K.length<V.length&&IM(e,d,xe,Oe)===0){ne={x:te.x,y:te.y,mine:oe,all:K.length,dist:Y};break}}ne&&o.moveElements([d],{x:ne.x-D.x,y:ne.y-D.y})}}const NM=60;function _f(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 $M(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=w=>pt(w).filter(y=>!t.has(ct(y))),a=w=>w.filter(y=>y.kind==="pool-overlap"),s=new Map(n.shapes.map(w=>[w.id,w])),c=(w,y)=>y.x>=w.x&&y.y>=w.y&&y.x+y.width<=w.x+w.width&&y.y+y.height<=w.y+w.height,l=w=>{if(!s.get(w))return[w];const v=new Set,x=new Set([w]);for(let M=0;M<4;M++){let D=!1;for(const P of n.shapes)P.type!=="bpmn:Group"||v.has(P.id)||[...x].some(T=>{const N=s.get(T);return N&&c(P,N)})&&(v.add(P.id),D=!0);for(const P of n.shapes)P.type!=="bpmn:Participant"||x.has(P.id)||[...v].some(T=>{const N=s.get(T);return N&&c(N,P)})&&(x.add(P.id),D=!0);if(!D)break}const E=n.shapes.filter(M=>!M.parent&&!x.has(M.id)&&!v.has(M.id)&&M.type!=="bpmn:Group"&&M.type!=="bpmn:Participant").filter(M=>[...v].some(D=>{const P=s.get(D);return P&&c(P,M)})).map(M=>M.id);return[...x,...v,...E]},u=r(Ge(i)),p=a(u).length;if(!p)return;const f=u.length,d=[];let g=0,h=p,m=f;for(let w=0;w<6;w++){const y=Ge(i),v=a(r(y));if(!v.length)break;const x=new Map(y.shapes.map(T=>[T.id,T]));let E=null;for(const T of v){if(T.kind!=="pool-overlap")continue;const[N,j]=T.pools,V=x.get(N),Q=x.get(j);if(!V||!Q)continue;const[ne,W]=V.x<=Q.x?[V,Q]:[Q,V];if(T.contained)continue;const te=s.get(ne.id),xe=s.get(W.id),Oe=te&&xe?Math.max(xe.x-(te.x+te.width),0):NM,we=ne.x+ne.width+Oe-W.x;if(we<=0)continue;const K=l(W.id).filter(oe=>i.get(oe));K.length&&(!E||we>E.dx)&&(E={movers:K,dx:we})}if(!E)break;const M=E.movers.map(T=>i.get(T)).filter(T=>!!T&&typeof T.x=="number");if(!M.length)break;o.moveElements(M,{x:E.dx,y:0}),d.push({els:M,dx:E.dx});const D=r(Ge(i)),P=a(D).length;P<p&&D.length<=f&&(P<h||P===h&&D.length<m||g===0)&&(g=d.length,h=P,m=D.length)}for(const{els:w,dx:y}of d.slice(g).reverse())o.moveElements(w,{x:-y,y:0})}const hs=.5,My=150;function FM(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of jM(n))i.length<n.length&&i.some(r=>Ay(e.elementRegistry.get(r.id)))||HM(e,i)}function jM(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)<=hs?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function Ay(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 HM(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(y=>y.x+y.width),r=Math.max(...o);if(r-Math.min(...o)>hs)return;const a=t.map(y=>n.get(y.id)).filter(y=>!!y&&typeof y.x=="number");if(a.length<2)return;const s=new Map(t.map(y=>[y.id,y.x]));if(a.some(y=>Math.abs(y.x-s.get(y.id))>hs))return;const c=a.map(y=>y.x+y.width);if(Math.max(...c)-Math.min(...c)<=hs)return;const l=y=>y.x+y.width,u=y=>!!y&&typeof y.width=="number",p=y=>{const v={shapes:[],edges:[],lanes:[]},x=E=>{for(const M of E.children??[]){if("waypoints"in M&&M.waypoints){v.edges.push(M);continue}M.type!=="label"&&(M.type==="bpmn:Lane"?v.lanes.push(M):v.shapes.push(M),x(M))}};return x(y),v},f=new Map(a.map(y=>[y.id,p(y)]));let d=r;for(const y of a){const{shapes:v}=f.get(y.id),x=v.flatMap(E=>[l(E),...u(E.label)?[l(E.label)]:[]]);x.length&&(d=Math.max(d,Math.max(...x)+My))}const g=a.filter(y=>Math.abs(l(y)-d)>hs);if(!g.length)return;for(const y of g){const v=l(y),{shapes:x,edges:E,lanes:M}=f.get(y.id);if([...x.flatMap(T=>[l(T),...u(T.label)?[l(T.label)]:[]]),...E.flatMap(T=>[...T.waypoints.map(N=>N.x),...u(T.label)?[l(T.label)]:[]])].some(T=>T>d)||[...(y.incoming??[]).map(T=>T.waypoints[T.waypoints.length-1]),...(y.outgoing??[]).map(T=>T.waypoints[0])].some(T=>!T||T.x>d||Math.abs(T.x-v)<1))return;if(d>v){const T={x:v,y:y.y,width:d-v,height:y.height},N=new Set([y.id,...x.map(V=>V.id),...E.map(V=>V.id),...M.map(V=>V.id)]);if(n.getAll().some(V=>{var W;if("waypoints"in V&&V.waypoints||V.type==="bpmn:Group"||!u(V))return!1;const Q=V.type==="label"?(W=V.labelTarget)==null?void 0:W.id:V.id;if(!Q||N.has(Q)||N.has(V.id))return!1;const ne=V;return ne.x<T.x+T.width&&ne.x+ne.width>T.x&&ne.y<T.y+T.height&&ne.y+ne.height>T.y}))return}}const h=()=>new Set(pt(Ge(n)).map(ct)),m=h(),w=g.map(y=>y.width);for(const y of g)_f(i,y,d-y.x,{layout:!1});[...h()].every(y=>m.has(y))||g.forEach((y,v)=>_f(i,y,w[v],{layout:!1}))}function zM(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(M=>M.id!==l.id&&M.type!=="bpmn:Group"&&a(l,M));if(!p.length)continue;const f=p.map(M=>i.get(M.id)).filter(M=>!!M&&typeof M.x=="number");if(f.length!==p.length)continue;const d=s(p),g=s(f),h=g.l+(l.x-d.l),m=g.t+(l.y-d.t),w=g.r+(l.x+l.width-d.r),y=g.b+(l.y+l.height-d.b),v={x:h,y:m,width:w-h,height:y-m};if(v.width<=0||v.height<=0||Math.abs(v.x-u.x)<1&&Math.abs(v.y-u.y)<1&&Math.abs(v.width-u.width)<1&&Math.abs(v.height-u.height)<1)continue;const x=r(Ge(i)).length,E={x:u.x,y:u.y,width:u.width,height:u.height};o.resizeShape(u,v),r(Ge(i)).length>x&&o.resizeShape(u,E)}}const nl=20,il=10;function GM(e,t,n,i){var p,f;const{elementRegistry:o}=e,r=e.modeling,a=d=>new Set(pt(d,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(ct)),s=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(Ie=>Ie.id===d);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const m=l.get(d);if(!(!m||Math.abs(m.x-h.x)>=.5||Math.abs(m.y-h.y)>=.5||Math.abs(m.width-h.width)>=.5||Math.abs(m.height-h.height)>=.5))continue;const y=h.members.map(Ie=>o.get(Ie)).filter(Ie=>!!Ie&&typeof Ie.x=="number");if(!y.length)continue;const v=Math.min(...y.map(Ie=>Ie.x)),x=Math.min(...y.map(Ie=>Ie.y)),E=Math.max(...y.map(Ie=>Ie.x+Ie.width)),M=Math.max(...y.map(Ie=>Ie.y+Ie.height)),D=h.x,P=h.y,T=h.x+h.width,N=h.y+h.height;let j=D,V=P,Q=T,ne=N;for(const Ie of g){const $=s.edges.find(S=>S.id===Ie.edge);if(!$)continue;const C=$.endpoints.some(S=>{const G=s.shapes.find(Ce=>Ce.id===S);if(!G||G.container)return!1;const Z=G.x+G.width/2,ae=G.y+G.height/2;return D<Z&&Z<T&&P<ae&&ae<N});for(const S of tn($)){const G=S.axis==="v"?[P,N]:[D,T];Math.min(S.hi,G[1])-Math.max(S.lo,G[0])<Jp||(S.axis==="v"?D<S.at&&S.at<T:P<S.at&&S.at<N)&&C||(S.axis==="v"?(Math.abs(S.at-D)<=fa&&(j=Math.max(j,S.at+nl)),Math.abs(S.at-T)<=fa&&(Q=Math.min(Q,S.at-nl))):(Math.abs(S.at-P)<=fa&&(V=Math.max(V,S.at+nl)),Math.abs(S.at-N)<=fa&&(ne=Math.min(ne,S.at-nl))))}}if(j>v-il&&(j=D),V>x-il&&(V=P),Q<E+il&&(Q=T),ne<M+il&&(ne=N),j===D&&V===P&&Q===T&&ne===N)continue;const W=o.get(d),te={x:W.x,y:W.y,width:W.width,height:W.height},xe=Ge(o),Oe=new Set(pt(xe).map(ct)),we=a(xe);r.resizeShape(W,{x:j,y:V,width:Q-j,height:ne-V});let K=Ge(o),oe=pt(K).filter(Ie=>!Oe.has(ct(Ie)));const Y=[];if(oe.length>0&&oe.every(Ie=>Ie.kind==="label-over-line"&&!i.has(Ie.edge)&&K.edges.some($=>$.id===Ie.edge))){for(const Ie of oe){if(Ie.kind!=="label-over-line")continue;const $=K.edges.find(ae=>ae.id===Ie.edge),C=$&&vf($,K),S=(f=o.get(Ie.edge))==null?void 0:f.label;if(!C||!S)continue;const G=C.x-S.x,Z=C.y-S.y;r.moveElements([S],{x:G,y:Z}),Y.push({label:S,dx:G,dy:Z})}K=Ge(o),oe=pt(K).filter(Ie=>!Oe.has(ct(Ie)))}const ce=a(K),me=[...ce].some(Ie=>!we.has(Ie));if(oe.length||me||ce.size>=we.size){for(const Ie of Y.reverse())r.moveElements([Ie.label],{x:-Ie.dx,y:-Ie.dy});r.resizeShape(W,te)}}}function VM(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=Op((o==null?void 0:o.$parent)??o),a=os(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:Dp(u,i,r),requests:Np(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 Py(e,t,n={}){var Q,ne;const{i18n:i,lower:o=Cy}=n,r=xy(e),a=$m(r.elementRegistry),s=by(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=AM(t,a,i),u=i&&l.writes.size?VM(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(Sy(l.ops,W=>{var te,xe;return(xe=(te=r.elementRegistry.get(W))==null?void 0:te.source)==null?void 0:xe.id}).keys()),h=new Set(p.edges.map(W=>W.id).filter(W=>!g.has(W))),m=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)),y=go(p),v=y.length,x=new Set(y.map(([W,te])=>`${W}|${te}`)),E=Fi(p),M=new Set(E.map(([W,te])=>`${W}|${te}`)),D=new Map;for(const W of r.elementRegistry.filter(te=>"waypoints"in te&&!!te.waypoints))W.label&&D.set(W.id,{wps:W.waypoints.map(te=>({x:te.x,y:te.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{Gg(P,()=>{o(l.ops,r);for(const te of(u==null?void 0:u.contexts())??[])P.execute(Ip,te);$M(r,f,p),FM(r,p),zM(r,f,p),oM(r,p,m),tM(r,h,w),qm(r,h);const W=lf(r,f);Hm(r,x,h),ay(r,f,h),Qm(r,h),mM(r,h,m),ny(r,f,h),wM(r,f,h),QC(r,M,h),uM(r,h,p),fy(r,f,h),py(r,h,m),hy(r,w),BM(r,f,w),lf(r,f,W),GM(r,d,p,h),gy(r,f),uy(r,D)})}catch(W){return{ok:!1,issues:[W instanceof Ry?W.issue:{kind:"lower-failed",message:W instanceof Error?W.message:String(W)}],findings:[],stats:c}}const T=Ge(r.elementRegistry),N=pt(T,{includeObservationOnly:!0}).filter(W=>!d.has(ct(W))),j=Am(T),V=Fi(T);return{ok:!0,issues:[],findings:N,stats:{edgeCrossings:{before:v,after:j.pairs.length,pairs:j.pairs,solidPairs:j.solidPairs,dashedPairs:j.dashedPairs,mixedPairs:j.mixedPairs,crossPoolMessages:j.crossPoolMessages},sharedEndpointCrossings:{before:E.length,after:V.length,pairs:V}}}}function WM(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function Ty(e,t){return typeof e.get=="function"?e.get(t):e[t]}function ky(e,t){const n=Ty(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Oy(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function UM(e){return typeof e=="string"&&Mp.includes(e)}function zi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Dy(e,t={}){const n=e.rootElements??[],i=n.find(K=>K.$type==="bpmn:Collaboration"),o=new Map(n.filter(K=>K.$type==="bpmn:Process").map(K=>[K.id,K])),r=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],d=[],g=[],h=[],m=[],w=[],y=[],v=new Map,x=new Set,E=new Set,M=K=>{K&&x.add(K)},D=K=>{x.add(K),E.add(K)},P=K=>{const oe=Oy(K,"bwl:Placement");if(!oe)return;const Y=typeof oe.anchor=="string"?oe.anchor:void 0;if(!Y||!UM(oe.side))return;const X=typeof oe.offset=="number"?oe.offset:void 0;m.push({owner:K.id,anchor:Y,side:oe.side,...X!==void 0?{offset:X}:{}})},T=K=>{const oe=Oy(K,"bwl:Members"),Y=typeof(oe==null?void 0:oe.refs)=="string"?oe.refs.split(/\s+/).filter(Boolean):[];Y.length&&y.push({owner:K.id,refs:Y})},N=K=>{var oe;for(const Y of K)switch(M(Y.id),Y.$type){case"bpmn:TextAnnotation":D(Y.id),v.set(Y.id,Y),c.push({id:Y.id,text:typeof Y.text=="string"?Y.text:""}),P(Y);break;case"bpmn:Association":g.push({id:Y.id,type:Y.$type,source:zi(Y.sourceRef),target:zi(Y.targetRef)});break;case"bpmn:Group":{D(Y.id),v.set(Y.id,Y);const X=(oe=Y.categoryValueRef)==null?void 0:oe.value;l.push({id:Y.id,...typeof X=="string"&&X?{name:X}:{}}),T(Y);break}default:u.push({id:Y.id,type:Y.$type,reason:"type-outside-mvp"})}},j=K=>{for(const oe of K.flowElements??[])M(oe.id),u.push({id:oe.id,type:oe.$type,reason:"inside-container"}),(oe.flowElements??[]).length&&j(oe);for(const oe of K.artifacts??[])M(oe.id),u.push({id:oe.id,type:oe.$type,reason:"inside-container"})},V=(K,oe)=>{const Y=K.flowElements??[],X=(K.laneSets??[]).flatMap(me=>me.lanes??[]),ce=new Map;for(const me of X){M(me.id),v.set(me.id,me);for(const Ie of me.flowNodeRef??[]){const $=zi(Ie);$&&ce.set($,me.id)}}for(const me of Y){if(M(me.id),v.set(me.id,me),me.$type==="bpmn:SequenceFlow"){f.push({id:me.id,source:zi(me.sourceRef),target:zi(me.targetRef),...typeof me.name=="string"&&me.name?{name:me.name}:{}});continue}if(me.$type==="bpmn:DataStoreReference"){D(me.id),s.push({id:me.id,...me.name?{name:me.name}:{}});continue}const Ie=WM(me.$type),$=Ie==="intermediateCatchEvent"?Rp((me.eventDefinitions??[]).map(Z=>Z.$type)):void 0;if(!Ng(Ie)||Ie==="intermediateCatchEvent"&&!$){u.push({id:me.id,type:me.$type,reason:"type-outside-mvp"});continue}D(me.id);const C=Ie==="boundaryEvent"?zi(me.attachedToRef):void 0;a.push({id:me.id,type:Ie,...me.name?{name:me.name}:{},...oe?{participant:oe}:{},...ce.has(me.id)?{lane:ce.get(me.id)}:{},...C?{attachedTo:C}:{},...$?{eventDefinition:$}:{}}),Ie==="subProcess"&&j(me);const S=ky(me,"bwl:band");S!==void 0&&(p.bands[me.id]=S);const G=Ty(me,"bwl:afterColumn");typeof G=="string"&&G!==""&&w.push([me.id,G]);for(const Z of me.dataOutputAssociations??[])M(Z.id),h.push({id:Z.id,type:Z.$type,source:me.id,target:zi(Z.targetRef)});for(const Z of me.dataInputAssociations??[])M(Z.id),h.push({id:Z.id,type:Z.$type,source:zi((Z.sourceRef??[])[0]),target:me.id})}N(K.artifacts??[])};if(i){const K=new Set;for(const oe of i.participants??[]){D(oe.id),v.set(oe.id,oe);const Y=zi(oe.processRef);Y&&K.add(Y);const X=Y?o.get(Y):void 0,ce=((X==null?void 0:X.laneSets)??[]).flatMap(C=>C.lanes??[]),me=ce.map(C=>({id:C.id,...C.name?{name:C.name}:{}}));for(const C of me)D(C.id);const Ie=!X||(X.flowElements??[]).length===0&&ce.length===0&&(X.artifacts??[]).length===0;r.push({id:oe.id,...oe.name?{name:oe.name}:{},...Ie?{blackBox:!0}:{},...me.length?{lanes:me}:{}});const $=ky(oe,"bwl:poolOrder");$!==void 0&&(p.poolOrders[oe.id]=$),X&&V(X,oe.id)}for(const oe of i.messageFlows??[])M(oe.id),v.set(oe.id,oe),d.push({id:oe.id,source:zi(oe.sourceRef),target:zi(oe.targetRef),...typeof oe.name=="string"&&oe.name?{name:oe.name}:{}});N(i.artifacts??[]);for(const[oe,Y]of o)!K.has(oe)&&(Y.flowElements??[]).length>0&&u.push({id:oe,type:Y.$type,reason:"unreachable-process"})}else for(const K of o.values())V(K);const Q=[],ne=[],W=[],te=[],xe=(K,oe)=>!!K&&!!oe&&E.has(K)&&E.has(oe);for(const K of f){if(!xe(K.source,K.target)){u.push({id:K.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}Q.push({id:K.id,source:K.source,target:K.target,...K.name?{name:K.name}:{}}),E.add(K.id)}for(const K of d){if(!xe(K.source,K.target)){u.push({id:K.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}ne.push({id:K.id,source:K.source,target:K.target,...K.name?{name:K.name}:{}}),E.add(K.id)}for(const K of h){if(!xe(K.source,K.target)){u.push({id:K.id??"",type:K.type,reason:"endpoint-outside-mvp"});continue}te.push({...K.id?{id:K.id}:{},source:K.source,target:K.target}),K.id&&E.add(K.id)}for(const K of g){if(!xe(K.source,K.target)){u.push({id:K.id??"",type:K.type,reason:"endpoint-outside-mvp"});continue}W.push({...K.id?{id:K.id}:{},source:K.source,target:K.target})}const Oe=new Map(l.map(K=>[K.id,K]));for(const{owner:K,refs:oe}of y){const Y=oe.filter(ce=>x.has(ce)),X=Oe.get(K);X&&Y.length&&(X.members=Y)}for(const K of m)x.has(K.anchor)&&(p.placements[K.owner]={anchor:K.anchor,side:K.side,...K.offset!==void 0?{offset:K.offset}:{}});for(const[K,oe]of w)x.has(oe)&&(p.afterColumns[K]=oe);const we={...r.length?{participants:r}:{},nodes:a,sequenceFlows:Q,...ne.length?{messageFlows:ne}:{},...s.length?{dataStores:s}:{},...te.length?{dataAssociations:te}:{},...c.length?{annotations:c}:{},...W.length?{associations:W}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:we,hints:p,omitted:u,i18n:qM(we,v,e,t.i18n)}:{definition:we,hints:p,omitted:u}}function qM(e,t,n,i){const o=Op(n),r=os(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=Dp(u,i,o);Object.keys(p).length&&(c[l]=p);for(const f of Np(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 YM(e,t={}){const{definitions:n,warnings:i}=await la(e);return{...Dy(n,t),warnings:i}}const KM=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Ef(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function XM(e){return Ef(e.processRef)!==void 0}function ZM(e){const t=new Set,n=o=>{const r=Ef(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 QM(e){const t=[],n=i=>{for(const o of i.flowElements??[])KM.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 JM(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 Sf(e){const t=[],n=e.rootElements??[],i=ZM(e);for(const r of QM(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??[])XM(s)&&JM(r.get(Ef(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 eA(e){const{definitions:t,warnings:n}=await la(e);return{issues:Sf(t),warnings:n}}const tA=.5,nA=8,iA=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),ol=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function oA(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}=${ol(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=>`${ol(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(ol).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function rA(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=ol(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 Ly(e){const t=rA(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:")&&!iA.has(s)&&n.set(c,{type:s,props:oA(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 Iy(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 By(e,t,n={}){const i=n.moveTolerance??tA,o=Ly(e),r=Ly(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||Iy(p.geometry,u.geometry,i)||Iy(p.label,u.label,n.labelTolerance??nA))&&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 aA(e,t,n={}){const[i,o]=await Promise.all([la(e),la(t)]);return{...By(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function sA(e){return new Set([...e.added,...e.modified])}function cA(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Ny(e,t,{currentVersion:n,i18n:i}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const o=Py(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 lA=new Set(["lasso","lasso.selection","hand","hand.move"]),$y=1e4,uA="bwl-edit-locked",Fy=new WeakMap;function pA(e){const t=Fy.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",$y,()=>{var s;if(o)return lA.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"],$y,()=>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(uA,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 Fy.set(e,a),a}const fA=Symbol("bpmn-editor"),Rf={geometry:[],semantic:[]};function dA(){const e=ye.ref(!1),t=ye.ref(!0),n=ye.ref(!1),i=ye.shallowRef(Rf),o=ye.shallowRef(void 0),r=ye.shallowRef(void 0);let a,s,c;const l=()=>{if(p(),!c){i.value=Rf;return}const w=pt(Ge(c.get("elementRegistry")),{includeObservationOnly:!0}),y=c.getDefinitions();i.value={geometry:w,semantic:y?Sf(y):[]}};function u(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function p(){const w=u();if(!w||!a){r.value=void 0;return}const y=w.locales(),v={};for(const x of y)v[x]={untranslated:w.untranslatedCount(x),reviewRequested:w.reviewRequestedCount(x)};r.value={designLocale:a.designLocale,locales:y,displayLocale:w.getDisplayLocale()??a.designLocale,counts:v}}function f(){const w=u();w&&(w.configure(a),a&&s&&(s=w.setDisplayLocale(s)))}const d=()=>{e.value=!0,l()};function g(w,y){pA(w).set(!y)}function h(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function m(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:l,changeScope:o,i18n:r,configureI18n(w){a=w,f(),p()},setDisplayLocale(w){var v;s=w;const y=(v=u())==null?void 0:v.setDisplayLocale(w);y&&(s=y),p()},setChangeScope(w){o.value=w===void 0?void 0:new Set(w)},requestFocus(w){if(!c)return;const y=c.get("elementRegistry").get(w);y&&(c.get("canvas").scrollToElement(y,180),c.get("selection").select(y))},describeElement(w){const y=c==null?void 0:c.get("elementRegistry").get(w),v=y==null?void 0:y.businessObject;if(!v)return;const x=typeof v.name=="string"&&v.name.trim()!==""?v.name:v.text;return{name:typeof x=="string"&&x.trim()!==""?x.trim():void 0,type:typeof v.$type=="string"?v.$type:""}},attach(w){c&&this.detach(),c=w,c.get("eventBus").on("commandStack.changed",d),t.value||g(c,!1),f(),l()},detach(){c==null||c.get("eventBus").off("commandStack.changed",d),c&&!t.value&&g(c,!0),c=void 0,i.value=Rf,o.value=void 0,r.value=void 0},setEditable(w){t.value=w,c&&g(c,w)},async applyAgentBatch(w,y){const v=h();n.value=!0;try{const x=await Ny(v,w,{currentVersion:y,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return x.status==="applied"&&(e.value=!1),x}finally{n.value=!1}},async importXml(w){const{warnings:y}=await h().importXML(w);return e.value=!1,o.value=void 0,l(),{warnings:Qp(y)}},async saveXml(){const{xml:w}=await h().saveXML({format:!0});return e.value=!1,w??""},undo:()=>{var w;return(w=m())==null?void 0:w.undo()},redo:()=>{var w;return(w=m())==null?void 0:w.redo()},canUndo:()=>{var w;return((w=m())==null?void 0:w.canUndo())??!1},canRedo:()=>{var w;return((w=m())==null?void 0:w.canRedo())??!1}}}const hA=new RegExp("\\p{Script=Hangul}","u"),gA=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,mA=new RegExp("\\p{Script=Han}","u");function rl(e){const t=hA.test(e),n=gA.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:mA.test(e)?"han":"other"}}function jy(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 Hy(e){var i;const t=new Set,n=[];for(const o of(e==null?void 0:e.diagrams)??[])for(const r of((i=o==null?void 0:o.plane)==null?void 0:i.planeElement)??[]){const a=r==null?void 0:r.bpmnElement;if(!a||t.has(a))continue;t.add(a);const s=Rr(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:$o(a).filter(l=>Sn(l))})}return n}const gs=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function yA(e){const t=jy(e),n=Hy(e);let i;const o={},r=[],a=[],s=[];for(const g of n){const h=g.trs.filter(m=>(m.body??"")===g.name).map(Sn);if(h.length){const m=[...h].sort().join("+");o[m]=(o[m]??0)+1,i=i?new Set([...i].filter(w=>h.includes(w))):new Set(h)}else g.trs.some(m=>m.body)?r.push(gs(g)):s.push({e:g,inference:rl(g.name)});for(const m of g.trs){const w=Sn(m),y=m.body??"",v=rl(y);v.locale&&v.locale!==w?a.push({...gs(g),locale:w,script:v.script}):w==="ko"&&v.script==="han"&&g.trs.some(x=>x!==m&&x.body===y)&&a.push({...gs(g),locale:w,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({...gs(g),locale:h.locale}):d.push({...gs(g),script:h.script});return{root:{current:t,proposed:l,reason:u},additions:f,undecided:d,drift:r,matchedBy:o,scriptMismatch:a}}function vA(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!jy(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(Hy(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=>Sn(f)===s);if(l){l.body=c.name,i++;continue}let u=c.bo.extensionElements;u||(u=n.create("bpmn:ExtensionElements",{values:[]}),u.$parent=c.bo,c.bo.extensionElements=u);const p=n.create(Sr,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function zy(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 Cf=e=>Sn(e)||void 0,Gy=e=>e.body??"";function Vy(e){const t=new Map;for(const n of zy(e)){const i=$o(n);i.length&&t.set(n.id,{type:n.$type,cells:i.map(o=>({locale:Cf(o),body:Gy(o)}))})}return t}const Wy=e=>JSON.stringify(e.map(t=>t.body).sort());class bA{constructor(){Bn(this,"byId",new Map);Bn(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};Uy(this.byId,o,a),Uy(this.byBodies,Wy(r.cells),a)}}sameId(t){return this.byId.get(t)??[]}sameBodies(t){return this.byBodies.get(Wy(t))??[]}}function Uy(e,t,n){const i=e.get(t);i?i.push(n):e.set(t,[n])}function xA(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 Mf(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 wA(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 _A=e=>JSON.stringify([...e.cells].sort((t,n)=>(t.body+t.locale).localeCompare(n.body+n.locale)));function EA(e,t){const n={restores:[],ambiguous:[],stale:[],unresolved:[]},i=Vy(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=xA(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&&Mf(m.state,c)).sort((m,w)=>w.version-m.version).slice(0,1).map(m=>m.state)],["lineage",t.index.sameId(a).filter(m=>m.doc!==t.doc&&Mf(m.state,c)).map(m=>m.state)],["bodies",t.index.sameBodies(s.cells).filter(m=>!(m.doc===t.doc&&m.id===a)&&Mf(m.state,c)).map(m=>m.state)]].find(([,m])=>m.length);if(!p){if(!r(s))continue;for(const[m,w]of c)for(let y=0;y<w;y++)n.unresolved.push({...l,body:m,script:rl(m).script});continue}const[f,d]=p,g=d.map(m=>wA(s,m,c));if(g.some(m=>m.overflow)||new Set(g.map(_A)).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 SA(e,t){if(!t.restores.length)return 0;const n=new Map(zy(e).map(o=>[o.id,o]));let i=0;for(const o of t.restores){const r=n.get(o.id);if(!r)continue;const a=$o(r),s=new Set(a.map(Cf).filter(Boolean));for(const{body:c,locale:l}of o.cells){if(s.has(l))continue;const u=a.find(p=>!Cf(p)&&Gy(p)===c);u&&(u.set("xml:lang",l),s.add(l),i++)}}return i}function Le(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function RA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Af={exports:{}},qy;function CA(){if(qy)return Af.exports;qy=1;var e=Af.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},Af.exports}var MA=CA(),AA=RA(MA);function Xi(e){if(!(this instanceof Xi))return new Xi(e);e=e||[128,36,1],this._seed=e.length?AA.rack(e[0],e[1],e[2]):e}Xi.prototype.next=function(e){return this._seed(e||!0)},Xi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Xi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Xi.prototype.assigned=function(e){return this._seed.get(e)||!1},Xi.prototype.unclaim=function(e){delete this._seed.hats[e]},Xi.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 PA(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var o=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function Vn(e,...t){const n=e.style;return z(t,function(i){i&&z(i,function(o,r){n[r]=o})}),e}function Rn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const TA=Object.prototype.toString;function Rt(e){return new Vo(e)}function Vo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Vo.prototype.add=function(e){return this.list.add(e),this},Vo.prototype.remove=function(e){return TA.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Vo.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Vo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Vo.prototype.array=function(){return Array.from(this.list)},Vo.prototype.has=Vo.prototype.contains=function(e){return this.list.contains(e)};function al(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Tr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function kA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var sl={},Yy;function OA(){if(Yy)return sl;Yy=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return sl.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},sl.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},sl}var Ky=OA(),DA=kA(Ky),je=PA({__proto__:null,default:DA},[Ky]),Xy=["focus","blur"];function LA(e,t,n,i,o){return Xy.indexOf(n)!==-1&&(o=!0),je.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=Tr(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function IA(e,t,n,i){return Xy.indexOf(t)!==-1&&(i=!0),je.unbind(e,t,n,i)}var ni={bind:LA,unbind:IA};function Pf(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Et(e,t){return t=t||document,t.querySelector(e)}function ms(e,t){return t=t||document,t.querySelectorAll(e)}function Zi(e){e.parentNode&&e.parentNode.removeChild(e)}function BA(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function NA(e,t){return t.appendChild(BA(e,t))}function Ke(e,t){return NA(t,e),e}var Tf=2,Zy={"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":Tf,"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":Tf,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function $A(e,t){return Zy[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=Zy[i];o?(o===Tf&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function FA(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)Qy(e,o,t[o])}function Ae(e,t,n){if(typeof t=="string")if(n!==void 0)Qy(e,t,n);else return $A(e,t);else FA(e,t);return e}const jA=Object.prototype.toString;function lt(e){return new Wo(e)}function Wo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Wo.prototype.add=function(e){return this.list.add(e),this},Wo.prototype.remove=function(e){return jA.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Wo.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Wo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Wo.prototype.array=function(){return Array.from(this.list)},Wo.prototype.has=Wo.prototype.contains=function(e){return this.list.contains(e)};function ys(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function kf(e){return e.cloneNode(!0)}var Of={svg:"http://www.w3.org/2000/svg"},Jy='<svg xmlns="'+Of.svg+'"';function HA(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Of.svg)===-1&&(e=Jy+e.substring(4)):(e=Jy+">"+e+"</svg>",t=!0);var n=zA(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function zA(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function $e(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=HA(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Of.svg,e),t&&Ae(n,t),n}var Df=null;function ev(){return Df===null&&(Df=$e("svg")),Df}function tv(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function GA(e,t,n,i,o,r){var a=ev().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return tv(a,e);case 6:return tv(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function vs(e){return ev().createSVGTransform()}var nv=/([&<>]{1})/g,VA=/([&<>\n\r"]{1})/g,WA={"&":"&","<":"<",">":">",'"':"'"};function Lf(e,t){function n(i,o){return WA[o]||o}return e.replace(t,n)}function iv(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(Lf(e.textContent,nv));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,'="',Lf(r.value,VA),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)iv(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Lf(e.nodeValue,nv),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function UA(e){for(var t=e.firstChild,n=[];t;)iv(t,n),t=t.nextSibling;return n.join("")}function ov(e,t){return UA(e)}function nn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function qA(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function YA(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(qA(e,i))}function bs(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),YA(n,t)),n.consolidate()}const KA=/^class[ {]/;function XA(e){return KA.test(e.toString())}function If(e){return Array.isArray(e)}function Bf(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function cl(...e){e.length===1&&If(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const ZA=/constructor\s*[^(]*\(\s*([^)]*)\)/m,QA=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,JA=/\/\*([^*]*)\*\//m;function eP(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(XA(e)?ZA:QA);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(JA);return(o&&o[1]||i).trim()})||[]}function rv(e,t){const n=t||{get:function(v,x){if(i.push(v),x===!1)return null;throw s(`No provider for "${v}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),a=r.injector=this,s=function(v){const x=i.join(" -> ");return i.length=0,new Error(x?`${v} (Resolving: ${x})`:v)};function c(v,x){if(!o[v]&&v.includes(".")){const E=v.split(".");let M=c(E.shift());for(;E.length;)M=M[E.shift()];return M}if(Bf(r,v))return r[v];if(Bf(o,v)){if(i.indexOf(v)!==-1)throw i.push(v),s("Cannot resolve circular dependency!");return i.push(v),r[v]=o[v][0](o[v][1]),i.pop(),r[v]}return n.get(v,x)}function l(v,x){if(typeof x>"u"&&(x={}),typeof v!="function")if(If(v))v=cl(v.slice());else throw s(`Cannot invoke "${v}". Expected a function!`);const M=(v.$inject||eP(v)).map(D=>Bf(x,D)?x[D]:c(D));return{fn:v,dependencies:M}}function u(v){const{fn:x,dependencies:E}=l(v),M=Function.prototype.bind.call(x,null,...E);return new M}function p(v,x,E){const{fn:M,dependencies:D}=l(v,E);return M.apply(x,D)}function f(v){return cl(x=>v.get(x))}function d(v,x){if(x&&x.length){const E=Object.create(null),M=Object.create(null),D=[],P=[],T=[];let N,j,V,Q;for(let ne in o)N=o[ne],x.indexOf(ne)!==-1&&(N[2]==="private"?(j=D.indexOf(N[3]),j===-1?(V=N[3].createChild([],x),Q=f(V),D.push(N[3]),P.push(V),T.push(Q),E[ne]=[Q,ne,"private",V]):E[ne]=[T[j],ne,"private",P[j]]):E[ne]=[N[2],N[1]],M[ne]=!0),(N[2]==="factory"||N[2]==="type")&&N[1].$scope&&x.forEach(W=>{N[1].$scope.indexOf(W)!==-1&&(E[ne]=[N[2],N[1]],M[W]=!0)});x.forEach(ne=>{if(!M[ne])throw new Error('No provider for "'+ne+'". Cannot use provider from the parent!')}),v.unshift(E)}return new rv(v,a)}const g={factory:p,type:u,value:function(v){return v}};function h(v,x){const E=v.__init__||[];return function(){E.forEach(M=>{typeof M=="string"?x.get(M):x.invoke(M)})}}function m(v){const x=v.__exports__;if(x){const E=v.__modules__,M=Object.keys(v).reduce((j,V)=>(V!=="__exports__"&&V!=="__modules__"&&V!=="__init__"&&V!=="__depends__"&&(j[V]=v[V]),j),Object.create(null)),D=(E||[]).concat(M),P=d(D),T=cl(function(j){return P.get(j)});x.forEach(function(j){o[j]=[T,j,"private",P]});const N=(v.__init__||[]).slice();return N.unshift(function(){P.init()}),v=Object.assign({},v,{__init__:N}),h(v,P)}return Object.keys(v).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const M=v[E];if(M[2]==="private"){o[E]=M;return}const D=M[0],P=M[1];o[E]=[g[D],tP(D,P),D]}),h(v,a)}function w(v,x){return v.indexOf(x)!==-1||(v=(x.__depends__||[]).reduce(w,v),v.indexOf(x)!==-1)?v:v.concat(x)}function y(v){const x=v.reduce(w,[]).map(m);let E=!1;return function(){E||(E=!0,x.forEach(M=>M()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=y(e)}function tP(e,t){return e!=="value"&&If(t)&&(t=cl(t.slice())),t}var nP=1e3;function yo(e,t){var n=this;t=t||nP,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)})}yo.prototype.canRender=function(e){},yo.prototype.drawShape=function(e,t){},yo.prototype.drawConnection=function(e,t){},yo.prototype.getShapePath=function(e){},yo.prototype.getConnectionPath=function(e){};function kr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function iP(e){return["M",e.x,e.y]}function Nf(e){return["L",e.x,e.y]}function oP(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function rP(e,t){const n=e.length,i=[iP(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(Nf(a));continue}const c=Math.min(t,$f(a.x-r.x,a.y-r.y),$f(s.x-a.x,s.y-a.y));if(!c){i.push(Nf(a));continue}const l=ll(a,r,c),u=ll(a,r,c*.5),p=ll(a,s,c),f=ll(a,s,c*.5);i.push(Nf(l)),i.push(oP(u,f,p))}return i}function ll(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=$f(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function $f(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function xs(e,t,n){Ue(t)&&(n=t,t=null),t||(t={});const i=$e("path",t);return Ue(n)&&(i.dataset.cornerRadius=String(n)),Ff(i,e)}function Ff(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Ae(e,{d:kr(rP(t,n))}),e}function ul(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 Or(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&&Or(r,t,n+1)})}function jf(e,t,n){var i=new Set,o=new Set;return Or(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 ws(e,t){return jf(e)}function aP(e,t,n){Er(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&&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,z(u.incoming,c),z(u.outgoing,c),u.children}return Or(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function on(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=on(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 z(e,function(i){var o=i;o.waypoints&&(o=on(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 av(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function sv(e){return!!(e&&e.isFrame)}function _s(e,t){return q({},e||{},t||{})}var sP=1;function Uo(e,t){yo.call(this,e,sP),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})}Le(Uo,yo),Uo.prototype.canRender=function(){return!0},Uo.prototype.drawShape=function(t,n,i){var o=$e("rect");return Ae(o,{x:0,y:0,width:n.width||0,height:n.height||0}),sv(n)?Ae(o,q({},this.FRAME_STYLE,i||{})):Ae(o,q({},this.SHAPE_STYLE,i||{})),Ke(t,o),o},Uo.prototype.drawConnection=function(t,n,i){var o=xs(n.waypoints,q({},this.CONNECTION_STYLE,i||{}));return Ke(t,o),o},Uo.prototype.getShapePath=function(t){var n=t.x,i=t.y,o=t.width,r=t.height,a=[["M",n,i],["l",o,0],["l",0,r],["l",-o,0],["z"]];return kr(a)},Uo.prototype.getConnectionPath=function(t){var n=t.waypoints,i,o,r=[];for(i=0;o=n[i];i++)o=o.original||o,r.push([i===0?"M":"L",o.x,o.y]);return kr(r)},Uo.$inject=["eventBus","styles"];function cP(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,o){var r=this.style(i,o);return q(r,{class:n})},this.style=function(n,i){!We(n)&&!i&&(i=n,n=[]);var o=ti(n,function(r,a){return q(r,e[a]||{})},{});return i?q(o,i):o},this.computeStyle=function(n,i,o){return We(i)||(o=i,i=[]),t.style(i||[],q({},o,n||{}))}}const lP={__init__:["defaultRenderer"],defaultRenderer:["type",Uo],styles:["type",cP]};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 Hf(e,t){return!e||!t?-1:e.indexOf(t)}function Es(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zf(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=Es(e,t);return Math.abs(o/r)<=i}var uP=2;function vo(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(pP(o,n))return r;return!1}function pP(e,t){const n=t[0];return Bo(t,function(i){return Math.abs(n[e]-i[e])<=uP})}function cv(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 Gf(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var fP=/,?([a-z]),?/gi,lv=parseFloat,rn=Math,qo=rn.PI,Qi=rn.min,Ji=rn.max,uv=rn.pow,Yo=rn.abs,dP=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,hP=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,pv=Array.isArray||function(e){return e instanceof Array};function gP(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function mP(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 yP(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 gP(o,i)?(mP(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function vP(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(dP,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(hP,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=Wf,n}function bP(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 xP(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 Vf(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 Wf(){return this.join(",").replace(fP,"$1")}function wP(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=Wf,t}function fv(e,t,n,i,o,r,a,s,c){var l=1-c,u=uv(l,3),p=uv(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:pl(g),y:pl(h)}}function dv(e){var t=MP(...e);return Vf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Ko(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function _P(e,t){return e=Vf(e),t=Vf(t),Ko(t,e.x,e.y)||Ko(t,e.x2,e.y)||Ko(t,e.x,e.y2)||Ko(t,e.x2,e.y2)||Ko(e,t.x,t.y)||Ko(e,t.x2,t.y)||Ko(e,t.x,t.y2)||Ko(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function hv(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 gv(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=hv(h,e,n,o,a),w=hv(h,t,i,r,s),y=m*m+w*w;d+=f[g]*rn.sqrt(y)}return l*d}function EP(e,t,n,i,o,r,a,s){if(!(Ji(e,n)<Qi(o,a)||Qi(e,n)>Ji(o,a)||Ji(t,i)<Qi(r,s)||Qi(t,i)>Ji(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=pl(c/u),f=pl(l/u),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+Qi(e,n).toFixed(2)||d>+Ji(e,n).toFixed(2)||d<+Qi(o,a).toFixed(2)||d>+Ji(o,a).toFixed(2)||g<+Qi(t,i).toFixed(2)||g>+Ji(t,i).toFixed(2)||g<+Qi(r,s).toFixed(2)||g>+Ji(r,s).toFixed(2)))return{x:p,y:f}}}}function pl(e){return Math.round(e*1e11)/1e11}function SP(e,t,n){var i=dv(e),o=dv(t);if(!_P(i,o))return[];var r=gv(...e),a=gv(...t),s=yv(e)?1:~~(r/5)||1,c=yv(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=fv(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=fv(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var m=l[d],w=l[d+1],y=u[g],v=u[g+1],x=Yo(w.x-m.x)<.01?"y":"x",E=Yo(v.x-y.x)<.01?"y":"x",M=EP(m.x,m.y,w.x,w.y,y.x,y.y,v.x,v.y),D;if(M){if(D=M.x.toFixed(9)+"#"+M.y.toFixed(9),p[D])continue;p[D]=!0;var P=m.t+Yo((M[x]-m[x])/(w[x]-m[x]))*(w.t-m.t),T=y.t+Yo((M[E]-y[E])/(v[E]-y[E]))*(v.t-y.t);P>=0&&P<=1&&T>=0&&T<=1&&f.push({x:M.x,y:M.y,t1:P,t2:T})}}return f}function mv(e,t,n){e=xv(e),t=xv(t);for(var i,o,r,a,s,c,l,u,p,f,d=n?0:[],g=0,h=e.length;g<h;g++){var m=e[g];if(m[0]=="M")i=s=m[1],o=c=m[2];else{m[0]=="C"?(p=[i,o,...m.slice(1)],i=p[6],o=p[7]):(p=[i,o,i,o,s,c,s,c],i=s,o=c);for(var w=0,y=t.length;w<y;w++){var v=t[w];if(v[0]=="M")r=l=v[1],a=u=v[2];else{v[0]=="C"?(f=[r,a,...v.slice(1)],r=f[6],a=f[7]):(f=[r,a,r,a,l,u,l,u],r=l,a=u);var x=SP(p,f);{for(var E=0,M=x.length;E<M;E++)x[E].segment1=g,x[E].segment2=w,x[E].bez1=p,x[E].bez2=f;d=d.concat(x)}}}}}return d}function RP(e){return pv(e)&&pv(e[0])}function CP(e){if(bP(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=Wf,t}function yv(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function fl(e,t,n,i){return[e,t,n,i,n,i]}function vv(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 bv(e,t,n,i,o,r,a,s,c,l){var u=qo*120/180,p=qo/180*(+o||0),f=[],d,g=yP(function($,C,S){var G=$*rn.cos(S)-C*rn.sin(S),Z=$*rn.sin(S)+C*rn.cos(S);return{x:G,y:Z}});if(l)D=l[0],P=l[1],E=l[2],M=l[3];else{d=g(e,t,-p),e=d.x,t=d.y,d=g(s,c,-p),s=d.x,c=d.y;var h=(e-s)/2,m=(t-c)/2,w=h*h/(n*n)+m*m/(i*i);w>1&&(w=rn.sqrt(w),n=w*n,i=w*i);var y=n*n,v=i*i,x=(r==a?-1:1)*rn.sqrt(Yo((y*v-y*m*m-v*h*h)/(y*m*m+v*h*h))),E=x*n*m/i+(e+s)/2,M=x*-i*h/n+(t+c)/2,D=rn.asin(((t-M)/i).toFixed(9)),P=rn.asin(((c-M)/i).toFixed(9));D=e<E?qo-D:D,P=s<E?qo-P:P,D<0&&(D=qo*2+D),P<0&&(P=qo*2+P),a&&D>P&&(D=D-qo*2),!a&&P>D&&(P=P-qo*2)}var T=P-D;if(Yo(T)>u){var N=P,j=s,V=c;P=D+u*(a&&P>D?1:-1),s=E+n*rn.cos(P),c=M+i*rn.sin(P),f=bv(s,c,n,i,o,0,a,j,V,[P,N,E,M])}T=P-D;var Q=rn.cos(D),ne=rn.sin(D),W=rn.cos(P),te=rn.sin(P),xe=rn.tan(T/4),Oe=4/3*n*xe,we=4/3*i*xe,K=[e,t],oe=[e+Oe*ne,t-we*Q],Y=[s+Oe*te,c-we*W],X=[s,c];if(oe[0]=2*K[0]-oe[0],oe[1]=2*K[1]-oe[1],l)return[oe,Y,X].concat(f);f=[oe,Y,X].concat(f).join().split(",");for(var ce=[],me=0,Ie=f.length;me<Ie;me++)ce[me]=me%2?g(f[me-1],f[me],p).y:g(f[me],f[me+1],p).x;return ce}function MP(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,f,d,g,h,m,w,y=0;y<2;++y){if(y==0?(p=6*e-12*n+6*o,u=-3*e+9*n-9*o+3*a,f=3*n-3*e):(p=6*t-12*i+6*r,u=-3*t+9*i-9*r+3*s,f=3*i-3*t),Yo(u)<1e-12){if(Yo(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}m=p*p-4*f*u,w=rn.sqrt(m),!(m<0)&&(g=(-p+w)/(2*u),0<g&&g<1&&c.push(g),h=(-p-w)/(2*u),0<h&&h<1&&c.push(h))}for(var v=c.length,x=v,E;v--;)d=c[v],E=1-d,l[0][v]=E*E*E*e+3*E*E*d*n+3*E*d*d*o+d*d*d*a,l[1][v]=E*E*E*t+3*E*E*d*i+3*E*d*d*r+d*d*d*s;return l[0][x]=e,l[1][x]=t,l[0][x+1]=a,l[1][x+1]=s,l[0].length=l[1].length=x+2,{x0:Qi(...l[0]),y0:Qi(...l[1]),x1:Ji(...l[0]),y1:Ji(...l[1])}}function xv(e){if(RP(e)||(e=vP(e)),xP(e))return e;for(var t=wP(CP(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",...bv(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",...vv(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",...vv(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...fl(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...fl(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...fl(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...fl(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=lv(u[p-4])||n.x,n.by=lv(u[p-3])||n.y}return t}function Tt(e){return hn(e)&&ei(e,"waypoints")}function nt(e){return hn(e)&&ei(e,"labelTarget")}function AP(e){return hn(e)&&ia(e.parent)}function wv(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function bo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ze(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function dl(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function PP(e){return bo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function TP(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=DP(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 Tt(e)?TP(e):PP(e)}function Tn(e,t,n){n=n||0,hn(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 Ss(e,t,n){var i=kP(e,t);return i.length===1||i.length===2&&Es(i[0],i[1])<1?bo(i[0]):i.length>1?(i=qi(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),bo(i[n?0:i.length-1])):null}function kP(e,t){return mv(e,t)}function OP(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],Es(n,o)===0||zf(i,o,n)?e.splice(t,1):t++;return e}function DP(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function hl(e,t){return Math.round(e*t)/t}function _v(e){return Ue(e)?e+"px":e}function LP(e){for(;e.parent;)e=e.parent;return e}function IP(e){e=q({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Vn(n,{position:"relative",overflow:"hidden",width:_v(e.width),height:_v(e.height)}),t.appendChild(n),n}function Ev(e,t,n){const i=$e("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 BP="base",Sv=0,NP=1,$P={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=IP(e),i=this._svg=$e("svg");Ae(i,{width:"100%",height:"100%"}),Rn(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=Ev(i,"viewport");e.deferUpdate&&(this._viewboxChanged=kp(this._viewboxChanged,300)),this._restoreFocus=kp(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:o})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},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=av(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(BP,Sv)},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=NP);const n=this._getChildIndex(t);return{group:Ev(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&&(nn(n),t.visible=!1),n},Ye.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],nn(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(LP(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,Sv);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=$P[e];if(!Bo(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);bs(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=bs(t),o=a?a.matrix:GA(),s=hl(o.a,1e3),c=hl(-o.e||0,1e3),l=hl(-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=q({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Rv(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=on(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 g=Math.max(0,s.right-f.right),h=Math.min(0,s.left-f.left),m=Math.max(0,s.bottom-f.bottom),w=Math.min(0,s.top-f.top);u=g||h,p=m||w}this.scroll({dx:-u*l,dy:-p*l})},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)}),hl(i.a,1e3)};function Rv(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=q(r,t),s=a.matrixTransform(c.inverse()),l=o.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),u=c.multiply(l)):u=o.scale(e),Rv(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),Ae(t,ba,i),n&&Ae(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&&(Ae(i.gfx,ba,""),i.secondaryGfx&&Ae(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&&Ae(t,ba,i),t},hi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Ae(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 FP(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 jP(e){return e.__refs_collection===!0}function HP(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Cv(e,t,n){var i=FP(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 zP(e,t,n){var i=t.inverse,o=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return o},set:function(r){if(r!==o){var a=o;o=null,a&&e.unset(a,i,n),o=r,e.set(o,i,n)}}})}function _i(e,t){if(!(this instanceof _i))return new _i(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}_i.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?Cv(this,t,e):zP(this,t,e)},_i.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return jP(n)||Cv(this,t,e),n},_i.prototype.ensureBound=function(e,t){HP(e,t)||this.bind(e,t)},_i.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},_i.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Uf=new _i({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Mv=new _i({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Av=new _i({name:"attachers",collection:!0},{name:"host"}),Pv=new _i({name:"outgoing",collection:!0},{name:"source"}),Tv=new _i({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)}}),Uf.bind(this,"parent"),Mv.bind(this,"labels"),Pv.bind(this,"outgoing"),Tv.bind(this,"incoming")}function Rs(){xa.call(this),Uf.bind(this,"children"),Av.bind(this,"host"),Av.bind(this,"attachers")}Le(Rs,xa);function kv(){xa.call(this),Uf.bind(this,"children")}Le(kv,Rs);function Ov(){Rs.call(this),Mv.bind(this,"labelTarget")}Le(Ov,Rs);function Dv(){xa.call(this),Pv.bind(this,"source"),Tv.bind(this,"target")}Le(Dv,xa);var GP={connection:Dv,shape:Rs,label:Ov,root:kv};function VP(e,t){var n=GP[e];if(!n)throw new Error("unknown type: <"+e+">");return q(new n,t)}function WP(e){return e instanceof xa}function xo(){this._uid=12}xo.prototype.createRoot=function(e){return this.create("root",e)},xo.prototype.createLabel=function(e){return this.create("label",e)},xo.prototype.createShape=function(e){return this.create("shape",e)},xo.prototype.createConnection=function(e){return this.create("connection",e)},xo.prototype.create=function(e,t){return t=q({},t||{}),t.id||(t.id=e+"_"+this._uid++),VP(e,t)};var gl="__fn",Lv=1e3,UP=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=Lv),!Ue(t))throw new Error("priority must be a number");var o=n;i&&(o=Kn(n,i),o[gl]=n[gl]||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=Lv),!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[gl]=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 Cs;return t.init(e),t},ii.prototype.fire=function(e,t){var n,i,o,r;if(r=UP.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 Cs?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=qP(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[gl]===t)&&(o?o.next=i:this._setListeners(e,i)),o=n,n=i};function Cs(){}Cs.prototype.stopPropagation=function(){this.cancelBubble=!0},Cs.prototype.preventDefault=function(){this.defaultPrevented=!0},Cs.prototype.init=function(e){q(this,e||{})};function qP(e,t){return e.apply(null,t)}function Xo(e){return e.childNodes[0]}function YP(e){return e.parentNode.childNodes[1]}function ml(e,t,n,i,o){var r=vs();r.setTranslate(t,n);var a=vs();a.setRotate(i||0,0,0);var s=vs();s.setScale(1,1),bs(e,[r,a,s])}function kn(e,t,n){var i=vs();i.setTranslate(t,n),bs(e,i)}function Iv(e,t){var n=vs();n.setRotate(t,0,0),bs(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=YP(t),n||(n=$e("g"),lt(n).add("djs-children"),Ke(t.parentNode,n))):n=t,n},gi.prototype._clear=function(e){var t=Xo(e);return al(t),t},gi.prototype._createContainer=function(e,t,n,i){var o=$e("g");lt(o).add("djs-group"),typeof n<"u"?KP(o,t,t.childNodes[n]):Ke(t,o);var r=$e("g");lt(r).add("djs-element"),lt(r).add("djs-"+e),i&<(r).add("djs-frame"),Ke(o,r);var a=$e("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,sv(t))},gi.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)})}})},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),kn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Ae(n,"display","none"):Ae(n,"display","block")}},gi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);nn(t.parentNode)};function KP(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const XP={__depends__:[lP],__init__:["canvas"],canvas:["type",Ye],elementRegistry:["type",hi],elementFactory:["type",xo],eventBus:["type",ii],graphicsFactory:["type",gi]};function ZP(e){var t=new rv(e);return t.init(),t}function QP(e){e=e||{};var t={config:["value",e]},n=[t,XP].concat(e.modules||[]);return ZP(n)}function Zo(e,t){this._injector=t||QP(e),this.get("eventBus").fire("diagram.init")}Zo.prototype.get=function(e,t){return this._injector.get(e,t)},Zo.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Zo.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Zo.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function jn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Xn(e,t){return e.$instanceOf(t)}function JP(e){return Lt(e.rootElements,function(t){return Xn(t,"bpmn:Process")||Xn(t,"bpmn:Collaboration")})}function eT(e){var t={},n=[],i={};function o(Y,X){return function(ce){Y(ce,X)}}function r(Y){t[Y.id]=Y}function a(Y){return t[Y.id]}function s(Y,X){var ce=Y.gfx;if(ce)throw new Error(`already rendered ${jn(Y)}`);return e.element(Y,i[Y.id],X)}function c(Y,X){return e.root(Y,i[Y.id],X)}function l(Y,X){try{var ce=i[Y.id]&&s(Y,X);return r(Y),ce}catch(me){u(me.message,{element:Y,error:me}),console.error(`failed to import ${jn(Y)}`,me)}}function u(Y,X){e.error(Y,X)}var p=this.registerDi=function(X){var ce=X.bpmnElement;ce?i[ce.id]?u(`multiple DI elements defined for ${jn(ce)}`,{element:ce}):i[ce.id]=X:u(`no bpmnElement referenced in ${jn(X)}`,{element:X})};function f(Y){d(Y.plane)}function d(Y){p(Y),z(Y.planeElement,g)}function g(Y){p(Y)}this.handleDefinitions=function(X,ce){var me=X.diagrams;if(ce&&me.indexOf(ce)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ce&&me&&me.length&&(ce=me[0]),!ce)throw new Error("no diagram to display");i={},f(ce);var Ie=ce.plane;if(!Ie)throw new Error(`no plane for ${jn(ce)}`);var $=Ie.bpmnElement;if(!$)if($=JP(X),$)u(`correcting missing bpmnElement on ${jn(Ie)} to ${jn($)}`),Ie.bpmnElement=$,p(Ie);else throw new Error("no process or collaboration to display");var C=c($,Ie);if(Xn($,"bpmn:Process")||Xn($,"bpmn:SubProcess"))m($,C);else if(Xn($,"bpmn:Collaboration"))K($,C),w(X.rootElements,C);else throw new Error(`unsupported bpmnElement for ${jn(Ie)}: ${jn($)}`);h(n)};var h=this.handleDeferred=function(){for(var X;n.length;)X=n.shift(),X()};function m(Y,X){xe(Y,X),T(Y.ioSpecification,X),P(Y.artifacts,X),r(Y)}function w(Y,X){var ce=rt(Y,function(me){return!a(me)&&Xn(me,"bpmn:Process")&&me.laneSets});ce.forEach(o(m,X))}function y(Y,X){l(Y,X)}function v(Y,X){z(Y,o(y,X))}function x(Y,X){l(Y,X)}function E(Y,X){l(Y,X)}function M(Y,X){l(Y,X)}function D(Y,X){l(Y,X)}function P(Y,X){z(Y,function(ce){Xn(ce,"bpmn:Association")?n.push(function(){D(ce,X)}):D(ce,X)})}function T(Y,X){Y&&(z(Y.dataInputs,o(E,X)),z(Y.dataOutputs,o(M,X)))}var N=this.handleSubProcess=function(X,ce){xe(X,ce),P(X.artifacts,ce)};function j(Y,X){var ce=l(Y,X);Xn(Y,"bpmn:SubProcess")&&N(Y,ce||X),Xn(Y,"bpmn:Activity")&&T(Y.ioSpecification,X),n.push(function(){z(Y.dataInputAssociations,o(x,X)),z(Y.dataOutputAssociations,o(x,X))})}function V(Y,X){l(Y,X)}function Q(Y,X){l(Y,X)}function ne(Y,X){n.push(function(){var ce=l(Y,X);Y.childLaneSet&&W(Y.childLaneSet,ce||X),oe(Y)})}function W(Y,X){z(Y.lanes,o(ne,X))}function te(Y,X){z(Y,o(W,X))}function xe(Y,X){Oe(Y.flowElements,X),Y.laneSets&&te(Y.laneSets,X)}function Oe(Y,X){z(Y,function(ce){Xn(ce,"bpmn:SequenceFlow")?n.push(function(){V(ce,X)}):Xn(ce,"bpmn:BoundaryEvent")?n.unshift(function(){j(ce,X)}):Xn(ce,"bpmn:FlowNode")?j(ce,X):Xn(ce,"bpmn:DataObject")||(Xn(ce,"bpmn:DataStoreReference")||Xn(ce,"bpmn:DataObjectReference")?Q(ce,X):u(`unrecognized flowElement ${jn(ce)} in context ${jn(X&&X.businessObject)}`,{element:ce,context:X}))})}function we(Y,X){var ce=l(Y,X),me=Y.processRef;me&&m(me,ce||X)}function K(Y,X){z(Y.participants,o(we,X)),n.push(function(){v(Y.messageFlows,X)}),P(Y.artifacts,X)}function oe(Y){z(Y.flowNodeRef,function(X){var ce=X.get("lanes");ce&&ce.push(Y)})}}function tT(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(h,m){return i.add(h,m)},element:function(h,m,w){return i.add(h,m,w)},error:function(h,m){s.push({message:h,context:m})}},f=new eT(p);u=u||l.diagrams&&l.diagrams[0];var d=nT(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 nT(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!A(n,"bpmn:Process")&&!A(n,"bpmn:Collaboration")&&(i=iT(n));var o;A(i,"bpmn:Collaboration")?o=i:o=Lt(e.rootElements,function(l){if(A(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=Bv(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 Bv(e){var t=[];return z(e,function(n){n&&(t.push(n),t=t.concat(Bv(n.flowElements)))}),t}function iT(e){for(var t=e;t;){if(A(t,"bpmn:Process"))return t;t=t.$parent}}var oT='<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>',Nv=oT,$v={verticalAlign:"middle"},Fv={color:"#404040"},rT={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},aT={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},sT={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"},cT='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Nv+'</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>',eo;function lT(){eo=$t(cT),Vn(eo,rT),Vn(Et("svg",eo),$v),Vn(Et(".backdrop",eo),aT),Vn(Et(".notice",eo),sT),Vn(Et(".link",eo),Fv,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function uT(){eo||(lT(),ni.bind(eo,".backdrop","click",function(e){document.body.removeChild(eo)})),document.body.appendChild(eo)}const yl=5,jv="djs-outline-hidden";function Vt(e){e=q({},fT,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),hT(this._container)}Le(Vt,Zo),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||[]),vl(s,r),s=pT(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 vl(r,[]),r}if(typeof t=="string"&&(i=dT(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw vl(r,[]),r}try{this.clear()}catch(r){throw vl(r,[]),r}const{warnings:o}=await tT(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=Et(":scope > defs",i._svg),a=ov(o),s=r?"<defs>"+ov(r)+"</defs>":"",c=i.getContainer();Rt(c).add(jv);let l;try{l=o.getBBox()}finally{Rt(c).remove(jv)}const u=l.x-yl,p=l.y-yl,f=l.width+yl*2,d=l.height+yl*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
3
|
+
column: `+$+`
|
|
4
|
+
nested error: `+E.message;if(D)return a.addWarning({message:G,error:E}),!0;throw Go(G)}function u(E,C){return l(E,C,!0)}function p(){var E=a.elementsById,C=a.references,D,P;for(D=0;P=C[D];D++){var T=P.element,$=E[P.id],j=go(T).propertiesByName[P.property];if($||a.addWarning({message:"unresolved reference <"+P.id+">",element:P.element,property:P.property,value:P.id}),j.isMany){var G=T.get(j.name),Q=G.indexOf(P);Q===-1&&(Q=G.length),$?G[Q]=$:G.splice(Q,1)}else T.set(j.name,$)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,g=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function m(E){if(d.test(E)){var C=g.exec(E),D=C&&C[1];!D||h.test(D)||a.addWarning({message:"unsupported document encoding <"+D+">, falling back to UTF-8"})}}function w(E,C){var D=c.peek();try{c.push(D.handleNode(E))}catch(P){l(P,C,r)&&c.push(new qp)}}function y(E,C){try{c.peek().handleText(E)}catch(D){u(D,C)}}function v(E,C){E.trim()&&y(E,C)}var x=o.getPackages().reduce(function(E,C){return E[C.uri]=C.prefix,E},Object.entries(Up).reduce(function(E,[C,D]){return E[D]=C,E},o.config&&o.config.nsMap||{}));return s.ns(x).on("openTag",function(E,C,D,P){var T=E.attrs||{},$=Object.keys(T).reduce(function(G,Q){var te=C(T[Q]);return G[Q]=te,G},{}),j={name:E.name,originalName:E.originalName,attributes:$,ns:E.ns};w(j,P)}).on("question",m).on("closeTag",f).on("cdata",y).on("text",function(E,C,D){v(C(E),D)}).on("error",l).on("warn",u),new Promise(function(E,C){var D;try{s.parse(e),p()}catch(G){D=G}var P=i.element;!D&&!P&&(D=Go("failed to parse document as <"+i.type.$descriptor.name+">"));var T=a.warnings,$=a.references,j=a.elementsById;return D?(D.warnings=T,C(D)):E({rootElement:P,elementsById:j,references:$,warnings:T})})},Xp.prototype.handler=function(e){return new Kp(this.model,e)};function sR(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var cR=`<?xml version="1.0" encoding="UTF-8"?>
|
|
5
|
+
`,lR=/<|>|'|"|&|\n\r|\n/g,lm=/<|>|&/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 uR(e){return e.charAt(0).toLowerCase()+e.slice(1)}function pR(e,t){return rm(t)?uR(e):e}function um(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function pm(e){return Jn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function fR(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 dR(e,t){return t.isGeneric?q({localName:t.ns.localName},e):q({localName:pR(t.ns.localName,t.$pkg)},e)}function hR(e,t){return q({localName:t.ns.localName},e)}function gR(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 mR={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},yR={"<":"lt",">":"gt","&":"amp"};function fm(e,t,n){return e=Jn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function vR(e){return fm(e,lR,mR)}function bR(e){return fm(e,lm,yR)}function xR(e){return rt(e,function(t){return t.isAttr})}function wR(e){return rt(e,function(t){return!t.isAttr})}function Zp(e){this.tagName=e}Zp.prototype.build=function(e){return this.element=e,this},Zp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Pr(){}Pr.prototype.serializeValue=Pr.prototype.serializeTo=function(e){e.append(this.escape?bR(this.value):this.value)},Pr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(lm)!==-1&&(this.escape=!0),this};function Qp(e){this.tagName=e}um(Qp,Pr),Qp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Ut(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Ut.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,o,r=t.isGeneric;return r?i=this.parseGenericNsAttributes(e):i=this.parseNsAttributes(e),n?this.ns=this.nsPropertyTagName(n):this.ns=this.nsTagName(t),this.tagName=this.addTagName(this.ns),r?this.parseGenericContainments(e):(o=gR(e),this.parseAttributes(xR(o)),this.parseContainments(wR(o))),this.parseGenericAttributes(e,i),this},Ut.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return dR(t,e)},Ut.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return hR(t,e)},Ut.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Ut.prototype.nsAttributeName=function(e){var t;if(Jn(e)?t=Hn(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:q({localName:t.localName},n)},Ut.prototype.parseGenericNsAttributes=function(e){return Object.entries(e).filter(([t,n])=>!t.startsWith("$")&&this.parseNsAttribute(e,t,n)).map(([t,n])=>({name:t,value:n}))},Ut.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Pr().build({type:"String"},t));var n=e.$children;n&&z(n,i=>{this.body.push(new Ut(this).build(i))})},Ut.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,o=Hn(t),r;if(o.prefix==="xmlns"&&(r={prefix:o.localName,uri:n}),!o.prefix&&o.localName==="xmlns"&&(r={uri:n}),!r)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(r,!0,!0);else{var a=this.logNamespaceUsed(r,!0);this.getNamespaces().logUsed(a)}},Ut.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return z(n,function(o,r){var a=t.parseNsAttribute(e,r,o);a&&i.push(a)}),i},Ut.prototype.parseGenericAttributes=function(e,t){var n=this;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)}})},Ut.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 Pr().build(o,r[0]));else if(Qg(o.type))z(r,function(l){n.push(new Qp(t.addTagName(t.nsPropertyTagName(o))).build(o,l))});else if(a)z(r,function(l){n.push(new Zp(t.addTagName(t.nsPropertyTagName(o))).build(l))});else{var c=sm(o);z(r,function(l){var u;c?c===am?u=new Ut(t,o):u=new Bc(t,o,c):u=new Ut(t),n.push(u.build(l))})}})},Ut.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Yi(i):t=i),t},Ut.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),o=e.uri,r=e.prefix,a=i.byUri(o);return(!a||n)&&i.add(e,t),i.mapPrefix(r,o),e},Ut.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),i=e.prefix,o=e.uri,r,a,s;if(!i&&!o)return{localName:e.localName};if(s=n.defaultUriByPrefix(i),o=o||s||n.uriByPrefix(i),!o)throw new Error("no namespace uri given for prefix <"+i+">");if(e=n.byUri(o),!e&&!i&&(e=this.logNamespace({uri:o},s===o,!0)),!e){for(r=i,a=1;n.uriByPrefix(r);)r=i+"_"+a++;e=this.logNamespace({prefix:r,uri:o},s===o)}return i&&n.mapPrefix(i,o),e},Ut.prototype.parseAttributes=function(e){var t=this,n=this.element;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)})},Ut.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),pm(e)},Ut.prototype.addAttribute=function(e,t){var n=this.attrs;Jn(t)&&(t=vR(t));var i=Wg(n,function(r){return r.name.localName===e.localName&&r.name.uri===e.uri&&r.name.prefix===e.prefix}),o={name:e,value:t};i!==-1?n.splice(i,1,o):n.push(o)},Ut.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=fR(n).concat(t)),z(t,function(i){e.append(" ").append(pm(i.name)).append('="').append(i.value).append('"')})},Ut.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Pr;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 Bc(e,t,n){Ut.call(this,e,t),this.serialization=n}um(Bc,Ut),Bc.prototype.parseNsAttributes=function(e){var t=Ut.prototype.parseNsAttributes.call(this,e).filter(a=>a.name!==this.serialization),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var o=e.$model.getPackage(i.uri),r=o.xml&&o.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+r+n.ns.localName),t},Bc.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function _R(){this.value="",this.write=function(e){this.value+=e}}function ER(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 SR(e){e=q({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new _R,r=new ER(o,e.format);e.preamble&&r.append(cR);var a=new Ut,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(RR(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function RR(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Up)n[i]=Up[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 Nc(e,t){bi.call(this,e,t)}Nc.prototype=Object.create(bi.prototype),Nc.prototype.fromXML=function(e,t,n){Jn(t)||(n=t,t="bpmn:Definitions");var i=new Xp(q({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},Nc.prototype.toXML=function(e,t){var n=new SR(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",MR="http://www.omg.org/spec/BPMN/20100524/MODEL",AR="bpmn",PR=[],TR=[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",isMany:!0,replaces:"FlowElementsContainer#laneSets",type:"LaneSet"},{name:"flowElements",isMany:!0,replaces:"FlowElementsContainer#flowElements",type:"FlowElement"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean",default:!0},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}},{name:"assignment",type:"Assignment",isMany:!0}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",isBody:!0,type:"String"}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}],superClass:["BaseElement"]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["Collaboration","FlowElementsContainer"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isMany:!0,isVirtual:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Integer",isAttr:!0}]},{name:"CallActivity",superClass:["Activity","InteractionNode"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}],superClass:["BaseElement"]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],kR=[{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"}]}],OR={tagAlias:"lowerCase",typePrefix:"t"},DR={name:CR,uri:MR,prefix:AR,associations:PR,types:TR,enumerations:kR,xml:OR},LR="BPMNDI",IR="http://www.omg.org/spec/BPMN/20100524/DI",BR="bpmndi",NR=[{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"]}],$R=[{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"}]}],FR=[],jR={name:LR,uri:IR,prefix:BR,types:NR,enumerations:$R,associations:FR},HR="DC",zR="http://www.omg.org/spec/DD/20100524/DC",GR="dc",VR=[{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}]}],WR=[],UR={name:HR,uri:zR,prefix:GR,types:VR,associations:WR},qR="DI",YR="http://www.omg.org/spec/DD/20100524/DI",KR="di",XR=[{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"}]}],ZR=[],QR={tagAlias:"lowerCase"},JR={name:qR,uri:YR,prefix:KR,types:XR,associations:ZR,xml:QR},eC="bpmn.io colors for BPMN",tC="http://bpmn.io/schema/bpmn/biocolor/1.0",nC="bioc",iC=[{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"}]}],oC=[],rC=[],aC={name:eC,uri:tC,prefix:nC,types:iC,enumerations:oC,associations:rC},sC="BPMN in Color",cC="http://www.omg.org/spec/BPMN/non-normative/color/1.0",lC="color",uC=[{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"}]}],pC=[],fC=[],dC={name:sC,uri:cC,prefix:lC,types:uC,enumerations:pC,associations:fC};const hC={bpmn:DR,bpmndi:jR,dc:UR,di:JR,bioc:aC,color:dC};function dm(e,t){const n=q({},hC,e);return new Nc(n,t)}const gC={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"}},$c={[qg]:gC,[Mp]:zg};function hm(){return dm($c)}const gm=hm();async function pa(e){const{rootElement:t,warnings:n}=await gm.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function mC(e){const{xml:t}=await gm.toXML(e,{format:!0});return t}function Jp(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const fa={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},yC=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function vC(e){const t=fa;return yC.test(e)?t.cjkEm:e===" "?t.spaceEm:e>="0"&&e<="9"?t.digitEm:e>="A"&&e<="Z"?t.upperEm:e>="a"&&e<="z"?t.lowerEm:t.otherEm}function da(e,t){let n=0;for(const i of e)n+=t*vC(i);return n}function mm(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&bC(e),xC(e),wC(e),_C(e)}function bC(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(o){var a;const r=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:da(o,r),fontBoundingBoxAscent:r*fa.ascentEm,fontBoundingBoxDescent:r*fa.descentEm,actualBoundingBoxAscent:r*fa.ascentEm,actualBoundingBoxDescent:r*fa.descentEm}}};t.getContext=()=>n}function xC(e){if(e.SVGMatrix)return;class t{constructor(){Fn(this,"a",1);Fn(this,"b",0);Fn(this,"c",0);Fn(this,"d",1);Fn(this,"e",0);Fn(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 wC(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 _C(e){const t=e.SVGElement.prototype;if(!t.getCTM){const n=()=>new e.SVGMatrix;t.getCTM=n,t.getScreenCTM=n}t.getBBox||(t.getBBox=function(){const n=String(this.textContent??"");return{x:0,y:0,width:da(n,12),height:14}})}const Fc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),EC=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),SC=1,jc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),RC=2;function lt(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"label-over-shape":return`ls|${e.edge}|${e.shape}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"edge-endpoint-detached":return`d|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"edge-along-group-boundary":return`eg|${e.edge}|${e.group}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const ym=20,Hc=5,vm=3,CC=8,ha=15,ef=50,bm=12,MC=bm*1.2;function tf(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>da(r,bm))),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 xm=1;function rn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],o=e.waypoints[n+1];Math.abs(i.y-o.y)<.5&&Math.abs(i.x-o.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,o.x),hi:Math.max(i.x,o.x),dir:o.x>i.x?1:-1}):Math.abs(i.x-o.x)<.5&&Math.abs(i.y-o.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,o.y),hi:Math.max(i.y,o.y),dir:o.y>i.y?1:-1})}return t}function Tr(e,t){let n=null;const i=e.type!==t.type,r=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of rn(e))for(const s of rn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>xm)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>=ym&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function nf(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function wm(e,t){const n=Tr(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function AC(e,t){let n=0;for(const i of t)i.id!==e.id&&wm(e,i)&&n++;return n}function di(e,t){let n=0;for(const i of t)i.id!==e.id&&Tr(e,i)&&n++;return n}const _m=15,Em=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]-Em||t.at>n[1]+Em)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 of=20;function zc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>xm)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<ym||n.push([o-of,r+of])}return n}function Gc(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of rn(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 zc(o,rn(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const TC=10,kC=1,OC=(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 DC(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 rf(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 LC=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ga=1;function Ni(e,t){const n=e.x+ga,i=e.x+e.width-ga,o=e.y+ga,r=e.y+e.height-ga;return t.axis==="h"?t.at>o&&t.at<r&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<r&&t.hi>o}function ma(e){return[{axis:"h",at:e.y,lo:e.x,hi:e.x+e.width,dir:1},{axis:"h",at:e.y+e.height,lo:e.x,hi:e.x+e.width,dir:1},{axis:"v",at:e.x,lo:e.y,hi:e.y+e.height,dir:1},{axis:"v",at:e.x+e.width,lo:e.y,hi:e.y+e.height,dir:1}]}function Sm(e,t){const n=e.label;if(!n)return null;if(rn(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(rn(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(ma(i).some(o=>Ni(n,o)))return i.id;return null}function Gt(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(DC(e.waypoints[r],e.waypoints[r+1],o,RC)){i.push(o);break}}return i}const us=(e,t,n)=>{const i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,a=r===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*o))},IC=(e,t,n,i)=>Cm(e,t,n,i)?0:Math.min(us(e,n,i),us(t,n,i),us(n,e,t),us(i,e,t)),Rm=(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 ya(e,t,n){const{x:i,y:o,width:r,height:a}=n;if(/Event$/.test(n.type)){const l=Math.min(r,a)/2;return Math.max(0,us({x:i+r/2,y:o+a/2},e,t)-l)}const s=/Gateway$/.test(n.type)?[{x:i+r/2,y:o},{x:i+r,y:o+a/2},{x:i+r/2,y:o+a},{x:i,y:o+a/2}]:[{x:i,y:o},{x:i+r,y:o},{x:i+r,y:o+a},{x:i,y:o+a}];if(Rm(e,s)||Rm(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,IC(e,t,s[l],s[(l+1)%s.length]));return c}function Cm(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 af=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Mm(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(Cm(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function ps(e,t){let n=0;for(const i of t)i.id===e.id||af(e,i)||Mm(e,i)&&n++;return n}function hi(e,t){let n=0;for(const i of t)i.id===e.id||af(e,i)||ps(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Am(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)ps(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function mo(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(ps(n[i],[n[o]])>0){const r=n[i].id,a=n[o].id;t.push(r<a?[r,a]:[a,r])}return t.sort((i,o)=>`${i[0]}|${i[1]}`.localeCompare(`${o[0]}|${o[1]}`))}function $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(af(n[i],n[o])&&Mm(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 Pm(e){const t=mo(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let o=0,r=0;for(const[a,s]of t){const c=i.get(a),l=i.get(s);if(!c||!l)continue;const u=n(c.type),p=n(l.type);u==="solid"&&p==="solid"?o++:u==="dashed"&&p==="dashed"&&r++}return{pairs:t,solidPairs:o,dashedPairs:r,mixedPairs:t.length-o-r,crossPoolMessages:BC(e)}}function BC(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 Tm(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!jc.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 km(e){var n;const t=(n=Vt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const o=Vt(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 Om=e=>e?{members:e}:{},zn=e=>e.shapes.filter(t=>!t.container);function NC(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 $C(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 Dm(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(rn(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(ma(i).some(o=>Ni(n,o)))return i.id;return null}function Vo(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 Lm=3;function Im(e,t){const n=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),i=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);if(n<=0||i<=0)return 0;const o=/Event$/.test(t.type);if(!o&&!/Gateway$/.test(t.type))return Math.min(n,i);const r=t.x+t.width/2,a=t.y+t.height/2,s=Math.min(Math.max(r,e.x),e.x+e.width),c=Math.min(Math.max(a,e.y),e.y+e.height);if(o)return Math.max(0,t.width/2-Math.hypot(s-r,c-a));const l=t.width/2,u=t.height/2;return Math.max(0,(1-(Math.abs(s-r)/l+Math.abs(c-a)/u))*Math.min(l,u))}function fs(e,t){const n=[];for(const i of t.shapes){if(i.container||jc.has(i.type))continue;const o=Im(e,i);o>=Lm&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function sf(e){const t=[],n=e.filter(o=>o.type==="bpmn:Participant"),i=(o,r)=>o.x<=r.x&&o.y<=r.y&&o.x+o.width>=r.x+r.width&&o.y+o.height>=r.y+r.height;for(let o=0;o<n.length;o++)for(let r=o+1;r<n.length;r++){const a=n[o],s=n[r];a.x+a.width<=s.x||s.x+s.width<=a.x||a.y+a.height<=s.y||s.y+s.height<=a.y||t.push({pools:[a.id,s.id],contained:i(a,s)||i(s,a)})}return t}function ft(e,t={}){const n=[],i=e.shapes.filter(y=>!y.container);for(const y of e.edges)for(const v of Gt(y,i))n.push({kind:"edge-crosses-shape",edge:y.id,shape:v.id});const o=e.shapes.filter(y=>y.container&&EC.has(y.type));if(o.length){const y=(v,x)=>{const E=e.shapes.find(C=>C.id===x);return!!E&&E.x>=v.x&&E.y>=v.y&&E.x+E.width<=v.x+v.width&&E.y+E.height<=v.y+v.height};for(const v of e.edges)for(const x of Gt(v,o))v.endpoints.includes(x.id)||v.endpoints.some(E=>y(x,E))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:x.id})}for(const y of e.edges){if(y.waypoints.length<2)continue;const v=[[y.source,y.waypoints[0]],[y.target,y.waypoints[y.waypoints.length-1]]];for(const[x,E]of v){if(!x)continue;const C=e.shapes.find($=>$.id===x);if(!C||C.container)continue;const D=Math.max(C.x-E.x,E.x-(C.x+C.width),0),P=Math.max(C.y-E.y,E.y-(C.y+C.height),0),T=Math.hypot(D,P);T>TC&&n.push({kind:"edge-endpoint-detached",edge:y.id,shape:x,distance:Math.round(T)})}}for(const y of sf(e.shapes))n.push({kind:"pool-overlap",...y});const r=i.filter(y=>!y.attached);for(let y=0;y<r.length;y++)for(let v=y+1;v<r.length;v++){const x=r[y],E=r[v];if(!rf(x,E,SC))continue;const C=x.id<E.id?[x.id,E.id]:[E.id,x.id];n.push({kind:"shape-overlap",shapes:C,identical:LC(x,E)})}const a=e.shapes.filter(y=>y.type==="bpmn:Group"&&Array.isArray(y.members)&&y.members.length>0);for(let y=0;y<a.length;y++)for(let v=y+1;v<a.length;v++){const x=a[y],E=a[v],C=Math.min(x.x+x.width,E.x+E.width)-Math.max(x.x,E.x),D=Math.min(x.y+x.height,E.y+E.height)-Math.max(x.y,E.y);if(C<=Hc||D<=Hc)continue;const P=x.id<E.id?[x.id,E.id]:[E.id,x.id],T=new Set(E.members);if(x.members.some(j=>T.has(j))){const j=Tm(e,a,{x:Math.max(x.x,E.x),y:Math.max(x.y,E.y),right:Math.min(x.x+x.width,E.x+E.width),bottom:Math.min(x.y+x.height,E.y+E.height)});j.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:P,shapes:j});continue}const $=x.x<=E.x&&x.y<=E.y&&x.x+x.width>=E.x+E.width&&x.y+x.height>=E.y+E.height?x.id:E.x<=x.x&&E.y<=x.y&&E.x+E.width>=x.x+x.width&&E.y+E.height>=x.y+x.height?E.id:void 0;n.push({kind:"group-overlap-unintended",groups:P,...$?{container:$}:{}})}const s=new Set(a.flatMap(y=>[...y.members])),c=y=>e.shapes.filter(v=>!v.container&&!jc.has(v.type)&&v.x>=y.x&&v.y>=y.y&&v.x+v.width<=y.x+y.width&&v.y+v.height<=y.y+y.height);for(const y of a){const v=c(y);if(!v.length)continue;const x=new Set(y.members),E=v.filter(C=>!x.has(C.id));E.some(C=>s.has(C.id))&&(E.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:y.id,shapes:E.map(C=>C.id).sort()}))}for(const y of a){const v=new Set(c(y).map(T=>T.id)),x=new Set(y.members),E=new Set([...v].filter(T=>!x.has(T)&&s.has(T)));if(!E.size)continue;let C=!1,D=!1,P=!1;for(const T of e.edges){if(T.type!=="bpmn:SequenceFlow"||!T.source||!T.target)continue;const $=E.has(T.source),j=E.has(T.target);!$&&j&&!v.has(T.source)?C=!0:$&&!j&&!v.has(T.target)?D=!0:$&&j&&(P=!0)}C&&D&&P&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:y.id,shapes:[...E].sort()})}const l=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<l.length;y++)for(let v=y+1;v<l.length;v++)for(let x=v+1;x<l.length;x++){const E=[l[y],l[v],l[x]],C={x:Math.max(...E.map(T=>T.x)),y:Math.max(...E.map(T=>T.y)),right:Math.min(...E.map(T=>T.x+T.width)),bottom:Math.min(...E.map(T=>T.y+T.height))};if(C.right-C.x<=Hc||C.bottom-C.y<=Hc)continue;const D=Tm(e,[],C);if(!D.length)continue;const P=E.map(T=>T.id).sort();n.push({kind:"group-stack-unreadable",groups:P,shapes:D})}for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||jc.has(v.type)||v.width<=0||v.height<=0)continue;const x=[["top",y.y,"h",y.x,y.x+y.width],["bottom",y.y+y.height,"h",y.x,y.x+y.width],["left",y.x,"v",y.y,y.y+y.height],["right",y.x+y.width,"v",y.y,y.y+y.height]];for(const[E,C,D,P,T]of x){const $=D==="h"?v.x:v.y,j=D==="h"?v.x+v.width:v.y+v.height;if(!($<T&&P<j))continue;const G=D==="h"?v.y:v.x,Q=D==="h"?v.y+v.height:v.x+v.width;if(!(G<C&&C<Q))continue;const te=Math.min(C-G,Q-C);te<CC||n.push({kind:"group-cuts-shape",group:y.id,shape:v.id,side:E,depth:te})}}const u=t.includeObservationOnly?e.shapes.filter(y=>y.type==="bpmn:Group"&&y.width>0&&y.height>0):[];if(u.length){const y=new Map(e.shapes.filter(v=>!v.container).map(v=>[v.id,{x:v.x+v.width/2,y:v.y+v.height/2}]));for(const v of e.edges){if(v.type!=="bpmn:SequenceFlow"&&v.type!=="bpmn:MessageFlow")continue;const x=rn(v);if(x.length)for(const E of u){const C=E.x+E.width,D=E.y+E.height,P=v.endpoints.some($=>{const j=y.get($);return!!j&&E.x<j.x&&j.x<C&&E.y<j.y&&j.y<D});let T=null;for(const $ of x){const[j,G,Q]=$.axis==="v"?[E.y,D,[["left",E.x],["right",C]]]:[E.x,C,[["top",E.y],["bottom",D]]],te=Math.min($.hi,G)-Math.max($.lo,j);if(te<ef)continue;const V=$.axis==="v"?E.x<$.at&&$.at<C:E.y<$.at&&$.at<D;if(!(V&&P))for(const[ee,Ee]of Q){const Pe=Math.abs($.at-Ee);Pe<=ha&&(!T||Pe<T.distance)&&(T={side:ee,inside:V,distance:Pe,length:te})}}T&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:E.id,side:T.side,inside:T.inside,distance:Math.round(T.distance),length:Math.round(T.length)})}}}const p=e.shapes.filter(y=>y.container&&y.type!=="bpmn:Group"&&y.type!=="bpmn:Lane");for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of p){const x=y.x<v.x+v.width&&v.x<y.x+y.width,E=y.y<v.y+v.height&&v.y<y.y+y.height,C=[["top",y.y,v.y,x],["bottom",y.y+y.height,v.y+v.height,x],["left",y.x,v.x,E],["right",y.x+y.width,v.x+v.width,E]];for(const[D,P,T,$]of C)$&&Math.abs(P-T)<=vm&&n.push({kind:"group-on-container-boundary",group:y.id,container:v.id,side:D})}const f=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<f.length;y++)for(let v=y+1;v<f.length;v++){const x=f[y],E=f[v],C=x.x<E.x+E.width&&E.x<x.x+x.width,D=x.y<E.y+E.height&&E.y<x.y+x.height,P=[["x",x.x+x.width,E.x,D],["x",E.x+E.width,x.x,D],["y",x.y+x.height,E.y,C],["y",E.y+E.height,x.y,C]];for(const[T,$,j,G]of P)if(G&&Math.abs($-j)<=vm){n.push({kind:"group-on-group-boundary",groups:x.id<E.id?[x.id,E.id]:[E.id,x.id],axis:T});break}}for(let y=0;y<e.edges.length;y++)for(let v=y+1;v<e.edges.length;v++){const x=e.edges[y],E=e.edges[v],C=Tr(x,E);if(!C)continue;const D=x.id<E.id?[x.id,E.id]:[E.id,x.id];n.push({kind:C.kind==="opposite"?"edge-overlap-opposite":C.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:D,axis:C.axis,length:Math.round(C.length)})}for(const y of e.edges){if(!y.label)continue;const v=Gc(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=Sm(y,e);v&&n.push({kind:"label-over-line",edge:y.id,line:v})}if(t.includeObservationOnly){for(const y of e.edges)if(!(!y.label||y.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:x}of fs(y.label,e))n.push({kind:"label-over-shape",edge:y.id,shape:v,depth:Math.round(x)})}const d=new Set(i.map(y=>y.id)),g=e.shapes.filter(y=>y.type==="bpmn:Participant"&&y.label);for(const y of[...i,...g.filter(v=>!d.has(v.id))]){if(!y.label)continue;const v=Dm(y,e);v&&n.push({kind:"label-over-line",edge:y.id,line:v})}const h=new Set(e.shapes.filter(y=>y.type==="bpmn:TextAnnotation").map(y=>y.id));for(const y of g)for(const{owner:v,rect:x}of Vo(e))v===y.id||h.has(v)||rf(y.label,x,ga)&&n.push({kind:"pool-name-over-label",pool:y.id,label:v});const m=Vo(e);for(const y of i)if(y.type==="bpmn:TextAnnotation")for(const{owner:v,rect:x}of m)v!==y.id&&rf(y,x,ga)&&n.push({kind:"annotation-over-label",annotation:y.id,label:v});const w=new Map(e.shapes.map(y=>[y.id,y]));for(const y of i){const v=y.parent??NC(y,e,w);if(!v)continue;const x=w.get(v);!x||!x.container||OC(x,y,kC)||y.type==="bpmn:TextAnnotation"&&!$C(y,x,e)||n.push({kind:"shape-outside-container",shape:y.id,container:x.id})}return n.sort((y,v)=>lt(y).localeCompare(lt(v)))}const Vt=e=>typeof e=="object"&&e!==null?e:void 0,en=e=>typeof e=="number"?e:0,yo=e=>{const t=Vt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function FC(e){const t=Vt(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const o=t[i];for(const r of Array.isArray(o)?o:[o]){const a=yo(r);a&&n.push(a)}}return n}function jC(e){const t=Vt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:yo(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:yo(t.targetRef);return n&&i?{source:n,target:i}:{}}function HC(e,t){const n=Vt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=yo(n);return o?t.get(o):void 0}if(Fc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return yo(n)}function Bm(e){var a,s,c,l,u;const t=[],n=[],i=((a=Vt(e))==null?void 0:a.diagrams)??[],o=new Map,r=new Set;for(const p of((s=Vt(e))==null?void 0:s.rootElements)??[]){const f=Vt(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=Vt(d),h=yo(g),m=yo(g==null?void 0:g.processRef);h&&m?o.set(m,h):h&&r.add(h)}}for(const p of i){const f=Vt((c=Vt(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=Vt(g);if(!h)continue;const m=Vt(h.bpmnElement),w=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!w)continue;const y=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",v=Vt(h.bounds);if(v){const E=h.isExpanded===!1&&y!=="bpmn:Participant",C=Vt((l=Vt(h.label))==null?void 0:l.bounds),D={id:w,type:y,x:en(v.x),y:en(v.y),width:en(v.width),height:en(v.height),container:Fc.has(y)&&!E,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:HC(m,o)}:{},...C?{label:{x:en(C.x),y:en(C.y),width:en(C.width),height:en(C.height)}}:{},...y==="bpmn:Group"?Om(km(m)):{}},P=h.isHorizontal!==!1,T=typeof(m==null?void 0:m.name)=="string"?m.name:"";r.has(w)&&P&&T&&(D.label=tf(D,T)),t.push(D);continue}const x=h.waypoint;if(Array.isArray(x)){const E=Vt((u=Vt(h.label))==null?void 0:u.bounds);n.push({id:w,type:y,waypoints:x.map(C=>{var D,P;return{x:en((D=Vt(C))==null?void 0:D.x),y:en((P=Vt(C))==null?void 0:P.y)}}),endpoints:FC(m),...jC(m),...E?{label:{x:en(E.x),y:en(E.y),width:en(E.width),height:en(E.height)}}:{}})}}}return{shapes:t,edges:n}}function Nm(e){return ft(Bm(e),{includeObservationOnly:!0})}async function zC(e){const{definitions:t,warnings:n}=await pa(e);return{findings:Nm(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=Vt(r.label),m=yo(r.source),w=yo(r.target);n.push({id:r.id,type:a,waypoints:s.map(y=>({x:en(y.x),y:en(y.y)})),endpoints:[m,w].filter(y=>!!y),...m&&w?{source:m,target:w}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:en(h.y),width:en(h.width),height:en(h.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=Vt(r.businessObject),l=Vt(r.label);let u=Vt(r.parent);for(;u&&u.type==="bpmn:Lane";)u=Vt(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&Fc.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:r.id,type:a,x:r.x,y:r.y,width:en(r.width),height:en(r.height),container:Fc.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:en(l.y),width:en(l.width),height:en(l.height)}}:{},...a==="bpmn:Group"?Om(km(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=Vt(r.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=tf(d,g)),t.push(d)}return{shapes:t,edges:n}}const GC={"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 VC(e,t){const n=GC[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function $m(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Fm(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 VC(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&$m(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?$m(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 Cp(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:jo(i.businessObject).map(o=>o.locale)}}}const cf=20,WC=4,We=(e,t)=>Math.abs(e-t)<.5;function Vc(e,t,n,i=cf){if(We(e.y,t.y)&&!We(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(We(e.x,t.x)&&!We(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 jm(e,t,n,i=cf){if(n.length<2)return null;if(We(e.y,t.y)&&!We(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(We(e.x,t.x)&&!We(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 Hm(e,t,n=cf){if(e.length!==4)return null;const[i,o,r,a]=e;if(We(i.y,o.y)&&We(o.x,r.x)&&We(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(We(i.x,o.x)&&We(o.y,r.y)&&We(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 Wc(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 Uc=30,UC=[0,-25,25,-40,40];function qC(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+Uc:s-Uc,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return UC.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}]).filter(f=>Gt({...e,endpoints:[],waypoints:f},[n]).length===0)}const lf=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],va=(e,t,n)=>Gt({...e,waypoints:t},n).length;function qc(e,t,n,i){let o=[...e.waypoints],r=va(e,o,t);if(r===0)return null;let a=!1;for(const p of Wc(e,t))if(va(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(rn),c=p=>rn({...e,waypoints:p}).some(f=>zc(f,s).length>0),l=qC(e,t).filter(p=>va(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&&We(p.y+p.height/2,f.y+f.height/2)){const d=[o[0],o[o.length-1]];if(We(d[0].y,d[1].y)&&!We(d[0].x,d[1].x)){const g=t.filter(y=>!e.endpoints.includes(y.id)&&Gt({...e,waypoints:d},[y]).length>0),h=g.length>=2?jm(d[0],d[1],g):null,w=(h?h.map(y=>[d[0],...y,d[1]]):g.length===1?(Vc(d[0],d[1],g[0])??[]).map(y=>[d[0],...y,d[1]]):g.length===0?[d]:[]).filter(y=>va(e,y,t)===0&&y.length<=o.length).sort((y,v)=>Number(u(v))-Number(u(y)));if(w.length)return w.find(y=>!c(y))??w[0]}}}for(let p=0;p+1<o.length;p++){const f=o[p],d=o[p+1],g=t.filter(w=>!e.endpoints.includes(w.id)&&Gt({...e,waypoints:[f,d]},[w]).length>0);if(g.length<2)continue;const h=jm(f,d,g);if(!h)continue;const m=h.map(w=>lf(o,p,w)).filter(w=>va(e,w,t)===0).sort((w,y)=>Number(u(y))-Number(u(w)));if(m.length)return m.find(w=>!c(w))??m[0]}for(let p=0;p<WC&&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)||Gt({...e,waypoints:[g,h]},[m]).length===0)continue;const w=Vc(g,h,m),y=w?w.map(x=>lf(o,d,x)):Hm(o,m)??[];if(!y.length)continue;const v=[...y].sort((x,E)=>Number(u(E))-Number(u(x)));for(const x of v){const E=va(e,x,t);if(E<r){o=x,r=E,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&r===0?o:null}function uf(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=zn(r),s=new Set,c=ft(r).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(lt(u)));if(!c.length)return s;const l=new Map;for(const u of c){if(u.kind!=="edge-crosses-shape"||l.has(u.edge))continue;const p=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=Gt(p,a);if(!n&&h.length&&h.every(x=>x.type==="bpmn:TextAnnotation")){s.add(u);continue}const m=qc(p,a,g,r.edges);if(!m){h.some(x=>x.type==="bpmn:TextAnnotation")&&s.add(u);continue}const w=r.edges.filter(x=>x.id!==u),y=di(p,w);di({...p,waypoints:m},w)>y||o.updateWaypoints(f,m)}return s}const YC=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 Yc(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 pf=(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),ff=(e,t)=>ps(e,[t])>0;function zm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=zn(r);let s=r;const c=new Set(ft(r).map(lt));for(const[l,u]of mo(r))if(!t.has(`${l}|${u}`))for(const[p,f]of[[l,u],[u,l]]){if(n.has(p))continue;const d=s.edges.find(D=>D.id===p),g=s.edges.find(D=>D.id===f);if(!d||!g)continue;const h=i.get(p);if(!h)continue;const m=Yc(h),w=YC(g),y=[...Wc(d,a)??[]],v=qc(d,[...a,...w],m,r.edges);v&&y.push(v);for(let D=0;D+1<d.waypoints.length;D++)for(const P of w)for(const T of Vc(d.waypoints[D],d.waypoints[D+1],P)??[])y.push(lf(d.waypoints,D,T));const x=s.edges.filter(D=>D.id!==p),E=D=>({...s,edges:s.edges.map(P=>P.id===p?{...P,waypoints:D}:P)}),C=y.find(D=>{const P={...d,waypoints:D};return ff(P,g)||!pf(D,m)||x.some(T=>T.id!==f&&!ff(d,T)&&ff(P,T))?!1:ft(E(D)).every(T=>c.has(lt(T)))});if(C){o.updateWaypoints(h,C),s=E(C);break}}}const KC=["top","bottom","left","right"],Gm={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},ds=20,XC=20;function ZC(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&&We(e.y,t.y)&&o.push("top"),n&&We(e.y,t.y+t.height)&&o.push("bottom"),i&&We(e.x,t.x)&&o.push("left"),i&&We(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const QC=(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 Vm(e,t,n,i){const o=Gm[t],r=Gm[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(We(e[f],n[f]))return d===-g&&d*(n[p]-e[p])>=ds?[e,n]:null;let h;if(d===-g){const w=e[p]+d*ds,y=n[p]-d*ds;if(d*(y-w)<0)return null;h=Math.round((e[p]+n[p])/2)}else h=d>0?Math.max(e[p],n[p])+Uc:Math.min(e[p],n[p])-Uc;const m=(w,y)=>a?{x:y,y:w}:{x:w,y};return[e,m(h,e[f]),m(h,n[f]),n]}const c=a?{x:e.x,y:n.y}:{x:n.x,y:e.y},l=a?o.y*(c.y-e.y):o.x*(c.x-e.x),u=s?r.y*(c.y-n.y):r.x*(c.x-n.x);return l>=ds&&u>=ds?[e,c,n]:null}function JC(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?ZC(a,r):null;if(!s)return[];const c=[];for(const l of KC){const u=QC(t,l),p=o?Vm(u,l,a,s):Vm(a,s,u,l);p&&c.push(p)}return c}const Wm=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 eM(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(ft(r).map(lt));let c=r;for(const[l,u]of $i(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(T=>T.id===l),f=c.edges.find(T=>T.id===u);if(!p||!f||p.type!=="bpmn:SequenceFlow"||f.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!$i({edges:[p,f]}).length)continue;const d=p.endpoints.find(T=>f.endpoints.includes(T)),g=d?a.get(d):void 0;if(!g||g.container)continue;const h=i.get(l),m=i.get(u);if(!h||!m)continue;const w=T=>n.has(T.id)?[T.waypoints]:[T.waypoints,...JC(T,g,a)],y=T=>T.length-2,v=w(p).flatMap(T=>w(f).map($=>({pa:T,pb:$}))).filter(({pa:T,pb:$})=>T!==p.waypoints||$!==f.waypoints).map(T=>({...T,cost:Wm(T.pa)+Wm(T.pb)+XC*(y(T.pa)+y(T.pb))})).sort((T,$)=>T.cost-$.cost),x=Yc(h),E=Yc(m),C=$i(c).length,D=new Set(mo(c).map(([T,$])=>`${T}|${$}`)),P=v.find(({pa:T,pb:$})=>{const j={...p,waypoints:T},G={...f,waypoints:$};if($i({edges:[j,G]}).length||Tr(j,G)||!pf(T,x)||!pf($,E))return!1;const Q={...c,edges:c.edges.map(te=>te.id===l?j:te.id===u?G:te)};return $i(Q).length>=C||mo(Q).some(([te,V])=>!D.has(`${te}|${V}`))?!1:ft(Q).every(te=>s.has(lt(te)))});P&&(P.pa!==p.waypoints&&o.updateWaypoints(h,P.pa),P.pb!==f.waypoints&&o.updateWaypoints(m,P.pb),c={...c,edges:c.edges.map(T=>T.id===l?{...p,waypoints:P.pa}:T.id===u?{...f,waypoints:P.pb}:T)})}}const tM=40,nM=20;function iM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>{const u=Ge(i),p=$i(u);return{keys:new Set(ft(u).map(lt)),crossings:mo(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(Gt({...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 g=d.x+d.width/2;if(g>=f.x+10&&g<=f.x+f.width-10)continue;const h=g>f.x+f.width,m=f.y>d.y,w=m?d.y+d.height:d.y,y=m?f.y:f.y+f.height,v=Math.round((w+y)/2),x=$=>f===u?[...$].reverse():$,E=(l.waypoints??[]).map($=>({x:$.x,y:$.y})),C=r(l.id),D=a(l.id,E)??new Set,P=h?f.x+f.width:f.x,T=f.x+f.width/2;for(let $=Math.min(tM,f.width/4);h?P-$>T:P+$<T;$+=nM){const j=Math.round(h?P-$:P+$),G=x([{x:g,y:w},{x:g,y:v},{x:j,y:v},{x:j,y}]),Q=a(l.id,G);if(!Q||[...Q].some(V=>!D.has(V)))continue;o.updateWaypoints(l,G);const te=r(l.id);if(te.crossings<=C.crossings&&te.shared<=C.shared&&te.mine<=C.mine&&[...te.keys].every(V=>C.keys.has(V)))break;o.updateWaypoints(l,E)}}}const oM=10;function Um(e,t){if(e.parent){const o=t.find(r=>r.id===e.parent);if(o)return o}const n=e.x+e.width/2,i=e.y+e.height/2;return t.find(o=>n>=o.x&&n<=o.x+o.width&&i>=o.y&&i<=o.y+o.height)}function qm(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(G=>G.type==="bpmn:Participant"&&G.container),i=t.shapes.find(G=>G.id===e.endpoints[0]),o=t.shapes.find(G=>G.id===e.endpoints[1]);if(!i||!o)return null;const r=Um(i,n),a=Um(o,n);if(!r||!a||r.id===a.id)return null;const s=a.y>r.y,c=s?r:a,l=s?a:r,u=n.filter(G=>G.id!==r.id&&G.id!==a.id&&G.y>=c.y+c.height&&G.y+G.height<=l.y).sort((G,Q)=>G.y-Q.y);if(!u.length)return null;const p=u[0],f=u[u.length-1],d=(c.y+c.height+p.y)/2,g=(f.y+f.height+l.y)/2,h=s?d:g,m=s?g:d,w=e.waypoints[0],y=e.waypoints[e.waypoints.length-1],v=zn(t),x=t.edges.filter(G=>G.id!==e.id),E=hi(e,x),C=Gt(e,v).length;if(E===0&&C===0||C===0&&e.waypoints.length===2)return null;const D=Math.min(...u.map(G=>G.x)),P=Math.max(...u.map(G=>G.x+G.width)),T=(w.x+y.x)/2,$=G=>G.filter((Q,te)=>te===0||!(We(Q.x,G[te-1].x)&&We(Q.y,G[te-1].y)));let j;for(let G=D;G<=P;G+=oM){const Q=$([w,{x:w.x,y:h},{x:G,y:h},{x:G,y:m},{x:y.x,y:m},y]),te={...e,waypoints:Q};if(Gt(te,v).length>0)continue;const V=hi(te,x),ee=Math.abs(G-T);(!j||V<j.cross||V===j.cross&&ee<j.detour)&&(j={pts:Q,cross:V,detour:ee})}return j&&(C>0?j.cross<=E:j.cross<E)?j.pts:null}const rM=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function aM(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(!rM.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||!We(d.width,h.width)||!We(d.height,h.height)||!We(g.width,m.width)||!We(g.height,m.height))continue;const w=h.x-d.x,y=h.y-d.y;if(We(w,0)&&We(y,0)||!We(m.x-g.x,w)||!We(m.y-g.y,y))continue;const v=p.waypoints.map(C=>({x:C.x+w,y:C.y+y})),x=f.waypoints.map(C=>({x:C.x,y:C.y}));x.length===v.length&&x.every((C,D)=>We(C.x,v[D].x)&&We(C.y,v[D].y))||x.length===2&&(We(x[0].x,x[1].x)||We(x[0].y,x[1].y))&&Gt({...p,waypoints:x},c).length===0||Gt({...p,waypoints:v},c).length>0||o.updateWaypoints(f,v)}}function Ym(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=qm(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const df=20,Km=10,Fi=10,hf=40,sM=6,cM=40,Xm=50;function lM(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<=sM})}function gf(e,t,n){let i=0;for(let o=1;o<e.length;o++){const r=e[o-1],a=e[o];if(We(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 uM(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 mf(e,t,n){if(t>n)return[];const i=[Math.min(Math.max(e,t),n)];for(let o=Km;o<=n-t;o+=Km)e+o<=n&&i.push(e+o),e-o>=t&&i.push(e-o);return i}function pM(e,t,n,i,o){const r=[],a=e.type==="bpmn:Participant",s=t.type==="bpmn:Participant",c=t.y>=e.y+e.height;if(!c&&t.y+t.height>e.y)return{inPools:r,outside:[]};const l=c?e.y+e.height:e.y,u=c?t.y:t.y+t.height,p=e.x+e.width/2,f=t.x+t.width/2,d=(V,ee)=>ee>V.x+Fi&&ee<V.x+V.width-Fi,g=(V,ee)=>V.width<=2*hf?V.x+V.width/2:Math.min(Math.max(ee,V.x+hf),V.x+V.width-hf),h=Math.max(e.x,t.x)+Fi,m=Math.min(e.x+e.width,t.x+t.width)-Fi;if(h<=m){const V=!a&&d(t,p)?p:!s&&d(e,f)?f:Math.round((h+m)/2);r.push([{x:V,y:l},{x:V,y:u}])}const w=s?g(t,p):f,y=a?g(e,f):p;if(!a&&!d(e,w)){const V=w<e.x?e.x:e.x+e.width;for(const ee of mf(e.y+e.height/2,e.y+Fi,e.y+e.height-Fi))r.push([{x:V,y:ee},{x:w,y:ee},{x:w,y:u}])}if(!s&&!d(t,y)){const V=y<t.x?t.x:t.x+t.width;for(const ee of mf(t.y+t.height/2,t.y+Fi,t.y+t.height-Fi))r.push([{x:y,y:l},{x:y,y:ee},{x:V,y:ee}])}const v=(V,ee)=>{if(Math.abs(ee-V)<2*Fi)return[];const Ee=Math.min(V,ee)+Fi,Pe=Math.max(V,ee)-Fi;return mf(Math.round((V+ee)/2),Ee,Pe)};if(!a&&n)for(const V of v(l,c?n.y+n.height:n.y))r.push([{x:p,y:l},{x:p,y:V},{x:w,y:V},{x:w,y:u}]);if(!s&&i)for(const V of v(u,c?i.y:i.y+i.height))r.push([{x:y,y:l},{x:y,y:V},{x:f,y:V},{x:f,y:u}]);const x=Math.min(y,w),E=Math.max(y,w),C=[];for(const[V,ee]of o.filter(Ee=>Ee.x<E&&Ee.x+Ee.width>x).map(Ee=>[Ee.y,Ee.y+Ee.height]).sort((Ee,Pe)=>Ee[0]-Pe[0])){const Ee=C[C.length-1];Ee&&V<=Ee[1]?Ee[1]=Math.max(Ee[1],ee):C.push([V,ee])}const D=[];for(let V=1;V<C.length;V++)C[V][0]-C[V-1][1]>=cM&&D.push(Math.round((C[V-1][1]+C[V][0])/2));C.length&&D.push(C[0][0]-Xm,C[C.length-1][1]+Xm);const P=(V,ee)=>ee<V.y?V.y:ee>V.y+V.height?V.y+V.height:void 0,T=new Set([a?e.id:n==null?void 0:n.id,s?t.id:i==null?void 0:i.id].filter(V=>!!V)),$=e.y+e.height/2,j=t.y+t.height/2,G=j>$?1:-1,Q=(V,ee,Ee)=>o.some(Pe=>!T.has(Pe.id)&&Pe.x<V&&V<Pe.x+Pe.width&&Pe.y<Math.max(ee,Ee)-1&&Pe.y+Pe.height>Math.min(ee,Ee)+1),te=[];for(const V of D){const ee=P(e,V),Ee=P(t,V);ee===void 0||Ee===void 0||(V-$)*G<0&&Q(y,ee,V)||(V-j)*G>0&&Q(w,Ee,V)||te.push({pts:[{x:y,y:ee},{x:y,y:V},{x:w,y:V},{x:w,y:Ee}],len:Math.abs(V-ee)+(E-x)+Math.abs(Ee-V)})}return{inPools:r,outside:te.sort((V,ee)=>V.len-ee.len).map(V=>V.pts)}}function fM(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(ft(d).map(lt)),crossings:mo(d).length,shared:$i(d).length}},l=(d,g)=>d.length===g.length&&d.every((h,m)=>We(h.x,g[m].x)&&We(h.y,g[m].y)),u=d=>{const g=d.source,h=d.target;if(!g||!h)return"skip";const m=Ge(i),w=new Map(m.shapes.map(K=>[K.id,K])),y=s(g),v=s(h),x=new Set([y,v].filter(K=>!!K)),E=m.shapes.filter(K=>K.type==="bpmn:Participant"),C=(d.waypoints??[]).map(K=>({x:K.x,y:K.y})),D=gf(C,x,E);if(D<df)return"skip";if(t.has(d.id)){const K=r.get(d.id);if(K&&l(K,C)||D-(K?gf(K,x,a):0)<df)return"skip"}const P=w.get(g.id),T=w.get(h.id),$=m.edges.find(K=>K.id===d.id);if(!P||!T||!$)return"skip";const j=zn(m),G=new Set(Gt($,j).map(K=>K.id)),Q=Vo(m).filter(K=>K.owner!==d.id&&K.owner!==P.id&&K.owner!==T.id),te=[...m.shapes.filter(K=>!K.container&&K.id!==P.id&&K.id!==T.id),...Q.map(K=>K.rect)],V=K=>rn({...$,waypoints:K}).some(oe=>lM(oe,te)),ee=pM(P,T,y?w.get(y):void 0,v?w.get(v):void 0,E),Ee=K=>K.map((oe,Y)=>({pts:oe,i:Y,key:oe.length*2+(V(oe)?1:0)})).sort((oe,Y)=>oe.key-Y.key||oe.i-Y.i).map(oe=>oe.pts),Pe=[...Ee(ee.inPools),...Ee(ee.outside)],Se=c();for(const K of Pe){if(gf(K,x,E)>=df)continue;const oe={...$,waypoints:K};if(Gt(oe,j).some(ce=>!G.has(ce.id))||rn(oe).some(ce=>uM(ce,m.shapes)||Q.some(xe=>Ni(xe.rect,ce))))continue;o.updateWaypoints(d,K);const Z=c();if(Z.crossings<=Se.crossings&&Z.shared<=Se.shared&&[...Z.keys].every(ce=>Se.keys.has(ce)))return"fixed";o.updateWaypoints(d,C)}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],ba=35;function dM(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)-ba:Math.max(e.y+e.height,t.y+t.height)+ba,p=gM(e,t,s,u,n),f=p===null?[[u,0]]:[[u,0],[p,hM]];for(const[d,g]of f)for(const h of[0,...ji])if(!(Math.abs(h)>=e.width/2-5))for(const m of[0,...ji]){if(Math.abs(m)>=t.width/2-5)continue;const w=i+h,y=o+m,v=[{x:w,y:c},{x:w,y:d},{x:y,y:d},{x:y,y:l}];g&&Gt({endpoints:[],waypoints:v},a).length||r.push({pts:v,cost:g+Math.abs(m)+Math.abs(h)})}}return r}const hM=45,Kc=20;function gM(e,t,n,i,o){if(!o.length)return null;const r=e.x+e.width/2,a=t.x+t.width/2,s=Math.min(r,a),c=Math.max(r,a),l=n?Math.min(e.y,t.y):Math.max(e.y+e.height,t.y+t.height),u=o.filter(m=>m.container&&(m.type==="bpmn:Lane"||m.type==="bpmn:Participant")&&r>=m.x&&r<=m.x+m.width&&e.y>=m.y&&e.y+e.height<=m.y+m.height).sort((m,w)=>m.width*m.height-w.width*w.height)[0];if(!u)return null;const p=o.filter(m=>!m.container&&m.id!==e.id&&m.id!==t.id),f=p.filter(m=>m.x<c&&m.x+m.width>s&&(n?m.y<l&&m.y+m.height>i:m.y+m.height>l&&m.y<i));if(!f.length)return null;const d=[...p,...p.flatMap(m=>m.label?[m.label]:[])].filter(m=>m.x<c&&m.x+m.width>s);if(n){let m=Math.min(...f.map(y=>y.y));for(let y=!0;y;){y=!1;for(const v of d)v.y<m&&v.y<l&&v.y+v.height>m-Kc&&(m=v.y,y=!0)}const w=Math.max(u.y,...d.filter(y=>y.y+y.height<=m).map(y=>y.y+y.height));return m-w>=Kc?Math.round((m+w)/2):null}let g=Math.max(...f.map(m=>m.y+m.height));for(let m=!0;m;){m=!1;for(const w of d)w.y+w.height>g&&w.y+w.height>l&&w.y<g+Kc&&(g=w.y+w.height,m=!0)}const h=Math.min(u.y+u.height,...d.filter(m=>m.y>=g).map(m=>m.y));return h-g>=Kc?Math.round((g+h)/2):null}function Xc(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 dM(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-ba:n.y+n.height+ba,p=[];for(const y of[0,...ji]){if(Math.abs(y)>=i.width/2-5)continue;const v=r+y;p.push({pts:[{x:n.x,y:o},{x:v,y:o},{x:v,y:c}],cost:Math.abs(y)});for(const x of[0,...ji]){if(Math.abs(x)>=n.width/2-5)continue;const E=a+x;p.push({pts:[{x:E,y:l},{x:E,y:u},{x:v,y:u},{x:v,y:c}],cost:Math.abs(y)+Math.abs(x)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const y of[0,...ji]){if(Math.abs(y)>=n.width/2-5)continue;const v=a+y;p.push({pts:[{x:v,y:g},{x:v,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(y)})}const h=60,m=s?i.y+i.height:i.y,w=s?i.y+i.height+ba:i.y-ba;for(const y of[0,...ji]){if(Math.abs(y)>=i.width/2-5)continue;const v=r+y;for(const x of[0,...ji]){if(Math.abs(x)>=n.width/2-5)continue;const E=a+x;p.push({pts:[{x:E,y:g},{x:E,y:w},{x:v,y:w},{x:v,y:m}],cost:h+Math.abs(y)+Math.abs(x)})}}return p}const Zc=30;function Zm(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],o=e[n+1],r=We(i.y,o.y)&&!We(i.x,o.x),a=We(i.x,o.x)&&!We(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)<Zc||Math.abs(i.y-(s.y+s.height))<Zc)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)<Zc||Math.abs(i.x-(s.x+s.width))<Zc)return!0}}return!1}const Qc=40;function mM(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(C=>C.container),i=new Map(t.shapes.map(C=>[C.id,C])),o=zn(t),r=t.edges.filter(C=>C.id!==e.id),a=di(e,r),s=hi(e,r),c=C=>mM(C,t.shapes,e.endpoints)+(Zm(C,n)?1:0),l=c(e.waypoints),u=C=>{if(!C)return;const D=C.x+C.width/2,P=C.y+C.height/2;return n.find(T=>T.type==="bpmn:Lane"&&D>=T.x&&D<=T.x+T.width&&P>=T.y&&P<=T.y+T.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=C=>{if(!d||!f)return!1;for(let D=1;D<C.length-2;D++){const P=C[D],T=C[D+1];if(We(P.y,T.y)&&!We(P.x,T.x)&&P.y>f.y&&P.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),w=(C=>{if(!C)return;const D=C.x+C.width/2,P=C.y+C.height/2;return n.filter(T=>T.type==="bpmn:Participant"&&D>=T.x&&D<=T.x+T.width&&P>=T.y&&P<=T.y+T.height).sort((T,$)=>T.width*T.height-$.width*$.height)[0]})(i.get(e.endpoints[0]??"")),y=C=>{if(!w)return 0;let D=0;for(let P=1;P<C.length-1;P++){const T=C[P];(T.x<w.x||T.x>w.x+w.width||T.y<w.y||T.y>w.y+w.height)&&D++}return D},v=y(e.waypoints);if(!Zm(e.waypoints,n)&&!(d&&!h)&&v===0)return null;const x=C=>C.reduce((D,P,T)=>T?D+Math.abs(P.x-C[T-1].x)+Math.abs(P.y-C[T-1].y):0,0);let E;for(const{pts:C,cost:D}of Xc(e,i)){const P={...e,waypoints:C};if(Gt(P,o).length>0)continue;const T=di(P,r);if(T>a)continue;const $=y(C);if($>v)continue;const j=$<v&&T===0;if(!j&&hi(P,r)>s)continue;const G=c(C),Q=g(C);if(!j&&!(Q&&!h)&&G>=l)continue;const V=Q?0:1,ee=x(C);(!E||$<E.out||$===E.out&&(V<E.lane||V===E.lane&&(T<E.opp||T===E.opp&&(G<E.sc||G===E.sc&&(D<E.cost||D===E.cost&&ee<E.len)))))&&(E={pts:C,out:$,sc:G,lane:V,opp:T,cost:D,len:ee})}return(E==null?void 0:E.pts)??null}function yM(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 vM(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=zn(s),u=s.edges.filter(m=>m.id!==a),p=Gt(c,l).length,f=di(c,u),d=hi(c,u),g=n.has(a)?new Set(ft(s).map(lt)):null,h=Wc(c,s.shapes);h.length===2&&yM(c,s)&&h.reverse();for(const m of h){if(m.length>=c.waypoints.length)continue;const w={...c,waypoints:m};if(Gt(w,l).length>p||di(w,u)>f||hi(w,u)>d)continue;if(g){const v=new Set(ft({...s,edges:s.edges.map(C=>C.id===a?w:C)}).map(lt)),x=[...v].filter(C=>!g.has(C)).length,E=[...g].filter(C=>!v.has(C)).length;if(x>E)continue}const y=i.get(a);y&&o.updateWaypoints(y,m);break}}}function Jm(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 yf(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=We(n[0].x,n[1].x)&&!We(n[0].y,n[1].y),s=We(n[n.length-1].x,n[n.length-2].x)&&!We(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 ey=e=>e==="bpmn:SequenceFlow"||e==="bpmn:MessageFlow";function bM(e,t,n){const i=e.waypoints;if(i.length<2||!ey(e.type))return[];const o=i[0],r=i[1],a=We(o.y,r.y)&&!We(o.x,r.x),s=We(o.x,r.x)&&!We(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(!ey(g.type)||g.type===e.type||g.waypoints.length<2)return!1;const h=g.waypoints[0],m=g.waypoints[1];return!We(h.x,o.x)||!We(h.y,o.y)?!1:a?We(h.y,m.y)&&Math.sign(m.x-h.x)===c:We(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 ji){const h=(a?o.y:o.x)+g;if(!f(u,h)||i.length===2&&(!p||!f(p,h)))continue;const m=i.map(w=>({...w}));for(const w of[m[0],m[1]])a?w.y=h:w.x=h;d.push({pts:m,cost:Math.abs(g)})}return d}function xM(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const o=i.y+i.height<=n.y,r=n.y+n.height<=i.y;if(!o&&!r)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,l=n.y+n.height/2,u=i.x+i.width/2,p=i.y+i.height/2,f=a?n.x+n.width:n.x,d=r?n.y+n.height:n.y,g=a?i.x:i.x+i.width,h=r?i.y:i.y+i.height,m=[];for(const w of[0,...ji])Math.abs(w)<i.width/2-5&&m.push({pts:[{x:f,y:l},{x:u+w,y:l},{x:u+w,y:h}],cost:Math.abs(w)}),Math.abs(w)<i.height/2-5&&m.push({pts:[{x:c,y:d},{x:c,y:p+w},{x:g,y:p+w}],cost:Math.abs(w)});return m}function vf(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 ty(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=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=[...Xc(e,n),...vf(e,n),...yf(e,n),...bM(e,o,n)];for(const{pts:d,cost:g}of f){const h={...e,waypoints:d};if(Gt(h,i).length>0)continue;const m=di(h,o),w=hi(h,o),y=r-m+(p-u(d));if(m>=r||w-a>y)continue;const v=c(d);(!s||m<s.opposite||m===s.opposite&&(w<s.cross||w===s.cross&&(g<s.cost||g===s.cost&&v<s.len)))&&(s={pts:d,opposite:m,cross:w,cost:g,len:v})}return(s==null?void 0:s.pts)??null}function ny(e,t){var i;let n=0;for(const o of t)o.id!==e.id&&((i=Tr(e,o))==null?void 0:i.kind)==="unrelated"&&n++;return n}function wM(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=ny(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=[...Xc(e,n),...vf(e,n),...xM(e,n),...yf(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(Gt(g,i).length>0)continue;const h=ny(g,o);if(h>=r)continue;const m=di(g,o);if(m-h>a-r)continue;const w=hi(g,o);if(w-s>(r-h)*l)continue;const y=c(f);(!u||h<u.fake||h===u.fake&&(m<u.unreadable||m===u.unreadable&&(w<u.cross||w===u.cross&&(d<u.cost||d===u.cost&&y<u.length))))&&(u={pts:f,fake:h,unreadable:m,cross:w,cost:d,length:y})}return(u==null?void 0:u.pts)??null}function iy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ft(Ge(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(lt(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=wM(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function oy(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 ry(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Tr(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,o]=e.endpoints,[r,a]=t.endpoints,s=[i,o].filter(u=>u&&(u===r||u===a)).length;return!(!!o&&o===r||!!a&&a===i)||s!==1?!1:oy(e,n)&&oy(t,n)}function ay(e,t,n){let i=0;for(const o of t)o.id!==e.id&&ry(e,o,n)&&i++;return i}function _M(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=ay(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=[...Xc(e,n),...vf(e,n),...yf(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(Gt(g,i).length>0)continue;const h=ay(g,o,n);if(h>=r)continue;const m=di(g,o);if(m-h>a-r)continue;const w=hi(g,o);if(w-s>(r-h)*l)continue;const y=c(f);(!u||h<u.chain||h===u.chain&&(m<u.unreadable||m===u.unreadable&&(w<u.cross||w===u.cross&&(d<u.cost||d===u.cost&&y<u.length))))&&(u={pts:f,chain:h,unreadable:m,cross:w,cost:d,length:y})}return(u==null?void 0:u.pts)??null}function EM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=ft(r).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(lt(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,p]=l.edges.map(f=>r.edges.find(d=>d.id===f));if(!(!u||!p||!ry(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=_M(p,u);if(!f)continue;const d=i.get(l);d&&o.updateWaypoints(d,f)}}function sy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=ft(r).filter(u=>nf(u)&&!t.has(lt(u)));if(!a.length)return;const s=new Set;for(const u of a)if(nf(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=ty(f,p);if(!d)continue;const g=i.get(u);g&&o.updateWaypoints(g,d)}}const SM=10,RM=(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 cy(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Gc(e,i))return null;const o=zn(t),r=i.flatMap(rn);for(const a of rn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of zc(a,r))s=s.flatMap(([h,m])=>{const w=[];return d>h&&w.push([h,Math.min(m,d)]),g<m&&w.push([Math.max(h,g),m]),w.filter(([y,v])=>v>y)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,g])=>g-d>=c+SM*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-_m}:{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(!Gc({...e,label:f},i)&&!o.some(d=>!e.endpoints.includes(d.id)&&RM(f,d)))return f}return null}const Tn=8;function bf(e,t){const n=e.label;if(!n)return null;const i=rn(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(rn),...t.shapes.filter(f=>f.container).flatMap(ma)],l=f=>!c.some(d=>Ni(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 ly=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},uy=(e,t)=>CM({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=rn(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(rn),...t.shapes.filter(c=>c.container).flatMap(ma)],r=Vo(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))&&!fs(c,t).length&&!r.some(l=>a(c,l));for(const c of i){const l=(c.lo+c.hi)/2,u=c.axis==="h"?[c.at+Tn,c.at-Tn-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+Tn,c.at-Tn-n.width].map(p=>({...n,x:p,y:l-n.height/2}));for(const p of u)if(s(p))return p}return null}function py(e,t){var a,s;const{elementRegistry:n}=e,i=e.modeling;let o=Ge(n),r=new Set(ft(o).map(lt));for(const[c,l]of t){const u=l.wps,p=n.get(c),f=p==null?void 0:p.label;if(!f||!(p!=null&&p.waypoints))continue;const d=p.waypoints[0].x-u[0].x,g=p.waypoints[0].y-u[0].y;if(!(p.waypoints.length===u.length&&p.waypoints.every((C,D)=>C.x-u[D].x===d&&C.y-u[D].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 C=o.edges.find(j=>j.id===c);if(!(C!=null&&C.label)||!fs(C.label,o).length)continue;let D={...C.label,x:l.label.x,y:l.label.y};if((fs(D,o).length||uy(D,C.waypoints)>ly)&&(D=null),!D&&uy(C.label,C.waypoints)>ly&&(D=MM(C,o)),!D)continue;const P=D,T={...o,edges:o.edges.map(j=>j.id===c?{...j,label:P}:j)},$=ft(T);if($.some(j=>!r.has(lt(j))))continue;i.moveElements([f],{x:P.x-f.x,y:P.y-f.y}),o=T,r=new Set($.map(lt));continue}const m=l.label.x+d-f.x,w=l.label.y+g-f.y;if(m===0&&w===0)continue;const y=o.edges.find(C=>C.id===c);if(!(y!=null&&y.label))continue;const v={...y.label,x:y.label.x+m,y:y.label.y+w},x={...o,edges:o.edges.map(C=>C.id===c?{...C,label:v}:C)},E=ft(x);E.some(C=>!r.has(lt(C)))||(i.moveElements([f],{x:m,y:w}),o=x,r=new Set(E.map(lt)))}}function fy(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=bf(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 dy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=ft(r).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(lt(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=r.edges.find(f=>f.id===s.edge);if(!c)continue;const l=cy(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 hy(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(rn),...t.shapes.filter(f=>f.container).flatMap(ma)],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=Vo(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-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 gy(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=hy(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 AM(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 my(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=Ge(n),r=new Set(ft(o).map(lt));const a=[...new Set(ft(o).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(lt(s))).map(s=>s.edge))].sort();for(const s of a){const c=o.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[h,m]of u){const w=h?o.shapes.find(v=>v.id===h):void 0;if(!w)continue;const y=AM(w,l[m]);y.x===l[m].x&&y.y===l[m].y||(l[m]=y,p=!0)}if(!p)continue;const f={...o,edges:o.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=ft(f);if(d.some(h=>!r.has(lt(h))))continue;const g=n.get(s);g&&(i.updateWaypoints(g,l),o=f,r=new Set(d.map(lt)))}}const xf=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function yy(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?as(n):[];return e.forEach((r,a)=>{if(r.kind==="translation.confirm"){if(!n){i.push({kind:"locale-texts-not-enabled",opIndex:a,id:r.id,field:"locale"});return}if(!o.includes(r.locale)){i.push({kind:"locale-not-in-document",opIndex:a,id:r.id,field:"locale",locale:r.locale,locales:o});return}t.categoryOf(r.id)!==void 0&&!t.reviewRequestLocalesOf(r.id).includes(r.locale)&&i.push({kind:"review-request-missing",opIndex:a,id:r.id,locale:r.locale});return}for(const s of yy(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(!xf(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 xi(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function TM(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(xf(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=yy(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,g)=>xi(d,"name",a(p[g])))),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,g)=>xi(d,"name",a(p[g])))),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(xf(l[0].map)?xi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const kM=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,vy=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),by={"participant.add":[{path:"participant",shape:["id"]},{path:"participant.lanes[]",shape:["id"],optional:!0}],"participant.update":[{path:"id",shape:null},{path:"lanes[]",shape:["id"],optional:!0}],"node.add":[{path:"node",shape:["id","type"]}],"node.update":[{path:"id",shape:null}],"sequenceFlow.add":[{path:"flow",shape:["id","source","target"]}],"sequenceFlow.update":[{path:"id",shape:null}],"messageFlow.add":[{path:"flow",shape:["id","source","target"]}],"messageFlow.update":[{path:"id",shape:null}],"dataStore.add":[{path:"dataStore",shape:["id"]},{path:"associations[]",shape:["source","target"],optional:!0}],"dataStore.update":[{path:"id",shape:null}],"dataAssociation.add":[{path:"association",shape:["source","target"]}],"association.add":[{path:"association",shape:["source","target"]}],"annotation.add":[{path:"annotation",shape:["id"]},{path:"association",shape:["source","target"],optional:!0},{path:"placement",shape:["anchor","side"],optional:!0}],"annotation.update":[{path:"id",shape:null},{path:"placement",shape:["anchor","side"],optional:!0}],"group.add":[{path:"group",shape:["id"]},{path:"group.members[]",shape:null,optional:!0}],"group.update":[{path:"id",shape:null},{path:"members[]",shape:null,optional:!0}],"translation.confirm":[{path:"id",shape:null},{path:"locale",shape:null}],"element.remove":[{path:"id",shape:null}]},hs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Jc=e=>typeof e=="string"&&e!=="";function OM(e){const t=[];function n(i,o,r,a){if(a===null){Jc(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!hs(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)Jc(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!hs(i)||!Jc(i.kind)||!(i.kind in by)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of by[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let f=i;for(const g of p.slice(0,-1)){if(!hs(f))break;f=f[g]}if(!hs(f))continue;const d=f[p[p.length-1]];if(!(d===void 0&&c.optional)&&!(d===null&&c.optional)){if(!l){n(o,c.path,d,c.shape);continue}if(!Array.isArray(d)){t.push({kind:"payload-invalid",opIndex:o,field:c.path});continue}d.forEach((g,h)=>n(o,`${u}[${h}]`,g,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;hs(c)&&!Jc(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"&&!Fg(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&&!jg(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 xy(e,t,n={}){const i=OM(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(h,m,w){if(!kM.test(m)){o.push({kind:"id-invalid",opIndex:h,id:m});return}if(t.categoryOf(m)!==void 0||r.has(m)){o.push({kind:"id-duplicate",opIndex:h,id:m});return}r.set(m,{...w,opIndex:h})}e.forEach((h,m)=>{var w;switch(h.kind){case"participant.add":s(m,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(y=>y.id)});for(const y of h.participant.lanes??[])s(m,y.id,{category:"lane"});break;case"node.add":s(m,h.node.id,{category:"flowNode",participant:h.node.participant});break;case"sequenceFlow.add":s(m,h.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(m,h.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(m,h.dataStore.id,{category:"dataStore"});for(const y of h.associations??[])y.id&&s(m,y.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(m,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(m,h.association.id,{category:"association"});break;case"annotation.add":s(m,h.annotation.id,{category:"annotation"}),(w=h.association)!=null&&w.id&&s(m,h.association.id,{category:"association"});break;case"group.add":s(m,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(y=>y.id));for(const y of h.lanes)t.categoryOf(y.id)===void 0&&s(m,y.id,{category:"lane"})}break}});const c=h=>{var m;return((m=r.get(h))==null?void 0:m.category)??t.categoryOf(h)},l=h=>{const m=r.get(h);return m?m.category==="participant"?h:m.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,m,w,y){const v=c(m);if(v===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:w});return}if(y&&!y.includes(v)){o.push({kind:"ref-category",opIndex:h,ref:m,role:w,expected:y.join("|"),actual:v});return}return v}const p=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),f=new Map;for(const h of e)h.kind==="node.add"?f.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&f.set(h.id,h.eventDefinition);const d=h=>f.has(h)?f.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,m)=>{var w,y;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:v,lane:x}=h.node;if(v===void 0){(p||x!==void 0)&&o.push({kind:"participant-required",opIndex:m,id:h.node.id});break}if(u(m,v,"participant",["participant"])===void 0)break;x!==void 0&&((((w=r.get(v))==null?void 0:w.lanes)??a.get(v)??t.lanesOf(v)).includes(x)||o.push({kind:"lane-unknown",opIndex:m,lane:x,participant:v}));break}case"sequenceFlow.add":{const{id:v,source:x,target:E,name:C,condition:D}=h.flow,P=u(m,x,"source",["flowNode"]),T=u(m,E,"target",["flowNode"]);P&&T&&l(x)!==l(E)&&o.push({kind:"flow-cross-pool",opIndex:m,id:v}),C!==void 0&&D!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:v});break}case"messageFlow.add":{const{id:v,source:x,target:E}=h.flow,C=u(m,x,"source",["flowNode","participant"]),D=u(m,E,"target",["flowNode","participant"]);if(C&&D){const P=l(x),T=l(E);P!==void 0&&P===T&&o.push({kind:"message-flow-same-pool",opIndex:m,id:v})}for(const P of[x,E])d(P)&&o.push({kind:"message-flow-timer-endpoint",opIndex:m,id:v,ref:P});break}case"dataStore.add":{for(const v of h.associations??[]){if([v.source,v.target].filter(C=>C===h.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:m,source:v.source,target:v.target});continue}const E=v.source===h.dataStore.id?v.target:v.source;u(m,E,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:v,target:x}=h.association,E=u(m,v,"source"),C=u(m,x,"target");if(E&&C){const D=new Set([E,C]);D.has("dataStore")&&D.has("flowNode")||o.push({kind:"data-association-ends",opIndex:m,source:v,target:x})}break}case"association.add":{const{id:v,source:x,target:E}=h.association,C=u(m,x,"source"),D=u(m,E,"target");C&&D&&C!=="annotation"&&D!=="annotation"&&o.push({kind:"association-detached",opIndex:m,annotation:v??`${x}->${E}`});break}case"annotation.add":{if(h.association){const{source:v,target:x}=h.association;if(v!==h.annotation.id&&x!==h.annotation.id)o.push({kind:"association-detached",opIndex:m,annotation:h.annotation.id});else{const E=v===h.annotation.id?x:v;u(m,E,"association")}}h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.add":{for(const v of h.group.members??[]){const x=u(m,v,"member");x&&vy.has(x)&&o.push({kind:"ref-category",opIndex:m,ref:v,role:"member",expected:"shape",actual:x})}break}case"participant.update":{if(g(m,h.id,"participant")===void 0)break;if(h.lanes){const v=t.lanesOf(h.id),x=h.lanes.map(P=>P.id);for(const P of v)x.includes(P)||o.push({kind:"lane-shrink-unsupported",opIndex:m,participant:h.id,lane:P});for(const P of x)t.categoryOf(P)!==void 0&&!v.includes(P)&&o.push({kind:"id-duplicate",opIndex:m,id:P});const E=x.filter(P=>v.includes(P)),C=P=>E.every((T,$)=>T===P[$]),D=(((y=t.laneDeclarationOrderOf)==null?void 0:y.call(t,h.id))??v).filter(P=>v.includes(P));E.length===v.length&&!C(v)&&!C(D)&&o.push({kind:"lane-reorder-unsupported",opIndex:m,participant:h.id})}break}case"node.update":{if(g(m,h.id,"flowNode")===void 0)break;if(h.lane!==void 0){const v=t.participantOf(h.id);(v?a.get(v)??t.lanesOf(v):[]).includes(h.lane)||o.push({kind:"lane-unknown",opIndex:m,lane:h.lane,participant:v??""})}break}case"sequenceFlow.update":{if(g(m,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:h.id}),h.source!==void 0||h.target!==void 0){const v=h.source===void 0||u(m,h.source,"source",["flowNode"])!==void 0,x=h.target===void 0||u(m,h.target,"target",["flowNode"])!==void 0,E=t.endpointsOf(h.id),C=h.source??(E==null?void 0:E.source),D=h.target??(E==null?void 0:E.target);v&&x&&C!==void 0&&D!==void 0&&new Set([l(C),l(D),l(h.id)]).size>1&&o.push({kind:"flow-cross-pool",opIndex:m,id:h.id})}break}case"messageFlow.update":g(m,h.id,"messageFlow");break;case"dataStore.update":g(m,h.id,"dataStore");break;case"annotation.update":{if(g(m,h.id,"annotation")===void 0)break;h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.update":{if(g(m,h.id,"group")===void 0)break;for(const v of h.members??[]){const x=u(m,v,"member");x&&vy.has(x)&&o.push({kind:"ref-category",opIndex:m,ref:v,role:"member",expected:"shape",actual:x})}break}case"translation.confirm":g(m,h.id);break;case"element.remove":{g(m,h.id)==="lane"&&o.push({kind:"ref-category",opIndex:m,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),o.push(...PM(e,t,n.i18n)),o;function g(h,m,w){if(r.has(m)){o.push({kind:"target-added-in-batch",opIndex:h,id:m});return}const y=t.categoryOf(m);if(y===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:"target"});return}if(w&&y!==w){o.push({kind:"ref-category",opIndex:h,ref:m,role:"target",expected:w,actual:y});return}return y}}function wy(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 el(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const tl={"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,DM=300,LM=160,_y=20,wf=100,Ey=40,IM=10,BM=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function Sy(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 nl=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function il(e,t,n,i,o){const r=n,a=Sy(e,t,i),s=a??i,c=(Q,te,V=s)=>{const[ee,Ee]=tl[Q];let Pe={x:t.x+t.width/2+ee*(t.width/2+r.width/2+te),y:t.y+t.height/2+Ee*(t.height/2+r.height/2+te)};const Se=V.x+kn+r.width/2,K=V.x+V.width-kn-r.width/2,oe=V.y+kn+r.height/2,Y=V.y+V.height-kn-r.height/2,Z={x:Math.min(K,Math.max(Se,Pe.x)),y:Math.min(Y,Math.max(oe,Pe.y))};return(Z.x!==Pe.x||Z.y!==Pe.y)&&(Pe=Math.abs(Z.x-(t.x+t.width/2))<(t.width+r.width)/2+kn&&Math.abs(Z.y-(t.y+t.height/2))<(t.height+r.height)/2+kn?{x:t.x+t.width+kn+r.width/2,y:Z.y}:Z),Pe},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 V,ee;if(!o.selfId)return!1;const te=e.get(Q);return!!te&&(((V=te.source)==null?void 0:V.id)===o.selfId||((ee=te.target)==null?void 0:ee.id)===o.selfId)},f=u.edges.filter(Q=>!p(Q.id)).flatMap(rn),d=Vo(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 te=g(Q);return l.some(V=>te.x0<V.x+V.width&&te.x1>V.x&&te.y0<V.y+V.height&&te.y1>V.y)},m=Q=>{const te=g(Q);return f.some(V=>V.axis==="h"?V.at>te.y0&&V.at<te.y1&&V.lo<te.x1&&V.hi>te.x0:V.at>te.x0&&V.at<te.x1&&V.lo<te.y1&&V.hi>te.y0)},w=Q=>{const te=g(Q);return d.some(V=>te.x0<V.x+V.width&&te.x1>V.x&&te.y0<V.y+V.height&&te.y1>V.y)},y=u.shapes.filter(Q=>Q.type==="bpmn:Group").flatMap(Q=>[{axis:"h",at:Q.y,lo:Q.x,hi:Q.x+Q.width},{axis:"h",at:Q.y+Q.height,lo:Q.x,hi:Q.x+Q.width},{axis:"v",at:Q.x,lo:Q.y,hi:Q.y+Q.height},{axis:"v",at:Q.x+Q.width,lo:Q.y,hi:Q.y+Q.height}]),v=Q=>{const te=g(Q);return y.some(V=>V.axis==="h"?V.at>te.y0&&V.at<te.y1&&V.lo<te.x1&&V.hi>te.x0:V.at>te.x0&&V.at<te.x1&&V.lo<te.y1&&V.hi>te.y0)},x=Q=>h(Q)||m(Q)||w(Q)||v(Q),E=Q=>Q.x-r.width/2>=i.x&&Q.x+r.width/2<=i.x+i.width&&Q.y-r.height/2>=i.y&&Q.y+r.height/2<=i.y+i.height,C=Q=>E(Q)&&(!a||nl(Q,r,a));if(o.placement){const Q=Se=>Se.startsWith("top")?Se.replace(/^top/,"bottom"):Se.replace(/^bottom/,"top"),te=Se=>Se.endsWith("left")?Se.replace(/left$/,"right"):Se.replace(/right$/,"left"),V=o.placement.side,ee=[V,Q(V),te(V),Q(te(V)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],Ee=o.placement.offset??50;let Pe=c(V,Ee);if(x(Pe)||a&&!nl(Pe,r,a)){const Se=(K,oe)=>{const Y=new Set;for(const Z of ee){if(Y.has(Z))continue;Y.add(Z);const ce=c(Z,Ee,K);if(oe(ce)&&!x(ce))return Pe=ce,!0}return!1};!Se(s,C)&&a&&Se(i,E)}return Pe}const D=o.from,P=s.x+kn+r.width/2,T=s.x+s.width-kn-r.width/2,$=s.y+kn+r.height/2,j=s.y+s.height-kn-r.height/2;let G={x:Math.min(T,Math.max(P,D.x)),y:Math.min(j,Math.max($,D.y))};if(x(G)){const Q=(t.width+r.width)/2+kn,V=[{x:G.x+Q,y:G.y},{x:G.x-Q,y:G.y},{x:G.x,y:G.y-r.height-kn},{x:G.x,y:G.y+r.height+kn}].filter(C).find(ee=>!x(ee));V&&(G=V)}return G}function qt(e,t){return e.filter(n=>n.kind===t)}function Ry(e,t){const n=new Map,i=new Set(qt(e,"node.add").map(s=>s.node.id)),o=qt(e,"sequenceFlow.update"),r=new Set(o.flatMap(s=>s.target!==void 0?[s.target]:[])),a=new Set;for(const s of o){const c=s.source;if(s.target!==void 0||c===void 0||!i.has(c)||r.has(c)||a.has(c))continue;const l=t(s.id),u=l&&qt(e,"sequenceFlow.add").find(f=>f.flow.source===l&&f.flow.target===c);if(!u)continue;const p=JSON.stringify(u.flow.id);e.some(f=>f!==u&&JSON.stringify(f).includes(p))||(a.add(c),n.set(s.id,u))}return n}class Cy extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}function My(e,t){var K1,X1,Z1,Q1,J1,eS,tS,nS,iS,oS,rS,aS,sS,cS,lS,uS,pS,fS,dS,hS,gS,mS,yS;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 _=p(b);if(!_)throw new Error(`하강 참조 해소 실패: ${b}`);return _},d=b=>{let _=b.parent;for(;_;){if(_.type==="bpmn:Participant")return _;_=_.parent}},g=new Map;for(const b of r.filter(_=>!("waypoints"in _&&_.waypoints)&&_.type!=="bpmn:Lane"&&_.type!=="label"&&typeof _.x=="number"))g.set(b.id,{x:b.x,y:b.y});const h=qt(e,"participant.add"),m=qt(e,"node.add"),w=qt(e,"sequenceFlow.add"),y=qt(e,"messageFlow.add"),v=qt(e,"dataStore.add"),x=qt(e,"dataAssociation.add"),E=qt(e,"annotation.add"),C=qt(e,"group.add"),D=new Map(m.map(b=>[b.node.id,b])),P=Ry(e,b=>{var _,R;return(R=(_=p(b))==null?void 0:_.source)==null?void 0:R.id}),T=new Set([...P.values()].map(b=>b.flow.id)),$=w.filter(b=>!T.has(b.flow.id)),j=new Set([...P.values()].map(b=>b.flow.target)),G=b=>qt(e,"sequenceFlow.update").filter(_=>_.target===b).length+(j.has(b)?1:0),Q=(b,_,R)=>{var I;const k=b.businessObject,L=(((I=k.extensionElements)==null?void 0:I.values)??[]).filter(B=>B.$type!==_),O=R?[...L,i.create(_,R)]:L;if(!O.length){k.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const F=i.create("bpmn:ExtensionElements",{values:O});O.forEach(B=>{B.$parent=F}),n.updateProperties(b,{extensionElements:F})},te=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of qt(e,"element.remove")){const _=p(b.id);_&&n.removeElements([_])}const V=b=>r.filter(_=>{var R;return _.type==="bpmn:Lane"&&((R=d(_))==null?void 0:R.id)===b}).sort((_,R)=>_.y-R.y);for(const b of qt(e,"participant.update")){const _=f(b.id);if(b.name!==void 0&&n.updateProperties(_,{name:b.name??void 0}),!b.lanes)continue;const R=V(b.id);if(!R.length){n.splitLane(_,b.lanes.length),V(b.id).forEach((O,F)=>{const I=b.lanes[F];I&&n.updateProperties(O,{id:I.id,name:I.name})});continue}const k=new Set(R.map(O=>O.id)),L=b.lanes.reduce((O,F,I)=>k.has(F.id)?I:O,-1);b.lanes.forEach((O,F)=>{if(k.has(O.id)){n.updateProperties(f(O.id),{name:O.name});return}const I=F===L+1&&L>=0,B=F===0?n.addLane(V(b.id)[0],"top"):I?n.addLane(V(b.id).at(-1),"bottom"):n.addLane(f(b.lanes[F-1].id),"bottom");n.updateProperties(B,{id:O.id,name:O.name})})}const ee=150,Ee=130,Pe=80,Se=90,K=180,oe=30,Y=30,Z=10,ce=300,xe=5,ke=(b,_,R,k,L)=>{const O=R-_.width/2,F=k-_.height/2;return(b.children??[]).find(I=>!("waypoints"in I&&I.waypoints)&&I.type!=="bpmn:Lane"&&I.type!=="label"&&!(L!=null&&L.has(I.id))&&typeof I.x=="number"&&O<I.x+I.width+Y&&O+_.width+Y>I.x&&F<I.y+I.height&&F+_.height>I.y)},N=new Set;for(const b of h){N.add(`pool:${b.participant.id}`);for(const _ of b.participant.lanes??[])N.add(_.id)}const M=new Map;for(const b of m){const _=b.node.lane??`pool:${b.node.participant??""}`;let R=M.get(_);R||M.set(_,R=new Set([0])),b.band!==void 0&&R.add(b.band)}const S=new Map;for(const[b,_]of M){if(!N.has(b))continue;const R=[..._].sort((O,F)=>O-F),k=R.map((O,F)=>F===0?0:F%2===1?Math.ceil(F/2):-(F/2)),L=Math.min(...k);S.set(b,new Map(R.map((O,F)=>[O,k[F]-L])))}{const b=new Map;for(const _ of h)(_.participant.lanes??[]).forEach((R,k)=>b.set(R.id,k));for(const[_,R]of S){if(!b.has(_)||R.size<2)continue;const k=b.get(_),L=R.get(0)??0,O=new Set;for(const pe of m){if(pe.node.lane!==_||(pe.band??0)!==0||!pe.node.type.endsWith("Gateway"))continue;const ve={in:new Set,out:new Set,cross:new Set};for(const se of $){const de=se.flow.source===pe.node.id;if(!de&&se.flow.target!==pe.node.id)continue;const Me=D.get(de?se.flow.target:se.flow.source);if(!Me||Me.node.participant!==pe.node.participant||!Me.node.lane)continue;let _e,ye=!1;if(Me.node.lane!==_){const ne=b.get(Me.node.lane);if(ne===void 0)continue;_e=ne>k?"down":"up",ye=!0}else{const ne=R.get(Me.band??0)??L;_e=ne>L?"down":ne<L?"up":void 0}_e&&(ve[de?"out":"in"].add(_e),ye&&ve.cross.add(_e))}for(const se of["up","down"])ve.in.has(se)&&ve.out.has(se)&&ve.cross.has(se)&&O.add(se)}if(O.size!==1)continue;const[F]=O,I=Math.max(...R.values()),B=F==="down"?I:0;if(L===B)continue;const H=[...R.entries()].filter(([pe])=>pe!==0).sort((pe,ve)=>pe[1]-ve[1]),U=[...Array(I+1).keys()].filter(pe=>pe!==B),ie=new Map([[0,B]]);H.forEach(([pe],ve)=>ie.set(pe,U[ve])),S.set(_,ie)}}const W=b=>{var _;return(((_=M.get(b))==null?void 0:_.size)??0)>1},X=b=>b.band??(b.node.lane||!W(`pool:${b.node.participant??""}`)?void 0:0),re=new Map,Re=b=>re.get(b.node.id)??X(b),et=new Set,yt=new Set;{const b=new Map;for(const k of $)b.set(k.flow.target,(b.get(k.flow.target)??0)+1);const _=k=>{const L=[],O=new Set([k]),F=[k];for(;F.length;){const I=F.shift();L.push(I);for(const B of $)B.flow.source!==I||O.has(B.flow.target)||(b.get(B.flow.target)??0)!==1||(O.add(B.flow.target),F.push(B.flow.target))}return L},R=(k,L)=>{var O;return((O=S.get(k))==null?void 0:O.get(L))??L};for(const k of m){if(!k.node.type.endsWith("Gateway"))continue;const L=k.node.lane??`pool:${k.node.participant??""}`,O=S.get(L);if(!O||O.size<2)continue;const F=Re(k);if(F===void 0||R(L,F)!==R(L,0))continue;const I=R(L,F),B=$.filter(se=>se.flow.source===k.node.id).map(se=>D.get(se.flow.target)).filter(se=>!!se&&(se.node.lane??`pool:${se.node.participant??""}`)===L),H=B.filter(se=>{const de=Re(se);return de!==void 0&&R(L,de)===I&&(b.get(se.node.id)??0)===1}),U=B.some(se=>{const de=Re(se);return de!==void 0&&R(L,de)>I});if(H.length!==1||!U)continue;const ie=new Set(B.flatMap(se=>_(se.node.id)));if(!$.some(se=>se.flow.target===k.node.id&&ie.has(se.flow.source)))continue;const ve=new Map;for(const[se,de]of O)ve.set(se,de+1);ve.set(-1,0),S.set(L,ve);for(const se of _(H[0].node.id))D.has(se)&&(re.set(se,-1),yt.add(se));et.add(k.node.id)}}const It=(b,_)=>{var R;return((R=S.get(b))==null?void 0:R.get(_))??_},bt=(b,_,R,k)=>{const L=b?p(b):_?p(_):void 0;if(!L)return!1;const O=b?L.y+Math.min(L.height/2,Se):L.y+Pe;return Math.abs(O+It(b??`pool:${_??""}`,R)*ee-k)<=ee/2},on=new Map;for(const[b,_]of M){let R=0;for(const k of _)R=Math.max(R,It(b,k));on.set(b,R)}const Mn=b=>K+ee*b,An=(b,_,R)=>{const k=u().children.filter(L=>!("waypoints"in L&&L.waypoints)&&L.type!=="label"&&L.id!==_&&typeof L.y=="number"&&L.y>=b);k.length&&n.moveElements(k,{x:0,y:R})},Nt=(b,_,R)=>{const k=b.type==="bpmn:Participant"?b:void 0;if(!k||k.children.some(I=>I.type==="bpmn:Lane"))return;const L=R+_.height/2+oe-k.y;if(k.height>=L)return;const O=L-k.height,F=k.y+k.height;n.resizeShape(k,{x:k.x,y:k.y,width:k.width,height:L}),An(F,k.id,O)},xn=(b,_)=>{const R=_-b.height;if(R<=0)return;const k=d(b)??b,L=[],O=B=>{L.push(B);for(const H of B.children??[])O(H)};O(k);const F=b.y+b.height-10,I=l.calculateAdjustments(L,"y",R,F);l.makeSpace(I.movingShapes,I.resizingShapes,{x:0,y:R},"s",F)},Nn=(b,_,R)=>{if(b){const F=f(b),I=Mn(_);if(F.height>=I)return;const B=I-F.height,H=d(F),U=H?H.y+H.height:F.y+F.height;xn(F,I),An(U,H==null?void 0:H.id,B);return}if(!R)return;const k=ee*(_+1);if(R.height>=k)return;const L=k-R.height,O=R.y+R.height;n.resizeShape(R,{x:R.x,y:R.y,width:R.width,height:k}),An(O,R.id,L)},xr=new Map;for(const b of $)xr.set(b.flow.target,(xr.get(b.flow.target)??0)+1);const vi=b=>(xr.get(b)??0)<=1,lo=new Set(m.map(b=>b.node.id).filter(b=>G(b)===1&&!$.some(_=>_.flow.target===b||_.flow.source===b&&D.has(_.flow.target)))),ui=new Map,dn=(b,_)=>{if(!b)return;const R=p(b);if(!R||R.height>=Mn(_))return;const k=R.y+R.height-10,L=d(R);if(L)return new Set((L.children??[]).filter(O=>O.type!=="bpmn:Lane"&&typeof O.y=="number"&&O.y>k).map(O=>O.id))},uo=(b,_,R)=>{if(!b)return!0;const k=p(b);return k?R-_.height/2>=k.y&&R+_.height/2<=k.y+k.height:!0},Kr=h.map((b,_)=>({op:b,declared:_}));Kr.sort((b,_)=>{const R=b.op.order??Number.POSITIVE_INFINITY,k=_.op.order??Number.POSITIVE_INFINITY;return R!==k?R-k:b.declared-_.declared});let Wn=80;for(const b of r.getAll())b.parent===u()&&"height"in b&&typeof b.y=="number"&&(Wn=Math.max(Wn,b.y+b.height+60));const mt=r.getAll().filter(b=>b.type==="bpmn:Participant"&&b.parent===u()),At=(()=>{if(!mt.length)return;const b=mt.filter(L=>!Py(L)),_=b.length?b:mt,R=Math.min(..._.map(L=>L.x)),k=Math.max(..._.map(L=>L.x+L.width));return k>R?{x:R,width:k-R}:void 0})();for(const{op:b}of Kr){const _=b.participant,R=m.filter(de=>de.node.participant===_.id).length,k=((K1=_.lanes)==null?void 0:K1.length)??0,L=Math.max(1200,R*160+300),O=(_.lanes??[]).map(de=>Mn(on.get(de.id)??0)),F=O.reduce((de,Me)=>de+Me,0);k&&F<300&&(O[k-1]+=300-F);const I=Math.max(300,ee*((on.get(`pool:${_.id}`)??0)+1)),B=_.blackBox||R+k===0?120:k?Math.max(300,F):I,H=_.blackBox?At:void 0,U=(H==null?void 0:H.x)??100,ie=(H==null?void 0:H.width)??L,pe=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:_.id,name:_.name,...b.order!==void 0?{"bwl:poolOrder":b.order}:{},..._.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:ie,height:B,isExpanded:!0}),ve=n.createShape(pe,{x:U+ie/2,y:Wn+B/2},u()),se=_.lanes??[];if(se.length&&n.splitLane(ve,se.length),se.length){const de=r.filter(Me=>{var _e;return Me.type==="bpmn:Lane"&&((_e=d(Me))==null?void 0:_e.id)===_.id}).sort((Me,_e)=>Me.y-_e.y);if(de.forEach((Me,_e)=>{const ye=se[_e];ye&&n.updateProperties(Me,{id:ye.id,name:ye.name})}),O.some(Me=>Me!==ve.height/k)){let Me=ve.y;de.forEach((_e,ye)=>{const ne=O[ye];n.resizeShape(_e,{x:_e.x,y:Me,width:_e.width,height:ne}),Me+=ne})}}Wn=ve.y+ve.height+60}const i3=b=>{var k;const _=D.get(b);if(_)return _.node.participant??"";const R=p(b);return R?R.type==="bpmn:Participant"?R.id:((k=d(R))==null?void 0:k.id)??"":""},bc=new Map,v1=b=>{let _=bc.get(b);return _||bc.set(b,_={nodes:[],flows:[]}),_};for(const b of m)v1(b.node.participant??"").nodes.push(b);for(const b of $)v1(i3(b.flow.source)).flows.push(b);const mp=b=>{var _;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((_=b.condition)==null?void 0:_.label)})},Mg=(b,_,R)=>o.createShape({type:el(b.type),...b.eventDefinition?{eventDefinitionType:Mc[b.eventDefinition]}:{},businessObject:i.create(el(b.type),{id:b.id,name:b.name,..._!==void 0?{"bwl:band":_}:{},...R!==void 0?{"bwl:afterColumn":R}:{}})}),o3=[...Kr.map(({op:b})=>b.participant.id).filter(b=>bc.has(b)),...[...bc.keys()].filter(b=>!h.some(_=>_.participant.id===b))],Ag=b=>b.endsWith("Gateway");for(const b of o3){const _=bc.get(b),R=b?f(b):void 0,k=R?R.x+150:250;let L=R?R.y+80:120;const O=(ne,ae,he)=>{if(ne){const Ve=f(ne);return Ve.y+Math.min(Ve.height/2,Se)+It(ne,ae??0)*ee}return ae!==void 0&&R?R.y+Pe+It(`pool:${b}`,ae)*ee:he},F=(ne,ae,he)=>{if(ne){const Ve=f(ne);return Ve.y+Math.min(Ve.height/2,Se)+ae*ee}return R?R.y+Pe+ae*ee:he},I=ne=>ne.participant?f(ne.participant):u(),B=(ne,ae,he,Ve,ct,nt,dt,Et)=>{const le=he!==void 0||Ve!==void 0,Le=Fe=>{const Ie=()=>Nn(he,Fe,R);Et?Et(Ie):Ie()},we=It(he??`pool:${b}`,Ve??0);if((Ve===void 0||bt(he,b,Ve,dt??Number.NaN))&&dt!==void 0&&uo(he,ae,dt)&&!ke(ne,ae,ct,dt))return{x:ct,y:dt};if(le)for(let Fe=0;Fe<4;Fe++){const Ie=F(he,we+Fe,nt);if(!ke(ne,ae,ct,Ie,dn(he,we+Fe)))return Le(we+Fe),{x:ct,y:Ie}}const ue=O(he,Ve,nt);le?Le(we):Et?Et(()=>Nt(ne,ae,ae.y+ae.height/2)):Nt(ne,ae,ue);let $e=ct;for(let Fe=0;Fe<64;Fe++){const Ie=ke(ne,ae,$e,ue);if(!Ie)break;$e=Ie.x+Ie.width+Ee+ae.width/2}return{x:$e,y:ue}},H=(ne,ae,he)=>{const Ve=r.getAll().filter(nt=>{var dt;return/Association$/.test(nt.type)&&(((dt=nt.waypoints)==null?void 0:dt.length)??0)>=2});if(!Ve.length)return he;const ct=nt=>{const dt={id:ae.id,type:ae.type,x:nt-ae.width/2,y:he.y-ae.height/2,width:ae.width,height:ae.height};return Ve.some(Et=>Et.waypoints.some((le,Le)=>!!Et.waypoints[Le+1]&&ya(le,Et.waypoints[Le+1],dt)<=Z))};if(!ct(he.x))return he;for(let nt=xe;nt<=ce;nt+=xe){const dt=he.x+nt;if(!ct(dt)&&!ke(ne,ae,dt,he.y))return{x:dt,y:he.y}}return he},U=new Set(_.flows.map(ne=>ne.flow.target)),ie=new Map,pe=ne=>{if(ne===void 0)return;const ae=r.get(ne);if(!(!ae||typeof ae.x!="number"||typeof ae.width!="number"))return ae.x+ae.width+Ee};for(const ne of _.nodes){if(U.has(ne.node.id))continue;const ae=Mg(ne.node,ne.band,ne.afterColumn),he=X(ne),Ve=ne.node.lane?`${ne.node.lane}|${he??""}`:he!==void 0?`band:${he}`:"",ct=I(ne.node),nt=ie.get(Ve)??k,dt=pe(ne.afterColumn),Et=dt===void 0?nt:Math.max(nt,dt);let le;const Le=B(ct,ae,ne.node.lane,he,Et,L,void 0,lo.has(ne.node.id)&&ne.node.participant!==void 0?we=>le=we:void 0);if(le?n.createShape(ae,Le,ct,{autoResize:!1}):n.createShape(ae,Le,ct),le){const we=ne.node.lane?f(ne.node.lane):ct;ui.set(ne.node.id,{container:we,relCy:Le.y-we.y,grow:le})}ie.set(Ve,Le.x+ae.width+Ee),!ne.node.lane&&he===void 0&&(L+=160)}const ve=new Set,se=new Map,de=new Map,Me=new Map;if(b&&N.has(`pool:${b}`)){const ne=new Map;for(const le of _.flows)ne.set(le.flow.target,(ne.get(le.flow.target)??0)+1);const ae=le=>O(le.node.lane,Re(le),Number.NaN),he=new Set,Ve=le=>{var ue;const Le=(ue=D.get(le))==null?void 0:ue.node.participant;if(Le)return p(Le);const we=p(le);if(we)return we.type==="bpmn:Participant"?we:d(we)},ct=le=>{const Le=[],we=new Set([le]),ue=[le];for(;ue.length;){const $e=ue.shift(),Fe=D.get($e);Fe&&Le.push(Fe);for(const Ie of _.flows)Ie.flow.source!==$e||we.has(Ie.flow.target)||(ne.get(Ie.flow.target)??0)!==1||(we.add(Ie.flow.target),ue.push(Ie.flow.target))}return Le},nt=le=>{if(!R)return;const Le=new Set(le.map($e=>$e.node.id));let we=!1,ue=!1;for(const $e of y){if(!Le.has($e.flow.source))continue;const Fe=Ve($e.flow.target);!Fe||Fe.id===R.id||(Fe.y<R.y?we=!0:ue=!0)}return we&&!ue?"up":ue&&!we?"down":void 0};for(const le of _.nodes){if(!Ag(le.node.type))continue;const Le=O(le.node.lane,X(le),Number.NaN);if(Number.isNaN(Le))continue;const we=[];for(const Ie of _.flows){if(Ie.flow.source!==le.node.id)continue;const at=D.get(Ie.flow.target);if(!at||at.node.lane!==le.node.lane||(ne.get(at.node.id)??0)!==1)continue;const St=X(at);if(St===void 0)continue;const Ht=O(at.node.lane,St,Number.NaN);if(Number.isNaN(Ht))continue;const $n=ct(at.node.id),Wt=nt($n);Wt&&we.push({subtree:$n,band:St,row:Ht,dir:Wt})}if(!we.some(Ie=>Ie.dir==="up")||!we.some(Ie=>Ie.dir==="down")||!we.some(Ie=>Ie.dir==="up"&&we.some(at=>at.dir==="down"&&at.row<Ie.row)))continue;const $e=[...we].sort((Ie,at)=>Ie.row-at.row);[...we.filter(Ie=>Ie.dir==="up"),...we.filter(Ie=>Ie.dir==="down")].sort((Ie,at)=>Ie.dir===at.dir?Ie.row-at.row:Ie.dir==="up"?-1:1).forEach((Ie,at)=>{const St=$e[at].band;if(St!==Ie.band){he.add(le.node.id);for(const Ht of Ie.subtree)X(Ht)===Ie.band&&re.set(Ht.node.id,St)}})}const dt=le=>{if(!R)return;const Le=new Set(le.map($e=>$e.node.id));let we=!1,ue=!1;for(const $e of y){if(!Le.has($e.flow.target))continue;const Fe=Ve($e.flow.source);!Fe||Fe.id===R.id||(Fe.y<R.y?we=!0:ue=!0)}return we&&!ue?"up":ue&&!we?"down":void 0};for(const le of _.nodes){if(!Ag(le.node.type))continue;const Le=le.node.lane??`pool:${b}`,we=S.get(Le);if(!we||we.size<2)continue;const ue=we.get(0);if(ue===void 0)continue;const $e=Math.max(...we.values()),Fe=ue===$e&&ue!==0?"down":void 0;if(!Fe)continue;const Ie=[];for(const Wt of _.flows){if(Wt.flow.source!==le.node.id)continue;const $t=D.get(Wt.flow.target);if(!$t||$t.node.lane!==le.node.lane||(ne.get($t.node.id)??0)!==1)continue;const Io=Re($t);Io!==void 0&&Ie.push({t:$t,subtree:ct($t.node.id),band:Io})}const at=Ie.find(Wt=>(we.get(Wt.band)??Wt.band)===ue);if(!at||dt(at.subtree)===Fe||nt(at.subtree)===Fe)continue;const St=Ie.find(Wt=>Wt!==at&&dt(Wt.subtree)===Fe);if(!St)continue;const Ht=at.band,$n=St.band;for(const Wt of at.subtree)Re(Wt)===Ht&&re.set(Wt.node.id,$n);for(const Wt of St.subtree)Re(Wt)===$n&&re.set(Wt.node.id,Ht);he.add(le.node.id)}for(const le of _.nodes){if(!Ag(le.node.type))continue;const Le=ae(le);if(Number.isNaN(Le)||E.some(Ie=>{var at,St;return(((at=Ie.placement)==null?void 0:at.anchor)??(Ie.association?Ie.association.source===Ie.annotation.id?Ie.association.target:Ie.association.source:void 0))===le.node.id&&((St=Ie.placement)==null?void 0:St.side.startsWith("bottom"))}))continue;let ue,$e=!1,Fe;for(const Ie of _.flows){if(Ie.flow.source!==le.node.id)continue;const at=D.get(Ie.flow.target);if(!at||!at.node.lane&&X(at)===void 0)continue;const St=ae(at);Number.isNaN(St)||(Math.abs(St-Le)<.5&&($e=!0),St>Le?!ue||St>ue.row?ue={id:at.node.id,row:St,count:1}:St===ue.row&&ue.count++:St<Le&&at.node.lane===le.node.lane&&(!Fe||St>Fe.row?Fe={op:at,row:St,count:1}:St===Fe.row&&Fe.count++))}ue&&ue.count===1&&(ne.get(ue.id)??0)===1&&!he.has(le.node.id)&&ve.add(ue.id),!$e&&Fe&&Fe.count===1&&(ne.get(Fe.op.node.id)??0)===1&&!et.has(le.node.id)&&se.set(Fe.op.node.id,{lane:le.node.lane,band:Re(le)})}const Et=new Map;for(const le of y)Et.set(le.flow.target,[...Et.get(le.flow.target)??[],le]);for(const le of _.nodes){const Le=Et.get(le.node.id);if(!Le||Le.length!==1||!ne.get(le.node.id)||!le.node.lane&&X(le)===void 0||yt.has(le.node.id))continue;const we=(X1=D.get(Le[0].flow.source))==null?void 0:X1.node.participant,ue=we?p(we):void 0;if(!ue||!R||ue.id===R.id)continue;const $e=le.node.lane??`pool:${b}`,Fe=S.get($e);if(!Fe)continue;const Ie=Fe.get(0)??0,at=(Fe.get(Re(le)??0)??Ie)-Ie;if(at===0)continue;const St=ue.y<R.y;if(St&&at<0||!St&&at>0)continue;let Ht;for(const[$n,Wt]of Fe){const $t=Wt-Ie;(St&&$t<0&&(!Ht||$t<Ht.row)||!St&&$t>0&&(!Ht||$t>Ht.row))&&(Ht={band:$n,row:$t})}Ht&&de.set(le.node.id,{lane:le.node.lane,band:Ht.band})}}const _e=new Set;let ye=0;for(;ye++<_.nodes.length+2;){for(let he=0;he<_.nodes.length+_.flows.length+2;he++){let Ve=!1;for(const ct of _.flows){const nt=ct.flow;if(_e.has(nt.id))continue;const dt=p(nt.source);if(!dt)continue;const Et=p(nt.target),le=D.get(nt.target);if(!Et&&le){const Le=Mg(le.node,le.band),we=Re(le);if(le.node.lane||we!==void 0){const ue=I(le.node),$e=dt,Fe=$e.x+(Me.get(nt.source)??0)+$e.width+Ee,Ie=se.get(nt.target)??de.get(nt.target),at=B(ue,Le,Ie?Ie.lane:le.node.lane,Ie?Ie.band:we,ve.has(nt.target)?$e.x+$e.width/2:Fe,Number.NaN,Ie||!vi(nt.target)?void 0:$e.y+$e.height/2),St=D.has(nt.source)?at:H(ue,Le,at),Ht=n.createShape(Le,St,ue);ve.has(nt.target)&&Me.set(nt.target,Fe-(Ht.x+Ht.width/2)),n.connect(dt,Ht,{type:"bpmn:SequenceFlow",businessObject:mp(nt)})}else s.append(dt,Le,{connection:{type:"bpmn:SequenceFlow",businessObject:mp(nt)}})}else if(Et)n.connect(dt,Et,{type:"bpmn:SequenceFlow",businessObject:mp(nt)});else continue;_e.add(nt.id),Ve=!0}if(!Ve)break}const ne=_.nodes.filter(he=>!p(he.node.id));if(!ne.length)break;const ae=ne[0];{const he=Mg(ae.node,ae.band),Ve=I(ae.node),ct=X(ae);n.createShape(he,B(Ve,he,ae.node.lane,ct,k,L),Ve),!ae.node.lane&&ct===void 0&&(L+=160)}}}const b1=new Map;for(const[b,_]of P){const R=p(b),k=p(_.flow.target);if(!(R!=null&&R.target)||!k)continue;const L=R.label&&{x:R.label.x,y:R.label.y,width:R.label.width,height:R.label.height};b1.set(b,{waypoints:R.waypoints.map(I=>({x:I.x,y:I.y})),label:L});const O=R.target,F=I=>({x:I.x+I.width/2,y:I.y+I.height/2});n.reconnect(R,k,O,[F(k),F(O)]),n.layoutConnection(R,{waypoints:[]})}const Xr=40,yp=b=>{const _=U=>U.kind==="label-over-line"||U.kind==="label-over-shape"||U.kind==="label-on-shared-segment"?U.edge===b.id:U.kind==="annotation-over-label"||U.kind==="pool-name-over-label"?U.label===b.id:!1,R=()=>new Map(ft(Ge(r)).filter(U=>!_(U)).map(U=>[lt(U),U])),k=R(),L=U=>[...U].filter(([ie])=>!k.has(ie)).map(([,ie])=>ie),O=U=>L(U).length<=[...k.keys()].filter(ie=>!U.has(ie)).length,F=b.waypoints.map(U=>({x:U.x,y:U.y})),I=b.label,B=I&&{x:I.x,y:I.y};n.layoutConnection(b,{waypoints:[]});const H=R();if(!O(H)){if(L(H).every(U=>U.kind==="edge-crosses-shape"&&U.edge===b.id)){const U=Ge(r),ie=U.edges.find(de=>de.id===b.id),pe=zn(U),ve=ie?Gt(ie,pe):[],se=ie&&ve.length&&!ve.every(de=>de.type==="bpmn:TextAnnotation")?qc(ie,pe,Yc(b),U.edges):null;if(se&&(n.updateWaypoints(b,se),O(R())))return}n.updateWaypoints(b,F),I&&B&&(I.x!==B.x||I.y!==B.y)&&n.moveElements([I],{x:B.x-I.x,y:B.y-I.y})}},x1=5,Di=10,w1=200,xc=new Set([...$.map(b=>b.flow.id),...y.map(b=>b.flow.id),...qt(e,"sequenceFlow.update").map(b=>b.id),...qt(e,"messageFlow.update").map(b=>b.id)].filter(b=>!!b)),r3=(b,_,R,k,L,O)=>{const F=new Set(b.map(ye=>ye.id)),I=Math.min(...b.map(ye=>ye.x))+_-Di,B=Math.max(...b.map(ye=>ye.x+ye.width))+_+w1+Di,H=Math.min(...b.map(ye=>ye.y+Math.min(0,...R)))-Di,U=Math.max(...b.map(ye=>ye.y+ye.height+Math.max(0,...R)))+Di,ie=r.getAll().filter(ye=>{if(ye.type!=="bpmn:SequenceFlow"&&ye.type!=="bpmn:MessageFlow")return!1;const ne=ye;return xc.has(ne.id)||!ne.waypoints||ne.waypoints.length<2||[ne.source,ne.target].some(he=>!he||F.has(he.id)||he.x>=k)?!1:ne.waypoints.some((he,Ve)=>{const ct=ne.waypoints[Ve+1];return!!ct&&Math.max(he.x,ct.x)>=I&&Math.min(he.x,ct.x)<=B&&Math.max(he.y,ct.y)>=H&&Math.min(he.y,ct.y)<=U})});if(!ie.length)return 0;const pe=ye=>{const ne=new Map;for(const ae of b)for(const he of R){const Ve={id:ae.id,type:ae.type,x:ae.x+_+ye,y:ae.y+he,width:ae.width,height:ae.height};for(const ct of ie){let nt=1/0;for(let Et=0;Et+1<ct.waypoints.length;Et++)nt=Math.min(nt,ya(ct.waypoints[Et],ct.waypoints[Et+1],Ve));const dt=`${ct.id}|${ae.id}`;ne.set(dt,Math.min(ne.get(dt)??1/0,nt))}}return ne},ve=[...pe(0)].filter(([,ye])=>ye<=x1).map(([ye])=>ye);if(!ve.length)return 0;let se=0;for(let ye=1;ye<=w1;ye++){const ne=pe(ye);if([...ne.values()].every(ae=>ae>x1)&&ve.every(ae=>(ne.get(ae)??1/0)>=Di)){se=ye;break}}if(!se)return 0;const de=Math.min(...b.map(ye=>ye.x))+_+se,Me=new Set(ve.map(ye=>ye.slice(0,ye.indexOf("|"))));return ie.some(ye=>ye.type==="bpmn:SequenceFlow"&&Me.has(ye.id)&&ye.waypoints.some((ne,ae)=>{const he=ye.waypoints[ae+1];if(!he||Math.min(ne.y,he.y)>O||Math.max(ne.y,he.y)<O||ne.y===he.y)return!1;const Ve=ne.x+(O-ne.y)*(he.x-ne.x)/(he.y-ne.y);return Ve>L&&Ve<de}))?0:se},Zr=(b,_=()=>!0)=>{const R=p(b);if(!R)return[];const k=[R],L=new Set([b]);for(let O=0;O<k.length;O++){const F=k[O].id;for(const I of $){const B=I.flow.target;if(I.flow.source!==F||L.has(B)||!D.has(B))continue;L.add(B);const H=p(B);H&&_(H)&&k.push(H)}}return k},a3=(b,_=()=>!0)=>{const R=p(b);if(!R)return[];const k=[R],L=new Set([b]);for(let O=0;O<k.length;O++){const F=k[O].id;for(const I of $){const B=I.flow.source;if(I.flow.target!==F||L.has(B)||!D.has(B))continue;L.add(B);const H=p(B);H&&_(H)&&k.push(H)}}return k},Li=30,Ii=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",Ja=(b,_)=>Ef(n,b,_),es=(b,_,R=!1)=>{const k=new Set(b.flatMap(B=>B.subtree.map(H=>H.id)));for(const B of b){const H=(B.pool.children??[]).filter(Ii).filter(ie=>!k.has(ie.id));if(B.subtree.some(ie=>H.some(pe=>ie.x+_<pe.x+pe.width+Li&&ie.x+_+ie.width+Li>pe.x&&ie.y<pe.y+pe.height&&ie.y+ie.height>pe.y)))return null}const L=b.map(B=>B.pool.width),O=R?r.filter(B=>Array.isArray(B.waypoints)).map(B=>({c:B,wps:B.waypoints.map(H=>({x:H.x,y:H.y}))})):[],F=r.filter(B=>B.type==="label").map(B=>({label:B,x:B.x,y:B.y}));n.moveElements(b.flatMap(B=>B.subtree),{x:_,y:0});const I=b.map(B=>{const U=Math.max(...B.subtree.map(ie=>ie.x+ie.width))+Ay-(B.pool.x+B.pool.width);return U>0&&Ja(B.pool,B.pool.width+U),U});return()=>{n.moveElements(b.flatMap(B=>B.subtree),{x:-_,y:0}),b.forEach((B,H)=>{I[H]>0&&Ja(B.pool,L[H])});for(const{c:B,wps:H}of O){const U=B.waypoints??[];U.length===H.length&&U.every((pe,ve)=>Math.abs(pe.x-H[ve].x)<=.5&&Math.abs(pe.y-H[ve].y)<=.5)||n.updateWaypoints(B,H.map(pe=>({x:pe.x,y:pe.y})))}for(let B=0;B<3;B++){let H=0;for(const U of F){const ie=U.x-U.label.x,pe=U.y-U.label.y;Math.abs(ie)<=.5&&Math.abs(pe)<=.5||(n.moveElements([U.label],{x:ie,y:pe}),H++)}if(!H)break}}},Pg=b=>{var L,O;const _=new Map,R=new Map;for(const F of r.getAll()){if(F.type!=="bpmn:Participant")continue;const I=F;(I.children??[]).length||(_.set(I.id,I),R.set(I.id,[]))}for(const F of r.getAll()){if(F.type!=="bpmn:MessageFlow")continue;const I=F,B=(L=I.source)==null?void 0:L.id,H=(O=I.target)==null?void 0:O.id;B&&H&&R.has(B)&&R.get(B).push(H),B&&H&&R.has(H)&&R.get(H).push(B)}const k=[];for(const[F,I]of R)I.length&&I.every(B=>b.has(B))&&k.push(_.get(F));return k},_1=(b,_)=>{if(!b.length)return null;const R=new Set(b.map(U=>U.id)),k=r.getAll().filter(U=>U.type==="bpmn:Participant"&&!R.has(U.id)),L=Math.min(...k.filter(U=>(U.children??[]).length>0).map(U=>U.x)),O=new Set(b.filter(U=>Math.abs(U.x-L)<=2).map(U=>U.id));if(b.some(U=>{const ie=O.has(U.id)?U.x:U.x+_,pe=O.has(U.id)?U.width+_:U.width;return k.some(ve=>ie<ve.x+ve.width+Li&&ie+pe+Li>ve.x&&U.y<ve.y+ve.height&&U.y+U.height>ve.y)}))return null;const I=r.filter(U=>U.type==="label").map(U=>({label:U,x:U.x,y:U.y})),B=b.filter(U=>!O.has(U.id)),H=b.filter(U=>O.has(U.id)).map(U=>({pool:U,was:{x:U.x,y:U.y,width:U.width,height:U.height}}));B.length&&n.moveElements(B,{x:_,y:0});for(const{pool:U,was:ie}of H)n.resizeShape(U,{...ie,width:ie.width+_});return()=>{for(const{pool:U,was:ie}of H)n.resizeShape(U,ie);B.length&&n.moveElements(B,{x:-_,y:0});for(let U=0;U<3;U++){let ie=0;for(const pe of I){const ve=pe.x-pe.label.x,se=pe.y-pe.label.y;Math.abs(ve)<=.5&&Math.abs(se)<=.5||(n.moveElements([pe.label],{x:ve,y:se}),ie++)}if(!ie)break}}},E1=(b,_,R)=>{const k=R.x+R.width/2,L=_.y>R.y,O=L?R.y+R.height:R.y,F=L?_.y:_.y+_.height,I=b.source===_?[{x:k,y:F},{x:k,y:O}]:[{x:k,y:O},{x:k,y:F}],B=Ge(r),H={...B.edges.find(U=>U.id===b.id),waypoints:I};return Gt(H,zn(B)).length?!1:(n.updateWaypoints(b,I),!0)},s3=()=>{const b=r.filter(F=>F.type==="bpmn:Participant"),_=Math.min(...b.filter(F=>(F.children??[]).length>0).map(F=>F.x)),R=F=>h.some(I=>I.participant.id===F.id),k=F=>!!F&&F.type==="bpmn:Participant"&&!(F.children??[]).length&&Math.abs(F.x-_)<=2&&!R(F),L=F=>!!F&&F.type==="bpmn:Participant"&&(F.children??[]).length>0&&!R(F),O=new Set;for(const F of r.getAll()){if(F.type!=="bpmn:MessageFlow")continue;const I=F;if((I.waypoints??[]).length!==2)continue;const B=[I.source,I.target].find(ie=>k(ie)||L(ie)),H=B===I.source?I.target:I.source;if(!B||!H||H.type==="bpmn:Participant")continue;const U=H.x+H.width/2;L(B)&&(U<B.x||U>B.x+B.width)||O.add(I.id)}return O},c3=b=>{var R;const _=new Map;for(const k of b){const L=r.get(k);if(!L||(L.waypoints??[]).length===2)continue;const O=((R=L.source)==null?void 0:R.type)==="bpmn:Participant"?L.source:L.target,F=O===L.source?L.target:L.source;if(F.x+F.width/2<=O.x+O.width)continue;const I=_.get(O.id)??{pool:O,msgs:[]};I.msgs.push({conn:L,other:F}),_.set(O.id,I)}for(const{pool:k,msgs:L}of _.values()){const O=Math.max(...L.map(({other:se})=>se.x+se.width/2))+wf;if(r.getAll().some(se=>{if(se.type!=="bpmn:Participant"||se.id===k.id)return!1;const de=se;return k.x<de.x+de.width+Li&&O+Li>de.x&&k.y<de.y+de.height&&k.y+k.height>de.y}))continue;const I={x:k.x,y:k.y,width:k.width,height:k.height},B=[...k.incoming??[],...k.outgoing??[]],H=B.map(se=>({c:se,wps:(se.waypoints??[]).map(de=>({x:de.x,y:de.y}))})),U=B.flatMap(se=>{const de=se.label;return de?[{label:de,x:de.x,y:de.y}]:[]}),ie=wr();Ja(k,O-k.x);const pe=L.filter(({conn:se,other:de})=>E1(se,k,de)).length,ve=wr();if(!(pe>0&&ve.messages>ie.messages&&ve.lines>=ie.lines)){Ja(k,I.width);for(const{c:se,wps:de}of H){const Me=se.waypoints??[];Me.length===de.length&&Me.every((ye,ne)=>Math.abs(ye.x-de[ne].x)<=.5&&Math.abs(ye.y-de[ne].y)<=.5)||n.updateWaypoints(se,de.map(ye=>({x:ye.x,y:ye.y})))}for(let se=0;se<3;se++){let de=0;for(const Me of U){const _e=Me.x-Me.label.x,ye=Me.y-Me.label.y;Math.abs(_e)<=.5&&Math.abs(ye)<=.5||(n.moveElements([Me.label],{x:_e,y:ye}),de++)}if(!de)break}}}},S1=()=>{let b=0;for(const _ of r.getAll()){if(_.type!=="bpmn:DataInputAssociation"&&_.type!=="bpmn:DataOutputAssociation")continue;const R=_.waypoints??[];for(let k=1;k<R.length;k++)b+=Math.hypot(R[k].x-R[k-1].x,R[k].y-R[k-1].y)}return b},R1=()=>{let b=0;for(const _ of r.getAll()){if(_.type!=="bpmn:Association")continue;const R=_.waypoints??[];for(let k=1;k<R.length;k++)b+=Math.hypot(R[k].x-R[k-1].x,R[k].y-R[k-1].y)}return b},l3=b=>{const _=[];for(const R of r.getAll()){if(R.type!=="bpmn:TextAnnotation")continue;const k=R;if(b.has(k.id))continue;const O=[...k.incoming??[],...k.outgoing??[]].filter(B=>B.type==="bpmn:Association").map(B=>B.source===k?B.target:B.source);if(!O.length||O.some(B=>B===void 0))continue;const F=B=>{if(!("waypoints"in B&&B.waypoints))return[B.id];const H=B,U=[H.source,H.target];return U.some(ie=>!ie)?[]:U.map(ie=>ie.id)},I=O.flatMap(B=>F(B));I.length&&I.every(B=>b.has(B))&&_.push(k)}return _},C1=()=>ft(Ge(r)).filter(b=>b.kind==="edge-crosses-shape").length,M1=b=>{const _=(b.children??[]).filter(Ii);let R=0;for(let k=0;k<_.length;k++)for(let L=k+1;L<_.length;L++){const O=_[k],F=_[L];O.x<F.x+F.width&&O.x+O.width>F.x&&O.y<F.y+F.height&&O.y+O.height>F.y&&R++}return R},wr=()=>{const b=Ge(r),_=R=>R.length>=2&&(R.every(k=>Math.abs(k.x-R[0].x)<.01)||R.every(k=>Math.abs(k.y-R[0].y)<.01));return{messages:b.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length,lines:b.edges.filter(R=>_(R.waypoints)).length}},A1=b=>{const _=new Map;for(const k of r.getAll()){if(k.type!=="bpmn:MessageFlow")continue;const L=k;if(!L.waypoints||L.waypoints.length!==2)continue;const O=L.source,F=L.target;if(!O||!F)continue;const I=b.has(O.id);if(I===b.has(F.id))continue;const B=I?F:O,H=d(B);if(!H||b.has(B.id))continue;const U=_.get(H.id);U?B.x<U.minX&&(U.minX=B.x):_.set(H.id,{pool:H,minX:B.x})}const R=[];for(const{pool:k,minX:L}of _.values()){const O=(k.children??[]).filter(F=>Ii(F)&&!b.has(F.id)&&F.x>=L);O.length&&R.push({subtree:O,pool:k})}return R},u3=(b,_,R)=>{const k=new Map(_.map(F=>[F.pool.id,{subtree:[...F.subtree],pool:F.pool}])),L=new Set(b);for(const F of _)for(const I of F.subtree)L.add(I.id);let O=!1;for(;;){let F=0;for(const I of A1(L)){if(I.pool===R)continue;const B=k.get(I.pool.id);B?B.subtree.push(...I.subtree):k.set(I.pool.id,{subtree:[...I.subtree],pool:I.pool});for(const H of I.subtree)L.add(H.id);F+=I.subtree.length}if(!F)break;O=!0}return O?[...k.values()]:null},p3=(b,_)=>{const R=new Map;for(const L of r.getAll()){if(L.type!=="bpmn:DataInputAssociation"&&L.type!=="bpmn:DataOutputAssociation")continue;const O=L,F=O.waypoints;if(!F||F.length<2||!F.every(ve=>Math.abs(ve.x-F[0].x)<1))continue;const I=O.source,B=O.target;if(!I||!B)continue;const H=b.has(I.id);if(H===b.has(B.id))continue;const U=H?B:I,ie=d(U);if(!ie||ie===_||ie===d(H?I:B))continue;const pe=R.get(ie.id);pe?U.x<pe.minX&&(pe.minX=U.x):R.set(ie.id,{pool:ie,minX:U.x})}const k=[];for(const{pool:L,minX:O}of R.values()){const F=(L.children??[]).filter(I=>Ii(I)&&!b.has(I.id)&&I.x>=O);F.length&&k.push({subtree:F,pool:L})}return k},P1=b=>{const _=Ge(r),R=_.shapes.filter(L=>b.has(L.id)),k=new Set;for(const L of _.edges)if(!(L.type!=="bpmn:SequenceFlow"&&L.type!=="bpmn:MessageFlow"))for(const O of Gt(L,R))k.add(`${L.id}|${O.id}`);return k},Tg=new Map,f3=qt(e,"sequenceFlow.update").flatMap(b=>{if(b.target!==void 0)return[{id:b.id,target:b.target,source:b.source}];const _=P.get(b.id);return _?[{id:b.id,target:_.flow.target,source:_.flow.source}]:[]});for(const b of f3){if(b.target===void 0)continue;const _=D.get(b.target);if(!_)continue;const R=p(b.target),k=p(b.id);if(!R||!k)continue;const L=b.source!==void 0?p(b.source):k.source,O=k.target;if(!L||!O||O.id===R.id)continue;const F=b1.get(k.id)??{waypoints:k.waypoints,label:k.label},I=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,B=I?F.waypoints[1].y:void 0,H=I&&F.label?{x:F.label.x,y:F.label.y}:void 0,U=H&&F.label&&Math.abs(H.y+F.label.height/2-B)<=ee/5&&H.x+F.label.width>I.x?H.x+F.label.width+6:void 0,ie=(L.outgoing??[]).filter(Oe=>Oe.type==="bpmn:SequenceFlow"&&Oe.id!==k.id&&Oe.target&&!xc.has(Oe.id)),pe=new Set(ie.map(Oe=>Oe.target.id)),ve=Oe=>{const Tt={type:"bpmn:Task",x:Oe.x+2,y:Oe.y+2,width:Oe.width-4,height:Oe.height-4};return ie.find(Rt=>(Rt.waypoints??[]).some((hn,De)=>!!Rt.waypoints[De+1]&&ya(hn,Rt.waypoints[De+1],Tt)===0))},se=Zr(b.target),de=new Set(se.map(Oe=>Oe.id)),Me=ui.has(b.target)?{autoResize:!1}:void 0,_e=Math.min(...se.map(Oe=>Oe.x)),ye=Math.max(...se.map(Oe=>Oe.x+Oe.width)),ne=L.x+L.width,ae=O.x+O.width<=L.x,he=(()=>{if(!ae)return;const Oe=d(R),Tt=((Oe==null?void 0:Oe.children)??[]).filter(Ne=>Ii(Ne)&&!de.has(Ne.id)&&Ne.type!=="bpmn:Group"&&Ne.type!=="bpmn:Participant"),Rt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],hn=r.getAll().filter(Ne=>{if(!Rt.includes(Ne.type))return!1;const Ft=Ne;return Ft.id===k.id||xc.has(Ft.id)||!Ft.waypoints||Ft.waypoints.length<2?!1:![Ft.source,Ft.target].some(kt=>!kt||de.has(kt.id))}),De=(Ne,Ft)=>se.every(kt=>{var ta;const wt={id:kt.id,type:kt.type,x:kt.x+Ne,y:kt.y+Ft,width:kt.width,height:kt.height};return Oe&&(wt.x<Oe.x||wt.x+wt.width>Oe.x+Oe.width||wt.y<Oe.y||wt.y+wt.height>Oe.y+Oe.height)||!uo((ta=D.get(kt.id))==null?void 0:ta.node.lane,kt,kt.y+Ft+kt.height/2)||Tt.some(Kn=>wt.x<Kn.x+Kn.width+Di&&wt.x+wt.width+Di>Kn.x&&wt.y<Kn.y+Kn.height+Di&&wt.y+wt.height+Di>Kn.y)?!1:hn.every(Kn=>{for(let fo=0;fo+1<Kn.waypoints.length;fo++)if(ya(Kn.waypoints[fo],Kn.waypoints[fo+1],wt)<Di)return!1;return!0})}),Ze=L.x+L.width/2,xt=L.y+L.height/2,Qe=F.waypoints??[],Pt=Qe.length>=2&&Math.abs(Qe[0].y-Qe[1].y)<1&&Qe[1].x<Qe[0].x;return[...B!==void 0?[{cx:Ze,cy:B}]:[],...Pt?[{cx:L.x-Xr-R.width/2,cy:Qe[0].y}]:[],{cx:Ze,cy:xt+ee},{cx:Ze,cy:xt-ee}].find(Ne=>De(Ne.cx-(R.x+R.width/2),Ne.cy-(R.y+R.height/2)))})(),Ve=ae&&!he?ne:O.x,ct=R.y+R.height/2,nt=r3(se,ne+Xr-_e,[0,L.y+L.height/2-ct,O.y+O.height/2-ct],Ve,ne,L.y+L.height/2),dt=ne+Xr+nt,Et=(()=>{if(U===void 0)return 0;const Oe=ne+Xr,Tt=L.y+L.height/2-R.height/2,Rt={x:Oe,y:Tt,width:ye-_e,height:R.height},hn=d(L);return((hn==null?void 0:hn.children)??[]).some(Ze=>Ii(Ze)&&!de.has(Ze.id)&&Ze.id!==L.id&&Ze.id!==O.id&&Ze.type!=="bpmn:Group"&&Ze.type!=="bpmn:Participant"&&Ze.x<Rt.x+Rt.width&&Ze.x+Ze.width>Rt.x&&Ze.y<Rt.y+Rt.height&&Ze.y+Ze.height>Rt.y)||ve(Rt)?Math.max(0,U-Oe):0})(),le=he?0:ye-_e+Xr*2+nt+Et-(ae?0:O.x-ne);let Le=[];if(le>0){const Oe=d(R),Tt=(Oe==null?void 0:Oe.children)??[],Rt=Qe=>Qe.type==="bpmn:Lane";Le=(()=>{const Qe=new Set;for(const He of Tt)Ii(He)&&!de.has(He.id)&&He.id!==L.id&&He.x>=Ve&&Qe.add(He.id);const Pt=[];for(const He of Tt){if(He.type!=="bpmn:DataStoreReference"&&He.type!=="bpmn:DataObjectReference")continue;const Ne=He,kt=[...Ne.incoming??[],...Ne.outgoing??[]].filter(wt=>wt.type==="bpmn:DataInputAssociation"||wt.type==="bpmn:DataOutputAssociation").map(wt=>wt.source===Ne?wt.target:wt.source);kt.length&&kt.every(wt=>wt!==void 0&&Qe.has(wt.id))&&Pt.push(Ne)}return Pt})();const De=Tt.filter(Qe=>!("waypoints"in Qe&&Qe.waypoints)&&!Rt(Qe)&&Qe.type!=="label"&&!de.has(Qe.id)&&Qe.id!==L.id&&Qe.x>=Ve),Ze=De.flatMap(Qe=>Qe.labels??[]),xt=Oe?[Oe,...Tt.filter(Qe=>Rt(Qe))]:[];if(De.length){const Qe=new Set(De.map(tt=>tt.id)),Pt=A1(Qe),He=Pt.length?u3(Qe,Pt,Oe):null,Ne=tt=>{const _t=new Set(Qe);for(const jt of tt)for(const Bo of jt.subtree)_t.add(Bo.id);return l3(_t)},Ft=Ne(Pt),kt=He?Ne(He):Ft,wt=Pg(Qe),ta=new Set(Qe);for(const tt of Pt)for(const _t of tt.subtree)ta.add(_t.id);const Kn=Pt.length?Pg(ta):wt,fo=(()=>{if(!He)return[];const tt=new Set(Qe);for(const _t of He)for(const jt of _t.subtree)tt.add(jt.id);return Pg(tt)})(),is=He??Pt,na=(()=>{const tt=new Set(Qe);for(const _t of is)for(const jt of _t.subtree)tt.add(jt.id);return p3(tt,Oe)})(),Ng=na.length?Ne([...is,...na]):Ft,Wi=new Set([...De,...xt].map(tt=>tt.id)),vt=Tt.filter(tt=>{const _t=tt.labelTarget;return tt.type==="label"&&!!_t&&"waypoints"in _t&&!!_t.source&&!!_t.target&&Wi.has(_t.source.id)&&Wi.has(_t.target.id)}),En=s3();n.createSpace([...De,...Ze,...vt],xt,{x:le,y:0},"e",Ve-1);const Qt=(tt,_t,jt)=>{const Bo=wr(),Ep=jt?P1(jt):null,Sp=es(tt,le,!!jt);if(!Sp)return!1;const Ec=_t.length?_1(_t,le):null,Rp=wr(),Jt=!!jt&&!!Ep&&[...P1(jt)].some(oa=>!Ep.has(oa));return Rp.messages>Bo.messages&&Rp.lines>=Bo.lines&&!Jt?!0:(Ec==null||Ec(),Sp(),!1)},pi=na.length>0&&Qt([...is,...na],He?fo:Kn,new Set(na.flatMap(tt=>tt.subtree.map(_t=>_t.id)))),ia=!pi&&He?Qt(He,fo):!1;let ho=pi||ia;!ho&&Pt.length&&(ho=Qt(Pt,Kn));const os=pi?Ng:ia?kt:Ft;if(!ho){for(const tt of Pt){const _t=wr(),jt=es([tt],le);if(!jt)continue;const Bo=wr();(Bo.messages<=_t.messages||Bo.lines<_t.lines)&&jt()}if(wt.length){const tt=wr(),_t=_1(wt,le);if(_t){const jt=wr();(jt.messages<=tt.messages||jt.lines<tt.lines)&&_t()}}}if(c3(En),os.length){const tt=()=>new Set(ft(Ge(r)).map(jt=>lt(jt))),_t=jt=>{const Bo=R1(),Ep=tt(),Sp=jt.map(Jt=>({a:Jt,x:Jt.x,y:Jt.y})),Ec=r.filter(Jt=>Jt.type==="label").map(Jt=>({label:Jt,x:Jt.x,y:Jt.y}));n.moveElements(jt,{x:le,y:0});const Rp=[...tt()].filter(Jt=>!Ep.has(Jt));if(R1()<Bo&&Rp.length===0)return!0;for(const{a:Jt,x:oa,y:Sc}of Sp)(Jt.x!==oa||Jt.y!==Sc)&&n.moveElements([Jt],{x:oa-Jt.x,y:Sc-Jt.y});for(const Jt of Ec){const oa=Jt.x-Jt.label.x,Sc=Jt.y-Jt.label.y;(oa!==0||Sc!==0)&&n.moveElements([Jt.label],{x:oa,y:Sc})}return!1};if(!_t(os)&&os.length>1)for(const jt of os)_t([jt])}}}const we=_.node.lane!==void 0?p(_.node.lane):_.node.participant!==void 0?p(_.node.participant):void 0,ue=Oe=>{if(!we)return!0;const Tt=Oe.y+Oe.height/2;return Tt>=we.y&&Tt<=we.y+we.height},$e=!ue(L)&&ue(O),Fe=Oe=>Oe.y+Oe.height/2,Ie=()=>{const Oe=L.x+L.width,Tt=O.x,Rt=Fe(O)-R.height/2,hn=Fe(O)+R.height/2;return!r.getAll().some(De=>Ii(De)&&De.type!=="bpmn:Participant"&&De.type!=="bpmn:Group"&&De.type!=="bpmn:TextAnnotation"&&De.id!==L.id&&De.id!==O.id&&De.id!==R.id&&De.x<Tt&&De.x+De.width>Oe&&De.y<hn&&De.y+De.height>Rt)},at=!$e&&_.band!==void 0&&ue(O)&&!bt(_.node.lane,_.node.participant,_.band,Fe(L))&&bt(_.node.lane,_.node.participant,_.band,Fe(O))&&O.x>=L.x+L.width&&Ie(),St=$e||at?O:L,Ht=St.y+St.height/2,$n=Ht-(R.y+R.height/2),Wt=_.band!==void 0,$t=Wt?[R]:se,Io=(_.band===void 0||bt(_.node.lane,_.node.participant,_.band,Ht))&&vi(b.target)&&$t.every(Oe=>{var Tt;return uo((Tt=D.get(Oe.id))==null?void 0:Tt.node.lane,Oe,Oe.y+Oe.height/2+$n)}),I3=Oe=>Math.abs(Oe.y+Oe.height/2-(R.y+R.height/2))<=ee/2;if(Io&&Wt){const Oe=Math.abs($n)<=ee/2?se.filter(De=>De.id!==R.id&&I3(De)):[],Tt=R.y+R.height/2,hn=_.band!==void 0&&!bt(_.node.lane,_.node.participant,_.band,Tt)?se.filter(De=>{var Ze,xt;return De.id!==R.id&&!Oe.includes(De)&&((Ze=D.get(De.id))==null?void 0:Ze.band)===_.band&&((xt=D.get(De.id))==null?void 0:xt.node.lane)===_.node.lane&&(Math.abs(De.y+De.height/2-Tt)<=ee/2||bt(_.node.lane,_.node.participant,_.band,De.y+De.height/2))}).map(De=>({t:De,dy:Ht-(De.y+De.height/2)})).filter(({dy:De})=>De!==0):[];if(n.moveElements(se,{x:dt-_e,y:0},void 0,Me),n.moveElements([R],{x:0,y:$n},void 0,Me),Oe.length){const De=()=>new Set(ft(Ge(r)).map(Ne=>lt(Ne))),Ze=De(),xt=r.filter(Ne=>Ne.type==="label").map(Ne=>({label:Ne,x:Ne.x,y:Ne.y}));n.moveElements(Oe,{x:0,y:$n});const Qe=De(),Pt=[...Qe].filter(Ne=>!Ze.has(Ne)).length,He=[...Ze].filter(Ne=>!Qe.has(Ne)).length;if(Pt>He){n.moveElements(Oe,{x:0,y:-$n});for(const Ne of xt){const Ft=Ne.x-Ne.label.x,kt=Ne.y-Ne.label.y;(Ft!==0||kt!==0)&&n.moveElements([Ne.label],{x:Ft,y:kt})}}}if(hn.length){const De=new Set(se.map(Ze=>Ze.id));for(const{t:Ze,dy:xt}of hn)ke(Ze.parent,Ze,Ze.x+Ze.width/2,Ze.y+Ze.height/2+xt,De)||n.moveElements([Ze],{x:0,y:xt})}}else n.moveElements(se,{x:dt-_e,y:Io?$n:0},void 0,Me);const Vi=d(R);if(!Io&&_.node.lane===void 0&&_.band!==void 0&&Vi){const Oe=Vi.y+Pe+It(`pool:${_.node.participant??""}`,_.band)*ee,Tt=Oe-(R.y+R.height/2);Tt!==0&&!ke(Vi,R,R.x+R.width/2,Oe,de)&&n.moveElements([R],{x:0,y:Tt},void 0,Me)}if(he)n.moveElements(se,{x:he.cx-(R.x+R.width/2),y:he.cy-(R.y+R.height/2)},void 0,Me);else if(Vi){const Oe=(Vi.children??[]).filter(De=>Ii(De)&&!de.has(De.id)&&De.type!=="bpmn:Group"&&De.type!=="bpmn:Participant"),Tt=(De,Ze,xt,Qe,Pt)=>De.x+Ze<Pt.x+Pt.width+Qe&&De.x+Ze+De.width+Qe>Pt.x&&De.y+xt<Pt.y+Pt.height+Qe&&De.y+xt+De.height+Qe>Pt.y,Rt=Oe.find(De=>Tt(R,0,0,0,De)),hn=Rt?void 0:ve(R);if(Rt||hn){const De=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Ze=r.getAll().filter(vt=>{if(!De.includes(vt.type))return!1;const En=vt;return xc.has(En.id)||!En.waypoints||En.waypoints.length<2?!1:![En.source,En.target].some(Qt=>!Qt||de.has(Qt.id))}),xt=(vt,En,Qt)=>{var pi;return uo((pi=D.get(vt.id))==null?void 0:pi.node.lane,vt,vt.y+Qt+vt.height/2)&&vt.x+En>=Vi.x&&vt.x+En+vt.width<=Vi.x+Vi.width&&vt.y+Qt>=Vi.y&&vt.y+Qt+vt.height<=Vi.y+Vi.height},Qe=(vt,En)=>se.every(Qt=>xt(Qt,vt,En)&&!Oe.some(pi=>Tt(Qt,vt,En,Di,pi))&&Ze.every(pi=>{const ia={id:Qt.id,type:Qt.type,x:Qt.x+vt,y:Qt.y+En,width:Qt.width,height:Qt.height};for(let ho=0;ho+1<pi.waypoints.length;ho++)if(ya(pi.waypoints[ho],pi.waypoints[ho+1],ia)<Di)return!1;return!0})),Pt=R.y+R.height/2,He=[B,O.y+O.height/2].filter(vt=>vt!==void 0&&Math.abs(vt-Pt)>=1),Ne=Rt&&pe.has(Rt.id)?Rt:hn==null?void 0:hn.target,Ft=Ne?Ne.x-R.x:0,kt=Math.max(...se.map(vt=>vt.x+vt.width)),wt=[...Ft!==0?[Ft]:[],...nt!==0?[-nt]:[],0],ta=U===void 0?[]:wt.map(vt=>Math.max(vt,U-R.x)),Kn=vt=>kt+vt+Xr<=O.x,fo=[...new Set([...ta,...wt])].filter(Kn),is=Rt&&pe.has(Rt.id)?[Rt.x+Rt.width+Xr-R.x]:[],na=U===void 0?[]:is.map(vt=>Math.max(vt,U-R.x)),Ng=[...new Set([...na,...is])].filter(vt=>Kn(vt)&&!fo.includes(vt));let Wi;for(const vt of[fo,Ng]){for(const En of He){for(const Qt of vt)if(Qe(Qt,En-Pt)){Wi={dx:Qt,dy:En-Pt};break}if(Wi)break}if(Wi)break}if(Wi){const vt=tt=>{const _t=tt;return[_t.edge,_t.other,...Array.isArray(_t.edges)?_t.edges:[]].some(jt=>typeof jt=="string"&&xc.has(jt))},En=()=>new Set(ft(Ge(r)).filter(tt=>!vt(tt)).map(tt=>lt(tt))),Qt=En(),pi=r.filter(tt=>tt.type==="label").map(tt=>({label:tt,x:tt.x,y:tt.y}));n.moveElements(se,{x:Wi.dx,y:Wi.dy},void 0,Me);const ia=En(),ho=[...ia].filter(tt=>!Qt.has(tt)).length,os=[...Qt].filter(tt=>!ia.has(tt)).length;if(ho>os){n.moveElements(se,{x:-Wi.dx,y:-Wi.dy},void 0,Me);for(const tt of pi){const _t=tt.x-tt.label.x,jt=tt.y-tt.label.y;(_t!==0||jt!==0)&&n.moveElements([tt.label],{x:_t,y:jt})}}else I&&Tg.set(k.id,{exit:I,channelY:B,label:H})}}}{const Oe=new Set(se.map(Ze=>Ze.id)),Tt=new Set($.map(Ze=>Ze.flow.id)),Rt=20,hn=Ze=>{const xt=Ze.source,Qe=Ze.target,Pt=Math.min(xt.x,Qe.x)-Rt,He=Math.max(xt.x+xt.width,Qe.x+Qe.width)+Rt,Ne=Math.min(xt.y,Qe.y)-Rt,Ft=Math.max(xt.y+xt.height,Qe.y+Qe.height)+Rt;return Ze.waypoints.some(kt=>kt.x<Pt||kt.x>He||kt.y<Ne||kt.y>Ft)},De=new Map;for(const Ze of se)for(const xt of[...Ze.incoming??[],...Ze.outgoing??[]])(P.has(xt.id)||xt.id!==b.id&&Tt.has(xt.id))&&!(Oe.has(xt.source.id)&&Oe.has(xt.target.id))&&De.set(xt.id,xt);for(const Ze of De.values())hn(Ze)&&yp(Ze)}const po=Le.length?d(Le[0]):void 0;if(po){const Oe={assoc:S1(),overlaps:M1(po),crosses:C1()},Tt=Le.map(He=>({st:He,x:He.x})),Rt=r.filter(He=>He.type==="label").map(He=>({label:He,x:He.x,y:He.y})),hn=Math.min(...Le.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))),De=new Set(Le.map(He=>He.id)),Ze=(po.children??[]).filter(Ii).filter(He=>!De.has(He.id));let xt=hn;for(const He of[...Le].sort((Ne,Ft)=>Ne.x-Ft.x)){let Ne=xt;for(let Ft=0;Ft<100;Ft++){const kt=Ze.find(wt=>Ne<wt.x+wt.width+Li&&Ne+He.width+Li>wt.x&&He.y<wt.y+wt.height&&He.y+He.height>wt.y);if(!kt)break;Ne=kt.x+kt.width+Li}Ne!==He.x&&n.moveElements([He],{x:Ne-He.x,y:0}),xt=Ne+He.width+Li}const Qe=xt+150-(po.x+po.width);Qe>0&&Ja(po,po.width+Qe);const Pt={assoc:S1(),overlaps:M1(po),crosses:C1()};if(Pt.assoc>=Oe.assoc||Pt.overlaps>Oe.overlaps||Pt.crosses>Oe.crosses){for(const{st:He,x:Ne}of Tt)He.x!==Ne&&n.moveElements([He],{x:Ne-He.x,y:0});Qe>0&&Ja(po,po.width-Qe);for(const He of Rt){const Ne=He.x-He.label.x,Ft=He.y-He.label.y;(Ne!==0||Ft!==0)&&n.moveElements([He.label],{x:Ne,y:Ft})}}}}for(const[b,_]of ui){const R=p(b);if(!R)continue;const k=_.container,L=Math.abs(R.y+R.height/2-k.y-_.relCy)>=.5,O=R.label,F=Math.min(R.y,O&&!O.hidden?O.y:R.y),I=Math.max(R.y+R.height,O&&!O.hidden?O.y+O.height:0);if(L&&F>=k.y&&I<=k.y+k.height)continue;const B=R.y;_.grow(),R.y!==B&&n.moveElements([R],{x:0,y:B-R.y},void 0,{autoResize:!1})}const T1=(b,_)=>{const R=_.target===b,k=f(_.source),L=f(_.target),O=R?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(k,L,_.id?{type:O,businessObject:i.create(O,{id:_.id})}:{type:O})},k1=b=>{for(const _ of h){if(!_.participant.blackBox)continue;const R=p(_.participant.id);if(!R)continue;const k=[];for(const O of y){const F=O.flow.source===_.participant.id?O.flow.target:O.flow.target===_.participant.id?O.flow.source:void 0,I=F?p(F):void 0;I&&typeof I.x=="number"&&I.type!=="bpmn:Participant"&&k.push(I)}if(!k.length)continue;if(!b&&_.order===void 0){const O=(()=>{var I;const F=new Map;for(const B of k){const H=d(B);if(!H)continue;const U=F.get(H.id);U?U.n+=1:F.set(H.id,{shape:H,n:1})}return(I=[...F.values()].sort((B,H)=>H.n-B.n)[0])==null?void 0:I.shape})();if(O){const F=H=>H.reduce((U,ie)=>U+ie,0)/H.length,I=F(k.map(H=>H.y+H.height/2))<O.y+O.height/2,B=r.filter(H=>H.type==="bpmn:Participant"&&H.id!==_.participant.id&&H.id!==O.id).filter(H=>I?H.y+H.height<=O.y+5:H.y>=O.y+O.height-5);if(B.length){const H=[...B.reduce((ae,he)=>ae.set(he.y,(ae.get(he.y)??0)+1),new Map)].sort((ae,he)=>he[1]-ae[1]||(I?he[0]-ae[0]:ae[0]-he[0]))[0][0],U=Math.min(R.width,DM),ie=LM,pe=k.map(ae=>ae.x+ae.width/2),ve=Math.round(F(pe)-U/2),se=Math.max(...pe)+wf,de=ae=>({x:ae,width:Math.max(U,se-ae)}),Me=B.filter(ae=>Math.min(ae.y+ae.height,H+ie)-Math.max(ae.y,H)>0),_e=ae=>{const he=de(ae);return Me.some(Ve=>Ve.x<he.x+he.width&&he.x<Ve.x+Ve.width)},ye=ae=>{const he=de(ae);return pe.filter(Ve=>Ve>=he.x+10&&Ve<=he.x+he.width-10).length},ne=(()=>{if(!_e(ve))return ve;const ae=ye(ve);return Me.flatMap(he=>[he.x+he.width+_y,he.x-_y-U]).map(he=>Math.round(he)).filter(he=>!_e(he)&&ye(he)>=ae).sort((he,Ve)=>Math.abs(he-ve)-Math.abs(Ve-ve))[0]??ve})();if(ne!==R.x||H!==R.y||U!==R.width||ie!==R.height){const ae=()=>new Set(ft(Ge(r)).map(Et=>lt(Et))),he=ae(),Ve={x:R.x,y:R.y,width:R.width,height:R.height};n.resizeShape(R,{x:ne,y:H,width:U,height:ie});const ct=ae(),nt=[...ct].filter(Et=>!he.has(Et)).length,dt=[...he].filter(Et=>!ct.has(Et)).length;nt>dt&&n.resizeShape(R,Ve)}}}}const L=Math.max(...k.map(O=>O.x+O.width/2))+wf;if(L>R.x+R.width&&n.resizeShape(R,{x:R.x,y:R.y,width:L-R.x,height:R.height}),!!b)for(const O of y){const F=p(O.flow.id),I=O.flow.source===_.participant.id?O.flow.target:O.flow.target===_.participant.id?O.flow.source:void 0,B=I?p(I):void 0;if(!F||!B||B.type==="bpmn:Participant")continue;const H=B.x+B.width/2;H<R.x+10||H>R.x+R.width-10||E1(F,R,B)}}};k1(!1);for(const b of y){const _=b.flow;n.connect(f(_.source),f(_.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:_.id,name:_.name})})}{const R=new Set([...$.map(B=>B.flow.id),...y.map(B=>B.flow.id)].filter(B=>!!B)),k=r.filter(B=>!!B.waypoints),L=(B,H)=>Math.abs(H.x-B.x)<2?"L":Math.abs(H.x-(B.x+B.width))<2?"R":Math.abs(H.y-B.y)<2?"T":Math.abs(H.y-(B.y+B.height))<2?"B":void 0,O=new Map,F=(B,H,U)=>{if(!B||!H||typeof B.x!="number")return;const ie=L(B,H);if(!ie)return;let pe=O.get(B.id);pe||O.set(B.id,pe=new Map),pe.set(ie,[...pe.get(ie)??[],U])};for(const B of k){const H=B.waypoints;!H||H.length<2||(F(B.source,H[0],{id:B.id,dir:"out"}),F(B.target,H[H.length-1],{id:B.id,dir:"in"}))}const I=new Set;for(const[B,H]of O){const U=p(B);if(!U||typeof U.x!="number")continue;const ie=ye=>{var ae;const ne=(ae=p(ye.id))==null?void 0:ae.source;return!!ne&&typeof ne.x=="number"&&ne.x+ne.width/2>U.x+U.width/2};if(![...H.values()].some(ye=>ye.length>=3&&ye.some(ne=>ne.dir==="out")&&ye.some(ne=>ne.dir==="in"&&R.has(ne.id)&&ie(ne))))continue;const ve=d(U);if(!ve||I.has(ve.id)||(ve.children??[]).some(ye=>ye.type==="bpmn:Lane"))continue;const se=(Z1=H.get("T"))!=null&&Z1.length?(Q1=H.get("B"))!=null&&Q1.length?void 0:"B":"T";if(!se||(se==="T"?U.y-ve.y:ve.y+ve.height-(U.y+U.height))>=ee)continue;const Me=(ve.children??[]).filter(ye=>!("waypoints"in ye&&ye.waypoints)&&ye.type!=="label"&&typeof ye.x=="number"),_e=ve.y+ve.height;n.resizeShape(ve,{x:ve.x,y:ve.y,width:ve.width,height:ve.height+ee}),An(_e,ve.id,ee),se==="T"&&Me.length&&n.moveElements(Me,{x:0,y:ee}),I.add(ve.id)}}const kg=20,O1=4,d3=3,h3=2,g3=[10,30,80],Lo=()=>{const b=Ge(r);return{bad:ft(b).filter(_=>_.kind==="edge-crosses-shape"||_.kind==="edge-overlap-opposite"||_.kind==="edge-overlap-mixed").length,crossings:Am(b),straight:b.edges.filter(_=>_.type==="bpmn:MessageFlow"&&_.waypoints.length===2).length}},ts=b=>{const _=Ge(r),R=_.edges.find(k=>k.id===b);return R?Gt(R,zn(_)).length:0},vp=b=>ts(b)>0,bp=b=>Ge(r).edges.filter(_=>_.type==="bpmn:MessageFlow"&&_.id!==b&&_.waypoints.length===2).length,D1=(b,_,R)=>es([{subtree:b,pool:_}],R),L1=(b,_)=>_.bad>b.bad||_.crossings>b.crossings&&_.straight<=b.straight&&_.bad>=b.bad,ns=(b,_)=>L1(b,_)||_.straight<b.straight,Qr=(b,_,R=()=>!0,k=L1,L=!1)=>{const O=Lo(),F=es(b,_,L);if(!F)return!1;const I=Lo();return k(O,I)||!R()?(F(),!1):!0},m3=(b,_,R,k=()=>!0)=>Qr([{subtree:b,pool:_}],R,k),Jr=b=>{var _;return!!((_=D.get(b))!=null&&_.node.participant)},wc=new Map;for(const b of y){if(!Jr(b.flow.target))continue;const _=wc.get(b.flow.target)??[];_.push(b),wc.set(b.flow.target,_)}const xp=[...wc.keys()],Og=new Set($.map(b=>b.flow.target)),I1=b=>Kr.findIndex(({op:_})=>_.participant.id===b);xp.sort((b,_)=>{var L,O;const R=Og.has(b)?1:0,k=Og.has(_)?1:0;return R!==k?R-k:I1((L=D.get(b))==null?void 0:L.node.participant)-I1((O=D.get(_))==null?void 0:O.node.participant)});const _r=b=>b.x+b.width/2,y3=b=>{const _=new Map;for(const L of r.getAll()){const O=L;if(!O.waypoints||!O.source||!O.target)continue;(_.get(O.source.id)??_.set(O.source.id,[]).get(O.source.id)).push(O.target.id)}const R=new Set([b]),k=[b];for(let L=0;L<k.length;L++)for(const O of _.get(k[L])??[])R.has(O)||(R.add(O),k.push(O));return R},v3=(b,_)=>{const R=y3(_);let k;for(const L of r.getAll()){const O=L;if(O.type!=="bpmn:MessageFlow"||!O.source||!O.target||O.target.id!==b||R.has(O.source.id))continue;const F=O.source;if(typeof F.x!="number"||F.type==="bpmn:Participant")continue;const I=_r(F);(k===void 0||I>k)&&(k=I)}return k},Dg=(b,_)=>{const R=p(b.flow.source);if(R)return R.type==="bpmn:Participant"?v3(R.id,_):_r(R)},B1=b=>{let _;for(const R of wc.get(b)??[]){const k=Dg(R,b);k!==void 0&&(!_||k>_.cx)&&(_={op:R,cx:k})}return _==null?void 0:_.op},b3=b=>{const _=B1(b),R=p(b),k=_?Dg(_,b):void 0;return R&&k!==void 0?k-_r(R):void 0},x3=b=>{const _=b3(b);return _!==void 0&&Math.abs(_)<kg},wp=(b,_,R,k,L)=>{var O;for(let F=!0;F;){F=!1;for(const I of y){if(I.flow.id===R)continue;const B=_.has(I.flow.source),H=_.has(I.flow.target);if(B===H||k(B?I.flow.source:I.flow.target))continue;const U=B?I.flow.target:I.flow.source;if(L(U)||!Jr(U))continue;const ie=p(I.flow.id);if(!(ie!=null&&ie.waypoints)||ie.waypoints.length!==2)continue;const pe=p(U),ve=(O=D.get(U))==null?void 0:O.node.participant;if(!pe||!ve)continue;const se=Zr(U,de=>de.x>=pe.x).filter(de=>!_.has(de.id));if(!(!se.length||se.some(de=>L(de.id)))){for(const de of se)_.add(de.id);b.set(ve,[...b.get(ve)??[],...se]),F=!0}}}return[...b].map(([F,I])=>({subtree:I,pool:f(F)}))},N1=(b,_,R,k,L)=>wp(new Map([[_,[...b]]]),new Set(b.map(O=>O.id)),k,O=>O===R,O=>O===L),Lg=b=>{const _=B1(b);if(!_)return null;const R=p(b),k=p(_.flow.source),L=Dg(_,b);if(!R||!k||L===void 0)return null;const O=L-_r(R);if(O>=kg){const F=D.get(b).node.participant,I=Zr(b,B=>B.x>=R.x);return{groups:N1(I,F,b,_.flow.id,_.flow.source),dx:O}}if(-O>=kg&&Jr(_.flow.source)){const F=D.get(_.flow.source).node.participant,I=Zr(_.flow.source,B=>B.x>=k.x&&!x3(B.id));return{groups:N1(I,F,_.flow.source,_.flow.id,b),dx:-O}}return null},$1=()=>xp.map(b=>({id:b,plan:Lg(b)})).filter(b=>!!b.plan).sort((b,_)=>Math.min(...b.plan.groups.flatMap(R=>R.subtree.map(k=>k.x)))-Math.min(..._.plan.groups.flatMap(R=>R.subtree.map(k=>k.x)))).map(b=>b.id);for(let b=0;b<3;b++){const _=Lo(),R=[];for(const L of $1()){const O=Lg(L);if(!O)continue;const F=es(O.groups,O.dx);F&&R.push(F)}if(!R.length)break;if(!ns(_,Lo()))continue;for(const L of R.reverse())L();let k=!1;for(const L of $1()){const O=Lg(L);O&&Qr(O.groups,O.dx,()=>!0,ns)&&(k=!0)}if(!k)break}for(const b of xp){if(Og.has(b))continue;const _=D.get(b);if(!_||_.node.lane!==void 0)continue;const R=X(_);if(R===void 0)continue;const k=p(b),L=k?d(k):void 0;if(!k||!L)continue;const O=L.y+Pe+It(`pool:${_.node.participant??""}`,R)*ee,F=O-(k.y+k.height/2);F!==0&&!ke(L,k,k.x+k.width/2,O)&&n.moveElements([k],{x:0,y:F})}const F1=()=>{const b=r.filter(k=>k.type==="bpmn:Participant"),_=new Map(b.map(k=>[k.id,k]));let R=0;for(const{pools:[k,L]}of sf(b)){const O=_.get(k),F=_.get(L);R+=(Math.min(O.x+O.width,F.x+F.width)-Math.max(O.x,F.x))*(Math.min(O.y+O.height,F.y+F.height)-Math.max(O.y,F.y))}return R},j1=new Set;for(let b=0,_=!0;_&&b<d3;b++){_=!1;for(const R of xp.flatMap(k=>wc.get(k)??[])){if(j1.has(R.flow.id)||!vp(R.flow.id))continue;const k=p(R.flow.target);if(!k)continue;const L=f(D.get(R.flow.target).node.participant),O=Zr(R.flow.target,U=>U.x>=k.x),F=k.width+Ee,I=ts(R.flow.id),B=bp(R.flow.id),H=F1();for(let U=1;U<=O1;U++){const ie=()=>ts(R.flow.id)<I&&bp(R.flow.id)>=B&&F1()<=H;if(m3(O,L,F*U,ie)){j1.add(R.flow.id),_=!0;break}}}}const Ig=y.map(b=>({id:b.flow.id,source:b.flow.source,target:b.flow.target,preexisting:!1})),H1=new Set(Ig.map(b=>b.id));for(const b of r.filter(_=>_.type==="bpmn:MessageFlow"))H1.has(b.id)||!b.source||!b.target||b.source.type==="bpmn:Participant"!=(b.target.type==="bpmn:Participant")&&Ig.push({id:b.id,source:b.source.id,target:b.target.id,preexisting:!0});for(const b of Ig){if(!vp(b.id))continue;const _=p(b.source),R=p(b.target);if(!_||!R)continue;let k,L,O;if(b.preexisting){const[I,B]=_.type==="bpmn:Participant"?[R,_]:[_,R];if(k=_r(I),k<B.x||k>B.x+B.width)continue;[L,O]=I.y<B.y?[I.y+I.height,B.y]:[B.y+B.height,I.y]}else{if(_.type==="bpmn:Participant"||R.type==="bpmn:Participant"||(k=_.x+_.width/2,Math.abs(k-(R.x+R.width/2))>15))continue;[L,O]=_.y<R.y?[_.y+_.height,R.y]:[R.y+R.height,_.y]}const F=[...D.values()].map(I=>p(I.node.id)).filter(I=>!!I&&I.id!==_.id&&I.id!==R.id).filter(I=>I.x<=k&&k<=I.x+I.width&&I.y+I.height>L&&I.y<O).sort((I,B)=>I.x-B.x);for(const I of F){const B=(J1=D.get(I.id))==null?void 0:J1.node.participant,H=B?p(B):void 0;if(!B||!H)continue;const U=[...D.values()].filter(ne=>ne.node.participant===B).map(ne=>ne.node.id),ie=ne=>ne.map(ae=>p(ae)).filter(ae=>!!ae),ve=[a3(I.id,ne=>{var ae;return((ae=D.get(ne.id))==null?void 0:ae.node.participant)===B}),ie(U)].filter(ne=>ne.length).map(ne=>[{subtree:ne,pool:H}]);if(b.preexisting){const ne=ie(U);ne.length&&ve.push(wp(new Map([[B,[...ne]]]),new Set(ne.map(ae=>ae.id)),b.id,()=>!1,ae=>ae===_.id||ae===R.id))}const se=I.width+Ee,de=ts(b.id),Me=bp(b.id),_e=()=>ts(b.id)<de&&bp(b.id)>=Me;let ye=!1;for(const ne of ve){for(let ae=1;ae<=O1;ae++)if(Qr(ne,se*ae,_e)){ye=!0;break}if(ye)break}if(!vp(b.id))break}}const _p=()=>{var _;const b=new Set;for(const R of ft(Ge(r)))R.kind!=="edge-crosses-shape"||H1.has(R.edge)||((_=p(R.edge))==null?void 0:_.type)==="bpmn:MessageFlow"&&b.add(`${R.edge}>${R.shape}`);return b},w3=(b,_)=>Lo().bad>=b&&[..._p()].some(R=>!_.has(R)),z1=b=>{var _,R;return ts(b)===0&&((R=(_=p(b))==null?void 0:_.waypoints)==null?void 0:R.length)===2},_3=(b,_,R)=>{const k=new Set(b.flatMap(O=>O.subtree.map(F=>F.id))),L=[..._p()].filter(O=>!R.has(O)).map(O=>O.split(">")[1]);return[...new Set(L)].filter(O=>k.has(O)&&O!==_.source&&O!==_.target)},E3=(b,_,R,k,L)=>{const O=b.map(H=>({...H,subtree:H.subtree.filter(U=>!L.includes(U.id))})).filter(H=>H.subtree.length),F=new Set(O.flatMap(H=>H.subtree.map(U=>U.id))),I=()=>L.every(H=>{const U=p(H);return!!U&&$.filter(ie=>ie.flow.target===H&&F.has(ie.flow.source)).every(ie=>{const pe=p(ie.flow.source);return!!pe&&pe.x+pe.width<=U.x})});return Qr(O,_,()=>z1(R.id)&&[..._p()].every(H=>k.has(H))&&I(),ns,!0)};for(const b of y){if(!vp(b.flow.id))continue;const _=p(b.flow.id);if(((eS=_==null?void 0:_.waypoints)==null?void 0:eS.length)!==2)continue;const R=p(b.flow.source),k=p(b.flow.target);if(!R||!k||R.type==="bpmn:Participant"||k.type==="bpmn:Participant"||!Jr(b.flow.source)||!Jr(b.flow.target)||Math.abs(_r(R)-_r(k))>h3)continue;const L=_r(R),O=_.waypoints.map(de=>de.y),[F,I]=[Math.min(...O),Math.max(...O)],B=zn(Ge(r)).filter(de=>de.id!==R.id&&de.id!==k.id&&de.x<L&&L<de.x+de.width&&F<de.y+de.height&&de.y<I);if(!B.length)continue;const H=(tS=D.get(b.flow.source))==null?void 0:tS.node.participant,U=(nS=D.get(b.flow.target))==null?void 0:nS.node.participant;if(!H||!U)continue;const ie=new Map;for(const[de,Me,_e]of[[b.flow.source,R,H],[b.flow.target,k,U]]){const ye=ie.get(_e)??[],ne=Zr(de,ae=>ae.x>=Me.x).filter(ae=>!ye.some(he=>he.id===ae.id));ie.set(_e,[...ye,...ne])}const pe=new Set([...ie.values()].flat().map(de=>de.id)),ve=wp(ie,pe,b.flow.id,de=>de===b.flow.source||de===b.flow.target,()=>!1),se=Math.max(...B.map(de=>de.x+de.width));for(const de of g3){const Me=se+de-L;if(Me<=0)continue;const _e=Lo().bad,ye=_p();let ne=[],ae=!0;const he=()=>!z1(b.flow.id)||ae&&(ne=_3(ve,b.flow,ye),ne.length)?!1:!w3(_e,ye);if(Qr(ve,Me,he,ns))break;if(ne.length&&(E3(ve,Me,b.flow,ye,ne)||(ae=!1,Qr(ve,Me,he,ns))))break}}{const b=R=>R.y+R.height/2,_=[];for(const R of D.keys()){if(!Jr(R))continue;const k=$.filter(F=>F.flow.target===R);if(k.length!==1)continue;const L=p(k[0].flow.source),O=p(R);!L||!O||!D.has(L.id)||Math.abs(b(L)-b(O))>1||O.x-(L.x+L.width)<=Ee+1||_.push({id:R,pred:L,node:O})}_.sort((R,k)=>R.node.x-k.node.x);for(const{id:R}of _){const k=D.get(R),L=p(R),O=p($.find(Me=>Me.flow.target===R).flow.source);if(!L||!O)continue;const F=L.x-(O.x+O.width);if(F<=Ee+1)continue;const I=f(k.node.participant),B=Zr(R,Me=>Me.x>=L.x),H=-(F-Ee),U=(Me,_e)=>_e.bad>Me.bad||_e.crossings>=Me.crossings||_e.straight<Me.straight,ie=wp(new Map([[k.node.participant,[...B]]]),new Set(B.map(Me=>Me.id)),"",()=>!1,()=>!1),pe=ie.some(Me=>Me.pool!==I)||ie.reduce((Me,_e)=>Me+_e.subtree.length,0)>B.length,ve=Lo(),se=D1(B,I,H);if(!se)continue;const de=Lo();if(pe&&!U(ve,de)){se();const Me=es(ie,H);if(Me){const _e=Lo();if(!U(ve,_e)&&_e.bad<=de.bad&&_e.crossings<=de.crossings)continue;Me()}D1(B,I,H);continue}U(ve,de)&&se()}}k1(!0);const S3=10,R3=400,C3=b=>[...b.incoming??[],...b.outgoing??[]].filter(_=>_.type==="bpmn:DataInputAssociation"||_.type==="bpmn:DataOutputAssociation").map(_=>_.source===b?_.target:_.source).filter(_=>!!_&&typeof _.y=="number"),M3=r.filter(b=>b.type==="bpmn:DataStoreReference"&&g.has(b.id)),A3=(b,_)=>{const R=b.x+b.width/2,k=b.y+b.height/2;let L;for(const O of M3){if((d(O)??u())!==_||O.y<b.y+b.height)continue;const F=Math.abs(O.x+O.width/2-R);F>R3||F<O.width||!C3(O).some(B=>B.height===b.height&&Math.abs(B.y+B.height/2-k)<=S3&&O.y>=B.y+B.height)||(!L||F<L.dx||F===L.dx&&O.id<L.id)&&(L={dx:F,id:O.id,cy:O.y+O.height/2})}return L==null?void 0:L.cy};for(const b of v){const _=b.associations??[],R=_.map(O=>O.source===b.dataStore.id?O.target:O.source).map(p).find(Boolean),k=R?d(R)??u():u(),L=R?{x:R.x+R.width/2,y:A3(R,k)??R.y+R.height+110}:{x:200,y:Wn+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:b.dataStore.id,name:b.dataStore.name})},L,k);for(const O of _)T1(b.dataStore.id,O)}for(const b of x){const R=f(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;T1(R,b.association)}let G1=0;const ea=10,V1=40,P3=(b,_)=>{const R=_.map(B=>d(B)).filter(B=>!!B);for(const B of R){const H=ea,U=B.y,ie=B.y+B.height,pe=B.x,ve=B.x+B.width;if(Math.abs(b.y-U)<H){const se=U+H-b.y;b.y+=se,b.height-=se}if(Math.abs(b.y+b.height-ie)<H&&(b.height=ie-H-b.y),Math.abs(b.x-pe)<H){const se=pe+H-b.x;b.x+=se,b.width-=se}Math.abs(b.x+b.width-ve)<H&&(b.width=ve-H-b.x)}if(!R.length)return;const k=Math.min(...R.map(B=>B.y)),L=Math.max(...R.map(B=>B.y+B.height)),O=k-b.y,F=b.y+b.height-L,I=V1-ea;if(O>0!=F>0)if(O>0&&O<I){const B=O+ea;b.y+=B,b.height-=B}else F>0&&F<I&&(b.height-=F+ea)},T3=(b,_)=>{const R=ea,k=30,L=r.filter(O=>O.type==="bpmn:Group"&&O.id!==_);for(const O of L){const F=O.x,I=O.x+O.width,B=O.y,H=O.y+O.height,U=b.y<H&&B<b.y+b.height,ie=b.x<I&&F<b.x+b.width;if(U){if(Math.abs(b.x-I)<R){const pe=Math.min(I+R-b.x,k);pe>0&&b.width-pe>0&&(b.x+=pe,b.width-=pe)}if(Math.abs(b.x+b.width-F)<R){const pe=Math.min(b.x+b.width-(F-R),k);pe>0&&b.width-pe>0&&(b.width-=pe)}}if(ie){if(Math.abs(b.y-H)<R){const pe=Math.min(H+R-b.y,k);pe>0&&b.height-pe>0&&(b.y+=pe,b.height-=pe)}if(Math.abs(b.y+b.height-B)<R){const pe=Math.min(b.y+b.height-(B-R),k);pe>0&&b.height-pe>0&&(b.height-=pe)}}}},Bg=(b,_)=>{const R=V1,k=Math.min(...b.map(B=>B.x))-R,L=Math.min(...b.map(B=>B.y))-R,O=Math.max(...b.map(B=>B.x+B.width))+R,F=Math.max(...b.map(B=>B.y+B.height))+R,I={x:k,y:L,width:O-k,height:F-L};return P3(I,b),T3(I,_),I};for(const b of C){const _=(b.group.members??[]).map(p).filter(L=>!!L);let R;_.length?R=Bg(_,b.group.id):(R={x:300+G1*350,y:40,width:300,height:200},G1++);const k=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:R.width,height:R.height},{x:R.x+R.width/2,y:R.y+R.height/2},u());b.group.name&&n.updateLabel(k,b.group.name),(iS=b.group.members)!=null&&iS.length&&Q(k,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=r.filter(L=>!!L.waypoints),_=new Map,R=(L,O)=>{!L||!O||(_.has(L)||_.set(L,new Set),_.get(L).add(O))};for(const L of b){const O=(oS=L.source)==null?void 0:oS.id,F=(rS=L.target)==null?void 0:rS.id;R(O,F),((aS=L.type)!=null&&aS.includes("DataOutputAssociation")||(sS=L.type)!=null&&sS.includes("DataInputAssociation")||L.type==="bpmn:Association")&&R(F,O)}const k=r.filter(L=>L.type==="bpmn:Group");for(const L of k){const F=(((cS=L.businessObject.extensionElements)==null?void 0:cS.values)??[]).find(_e=>_e.$type==="bwl:Members"),I=((F==null?void 0:F.refs)??"").split(" ").filter(Boolean);if(!I.length)continue;const B=new Set(I),H=[...I];for(;H.length;){const _e=H.shift();for(const ye of _.get(_e)??[])B.has(ye)||(B.add(ye),H.push(ye))}const U=L.x,ie=L.x+L.width,pe=L.y,ve=L.y+L.height,se=_e=>$.filter(ye=>ye.flow.target===_e).length,de=_e=>{var ne;const ye=((ne=p(_e))==null?void 0:ne.type)??"";if(ye==="bpmn:StartEvent"&&se(_e)===0)return!1;if(ye.endsWith("Gateway")){const ae=$.filter(he=>he.flow.target===_e).map(he=>he.flow.source);if(ae.length&&ae.every(he=>{var Ve;return((Ve=p(he))==null?void 0:Ve.type)==="bpmn:StartEvent"&&se(he)===0}))return!1}return!0},Me=r.filter(_e=>Ii(_e)).filter(_e=>_e.type!=="bpmn:Group"&&_e.type!=="bpmn:Participant"&&_e.type!=="bpmn:TextAnnotation"&&!B.has(_e.id)&&Jr(_e.id)&&de(_e.id)&&_e.x<ie&&_e.x+_e.width>U&&_e.y<ve&&_e.y+_e.height>pe);if(Me.length)for(const _e of[-1,1]){const ye=Me.filter(le=>(le.x+le.width-U<=ie-le.x?-1:1)===_e);if(!ye.length)continue;const ne=[];for(const le of ye){const Le=ne.find(we=>we.some(ue=>le.y<ue.y+ue.height&&le.y+le.height>ue.y));Le?Le.push(le):ne.push([le])}const ae=new Map;for(const le of ne){let Le=_e<0?U-ea:ie+ea;for(const we of[...le].sort((ue,$e)=>_e<0?$e.x-ue.x:ue.x-$e.x)){const ue=_e<0?Math.min(we.x,Le-we.width):Math.max(we.x,Le);Le=_e<0?ue-Li:ue+we.width+Li,ue!==we.x&&Math.sign(ue-we.x)===_e&&ae.set(we.id,ue-we.x)}}const he=new Map,Ve=le=>he.get(le)===le||!he.get(le)?le:Ve(he.get(le));for(const le of ye)he.set(le.id,le.id);for(const le of y){const Le=ae.has(le.flow.source)?le.flow.source:void 0,we=ae.has(le.flow.target)?le.flow.target:void 0;if(!Le||!we)continue;const ue=p(le.flow.id);((lS=ue==null?void 0:ue.waypoints)==null?void 0:lS.length)===2&&he.set(Ve(Le),Ve(we))}const ct=new Map;for(const le of ye){if(!ae.has(le.id))continue;const Le=Ve(le.id);ct.set(Le,[...ct.get(Le)??[],le])}const nt=[...ct.values()].sort((le,Le)=>_e<0?Math.min(...le.map(we=>we.x))-Math.min(...Le.map(we=>we.x)):Math.max(...Le.map(we=>we.x))-Math.max(...le.map(we=>we.x))),dt=[];let Et=!0;for(const le of nt){const Le=le.map($e=>ae.get($e.id)??0).reduce(($e,Fe)=>Math.abs(Fe)>Math.abs($e)?Fe:$e,0),we=new Map;let ue=!0;for(const $e of le){const Fe=d($e);if(!Fe){ue=!1;break}we.has(Fe.id)||we.set(Fe.id,{subtree:[],pool:Fe}),we.get(Fe.id).subtree.push($e)}ue&&Qr([...we.values()],Le,()=>!0,ns)?dt.push({shapes:le,dx:Le}):Et=!1}if(!Et)for(const le of dt.reverse())n.moveElements(le.shapes,{x:-le.dx,y:0})}}}{const b=new Set([...C.map(_=>_.group.id),...qt(e,"group.update").map(_=>_.id)]);for(const _ of r.filter(R=>R.type==="bpmn:Group")){if(b.has(_.id))continue;const k=(((uS=_.businessObject.extensionElements)==null?void 0:uS.values)??[]).find(I=>I.$type==="bwl:Members"),L=((k==null?void 0:k.refs)??"").split(" ").filter(Boolean).map(p).filter(I=>!!I);!L.length||!L.some(I=>{const B=g.get(I.id);return!B||B.x!==I.x||B.y!==I.y})||!L.some(I=>I.x<_.x||I.y<_.y||I.x+I.width>_.x+_.width||I.y+I.height>_.y+_.height)||n.resizeShape(_,Bg(L,_.id))}}{const _=new Map(Vo(Ge(r)).map(I=>[I.owner,I.rect])),R=r.filter(I=>!!I.waypoints),k=new Map,L=(I,B)=>{!I||!B||(k.has(I)||k.set(I,new Set),k.get(I).add(B))};for(const I of R){const B=(pS=I.source)==null?void 0:pS.id,H=(fS=I.target)==null?void 0:fS.id;L(B,H),((dS=I.type)!=null&&dS.includes("DataOutputAssociation")||(hS=I.type)!=null&&hS.includes("DataInputAssociation")||I.type==="bpmn:Association")&&L(H,B)}const O=I=>$.filter(B=>B.flow.target===I).length,F=I=>{var H;const B=((H=p(I))==null?void 0:H.type)??"";if(B==="bpmn:StartEvent"&&O(I)===0)return!1;if(B.endsWith("Gateway")){const U=$.filter(ie=>ie.flow.target===I).map(ie=>ie.flow.source);if(U.length&&U.every(ie=>{var pe;return((pe=p(ie))==null?void 0:pe.type)==="bpmn:StartEvent"&&O(ie)===0}))return!1}return!0};for(const I of r.filter(B=>B.type==="bpmn:Group")){const H=(((gS=I.businessObject.extensionElements)==null?void 0:gS.values)??[]).find(ue=>ue.$type==="bwl:Members"),U=((H==null?void 0:H.refs)??"").split(" ").filter(Boolean);if(!U.length)continue;const ie=U.map(p).filter(ue=>!!ue);if(!ie.length||!(C.some(ue=>ue.group.id===I.id)||qt(e,"group.update").some(ue=>ue.id===I.id)||ie.some(ue=>{const $e=g.get(ue.id);return!$e||$e.x!==ue.x||$e.y!==ue.y})))continue;const ve=new Set(U),se=[...U];for(;se.length;){const ue=se.shift();for(const $e of k.get(ue)??[])ve.has($e)||(ve.add($e),se.push($e))}const de=I.x,Me=I.x+I.width,_e=I.y,ye=I.y+I.height,ne=ue=>{const $e=_.get(ue.id),Fe={x:ue.x,y:ue.y,width:ue.width,height:ue.height};return $e?[Fe,{x:$e.x,y:$e.y,width:$e.width,height:$e.height}]:[Fe]},ae=ie.flatMap(ne),he=Math.min(...ae.map(ue=>ue.x)),Ve=Math.max(...ae.map(ue=>ue.x+ue.width)),ct=Math.min(...ae.map(ue=>ue.y)),nt=Math.max(...ae.map(ue=>ue.y+ue.height)),dt={L:he-de,R:Me-Ve,T:ct-_e,B:ye-nt},Et=new Set(U),le=ue=>ue.x>=de&&ue.x+ue.width<=Me&&ue.y>=_e&&ue.y+ue.height<=ye,Le=r.filter(ue=>Ii(ue)).filter(ue=>ue.type!=="bpmn:Group"&&ue.type!=="bpmn:Participant"&&ue.type!=="bpmn:TextAnnotation"&&!Et.has(ue.id)&&(!ve.has(ue.id)||!le(ue))&&F(ue.id)&&ue.x<Me&&ue.x+ue.width>de&&ue.y<ye&&ue.y+ue.height>_e);if(!Le.length)continue;const we={L:0,R:0,T:0,B:0};for(const ue of Le){const $e=ne(ue),Fe=Math.min(...$e.map($t=>$t.x)),Ie=Math.max(...$e.map($t=>$t.x+$t.width)),at=Math.min(...$e.map($t=>$t.y)),St=Math.max(...$e.map($t=>$t.y+$t.height)),Ht={L:Ie-de,R:Me-Fe,T:St-_e,B:ye-at},$n=["L","R","T","B"].filter($t=>Ht[$t]<=dt[$t]+.001);if(!$n.length)continue;const Wt=$n.reduce(($t,Io)=>Ht[Io]<Ht[$t]?Io:$t,$n[0]);we[Wt]=Math.max(we[Wt],Math.min(Ht[Wt]+10,dt[Wt]))}!we.L&&!we.R&&!we.T&&!we.B||n.resizeShape(I,{x:I.x+we.L,y:I.y+we.T,width:I.width-we.L-we.R,height:I.height-we.T-we.B})}}const W1=b=>{const _=b.waypoints;if(_!=null&&_.length){const k=_[Math.floor((_.length-1)/2)];return{x:k.x,y:k.y,width:0,height:0}}const R=b;return{x:R.x,y:R.y,width:R.width,height:R.height}};let _c=0;const U1=12,q1=14,k3=15,O3=300,D3=b=>{const _=b.split(`
|
|
7
|
+
`),R=Math.max(..._.map(O=>da(O,U1))),k=Math.max(100,Math.min(O3,Math.ceil(R)+q1)),L=_.reduce((O,F)=>O+Math.max(1,Math.ceil((da(F,U1)+q1)/k)),0);return{width:k,height:Math.max(30,L*k3+10)}};for(const b of E){const _=b.association,R=((mS=b.placement)==null?void 0:mS.anchor)??(_?_.source===b.annotation.id?_.target:_.source:void 0),k=R?p(R):void 0,L=k?W1(k):void 0,O=D3(b.annotation.text??"");let F;if(L&&b.placement){const[U,ie]=tl[b.placement.side],pe=b.placement.offset??50;F={x:L.x+L.width/2+U*(L.width/2+O.width/2+pe),y:L.y+L.height/2+ie*(L.height/2+O.height/2+pe)}}else L?(F={x:L.x+L.width/2+180+_c%3*260,y:L.y-110-_c%2*95},_c++):(F={x:300+_c*260,y:60},_c++);const I=k?d(k)??u():u(),B=I;L&&typeof B.x=="number"&&typeof B.width=="number"&&B.type==="bpmn:Participant"&&(F=il(r,L,O,B,b.placement?{placement:b.placement}:{from:F}));const H=n.createShape({type:"bpmn:TextAnnotation",width:O.width,height:O.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},F,I);if(_){const U=ie=>ie===b.annotation.id?H:f(ie);n.connect(U(_.source),U(_.target),_.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:_.id})}:{type:"bpmn:Association"})}b.placement&&Q(H,"bwl:Placement",te(b.placement))}for(const b of qt(e,"association.add")){const _=b.association;n.connect(f(_.source),f(_.target),_.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:_.id})}:{type:"bpmn:Association"})}const L3=(b,_,R,k)=>{const L=b.parent;if(!L)return k;const O=b.x+b.width/2,F=new Set([b.id]);if(!ke(L,b,O,k,F))return k;const I=_?_.y+Math.min(_.height/2,Se):R?R.y+Pe:void 0;if(I===void 0)return k;const B=Math.floor((k-I)/ee+1e-6);for(let H=1;H<=3;H++){const U=B+H,ie=I+U*ee,pe=dn(_==null?void 0:_.id,U);if(!ke(L,b,O,ie,pe?new Set([...F,...pe]):F))return Nn(_==null?void 0:_.id,U,R),ie}return k},Y1=()=>new Set(r.getAll().filter(b=>b.type!=="label").map(b=>b.id));for(const b of qt(e,"node.update")){let _=f(b.id);if(b.type&&el(b.type)!==_.type){const R=_.x+_.width/2,k=_.y+_.height/2,L=Y1();_=c.replaceElement(_,{type:el(b.type),...b.eventDefinition?{eventDefinitionType:Mc[b.eventDefinition]}:{}});const O=Y1(),F=[...L].filter(H=>H!==b.id&&!O.has(H));if(F.length)throw new Cy({kind:"type-change-drops-elements",opIndex:e.indexOf(b),id:b.id,type:b.type,dropped:F});const I=Math.round(R-(_.x+_.width/2)),B=Math.round(k-(_.y+_.height/2));if(I!==0||B!==0){n.moveShape(_,{x:I,y:B});for(const H of[..._.incoming??[],..._.outgoing??[]])yp(H)}}if(b.name!==void 0&&n.updateProperties(_,{name:b.name??void 0}),b.lane||b.band!==void 0){b.band!==void 0&&n.updateProperties(_,{"bwl:band":b.band});const R=_.y+_.height/2,k=d(_),L=b.lane?f(b.lane):((k==null?void 0:k.children)??[]).find(F=>F.type==="bpmn:Lane"&&R>=F.y&&R<=F.y+F.height);b.band!==void 0&&Nn(L==null?void 0:L.id,b.band,k);const O=L?L.y+(b.band===void 0?L.height/2:Math.min(L.height/2,Se)+It(L.id,b.band)*ee):b.band!==void 0&&k?k.y+Pe+It(`pool:${k.id}`,b.band)*ee:void 0;if(O!==void 0){const F=L3(_,L,k,O),I=F===O?O-R:F-(_.y+_.height/2);I!==0&&n.moveElements([_],{x:0,y:I})}}}for(const b of qt(e,"sequenceFlow.update")){const _=f(b.id),R=P.get(b.id);if(R){const k=H=>({x:H.x+H.width/2,y:H.y+H.height/2}),L=f(R.flow.source),O=f(R.flow.target),F=n.connect(L,O,{type:"bpmn:SequenceFlow",businessObject:mp(R.flow)}),I=Tg.get(b.id),B=O.y+O.height/2;I&&O.x>I.exit.x&&Math.abs(B-I.exit.y)>1?n.updateWaypoints(F,[I.exit,{x:I.exit.x,y:B},{x:O.x,y:B}]):(n.reconnect(F,L,O,[k(L),k(O)]),Math.abs(B-(L.y+L.height/2))>1&&yp(F))}else if(b.source!==void 0||b.target!==void 0){const k=_,L=b.source!==void 0?f(b.source):k.source,O=b.target!==void 0?f(b.target):k.target,F=H=>({x:H.x+H.width/2,y:H.y+H.height/2});n.reconnect(k,L,O,[F(L),F(O)]);const I=Tg.get(k.id),B=O.y+O.height/2;if(I&&O.x>I.exit.x&&Math.abs(B-I.exit.y)>1){n.updateWaypoints(k,[I.exit,{x:I.exit.x,y:B},{x:O.x,y:B}]);const H=k.label;if(H&&I.label){const ie=Math.abs(I.label.y+H.height/2-I.channelY)<=ee/5&&I.label.x+H.width>I.exit.x,pe=I.exit.x+6,ve=O.x-6-H.width,se=ie?ve>=pe?{x:Math.max(pe,Math.min(I.label.x,ve)),y:I.label.y+(B-I.channelY)}:void 0:I.label;se&&(se.x!==H.x||se.y!==H.y)&&n.moveElements([H],{x:se.x-H.x,y:se.y-H.y})}}else Math.abs(B-(L.y+L.height/2))>1&&yp(k)}b.name!==void 0&&n.updateProperties(_,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(_,{name:((yS=b.condition)==null?void 0:yS.label)??void 0})}for(const b of qt(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of qt(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of qt(e,"annotation.update")){const _=f(b.id);if(b.text!==void 0&&n.updateProperties(_,{text:b.text}),b.placement===null)Q(_,"bwl:Placement",null);else if(b.placement){const R=f(b.placement.anchor),k=W1(R),L=d(R)??u(),O=typeof L.x=="number"&&typeof L.width=="number"&&L.type==="bpmn:Participant",[F,I]=tl[b.placement.side],B=b.placement.offset??50,H={x:k.x+k.width/2+F*(k.width/2+_.width/2+B),y:k.y+k.height/2+I*(k.height/2+_.height/2+B)},U=O?il(r,k,{width:_.width,height:_.height},L,{placement:b.placement,selfId:b.id}):H;n.moveElements([_],{x:U.x-(_.x+_.width/2),y:U.y-(_.y+_.height/2)}),Q(_,"bwl:Placement",te(b.placement))}}for(const b of qt(e,"group.update")){const _=f(b.id);if(b.name!==void 0&&n.updateLabel(_,b.name??""),b.members){const R=b.members.map(p).filter(k=>!!k);R.length&&n.resizeShape(_,Bg(R,b.id)),Q(_,"bwl:Members",{refs:b.members.join(" ")})}}}function _f(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 NM(e,t,n,i){const{elementRegistry:o}=e,r=e.modeling,a=[...t.incoming??[],...t.outgoing??[]].filter(d=>d.type==="bpmn:Association");if(!a.length)return 0;const s=d=>d.map(g=>g.original?{x:g.x,y:g.y,original:{x:g.original.x,y:g.original.y}}:{x:g.x,y:g.y}),c=(d,g)=>d.length===g.length&&d.every((h,m)=>{var w,y,v,x;return h.x===g[m].x&&h.y===g[m].y&&((w=h.original)==null?void 0:w.x)===((y=g[m].original)==null?void 0:y.x)&&((v=h.original)==null?void 0:v.y)===((x=g[m].original)==null?void 0:x.y)}),l=a.map(d=>s(d.waypoints)),u=new Set(a.map(d=>d.id));r.moveElements([t],{x:n,y:i});const p=Ge(o),f=[...mo(p),...$i(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 $M(e,t,n){var u,p;const{elementRegistry:i}=e,o=e.modeling,r=f=>ft(f).filter(d=>!t.has(lt(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(_f))].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 ee=d.x+d.width/2,Ee=d.y+d.height/2;h=i.getAll().find(Pe=>{if(Pe.type!=="bpmn:Participant")return!1;const Se=Pe;return typeof Se.x=="number"&&typeof Se.width=="number"&&ee>=Se.x&&ee<=Se.x+Se.width&&Ee>=Se.y&&Ee<=Se.y+Se.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"),y=[...d.incoming??[],...d.outgoing??[]].find(ee=>ee.type==="bpmn:Association"),v=(w!=null&&w.anchor?i.get(w.anchor):void 0)??(y?((p=y.source)==null?void 0:p.id)===f?y.target:y.source:void 0);if(!v)continue;const x=v.waypoints,E=x!=null&&x.length?{x:x[Math.floor((x.length-1)/2)].x,y:x[Math.floor((x.length-1)/2)].y,width:0,height:0}:{x:v.x,y:v.y,width:v.width,height:v.height},C={width:d.width,height:d.height},D={x:d.x+d.width/2,y:d.y+d.height/2},P=w==null?void 0:w.side,T=Sy(i,E,h),$=[];if(P&&P in tl&&$.push(il(i,E,C,h,{placement:{side:P,offset:(w==null?void 0:w.offset)??null},selfId:f})),T&&!nl(D,C,T))for(const ee of BM)$.push(il(i,E,C,h,{placement:{side:ee,offset:null},selfId:f}));for(const[ee,Ee]of[[-1,0],[1,0],[0,-1],[0,1]])for(let Pe=1;Pe<=IM;Pe++)$.push({x:D.x+ee*Ey*Pe,y:D.y+Ee*Ey*Pe});const j={...s,edges:s.edges.filter(ee=>ee.id!==(y==null?void 0:y.id))},G=r(j),Q=G.filter(ee=>_f(ee).includes(f)).length;if(!Q)continue;let te,V=!1;for(const ee of $){const Ee=ee.x-D.x,Pe=ee.y-D.y;if(!Ee&&!Pe||ee.x-C.width/2<h.x||ee.x+C.width/2>h.x+h.width||ee.y-C.height/2<h.y||ee.y+C.height/2>h.y+h.height||T&&!nl(ee,C,T))continue;const Se={...j,shapes:j.shapes.map(Z=>Z.id===f?{...Z,x:Z.x+Ee,y:Z.y+Pe}:Z)},K=r(Se),oe=K.filter(Z=>_f(Z).includes(f)).length;if(oe>=Q||K.length>G.length)continue;const Y=Math.abs(Ee)+Math.abs(Pe);if(V||((!te||oe<te.mine||oe===te.mine&&(K.length<te.all||K.length===te.all&&Y<te.dist))&&(te={x:ee.x,y:ee.y,mine:oe,all:K.length,dist:Y}),te.mine===0&&te.all<G.length&&(V=!0)),oe===0&&K.length<G.length&&NM(e,d,Ee,Pe)===0){te={x:ee.x,y:ee.y,mine:oe,all:K.length,dist:Y};break}}te&&o.moveElements([d],{x:te.x-D.x,y:te.y-D.y})}}const FM=60;function Ef(e,t,n,i){const o=t.x+t.width,r=[],a=c=>{for(const l of c.children??[])l.type==="bpmn:Lane"&&(r.push(l),a(l))};a(t),e.resizeShape(t,{x:t.x,y:t.y,width:n,height:t.height},void 0,i);const s=t.x+n;for(const c of r)Math.abs(c.x+c.width-o)<1&&e.resizeShape(c,{x:c.x,y:c.y,width:s-c.x,height:c.height},void 0,i)}function jM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=w=>ft(w).filter(y=>!t.has(lt(y))),a=w=>w.filter(y=>y.kind==="pool-overlap"),s=new Map(n.shapes.map(w=>[w.id,w])),c=(w,y)=>y.x>=w.x&&y.y>=w.y&&y.x+y.width<=w.x+w.width&&y.y+y.height<=w.y+w.height,l=w=>{if(!s.get(w))return[w];const v=new Set,x=new Set([w]);for(let C=0;C<4;C++){let D=!1;for(const P of n.shapes)P.type!=="bpmn:Group"||v.has(P.id)||[...x].some(T=>{const $=s.get(T);return $&&c(P,$)})&&(v.add(P.id),D=!0);for(const P of n.shapes)P.type!=="bpmn:Participant"||x.has(P.id)||[...v].some(T=>{const $=s.get(T);return $&&c($,P)})&&(x.add(P.id),D=!0);if(!D)break}const E=n.shapes.filter(C=>!C.parent&&!x.has(C.id)&&!v.has(C.id)&&C.type!=="bpmn:Group"&&C.type!=="bpmn:Participant").filter(C=>[...v].some(D=>{const P=s.get(D);return P&&c(P,C)})).map(C=>C.id);return[...x,...v,...E]},u=r(Ge(i)),p=a(u).length;if(!p)return;const f=u.length,d=[];let g=0,h=p,m=f;for(let w=0;w<6;w++){const y=Ge(i),v=a(r(y));if(!v.length)break;const x=new Map(y.shapes.map(T=>[T.id,T]));let E=null;for(const T of v){if(T.kind!=="pool-overlap")continue;const[$,j]=T.pools,G=x.get($),Q=x.get(j);if(!G||!Q)continue;const[te,V]=G.x<=Q.x?[G,Q]:[Q,G];if(T.contained)continue;const ee=s.get(te.id),Ee=s.get(V.id),Pe=ee&&Ee?Math.max(Ee.x-(ee.x+ee.width),0):FM,Se=te.x+te.width+Pe-V.x;if(Se<=0)continue;const K=l(V.id).filter(oe=>i.get(oe));K.length&&(!E||Se>E.dx)&&(E={movers:K,dx:Se})}if(!E)break;const C=E.movers.map(T=>i.get(T)).filter(T=>!!T&&typeof T.x=="number");if(!C.length)break;o.moveElements(C,{x:E.dx,y:0}),d.push({els:C,dx:E.dx});const D=r(Ge(i)),P=a(D).length;P<p&&D.length<=f&&(P<h||P===h&&D.length<m||g===0)&&(g=d.length,h=P,m=D.length)}for(const{els:w,dx:y}of d.slice(g).reverse())o.moveElements(w,{x:-y,y:0})}const gs=.5,Ay=150;function HM(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of zM(n))i.length<n.length&&i.some(r=>Py(e.elementRegistry.get(r.id)))||GM(e,i)}function zM(e){const t=[...e].sort((i,o)=>i.x+i.width-(o.x+o.width)),n=[];for(const i of t){const o=n[n.length-1],r=o==null?void 0:o[o.length-1];o&&r&&i.x+i.width-(r.x+r.width)<=gs?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function Py(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 GM(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(y=>y.x+y.width),r=Math.max(...o);if(r-Math.min(...o)>gs)return;const a=t.map(y=>n.get(y.id)).filter(y=>!!y&&typeof y.x=="number");if(a.length<2)return;const s=new Map(t.map(y=>[y.id,y.x]));if(a.some(y=>Math.abs(y.x-s.get(y.id))>gs))return;const c=a.map(y=>y.x+y.width);if(Math.max(...c)-Math.min(...c)<=gs)return;const l=y=>y.x+y.width,u=y=>!!y&&typeof y.width=="number",p=y=>{const v={shapes:[],edges:[],lanes:[]},x=E=>{for(const C of E.children??[]){if("waypoints"in C&&C.waypoints){v.edges.push(C);continue}C.type!=="label"&&(C.type==="bpmn:Lane"?v.lanes.push(C):v.shapes.push(C),x(C))}};return x(y),v},f=new Map(a.map(y=>[y.id,p(y)]));let d=r;for(const y of a){const{shapes:v}=f.get(y.id),x=v.flatMap(E=>[l(E),...u(E.label)?[l(E.label)]:[]]);x.length&&(d=Math.max(d,Math.max(...x)+Ay))}const g=a.filter(y=>Math.abs(l(y)-d)>gs);if(!g.length)return;for(const y of g){const v=l(y),{shapes:x,edges:E,lanes:C}=f.get(y.id);if([...x.flatMap(T=>[l(T),...u(T.label)?[l(T.label)]:[]]),...E.flatMap(T=>[...T.waypoints.map($=>$.x),...u(T.label)?[l(T.label)]:[]])].some(T=>T>d)||[...(y.incoming??[]).map(T=>T.waypoints[T.waypoints.length-1]),...(y.outgoing??[]).map(T=>T.waypoints[0])].some(T=>!T||T.x>d||Math.abs(T.x-v)<1))return;if(d>v){const T={x:v,y:y.y,width:d-v,height:y.height},$=new Set([y.id,...x.map(G=>G.id),...E.map(G=>G.id),...C.map(G=>G.id)]);if(n.getAll().some(G=>{var V;if("waypoints"in G&&G.waypoints||G.type==="bpmn:Group"||!u(G))return!1;const Q=G.type==="label"?(V=G.labelTarget)==null?void 0:V.id:G.id;if(!Q||$.has(Q)||$.has(G.id))return!1;const te=G;return te.x<T.x+T.width&&te.x+te.width>T.x&&te.y<T.y+T.height&&te.y+te.height>T.y}))return}}const h=()=>new Set(ft(Ge(n)).map(lt)),m=h(),w=g.map(y=>y.width);for(const y of g)Ef(i,y,d-y.x,{layout:!1});[...h()].every(y=>m.has(y))||g.forEach((y,v)=>Ef(i,y,w[v],{layout:!1}))}function VM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>ft(l).filter(u=>!t.has(lt(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const p=n.shapes.filter(C=>C.id!==l.id&&C.type!=="bpmn:Group"&&a(l,C));if(!p.length)continue;const f=p.map(C=>i.get(C.id)).filter(C=>!!C&&typeof C.x=="number");if(f.length!==p.length)continue;const d=s(p),g=s(f),h=g.l+(l.x-d.l),m=g.t+(l.y-d.t),w=g.r+(l.x+l.width-d.r),y=g.b+(l.y+l.height-d.b),v={x:h,y:m,width:w-h,height:y-m};if(v.width<=0||v.height<=0||Math.abs(v.x-u.x)<1&&Math.abs(v.y-u.y)<1&&Math.abs(v.width-u.width)<1&&Math.abs(v.height-u.height)<1)continue;const x=r(Ge(i)).length,E={x:u.x,y:u.y,width:u.width,height:u.height};o.resizeShape(u,v),r(Ge(i)).length>x&&o.resizeShape(u,E)}}const ol=20,rl=10;function WM(e,t,n,i){var p,f;const{elementRegistry:o}=e,r=e.modeling,a=d=>new Set(ft(d,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(lt)),s=Ge(o),c=ft(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(lt(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,g]of u){const h=s.shapes.find(ke=>ke.id===d);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const m=l.get(d);if(!(!m||Math.abs(m.x-h.x)>=.5||Math.abs(m.y-h.y)>=.5||Math.abs(m.width-h.width)>=.5||Math.abs(m.height-h.height)>=.5))continue;const y=h.members.map(ke=>o.get(ke)).filter(ke=>!!ke&&typeof ke.x=="number");if(!y.length)continue;const v=Math.min(...y.map(ke=>ke.x)),x=Math.min(...y.map(ke=>ke.y)),E=Math.max(...y.map(ke=>ke.x+ke.width)),C=Math.max(...y.map(ke=>ke.y+ke.height)),D=h.x,P=h.y,T=h.x+h.width,$=h.y+h.height;let j=D,G=P,Q=T,te=$;for(const ke of g){const N=s.edges.find(S=>S.id===ke.edge);if(!N)continue;const M=N.endpoints.some(S=>{const W=s.shapes.find(Re=>Re.id===S);if(!W||W.container)return!1;const X=W.x+W.width/2,re=W.y+W.height/2;return D<X&&X<T&&P<re&&re<$});for(const S of rn(N)){const W=S.axis==="v"?[P,$]:[D,T];Math.min(S.hi,W[1])-Math.max(S.lo,W[0])<ef||(S.axis==="v"?D<S.at&&S.at<T:P<S.at&&S.at<$)&&M||(S.axis==="v"?(Math.abs(S.at-D)<=ha&&(j=Math.max(j,S.at+ol)),Math.abs(S.at-T)<=ha&&(Q=Math.min(Q,S.at-ol))):(Math.abs(S.at-P)<=ha&&(G=Math.max(G,S.at+ol)),Math.abs(S.at-$)<=ha&&(te=Math.min(te,S.at-ol))))}}if(j>v-rl&&(j=D),G>x-rl&&(G=P),Q<E+rl&&(Q=T),te<C+rl&&(te=$),j===D&&G===P&&Q===T&&te===$)continue;const V=o.get(d),ee={x:V.x,y:V.y,width:V.width,height:V.height},Ee=Ge(o),Pe=new Set(ft(Ee).map(lt)),Se=a(Ee);r.resizeShape(V,{x:j,y:G,width:Q-j,height:te-G});let K=Ge(o),oe=ft(K).filter(ke=>!Pe.has(lt(ke)));const Y=[];if(oe.length>0&&oe.every(ke=>ke.kind==="label-over-line"&&!i.has(ke.edge)&&K.edges.some(N=>N.id===ke.edge))){for(const ke of oe){if(ke.kind!=="label-over-line")continue;const N=K.edges.find(re=>re.id===ke.edge),M=N&&bf(N,K),S=(f=o.get(ke.edge))==null?void 0:f.label;if(!M||!S)continue;const W=M.x-S.x,X=M.y-S.y;r.moveElements([S],{x:W,y:X}),Y.push({label:S,dx:W,dy:X})}K=Ge(o),oe=ft(K).filter(ke=>!Pe.has(lt(ke)))}const ce=a(K),xe=[...ce].some(ke=>!Se.has(ke));if(oe.length||xe||ce.size>=Se.size){for(const ke of Y.reverse())r.moveElements([ke.label],{x:-ke.dx,y:-ke.dy});r.resizeShape(V,ee)}}}function UM(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=Dp((o==null?void 0:o.$parent)??o),a=as(i),s=new Map;for(const l of e.keys()){const u=(c=t.get(l))==null?void 0:c.businessObject;s.set(l,u?{texts:Lp(u,i,r),requests:$p(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 Ty(e,t,n={}){var Q,te;const{i18n:i,lower:o=My}=n,r=wy(e),a=Fm(r.elementRegistry),s=xy(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=TM(t,a,i),u=i&&l.writes.size?UM(l.writes,r.elementRegistry,r.canvas,i):void 0,p=Ge(r.elementRegistry),f=new Set(ft(p).map(lt)),d=new Set(ft(p,{includeObservationOnly:!0}).map(lt)),g=new Set(Ry(l.ops,V=>{var ee,Ee;return(Ee=(ee=r.elementRegistry.get(V))==null?void 0:ee.source)==null?void 0:Ee.id}).keys()),h=new Set(p.edges.map(V=>V.id).filter(V=>!g.has(V))),m=new Set(t.flatMap(V=>V.kind==="sequenceFlow.update"&&(V.source!==void 0||V.target!==void 0)?[V.id]:[])),w=new Set(p.shapes.map(V=>V.id)),y=mo(p),v=y.length,x=new Set(y.map(([V,ee])=>`${V}|${ee}`)),E=$i(p),C=new Set(E.map(([V,ee])=>`${V}|${ee}`)),D=new Map;for(const V of r.elementRegistry.filter(ee=>"waypoints"in ee&&!!ee.waypoints))V.label&&D.set(V.id,{wps:V.waypoints.map(ee=>({x:ee.x,y:ee.y})),label:{x:V.label.x,y:V.label.y},source:(Q=V.source)==null?void 0:Q.id,target:(te=V.target)==null?void 0:te.id});const P=e.get("commandStack");try{Vg(P,()=>{o(l.ops,r);for(const ee of(u==null?void 0:u.contexts())??[])P.execute(Bp,ee);jM(r,f,p),HM(r,p),VM(r,f,p),aM(r,p,m),iM(r,h,w),Ym(r,h);const V=uf(r,f);zm(r,x,h),sy(r,f,h),Jm(r,h),vM(r,h,m),iy(r,f,h),EM(r,f,h),eM(r,C,h),fM(r,h,p),dy(r,f,h),fy(r,h,m),gy(r,w),$M(r,f,w),uf(r,f,V),WM(r,d,p,h),my(r,f),py(r,D)})}catch(V){return{ok:!1,issues:[V instanceof Cy?V.issue:{kind:"lower-failed",message:V instanceof Error?V.message:String(V)}],findings:[],stats:c}}const T=Ge(r.elementRegistry),$=ft(T,{includeObservationOnly:!0}).filter(V=>!d.has(lt(V))),j=Pm(T),G=$i(T);return{ok:!0,issues:[],findings:$,stats:{edgeCrossings:{before:v,after:j.pairs.length,pairs:j.pairs,solidPairs:j.solidPairs,dashedPairs:j.dashedPairs,mixedPairs:j.mixedPairs,crossPoolMessages:j.crossPoolMessages},sharedEndpointCrossings:{before:E.length,after:G.length,pairs:G}}}}function qM(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function ky(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Oy(e,t){const n=ky(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Dy(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function YM(e){return typeof e=="string"&&Ap.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 Ly(e,t={}){const n=e.rootElements??[],i=n.find(K=>K.$type==="bpmn:Collaboration"),o=new Map(n.filter(K=>K.$type==="bpmn:Process").map(K=>[K.id,K])),r=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],d=[],g=[],h=[],m=[],w=[],y=[],v=new Map,x=new Set,E=new Set,C=K=>{K&&x.add(K)},D=K=>{x.add(K),E.add(K)},P=K=>{const oe=Dy(K,"bwl:Placement");if(!oe)return;const Y=typeof oe.anchor=="string"?oe.anchor:void 0;if(!Y||!YM(oe.side))return;const Z=typeof oe.offset=="number"?oe.offset:void 0;m.push({owner:K.id,anchor:Y,side:oe.side,...Z!==void 0?{offset:Z}:{}})},T=K=>{const oe=Dy(K,"bwl:Members"),Y=typeof(oe==null?void 0:oe.refs)=="string"?oe.refs.split(/\s+/).filter(Boolean):[];Y.length&&y.push({owner:K.id,refs:Y})},$=K=>{var oe;for(const Y of K)switch(C(Y.id),Y.$type){case"bpmn:TextAnnotation":D(Y.id),v.set(Y.id,Y),c.push({id:Y.id,text:typeof Y.text=="string"?Y.text:""}),P(Y);break;case"bpmn:Association":g.push({id:Y.id,type:Y.$type,source:Hi(Y.sourceRef),target:Hi(Y.targetRef)});break;case"bpmn:Group":{D(Y.id),v.set(Y.id,Y);const Z=(oe=Y.categoryValueRef)==null?void 0:oe.value;l.push({id:Y.id,...typeof Z=="string"&&Z?{name:Z}:{}}),T(Y);break}default:u.push({id:Y.id,type:Y.$type,reason:"type-outside-mvp"})}},j=K=>{for(const oe of K.flowElements??[])C(oe.id),u.push({id:oe.id,type:oe.$type,reason:"inside-container"}),(oe.flowElements??[]).length&&j(oe);for(const oe of K.artifacts??[])C(oe.id),u.push({id:oe.id,type:oe.$type,reason:"inside-container"})},G=(K,oe)=>{const Y=K.flowElements??[],Z=(K.laneSets??[]).flatMap(xe=>xe.lanes??[]),ce=new Map;for(const xe of Z){C(xe.id),v.set(xe.id,xe);for(const ke of xe.flowNodeRef??[]){const N=Hi(ke);N&&ce.set(N,xe.id)}}for(const xe of Y){if(C(xe.id),v.set(xe.id,xe),xe.$type==="bpmn:SequenceFlow"){f.push({id:xe.id,source:Hi(xe.sourceRef),target:Hi(xe.targetRef),...typeof xe.name=="string"&&xe.name?{name:xe.name}:{}});continue}if(xe.$type==="bpmn:DataStoreReference"){D(xe.id),s.push({id:xe.id,...xe.name?{name:xe.name}:{}});continue}const ke=qM(xe.$type),N=ke==="intermediateCatchEvent"?Cp((xe.eventDefinitions??[]).map(X=>X.$type)):void 0;if(!$g(ke)||ke==="intermediateCatchEvent"&&!N){u.push({id:xe.id,type:xe.$type,reason:"type-outside-mvp"});continue}D(xe.id);const M=ke==="boundaryEvent"?Hi(xe.attachedToRef):void 0;a.push({id:xe.id,type:ke,...xe.name?{name:xe.name}:{},...oe?{participant:oe}:{},...ce.has(xe.id)?{lane:ce.get(xe.id)}:{},...M?{attachedTo:M}:{},...N?{eventDefinition:N}:{}}),ke==="subProcess"&&j(xe);const S=Oy(xe,"bwl:band");S!==void 0&&(p.bands[xe.id]=S);const W=ky(xe,"bwl:afterColumn");typeof W=="string"&&W!==""&&w.push([xe.id,W]);for(const X of xe.dataOutputAssociations??[])C(X.id),h.push({id:X.id,type:X.$type,source:xe.id,target:Hi(X.targetRef)});for(const X of xe.dataInputAssociations??[])C(X.id),h.push({id:X.id,type:X.$type,source:Hi((X.sourceRef??[])[0]),target:xe.id})}$(K.artifacts??[])};if(i){const K=new Set;for(const oe of i.participants??[]){D(oe.id),v.set(oe.id,oe);const Y=Hi(oe.processRef);Y&&K.add(Y);const Z=Y?o.get(Y):void 0,ce=((Z==null?void 0:Z.laneSets)??[]).flatMap(M=>M.lanes??[]),xe=ce.map(M=>({id:M.id,...M.name?{name:M.name}:{}}));for(const M of xe)D(M.id);const ke=!Z||(Z.flowElements??[]).length===0&&ce.length===0&&(Z.artifacts??[]).length===0;r.push({id:oe.id,...oe.name?{name:oe.name}:{},...ke?{blackBox:!0}:{},...xe.length?{lanes:xe}:{}});const N=Oy(oe,"bwl:poolOrder");N!==void 0&&(p.poolOrders[oe.id]=N),Z&&G(Z,oe.id)}for(const oe of i.messageFlows??[])C(oe.id),v.set(oe.id,oe),d.push({id:oe.id,source:Hi(oe.sourceRef),target:Hi(oe.targetRef),...typeof oe.name=="string"&&oe.name?{name:oe.name}:{}});$(i.artifacts??[]);for(const[oe,Y]of o)!K.has(oe)&&(Y.flowElements??[]).length>0&&u.push({id:oe,type:Y.$type,reason:"unreachable-process"})}else for(const K of o.values())G(K);const Q=[],te=[],V=[],ee=[],Ee=(K,oe)=>!!K&&!!oe&&E.has(K)&&E.has(oe);for(const K of f){if(!Ee(K.source,K.target)){u.push({id:K.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}Q.push({id:K.id,source:K.source,target:K.target,...K.name?{name:K.name}:{}}),E.add(K.id)}for(const K of d){if(!Ee(K.source,K.target)){u.push({id:K.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}te.push({id:K.id,source:K.source,target:K.target,...K.name?{name:K.name}:{}}),E.add(K.id)}for(const K of h){if(!Ee(K.source,K.target)){u.push({id:K.id??"",type:K.type,reason:"endpoint-outside-mvp"});continue}ee.push({...K.id?{id:K.id}:{},source:K.source,target:K.target}),K.id&&E.add(K.id)}for(const K of g){if(!Ee(K.source,K.target)){u.push({id:K.id??"",type:K.type,reason:"endpoint-outside-mvp"});continue}V.push({...K.id?{id:K.id}:{},source:K.source,target:K.target})}const Pe=new Map(l.map(K=>[K.id,K]));for(const{owner:K,refs:oe}of y){const Y=oe.filter(ce=>x.has(ce)),Z=Pe.get(K);Z&&Y.length&&(Z.members=Y)}for(const K of m)x.has(K.anchor)&&(p.placements[K.owner]={anchor:K.anchor,side:K.side,...K.offset!==void 0?{offset:K.offset}:{}});for(const[K,oe]of w)x.has(oe)&&(p.afterColumns[K]=oe);const Se={...r.length?{participants:r}:{},nodes:a,sequenceFlows:Q,...te.length?{messageFlows:te}:{},...s.length?{dataStores:s}:{},...ee.length?{dataAssociations:ee}:{},...c.length?{annotations:c}:{},...V.length?{associations:V}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:Se,hints:p,omitted:u,i18n:KM(Se,v,e,t.i18n)}:{definition:Se,hints:p,omitted:u}}function KM(e,t,n,i){const o=Dp(n),r=as(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=Lp(u,i,o);Object.keys(p).length&&(c[l]=p);for(const f of $p(u))r.includes(f.locale)&&a.push({id:c.id,...f})};for(const c of e.participants??[]){s(c,"names");for(const l of c.lanes??[])s(l,"names")}for(const c of[e.nodes,e.sequenceFlows,e.messageFlows,e.dataStores,e.groups])for(const l of c??[])s(l,"names");for(const c of e.annotations??[])s(c,"texts");return{designLocale:i.designLocale,companionLocales:r.slice(1),reviewRequests:a}}async function XM(e,t={}){const{definitions:n,warnings:i}=await pa(e);return{...Ly(n,t),warnings:i}}const ZM=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Sf(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function QM(e){return Sf(e.processRef)!==void 0}function JM(e){const t=new Set,n=o=>{const r=Sf(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 eA(e){const t=[],n=i=>{for(const o of i.flowElements??[])ZM.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 tA(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 Rf(e){const t=[],n=e.rootElements??[],i=JM(e);for(const r of eA(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??[])QM(s)&&tA(r.get(Sf(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 nA(e){const{definitions:t,warnings:n}=await pa(e);return{issues:Rf(t),warnings:n}}const iA=.5,oA=8,rA=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),xa=e=>typeof e=="number"?e:Number(e??NaN),al=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function aA(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}=${al(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=>`${al(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(al).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function sA(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?[xa(s.x),xa(s.y),xa(s.width),xa(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=al(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=>[xa(f.x),xa(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 Iy(e){const t=sA(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:")&&!rA.has(s)&&n.set(c,{type:s,props:aA(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 By(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 Ny(e,t,n={}){const i=n.moveTolerance??iA,o=Iy(e),r=Iy(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||By(p.geometry,u.geometry,i)||By(p.label,u.label,n.labelTolerance??oA))&&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 cA(e,t,n={}){const[i,o]=await Promise.all([pa(e),pa(t)]);return{...Ny(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function lA(e){return new Set([...e.added,...e.modified])}function uA(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function $y(e,t,{currentVersion:n,i18n:i}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const o=Ty(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 pA=new Set(["lasso","lasso.selection","hand","hand.move"]),Fy=1e4,fA="bwl-edit-locked",jy=new WeakMap;function dA(e){const t=jy.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",Fy,()=>{var s;if(o)return pA.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"],Fy,()=>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(fA,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 jy.set(e,a),a}const hA=Symbol("bpmn-editor"),Cf={geometry:[],semantic:[]};function gA(){const e=be.ref(!1),t=be.ref(!0),n=be.ref(!1),i=be.shallowRef(Cf),o=be.shallowRef(void 0),r=be.shallowRef(void 0);let a,s,c;const l=()=>{if(p(),!c){i.value=Cf;return}const w=ft(Ge(c.get("elementRegistry")),{includeObservationOnly:!0}),y=c.getDefinitions();i.value={geometry:w,semantic:y?Rf(y):[]}};function u(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function p(){const w=u();if(!w||!a){r.value=void 0;return}const y=w.locales(),v={};for(const x of y)v[x]={untranslated:w.untranslatedCount(x),reviewRequested:w.reviewRequestedCount(x)};r.value={designLocale:a.designLocale,locales:y,displayLocale:w.getDisplayLocale()??a.designLocale,counts:v}}function f(){const w=u();w&&(w.configure(a),a&&s&&(s=w.setDisplayLocale(s)))}const d=()=>{e.value=!0,l()};function g(w,y){dA(w).set(!y)}function h(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function m(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:l,changeScope:o,i18n:r,configureI18n(w){a=w,f(),p()},setDisplayLocale(w){var v;s=w;const y=(v=u())==null?void 0:v.setDisplayLocale(w);y&&(s=y),p()},setChangeScope(w){o.value=w===void 0?void 0:new Set(w)},requestFocus(w){if(!c)return;const y=c.get("elementRegistry").get(w);y&&(c.get("canvas").scrollToElement(y,180),c.get("selection").select(y))},describeElement(w){const y=c==null?void 0:c.get("elementRegistry").get(w),v=y==null?void 0:y.businessObject;if(!v)return;const x=typeof v.name=="string"&&v.name.trim()!==""?v.name:v.text;return{name:typeof x=="string"&&x.trim()!==""?x.trim():void 0,type:typeof v.$type=="string"?v.$type:""}},attach(w){c&&this.detach(),c=w,c.get("eventBus").on("commandStack.changed",d),t.value||g(c,!1),f(),l()},detach(){c==null||c.get("eventBus").off("commandStack.changed",d),c&&!t.value&&g(c,!0),c=void 0,i.value=Cf,o.value=void 0,r.value=void 0},setEditable(w){t.value=w,c&&g(c,w)},async applyAgentBatch(w,y){const v=h();n.value=!0;try{const x=await $y(v,w,{currentVersion:y,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return x.status==="applied"&&(e.value=!1),x}finally{n.value=!1}},async importXml(w){const{warnings:y}=await h().importXML(w);return e.value=!1,o.value=void 0,l(),{warnings:Jp(y)}},async saveXml(){const{xml:w}=await h().saveXML({format:!0});return e.value=!1,w??""},undo:()=>{var w;return(w=m())==null?void 0:w.undo()},redo:()=>{var w;return(w=m())==null?void 0:w.redo()},canUndo:()=>{var w;return((w=m())==null?void 0:w.canUndo())??!1},canRedo:()=>{var w;return((w=m())==null?void 0:w.canRedo())??!1}}}const mA=new RegExp("\\p{Script=Hangul}","u"),yA=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,vA=new RegExp("\\p{Script=Han}","u");function sl(e){const t=mA.test(e),n=yA.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:vA.test(e)?"han":"other"}}function Hy(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 zy(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=Cr(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:Fo(a).filter(l=>Sn(l))})}return n}const ms=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function bA(e){const t=Hy(e),n=zy(e);let i;const o={},r=[],a=[],s=[];for(const g of n){const h=g.trs.filter(m=>(m.body??"")===g.name).map(Sn);if(h.length){const m=[...h].sort().join("+");o[m]=(o[m]??0)+1,i=i?new Set([...i].filter(w=>h.includes(w))):new Set(h)}else g.trs.some(m=>m.body)?r.push(ms(g)):s.push({e:g,inference:sl(g.name)});for(const m of g.trs){const w=Sn(m),y=m.body??"",v=sl(y);v.locale&&v.locale!==w?a.push({...ms(g),locale:w,script:v.script}):w==="ko"&&v.script==="han"&&g.trs.some(x=>x!==m&&x.body===y)&&a.push({...ms(g),locale:w,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({...ms(g),locale:h.locale}):d.push({...ms(g),script:h.script});return{root:{current:t,proposed:l,reason:u},additions:f,undecided:d,drift:r,matchedBy:o,scriptMismatch:a}}function xA(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!Hy(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(zy(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=>Sn(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(Rr,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Gy(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 Mf=e=>Sn(e)||void 0,Vy=e=>e.body??"";function Wy(e){const t=new Map;for(const n of Gy(e)){const i=Fo(n);i.length&&t.set(n.id,{type:n.$type,cells:i.map(o=>({locale:Mf(o),body:Vy(o)}))})}return t}const Uy=e=>JSON.stringify(e.map(t=>t.body).sort());class wA{constructor(){Fn(this,"byId",new Map);Fn(this,"byBodies",new Map)}add(t,n,i){for(const[o,r]of i){if(!r.cells.some(s=>s.locale))continue;const a={doc:t,version:n,id:o,state:r};qy(this.byId,o,a),qy(this.byBodies,Uy(r.cells),a)}}sameId(t){return this.byId.get(t)??[]}sameBodies(t){return this.byBodies.get(Uy(t))??[]}}function qy(e,t,n){const i=e.get(t);i?i.push(n):e.set(t,[n])}function _A(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 Af(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 EA(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 RA(e,t){const n={restores:[],ambiguous:[],stale:[],unresolved:[]},i=Wy(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=_A(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&&Af(m.state,c)).sort((m,w)=>w.version-m.version).slice(0,1).map(m=>m.state)],["lineage",t.index.sameId(a).filter(m=>m.doc!==t.doc&&Af(m.state,c)).map(m=>m.state)],["bodies",t.index.sameBodies(s.cells).filter(m=>!(m.doc===t.doc&&m.id===a)&&Af(m.state,c)).map(m=>m.state)]].find(([,m])=>m.length);if(!p){if(!r(s))continue;for(const[m,w]of c)for(let y=0;y<w;y++)n.unresolved.push({...l,body:m,script:sl(m).script});continue}const[f,d]=p,g=d.map(m=>EA(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 CA(e,t){if(!t.restores.length)return 0;const n=new Map(Gy(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=Fo(r),s=new Set(a.map(Mf).filter(Boolean));for(const{body:c,locale:l}of o.cells){if(s.has(l))continue;const u=a.find(p=>!Mf(p)&&Vy(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 MA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pf={exports:{}},Yy;function AA(){if(Yy)return Pf.exports;Yy=1;var e=Pf.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},Pf.exports}var PA=AA(),TA=MA(PA);function Ki(e){if(!(this instanceof Ki))return new Ki(e);e=e||[128,36,1],this._seed=e.length?TA.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 yn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};yn.td=yn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],yn.option=yn.optgroup=[1,'<select multiple="multiple">',"</select>"],yn.thead=yn.tbody=yn.colgroup=yn.caption=yn.tfoot=[1,"<table>","</table>"],yn.polyline=yn.ellipse=yn.polygon=yn.circle=yn.text=yn.line=yn.path=yn.rect=yn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function zt(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:p}=u;return p.remove(),p}let[o,r,a]=Object.hasOwn(yn,i)?yn[i]:yn._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 kA(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var o=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function qn(e,...t){const n=e.style;return z(t,function(i){i&&z(i,function(o,r){n[r]=o})}),e}function Rn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const OA=Object.prototype.toString;function Mt(e){return new Wo(e)}function Wo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Wo.prototype.add=function(e){return this.list.add(e),this},Wo.prototype.remove=function(e){return OA.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Wo.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Wo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Wo.prototype.array=function(){return Array.from(this.list)},Wo.prototype.has=Wo.prototype.contains=function(e){return this.list.contains(e)};function cl(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function kr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function DA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ll={},Ky;function LA(){if(Ky)return ll;Ky=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return ll.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},ll.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},ll}var Xy=LA(),IA=DA(Xy),je=kA({__proto__:null,default:IA},[Xy]),Zy=["focus","blur"];function BA(e,t,n,i,o){return Zy.indexOf(n)!==-1&&(o=!0),je.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=kr(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function NA(e,t,n,i){return Zy.indexOf(t)!==-1&&(i=!0),je.unbind(e,t,n,i)}var ni={bind:BA,unbind:NA};function Tf(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Ct(e,t){return t=t||document,t.querySelector(e)}function ys(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 FA(e,t){return t.appendChild($A(e,t))}function Xe(e,t){return FA(t,e),e}var kf=2,Qy={"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":kf,"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":kf,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function jA(e,t){return Qy[t]?e.style[t]:e.getAttributeNS(null,t)}function Jy(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=Qy[i];o?(o===kf&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function HA(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)Jy(e,o,t[o])}function Ce(e,t,n){if(typeof t=="string")if(n!==void 0)Jy(e,t,n);else return jA(e,t);else HA(e,t);return e}const zA=Object.prototype.toString;function ut(e){return new Uo(e)}function Uo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Uo.prototype.add=function(e){return this.list.add(e),this},Uo.prototype.remove=function(e){return zA.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Uo.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},Uo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Uo.prototype.array=function(){return Array.from(this.list)},Uo.prototype.has=Uo.prototype.contains=function(e){return this.list.contains(e)};function vs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Of(e){return e.cloneNode(!0)}var Df={svg:"http://www.w3.org/2000/svg"},ev='<svg xmlns="'+Df.svg+'"';function GA(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Df.svg)===-1&&(e=ev+e.substring(4)):(e=ev+">"+e+"</svg>",t=!0);var n=VA(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function VA(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=GA(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Df.svg,e),t&&Ce(n,t),n}var Lf=null;function tv(){return Lf===null&&(Lf=Be("svg")),Lf}function nv(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function WA(e,t,n,i,o,r){var a=tv().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return nv(a,e);case 6:return nv(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function bs(e){return tv().createSVGTransform()}var iv=/([&<>]{1})/g,UA=/([&<>\n\r"]{1})/g,qA={"&":"&","<":"<",">":">",'"':"'"};function If(e,t){function n(i,o){return qA[o]||o}return e.replace(t,n)}function ov(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(If(e.textContent,iv));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,'="',If(r.value,UA),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)ov(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",If(e.nodeValue,iv),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function YA(e){for(var t=e.firstChild,n=[];t;)ov(t,n),t=t.nextSibling;return n.join("")}function rv(e,t){return YA(e)}function an(e){var t=e.parentNode;return t&&t.removeChild(e),e}function KA(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function XA(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(KA(e,i))}function xs(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),XA(n,t)),n.consolidate()}const ZA=/^class[ {]/;function QA(e){return ZA.test(e.toString())}function Bf(e){return Array.isArray(e)}function Nf(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ul(...e){e.length===1&&Bf(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const JA=/constructor\s*[^(]*\(\s*([^)]*)\)/m,eP=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,tP=/\/\*([^*]*)\*\//m;function nP(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(QA(e)?JA:eP);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(tP);return(o&&o[1]||i).trim()})||[]}function av(e,t){const n=t||{get:function(v,x){if(i.push(v),x===!1)return null;throw s(`No provider for "${v}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),a=r.injector=this,s=function(v){const x=i.join(" -> ");return i.length=0,new Error(x?`${v} (Resolving: ${x})`:v)};function c(v,x){if(!o[v]&&v.includes(".")){const E=v.split(".");let C=c(E.shift());for(;E.length;)C=C[E.shift()];return C}if(Nf(r,v))return r[v];if(Nf(o,v)){if(i.indexOf(v)!==-1)throw i.push(v),s("Cannot resolve circular dependency!");return i.push(v),r[v]=o[v][0](o[v][1]),i.pop(),r[v]}return n.get(v,x)}function l(v,x){if(typeof x>"u"&&(x={}),typeof v!="function")if(Bf(v))v=ul(v.slice());else throw s(`Cannot invoke "${v}". Expected a function!`);const C=(v.$inject||nP(v)).map(D=>Nf(x,D)?x[D]:c(D));return{fn:v,dependencies:C}}function u(v){const{fn:x,dependencies:E}=l(v),C=Function.prototype.bind.call(x,null,...E);return new C}function p(v,x,E){const{fn:C,dependencies:D}=l(v,E);return C.apply(x,D)}function f(v){return ul(x=>v.get(x))}function d(v,x){if(x&&x.length){const E=Object.create(null),C=Object.create(null),D=[],P=[],T=[];let $,j,G,Q;for(let te in o)$=o[te],x.indexOf(te)!==-1&&($[2]==="private"?(j=D.indexOf($[3]),j===-1?(G=$[3].createChild([],x),Q=f(G),D.push($[3]),P.push(G),T.push(Q),E[te]=[Q,te,"private",G]):E[te]=[T[j],te,"private",P[j]]):E[te]=[$[2],$[1]],C[te]=!0),($[2]==="factory"||$[2]==="type")&&$[1].$scope&&x.forEach(V=>{$[1].$scope.indexOf(V)!==-1&&(E[te]=[$[2],$[1]],C[V]=!0)});x.forEach(te=>{if(!C[te])throw new Error('No provider for "'+te+'". Cannot use provider from the parent!')}),v.unshift(E)}return new av(v,a)}const g={factory:p,type:u,value:function(v){return v}};function h(v,x){const E=v.__init__||[];return function(){E.forEach(C=>{typeof C=="string"?x.get(C):x.invoke(C)})}}function m(v){const x=v.__exports__;if(x){const E=v.__modules__,C=Object.keys(v).reduce((j,G)=>(G!=="__exports__"&&G!=="__modules__"&&G!=="__init__"&&G!=="__depends__"&&(j[G]=v[G]),j),Object.create(null)),D=(E||[]).concat(C),P=d(D),T=ul(function(j){return P.get(j)});x.forEach(function(j){o[j]=[T,j,"private",P]});const $=(v.__init__||[]).slice();return $.unshift(function(){P.init()}),v=Object.assign({},v,{__init__:$}),h(v,P)}return Object.keys(v).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const C=v[E];if(C[2]==="private"){o[E]=C;return}const D=C[0],P=C[1];o[E]=[g[D],iP(D,P),D]}),h(v,a)}function w(v,x){return v.indexOf(x)!==-1||(v=(x.__depends__||[]).reduce(w,v),v.indexOf(x)!==-1)?v:v.concat(x)}function y(v){const x=v.reduce(w,[]).map(m);let E=!1;return function(){E||(E=!0,x.forEach(C=>C()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=y(e)}function iP(e,t){return e!=="value"&&Bf(t)&&(t=ul(t.slice())),t}var oP=1e3;function vo(e,t){var n=this;t=t||oP,e.on(["render.shape","render.connection"],t,function(i,o){var r=i.type,a=o.element,s=o.gfx,c=o.attrs;if(n.canRender(a))return r==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,o){if(n.canRender(o))return i.type==="render.getShapePath"?n.getShapePath(o):n.getConnectionPath(o)})}vo.prototype.canRender=function(e){},vo.prototype.drawShape=function(e,t){},vo.prototype.drawConnection=function(e,t){},vo.prototype.getShapePath=function(e){},vo.prototype.getConnectionPath=function(e){};function Or(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function rP(e){return["M",e.x,e.y]}function $f(e){return["L",e.x,e.y]}function aP(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function sP(e,t){const n=e.length,i=[rP(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($f(a));continue}const c=Math.min(t,Ff(a.x-r.x,a.y-r.y),Ff(s.x-a.x,s.y-a.y));if(!c){i.push($f(a));continue}const l=pl(a,r,c),u=pl(a,r,c*.5),p=pl(a,s,c),f=pl(a,s,c*.5);i.push($f(l)),i.push(aP(u,f,p))}return i}function pl(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=Ff(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function Ff(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function ws(e,t,n){qe(t)&&(n=t,t=null),t||(t={});const i=Be("path",t);return qe(n)&&(i.dataset.cornerRadius=String(n)),jf(i,e)}function jf(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Ce(e,{d:Or(sP(t,n))}),e}function fl(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 Dr(e,t,n){n=n||0,Ue(e)||(e=[e]),z(e,function(i,o){var r=t(i,o,n);Ue(r)&&r.length&&Dr(r,t,n+1)})}function Hf(e,t,n){var i=new Set,o=new Set;return Dr(e,function(r,a,s){i.add(r);var c=r.children;if(c&&!o.has(c))return o.add(c),c}),Array.from(i)}function _s(e,t){return Hf(e)}function cP(e,t,n){Sr(t)&&(t=!0),mn(t)&&(n=t,t=!0),n=n||{};var i=Es(n.allShapes),o=Es(n.allConnections),r=Es(n.enclosedElements),a=Es(n.enclosedConnections),s=Es(n.topLevel,t&&sa(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=r[u.id]=u),o[u.id]=u}function l(u){if(r[u.id]=u,u.waypoints)a[u.id]=o[u.id]=u;else return i[u.id]=u,z(u.incoming,c),z(u.outgoing,c),u.children}return Dr(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function sn(e,t){t=!!t,Ue(e)||(e=[e]);var n,i,o,r;return z(e,function(a){var s=a;a.waypoints&&!t&&(s=sn(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 wa(e,t){var n={};return z(e,function(i){var o=i;o.waypoints&&(o=sn(o)),!qe(t.y)&&o.x>t.x&&(n[i.id]=i),!qe(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(qe(t.width)&&qe(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!qe(t.width)||!qe(t.height))&&(n[i.id]=i)}),n}function sv(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function cv(e){return!!(e&&e.isFrame)}function Es(e,t){return q({},e||{},t||{})}var lP=1;function qo(e,t){vo.call(this,e,lP),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(qo,vo),qo.prototype.canRender=function(){return!0},qo.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}),cv(n)?Ce(o,q({},this.FRAME_STYLE,i||{})):Ce(o,q({},this.SHAPE_STYLE,i||{})),Xe(t,o),o},qo.prototype.drawConnection=function(t,n,i){var o=ws(n.waypoints,q({},this.CONNECTION_STYLE,i||{}));return Xe(t,o),o},qo.prototype.getShapePath=function(t){var n=t.x,i=t.y,o=t.width,r=t.height,a=[["M",n,i],["l",o,0],["l",0,r],["l",-o,0],["z"]];return Or(a)},qo.prototype.getConnectionPath=function(t){var n=t.waypoints,i,o,r=[];for(i=0;o=n[i];i++)o=o.original||o,r.push([i===0?"M":"L",o.x,o.y]);return Or(r)},qo.$inject=["eventBus","styles"];function uP(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,o){var r=this.style(i,o);return q(r,{class:n})},this.style=function(n,i){!Ue(n)&&!i&&(i=n,n=[]);var o=ti(n,function(r,a){return q(r,e[a]||{})},{});return i?q(o,i):o},this.computeStyle=function(n,i,o){return Ue(i)||(o=i,i=[]),t.style(i||[],q({},o,n||{}))}}const pP={__init__:["defaultRenderer"],defaultRenderer:["type",qo],styles:["type",uP]};function tn(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function nn(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 zf(e,t){return!e||!t?-1:e.indexOf(t)}function Ss(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Gf(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var o=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),r=Ss(e,t);return Math.abs(o/r)<=i}var fP=2;function bo(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(dP(o,n))return r;return!1}function dP(e,t){const n=t[0];return No(t,function(i){return Math.abs(n[e]-i[e])<=fP})}function lv(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 Vf(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var hP=/,?([a-z]),?/gi,uv=parseFloat,cn=Math,Yo=cn.PI,Zi=cn.min,Qi=cn.max,pv=cn.pow,Ko=cn.abs,gP=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,mP=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,fv=Array.isArray||function(e){return e instanceof Array};function yP(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function vP(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 bP(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 yP(o,i)?(vP(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function xP(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(gP,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(mP,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=Uf,n}function wP(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 _P(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 Wf(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 Uf(){return this.join(",").replace(hP,"$1")}function EP(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=Uf,t}function dv(e,t,n,i,o,r,a,s,c){var l=1-c,u=pv(l,3),p=pv(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:dl(g),y:dl(h)}}function hv(e){var t=PP(...e);return Wf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Xo(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=Wf(e),t=Wf(t),Xo(t,e.x,e.y)||Xo(t,e.x2,e.y)||Xo(t,e.x,e.y2)||Xo(t,e.x2,e.y2)||Xo(e,t.x,t.y)||Xo(e,t.x2,t.y)||Xo(e,t.x,t.y2)||Xo(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 gv(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 mv(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=gv(h,e,n,o,a),w=gv(h,t,i,r,s),y=m*m+w*w;d+=f[g]*cn.sqrt(y)}return l*d}function RP(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=dl(c/u),f=dl(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 dl(e){return Math.round(e*1e11)/1e11}function CP(e,t,n){var i=hv(e),o=hv(t);if(!SP(i,o))return[];var r=mv(...e),a=mv(...t),s=vv(e)?1:~~(r/5)||1,c=vv(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=dv(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=dv(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var m=l[d],w=l[d+1],y=u[g],v=u[g+1],x=Ko(w.x-m.x)<.01?"y":"x",E=Ko(v.x-y.x)<.01?"y":"x",C=RP(m.x,m.y,w.x,w.y,y.x,y.y,v.x,v.y),D;if(C){if(D=C.x.toFixed(9)+"#"+C.y.toFixed(9),p[D])continue;p[D]=!0;var P=m.t+Ko((C[x]-m[x])/(w[x]-m[x]))*(w.t-m.t),T=y.t+Ko((C[E]-y[E])/(v[E]-y[E]))*(v.t-y.t);P>=0&&P<=1&&T>=0&&T<=1&&f.push({x:C.x,y:C.y,t1:P,t2:T})}}return f}function yv(e,t,n){e=wv(e),t=wv(t);for(var i,o,r,a,s,c,l,u,p,f,d=n?0:[],g=0,h=e.length;g<h;g++){var m=e[g];if(m[0]=="M")i=s=m[1],o=c=m[2];else{m[0]=="C"?(p=[i,o,...m.slice(1)],i=p[6],o=p[7]):(p=[i,o,i,o,s,c,s,c],i=s,o=c);for(var w=0,y=t.length;w<y;w++){var v=t[w];if(v[0]=="M")r=l=v[1],a=u=v[2];else{v[0]=="C"?(f=[r,a,...v.slice(1)],r=f[6],a=f[7]):(f=[r,a,r,a,l,u,l,u],r=l,a=u);var x=CP(p,f);{for(var E=0,C=x.length;E<C;E++)x[E].segment1=g,x[E].segment2=w,x[E].bez1=p,x[E].bez2=f;d=d.concat(x)}}}}}return d}function MP(e){return fv(e)&&fv(e[0])}function AP(e){if(wP(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=Uf,t}function vv(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function hl(e,t,n,i){return[e,t,n,i,n,i]}function bv(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 xv(e,t,n,i,o,r,a,s,c,l){var u=Yo*120/180,p=Yo/180*(+o||0),f=[],d,g=bP(function(N,M,S){var W=N*cn.cos(S)-M*cn.sin(S),X=N*cn.sin(S)+M*cn.cos(S);return{x:W,y:X}});if(l)D=l[0],P=l[1],E=l[2],C=l[3];else{d=g(e,t,-p),e=d.x,t=d.y,d=g(s,c,-p),s=d.x,c=d.y;var h=(e-s)/2,m=(t-c)/2,w=h*h/(n*n)+m*m/(i*i);w>1&&(w=cn.sqrt(w),n=w*n,i=w*i);var y=n*n,v=i*i,x=(r==a?-1:1)*cn.sqrt(Ko((y*v-y*m*m-v*h*h)/(y*m*m+v*h*h))),E=x*n*m/i+(e+s)/2,C=x*-i*h/n+(t+c)/2,D=cn.asin(((t-C)/i).toFixed(9)),P=cn.asin(((c-C)/i).toFixed(9));D=e<E?Yo-D:D,P=s<E?Yo-P:P,D<0&&(D=Yo*2+D),P<0&&(P=Yo*2+P),a&&D>P&&(D=D-Yo*2),!a&&P>D&&(P=P-Yo*2)}var T=P-D;if(Ko(T)>u){var $=P,j=s,G=c;P=D+u*(a&&P>D?1:-1),s=E+n*cn.cos(P),c=C+i*cn.sin(P),f=xv(s,c,n,i,o,0,a,j,G,[P,$,E,C])}T=P-D;var Q=cn.cos(D),te=cn.sin(D),V=cn.cos(P),ee=cn.sin(P),Ee=cn.tan(T/4),Pe=4/3*n*Ee,Se=4/3*i*Ee,K=[e,t],oe=[e+Pe*te,t-Se*Q],Y=[s+Pe*ee,c-Se*V],Z=[s,c];if(oe[0]=2*K[0]-oe[0],oe[1]=2*K[1]-oe[1],l)return[oe,Y,Z].concat(f);f=[oe,Y,Z].concat(f).join().split(",");for(var ce=[],xe=0,ke=f.length;xe<ke;xe++)ce[xe]=xe%2?g(f[xe-1],f[xe],p).y:g(f[xe],f[xe+1],p).x;return ce}function PP(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,f,d,g,h,m,w,y=0;y<2;++y){if(y==0?(p=6*e-12*n+6*o,u=-3*e+9*n-9*o+3*a,f=3*n-3*e):(p=6*t-12*i+6*r,u=-3*t+9*i-9*r+3*s,f=3*i-3*t),Ko(u)<1e-12){if(Ko(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}m=p*p-4*f*u,w=cn.sqrt(m),!(m<0)&&(g=(-p+w)/(2*u),0<g&&g<1&&c.push(g),h=(-p-w)/(2*u),0<h&&h<1&&c.push(h))}for(var v=c.length,x=v,E;v--;)d=c[v],E=1-d,l[0][v]=E*E*E*e+3*E*E*d*n+3*E*d*d*o+d*d*d*a,l[1][v]=E*E*E*t+3*E*E*d*i+3*E*d*d*r+d*d*d*s;return l[0][x]=e,l[1][x]=t,l[0][x+1]=a,l[1][x+1]=s,l[0].length=l[1].length=x+2,{x0:Zi(...l[0]),y0:Zi(...l[1]),x1:Qi(...l[0]),y1:Qi(...l[1])}}function wv(e){if(MP(e)||(e=xP(e)),_P(e))return e;for(var t=EP(AP(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",...xv(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",...bv(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",...bv(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...hl(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...hl(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...hl(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...hl(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=uv(u[p-4])||n.x,n.by=uv(u[p-3])||n.y}return t}function Ot(e){return mn(e)&&ei(e,"waypoints")}function it(e){return mn(e)&&ei(e,"labelTarget")}function TP(e){return mn(e)&&ra(e.parent)}function _v(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function xo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ze(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function gl(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function kP(e){return xo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function OP(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=IP(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 Ye(e){return Ot(e)?OP(e):kP(e)}function On(e,t,n){n=n||0,mn(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 Rs(e,t,n){var i=DP(e,t);return i.length===1||i.length===2&&Ss(i[0],i[1])<1?xo(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}),xo(i[n?0:i.length-1])):null}function DP(e,t){return yv(e,t)}function LP(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],Ss(n,o)===0||Gf(i,o,n)?e.splice(t,1):t++;return e}function IP(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ml(e,t){return Math.round(e*t)/t}function Ev(e){return qe(e)?e+"px":e}function BP(e){for(;e.parent;)e=e.parent;return e}function NP(e){e=q({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),qn(n,{position:"relative",overflow:"hidden",width:Ev(e.width),height:Ev(e.height)}),t.appendChild(n),n}function Sv(e,t,n){const i=Be("g");ut(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",Rv=0,FP=1,jP={shape:["x","y","width","height"],connection:["waypoints"]};function Ke(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||{})}Ke.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Ke.prototype._init=function(e){const t=this._eventBus,n=this._container=NP(e),i=this._svg=Be("svg");Ce(i,{width:"100%",height:"100%"}),Rn(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")}),Xe(n,i);const o=this._viewport=Sv(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Op(this._viewboxChanged,300)),this._restoreFocus=Op(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)},Ke.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},Ke.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Ke.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=sv(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Ke.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Ke.prototype.restoreFocus=function(){this._restoreFocus()},Ke.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Ke.prototype.isFocused=function(){return this._focused},Ke.prototype.getDefaultLayer=function(){return this.getLayer($P,Rv)},Ke.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},Ke.prototype._getChildIndex=function(e){return ti(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Ke.prototype._createLayer=function(e,t){typeof t>"u"&&(t=FP);const n=this._getChildIndex(t);return{group:Sv(this._viewport,"layer-"+e,n),index:t,visible:!0}},Ke.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},Ke.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&&(an(n),t.visible=!1),n},Ke.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],an(t.group))},Ke.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Ke.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},Ke.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Ke.prototype._findPlaneForRoot=function(e){return Bt(this._planes,function(t){return t.rootElement===e})},Ke.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Ke.prototype._resolveElements=function(e){return Ue(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Ke.prototype.getContainer=function(){return this._container},Ke.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),ut(o).add(t)):(e.markers.delete(t),ut(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Ke.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Ke.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Ke.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Ke.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Ke.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Ke.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,Rv);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Ke.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},Ke.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},Ke.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)},Ke.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})},Ke.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})},Ke.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=jP[e];if(!No(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Ke.prototype._setParent=function(e,t,n){nn(t.children,e,n),e.parent=t},Ke.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},Ke.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Ke.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Ke.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),tn(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},Ke.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Ke.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Ke.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Ke.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Ke.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Ke.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,o,r,a,s,c,l;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const u=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);xs(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=xs(t),o=a?a.matrix:WA(),s=ml(o.a,1e3),c=ml(-o.e||0,1e3),l=ml(-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},Ke.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=q({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Cv(t,n)}),{x:n.e,y:n.f}},Ke.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=sn(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 g=Math.max(0,s.right-f.right),h=Math.min(0,s.left-f.left),m=Math.max(0,s.bottom-f.bottom),w=Math.min(0,s.top-f.top);u=g||h,p=m||w}this.scroll({dx:-u*l,dy:-p*l})},Ke.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)}),ml(i.a,1e3)};function Cv(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Ke.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},Ke.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,o=n.createSVGMatrix(),r=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const p=c.a;return t?(a=q(r,t),s=a.matrixTransform(c.inverse()),l=o.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),u=c.multiply(l)):u=o.scale(e),Cv(this._viewport,u),u},Ke.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Ke.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}},Ke.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var _a="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),Ce(t,_a,i),n&&Ce(n,_a,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&&(Ce(i.gfx,_a,""),i.secondaryGfx&&Ce(i.secondaryGfx,_a,""),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&&Ce(t,_a,i),t},gi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Ce(e,_a);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 HP(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 zP(e){return e.__refs_collection===!0}function GP(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Mv(e,t,n){var i=HP(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 VP(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?Mv(this,t,e):VP(this,t,e)},wi.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return zP(n)||Mv(this,t,e),n},wi.prototype.ensureBound=function(e,t){GP(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 qf=new wi({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Av=new wi({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Pv=new wi({name:"attachers",collection:!0},{name:"host"}),Tv=new wi({name:"outgoing",collection:!0},{name:"source"}),kv=new wi({name:"incoming",collection:!0},{name:"target"});function Ea(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),qf.bind(this,"parent"),Av.bind(this,"labels"),Tv.bind(this,"outgoing"),kv.bind(this,"incoming")}function Cs(){Ea.call(this),qf.bind(this,"children"),Pv.bind(this,"host"),Pv.bind(this,"attachers")}Te(Cs,Ea);function Ov(){Ea.call(this),qf.bind(this,"children")}Te(Ov,Cs);function Dv(){Cs.call(this),Av.bind(this,"labelTarget")}Te(Dv,Cs);function Lv(){Ea.call(this),Tv.bind(this,"source"),kv.bind(this,"target")}Te(Lv,Ea);var WP={connection:Lv,shape:Cs,label:Dv,root:Ov};function UP(e,t){var n=WP[e];if(!n)throw new Error("unknown type: <"+e+">");return q(new n,t)}function qP(e){return e instanceof Ea}function wo(){this._uid=12}wo.prototype.createRoot=function(e){return this.create("root",e)},wo.prototype.createLabel=function(e){return this.create("label",e)},wo.prototype.createShape=function(e){return this.create("shape",e)},wo.prototype.createConnection=function(e){return this.create("connection",e)},wo.prototype.create=function(e,t){return t=q({},t||{}),t.id||(t.id=e+"_"+this._uid++),UP(e,t)};var yl="__fn",Iv=1e3,YP=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=Ue(e)?e:[e],wn(t)&&(i=n,n=t,t=Iv),!qe(t))throw new Error("priority must be a number");var o=n;i&&(o=Xn(n,i),o[yl]=n[yl]||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(wn(t)&&(i=n,n=t,t=Iv),!qe(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[yl]=n,this.on(e,t,r)},ii.prototype.off=function(e,t){e=Ue(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},ii.prototype.createEvent=function(e){var t=new Ms;return t.init(e),t},ii.prototype.fire=function(e,t){var n,i,o,r;if(r=YP.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof Ms?n=t:n=this.createEvent(t),r[0]=n;var a=n.type;e!==a&&(n.type=e);try{o=this._invokeListeners(n,r,i)}finally{e!==a&&(n.type=a)}return o===void 0&&n.defaultPrevented&&(o=!1),o}},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=KP(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[yl]===t)&&(o?o.next=i:this._setListeners(e,i)),o=n,n=i};function Ms(){}Ms.prototype.stopPropagation=function(){this.cancelBubble=!0},Ms.prototype.preventDefault=function(){this.defaultPrevented=!0},Ms.prototype.init=function(e){q(this,e||{})};function KP(e,t){return e.apply(null,t)}function Zo(e){return e.childNodes[0]}function XP(e){return e.parentNode.childNodes[1]}function vl(e,t,n,i,o){var r=bs();r.setTranslate(t,n);var a=bs();a.setRotate(i||0,0,0);var s=bs();s.setScale(1,1),xs(e,[r,a,s])}function Dn(e,t,n){var i=bs();i.setTranslate(t,n),xs(e,i)}function Bv(e,t){var n=bs();n.setRotate(t,0,0),xs(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=XP(t),n||(n=Be("g"),ut(n).add("djs-children"),Xe(t.parentNode,n))):n=t,n},mi.prototype._clear=function(e){var t=Zo(e);return cl(t),t},mi.prototype._createContainer=function(e,t,n,i){var o=Be("g");ut(o).add("djs-group"),typeof n<"u"?ZP(o,t,t.childNodes[n]):Xe(t,o);var r=Be("g");ut(r).add("djs-element"),ut(r).add("djs-"+e),i&&ut(r).add("djs-frame"),Xe(o,r);var a=Be("g");return ut(a).add("djs-visual"),Xe(r,a),r},mi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,cv(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?Ce(n,"display","none"):Ce(n,"display","block")}},mi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);an(t.parentNode)};function ZP(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const QP={__depends__:[pP],__init__:["canvas"],canvas:["type",Ke],elementRegistry:["type",gi],elementFactory:["type",wo],eventBus:["type",ii],graphicsFactory:["type",mi]};function JP(e){var t=new av(e);return t.init(),t}function eT(e){e=e||{};var t={config:["value",e]},n=[t,QP].concat(e.modules||[]);return JP(n)}function Qo(e,t){this._injector=t||eT(e),this.get("eventBus").fire("diagram.init")}Qo.prototype.get=function(e,t){return this._injector.get(e,t)},Qo.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Qo.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Qo.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Gn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Zn(e,t){return e.$instanceOf(t)}function tT(e){return Bt(e.rootElements,function(t){return Zn(t,"bpmn:Process")||Zn(t,"bpmn:Collaboration")})}function nT(e){var t={},n=[],i={};function o(Y,Z){return function(ce){Y(ce,Z)}}function r(Y){t[Y.id]=Y}function a(Y){return t[Y.id]}function s(Y,Z){var ce=Y.gfx;if(ce)throw new Error(`already rendered ${Gn(Y)}`);return e.element(Y,i[Y.id],Z)}function c(Y,Z){return e.root(Y,i[Y.id],Z)}function l(Y,Z){try{var ce=i[Y.id]&&s(Y,Z);return r(Y),ce}catch(xe){u(xe.message,{element:Y,error:xe}),console.error(`failed to import ${Gn(Y)}`,xe)}}function u(Y,Z){e.error(Y,Z)}var p=this.registerDi=function(Z){var ce=Z.bpmnElement;ce?i[ce.id]?u(`multiple DI elements defined for ${Gn(ce)}`,{element:ce}):i[ce.id]=Z:u(`no bpmnElement referenced in ${Gn(Z)}`,{element:Z})};function f(Y){d(Y.plane)}function d(Y){p(Y),z(Y.planeElement,g)}function g(Y){p(Y)}this.handleDefinitions=function(Z,ce){var xe=Z.diagrams;if(ce&&xe.indexOf(ce)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ce&&xe&&xe.length&&(ce=xe[0]),!ce)throw new Error("no diagram to display");i={},f(ce);var ke=ce.plane;if(!ke)throw new Error(`no plane for ${Gn(ce)}`);var N=ke.bpmnElement;if(!N)if(N=tT(Z),N)u(`correcting missing bpmnElement on ${Gn(ke)} to ${Gn(N)}`),ke.bpmnElement=N,p(ke);else throw new Error("no process or collaboration to display");var M=c(N,ke);if(Zn(N,"bpmn:Process")||Zn(N,"bpmn:SubProcess"))m(N,M);else if(Zn(N,"bpmn:Collaboration"))K(N,M),w(Z.rootElements,M);else throw new Error(`unsupported bpmnElement for ${Gn(ke)}: ${Gn(N)}`);h(n)};var h=this.handleDeferred=function(){for(var Z;n.length;)Z=n.shift(),Z()};function m(Y,Z){Ee(Y,Z),T(Y.ioSpecification,Z),P(Y.artifacts,Z),r(Y)}function w(Y,Z){var ce=rt(Y,function(xe){return!a(xe)&&Zn(xe,"bpmn:Process")&&xe.laneSets});ce.forEach(o(m,Z))}function y(Y,Z){l(Y,Z)}function v(Y,Z){z(Y,o(y,Z))}function x(Y,Z){l(Y,Z)}function E(Y,Z){l(Y,Z)}function C(Y,Z){l(Y,Z)}function D(Y,Z){l(Y,Z)}function P(Y,Z){z(Y,function(ce){Zn(ce,"bpmn:Association")?n.push(function(){D(ce,Z)}):D(ce,Z)})}function T(Y,Z){Y&&(z(Y.dataInputs,o(E,Z)),z(Y.dataOutputs,o(C,Z)))}var $=this.handleSubProcess=function(Z,ce){Ee(Z,ce),P(Z.artifacts,ce)};function j(Y,Z){var ce=l(Y,Z);Zn(Y,"bpmn:SubProcess")&&$(Y,ce||Z),Zn(Y,"bpmn:Activity")&&T(Y.ioSpecification,Z),n.push(function(){z(Y.dataInputAssociations,o(x,Z)),z(Y.dataOutputAssociations,o(x,Z))})}function G(Y,Z){l(Y,Z)}function Q(Y,Z){l(Y,Z)}function te(Y,Z){n.push(function(){var ce=l(Y,Z);Y.childLaneSet&&V(Y.childLaneSet,ce||Z),oe(Y)})}function V(Y,Z){z(Y.lanes,o(te,Z))}function ee(Y,Z){z(Y,o(V,Z))}function Ee(Y,Z){Pe(Y.flowElements,Z),Y.laneSets&&ee(Y.laneSets,Z)}function Pe(Y,Z){z(Y,function(ce){Zn(ce,"bpmn:SequenceFlow")?n.push(function(){G(ce,Z)}):Zn(ce,"bpmn:BoundaryEvent")?n.unshift(function(){j(ce,Z)}):Zn(ce,"bpmn:FlowNode")?j(ce,Z):Zn(ce,"bpmn:DataObject")||(Zn(ce,"bpmn:DataStoreReference")||Zn(ce,"bpmn:DataObjectReference")?Q(ce,Z):u(`unrecognized flowElement ${Gn(ce)} in context ${Gn(Z&&Z.businessObject)}`,{element:ce,context:Z}))})}function Se(Y,Z){var ce=l(Y,Z),xe=Y.processRef;xe&&m(xe,ce||Z)}function K(Y,Z){z(Y.participants,o(Se,Z)),n.push(function(){v(Y.messageFlows,Z)}),P(Y.artifacts,Z)}function oe(Y){z(Y.flowNodeRef,function(Z){var ce=Z.get("lanes");ce&&ce.push(Y)})}}function iT(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(h,m){return i.add(h,m)},element:function(h,m,w){return i.add(h,m,w)},error:function(h,m){s.push({message:h,context:m})}},f=new nT(p);u=u||l.diagrams&&l.diagrams[0];var d=oT(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 oT(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!A(n,"bpmn:Process")&&!A(n,"bpmn:Collaboration")&&(i=rT(n));var o;A(i,"bpmn:Collaboration")?o=i:o=Bt(e.rootElements,function(l){if(A(l,"bpmn:Collaboration"))return Bt(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=jn(o.participants,function(l){return l.processRef}),r.push(o));var a=Nv(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 Nv(e){var t=[];return z(e,function(n){n&&(t.push(n),t=t.concat(Nv(n.flowElements)))}),t}function rT(e){for(var t=e;t;){if(A(t,"bpmn:Process"))return t;t=t.$parent}}var aT='<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>',$v=aT,Fv={verticalAlign:"middle"},jv={color:"#404040"},sT={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},cT={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},lT={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"},uT='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+$v+'</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 pT(){Ji=zt(uT),qn(Ji,sT),qn(Ct("svg",Ji),Fv),qn(Ct(".backdrop",Ji),cT),qn(Ct(".notice",Ji),lT),qn(Ct(".link",Ji),jv,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function fT(){Ji||(pT(),ni.bind(Ji,".backdrop","click",function(e){document.body.removeChild(Ji)})),document.body.appendChild(Ji)}const bl=5,Hv="djs-outline-hidden";function Yt(e){e=q({},hT,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),mT(this._container)}Te(Yt,Qo),Yt.prototype.importXML=async function(t,n){const i=this;function o(a){return i.get("eventBus").createEvent(a)}let r=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;r=r.concat(l),s=this._emit("import.parse.complete",o({error:null,definitions:s,elementsById:u,references:c,warnings:r}))||s;const p=await this.importDefinitions(s,n);return r=r.concat(p.warnings),this._emit("import.done",{error:null,warnings:r}),{warnings:r}}catch(a){let s=a;throw r=r.concat(s.warnings||[]),xl(s,r),s=dT(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Yt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Yt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw xl(r,[]),r}if(typeof t=="string"&&(i=gT(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw xl(r,[]),r}try{this.clear()}catch(r){throw xl(r,[]),r}const{warnings:o}=await iT(this,n,i);return{warnings:o}},Yt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,o;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,o=(await this._moddle.toXML(n,t)).xml,o=this._emit("saveXML.serialized",{xml:o})||o}catch(a){i=a}const r=i?{error:i}:{xml:o};if(this._emit("saveXML.done",r),i)throw i;return r},Yt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=Ct(":scope > defs",i._svg),a=rv(o),s=r?"<defs>"+rv(r)+"</defs>":"",c=i.getContainer();Mt(c).add(Hv);let l;try{l=o.getBBox()}finally{Mt(c).remove(Hv)}const u=l.x-bl,p=l.y-bl,f=l.width+bl*2,d=l.height+bl*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}},Vt.prototype._setDefinitions=function(e){this._definitions=e},Vt.prototype.getModules=function(){return this._modules},Vt.prototype.clear=function(){this.getDefinitions()&&Zo.prototype.clear.call(this)},Vt.prototype.destroy=function(){Zo.prototype.destroy.call(this),Zi(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=Et(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=q(Yi(n,["additionalModules"]),{canvas:q({},n.canvas,{container:e}),modules:a});Zo.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 Vn(t,{width:Hv(e.width),height:Hv(e.height),position:e.position}),t},Vt.prototype._createModdle=function(e){const t=q({},this._moddleExtensions,e.moddleExtensions);return new fm(t)},Vt.prototype._modules=[];function vl(e,t){return e.warnings=t,e}function pT(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 fT={width:"100%",height:"100%",position:"relative"};function Hv(e){return e+(Ue(e)?"px":"")}function dT(e,t){return t&&Lt(e.diagrams,function(n){return n.id===t})||null}function hT(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Nv+"</a>",i=$t(n);Vn(Et("svg",i),$v),Vn(i,Fv,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),je.bind(i,"click",function(o){uT(),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)}Le(wa,Vt),wa.prototype._createModdle=function(e){var t=Vt.prototype._createModdle.call(this,e);return t.ids=new Xi([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||dt(e),t&&A(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):A(e,"bpmn:Participant")?!!ge(e).processRef:!0}function xn(e){if(!(!A(e,"bpmn:Participant")&&!A(e,"bpmn:Lane"))){var t=dt(e).isHorizontal;return t===void 0?!0:t}}function gT(e){return e&&ge(e).isInterrupting!==!1}function Hn(e){return e&&!!ge(e).triggeredByEvent}function _a(e,t){var n=ge(e).eventDefinitions;return No(n,function(i){return A(i,t)})}function mT(e){return _a(e,"bpmn:ErrorEventDefinition")}function yT(e){return _a(e,"bpmn:EscalationEventDefinition")}function vT(e){return _a(e,"bpmn:CompensateEventDefinition")}var Dr={width:90,height:20},zv=15;function Qo(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 bl(e){return nt(e.label)}function bT(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=xT(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-=zv:a+=zv,{x:a,y:s}}function xT(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 qf(e){return e.waypoints?bT(e.waypoints):A(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Dr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Dr.height/2}}function wT(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Dr.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=qf(t),i=Dr),q({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Gv(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 _T(e){var t=e.categoryValueRef;return t&&t.value||""}function mi(e){var t=e.businessObject,n=Gv(t);if(n)return n==="categoryValueRef"?_T(t):t[n]||""}function ET(e,t){var n=e.businessObject,i=Gv(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function ST(e){return nt(e)&&Qo(e.labelTarget)}var Ea=7;function Vv(e){let t=[];return z(e.incoming,n=>{A(n,"bpmn:Association")&&A(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),z(e.outgoing,n=>{A(n,"bpmn:Association")&&A(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Ms(e){const t=new Map;return z(jf(e),n=>{z(Vv(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 Yf="hsl(225, 10%, 15%)",RT="white";function to(e,t){return No(e.eventDefinitions,function(n){return n.$type===t})}function CT(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function MT(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||RT}function Te(e,t,n){var i=dt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Yf}function As(e,t,n,i){var o=dt(e),r=o.get("label");return i||r&&r.get("color:color")||t||Te(e,n)}function Wv(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 kr(o)}function Kf(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 kr(a)}function AT(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 kr(s)}function PT(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 kr(r)}function Ps(e,t={}){return{width:Ei(e,t),height:oi(e,t)}}function Ei(e,t={}){return ei(t,"width")?t.width:e.width}function oi(e,t={}){return ei(t,"height")?t.height:e.height}var TT=new Xi,kT=10,xl=3,OT=1.5,wl=10,DT=4,Sa=.95,LT=1,IT=.25;function Lr(e,t,n,i,o,r,a){yo.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:Yf,strokeWidth:2,fill:"white"})}function p($){return n.computeStyle($,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Yf,strokeWidth:2})}function f($,C){var{ref:S={x:0,y:0},scale:G=1,element:Z,parentGfx:ae=o._svg}=C,Ce=$e("marker",{id:$,viewBox:"0 0 20 20",refX:S.x,refY:S.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});Ke(Ce,Z);var Ze=Et(":scope > defs",ae);Ze||(Ze=$e("defs"),Ke(ae,Ze)),Ke(Ze,Ce)}function d($,C,S,G){var Z=TT.nextPrefixed("marker-");return g($,Z,C,S,G),"url(#"+Z+")"}function g($,C,S,G,Z){if(S==="sequenceflow-end"){var ae=$e("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:Z,stroke:Z,strokeWidth:1})});f(C,{element:ae,ref:{x:11,y:10},scale:.5,parentGfx:$})}if(S==="messageflow-start"){var Ce=$e("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:Z,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Ce,ref:{x:6,y:6},parentGfx:$})}if(S==="messageflow-end"){var Ze=$e("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:Z,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Ze,ref:{x:8.5,y:5},parentGfx:$})}if(S==="association-start"){var gt=$e("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:gt,ref:{x:1,y:10},scale:.5,parentGfx:$})}if(S==="association-end"){var Yt=$e("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(S==="conditional-flow-marker"){var _t=$e("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:Z})});f(C,{element:_t,ref:{x:-1,y:10},scale:.5,parentGfx:$})}if(S==="conditional-default-flow-marker"){var un=$e("path",{d:"M 6 4 L 10 16",...u({stroke:Z,fill:"none"})});f(C,{element:un,ref:{x:0,y:10},scale:.5,parentGfx:$})}}function h($,C,S,G,Z={}){hn(G)&&(Z=G,G=0),G=G||0,Z=u(Z);var ae=C/2,Ce=S/2,Ze=$e("circle",{cx:ae,cy:Ce,r:Math.round((C+S)/4-G),...Z});return Ke($,Ze),Ze}function m($,C,S,G,Z,ae){hn(Z)&&(ae=Z,Z=0),Z=Z||0,ae=u(ae);var Ce=$e("rect",{x:Z,y:Z,width:C-Z*2,height:S-Z*2,rx:G,ry:G,...ae});return Ke($,Ce),Ce}function w($,C,S,G){var Z=C/2,ae=S/2,Ce=[{x:Z,y:0},{x:C,y:ae},{x:Z,y:S},{x:0,y:ae}],Ze=Ce.map(function(Yt){return Yt.x+","+Yt.y}).join(" ");G=u(G);var gt=$e("polygon",{...G,points:Ze});return Ke($,gt),gt}function y($,C,S,G){S=p(S);var Z=xs(C,S,G);return Ke($,Z),Z}function v($,C,S){return y($,C,S,5)}function x($,C,S){S=p(S);var G=$e("path",{...S,d:C});return Ke($,G),G}function E($,C,S,G){return x(C,S,q({"data-marker":$},G))}function M($){return Ie[$]}function D($){return function(C,S,G){return M($)(C,S,G)}}var P={"bpmn:MessageEventDefinition":function($,C,S={},G){var Z=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.235,my:.315}}),ae=G?Te(C,c,S.stroke):at(C,s,S.fill),Ce=G?at(C,s,S.fill):Te(C,c,S.stroke),Ze=x($,Z,{fill:ae,stroke:Ce,strokeWidth:1});return Ze},"bpmn:TimerEventDefinition":function($,C,S={}){var G=S.width||C.width,Z=S.height||C.height,ae=S.width?1:2,Ce=h($,G,Z,.2*Z,{fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke),strokeWidth:ae}),Ze=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:Z,position:{mx:.5,my:.5}});x($,Ze,{stroke:Te(C,c,S.stroke),strokeWidth:ae});for(var gt=0;gt<12;gt++){var Yt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:Z,position:{mx:.5,my:.5}}),_t=G/2,un=Z/2;x($,Yt,{strokeWidth:1,stroke:Te(C,c,S.stroke),transform:"rotate("+gt*30+","+un+","+_t+")"})}return Ce},"bpmn:EscalationEventDefinition":function($,C,S={},G){var Z=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.5,my:.2}}),ae=G?Te(C,c,S.stroke):at(C,s,S.fill);return x($,Z,{fill:ae,stroke:Te(C,c,S.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function($,C,S={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.5,my:.222}});return x($,G,{fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function($,C,S={},G){var Z=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.57,my:.263}}),ae=G?Te(C,c,S.stroke):at(C,s,S.fill);return x($,Z,{fill:ae,stroke:Te(C,c,S.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function($,C,S={},G){var Z=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.2,my:.722}}),ae=G?Te(C,c,S.stroke):at(C,s,S.fill);return x($,Z,{fill:ae,stroke:Te(C,c,S.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function($,C,S={},G){var Z=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.638,my:-.055}}),ae=G?Te(C,c,S.stroke):"none",Ce=x($,Z,{fill:ae,stroke:Te(C,c,S.stroke),strokeWidth:1});return Iv(Ce,45),Ce},"bpmn:CompensateEventDefinition":function($,C,S={},G){var Z=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.22,my:.5}}),ae=G?Te(C,c,S.stroke):at(C,s,S.fill);return x($,Z,{fill:ae,stroke:Te(C,c,S.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function($,C,S={},G){var Z=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.5,my:.2}}),ae=G?Te(C,c,S.stroke):at(C,s,S.fill);return x($,Z,{strokeWidth:1,fill:ae,stroke:Te(C,c,S.stroke)})},"bpmn:MultipleEventDefinition":function($,C,S={},G){var Z=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.211,my:.36}}),ae=G?Te(C,c,S.stroke):at(C,s,S.fill);return x($,Z,{fill:ae,stroke:Te(C,c,S.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function($,C,S={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.458,my:.194}});return x($,G,{fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function($,C,S={}){var G=h($,C.width,C.height,8,{fill:Te(C,c,S.stroke),stroke:Te(C,c,S.stroke),strokeWidth:4});return G}};function T($,C,S={},G){var Z=ge($),ae=CT(Z),Ce=G||$;return Z.get("eventDefinitions")&&Z.get("eventDefinitions").length>1?Z.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](C,Ce,S,ae):P["bpmn:MultipleEventDefinition"](C,Ce,S,ae):to(Z,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](C,Ce,S,ae):to(Z,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](C,Ce,S,ae):to(Z,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](C,Ce,S,ae):to(Z,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](C,Ce,S,ae):to(Z,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](C,Ce,S,ae):to(Z,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](C,Ce,S,ae):to(Z,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](C,Ce,S,ae):to(Z,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](C,Ce,S,ae):to(Z,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](C,Ce,S,ae):to(Z,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](C,Ce,S,ae):null}var N={ParticipantMultiplicityMarker:function($,C,S={}){var G=Ei(C,S),Z=oi(C,S),ae=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:Z,position:{mx:(G/2-6)/G,my:(Z-15)/Z}});E("participant-multiplicity",$,ae,{strokeWidth:2,fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke)})},SubProcessMarker:function($,C,S={}){var G=m($,14,14,0,{strokeWidth:1,fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke)});kn(G,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}});E("sub-process",$,Z,{fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke)})},ParallelMarker:function($,C,S){var G=Ei(C,S),Z=oi(C,S),ae=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:Z,position:{mx:(G/2+S.parallel)/G,my:(Z-20)/Z}});E("parallel",$,ae,{fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke)})},SequentialMarker:function($,C,S){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+S.seq)/C.width,my:(C.height-19)/C.height}});E("sequential",$,G,{fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke)})},CompensationMarker:function($,C,S){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+S.compensation)/C.width,my:(C.height-13)/C.height}});E("compensation",$,G,{strokeWidth:1,fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke)})},LoopMarker:function($,C,S){var G=Ei(C,S),Z=oi(C,S),ae=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:Z,position:{mx:(G/2+S.loop)/G,my:(Z-7)/Z}});E("loop",$,ae,{strokeWidth:1.5,fill:"none",stroke:Te(C,c,S.stroke),strokeMiterlimit:.5})},AdhocMarker:function($,C,S){var G=Ei(C,S),Z=oi(C,S),ae=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:Z,position:{mx:(G/2+S.adhoc)/G,my:(Z-15)/Z}});E("adhoc",$,ae,{strokeWidth:1,fill:Te(C,c,S.stroke),stroke:Te(C,c,S.stroke)})}};function j($,C,S,G){N[$](C,S,G)}function V($,C,S=[],G={}){G={fill:G.fill,stroke:G.stroke,width:Ei(C,G),height:oi(C,G)};var Z=ge(C),ae=S.includes("SubProcessMarker");ae?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},Z.get("isForCompensation")&&S.push("CompensationMarker"),A(Z,"bpmn:AdHocSubProcess")&&(S.push("AdhocMarker"),ae||q(G,{compensation:G.compensation-18}));var Ce=Z.get("loopCharacteristics"),Ze=Ce&&Ce.get("isSequential");Ce&&(q(G,{compensation:G.compensation-18}),S.includes("AdhocMarker")&&q(G,{seq:-23,loop:-18,parallel:-24}),Ze===void 0&&S.push("LoopMarker"),Ze===!1&&S.push("ParallelMarker"),Ze===!0&&S.push("SequentialMarker")),S.includes("CompensationMarker")&&S.length===1&&q(G,{compensation:-8}),z(S,function(gt){j(gt,$,C,G)})}function Q($,C,S={}){S=q({size:{width:100}},S);var G=r.createText(C||"",S);return lt(G).add("djs-label"),Ke($,G),G}function ne($,C,S,G={}){var Z=ge(C),ae=Ps({x:C.x,y:C.y,width:C.width,height:C.height},G);return Q($,Z.name,{align:S,box:ae,padding:7,style:{fill:As(C,l,c,G.stroke)}})}function W($,C,S={}){var G={width:C.width,height:C.height,x:C.width/2+C.x,y:C.height/2+C.y};return Q($,mi(C),{box:G,style:q({},r.getExternalStyle(),{fill:As(C,l,c,S.stroke)})})}function te($,C,S,G={}){var Z=xn(S),ae=Q($,C,{box:{height:30,width:Z?oi(S,G):Ei(S,G)},align:"center-middle",style:{fill:As(S,l,c,G.stroke)}});if(Z){var Ce=-1*oi(S,G);ml(ae,0,-Ce,270)}}function xe($,C,S={}){var{width:G,height:Z}=Ps(C,S);return m($,G,Z,wl,{...S,fill:at(C,s,S.fill),fillOpacity:Sa,stroke:Te(C,c,S.stroke)})}function Oe($,C,S={}){var G=ge(C),Z=at(C,s,S.fill),ae=Te(C,c,S.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(S.markerEnd=d($,"association-end",Z,ae)),G.get("associationDirection")==="Both"&&(S.markerStart=d($,"association-start",Z,ae)),S=ht(S,["markerStart","markerEnd"]),v($,C.waypoints,{...S,stroke:ae,strokeDasharray:"0, 5"})}function we($,C,S={}){var G=at(C,s,S.fill),Z=Te(C,c,S.stroke),ae=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}}),Ce=x($,ae,{fill:G,fillOpacity:Sa,stroke:Z}),Ze=ge(C);if(MT(Ze)){var gt=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.33,my:(C.height-18)/C.height}});x($,gt,{strokeWidth:2,fill:G,stroke:Z})}return Ce}function K($,C,S={}){return h($,C.width,C.height,{fillOpacity:Sa,...S,fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke)})}function oe($,C,S={}){return w($,C.width,C.height,{fill:at(C,s,S.fill),fillOpacity:Sa,stroke:Te(C,c,S.stroke)})}function Y($,C,S={}){var G=m($,Ei(C,S),oi(C,S),0,{fill:at(C,s,S.fill),fillOpacity:S.fillOpacity||Sa,stroke:Te(C,c,S.stroke),strokeWidth:1.5}),Z=ge(C);if(A(Z,"bpmn:Lane")){var ae=Z.get("name");te($,ae,C,S)}return G}function X($,C,S={}){var G=xe($,C,S),Z=ut(C);if(Hn(C)&&(Ae(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!Z)){var ae=ge(C).flowElements||[],Ce=ae.filter(Ze=>A(Ze,"bpmn:StartEvent"));Ce.length===1&&ce(Ce[0],$,S,C)}return ne($,C,Z?"center-top":"center-middle",S),Z?V($,C,void 0,S):V($,C,["SubProcessMarker"],S),G}function ce($,C,S,G){var Z=22,ae={fill:at(G,s,S.fill),stroke:Te(G,c,S.stroke),width:Z,height:Z},Ce=ge($).isInterrupting,Ze=Ce?0:3,gt=Ce?1:1.2,Yt=20,_t=(Z-Yt)/2,un="translate("+_t+","+_t+")";h(C,Yt,Yt,{fill:ae.fill,stroke:ae.stroke,strokeWidth:gt,strokeDasharray:Ze,transform:un}),T($,C,ae,G)}function me($,C,S={}){var G=xe($,C,S);return ne($,C,"center-middle",S),V($,C,void 0,S),G}var Ie=this.handlers={"bpmn:AdHocSubProcess":function($,C,S={}){return ut(C)?S=ht(S,["fill","stroke","width","height"]):S=ht(S,["fill","stroke"]),X($,C,S)},"bpmn:Association":function($,C,S={}){return S=ht(S,["fill","stroke"]),Oe($,C,S)},"bpmn:BoundaryEvent":function($,C,S={}){var{renderIcon:G=!0}=S;S=ht(S,["fill","stroke"]);var Z=ge(C),ae=Z.get("cancelActivity");S={strokeWidth:1.5,fill:at(C,s,S.fill),fillOpacity:LT,stroke:Te(C,c,S.stroke)},ae||(S.strokeDasharray="6");var Ce=K($,C,S);return h($,C.width,C.height,xl,{...S,fill:"none"}),G&&T(C,$,S),Ce},"bpmn:BusinessRuleTask":function($,C,S={}){S=ht(S,["fill","stroke"]);var G=me($,C,S),Z=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),ae=x($,Z);Ae(ae,{fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke),strokeWidth:1});var Ce=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ze=x($,Ce);return Ae(Ze,{fill:Te(C,c,S.stroke),stroke:Te(C,c,S.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function($,C,S={}){return S=ht(S,["fill","stroke"]),X($,C,{strokeWidth:5,...S})},"bpmn:ComplexGateway":function($,C,S={}){S=ht(S,["fill","stroke"]);var G=oe($,C,S),Z=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.26}});return x($,Z,{fill:Te(C,c,S.stroke),stroke:Te(C,c,S.stroke),strokeWidth:1}),G},"bpmn:DataInput":function($,C,S={}){S=ht(S,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),Z=we($,C,S);return x($,G,{fill:"none",stroke:Te(C,c,S.stroke),strokeWidth:1}),Z},"bpmn:DataInputAssociation":function($,C,S={}){return S=ht(S,["fill","stroke"]),Oe($,C,{...S,markerEnd:d($,"association-end",at(C,s,S.fill),Te(C,c,S.stroke))})},"bpmn:DataObject":function($,C,S={}){return S=ht(S,["fill","stroke"]),we($,C,S)},"bpmn:DataObjectReference":D("bpmn:DataObject"),"bpmn:DataOutput":function($,C,S={}){S=ht(S,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),Z=we($,C,S);return x($,G,{strokeWidth:1,fill:Te(C,c,S.stroke),stroke:Te(C,c,S.stroke)}),Z},"bpmn:DataOutputAssociation":function($,C,S={}){return S=ht(S,["fill","stroke"]),Oe($,C,{...S,markerEnd:d($,"association-end",at(C,s,S.fill),Te(C,c,S.stroke))})},"bpmn:DataStoreReference":function($,C,S={}){S=ht(S,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:0,my:.133}});return x($,G,{fill:at(C,s,S.fill),fillOpacity:Sa,stroke:Te(C,c,S.stroke),strokeWidth:2})},"bpmn:EndEvent":function($,C,S={}){var{renderIcon:G=!0}=S;S=ht(S,["fill","stroke"]);var Z=K($,C,{...S,strokeWidth:4});return G&&T(C,$,S),Z},"bpmn:EventBasedGateway":function($,C,S={}){S=ht(S,["fill","stroke"]);var G=ge(C),Z=oe($,C,S);h($,C.width,C.height,C.height*.2,{fill:at(C,"none",S.fill),stroke:Te(C,c,S.stroke),strokeWidth:1});var ae=G.get("eventGatewayType"),Ce=!!G.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}});x($,Yt,{fill:"none",stroke:Te(C,c,S.stroke),strokeWidth:2})}if(ae==="Parallel"){var gt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}});x($,gt,{fill:"none",stroke:Te(C,c,S.stroke),strokeWidth:1})}else ae==="Exclusive"&&(Ce||h($,C.width,C.height,C.height*.26,{fill:"none",stroke:Te(C,c,S.stroke),strokeWidth:1}),Ze());return Z},"bpmn:ExclusiveGateway":function($,C,S={}){S=ht(S,["fill","stroke"]);var G=oe($,C,S),Z=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.32,my:.3}}),ae=dt(C);return ae.get("isMarkerVisible")&&x($,Z,{fill:Te(C,c,S.stroke),stroke:Te(C,c,S.stroke),strokeWidth:1}),G},"bpmn:Gateway":function($,C,S={}){return S=ht(S,["fill","stroke"]),oe($,C,S)},"bpmn:Group":function($,C,S={}){return S=ht(S,["fill","stroke","width","height"]),m($,C.width,C.height,wl,{stroke:Te(C,c,S.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Ei(C,S),height:oi(C,S)})},"bpmn:InclusiveGateway":function($,C,S={}){S=ht(S,["fill","stroke"]);var G=oe($,C,S);return h($,C.width,C.height,C.height*.24,{fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function($,C,S={}){var{renderIcon:G=!0}=S;S=ht(S,["fill","stroke"]);var Z=K($,C,{...S,strokeWidth:1.5});return h($,C.width,C.height,xl,{fill:"none",stroke:Te(C,c,S.stroke),strokeWidth:1.5}),G&&T(C,$,S),Z},"bpmn:IntermediateCatchEvent":D("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":D("bpmn:IntermediateEvent"),"bpmn:Lane":function($,C,S={}){return S=ht(S,["fill","stroke","width","height"]),Y($,C,{...S,fillOpacity:IT})},"bpmn:ManualTask":function($,C,S={}){S=ht(S,["fill","stroke"]);var G=me($,C,S),Z=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x($,Z,{fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function($,C,S={}){S=ht(S,["fill","stroke"]);var G=ge(C),Z=dt(C),ae=at(C,s,S.fill),Ce=Te(C,c,S.stroke),Ze=v($,C.waypoints,{markerEnd:d($,"messageflow-end",ae,Ce),markerStart:d($,"messageflow-start",ae,Ce),stroke:Ce,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var gt=Ze.getPointAtLength(Ze.getTotalLength()/2),Yt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:gt.x,y:gt.y}}),_t={strokeWidth:1};Z.get("messageVisibleKind")==="initiating"?(_t.fill=ae,_t.stroke=Ce):(_t.fill=Ce,_t.stroke=ae);var un=x($,Yt,_t),zn=G.get("messageRef"),In=zn.get("name"),Dt=Q($,In,{align:"center-top",fitBox:!0,style:{fill:Ce}}),pn=un.getBBox(),Un=Dt.getBBox(),br=gt.x-Un.width/2,yi=gt.y+pn.height/2+kT;ml(Dt,br,yi,0)}return Ze},"bpmn:ParallelGateway":function($,C,S={}){S=ht(S,["fill","stroke"]);var G=oe($,C,S),Z=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.2}});return x($,Z,{fill:Te(C,c,S.stroke),stroke:Te(C,c,S.stroke),strokeWidth:1}),G},"bpmn:Participant":function($,C,S={}){S=ht(S,["fill","stroke","width","height"]);var G=Y($,C,S),Z=ut(C),ae=xn(C),Ce=ge(C),Ze=Ce.get("name");if(Z){var gt=ae?[{x:30,y:0},{x:30,y:oi(C,S)}]:[{x:0,y:30},{x:Ei(C,S),y:30}];y($,gt,{stroke:Te(C,c,S.stroke),strokeWidth:OT}),te($,Ze,C,S)}else{var Yt=Ps(C,S);ae||(Yt.height=Ei(C,S),Yt.width=oi(C,S));var _t=Q($,Ze,{box:Yt,align:"center-middle",style:{fill:As(C,l,c,S.stroke)}});if(!ae){var un=-1*oi(C,S);ml(_t,0,-un,270)}}return Ce.get("participantMultiplicity")&&j("ParticipantMultiplicityMarker",$,C,S),G},"bpmn:ReceiveTask":function($,C,S={}){S=ht(S,["fill","stroke"]);var G=ge(C),Z=me($,C,S),ae;return G.get("instantiate")?(h($,28,28,20*.22,{fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke),strokeWidth:1}),ae=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):ae=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x($,ae,{fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke),strokeWidth:1}),Z},"bpmn:ScriptTask":function($,C,S={}){S=ht(S,["fill","stroke"]);var G=me($,C,S),Z=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x($,Z,{fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke),strokeWidth:1}),G},"bpmn:SendTask":function($,C,S={}){S=ht(S,["fill","stroke"]);var G=me($,C,S),Z=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x($,Z,{fill:Te(C,c,S.stroke),stroke:at(C,s,S.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function($,C,S={}){S=ht(S,["fill","stroke"]);var G=at(C,s,S.fill),Z=Te(C,c,S.stroke),ae=v($,C.waypoints,{markerEnd:d($,"sequenceflow-end",G,Z),stroke:Z}),Ce=ge(C),{source:Ze}=C;if(Ze){var gt=ge(Ze);Ce.get("conditionExpression")&&A(gt,"bpmn:Activity")&&Ae(ae,{markerStart:d($,"conditional-flow-marker",G,Z)}),gt.get("default")&&(A(gt,"bpmn:Gateway")||A(gt,"bpmn:Activity"))&>.get("default")===Ce&&Ae(ae,{markerStart:d($,"conditional-default-flow-marker",G,Z)})}return ae},"bpmn:ServiceTask":function($,C,S={}){S=ht(S,["fill","stroke"]);var G=me($,C,S);h($,10,10,{fill:at(C,s,S.fill),stroke:"none",transform:"translate(6, 6)"});var Z=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x($,Z,{fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke),strokeWidth:1}),h($,10,10,{fill:at(C,s,S.fill),stroke:"none",transform:"translate(11, 10)"});var ae=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x($,ae,{fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function($,C,S={}){var{renderIcon:G=!0}=S;S=ht(S,["fill","stroke"]);var Z=ge(C);Z.get("isInterrupting")||(S={...S,strokeDasharray:"6"});var ae=K($,C,S);return G&&T(C,$,S),ae},"bpmn:SubProcess":function($,C,S={}){return ut(C)?S=ht(S,["fill","stroke","width","height"]):S=ht(S,["fill","stroke"]),X($,C,S)},"bpmn:Task":function($,C,S={}){return S=ht(S,["fill","stroke"]),me($,C,S)},"bpmn:TextAnnotation":function($,C,S={}){S=ht(S,["fill","stroke"]);var{width:G,height:Z}=Ps(C,S),ae=m($,G,Z,0,0,{fill:"none",stroke:"none"}),Ce=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:Z,position:{mx:0,my:0}});x($,Ce,{stroke:Te(C,c,S.stroke)});var Ze=ge(C),gt=Ze.get("text")||"";return Q($,gt,{align:"left-top",box:Ps(C,S),padding:Ea,style:{fill:As(C,l,c,S.stroke)}}),ae},"bpmn:Transaction":function($,C,S={}){ut(C)?S=ht(S,["fill","stroke","width","height"]):S=ht(S,["fill","stroke"]);var G=X($,C,{strokeWidth:1.5,...S}),Z=n.style(["no-fill","no-events"],{stroke:Te(C,c,S.stroke),strokeWidth:1.5}),ae=ut(C);return ae||(S={}),m($,Ei(C,S),oi(C,S),wl-xl,xl,Z),G},"bpmn:UserTask":function($,C,S={}){S=ht(S,["fill","stroke"]);var G=me($,C,S),Z=15,ae=12,Ce=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:Z,y:ae}});x($,Ce,{fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke),strokeWidth:.5});var Ze=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:Z,y:ae}});x($,Ze,{fill:at(C,s,S.fill),stroke:Te(C,c,S.stroke),strokeWidth:.5});var gt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:Z,y:ae}});return x($,gt,{fill:Te(C,c,S.stroke),stroke:Te(C,c,S.stroke),strokeWidth:.5}),G},label:function($,C,S={}){return W($,C,S)}};this._drawPath=x,this._renderer=M}Le(Lr,yo),Lr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Lr.prototype.canRender=function(e){return A(e,"bpmn:BaseElement")},Lr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Lr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Lr.prototype.getShapePath=function(e){return nt(e)?Kf(e,DT):A(e,"bpmn:Event")?Wv(e):A(e,"bpmn:Activity")?Kf(e,wl):A(e,"bpmn:Gateway")?AT(e):PT(e)};function ht(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var BT=0,NT={width:150,height:50};function $T(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function FT(e){return hn(e)?q({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Xf=null;function jT(){return Xf||(Xf=document.createElement("canvas").getContext("2d")),Xf}function HT(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(Uv(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Uv(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function zT(e,t){var n=jT();if(!n)return{width:0,height:0};n.font=HT(t),"letterSpacing"in n&&(n.letterSpacing=Uv(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 GT(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=zT(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return VT(e,o,i,r);o=UT(o,r.width,t)}}function VT(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 qv="";function WT(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===qv)&&o.pop();break}var a=o[o.length-1];return a&&a===qv&&(o[o.length-1]="-"),o.join("")}function UT(e,t,n){var i=Math.max(e.length*(n/t),1),o=WT(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function _l(e){this._config=q({},{size:NT,padding:BT,style:{},align:"center-top"},e||{})}_l.prototype.createText=function(e,t){return this.layoutText(e,t).element},_l.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},_l.prototype.layoutText=function(e,t){for(var n=q({},this._config.size,t.box),i=q({},this._config.style,t.style),o=$T(t.align||this._config.align),r=FT(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=qT(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(GT(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=ti(l,function(m,w,y){return m+(s||w.height)},0)+r.top+r.bottom,f=ti(l,function(m,w,y){return w.width>m?w.width:m},0),d=r.top;o.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||l[0].height)/4;var g=$e("text");Ae(g,i),z(l,function(m){var w;switch(d+=s||m.height,o.horizontal){case"left":w=r.left;break;case"right":w=(a?f:u)-r.right-m.width;break;default:w=Math.max(((a?f:u)-m.width)/2+r.left,0)}var y=$e("tspan");Ae(y,{x:w,y:d}),y.textContent=m.text,Ke(g,y)});var h={width:f,height:p};return{dimensions:h,element:g}};function qT(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var YT=12,KT=1.2,XT=40;function Yv(e){var t=q({fontFamily:"Arial, sans-serif",fontSize:YT,fontWeight:"normal",lineHeight:KT},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=q({},t,{fontSize:n},e&&e.externalStyle||{}),o=new _l({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Dr.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(XT,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,q({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Yv.$inject=["config.textRenderer"];function ZT(){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=tk(i.d,{mx:o,my:r,e:a});return p}}var QT=/\{([^{}]+)\}/g,JT=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function ek(e,t,n){var i=n;return t.replace(JT,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 tk(e,t){return String(e).replace(QT,function(n,i){return ek(n,i,t)})}const nk={__init__:["bpmnRenderer"],bpmnRenderer:["type",Lr],textRenderer:["type",Yv],pathMap:["type",ZT]};function ik(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Ts={translate:["value",ik]};function El(e,t,n){return q({id:e.id,type:e.$type,businessObject:e,di:t},n)}function ok(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 Kv(e,t,n){return new Error(`element ${jn(t)} referenced by ${jn(e)}#${n} not yet drawn`)}function wo(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}wo.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],wo.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(El(e,t,a)),this._canvas.addRootElement(i)}else if(A(t,"bpmndi:BPMNShape")){var s=!ut(e,t),c=ak(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(El(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")&&(rk(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(El(e,t,{hidden:o,source:u,target:p,waypoints:ok(t,u,p)})),A(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${jn(t)} for element ${jn(e)}`);return Qo(e)&&mi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},wo.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${jn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw Kv(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},wo.prototype.addLabel=function(e,t,n){var i,o,r;return i=wT(t,n),o=mi(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(El(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)},wo.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?Kv(e,i,t+"Ref"):new Error(`${jn(e)}#${t} Ref not specified`)},wo.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},wo.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},wo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function rk(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 ak(e){return A(e,"bpmn:Group")}const Xv={__depends__:[nk,{__depends__:[Ts],bpmnImporter:["type",wo]}]};function ks(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Gi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Zf(e){return Math.log(e)/Math.log(10)}var sk=1e3;function de(e){this._eventBus=e}de.$inject=["eventBus"];function ck(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=sk),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?ck(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 Qf=["top","bottom","left","right"],Sl=10;function Jf(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(bl(o)&&!Tt(o)){var r=pk(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-Sl-s.height/2};break;case"left":u={x:l.left-Sl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Sl+s.height/2};break;case"right":u={x:l.right+Sl+s.width/2,y:a.y};break}var p=Gi(u,c);t.moveShape(s,p)}}}Le(Jf,de),Jf.$inject=["eventBus","modeling"];function lk(e){var t=e.host,n=qe(e),i=Tn(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=Qf.filter(function(a){return o.indexOf(a)===-1});return r}function uk(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 Zv(t,i)});return n}function pk(e){var t=qe(e.label),n=qe(e),i=Zv(n,t);if(fk(i)){var o=uk(e);if(e.host){var r=lk(e);o=o.concat(r)}var a=Qf.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?Tn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Zv(e,t){return Tn(t,e,5)}function fk(e){return Qf.indexOf(e)!==-1}function ed(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)}Le(ed,de),ed.$inject=["eventBus"];var dk=1500;function td(e,t,n){e.invoke(de,this),this.preExecute("elements.delete",dk,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 z(r,l=>{const u=new Set(oa(va(Array.from(s),on(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Le(td,de),td.$inject=["injector","eventBus","canvas"];function nd(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")});z(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Le(nd,de),nd.$inject=["injector","modeling"];function Ra(e,t){for(Jn(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=ge(e);o&&!A(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 Jv=500;function Rl(e,t){t.invoke(de,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Jv,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return eb(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",Jv,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];eb(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}Rl.$inject=["bpmnReplace","injector"],Le(Rl,de),Rl.prototype._replaceShape=function(e,t){var n=hk(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function hk(e){var t=ge(e),n=t.eventDefinitions;return n&&n[0]}function eb(e,t){return!nt(e)&&it(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function id(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")&&z(r.outgoing,function(a){var s=a.target,c=n(s);A(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}id.$inject=["eventBus","modeling"],Le(id,de);function tb(e){return e.create("bpmn:Category")}function gk(e){return e.create("bpmn:CategoryValue")}function nb(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=gk(e)),n.$parent||(n.$parent=tb(e)),n}function mk(e,t,n){return en(t.get("categoryValue"),e),e.$parent=t,en(n.get("rootElements"),t),t.$parent=n,e}function yk(e){var t=e.$parent;return t&&(Jt(t.get("categoryValue"),e),e.$parent=null),e}function vk(e){var t=e.$parent;return t&&(Jt(t.get("rootElements"),e),e.$parent=null),e}var bk=500;function od(e,t,n){n.invoke(de,this);function i(c){return t.filter(function(l){return A(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&&mk(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&vk(l),c&&!o(c,u)&&yk(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,ge(l))},!0),this.executed(["shape.move","shape.resize"],bk,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){ib(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){ib(c).forEach(function(l){s(l.categoryValue,l.category,ge(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ge(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}od.$inject=["bpmnjs","elementRegistry","injector"],Le(od,de);function ib(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function rd(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 w=m.source,y=m.target;Ca(w)&&Os(y)&&u(y)}function o(m){const w=m.connection,y=m.source,v=m.target;Ca(y)&&Cl(v)&&(l(v),f(y,[w]))}function r(m){const w=m.newTarget,y=m.oldSource,v=m.oldTarget;if(v!==w){const x=y;Os(v)&&u(v),Ca(x)&&Cl(w)&&l(w)}}function a(m){const{element:w}=m;Os(w)?(p(w),d(w)):Cl(w)&&g(w)}function s(m){const{newData:w,oldShape:y}=m;if(Ca(m.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){const v=y.outgoing.find(({target:x})=>Os(x));v&&v.target&&(m._connectionTarget=v.target)}else if(!Ca(m.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){const v=y.outgoing.find(({target:x})=>Cl(x));v&&v.target&&(m._connectionTarget=v.target),h(y)}}function c(m){const{_connectionTarget:w,newShape:y}=m;w&&t.connect(y,w)}function l(m){t.updateProperties(m,{isForCompensation:!0})}function u(m){t.updateProperties(m,{isForCompensation:void 0})}function p(m){for(const w of m.incoming)n.canConnect(w.source,m)||t.removeConnection(w);for(const w of m.outgoing)n.canConnect(m,w.target)||t.removeConnection(w)}function f(m,w){m.outgoing.filter(x=>A(x,"bpmn:Association")).filter(x=>Os(x.target)&&!w.includes(x)).forEach(x=>t.removeConnection(x))}function d(m){const w=m.attachers.slice();w.length&&t.removeElements(w)}function g(m){const w=m.incoming.filter(y=>Ca(y.source));t.removeElements(w)}function h(m){const w=m.outgoing.filter(y=>A(y,"bpmn:SequenceFlow"));t.removeElements(w)}}Le(rd,de),rd.$inject=["eventBus","modeling","bpmnRules"];function Os(e){const t=ge(e);return t&&t.get("isForCompensation")}function Ca(e){return e&&A(e,"bpmn:BoundaryEvent")&&_a(e,"bpmn:CompensateEventDefinition")}function Cl(e){return e&&A(e,"bpmn:Activity")&&!Hn(e)}function ad(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"))})}ad.$inject=["injector"],Le(ad,de);function sd(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}})}sd.$inject=["eventBus","bpmnFactory"],Le(sd,de);var cd=20,ld=20,ob=30,Ml=2e3;function ud(e,t,n){de.call(this,t),t.on(["create.start","shape.move.start"],Ml,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)&&!Tt(p)});if(c.length){var l=on(c),u=xk(a,l);q(a,u),r.createConstraints=wk(a,l)}}}),t.on("create.start",Ml,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",Ml,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",Ml,function(o){var r=o.elements,a=o.parent,s=_k(r),c;s&&A(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;A(a,"bpmn:Participant")&&A(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)}ud.$inject=["canvas","eventBus","modeling"],Le(ud,de);function xk(e,t){t={width:t.width+cd*2+ob,height:t.height+ld*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 wk(e,t){return t=ze(t),{bottom:t.top+e.height/2-ld,left:t.right-e.width/2+cd,top:t.bottom-e.height/2+ld,right:t.left+e.width/2-cd-ob}}function _k(e){return Lt(e,function(t){return A(t,"bpmn:Participant")})}var rb="__targetRef_placeholder";function pd(e,t){de.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],ab(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],ab(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===rb});return!l&&s&&(l=t.create("bpmn:Property",{name:rb}),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,g=s.oldTarget||s.target,h=g&&g.businessObject,m=c.businessObject,w;h&&h!==p&&o(h,l),d&&d!==p&&o(d,l),p?(w=i(p,!0),m.targetRef=w):m.targetRef=null}}pd.$inject=["eventBus","bpmnFactory"],Le(pd,de);function ab(e){return function(t){var n=t.context,i=n.connection;if(A(i,"bpmn:DataInputAssociation"))return e(t)}}function Al(e){this._bpmnUpdater=e}Al.$inject=["bpmnUpdater"],Al.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,o=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,o),[]},Al.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 fd(e,t,n,i){de.call(this,i),t.registerHandler("dataStore.updateContainment",Al);function o(){return n.filter(function(s){return A(s,"bpmn:Participant")&&ge(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:dt(s),newSemanticParent:u.processRef||u,newDiParent:dt(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:Sk(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 Ek(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)})})}fd.$inject=["canvas","commandStack","elementRegistry","eventBus"],Le(fd,de);function Ek(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 Sk(e,t){for(;e.parent;){if(A(e.parent,t))return e.parent;e=e.parent}}var Pl=Math.max,Tl=Math.min,Rk=20;function sb(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function Ck(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 Mk(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 kl(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)?Tl:Pl)(i,o)),Ue(r)&&(i=(/top|left/.test(e)?Pl:Tl)(i,r)),i}function Ak(e,t){if(!t)return e;var n=ze(e);return dl({top:kl("top",n,t),right:kl("right",n,t),bottom:kl("bottom",n,t),left:kl("left",n,t)})}function Pk(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:Tl(r.top,a.top),left:Tl(r.left,a.left),bottom:Pl(r.bottom,a.bottom),right:Pl(r.right,a.right)};return dl(s)}function Ds(e,t){return typeof e<"u"?e:Rk}function Tk(e,t){var n,i,o,r;return typeof t=="object"?(n=Ds(t.left),i=Ds(t.right),o=Ds(t.top),r=Ds(t.bottom)):n=i=o=r=Ds(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function kk(e){return!(e.waypoints||e.type==="label")}function cb(e,t){var n;if(e.length===void 0?n=rt(e.children,kk):n=e,n.length)return Tk(on(n),t)}var Jo=Math.abs;function Ok(e,t){return sb(ze(t),ze(e))}var Dk=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Si=30;function Ol(e,t){return t=t||[],e.children.filter(function(n){A(n,"bpmn:Lane")&&(Ol(n,t),t.push(n))}),t}function er(e){return e.children.filter(function(t){return A(t,"bpmn:Lane")})}function Ri(e){return Ra(e,Dk)||e}function Lk(e,t){var n=Ri(e),i=A(n,"bpmn:Process")?[]:[n],o=Ol(n,i),r=ze(e),a=ze(t),s=Ok(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=ze(u);s.top&&(Jo(h.bottom-r.top)<10&&(d=a.top-h.bottom),Jo(h.top-r.top)<5&&(p=a.top-h.top)),s.left&&(Jo(h.right-r.left)<10&&(f=a.left-h.right),Jo(h.left-r.left)<5&&(g=a.left-h.left)),s.bottom&&(Jo(h.top-r.bottom)<10&&(p=a.bottom-h.top),Jo(h.bottom-r.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(Jo(h.left-r.right)<10&&(g=a.right-h.left),Jo(h.right-r.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:u,newBounds:Mk(u,{top:p,right:f,bottom:d,left:g})})}}),c}var Ik=500;function dd(e,t){de.call(this,e);function n(i,o){var r=xn(i),a=er(o),s=[],c=[],l=[],u=[];if(Or(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",Ik,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))})}dd.$inject=["eventBus","spaceTool"],Le(dd,de);var lb=500;function Dl(e,t){t.invoke(de,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",lb,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return ub(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",lb,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;ub(a,Nk(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}Dl.$inject=["bpmnReplace","injector"],Le(Dl,de),Dl.prototype._replaceShape=function(e){var t=Bk(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function Bk(e){var t=ge(e),n=t.eventDefinitions;return n&&n[0]}function ub(e,t){return!nt(e)&&A(e,"bpmn:BoundaryEvent")&&!t}function Nk(e,t){return e.indexOf(t)!==-1}var Ll=Math.round,$k=Math.max;function Fk(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 jk(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var pb=10;function Hk(e,t){var n,i;for(n=0;i=e[n];n++)if(Es(i,t)<=pb)return{point:e[n],bendpoint:!0,index:n};return null}function zk(e,t){var n=mv(Fk(t,pb),jk(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=$k(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:Ll(i.x+o.x)/2,y:Ll(i.y+o.y)/2},index:i.segment2}:{point:{x:Ll(i.x),y:Ll(i.y)},index:i.segment2}:null}function hd(e,t){return Hk(e,t)||zk(e,t)}function gd(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(),w;Ue(a.width)?w=qe(a):w=a;var y=hd(s,w);if(y){if(c=s.slice(0,y.index),l=s.slice(y.index+(y.bendpoint?1:0)),!c.length||!l.length)return;u=y.bendpoint?s[y.index]:w,(c.length===1||!fb(o,c[c.length-1]))&&c.push(db(u)),(l.length===1||!fb(o,l[0]))&&l.unshift(db(u))}p=r.source,f=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||w),d=r),t.canConnect(o,f,r)&&(d?g=n.connect(o,f,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||w),g=r));var v=[].concat(d&&rt(m,function(x){return x.source===d.source})||[],g&&rt(h,function(x){return x.target===g.target})||[]);v.length&&n.removeElements(v)}this.preExecute("elements.move",function(o){var r=o.newParent,a=o.shapes,s=o.delta,c=a[0];if(!(!c||!r)){r&&r.waypoints&&(o.newParent=r=r.parent);var l=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&&hd(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)}Le(gd,de),gd.$inject=["eventBus","bpmnRules","modeling"];function fb(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 db(e){return q({},e)}function md(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)})})}})}md.$inject=["eventBus","modeling"],Le(md,de);function Ma(e){return A(e,"bpmn:SequenceFlow")}var Il=1500,hb=2e3;function gb(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"],Il,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=Ri(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"],Il,function(i){var o=i.hover;A(o,"bpmn:Lane")&&(i.hover=Ri(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Il,function(i){var o=i.context,r=i.hover,a=o.type;A(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Ri(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Il,function(i){var o=i.context,r=o.start;A(r,"bpmn:Lane")&&(o.start=Ri(r)||r)}),t.on("shape.move.start",hb,function(i){var o=i.shape;A(o,"bpmn:Lane")&&(i.shape=Ri(o)||o)}),t.on("spaceTool.move",hb,function(i){var o=i.hover;o&&A(o,"bpmn:Lane")&&(i.hover=Ri(o))})}gb.$inject=["elementRegistry","eventBus","canvas"];var mb=770;function yd(e,t,n,i){n.invoke(de,this);function o(s,c){var l=ge(s),u=c.categoryValue||l.categoryValueRef;u||(u=nb(e,l));var p=c.category||u.$parent||tb(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;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=ge(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=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||{};!A(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||{};!A(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;!A(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;!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",mb,function(s){var c=s.descriptor,l=s.element;if(!(!A(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",mb,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})}yd.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Le(yd,de);function vd(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 yb(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=vd(i,o,r,a),l=vd(i,o,r,s),u;c&&l?vb(c,r)>vb(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)})}yb.$inject=["eventBus"];function vb(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function bd(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(it(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}bd.$inject=["eventBus"],Le(bd,de);function bb(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function xb(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function Gk(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 Vk(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 xd(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=Vk([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 wb(e,t){var n=xd(e,t),i={x:n.x-e.x,y:n.y-e.y};return bb(i)}function Ls(e,t){return bb({x:e.x-t.x,y:e.y-t.y})}var _b=Math.sqrt,Eb=Math.min,Wk=Math.max,Sb=Math.abs;function Rb(e){return Math.pow(e,2)}function Is(e,t){return _b(Rb(e.x-t.x)+Rb(e.y-t.y))}function Uk(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=Is(e,i),a=Is(e,o),c=Eb(r,a),l=qk(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=Kk(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Is(i,s)/Is(i,o)}),p=Is(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function qk(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=_b(d),h=-p+g,m=-p-g,w={x:e.x-o*h,y:e.y-r*h};if(d===0)return[w];var y={x:e.x-o*m,y:e.y-r*m};return[w,y].filter(function(v){return Yk(v,e,t)})}function Yk(e,t,n){return Cb(e.x,t.x,n.x)&&Cb(e.y,t.y,n.y)}function Cb(e,t,n){return e>=Eb(t,n)-Bl&&e<=Wk(t,n)+Bl}function Kk(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Bl=.1;function Mb(e,t){return Sb(e.x-t.x)<=Bl&&Sb(e.y-t.y)<=Bl}function Xk(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=Pb(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 Ab(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=Uk(e,n),c=s.segmentIndex,l=Xk(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Tb(n,c),p=Tb(t,l),f=s.position,d=Qk(u,f),g=Zk(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,w=n[m];if(t.indexOf(w)!==-1)return a;if(h===0){var y=t[m];return o=y.x-s.position.x,r=y.y-s.position.y,{delta:{x:o,y:r},point:{x:e.x+o,y:e.y+r}}}h<0&&m!==0&&m<n.length-1&&(d=Pb(n,m))}var v={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},x=Gk({x:e.x-f.x,y:e.y-f.y},g);return o=v.x+x.x-e.x,r=v.y+x.y-e.y,{point:bo(v),delta:bo({x:o,y:r})}}function Pb(e,t){var n=Ls(e[t-1],e[t]),i=Ls(e[t],e[t+1]),o=n/(n+i);return o}function Zk(e,t){var n=xb(e),i=xb(t);return i-n}function Tb(e,t){return[e[t],e[t+1]]}function Qk(e,t){var n=Ls(e[0],e[1]),i=Ls(e[0],t);return n===0?0:i/n}function Jk(e,t,n,i){var o=qe(e);return Ab(o,t,n,i).delta}function Bs(e,t,n){var i=ks(t),o=ks(n),r=Gi(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return bo({x:o.x+a.x,y:o.y+a.y})}function kb(e,t,n){var i=ks(e),o=ks(t),r=ks(n),a=Gi(e,i),s=Gi(i,o),c=e2(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 bo({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function e2(e,t,n){var i=ze(t),o=ze(n);if(t2(i,o))return null;var r=Tn(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=Tn(n,s),c!==r?null:a}function t2(e,t){return n2(e,t)||i2(e,t)}function n2(e,t){return e.right!==t.right&&e.left!==t.left}function i2(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Ob="name",Db="text";function wd(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(Ob in l&&t.updateLabel(c,l[Ob]),Db in l&&A(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Db]||"");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)||!Qo(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=q({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),Jk(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&&Qo(u)&&l.label&&c.label&&(c.label.x=l.label.x,c.label.y=l.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.hints||{};if(!(!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,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(bl(c)){var p=c.label,f=qe(p),d=a2(u),g=r2(f,d),h=o2(g,u,l);t.moveShape(p,h)}})}Le(wd,de),wd.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function o2(e,t,n){var i=Bs(e,t,n);return bo(Gi(i,e))}function r2(e,t){if(t.length){var n=s2(e,t);return xd(e,n)}}function a2(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 s2(e,t){var n=t.map(function(o){return{line:o,distance:wb(e,o)}}),i=qi(n,"distance");return i[0].line}function c2(e,t,n,i){return Ab(e,t,n,i).point}function _d(e,t){de.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=q({},r.hints),c=r.newWaypoints||a.waypoints,l=r.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),c2(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)})})}Le(_d,de),_d.$inject=["eventBus","modeling"];function Nl(e,t,n){var i=Fl(e),o=Ib(i,t),r=i[0];return o.length?o[o.length-1]:Bs(r.original||r,n,t)}function $l(e,t,n){var i=Fl(e),o=Ib(i,t),r=i[i.length-1];return o.length?o[0]:Bs(r.original||r,n,t)}function Ed(e,t,n){var i=Fl(e),o=Lb(t,n),r=i[0];return Bs(r.original||r,o,t)}function Sd(e,t,n){var i=Fl(e),o=Lb(t,n),r=i[i.length-1];return Bs(r.original||r,o,t)}function Lb(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Fl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Ib(e,t){var n=Nn(e,u2);return rt(n,function(i){return l2(i,t)})}function l2(e,t){return Tn(t,e,1)==="intersect"}function u2(e){return e.original||e}function Rd(e,t){de.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(p2(i,o)){var r=f2(i);r.incoming.forEach(function(a){var s=$l(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=Nl(a,o,i);t.reconnectStart(a,o,s)})}},!0)}Rd.$inject=["eventBus","modeling"],Le(Rd,de);function p2(e,t){return A(e,"bpmn:Participant")&&ut(e)&&A(t,"bpmn:Participant")&&!ut(t)}function f2(e){var t=ws([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 d2=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Bb(e){const t=ge(e);if(!A(t,"bpmn:BoundaryEvent")&&!(A(t,"bpmn:StartEvent")&&Hn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:d2.some(i=>A(n[0],i))}function Nb(e){return A(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Cd(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(!Bb(o))return;const a=Nb(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})})}Cd.$inject=["injector","modeling"],Le(Cd,de);function Md(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)}Le(Md,de),Md.$inject=["eventBus","modeling"];function Ad(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=h2(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}Le(Ad,de),Ad.$inject=["eventBus","bpmnRules","modeling"];function Aa(e){return e.original||e}function h2(e,t){var n=vd(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 Pd(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)}Pd.$inject=["eventBus","modeling"],Le(Pd,de);function Td(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,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,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})})}Le(Td,de),Td.$inject=["eventBus","modeling","bpmnRules","injector"];function jl(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){Hn(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})})}Le(jl,de),jl.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)},jl.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var g2=1500,m2={width:140,height:120},kd={width:300,height:60},Od={width:60,height:300},Hl={width:300,height:150},zl={width:150,height:300},$b={width:140,height:120},Fb={width:100,height:40};function jb(e){e.on("resize.start",g2,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=w2(i,o,r)),A(i,"bpmn:SubProcess")&&ut(i)&&(n.minDimensions=$b),A(i,"bpmn:TextAnnotation")&&(n.minDimensions=Fb)})}jb.$inject=["eventBus"];var tr=Math.abs,y2=Math.min,v2=Math.max;function Hb(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function Pa(e,t,n){return Hb(e,t,n,y2)}function Ta(e,t,n){return Hb(e,t,n,v2)}var b2={top:20,left:50,right:20,bottom:20},x2={top:50,left:20,right:20,bottom:20};function w2(e,t,n){var i=Ri(e),o=!0,r=!0,a=Ol(i,[i]),s=ze(e),c={},l={},u=xn(e),p=u?kd:Od;/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=ze(g);u?(h.top<s.top-10&&(o=!1),h.bottom>s.bottom+10&&(r=!1)):(h.left<s.left-10&&(o=!1),h.right>s.right+10&&(r=!1)),/n/.test(t)&&(n&&tr(s.top-h.bottom)<10&&Ta(c,"top",h.top+p.height),tr(s.top-h.top)<5&&Pa(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&tr(s.right-h.left)<10&&Pa(c,"right",h.right-p.width),tr(s.right-h.right)<5&&Ta(l,"right",h.left+p.width)),/s/.test(t)&&(n&&tr(s.bottom-h.top)<10&&Pa(c,"bottom",h.bottom-p.height),tr(s.bottom-h.bottom)<5&&Ta(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&tr(s.left-h.right)<10&&Ta(c,"left",h.left+p.width),tr(s.left-h.left)<5&&Pa(l,"left",h.right-p.width))});var f=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(A(g,"bpmn:FlowElement")||A(g,"bpmn:Artifact"))}),d=u?b2:x2;return f.forEach(function(g){var h=ze(g);/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 zb(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function ka(e){return e.originalEvent||e.srcEvent}function Dd(e){zb(e),zb(ka(e))}function Ir(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 Gb(){return/mac/i.test(navigator.platform)}function Vb(e,t){return(ka(e)||e).button===t}function nr(e){return Vb(e,0)}function _2(e){return Vb(e,1)}function Ns(e){var t=ka(e)||e;return nr(e)?Gb()?t.metaKey:t.ctrlKey:!1}function Gl(e){var t=ka(e)||e;return nr(e)&&t.shiftKey}var Wb=1001;function Ub(e,t){e.on("resize.start",Wb+500,function(n){var i=n.context,o=i.shape;(A(o,"bpmn:Lane")||A(o,"bpmn:Participant"))&&(i.balanced=!Ns(n))}),e.on("resize.end",Wb,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=wv(a),t.resizeLane(o,a,i.balanced)),!1})}Ub.$inject=["eventBus","modeling"];var E2=500;function Ld(e,t,n,i,o){n.invoke(de,this);function r(u){return it(u,["bpmn:ReceiveTask","bpmn:SendTask"])||S2(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!Lt(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=ge(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),en(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");Jt(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",E2,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)})}Ld.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Le(Ld,de);function S2(e,t){return We(t)||(t=[t]),No(t,function(n){return _a(e,n)})}var qb=Math.max;function Yb(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;A(a,"bpmn:Participant")&&(r[s]=C2(a,i,o)),A(a,"bpmn:Lane")&&(r[s]=xn(a)?kd:Od),A(a,"bpmn:SubProcess")&&ut(a)&&(r[s]=$b),A(a,"bpmn:TextAnnotation")&&(r[s]=Fb),A(a,"bpmn:Group")&&(r[s]=m2)}),r})}Yb.$inject=["eventBus"];function R2(e){return e==="x"}function C2(e,t,n){var i=xn(e);if(!P2(e))return i?Hl:zl;var o=R2(t),r={};return o?i?r=Hl:r={width:A2(e,n,o),height:zl.height}:i?r={width:Hl.width,height:M2(e,n,o)}:r=zl,r}function M2(e,t,n){var i;return i=T2(e,t,n),qb(Hl.height,i)}function A2(e,t,n){var i;return i=k2(e,t,n),qb(zl.width,i)}function P2(e){return!!er(e).length}function T2(e,t,n){var i=er(e),o;return o=Id(i,t,n),e.height-o.height+kd.height}function k2(e,t,n){var i=er(e),o;return o=Id(i,t,n),e.width-o.width+Od.width}function Id(e,t,n){var i,o,r;for(i=0;i<e.length;i++)if(o=e[i],!n&&t>=o.y&&t<=o.y+o.height||n&&t>=o.x&&t<=o.x+o.width)return r=er(o),r.length?Id(r,t,n):o}var Kb="_plane";function Xb(e){var t=e.id;return O2(t)}function no(e){var t=e.id;return A(e,"bpmn:SubProcess")?Zb(t):t}function Br(e){return Zb(e)}function Vl(e){var t=dt(e);return A(t,"bpmndi:BPMNPlane")}function Zb(e){return e+Kb}function O2(e){return e.replace(new RegExp(Kb+"$"),"")}var Qb=400,D2=600,Jb={x:180,y:160};function Eo(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,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(no(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(no(d));if(!(!g||!d.children||!d.children.length)){var h=ex(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;!A(f,"bpmn:SubProcess")||!ut(f)||z(Ms([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(no(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(no(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(no(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(A(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,m=d.id;if(h!==m){if(Vl(f)){a.updateId(f,Br(m)),a.updateId(h,m);return}var w=a.get(Br(h));w&&a.updateId(Br(h),Br(m))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(A(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,m=d.id;if(h!==m){if(Vl(f)){a.updateId(f,Br(h)),a.updateId(m,h);return}var w=a.get(Br(m));w&&a.updateId(w,Br(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Vl(f)){var d=f,g=a.get(Xb(d));!g||g===d||t.fire("element.changed",{element:g})}}),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",D2,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),z(Ms(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=ex(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=no(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=A(dt(h),"bpmndi:BPMNPlane");if(m){var w=Xb(h),y=Lt(g,function(v){return v.id===w});y&&(f.parent=y.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}Le(Eo,de),Eo.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=on(i),r;if(!t.x)r={x:Jb.x-o.x,y:Jb.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})}},Eo.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Vv(e).map(i=>i.annotation));n.size&&z(Ms(e.children),i=>{n.has(i.annotation)&&z(i.associations,o=>{t.removeConnection(o)})})},Eo.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},Eo.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},Eo.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:no(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},Eo.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},Eo.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function L2(e){var t=[];return z(Ms(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function ex(e){return e.children.slice().concat(L2(e.children)).concat(I2(e))}function I2(e){return jf(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Bd(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=B2(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}Bd.$inject=["injector","modeling"],Le(Bd,de);function B2(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Nd(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}}})}Le(Nd,de),Nd.$inject=["eventBus","textRenderer"];function $d(e,t){de.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(ut(i))return;var o=ws(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||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)}Le($d,de),$d.$inject=["eventBus","modeling"];var Fd=500;function jd(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=N2(c).concat([a]),p=cb(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"],Fd,function(a){var s=a.context,c=s.shape;A(c,"bpmn:SubProcess")&&(c.collapsed?dt(c).isExpanded=!1:(i(c.children),dt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Fd,function(a){var s=a.context,c=s.shape;c.collapsed?dt(c).isExpanded=!1:dt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Fd,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"})})}Le(jd,de),jd.$inject=["eventBus","elementFactory","modeling"];function N2(e){return e.filter(function(t){return!t.hidden})}function Hd(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)})}Le(Hd,de),Hd.$inject=["canvas","injector","moddle","modeling"];function zd(e,t){de.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;$2(o,r)&&t.updateProperties(r,{default:null})})}Le(zd,de),zd.$inject=["eventBus","modeling"];function $2(e,t){if(!A(e,"bpmn:SequenceFlow"))return!1;var n=ge(t),i=ge(e);return n.get("default")===i}var F2=500,j2=5e3,tx=["shape.create","shape.delete","shape.move","shape.resize"],nx=[...tx,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Gd(e,t){de.call(this,e);var n;function i(){return n=n||new H2,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(nx,j2,function(){i()}),this.postExecuted(nx,F2,function(){r()}),this.preExecute(tx,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))})}Gd.$inject=["eventBus","modeling"],Le(Gd,de);function H2(){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 z2=500,G2=5e3,ix=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],ox=[...ix,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Vd(e,t){de.call(this,e);var n;function i(){return n=n||new V2,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(ox,G2,function(){i()}),this.postExecuted(ox,z2,function(){r()}),this.preExecute(ix,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)})}Vd.$inject=["eventBus","modeling"],Le(Vd,de);function V2(){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 Wd(e,t){de.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)W2(r)&&!q2(r)&&t.updateProperties(r,{isForCompensation:void 0})})}Le(Wd,de),Wd.$inject=["eventBus","modeling"];function W2(e){const t=ge(e);return t&&t.isForCompensation}function U2(e){return e&&A(e,"bpmn:BoundaryEvent")&&_a(e,"bpmn:CompensateEventDefinition")}function q2(e){return e.incoming.filter(n=>U2(n.source)).length>0}const Y2={__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",Jf],appendBehavior:["type",ed],associationBehavior:["type",nd],attachEventBehavior:["type",Rl],artifactBehavior:["type",td],boundaryEventBehavior:["type",id],categoryRootElementReferenceBehavior:["type",od],compensateBoundaryEventBehaviour:["type",rd],createBehavior:["type",ad],createDataObjectBehavior:["type",sd],createParticipantBehavior:["type",ud],dataInputAssociationBehavior:["type",pd],dataStoreBehavior:["type",fd],deleteLaneBehavior:["type",dd],detachEventBehavior:["type",Dl],dropOnFlowBehavior:["type",gd],eventBasedGatewayBehavior:["type",md],fixHoverBehavior:["type",gb],groupBehavior:["type",yd],importDockingFix:["type",yb],isHorizontalFix:["type",bd],labelBehavior:["type",wd],layoutConnectionBehavior:["type",_d],messageFlowBehavior:["type",Rd],nonInterruptingBehavior:["type",Cd],removeElementBehavior:["type",Ad],removeEmbeddedLabelBoundsBehavior:["type",Md],removeParticipantBehavior:["type",Pd],replaceConnectionBehavior:["type",Td],replaceElementBehaviour:["type",jl],resizeBehavior:["type",jb],resizeLaneBehavior:["type",Ub],rootElementReferenceBehavior:["type",Ld],spaceToolBehavior:["type",Yb],subProcessPlaneBehavior:["type",Eo],subProcessStartEventBehavior:["type",Bd],textAnnotationBehavior:["type",Nd],toggleCollapseConnectionBehaviour:["type",$d],toggleElementCollapseBehaviour:["type",jd],unclaimIdBehavior:["type",Hd],unsetDefaultFlowBehavior:["type",zd],updateFlowNodeRefsBehavior:["type",Gd],updateCategoryValueRefsBehavior:["type",Vd],setCompensationActivityAfterPasteBehavior:["type",Wd]};function Ud(e){this._commandStack=e.get("commandStack",!1)}Ud.$inject=["injector"],Ud.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const io={__init__:["rules"],rules:["type",Ud]};function Ci(e){de.call(this,e),this.init()}Ci.$inject=["eventBus"],Le(Ci,de),Ci.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(o){i.canExecute(o,t,function(r,a,s){return n(r)},!0)})},Ci.prototype.init=function(){};function rx(e,t){var n=Tn(e,t,-15);return n!=="intersect"?n:null}function On(e){Ci.call(this,e)}Le(On,Ci),On.$inject=["eventBus"],On.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return K2(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 Ul(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Ul(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 vx(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Tt(i)&&!ql(t,i)?!1:Bo(t,function(o){return Tt(o)?Ul(o.source,o.target,o):o.host?$s(o,o.host,null,n):Xd(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 fx(a)&&!n.includes(a.host)})?!1:$s(n,t,null,i)||mx(n,t,i)||yx(n,t)||ql(n,t)}),this.addRule("shape.create",function(e){return Xd(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return $s(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Ex(n,t)})},On.prototype.canConnectMessageFlow=wx,On.prototype.canConnectSequenceFlow=_x,On.prototype.canConnectDataAssociation=Zd,On.prototype.canConnectAssociation=bx,On.prototype.canConnectCompensationAssociation=xx,On.prototype.canMove=yx,On.prototype.canAttach=$s,On.prototype.canReplace=mx,On.prototype.canDrop=Oa,On.prototype.canInsert=ql,On.prototype.canCreate=Xd,On.prototype.canConnect=Ul,On.prototype.canResize=vx,On.prototype.canCopy=Ex;function K2(e){return qd(e)?null:it(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function qd(e){return!e||nt(e)}function ax(e){do{if(A(e,"bpmn:Process"))return ge(e);if(A(e,"bpmn:Participant"))return ge(e).processRef||ge(e)}while(e=e.parent)}function Yd(e){return A(e,"bpmn:TextAnnotation")}function Kd(e){return A(e,"bpmn:Group")&&!e.labelTarget}function sx(e){return A(e,"bpmn:BoundaryEvent")&&oo(e,"bpmn:CompensateEventDefinition")}function Wl(e){return ge(e).isForCompensation}function X2(e,t){var n=ax(e),i=ax(t);return n===i}function Z2(e){return A(e,"bpmn:InteractionNode")&&!A(e,"bpmn:BoundaryEvent")&&(!A(e,"bpmn:Event")||A(e,"bpmn:ThrowEvent")&&ux(e,"bpmn:MessageEventDefinition"))}function Q2(e){return A(e,"bpmn:InteractionNode")&&!Wl(e)&&(!A(e,"bpmn:Event")||A(e,"bpmn:CatchEvent")&&ux(e,"bpmn:MessageEventDefinition"))&&!(A(e,"bpmn:BoundaryEvent")&&!oo(e,"bpmn:MessageEventDefinition"))}function cx(e){for(var t=e;t=t.parent;){if(A(t,"bpmn:FlowElementsContainer"))return ge(t);if(A(t,"bpmn:Participant"))return ge(t).processRef}return null}function lx(e,t){var n=cx(e),i=cx(t);return n===i}function oo(e,t){var n=ge(e);return!!Lt(n.eventDefinitions||[],function(i){return A(i,t)})}function ux(e,t){var n=ge(e);return(n.eventDefinitions||[]).every(function(i){return A(i,t)})}function J2(e){return A(e,"bpmn:FlowNode")&&!A(e,"bpmn:EndEvent")&&!Hn(e)&&!(A(e,"bpmn:IntermediateThrowEvent")&&oo(e,"bpmn:LinkEventDefinition"))&&!sx(e)&&!Wl(e)}function eO(e){return A(e,"bpmn:FlowNode")&&!A(e,"bpmn:StartEvent")&&!A(e,"bpmn:BoundaryEvent")&&!Hn(e)&&!(A(e,"bpmn:IntermediateCatchEvent")&&oo(e,"bpmn:LinkEventDefinition"))&&!Wl(e)}function tO(e){return A(e,"bpmn:ReceiveTask")||A(e,"bpmn:IntermediateCatchEvent")&&(oo(e,"bpmn:MessageEventDefinition")||oo(e,"bpmn:TimerEventDefinition")||oo(e,"bpmn:ConditionalEventDefinition")||oo(e,"bpmn:SignalEventDefinition"))}function nO(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function px(e,t){var n=nO(t);return n.indexOf(e)!==-1}function Ul(e,t,n){if(qd(e)||qd(t))return null;if(!A(n,"bpmn:DataAssociation")){if(wx(e,t))return{type:"bpmn:MessageFlow"};if(_x(e,t))return{type:"bpmn:SequenceFlow"}}var i=Zd(e,t);return i||(xx(e,t)?{type:"bpmn:Association",associationDirection:"One"}:bx(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Oa(e,t){return nt(e)||Kd(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")&&!iO(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")?No(ge(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 iO(e){return ge(e).cancelActivity&&(dx(e)||hx(e))}function fx(e){return!nt(e)&&A(e,"bpmn:BoundaryEvent")}function oO(e){return A(e,"bpmn:Lane")}function rO(e){return fx(e)||A(e,"bpmn:IntermediateThrowEvent")&&dx(e)?!0:A(e,"bpmn:IntermediateCatchEvent")&&hx(e)}function dx(e){var t=ge(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function hx(e){return gx(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function gx(e,t){return t.some(function(n){return oo(e,n)})}function aO(e){return A(e,"bpmn:ReceiveTask")&&Lt(e.incoming,function(t){return A(t.source,"bpmn:EventBasedGateway")})}function $s(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return nt(o)||!rO(o)||Hn(t)||!A(t,"bpmn:Activity")||Wl(t)||i&&!rx(i,t)||aO(t)?!1:"attach"}function mx(e,t,n){if(!t)return!1;var i={replacements:[]};return z(e,function(o){Hn(t)||A(o,"bpmn:StartEvent")&&o.type!=="label"&&Oa(o,t)&&(gT(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(mT(o)||yT(o)||vT(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),gx(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")||oo(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")&&$s(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function yx(e,t){return No(e,oO)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Oa(n,t)})}function Xd(e,t,n,i){return t?nt(e)||Kd(e)?!0:Oa(e,t)||ql(e,t):!1}function vx(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:Yd(e)?n?n==="e"||n==="w":!0:Kd(e)?!0:nt(e)?n?n==="e"||n==="w":!0:!1}function sO(e,t){var n=Yd(e),i=Yd(t);return(n||i)&&n!==i}function bx(e,t){return px(t,e)||px(e,t)?!1:sO(e,t)?!0:!!Zd(e,t)}function xx(e,t){return lx(e,t)&&sx(e)&&A(t,"bpmn:Activity")&&!lO(t,e)&&!Hn(t)}function wx(e,t){return Rx(e)&&!Rx(t)?!1:Z2(e)&&Q2(t)&&!X2(e,t)}function _x(e,t){return J2(e)&&eO(t)&&lx(e,t)&&!(A(e,"bpmn:EventBasedGateway")&&!tO(t))}function Zd(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 ql(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 Qd(e,t){return e&&t&&e.indexOf(t)!==-1}function Ex(e,t){return nt(t)?!0:!(A(t,"bpmn:Lane")&&!Qd(e,t.parent)||A(t,"bpmn:MessageFlow")&&!cO(e,t))}function cO(e,t){var n=Sx(t.source),i=Sx(t.target);return Qd(e,n)&&Qd(e,i)}function Sx(e){for(;e;e=e.parent)if(A(e,"bpmn:Participant"))return e;return null}function Rx(e){return Ra(e,"bpmn:Process")||Ra(e,"bpmn:Collaboration")}function lO(e,t){return e.attachers.includes(t)}const uO={__depends__:[io],__init__:["bpmnRules"],bpmnRules:["type",On]};var pO=2e3;function Cx(e,t){e.on("saveXML.start",pO,n);function n(){var i=t.getRootElements();z(i,function(o){var r=dt(o),a,s;a=ws([o]),a=rt(a,function(c){return c!==o&&!c.labelTarget}),s=Nn(a,dt),r.set("planeElement",s)})}}Cx.$inject=["eventBus","canvas"];const fO={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Cx]};function Yl(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)})}Yl.prototype.getOrdering=function(e,t){return null},Le(Yl,de);function Jd(e,t){Yl.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 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=Vg(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}}}Jd.$inject=["eventBus","canvas"],Le(Jd,Yl);const dO={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Jd]};function Fs(){}Fs.prototype.get=function(){return this._data},Fs.prototype.set=function(e){this._data=e},Fs.prototype.clear=function(){var e=this._data;return delete this._data,e},Fs.prototype.isEmpty=function(){return!this._data};const hO={clipboard:["type",Fs]};var Mx=1500;function Ax(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=Ir(a),c=document.elementFromPoint(s.x,s.y),gO(c)}}Ax.$inject=["elementRegistry","eventBus","injector"];function gO(e){return Tr(e,"svg, .djs-element",!0)}const mO={__init__:["hoverFix"],hoverFix:["type",Ax]};function yO(e){return!0}function Kl(e){return nr(e)||_2(e)}var Px=500;function Tx(e,t,n){var i=this;function o(P,T,N){if(!s(P,T)){var j,V,Q;N?V=t.getGraphics(N):(j=T.delegateTarget||T.target,j&&(V=j,N=t.get(V))),!(!V||!N)&&(Q=e.fire(P,{element:N,gfx:V,originalEvent:T}),Q===!1&&(T.stopPropagation(),T.preventDefault()))}}var r={};function a(P){return r[P]}function s(P,T){var N=l[P]||nr;return!N(T)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":yO,"element.mousedown":Kl,"element.mouseup":Kl,"element.click":Kl,"element.dblclick":Kl};function u(P,T,N){var j=c[P];if(!j)throw new Error("unmapped DOM event name <"+P+">");return o(j,T,N)}var p="svg, .djs-element";function f(P,T,N,j){var V=r[N]=function(Q){o(N,Q)};j&&(l[N]=j),V.$delegate=ni.bind(P,p,T,V)}function d(P,T,N){var j=a(N);j&&ni.unbind(P,T,j.$delegate)}function g(P){z(c,function(T,N){f(P,N,T)})}function h(P){z(c,function(T,N){d(P,N,T)})}e.on("canvas.destroy",function(P){h(P.svg)}),e.on("canvas.init",function(P){g(P.svg)}),e.on(["shape.added","connection.added"],function(P){var T=P.element,N=P.gfx;e.fire("interactionEvents.createHit",{element:T,gfx:N})}),e.on(["shape.changed","connection.changed"],Px,function(P){var T=P.element,N=P.gfx;e.fire("interactionEvents.updateHit",{element:T,gfx:N})}),e.on("interactionEvents.createHit",Px,function(P){var T=P.element,N=P.gfx;i.createDefaultHit(T,N)}),e.on("interactionEvents.updateHit",function(P){var T=P.element,N=P.gfx;i.updateDefaultHit(T,N)});var m=E("djs-hit djs-hit-stroke"),w=E("djs-hit djs-hit-click-stroke"),y=E("djs-hit djs-hit-all"),v=E("djs-hit djs-hit-no-move"),x={all:y,"click-stroke":w,stroke:m,"no-move":v};function E(P,T){return T=q({stroke:"white",strokeWidth:15},T||{}),n.cls(P,["no-fill","no-border"],T)}function M(P,T){var N=x[T];if(!N)throw new Error("invalid hit type <"+T+">");return Ae(P,N),P}function D(P,T){Ke(P,T)}this.removeHits=function(P){var T=ms(".djs-hit",P);z(T,nn)},this.createDefaultHit=function(P,T){var N=P.waypoints,j=P.isFrame,V;return N?this.createWaypointsHit(T,N):(V=j?"stroke":"all",this.createBoxHit(T,V,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,T){var N=xs(T);return M(N,"stroke"),D(P,N),N},this.createBoxHit=function(P,T,N){N=q({x:0,y:0},N);var j=$e("rect");return M(j,T),Ae(j,N),D(P,j),j},this.updateDefaultHit=function(P,T){var N=Et(".djs-hit",T);if(N)return P.waypoints?Ff(N,P.waypoints):Ae(N,{width:P.width,height:P.height}),N},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Tx.$inject=["eventBus","elementRegistry","styles"];const Xl={__init__:["interactionEvents"],interactionEvents:["type",Tx]};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?z(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var kx="hover",Ox="selected";function Dx(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,kx)}),t.on("element.out",function(o){i(o.element,kx)}),t.on("selection.changed",function(o){function r(l){i(l,Ox)}function a(l){n(l,Ox)}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)})}Dx.$inject=["canvas","eventBus"];function Lx(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(vO))}}),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(nr(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=Gl(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}Lx.$inject=["eventBus","selection","canvas","elementRegistry"];function vO(e){return!e.hidden}const Mi={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Xl],selection:["type",Da],selectionVisuals:["type",Dx],selectionBehavior:["type",Lx]};var bO=/^djs-cursor-.*$/;function Zl(e){var t=Rt(document.body);t.removeMatching(bO),e&&t.add("djs-cursor-"+e)}function Ix(){Zl(null)}var xO=5e3;function Bx(e,t){t=t||"element.click";function n(){return!1}return e.once(t,xO,n),function(){e.off(t,n)}}var wO=["c","C"],_O=["v","V"],EO=["d","D"],SO=["x","X"],RO=["y","Y"],Nx=["z","Z"];function CO(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 eh(e){return e.shiftKey}function MO(e){return ri(e)&&mn(wO,e)}function AO(e){return ri(e)&&mn(_O,e)}function PO(e){return ri(e)&&mn(EO,e)}function TO(e){return ri(e)&&mn(SO,e)}function kO(e){return ri(e)&&!eh(e)&&mn(Nx,e)}function OO(e){return ri(e)&&(mn(RO,e)||mn(Nx,e)&&eh(e))}var La=Math.round,$x="djs-drag-active";function Nr(e){e.preventDefault()}function DO(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function LO(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Fx(e,t,n,i){var o={threshold:5,trapClick:!0},r;function a(v){var x=t.viewbox(),E=t._container.getBoundingClientRect();return{x:x.x+(v.x-E.left)/x.scale,y:x.y+(v.y-E.top)/x.scale}}function s(v,x){x=x||r;var E=e.createEvent(q({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+v,E)===!1?!1:e.fire(x.prefix+"."+v,E)}function c(v){var x=v.filter(function(E){return i.get(E.id)});x.length&&n.select(x)}function l(v,x){var E=r.payload,M=r.displacement,D=r.globalStart,P=Ir(v),T=Gi(P,D),N=r.localStart,j=a(P),V=Gi(j,N);if(!r.active&&(x||LO(T)>r.threshold)){if(q(E,{x:La(N.x+M.x),y:La(N.y+M.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return m();r.active=!0,r.keepSelection||(E.previousSelection=n.get(),n.select(null)),r.cursor&&Zl(r.cursor),t.addMarker(t.getRootElement(),$x)}Dd(v),r.active&&(q(E,{x:La(j.x+M.x),y:La(j.y+M.y),dx:La(V.x),dy:La(V.y)},{originalEvent:v}),s("move"))}function u(v){var x,E=!0;r.active&&(v&&(r.payload.originalEvent=v,Dd(v)),E=s("end")),E===!1&&s("rejected"),x=w(E!==!0),s("ended",x)}function p(v){mn("Escape",v)&&(Nr(v),m())}function f(v){var x;r.active&&(x=Bx(e),setTimeout(x,400),Nr(v)),u(v)}function d(v){l(v)}function g(v){var x=r.payload;x.hoverGfx=v.gfx,x.hover=v.element,s("hover")}function h(v){s("out");var x=r.payload;x.hoverGfx=null,x.hover=null}function m(v){var x;if(r){var E=r.active;E&&s("cancel"),x=w(v),E&&s("canceled",x)}}function w(v){var x,E;s("cleanup"),Ix(),r.trapClick?E=f:E=u,je.unbind(document,"mousemove",l),je.unbind(document,"dragstart",Nr),je.unbind(document,"selectstart",Nr),je.unbind(document,"mousedown",E,!0),je.unbind(document,"mouseup",E,!0),je.unbind(document,"keyup",p),je.unbind(document,"touchstart",d,!0),je.unbind(document,"touchcancel",m,!0),je.unbind(document,"touchmove",l,!0),je.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),$x);var M=r.payload.previousSelection;return v!==!1&&M&&!n.get().length&&c(M),x=r,r=null,x}function y(v,x,E,M){r&&m(!1),typeof x=="string"&&(M=E,E=x,x=null),M=q({},o,M||{});var D=M.data||{},P,T,N,j,V;if(M.trapClick?j=f:j=u,v?(P=ka(v)||v,T=Ir(v),Dd(v),P.type==="dragstart"&&Nr(P)):(P=null,T={x:0,y:0}),N=a(T),x||(x=N),V=DO(P),r=q({prefix:E,data:D,payload:{},globalStart:T,displacement:Gi(x,N),localStart:N,isTouch:V},M),M.manual||(V?(je.bind(document,"touchstart",d,!0),je.bind(document,"touchcancel",m,!0),je.bind(document,"touchmove",l,!0),je.bind(document,"touchend",u,!0)):(je.bind(document,"mousemove",l),je.bind(document,"dragstart",Nr),je.bind(document,"selectstart",Nr),je.bind(document,"mousedown",j,!0),je.bind(document,"mouseup",j,!0)),je.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return m(),!1;M.autoActivate&&l(v,!0)}e.on("diagram.destroy",m),this.init=y,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=m,this.context=function(){return r},this.setOptions=function(v){q(o,v)}}Fx.$inject=["eventBus","canvas","selection","elementRegistry"];const So={__depends__:[mO,Mi],dragging:["type",Fx]};function $r(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}$r.prototype.next=function(){return this._prefix+ ++this._counter};const IO=new $r("ps");var BO=["marker-start","marker-mid","marker-end"],NO=["circle","ellipse","line","path","polygon","polyline","path","rect"];function ir(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}ir.$inject=["elementRegistry","eventBus","canvas","styles"],ir.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},ir.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},ir.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=kf(n);return this._cloneMarkers(Xo(o),i),Ae(o,this._styles.cls(i,[])),Ke(t,o),Ae(o,"data-preview-support-element-id",e.id),o},ir.prototype.addFrame=function(e,t){var n=$e("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Ke(t,n),Ae(n,"data-preview-support-element-id",e.id),n},ir.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),HO(e)&&BO.forEach(function(o){if(Ae(e,o)){var r=$O(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},ir.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,IO.next()].join("-"),a=Et("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||kf(n);s.id=r,lt(s).add(o);var c=Et(":scope > defs",e);c||(c=$e("defs"),Ke(e,c)),Ke(c,s);var l=jO(s.id);Ae(t,i,l)};function $O(e,t,n){var i=FO(Ae(e,t));return Et("marker#"+i,n||document)}function FO(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function jO(e){return"url(#"+e+")"}function HO(e){return NO.indexOf(e.nodeName)!==-1}const Ia={__init__:["previewSupport"],previewSupport:["type",ir]};var zO="drop-ok",jx="drop-not-ok",Hx="attach-ok",zx="new-parent",Gx="create",GO=2e3;function Vx(e,t,n,i,o){function r(c,l,u,p,f){if(!l)return!1;c=rt(c,function(y){var v=y.labelTarget;return!y.parent&&!(nt(y)&&c.indexOf(v)!==-1)});var d=Lt(c,function(y){return!Tt(y)}),g=!1,h=!1,m=!1;Ux(c)&&(g=o.allowed("shape.attach",{position:u,shape:d,target:l})),g||(Ux(c)?m=o.allowed("shape.create",{position:u,shape:d,source:p,target:l}):m=o.allowed("elements.create",{elements:c,position:u,target:l}));var w=f.connectionTarget;return m||g?(d&&p&&(h=o.allowed("connection.create",{source:w===p?d:p,target:w===p?p:d,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):m===null||g===null?null:!1}function a(c,l){[Hx,zO,jx,zx].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}Wx(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,Hx):a(p,h?zx:jx))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,p=l.shape,f=l.elements,d=l.target,g=l.canExecute,h=g&&g.attach,m=g&&g.connect,w=l.hints||{};if(g===!1||!d)return!1;Wx(c);var y={x:c.x,y:c.y};m?p=i.appendShape(u,p,y,d,{attach:h,connection:m===!0?{}:m,connectionTarget:w.connectionTarget}):(f=i.createElements(f,y,d,q({},w,{attach:h})),p=Lt(f,function(v){return!Tt(v)})),q(l,{elements:f,shape:p}),q(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Gx&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],GO,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){We(l)||(l=[l]);var p=Lt(l,function(g){return!Tt(g)});if(p){u=q({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=on(f);z(l,function(g){Tt(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}})),q(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,Gx,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}Vx.$inject=["canvas","dragging","eventBus","modeling","rules"];function Wx(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 Ux(e){return e&&e.length===1&&!Tt(e[0])}var VO=750;function qx(e,t,n,i,o){function r(a){var s=$e("g");Ae(s,o.cls("djs-drag-group",["no-events"]));var c=$e("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(Xo(u),l)):(u=n._createContainer("shape",c),n.drawShape(Xo(u),l),kn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",VO,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)),kn(u,a.x,a.y)):nn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&nn(c)})}qx.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Ql={__depends__:[So,Ia,io,Mi],__init__:["create","createPreview"],create:["type",Vx],createPreview:["type",qx]};function th(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)})}th.$inject=["eventBus"],th.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||WO(0,0)};function WO(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 js={__init__:["mouse"],mouse:["type",th]};var Yx=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),UO(u)&&(l.priority=2,l.host=u.host.id),Tt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=qO(u)),nt(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",Yx,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",Yx,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;q(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=on(e);return z(e,function(r){Tt(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}})),q(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,q({},i))},ai.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return z(e,function(r,a){r=qi(r,"priority"),z(r,function(s){var c=q({},Yi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(Tt(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},ai.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Yi(e,["id"]));return t},ai.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Yi(e,["id"]));return t},ai.prototype.createShape=function(e){var t=this._elementFactory.createShape(Yi(e,["id"]));return t},ai.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Tt(e)&&(!n.has(e.source)||!n.has(e.target))||nt(e)&&!n.has(e.labelTarget))},ai.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=ul(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}Or(a,function(p,f,d){if(nt(p))return;z(p.labels,function(m){c(m,d)});function g(m){m&&m.length&&z(m,function(w){z(w.labels,function(y){c(y,d)}),c(w,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=qi(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)){Xx(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){Xx(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function UO(e){return!!e.host}function qO(e){return Nn(e.waypoints,function(t){return t=Kx(t),t.original&&(t.original=Kx(t.original)),t})}function Kx(e){return q({},e)}function Xx(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const YO={__depends__:[hO,Ql,js,io],__init__:["copyPaste"],copyPaste:["type",ai]};function nh(e,t,n){We(n)||(n=[n]),z(n,function(i){Er(e[i])||(t[i]=e[i])})}var ih=750;function Zx(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",ih,function(c){var l=c.descriptor,u=c.element,p=ge(u);if(nt(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(dt(u),!0);d.bpmnElement=f,nh(f,l,"name"),nh(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])),Yi(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(nt(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,nh(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",ih,function(c){var l=c.descriptor,u=c.element;if(A(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;A(l,"bpmn:SubProcess")&&z(Ms(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",ih,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}Zx.$inject=["bpmnFactory","eventBus","moddleCopy"];const KO=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],XO=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Hs(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:o}=i;if(!(!o||!o.length))return qi(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=hn(o)&&o.$descriptor;if(a&&XO.includes(a))return r;if(a&&KO.includes(a)||a&&s&&!Lt(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})}Hs.$inject=["eventBus","bpmnFactory","moddle"],Hs.prototype.copyElement=function(e,t,n,i=!1){n&&!We(n)&&(n=[n]),n=n||oh(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},Hs.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},Hs.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function oh(e,t){return ti(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Qx={__depends__:[YO],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Zx],moddleCopy:["type",Hs]};var Jx=Math.round;function rh(e,t){this._modeling=e,this._eventBus=t}rh.$inject=["modeling","eventBus"],rh.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=Jx(s+r/2),u=Jx(c+a/2),p=i.replaceShape(e,q({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function ew(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}ew.$inject=["selection","eventBus"];const ZO={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",ew],replace:["type",rh]};function QO(e,t,n){We(n)||(n=[n]),z(n,function(i){Er(e[i])||(t[i]=e[i])})}var JO=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function eD(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 tw(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(Jl(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&eD(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),QO(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=oh(p.$descriptor),h=oh(f.$descriptor,!0),m=tD(g,h);q(f,Ni(c,JO));var w=rt(m,function(x){return x==="eventDefinitions"?nw(s,c.eventDefinitionType):x==="loopCharacteristics"?!Hn(f):ei(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!Hn(f):!0});if(f=n.copyElement(p,f,w),c.eventDefinitionType&&(nw(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),A(p,"bpmn:Activity")){if(Jl(p))d.isExpanded=ut(s);else if(c&&ei(c,"isExpanded")){d.isExpanded=c.isExpanded;var y=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=y.width,d.height=y.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}ut(s)&&!A(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Jl(p)&&!Jl(f)&&(l.moveChildren=!1),A(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var v=xn(s);dt(s).isHorizontal||(dt(d).isHorizontal=v),d.width=v?s.width:t.getDefaultSize(d).width,d.height=v?t.getDefaultSize(d).height:s.height}return r.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,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}tw.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Jl(e){return A(e,"bpmn:SubProcess")}function nw(e,t){var n=ge(e);return t&&n.get("eventDefinitions").some(function(i){return A(i,t)})}function tD(e,t){return e.filter(function(n){return t.includes(n)})}const iw={__depends__:[Qx,ZO,Mi],bpmnReplace:["type",tw]};var nD=250;function Fr(e){this._eventBus=e,this._tools=[],this._active=null}Fr.$inject=["eventBus"],Fr.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)},Fr.prototype.isActive=function(e){return e&&this._active===e},Fr.prototype.length=function(e){return this._tools.length},Fr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Fr.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,nD,function(o){this._active&&(iD(o)||this.setActive(null))},this)};function iD(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Tr(t,'.group[data-group="tools"]')}const eu={__depends__:[So],__init__:["toolManager"],toolManager:["type",Fr]};function oD(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 rD(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 aD(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 ah=Math.abs,sD=Math.round,Ro={x:"width",y:"height"},ow="crosshair",or={n:"top",w:"left",s:"bottom",e:"right"},cD=1500,tu={n:"s",w:"e",s:"n",e:"w"},nu=20;function Ai(e,t,n,i,o,r,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=o,this._toolManager=r,this._mouse=a;var s=this;r.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",cD,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&aw(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){aw(c);var h={x:0,y:0};h[u]=sD(c["d"+u]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(m){s.activateSelection(m.originalEvent,!0,!0)})}})}Ai.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Ai.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:ow,data:{context:{reactivate:n}},trapClick:!1})},Ai.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:ow,data:{context:{}}})},Ai.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},Ai.prototype.init=function(e,t){var n=ah(e.dx)>ah(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(ah(i)<5)return!1;i<0&&(i*=-1),Ns(e)&&(i*=-1);var r=oD(n,i),a=this._canvas.getRootElement();!Gl(e)&&e.hover&&(a=e.hover);var s=[...ws(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=lD(c,n,r,o,l);return q(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),Zl("resize-"+(n==="x"?"ew":"ns")),!0},Ai.prototype.calculateAdjustments=function(e,t,n,i){var o=this._rules,r=[],a=[],s=new Set,c=new Set,l=[],u=[];function p(d){s.has(d)||(s.add(d),r.push(d));var g=d.label;g&&!s.has(g)&&(s.add(g),r.push(g))}function f(d){c.has(d)||(c.add(d),a.push(d))}return z(e,function(d){if(!(!d.parent||nt(d))){if(Tt(d)){u.push(d);return}var g=d[t],h=g+d[Ro[t]];if(uD(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}},Ai.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Ai.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function rw(e){return{top:e.top-nu,right:e.right+nu,bottom:e.bottom+nu,left:e.left-nu}}function aw(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 lD(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=ze(f),m=rt(g,function(V){return!Tt(V)&&!nt(V)&&!u.has(V)&&!p.has(V)}),w=rt(g,function(V){return!Tt(V)&&!nt(V)&&u.has(V)}),y,v,x,E=[],M=[],D,P,T,N;m.length&&(v=rw(ze(on(m))),y=i-h[or[n]]+v[or[n]],n==="n"?s.bottom=l=Ue(l)?Math.min(l,y):y:n==="w"?s.right=l=Ue(l)?Math.min(l,y):y:n==="s"?s.top=c=Ue(c)?Math.max(c,y):y:n==="e"&&(s.left=c=Ue(c)?Math.max(c,y):y)),w.length&&(x=rw(ze(on(w))),y=i-x[or[tu[n]]]+h[or[tu[n]]],n==="n"?s.bottom=l=Ue(l)?Math.min(l,y):y:n==="w"?s.right=l=Ue(l)?Math.min(l,y):y:n==="s"?s.top=c=Ue(c)?Math.max(c,y):y:n==="e"&&(s.left=c=Ue(c)?Math.max(c,y):y)),d&&d.length&&(d.forEach(function(V){u.has(V)?E.push(V):M.push(V)}),E.length&&(D=ze(on(E.map(qe))),P=h[or[tu[n]]]-(D[or[tu[n]]]-i)),M.length&&(T=ze(on(M.map(qe))),N=T[or[n]]-(h[or[n]]-i)),n==="n"?(y=Math.min(P||1/0,N||1/0),s.bottom=l=Ue(l)?Math.min(l,y):y):n==="w"?(y=Math.min(P||1/0,N||1/0),s.right=l=Ue(l)?Math.min(l,y):y):n==="s"?(y=Math.max(P||-1/0,N||-1/0),s.top=c=Ue(c)?Math.max(c,y):y):n==="e"&&(y=Math.max(P||-1/0,N||-1/0),s.left=c=Ue(c)?Math.max(c,y):y));var j=o&&o[f.id];j&&(n==="n"?(y=i+f[Ro[t]]-j[Ro[t]],s.bottom=l=Ue(l)?Math.min(l,y):y):n==="w"?(y=i+f[Ro[t]]-j[Ro[t]],s.right=l=Ue(l)?Math.min(l,y):y):n==="s"?(y=i-f[Ro[t]]+j[Ro[t]],s.top=c=Ue(c)?Math.max(c,y):y):n==="e"&&(y=i-f[Ro[t]]+j[Ro[t]],s.left=c=Ue(c)?Math.max(c,y):y))}),s}}function uD(e){return!!e.host}var sh="djs-dragging",sw="djs-resizing",pD=250,iu=Math.max;function cw(e,t,n,i,o){function r(a,s){z(a,function(c){o.addDragger(c,s),n.addMarker(c,sh)})}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=$e("g");Ae(u,i.cls("djs-crosshair-group",["no-events"])),Ke(s,u);var p=$e("path");Ae(p,"d",l.x),lt(p).add("djs-crosshair"),Ke(u,p);var f=$e("path");Ae(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;kn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&nn(c)}),e.on("spaceTool.move",pD,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=$e("path"),Ae(c,"d","M0,0 L0,0"),lt(c).add("djs-crosshair"),Ke(f,c),s.line=c;var d=$e("g");Ae(d,i.cls("djs-drag-group",["no-events"])),Ke(n.getActiveLayer(),d),r(u,d);var g=new Set(u);z(p,function(M){g.add(M)});var h=new Set,m=s.movingConnections=[];g.forEach(function(M){z(M.outgoing,function(D){h.has(D)||!Tt(D)||!g.has(D.target)||(h.add(D),m.push(D))})}),r(m,d),s.dragGroup=d}if(!s.frameGroup){var w=$e("g");Ae(w,i.cls("djs-frame-group",["no-events"])),Ke(n.getActiveLayer(),w);var y=[];z(p,function(M){var D=o.addFrame(M,w),P=D.getBBox();y.push({element:D,initialBounds:P}),n.addMarker(M,sw)}),s.frameGroup=w,s.frames=y}var v={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Ae(c,{d:v[l]});var x={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[x[s.axis]]=0,kn(s.dragGroup,E.x,E.y),z(s.frames,function(M){var D=M.element,P=M.initialBounds,T,N;s.direction==="e"?Ae(D,{width:iu(P.width+E.x,5)}):(T=iu(P.width-E.x,5),Ae(D,{width:T,x:P.x+P.width-T})),s.direction==="s"?Ae(D,{height:iu(P.height+E.y,5)}):(N=iu(P.height-E.y,5),Ae(D,{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;z(c,function(g){n.removeMarker(g,sh)}),z(l,function(g){n.removeMarker(g,sh)}),f&&(nn(p),nn(f)),z(u,function(g){n.removeMarker(g,sw)}),d&&nn(d)})}cw.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const fD={__init__:["spaceToolPreview"],__depends__:[So,io,eu,Ia,js],spaceTool:["type",Ai],spaceToolPreview:["type",cw]};function ou(e,t){e.invoke(Ai,this),this._canvas=t}ou.$inject=["injector","canvas"],Le(ou,Ai),ou.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")),on(r))));const s=[...e,...a];var c=Ai.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(A(l,"bpmn:TextAnnotation")||dD(l)&&(t==="y"&&xn(l)||t==="x"&&!xn(l)))}),c};function dD(e){return A(e,"bpmn:Participant")&&!ge(e).processRef}const lw={__depends__:[fD],spaceTool:["type",ou]};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:Wg("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 hD={commandStack:["type",Wt]};function rr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var gD=250,uw=1400;function ch(e,t,n){de.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",uw,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=pw(a),r.validatedShapes=pw(s)}),i&&t.on("shape.move.start",gD,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",uw,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;rr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.labelTarget;s&&(r.labelTargetIndex=Hf(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)})}Le(ch,de),ch.$inject=["injector","eventBus","modeling"];function pw(e){var t=new Set(e);return rt(e,function(n){return!t.has(n.labelTarget)})}const mD={__init__:["labelSupport"],labelSupport:["type",ch]};var yD=251,fw=1401,dw="attach-ok";function lh(e,t,n,i,o){de.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",fw,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=vD(c),s.validatedShapes=bD(l)}),r&&t.on("shape.move.start",yD,function(a){var s=a.context,c=s.shapes,l=uh(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,dw),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,dw)}))}}),this.preExecuted("elements.move",fw,function(a){var s=a.context,c=s.closure,l=s.shapes,u=uh(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 xD(p)&&!wD(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;rr(c.attachers,function(u){var p=i.allowed("elements.move",{target:l,shapes:[u]});p==="attach"?o.updateAttachment(u,l):o.removeShape(u)}),l.attachers.length&&z(l.attachers,function(u){var p=kb(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=kb(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;rr(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}Le(lh,de),lh.$inject=["injector","eventBus","canvas","rules","modeling"];function uh(e){return Pp(Nn(e,function(t){return t.attachers||[]}))}function vD(e){var t=uh(e);return _S("id",e,t)}function bD(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 xD(e){return!!e.host}function wD(e,t){return e.indexOf(t)!==-1}const _D={__depends__:[io],__init__:["attachSupport"],attachSupport:["type",lh]};function hw(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(av(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)})}hw.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const ph={__init__:["changeSupport"],changeSupport:["type",hw]};function Pi(e){this._model=e}Pi.$inject=["moddle"],Pi.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"])},Pi.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))},Pi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Pi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Pi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",q({bpmnElement:e,bounds:this.createDiBounds()},t))},Pi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Pi.prototype.createDiWaypoints=function(e){var t=this;return Nn(e,function(n){return t.createDiWaypoint(n)})},Pi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Ni(e,["x","y"]))},Pi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",q({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Pi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",q({bpmnElement:e},t))};function 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(w){A(w,"bpmn:BaseElement")&&i.updateParent(w)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;A(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,w=g.newSource,y=ge(h),v=ge(m),x=ge(w);y.conditionExpression&&!it(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=y.conditionExpression,delete y.conditionExpression),m!==w&&v.default===y&&(g.oldDefault=v.default,delete v.default)})),this.reverted("connection.reconnect",ci(function(d){var g=d.context,h=g.connection,m=g.oldSource,w=g.newSource,y=ge(h),v=ge(m),x=ge(w);g.oldConditionExpression&&(y.conditionExpression=g.oldConditionExpression),g.oldDefault&&(v.default=g.oldDefault,delete x.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],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=mi(g),m=dt(g),w=m&&m.get("label");Qo(g)||Vl(g)||(h&&!w?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&w&&m.set("label",void 0))}}Le(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(!nt(e)&&!(A(e,"bpmn:DataStoreReference")&&e.parent&&A(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=dt(e),r=n&&n.businessObject,a=dt(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)}},si.prototype.updateBounds=function(e){var t=dt(e),n=SD(e);if(n){var i=Gi(n,t.get("bounds"));q(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)),q(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;A(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Jt(i,e)),A(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),en(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&&!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 ED(e){for(;e&&!A(e,"bpmn:Definitions");)e=e.$parent;return e}si.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)},si.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=ED(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))}}},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(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)},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;A(i,"bpmn:BaseElement")&&e(t)}}function SD(e){if(A(e,"bpmn:Activity")){var t=dt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function ar(e,t){xo.call(this),this._bpmnFactory=e,this._moddle=t}Le(ar,xo),ar.$inject=["bpmnFactory","moddle"],ar.prototype._baseCreate=xo.prototype.create,ar.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,q({type:"label",di:n},Dr,t))}return this.createElement(e,t)},ar.prototype.createElement=function(e,t){t=q({},t||{});var n,i=t.businessObject,o=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!CD(o)){var r=q({},o||{},{id:i.id+"_di"});e==="root"?o=this._bpmnFactory.createDiPlane(i,r):e==="connection"?o=this._bpmnFactory.createDiEdge(i,r):o=this._bpmnFactory.createDiShape(i,r)}A(i,"bpmn:Group")&&(t=q({isFrame:!0},t)),t=RD(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=fh(o,t,"isExpanded")),it(i,["bpmn:Lane","bpmn:Participant"])&&(t=fh(o,t,"isHorizontal")),A(i,"bpmn:SubProcess")&&(t.collapsed=!ut(i,o)),A(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=q({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},ar.prototype.getDefaultSize=function(e,t){var n=ge(e);if(t=t||dt(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}},ar.prototype.createParticipantShape=function(e){return hn(e)||(e={isExpanded:e}),e=q({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function RD(e,t,n){return z(n,function(i){t=fh(e,t,i)}),t}function fh(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Yi(t,[n]))}function CD(e){return it(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function ru(e,t){this._modeling=e,this._canvas=t}ru.$inject=["modeling","canvas"],ru.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;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)})},ru.prototype.postExecute=function(e){};function au(e){this._modeling=e}au.$inject=["modeling"],au.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},au.prototype.postExecute=function(e){var t=e.hints||{};MD(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 MD(e,t){return No(e.outgoing,function(n){return n.target===t})}function su(e,t){this._canvas=e,this._layouter=t}su.$inject=["canvas","layouter"],su.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},su.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var cu=Math.round;function dh(e){this._modeling=e}dh.$inject=["modeling"],dh.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=on(s);z(t,function(p){Tt(p)&&(p.waypoints=Nn(p.waypoints,function(f){return{x:cu(f.x-c.x-c.width/2+o.x),y:cu(f.y-c.y-c.height/2+o.y)}})),q(p,{x:cu(p.x-c.x-c.width/2+o.x),y:cu(p.y-c.y-c.height/2+o.y)})});var l=new Set(ul(t)),u={};z(t,function(p){if(Tt(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=q({},r);l.has(p)||(f.autoResize=!1),nt(p)&&(f=Yi(f,["attach"])),u[p.id]=Ue(i)?a.createShape(p,Ni(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Ni(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=oa(u)};var gw=Math.round;function sr(e){this._canvas=e}sr.$inject=["canvas"],sr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,o=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?q(t,n):q(t,{x:n.x-gw(t.width/2),y:n.y-gw(t.height/2)}),this._canvas.addShape(t,i,o),t},sr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function zs(e){sr.call(this,e)}Le(zs,sr),zs.$inject=["canvas"];var AD=sr.prototype.execute;zs.prototype.execute=function(e){var t=e.shape;return TD(t),t.labelTarget=e.labelTarget,AD.call(this,e)};var PD=sr.prototype.revert;zs.prototype.revert=function(e){return e.shape.labelTarget=null,PD.call(this,e)};function TD(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Gs(e,t){this._canvas=e,this._modeling=t}Gs.$inject=["canvas","modeling"],Gs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;rr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),rr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Gs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Hf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Gs.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,en(n.children,t,i),this._canvas.addConnection(t,n),t};function hh(e,t){this._modeling=e,this._elementRegistry=t}hh.$inject=["modeling","elementRegistry"],hh.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 Vs(e,t){this._canvas=e,this._modeling=t}Vs.$inject=["canvas","modeling"],Vs.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;rr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),rr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),rr(n.children,function(i){Tt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Vs.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Hf(i.children,n),t.removeShape(n),n},Vs.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 lu(e){this._modeling=e}lu.$inject=["modeling"];var mw={x:"y",y:"x"};lu.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(m,w){m.range.min=Math.min(w[i],m.range.min),m.range.max=Math.max(w[i]+w[o],m.range.max)}function a(m){return m[i]+m[o]/2}function s(m){return m.length-1}function c(m){return m.max-m.min}function l(m,w){var y={y:0};y[i]=m-a(w),y[i]&&(y[mw[i]]=0,t.moveElements([w],y,w.parent))}var u=n[0],p=s(n),f=n[p],d,g,h=0;z(n,function(m,w){var y,v,x;if(m.elements.length<2){w&&w!==n.length-1&&(r(m,m.elements[0]),h+=c(m.range));return}y=qi(m.elements,i),v=y[0],w===p&&(v=y[s(y)]),x=a(v),m.range=null,z(y,function(E){if(l(x,E),m.range===null){m.range={min:E[i],max:E[i]+E[o]};return}r(m,E)}),w&&w!==n.length-1&&(h+=c(m.range))}),g=Math.abs(f.range.min-u.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&z(n,function(m,w){var y={},v;m===u||m===f||(v=n[w-1],m.range.max=0,z(m.elements,function(x,E){y[mw[i]]=0,y[i]=v.range.max-x[i]+d,m.range.min!==x[i]&&(y[i]+=x[i]-m.range.min),y[i]&&t.moveElements([x],y,x.parent),m.range.max=Math.max(x[i]+x[o],E?m.range.max:0)}))})},lu.prototype.postExecute=function(e){};function uu(e,t){this._layouter=e,this._canvas=t}uu.$inject=["layouter","canvas"],uu.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return q(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},uu.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function gh(){}gh.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,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},gh.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,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 mh(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}mh.prototype.add=function(e,t){return this.addAll([e],t)},mh.prototype.addAll=function(e,t){var n=aP(e,!!t,this);return q(this,n),this};function Ws(e){this._modeling=e}Ws.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ws.prototype.moveClosure=function(e,t,n,i,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&&Ed(p,p.source,t),connectionEnd:d&&Sd(p,p.target,t)})})},Ws.prototype.getClosure=function(e){return new mh().addAll(e,!0)};function pu(e){this._helper=new Ws(e)}pu.$inject=["modeling"],pu.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},pu.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 jr(e){this._modeling=e,this._helper=new Ws(e)}jr.$inject=["modeling"],jr.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=Ni(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=Jt(r.children,t),en(i.children,t,o),q(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},jr.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:Sd(r,t,n)})}),z(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:Ed(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},jr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return en(n.children,t,i),q(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},jr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},jr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Us(e){this._modeling=e}Us.$inject=["modeling"],Us.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},Us.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||yw(We(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||yw(We(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},Us.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 yw(e){return e.original||e}function Co(e,t){this._modeling=e,this._rules=t}Co.$inject=["modeling","rules"],Co.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,$l(g,s,u),a)}),z(d,function(g){var h=g.target,m=c(s,h,g);m&&t.reconnectStart(g,s,Nl(g,s,u),a)})},Co.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Co.prototype.execute=function(e){},Co.prototype.revert=function(e){},Co.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Co.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Co.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function qs(e){this._modeling=e}qs.$inject=["modeling"],qs.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},q(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},qs.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:$l(r,n,i)})}),z(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:Nl(r,n,i)})}))},qs.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return q(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function cr(e){this._modeling=e}cr.$inject=["modeling"],cr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,o=e.resizingShapes,r=e.start,a={};this.moveShapes(i,t),z(o,function(s){a[s.id]=OD(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(rD(i,o),t,n,r,i,o,a)},cr.prototype.execute=function(){},cr.prototype.revert=function(){},cr.prototype.moveShapes=function(e,t){var n=this;z(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},cr.prototype.resizeShapes=function(e,t,n){var i=this;z(e,function(o){var r=aD(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},cr.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);z(e,function(u){var p=u.source,f=u.target,d=kD(u),g=bw(n),h={},m=c.has(p)||l.has(p),w=c.has(f)||l.has(f);m&&w?(d=Nn(d,function(y){return xw(y,i,n)&&(y[g]=y[g]+t[g]),y.original&&xw(y.original,i,n)&&(y.original[g]=y.original[g]+t[g]),y}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(m||w)&&(c.has(p)?h.connectionStart=Ed(u,p,t):c.has(f)?h.connectionEnd=Sd(u,f,t):l.has(p)?h.connectionStart=Nl(u,p,a[p.id]):l.has(f)&&(h.connectionEnd=$l(u,f,a[f.id])),s._modeling.layoutConnection(u,h))})};function vw(e){return q({},e)}function kD(e){return Nn(e.waypoints,function(t){return t=vw(t),t.original&&(t.original=vw(t.original)),t})}function bw(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function xw(e,t,n){var i=bw(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function OD(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function fu(e){this._modeling=e}fu.$inject=["modeling"],fu.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=ww(n),t.collapsed=!t.collapsed;var i=_w(n,t.collapsed);return[t].concat(i)},fu.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=Ew(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function ww(e){var t={};return z(e,function(n){t[n.id]=n.hidden,n.children&&(t=q({},t,ww(n.children)))}),t}function _w(e,t){var n=[];return z(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(_w(i.children,i.collapsed||t)))}),n}function Ew(e,t){var n=[];return z(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Ew(i.children,t)))}),n}function du(e){this._modeling=e}du.$inject=["modeling"],du.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Sw(i,t),Rw(n,t),t.host=n,t},du.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,Sw(n,t),Rw(i,t,o),t};function Sw(e,t){return Jt(e&&e.attachers,t)}function Rw(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),en(i,t,n)}}function yh(){}yh.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},yh.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function kt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}kt.$inject=["eventBus","elementFactory","commandStack"],kt.prototype.getHandlers=function(){return{"shape.append":au,"shape.create":sr,"shape.delete":Vs,"shape.move":jr,"shape.resize":qs,"shape.replace":Co,"shape.toggleCollapse":fu,spaceTool:cr,"label.create":zs,"connection.create":su,"connection.delete":Gs,"connection.move":gh,"connection.layout":uu,"connection.updateWaypoints":yh,"connection.reconnect":Us,"elements.create":dh,"elements.move":pu,"elements.delete":hh,"elements.distribute":lu,"elements.align":ru,"element.updateAttachment":du}},kt.prototype.registerHandlers=function(e){z(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},kt.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)},kt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},kt.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)},kt.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)},kt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},kt.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},kt.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},kt.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},kt.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},kt.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},kt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},kt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},kt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},kt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},kt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},kt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},kt.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},kt.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)},kt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},kt.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)},kt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,q(i,{docking:"source"}))},kt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,q(i,{docking:"target"}))},kt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},kt.prototype._create=function(e,t){return WP(t)?t:this._elementFactory.create(e,t)},kt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ys(e){this._elementRegistry=e}Ys.$inject=["elementRegistry"],Ys.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||DD(n,Ac(i));return Cw(n,i),e.oldProperties=r,e.changed=o,o},Ys.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Cw(n,t),i},Ys.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return A(e,"bpmn:DataObject")?LD(e,t):[]};function DD(e,t){return ti(t,function(n,i){return n[i]=e.get(i),n},{})}function Cw(e,t){z(t,function(n,i){e.set(i,n)})}function LD(e,t){return t.filter(function(n){return A(n,"bpmn:DataObjectReference")&&ge(n).dataObjectRef===e})}var Ks="default",Mo="id",Mw="di",ID={width:0,height:0};function Xs(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Xs.$inject=["elementRegistry","moddle","modeling","textRenderer"],Xs.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=jD(e.properties),s=e.oldProperties||BD(t,a);return Aw(a,r)&&(o.unclaim(r[Mo]),i.updateId(t,a[Mo]),o.claim(a[Mo],r)),Ks in a&&(a[Ks]&&n.push(i.get(a[Ks].id)),r[Ks]&&n.push(i.get(r[Ks].id))),Pw(t,a),e.oldProperties=s,e.changed=n,n},Xs.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,ID)}},Xs.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 Pw(t,i),Aw(n,o)&&(a.unclaim(n[Mo]),r.updateId(t,i[Mo]),a.claim(i[Mo],o)),e.changed};function Aw(e,t){return Mo in e&&e[Mo]!==t[Mo]}function BD(e,t){var n=Ac(t),i=e.businessObject,o=dt(e);return ti(n,function(r,a){return a!==Mw?r[a]=i.get(a):r[a]=ND(o,Ac(t.di)),r},{})}function ND(e,t){return ti(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Pw(e,t){var n=e.businessObject,i=dt(e);z(t,function(o,r){r!==Mw?n.set(r,o):i&&$D(i,o)})}function $D(e,t){z(t,function(n,i){e.set(i,n)})}var FD=["default"];function jD(e){var t=q({},e);return FD.forEach(function(n){n in e&&(t[n]=ge(t[n]))}),t}function hu(e,t){this._canvas=e,this._modeling=t}hu.$inject=["canvas","modeling"],hu.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),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,[]},hu.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),Jt(a.rootElements,i),i.$parent=null,en(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function vh(e,t){this._modeling=e,this._spaceTool=t}vh.$inject=["modeling","spaceTool"],vh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,o=e.location,r=Ri(i),a=r===i,s=a?i:i.parent,c=er(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+Si,y:i.y,width:i.width-Si,height:i.height}:{x:i.x,y:i.y+Si,width:i.width,height:i.height-Si};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];Or(r,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:rt(x.children,function(E){return E!==i})});var f,d,g,h,m;o==="top"?(f=-120,d=i.y,g=d+10,h="n",m="y"):o==="left"?(f=-120,d=i.x,g=d+10,h="w",m="x"):o==="bottom"?(f=120,d=i.y+i.height,g=d-10,h="s",m="y"):o==="right"&&(f=120,d=i.x+i.width,g=d-10,h="e",m="x");var w=t.calculateAdjustments(p,m,f,g),y=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(w.movingShapes,w.resizingShapes,y,h,g);var v=l?{x:i.x+(a?Si:0),y:d-(o==="top"?120:0),width:i.width-(a?Si:0),height:120}:{x:d-(o==="left"?120:0),y:i.y+(a?Si:0),width:120,height:i.height-(a?Si:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},v,s)};function bh(e){this._modeling=e}bh.$inject=["modeling"],bh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=er(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=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+Si,y:n.y+f*c,width:n.width-Si,height:l}:{x:n.x+f*c,y:n.y+Si,width:l,height:n.height-Si},f<r?t.resizeShape(o[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function Zs(e,t){this._modeling=e,this._spaceTool=t}Zs.$inject=["modeling","spaceTool"],Zs.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Zs.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=Lk(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},Zs.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ze(e),o=ze(t),r=sb(o,i),a=Ri(e),s=[],c=[];Or(a,function(g){return s.push(g),(A(g,"bpmn:Lane")||A(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 Qs="flowNodeRef",xh="lanes";function gu(){}gu.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=Ri(u);return o[p.id]||(o[p.id]=Ol(p)),o[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(f){return a(u,f)}).map(function(f){return f.businessObject})}return t.forEach(function(u){var p=Ri(u);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return A(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),r.forEach(function(u){var p=u.businessObject,f=p.get(xh),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(Qs).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},gu.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(xh);n.remove.forEach(function(r){Jt(o,r),Jt(r.get(Qs),i)}),n.add.forEach(function(r){en(o,r),en(r.get(Qs),i)})}),[]},gu.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get(xh);n.add.forEach(function(r){Jt(o,r),Jt(r.get(Qs),i)}),n.remove.forEach(function(r){en(o,r),en(r.get(Qs),i)})}),[]};var wh="categoryValueRef";function Js(e,t){this._bpmnFactory=e,this._elementRegistry=t}Js.$inject=["bpmnFactory","elementRegistry"],Js.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(y,v,x){if(v){var E=a.get(y);E||(E={},a.set(y,E)),!(x&&E.present)&&(!x&&E.past||(x?E.present={categoryValue:v,root:_h(y)}:E.past={categoryValue:v}))}}function c(y){o.set(y,ge(y))}function l(){n.filter(function(y){return A(y,"bpmn:FlowElement")&&!nt(y)&&y.parent}).forEach(c)}function u(y){var v=ge(y),x=v.get("categoryValueRef");return x||(x=nb(i,v),r.push(HD(y,x))),x}function p(y){return y.reduce(function(v,x){var E=_h(x),M=v.get(E);return M||(M=[],v.set(E,M)),M.push(x),v},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(y){return A(y,"bpmn:Group")&&!nt(y)&&y.parent}).forEach(function(y){var v=ge(y).get("categoryValueRef");if(!v){var x=_h(y),E=f.get(x)||[],M=va(E,y),D=Object.keys(M).length>0;D&&(v=u(y))}s(y,v,!0)}),t.forEach(function(y){s(y.groupShape,y.categoryValue,!1)}),r.length&&l();var d=Array.from(o.keys()),g=Array.from(a.values()).reduce(function(y,v){return v.present&&y.add(v.present.categoryValue),v.past&&y.add(v.past.categoryValue),y},new Set),h=new Map,m=p(d);a.forEach(function(y,v){var x=y.present;if(x){var E=m.get(x.root)||[],M=va(E,v);E.forEach(function(D){if(M[D.id]){var P=h.get(D);P||(P=new Set,h.set(D,P)),P.add(x.categoryValue)}})}});var w=d.reduce(function(y,v){var x=o.get(v),E=x.get(wh),M=new Set(E),D=h.get(v)||new Set,P=Array.from(D).filter(function(N){return!M.has(N)}),T=E.filter(function(N){return g.has(N)&&!D.has(N)});return(P.length||T.length)&&y.push({businessObject:x,categoryValuesToAdd:P,categoryValuesToRemove:T}),y},[]);return{flowElements:w,groups:r}},Js.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),zD(t.groups),VD(t.flowElements),[]},Js.prototype.revert=function(e){var t=e.updates;return WD(t.flowElements),GD(t.groups),[]};function HD(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function zD(e){e.forEach(function(t){ge(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function GD(e){e.forEach(function(t){ge(t.groupShape).categoryValueRef=null})}function VD(e){e.forEach(function(t){var n=t.businessObject,i=n.get(wh);t.categoryValuesToRemove.forEach(function(o){Jt(i,o)}),t.categoryValuesToAdd.forEach(function(o){en(i,o,!0)})})}function WD(e){e.forEach(function(t){var n=t.businessObject,i=n.get(wh);t.categoryValuesToAdd.forEach(function(o){Jt(i,o)}),t.categoryValuesToRemove.forEach(function(o){en(i,o,!0)})})}function _h(e){for(;e.parent;)e=e.parent;return e}function mu(e){this._moddle=e}mu.$inject=["moddle"],mu.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),[]},mu.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 UD={fill:void 0,stroke:void 0};function Eh(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Jn(t)){var n=qD(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Eh.$inject=["commandStack"],Eh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||UD,i=this,o={};"fill"in n&&q(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&q(o,{"border-color":this._normalizeColor(n.stroke)}),z(t,function(r){var a=Tt(r)?Ni(o,["border-color"]):o,s=dt(r);if(YD(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 qD(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 YD(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var KD={width:0,height:0};function Tw(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return ET(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!nt(l)&&Qo(l)&&!bl(l)&&!kw(p)){var f=7,d=qf(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)&&kw(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var g=mi(l);typeof f>"u"&&(f=t.getExternalLabelBounds(u,g)),f&&e.resizeShape(u,f,KD)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}Tw.$inject=["modeling","textRenderer","bpmnFactory"];function kw(e){return!e||!e.trim()}function Dn(e,t,n,i){kt.call(this,e,t,n),this._bpmnRules=i}Le(Dn,kt),Dn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Dn.prototype.getHandlers=function(){var e=kt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ys,e["element.updateProperties"]=Xs,e["canvas.updateRoot"]=hu,e["lane.add"]=vh,e["lane.resize"]=Zs,e["lane.split"]=bh,e["lane.updateRefs"]=gu,e["group.updateRefs"]=Js,e["id.updateClaim"]=mu,e["element.setColor"]=Eh,e["element.updateLabel"]=Tw,e},Dn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Dn.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)},Dn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Dn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Dn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Dn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Dn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Dn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Dn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Dn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Dn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Dn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Dn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Dn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Ow(){}Ow.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||qe(t.source||e.source),t.connectionEnd||qe(t.target||e.target)]};var yu=20,XD=5,vu=Math.round,Dw=20,ZD={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function QD(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function JD(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Lw(e,t,n){var i=Tn(t,e,XD),o=n.split(":")[0],r=vu((t.x-e.x)/2+e.x),a=vu((t.y-e.y)/2+e.y),s,c,l=JD(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=QD(i,o),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+yu*(/l/.test(o)?-1:1),y:f?a+yu:a}):(f=r===e.x,s={x:f?r+yu:r,y:e.y+yu*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:Sh(e,s,c).concat(s),directions:c,turnNextDirections:f}}function eL(e,t,n){return Lw(e,t,n)}function tL(e,t,n){var i=Lw(t,e,Iw(n));return{waypoints:i.waypoints.slice().reverse(),directions:Iw(i.directions),turnNextDirections:i.turnNextDirections}}function nL(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=Sh(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function Iw(e){return e.split(":").reverse().join(":")}function iL(e,t,n){var i=vu((t.x-e.x)/2+e.x),o=vu((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 Sh(e,t,n){if(n=n||"h:h",!fL(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Nw(n)){var i=eL(e,t,n),o=tL(e,t,n),r=nL(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return iL(e,t,n)}function oL(e,t,n){var i=Sh(e,t,n);return i.unshift(e),i.push(t),Fw(i)}function rL(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=xS(r,"straight")[0]||"h:h",s=ZD[a]||0,c=Tn(e,t,s),l=pL(c,a);n=n||qe(e),i=i||qe(t);var u=l.split(":"),p=$w(n,e,u[0],dL(c)),f=$w(i,t,u[1],c);return oL(p,f,l)}function aL(e,t,n,i,o,r){We(n)&&(o=n,r=i,n=qe(e),i=qe(t)),r=q({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&cL(e,t,n,i,r),c||(c=r.connectionEnd&&uL(t,e,i,o),c)||(c=r.connectionStart&&lL(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:rL(e,t,n,i,r)}function sL(e,t,n){return e>=t&&e<=n}function Bw(e,t,n){var i={x:"width",y:"height"};return sL(t[e],n[e],n[e]+n[i[e]])}function cL(e,t,n,i,o){var r={},a,s;return s=Tn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),o.preserveDocking==="target"?Bw(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:Bw(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 lL(e,t,n,i){return Rh(e,t,n,i)}function uL(e,t,n,i){var o=i.slice().reverse();return o=Rh(e,t,n,o),o?o.reverse():null}function Rh(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&&Es(p,d)<3})}function r(u,p,f){var d=vo(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(cv(u[d],p,Dw)||cv(u[d],f,Dw))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=Rh(e,t,n,l)),c&&vo(c)?null:c}function pL(e,t){if(Nw(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 fL(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Nw(e){return e&&/t|r|b|l/.test(e)}function dL(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 $w(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 Fw(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return zf(o,r,n,0)||t.push(n),t},[])}var hL=-10,gL=40,mL={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},yL={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},Ch={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},ec={top:"t",right:"r",bottom:"b",left:"l"};function bu(e){this._elementRegistry=e}Le(bu,Ow),bu.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=jw(o&&o[0],n)),a||(a=jw(o&&o[o.length-1],i)),(A(e,"bpmn:Association")||A(e,"bpmn:DataAssociation"))&&o&&!Hw(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=Qv(n,s)?mL:yL;return A(e,"bpmn:MessageFlow")?c=bL(n,i,u):(A(e,"bpmn:SequenceFlow")||Hw(n,i))&&(n===i?c={preferredLayouts:RL(n,e,u)}:A(n,"bpmn:BoundaryEvent")?c={preferredLayouts:CL(n,i,a,u)}:tc(n)||tc(i)?c={preferredLayouts:u.subProcess,preserveDocking:wL(n)}:A(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:A(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=q(c,t),l=Fw(aL(n,i,r,a,o,c))),l||[r,a]};function vL(e){var t=e.host;return Tn(qe(e),t,hL)}function bL(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:xL(e,t)}}function xL(e,t){return A(t,"bpmn:Participant")?"source":A(e,"bpmn:Participant")?"target":tc(t)?"source":tc(e)||A(t,"bpmn:Event")?"target":A(e,"bpmn:Event")?"source":null}function wL(e){return tc(e)?"target":"source"}function jw(e,t){return e?e.original||e:qe(t)}function Hw(e,t){return A(t,"bpmn:Activity")&&A(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function tc(e){return A(e,"bpmn:SubProcess")&&ut(e)}function Hr(e,t){return e===t}function _L(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 zw(e,t){return Ch[e]===t}function EL(e,t){var n=Ba(e),i=Ch[n];return t.indexOf(i)!==-1}function SL(e,t){var n=Na(e),i=Ch[n];return t.indexOf(i)!==-1}function Gw(e){return e==="right"||e==="left"}function RL(e,t,n){var i=t.waypoints,o=i&&i.length&&Tn(i[0],e);return o==="top"?n.loop.fromTop:o==="right"?n.loop.fromRight:o==="left"?n.loop.fromLeft:n.loop.fromBottom}function CL(e,t,n,i){var o=qe(e),r=qe(t),a=vL(e),s,c,l=Hr(e.host,t),u=_L(a,["top","right","bottom","left"]),p=Tn(r,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?ML(a,u,e,t,n,i):(s=AL(a,p,u,i.isHorizontal),c=PL(a,p,u,i.isHorizontal),[s+":"+c])}function ML(e,t,n,i,o,r){var a=t?e:r.isHorizontal?Na(e):Ba(e),s=ec[a],c;return t?Gw(e)?c=Vw("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=Vw("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function Vw(e,t,n,i){var o=gL;return!(Mh(e,i,n,o)||Mh(e,i,{x:n.x+n.width,y:n.y+n.height},o)||Mh(e,i,qe(t),o))}function Mh(e,t,n,i){return Math.abs(t[e]-n[e])<i}function AL(e,t,n,i){if(n)return ec[e];var o=Na(e),r=Ba(e),a=Na(t),s=Ba(t);if(i){if(Hr(o,a)||zw(r,s))return ec[o]}else if(Hr(r,s)||zw(o,a))return ec[r];return ec[i?r:o]}function PL(e,t,n,i){if(n)return Gw(e)?EL(e,t)||Hr(e,t)?"h":"v":SL(e,t)||Hr(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?Hr(o,a)?"h":"v":Hr(r,s)?"v":"h"}bu.$inject=["elementRegistry"];function Ww(e){return q({original:e.point.original||e.point},e.actual)}function lr(e,t){this._elementRegistry=e,this._graphicsFactory=t}lr.$inject=["elementRegistry","graphicsFactory"],lr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),o=this.getDockingPoint(e,n),r=e.waypoints.slice(i.idx+1,o.idx);return r.unshift(Ww(i)),r.push(Ww(o)),r},lr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,o,r,a;return o=n?0:i.length-1,r=i[o],a=this._getIntersection(t,e,n),{point:r,actual:a||r,idx:o}},lr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return Ss(i,o,n)},lr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},lr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},lr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Ah={__init__:["modeling","bpmnUpdater"],__depends__:[Y2,uO,fO,dO,iw,hD,mD,_D,Mi,ph,lw],bpmnFactory:["type",Pi],bpmnUpdater:["type",si],elementFactory:["type",ar],modeling:["type",Dn],layouter:["type",bu],connectionDocking:["type",lr]};var TL=10,Uw=50,kL=250;function Ph(e,t,n,i){for(var o;o=OL(e,n,t);)n=i(t,n,o);return n}function Th(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 OL(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=LL(e);return Lt(o,function(r){if(r===n)return!1;var a=Tn(r,i,TL);return a==="intersect"})}function DL(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||Uw,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||kL,c=t.reference||"start";r||(r=NL);function l(g,h){return o==="n"?c==="start"?ze(g).top-ze(h).bottom:c==="center"?ze(g).top-qe(h).y:ze(g).top-ze(h).top:o==="w"?c==="start"?ze(g).left-ze(h).right:c==="center"?ze(g).left-qe(h).x:ze(g).left-ze(h).left:o==="s"?c==="start"?ze(h).top-ze(g).bottom:c==="center"?qe(h).y-ze(g).bottom:ze(h).bottom-ze(g).bottom:c==="start"?ze(h).left-ze(g).right:c==="center"?qe(h).x-ze(g).right:ze(h).right-ze(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,w=h.weight;return m<0||m>s||(g[String(m)]||(g[String(m)]=0),g[String(m)]+=1*w,(!g.distance||g[g.distance]<g[String(m)])&&(g.distance=m)),g},{});return d.distance||i}function LL(e){var t=kh(e);return e.host&&(t=t.concat(kh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(kh(i))},[]))),t}function kh(e){return BL(e).concat(IL(e))}function IL(e){return e.incoming.map(function(t){return t.source})}function BL(e){return e.outgoing.map(function(t){return t.target})}function NL(){return!0}var $L=100;function qw(e,t,n){e.on("autoPlace",$L,function(i){var o=i.shape,r=i.source;return FL(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}}qw.$inject=["eventBus","modeling","canvas"];function FL(e,t,n){n||(n={});var i=n.defaultDistance||Uw,o=qe(e),r=ze(e);return{x:r.right+i+t.width/2,y:o.y}}function Yw(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Yw.$inject=["eventBus","selection"];const jL={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",qw],autoPlaceSelectionBehavior:["type",Yw]};function Kw(e,t,n){var i=Qv(e,n);if(A(t,"bpmn:TextAnnotation"))return zL(e,t,i);if(it(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return GL(e,t,i);if(A(t,"bpmn:FlowNode"))return HL(e,t,i)}function HL(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=DL(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=Tn(e,e.host,-25),l.indexOf(r.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:o.y+Xw(l,c,r)}:{x:o.x+Xw(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Ph(e,t,u,Th(f))}function Xw(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function zL(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};Tt(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 Ph(e,t,o,Th(a))}function GL(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 Ph(e,t,o,Th(a))}function Zw(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return Kw(o,i,t)})}Zw.$inject=["eventBus","elementRegistry"];const xu={__depends__:[jL],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Zw]},VL=1500;class Qw{constructor(t){t.on("moddleCopy.canCopyProperties",VL,({sourceElement:n,targetElement:i})=>{var r;if(!((r=n==null?void 0:n.$instanceOf)!=null&&r.call(n,Sr)))return;const o=Sn(n);o!==void 0&&i.set("xml:lang",o)})}}Bn(Qw,"$inject",["eventBus"]);const Jw={__init__:["translationLocaleCopy"],translationLocaleCopy:["type",Qw]},WL=500,wu=1,e_=(e,t)=>{if((e==null?void 0:e.type)!=="bpmn:TextAnnotation"||!(t!=null&&t.original))return;const{x:n,y:i}=t.original;(n<e.x-wu||n>e.x+e.width+wu||i<e.y-wu||i>e.y+e.height+wu)&&(t.original={x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)})};class t_{constructor(t){t.on("bpmnElement.added",WL,({element:n})=>{if((n==null?void 0:n.type)!=="bpmn:Association")return;const i=n.waypoints;!i||i.length<2||(e_(n.source,i[0]),e_(n.target,i[i.length-1]))})}}Bn(t_,"$inject",["eventBus"]);const n_={__init__:["annotationImportDocking"],annotationImportDocking:["type",t_]},i_=[Xv,Ts,Ah,xu,Fp,Jw,n_];function UL(e={}){gm(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new wa({container:t,moddleExtensions:e.moddleExtensions??Bc,additionalModules:[...i_,...e.additionalModules??[]]})}const o_={"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":"풀"},qL={이:["이","가"],을:["을","를"],와:["과","와"]};function YL(e,t){const[n,i]=qL[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 KL={"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":"연관선"},XL="요소";function Oh(e){return(e&&KL[e.type])??XL}const r_=20;function ZL(e){const t=e.replace(/\s+/g," ").trim();return t.length>r_?`${t.slice(0,r_)}…`:t}function _u(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+Oh(o):r,s=r===void 0?a:`「${r}」`;return n?s+YL(a,n).slice(a.length):s}function QL(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&&Oh(r)===Oh(a);return[_u(e,t,i),_u(e,n,o,s?"다른 ":"")]}function JL(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 eI(e){switch(e.kind){case"edge-crosses-shape":return[e.edge,e.shape];case"edge-crosses-subprocess":return[e.edge,e.subProcess];case"edge-endpoint-detached":return[e.edge,e.shape];case"shape-overlap":return[...e.shapes];case"shape-outside-container":return[e.shape,e.container];case"edge-overlap-opposite":case"edge-overlap-mixed":case"edge-overlap-unrelated":return[...e.edges];case"label-on-shared-segment":return[e.edge,e.other];case"label-over-line":return[e.edge,e.line];case"label-over-shape":return[e.edge,e.shape];case"annotation-over-label":return[e.annotation,e.label];case"group-overlap-unintended":return e.container?[e.container,...e.groups.filter(t=>t!==e.container)]:[...e.groups];case"group-overlap-unreadable":return e.reason==="orphan"?[...e.groups,...e.shapes]:[e.group,...e.shapes];case"group-stack-unreadable":return[...e.groups,...e.shapes];case"group-on-container-boundary":return[e.group,e.container];case"group-on-group-boundary":return[...e.groups];case"group-cuts-shape":return[e.group,e.shape];case"edge-along-group-boundary":return[e.edge,e.group];case"pool-name-over-label":return[e.pool,e.label];case"pool-overlap":return[...e.pools]}}const Eu={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function tI(e,t){const n=(o,r)=>_u(t,o,r),i=(o,r,a,s)=>QL(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)}의 ${Eu[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)}의 ${Eu[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${Eu[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${Eu[e.side]} 테두리 ${e.inside?"안쪽":"바깥쪽"} ${e.distance}px 에 ${e.length}px 나란히 흘러 테두리와 구분되지 않습니다.`;case"pool-name-over-label":return`${n(e.pool)}의 이름 밴드가 ${n(e.label)}의 라벨을 덮습니다.`;case"pool-overlap":{const[o,r]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${o} ${r} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${o} ${r} 겹칩니다.`}}}function nI(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${_u(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const a_="기타",Dh={error:0,warning:1,info:2};function s_(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${ct(i)}`,source:"geometry",code:i.kind,severity:JL(i),targetRefs:eI(i),category:o_[i.kind]??a_,message:tI(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:o_[i.ruleId]??a_,message:nI(i,t)});return n}function c_(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 Lh(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 l_(e,t){const n=Lh(e,t);return e.slice().sort((i,o)=>(n?Number($a(o,t))-Number($a(i,t)):0)||Dh[i.severity]-Dh[o.severity])}const u_="i18n-untranslated",p_="i18n-review-requested",Ih="i18nDisplay.redrawn",f_=[["untranslated",u_],["reviewRequested",p_]];class Bh{constructor(t,n,i,o,r,a,s,c){Bn(this,"config");Bn(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(Tc,{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(Tc,{element:d.labelTarget??d,locale:this.displayLocale,text:g??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:h??""})})}configure(t){!t&&!this.config||(this.config=t,this.displayLocale=t==null?void 0:t.designLocale,this.rerenderAll())}locales(){if(!this.config)return[];const{designLocale:t,companionLocales:n}=this.config;return[t,...n.filter(i=>i!==t)]}setDisplayLocale(t){if(this.config)return this.displayLocale=this.locales().includes(t)?t:this.config.designLocale,this.rerenderAll(),this.displayLocale}getDisplayLocale(){return this.displayLocale}rootLang(){var i,o,r;const t=(i=this.canvas.getRootElement())==null?void 0:i.businessObject,n=(t==null?void 0:t.$parent)??t;return((o=n==null?void 0:n.get)==null?void 0:o.call(n,"xml:lang"))??((r=n==null?void 0:n.$attrs)==null?void 0:r["xml:lang"])}resolve(t){if(!this.config||!this.displayLocale)return;const n=(t.labelTarget??t).businessObject,i=Rr(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=$o(n).filter(f=>Sn(f)),s=f=>f.body??"",c=a.find(f=>Sn(f)===o&&s(f)),l=Fo(n).some(f=>f.locale===o)?"reviewRequested":"ok";if(!r)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(f=>s(f)===r).map(Sn);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 f_)r.toggle(g,(o==null?void 0:o.status)===d);if(!o||o.native)return n();const{target:a,key:s}=Rr((t.labelTarget??t).businessObject),c=Object.prototype.hasOwnProperty.call(a,s),l=a[s];if(l===o.text)return n();a[s]=o.text;const u=this.config.adaptiveExternalLabel??!0,p=t.type==="label"&&u?this.widen(t,o.text):void 0;try{const d=n();return p&&(d!=null&&d.setAttribute)&&d.setAttribute("transform",`translate(${p.dx}, 0)`),d}finally{c?a[s]=l:delete a[s],p==null||p.restore()}}widen(t,n){const{width:i,height:o}=t,r=this.textRenderer.getExternalLabelBounds(t,n);return t.width=r.width,t.height=r.height,{dx:(i-r.width)/2,restore:()=>(t.width=i,t.height=o)}}rerenderAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);if(i){if(!this.config)for(const[,o]of f_)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(Ih)}}Bn(Bh,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const d_={__depends__:[Fp],__init__:["i18nDisplay"],i18nDisplay:["type",Bh]};var iI=new $r("ov"),oI=500;function Cn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=iI,this._overlayDefaults=q({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=rI(n.getContainer()),this._init()}Cn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Cn.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,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},Cn.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=q({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Cn.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&&(Zi(i.html),Zi(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)}})},Cn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Cn.prototype.show=function(){Su(this._overlayRoot)},Cn.prototype.hide=function(){Su(this._overlayRoot,!1)},Cn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],al(this._overlayRoot)},Cn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=on(t);i=r.x,o=r.y}h_(n,i,o),Rn(e.html,"data-container-id",t.id)},Cn.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=on(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=on(i).height:s=i.height,r=t.bottom*-1+s}h_(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Cn.prototype._createOverlayContainer=function(e){var t=$t('<div class="djs-overlays" />');Vn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Cn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";g_(this._overlayRoot,n)},Cn.prototype._getOverlayContainer=function(e,t){var n=Lt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Cn.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+'">'),Vn(o,{position:"absolute"}),o.appendChild(i),e.type&&Rt(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Su(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())},Cn.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),Su(a,c),this._updateOverlayScale(e,t)},Cn.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+")"),g_(r,s)},Cn.prototype._updateOverlaysVisibilty=function(e){var t=this;z(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Cn.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){Zi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",oI,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 rI(e){var t=$t('<div class="djs-overlay-container" />');return Vn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function h_(e,t,n){Vn(e,{left:t+"px",top:n+"px"})}function Su(e,t){e.style.display=t===!1?"none":""}function g_(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Ru={__init__:["overlays"],overlays:["type",Cn]};function Nh(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)})}Le(Nh,de),Nh.$inject=["canvas","injector"];const aI={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Nh]};function zr(e){return CSS.escape(e)}var sI={"&":"&","<":"<",">":">",'"':""","'":"'"};function m_(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return sI[t]})}var cI="bjs-breadcrumbs-shown";function y_(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=lI(c));var l=a.flatMap(function(p){var f=n.findRoot(no(p))||n.findRoot(p.id);if(!f&&A(p,"bpmn:Process")){var d=t.find(function(m){var w=ge(m);return w&&w.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=m_(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(cI,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}y_.$inject=["eventBus","elementRegistry","canvas"];function lI(e){for(var t=ge(e),n=[],i=t;i;i=i.$parent)(A(i,"bpmn:SubProcess")||A(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function v_(e,t){var n=null,i=new uI;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})}v_.$inject=["eventBus","canvas"];function uI(){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 b_={x:180,y:160};function Gr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}Gr.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)})}},Gr.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),fI(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},Gr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=pI(e),i={x:n.x-b_.x,y:n.y-b_.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)})},Gr.prototype._moveToDiPlane=function(e,t){var n=x_(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Gr.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},Gr.$inject=["eventBus","moddle"];function x_(e){return A(e,"bpmndi:BPMNDiagram")?e:x_(e.$parent)}function pI(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=ze(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),dl(t)}function fI(e,t){var n=e.$parent;return!(!A(n,"bpmn:SubProcess")||n===t.bpmnElement||it(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Cu=250,dI='<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>',hI="bjs-drilldown-empty";function ur(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",Cu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Cu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Cu,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"],Cu,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)})})}Le(ur,de),ur.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},ur.prototype._canDrillDown=function(e){var t=this._canvas;return A(e,"bpmn:SubProcess")&&t.findRoot(no(e))},ur.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(hI,!o)}},ur.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">'+dI+"</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(no(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},ur.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},ur.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const gI={__depends__:[Ru,ph,aI],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",y_],drilldownCentering:["type",v_],drilldownOverlayBehavior:["type",ur],subprocessCompatibility:["type",Gr]};function pr(e){Vt.call(this,e)}Le(pr,Vt),pr.prototype._modules=[Xv,gI,Ru,Mi,Ts],pr.prototype._moddleExtensions={};var Mu="keyboard.keydown",mI="keyboard.keyup",yI=1e3,w_="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function Wn(e,t){var n=this;this._config=e=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),e.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(w_));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Wn.$inject=["config.keyboard","eventBus"],Wn.prototype._keydownHandler=function(e){this._keyHandler(e,Mu)},Wn.prototype._keyupHandler=function(e){this._keyHandler(e,mI)},Wn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Mu,i),n&&e.preventDefault()}},Wn.prototype._isEventIgnored=function(e){return!1},Wn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(w_)),this.unbind(),e=this._node=this._target,je.bind(e,"keydown",this._keydownHandler),je.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Wn.prototype.getBinding=function(){return this._node},Wn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),je.unbind(e,"keydown",this._keydownHandler),je.unbind(e,"keyup",this._keyupHandler)),this._node=null},Wn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Wn.prototype.addListener=function(e,t,n){bn(e)&&(n=t,t=e,e=yI),this._eventBus.on(n||Mu,e,t)},Wn.prototype.removeListener=function(e,t){this._eventBus.off(t||Mu,e)},Wn.prototype.hasModifier=CO,Wn.prototype.isCmd=ri,Wn.prototype.isShift=eh,Wn.prototype.isKey=mn;var vI=500;function Fa(e,t){var n=this;e.on("editorActions.init",vI,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(kO(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(OO(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(MO(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(AO(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(PO(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(TO(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 $h={__init__:["keyboard","keyboardBindings"],keyboard:["type",Wn],keyboardBindings:["type",Fa]};var bI={moveSpeed:50,moveSpeedAccelerated:200};function __(e,t,n){var i=this;this._config=q({},bI,e||{}),t.addListener(o);function o(r){var a=r.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,l;switch(a.key){case"ArrowLeft":case"Left":l="left";break;case"ArrowUp":case"Up":l="up";break;case"ArrowRight":case"Right":l="right";break;case"ArrowDown":case"Down":l="down";break}return i.moveCanvas({speed:c,direction:l}),!0}}this.moveCanvas=function(r){var a=0,s=0,c=r.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(r.direction){case"left":a=l;break;case"up":s=l;break;case"right":a=-l;break;case"down":s=-l;break}n.scroll({dx:a,dy:s})}}__.$inject=["config.keyboardMove","keyboard","canvas"];const E_={__depends__:[$h],__init__:["keyboardMove"],keyboardMove:["type",__]};var xI=15;function S_(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=Ir(s),p=Gi(u,c);if(!n.dragging&&wI(p)>xI&&(n.dragging=!0,l===0&&Bx(e),Zl("grab")),n.dragging){var f=n.last||n.start;p=Gi(u,f),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){je.unbind(document,"mousemove",o),je.unbind(document,"mouseup",r),n=null,Ix()}function a(s){if(!Tr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Ir(s)},je.bind(document,"mousemove",o),je.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}S_.$inject=["eventBus","canvas"];function wI(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const R_={__init__:["moveCanvas"],moveCanvas:["type",S_]};function C_(e,t){var n=Zf(e.min),i=Zf(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function _I(e,t){return Math.max(e.min,Math.min(e.max,t))}var EI=Math.sign||function(e){return e>=0?1:-1},Fh={min:.2,max:4},M_=10,SI=.1,RI=.75;function ro(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Kn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||RI;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}ro.$inject=["config.zoomScroll","eventBus","canvas"],ro.prototype.scroll=function(t){this._canvas.scroll(t)},ro.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ro.prototype.zoom=function(t,n){var i=C_(Fh,M_*2);this._totalDelta+=t,Math.abs(this._totalDelta)>SI&&(this._zoom(t,n,i),this._totalDelta=0)},ro.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Gb()&&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))*EI(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)}},ro.prototype.stepZoom=function(t,n){var i=C_(Fh,M_);this._zoom(t,n,i)},ro.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=Zf(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(_I(Fh,s),t)},ro.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&je[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},ro.prototype._init=function(e){this.toggle(e)};const A_={__init__:["zoomScroll"],zoomScroll:["type",ro]};function nc(e){pr.call(this,e)}Le(nc,pr),nc.prototype._navigationModules=[E_,R_,A_],nc.prototype._modules=[].concat(pr.prototype._modules,nc.prototype._navigationModules);function jh(e){return e&&e[e.length-1]}function P_(e){return e.y}function T_(e){return e.x}var CI={left:T_,center:T_,right:function(e){return e.x+e.width},top:P_,middle:P_,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=jh(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=qi(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return r[e]=jh(c).center,r;l=t[0],t=qi(t,function(f){return f[i]+f[o]}),u=jh(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=CI[t],a=qi(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const MI={__init__:["alignElements"],alignElements:["type",ja]},AI=new $r;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=AI.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=PI();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 PI(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const TI={scheduler:["type",Ha]};var kI="djs-element-hidden",Au=".entry",OI=1e3,k_=8,DI=300;function an(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}an.$inject=["canvas","elementRegistry","eventBus","scheduler"],an.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()},an.prototype._createContainer=function(){var e=$t('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},an.prototype.registerProvider=function(e,t){t||(t=e,e=OI),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},an.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},an.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=Rn(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},DI);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},an.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()}}}},an.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))}},an.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},an.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;Rn(s,"data-action",r),c=Et("[data-group="+zr(a)+"]",n),c||(c=$t('<div class="group"></div>'),Rn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&LI(s,o.className),o.title&&Rn(s,"title",o.title),o.imageUrl&&(i=$t("<img>"),Rn(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})},an.prototype._createHtml=function(e){var t=this,n=$t('<div class="djs-context-pad"></div>');return ni.bind(n,Au,"click",function(i){t.trigger("click",i)}),ni.bind(n,Au,"dragstart",function(i){t.trigger("dragstart",i)}),ni.bind(n,Au,"mouseover",function(i){t.trigger("mouseover",i)}),ni.bind(n,Au,"mouseout",function(i){t.trigger("mouseout",i)}),je.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},an.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()&&BI(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},an.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},an.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&&Bo(e,function(i){return n.includes(i)}):n===e},an.prototype.isShown=function(){return this.isOpen()&&Rt(this._current.html).has("open")},an.prototype.show=function(){this.isOpen()&&(Rt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},an.prototype.hide=function(){this.isOpen()&&(Rt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},an.prototype._getPosition=function(e){if(!We(e)&&Tt(e)){var t=this._canvas.viewbox(),n=II(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+k_*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+k_*this._canvas.zoom(),top:s.top-a.top}},an.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")},an.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,kI)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},an.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 LI(e,t){var n=Rt(e);t=We(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function II(e){return e.waypoints[e.waypoints.length-1]}function BI(e,t){return e=We(e)?e:[e],t=We(t)?t:[t],e.length===t.length&&Bo(e,function(n){return t.includes(n)})}const O_={__depends__:[Xl,TI,Ru],contextPad:["type",an]};var Pu,Ut,D_,fr,L_,I_,B_,Hh,Tu,ic,N_,zh,Gh,Vh,ku={},Ou=[],NI=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Du=Array.isArray;function Ao(e,t){for(var n in t)e[n]=t[n];return e}function Wh(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function $_(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?Pu.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 Lu(e,a,i,o,null)}function Lu(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??++D_,__i:-1,__u:0};return o==null&&Ut.vnode!=null&&Ut.vnode(r),r}function Iu(e){return e.children}function Bu(e,t){this.props=e,this.context=t}function Vr(e,t){if(t==null)return e.__?Vr(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"?Vr(e):null}function $I(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=Ao({},t);r.__v=t.__v+1,Ut.vnode&&Ut.vnode(r),Uh(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Vr(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,U_(i,r,o),t.__e=t.__=null,r.__e!=n&&F_(r)}}function F_(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}),F_(e)}function j_(e){(!e.__d&&(e.__d=!0)&&fr.push(e)&&!Nu.__r++||L_!=Ut.debounceRendering)&&((L_=Ut.debounceRendering)||I_)(Nu)}function Nu(){try{for(var e,t=1;fr.length;)fr.length>t&&fr.sort(B_),e=fr.shift(),t=fr.length,$I(e)}finally{fr.length=Nu.__r=0}}function H_(e,t,n,i,o,r,a,s,c,l,u){var p,f,d,g,h,m,w=i&&i.__k||Ou,y=t.length;for(c=FI(n,t,w,c,y),p=0;p<y;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&w[d.__i]||ku,d.__i=p,m=Uh(e,d,f,o,r,a,s,c,l,u),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&qh(f.ref,null,d),u.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=z_(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&m!==void 0?c=m:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function FI(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]=Lu(null,a,null,null,null):Du(a)?a=e.__k[r]=Lu(Iu,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=Lu(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=jI(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=Vr(s)),Y_(s,s));return i}function z_(e,t,n){var i,o;if(typeof e.type=="function"){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=z_(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Vr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function jI(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 G_(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||NI.test(t)?n:n+"px"}function $u(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||G_(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||G_(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(N_,"$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[ic]=i[ic]:(n[ic]=zh,e.addEventListener(t,r?Vh:Gh,r)):e.removeEventListener(t,r?Vh:Gh,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 V_(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Tu]==null)t[Tu]=zh++;else if(t[Tu]<n[ic])return;return n(Ut.event?Ut.event(t):t)}}}function Uh(e,t,n,i,o,r,a,s,c,l){var u,p,f,d,g,h,m,w,y,v,x,E,M,D,P,T,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(y=t.props,v=N.prototype&&N.prototype.render,x=(u=N.contextType)&&i[u.__c],E=u?x?x.props.value:u.__:i,n.__c?w=(f=t.__c=n.__c).__=f.__E:(v?t.__c=f=new N(y,E):(t.__c=f=new Bu(y,E),f.constructor=N,f.render=zI),x&&x.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),v&&f.__s==null&&(f.__s=f.state),v&&N.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Ao({},f.__s)),Ao(f.__s,N.getDerivedStateFromProps(y,f.__s))),g=f.props,h=f.state,f.__v=t,d)v&&N.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),v&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(v&&N.getDerivedStateFromProps==null&&y!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(y,E),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(y,f.__s,E)===!1){t.__v!=n.__v&&(f.props=y,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(j){j&&(j.__=t)}),Ou.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Vr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(y,f.__s,E),v&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,m)})}if(f.context=E,f.props=y,f.__P=e,f.__e=!1,M=Ut.__r,D=0,v)f.state=f.__s,f.__d=!1,M&&M(t),u=f.render(f.props,f.state,f.context),Ou.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,M&&M(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++D<25);f.state=f.__s,f.getChildContext!=null&&(i=Ao(Ao({},i),f.getChildContext())),v&&!d&&f.getSnapshotBeforeUpdate!=null&&(m=f.getSnapshotBeforeUpdate(g,h)),P=u!=null&&u.type===Iu&&u.key==null?q_(u.props.children):u,s=H_(e,Du(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(T=r.length;T--;)Wh(r[T])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),j.then||W_(t),Ut.__e(j,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=HI(n.__e,t,n,i,o,r,a,c,l);return(u=Ut.diffed)&&u(t),128&t.__u?void 0:s}function W_(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(W_))}function U_(e,t,n){for(var i=0;i<n.length;i++)qh(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 q_(e){return typeof e!="object"||e==null||e.__b>0?e:Du(e)?e.map(q_):e.constructor!==void 0?null:Ao({},e)}function HI(e,t,n,i,o,r,a,s,c){var l,u,p,f,d,g,h,m=n.props||ku,w=t.props,y=t.type;if(y=="svg"?o="http://www.w3.org/2000/svg":y=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),r!=null){for(l=0;l<r.length;l++)if((d=r[l])&&"setAttribute"in d==!!y&&(y?d.localName==y:d.nodeType==3)){e=d,r[l]=null;break}}if(e==null){if(y==null)return document.createTextNode(w);e=document.createElementNS(o,y,w.is&&w),s&&(Ut.__m&&Ut.__m(t,r),s=!1),r=null}if(y==null)m===w||s&&e.data==w||(e.data=w);else{if(r=y=="textarea"&&w.defaultValue!=null?null:r&&Pu.call(e.childNodes),!s&&r!=null)for(m={},l=0;l<e.attributes.length;l++)m[(d=e.attributes[l]).name]=d.value;for(l in m)d=m[l],l=="dangerouslySetInnerHTML"?p=d:l=="children"||l in w||l=="value"&&"defaultValue"in w||l=="checked"&&"defaultChecked"in w||$u(e,l,null,d,o);for(l in w)d=w[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?g=d:l=="checked"?h=d:s&&typeof d!="function"||m[l]===d||$u(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=""),H_(t.type=="template"?e.content:e,Du(f)?f:[f],t,n,i,y=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&Vr(n,0),s,c),r!=null)for(l=r.length;l--;)Wh(r[l]);s&&y!="textarea"||(l="value",y=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||y=="progress"&&!g||y=="option"&&g!=m[l])&&$u(e,l,g,m[l],o),l="checked",h!=null&&h!=e[l]&&$u(e,l,h,m[l],o))}return e}function qh(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 Y_(e,t,n){var i,o;if(Ut.unmount&&Ut.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||qh(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]&&Y_(i[o],t,n||typeof e.type!="function");n||Wh(e.__e),e.__c=e.__=e.__e=void 0}function zI(e,t,n){return this.constructor(e,n)}function K_(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=[],Uh(t,e=t.__k=$_(Iu,null,[e]),o||ku,ku,t.namespaceURI,o?null:t.firstChild?Pu.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),U_(r,e,a),e.props.children=null}Pu=Ou.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}},D_=0,Bu.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ao({},this.state),typeof e=="function"&&(e=e(Ao({},n),this.props)),e&&Ao(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),j_(this))},Bu.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),j_(this))},Bu.prototype.render=Iu,fr=[],I_=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,B_=function(e,t){return e.__v.__b-t.__v.__b},Nu.__r=0,Hh=Math.random().toString(8),Tu="__d"+Hh,ic="__a"+Hh,N_=/(PointerCapture)$|Capture$/i,zh=0,Gh=V_(!1),Vh=V_(!0);var X_=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,X_(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},Z_=new Map;function GI(e){var t=Z_.get(this);return t||(t=new Map,Z_.set(this,t)),(t=X_(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
|
|
10
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+u+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Yt.prototype._setDefinitions=function(e){this._definitions=e},Yt.prototype.getModules=function(){return this._modules},Yt.prototype.clear=function(){this.getDefinitions()&&Qo.prototype.clear.call(this)},Yt.prototype.destroy=function(){Qo.prototype.destroy.call(this),Xi(this._container)},Yt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Yt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Yt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=Ct(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Yt.prototype.getDefinitions=function(){return this._definitions},Yt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Yt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),o=n.additionalModules||[],r=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(r,i,o),s=q(qi(n,["additionalModules"]),{canvas:q({},n.canvas,{container:e}),modules:a});Qo.call(this,s),n&&n.container&&this.attachTo(n.container)},Yt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Yt.prototype._createContainer=function(e){const t=zt('<div class="bjs-container"></div>');return qn(t,{width:zv(e.width),height:zv(e.height),position:e.position}),t},Yt.prototype._createModdle=function(e){const t=q({},this._moddleExtensions,e.moddleExtensions);return new dm(t)},Yt.prototype._modules=[];function xl(e,t){return e.warnings=t,e}function dT(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 hT={width:"100%",height:"100%",position:"relative"};function zv(e){return e+(qe(e)?"px":"")}function gT(e,t){return t&&Bt(e.diagrams,function(n){return n.id===t})||null}function mT(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+$v+"</a>",i=zt(n);qn(Ct("svg",i),Fv),qn(i,jv,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),je.bind(i,"click",function(o){fT(),o.preventDefault()})}function Sa(e){Yt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Te(Sa,Yt),Sa.prototype._createModdle=function(e){var t=Yt.prototype._createModdle.call(this,e);return t.ids=new Ki([32,36,1]),t},Sa.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 pt(e,t){return A(e,"bpmn:CallActivity")?!1:A(e,"bpmn:SubProcess")?(t=t||ht(e),t&&A(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):A(e,"bpmn:Participant")?!!me(e).processRef:!0}function _n(e){if(!(!A(e,"bpmn:Participant")&&!A(e,"bpmn:Lane"))){var t=ht(e).isHorizontal;return t===void 0?!0:t}}function yT(e){return e&&me(e).isInterrupting!==!1}function Vn(e){return e&&!!me(e).triggeredByEvent}function Ra(e,t){var n=me(e).eventDefinitions;return $o(n,function(i){return A(i,t)})}function vT(e){return Ra(e,"bpmn:ErrorEventDefinition")}function bT(e){return Ra(e,"bpmn:EscalationEventDefinition")}function xT(e){return Ra(e,"bpmn:CompensateEventDefinition")}var Lr={width:90,height:20},Gv=15;function Jo(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 wl(e){return it(e.label)}function wT(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=_T(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-=Gv:a+=Gv,{x:a,y:s}}function _T(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 Yf(e){return e.waypoints?wT(e.waypoints):A(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Lr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Lr.height/2}}function ET(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Lr.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=Yf(t),i=Lr),q({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Vv(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 ST(e){var t=e.categoryValueRef;return t&&t.value||""}function yi(e){var t=e.businessObject,n=Vv(t);if(n)return n==="categoryValueRef"?ST(t):t[n]||""}function RT(e,t){var n=e.businessObject,i=Vv(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function CT(e){return it(e)&&Jo(e.labelTarget)}var Ca=7;function Wv(e){let t=[];return z(e.incoming,n=>{A(n,"bpmn:Association")&&A(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),z(e.outgoing,n=>{A(n,"bpmn:Association")&&A(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function As(e){const t=new Map;return z(Hf(e),n=>{z(Wv(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 Kf="hsl(225, 10%, 15%)",MT="white";function eo(e,t){return $o(e.eventDefinitions,function(n){return n.$type===t})}function AT(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function PT(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function st(e,t,n){var i=ht(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||MT}function Ae(e,t,n){var i=ht(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Kf}function Ps(e,t,n,i){var o=ht(e),r=o.get("label");return i||r&&r.get("color:color")||t||Ae(e,n)}function Uv(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,o=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return Or(o)}function Xf(e,t){var n=e.x,i=e.y,o=e.width,r=e.height,a=[["M",n+t,i],["l",o-t*2,0],["a",t,t,0,0,1,t,t],["l",0,r-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-o,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-r],["a",t,t,0,0,1,t,-t],["z"]];return Or(a)}function TT(e){var t=e.width,n=e.height,i=e.x,o=e.y,r=t/2,a=n/2,s=[["M",i+r,o],["l",r,a],["l",-r,a],["l",-r,-a],["z"]];return Or(s)}function kT(e){var t=e.x,n=e.y,i=e.width,o=e.height,r=[["M",t,n],["l",i,0],["l",0,o],["l",-i,0],["z"]];return Or(r)}function Ts(e,t={}){return{width:_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 OT=new Ki,DT=10,_l=3,LT=1.5,El=10,IT=4,Ma=.95,BT=1,NT=.25;function Ir(e,t,n,i,o,r,a){vo.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(N){return n.computeStyle(N,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Kf,strokeWidth:2,fill:"white"})}function p(N){return n.computeStyle(N,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Kf,strokeWidth:2})}function f(N,M){var{ref:S={x:0,y:0},scale:W=1,element:X,parentGfx:re=o._svg}=M,Re=Be("marker",{id:N,viewBox:"0 0 20 20",refX:S.x,refY:S.y,markerWidth:20*W,markerHeight:20*W,orient:"auto"});Xe(Re,X);var et=Ct(":scope > defs",re);et||(et=Be("defs"),Xe(re,et)),Xe(et,Re)}function d(N,M,S,W){var X=OT.nextPrefixed("marker-");return g(N,X,M,S,W),"url(#"+X+")"}function g(N,M,S,W,X){if(S==="sequenceflow-end"){var re=Be("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:X,stroke:X,strokeWidth:1})});f(M,{element:re,ref:{x:11,y:10},scale:.5,parentGfx:N})}if(S==="messageflow-start"){var Re=Be("circle",{cx:6,cy:6,r:3.5,...u({fill:W,stroke:X,strokeWidth:1,strokeDasharray:[1e4,1]})});f(M,{element:Re,ref:{x:6,y:6},parentGfx:N})}if(S==="messageflow-end"){var et=Be("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:W,stroke:X,strokeWidth:1,strokeDasharray:[1e4,1]})});f(M,{element:et,ref:{x:8.5,y:5},parentGfx:N})}if(S==="association-start"){var yt=Be("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:X,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(M,{element:yt,ref:{x:1,y:10},scale:.5,parentGfx:N})}if(S==="association-end"){var It=Be("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:X,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(M,{element:It,ref:{x:11,y:10},scale:.5,parentGfx:N})}if(S==="conditional-flow-marker"){var bt=Be("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:W,stroke:X})});f(M,{element:bt,ref:{x:-1,y:10},scale:.5,parentGfx:N})}if(S==="conditional-default-flow-marker"){var on=Be("path",{d:"M 6 4 L 10 16",...u({stroke:X,fill:"none"})});f(M,{element:on,ref:{x:0,y:10},scale:.5,parentGfx:N})}}function h(N,M,S,W,X={}){mn(W)&&(X=W,W=0),W=W||0,X=u(X);var re=M/2,Re=S/2,et=Be("circle",{cx:re,cy:Re,r:Math.round((M+S)/4-W),...X});return Xe(N,et),et}function m(N,M,S,W,X,re){mn(X)&&(re=X,X=0),X=X||0,re=u(re);var Re=Be("rect",{x:X,y:X,width:M-X*2,height:S-X*2,rx:W,ry:W,...re});return Xe(N,Re),Re}function w(N,M,S,W){var X=M/2,re=S/2,Re=[{x:X,y:0},{x:M,y:re},{x:X,y:S},{x:0,y:re}],et=Re.map(function(It){return It.x+","+It.y}).join(" ");W=u(W);var yt=Be("polygon",{...W,points:et});return Xe(N,yt),yt}function y(N,M,S,W){S=p(S);var X=ws(M,S,W);return Xe(N,X),X}function v(N,M,S){return y(N,M,S,5)}function x(N,M,S){S=p(S);var W=Be("path",{...S,d:M});return Xe(N,W),W}function E(N,M,S,W){return x(M,S,q({"data-marker":N},W))}function C(N){return ke[N]}function D(N){return function(M,S,W){return C(N)(M,S,W)}}var P={"bpmn:MessageEventDefinition":function(N,M,S={},W){var X=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:S.width||M.width,containerHeight:S.height||M.height,position:{mx:.235,my:.315}}),re=W?Ae(M,c,S.stroke):st(M,s,S.fill),Re=W?st(M,s,S.fill):Ae(M,c,S.stroke),et=x(N,X,{fill:re,stroke:Re,strokeWidth:1});return et},"bpmn:TimerEventDefinition":function(N,M,S={}){var W=S.width||M.width,X=S.height||M.height,re=S.width?1:2,Re=h(N,W,X,.2*X,{fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke),strokeWidth:re}),et=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:W,containerHeight:X,position:{mx:.5,my:.5}});x(N,et,{stroke:Ae(M,c,S.stroke),strokeWidth:re});for(var yt=0;yt<12;yt++){var It=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:W,containerHeight:X,position:{mx:.5,my:.5}}),bt=W/2,on=X/2;x(N,It,{strokeWidth:1,stroke:Ae(M,c,S.stroke),transform:"rotate("+yt*30+","+on+","+bt+")"})}return Re},"bpmn:EscalationEventDefinition":function(N,M,S={},W){var X=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width||M.width,containerHeight:S.height||M.height,position:{mx:.5,my:.2}}),re=W?Ae(M,c,S.stroke):st(M,s,S.fill);return x(N,X,{fill:re,stroke:Ae(M,c,S.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(N,M,S={}){var W=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width||M.width,containerHeight:S.height||M.height,position:{mx:.5,my:.222}});return x(N,W,{fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(N,M,S={},W){var X=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:.57,my:.263}}),re=W?Ae(M,c,S.stroke):st(M,s,S.fill);return x(N,X,{fill:re,stroke:Ae(M,c,S.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(N,M,S={},W){var X=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:S.width||M.width,containerHeight:S.height||M.height,position:{mx:.2,my:.722}}),re=W?Ae(M,c,S.stroke):st(M,s,S.fill);return x(N,X,{fill:re,stroke:Ae(M,c,S.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(N,M,S={},W){var X=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:.638,my:-.055}}),re=W?Ae(M,c,S.stroke):"none",Re=x(N,X,{fill:re,stroke:Ae(M,c,S.stroke),strokeWidth:1});return Bv(Re,45),Re},"bpmn:CompensateEventDefinition":function(N,M,S={},W){var X=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width||M.width,containerHeight:S.height||M.height,position:{mx:.22,my:.5}}),re=W?Ae(M,c,S.stroke):st(M,s,S.fill);return x(N,X,{fill:re,stroke:Ae(M,c,S.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(N,M,S={},W){var X=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:S.width||M.width,containerHeight:S.height||M.height,position:{mx:.5,my:.2}}),re=W?Ae(M,c,S.stroke):st(M,s,S.fill);return x(N,X,{strokeWidth:1,fill:re,stroke:Ae(M,c,S.stroke)})},"bpmn:MultipleEventDefinition":function(N,M,S={},W){var X=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:S.width||M.width,containerHeight:S.height||M.height,position:{mx:.211,my:.36}}),re=W?Ae(M,c,S.stroke):st(M,s,S.fill);return x(N,X,{fill:re,stroke:Ae(M,c,S.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(N,M,S={}){var W=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:S.width||M.width,containerHeight:S.height||M.height,position:{mx:.458,my:.194}});return x(N,W,{fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(N,M,S={}){var W=h(N,M.width,M.height,8,{fill:Ae(M,c,S.stroke),stroke:Ae(M,c,S.stroke),strokeWidth:4});return W}};function T(N,M,S={},W){var X=me(N),re=AT(X),Re=W||N;return X.get("eventDefinitions")&&X.get("eventDefinitions").length>1?X.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](M,Re,S,re):P["bpmn:MultipleEventDefinition"](M,Re,S,re):eo(X,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](M,Re,S,re):eo(X,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](M,Re,S,re):eo(X,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](M,Re,S,re):eo(X,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](M,Re,S,re):eo(X,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](M,Re,S,re):eo(X,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](M,Re,S,re):eo(X,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](M,Re,S,re):eo(X,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](M,Re,S,re):eo(X,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](M,Re,S,re):eo(X,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](M,Re,S,re):null}var $={ParticipantMultiplicityMarker:function(N,M,S={}){var W=_i(M,S),X=oi(M,S),re=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:W,containerHeight:X,position:{mx:(W/2-6)/W,my:(X-15)/X}});E("participant-multiplicity",N,re,{strokeWidth:2,fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke)})},SubProcessMarker:function(N,M,S={}){var W=m(N,14,14,0,{strokeWidth:1,fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke)});Dn(W,M.width/2-7.5,M.height-20);var X=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:M.width,containerHeight:M.height,position:{mx:(M.width/2-7.5)/M.width,my:(M.height-20)/M.height}});E("sub-process",N,X,{fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke)})},ParallelMarker:function(N,M,S){var W=_i(M,S),X=oi(M,S),re=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:W,containerHeight:X,position:{mx:(W/2+S.parallel)/W,my:(X-20)/X}});E("parallel",N,re,{fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke)})},SequentialMarker:function(N,M,S){var W=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:(M.width/2+S.seq)/M.width,my:(M.height-19)/M.height}});E("sequential",N,W,{fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke)})},CompensationMarker:function(N,M,S){var W=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:(M.width/2+S.compensation)/M.width,my:(M.height-13)/M.height}});E("compensation",N,W,{strokeWidth:1,fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke)})},LoopMarker:function(N,M,S){var W=_i(M,S),X=oi(M,S),re=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:W,containerHeight:X,position:{mx:(W/2+S.loop)/W,my:(X-7)/X}});E("loop",N,re,{strokeWidth:1.5,fill:"none",stroke:Ae(M,c,S.stroke),strokeMiterlimit:.5})},AdhocMarker:function(N,M,S){var W=_i(M,S),X=oi(M,S),re=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:W,containerHeight:X,position:{mx:(W/2+S.adhoc)/W,my:(X-15)/X}});E("adhoc",N,re,{strokeWidth:1,fill:Ae(M,c,S.stroke),stroke:Ae(M,c,S.stroke)})}};function j(N,M,S,W){$[N](M,S,W)}function G(N,M,S=[],W={}){W={fill:W.fill,stroke:W.stroke,width:_i(M,W),height:oi(M,W)};var X=me(M),re=S.includes("SubProcessMarker");re?W={...W,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:W={...W,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},X.get("isForCompensation")&&S.push("CompensationMarker"),A(X,"bpmn:AdHocSubProcess")&&(S.push("AdhocMarker"),re||q(W,{compensation:W.compensation-18}));var Re=X.get("loopCharacteristics"),et=Re&&Re.get("isSequential");Re&&(q(W,{compensation:W.compensation-18}),S.includes("AdhocMarker")&&q(W,{seq:-23,loop:-18,parallel:-24}),et===void 0&&S.push("LoopMarker"),et===!1&&S.push("ParallelMarker"),et===!0&&S.push("SequentialMarker")),S.includes("CompensationMarker")&&S.length===1&&q(W,{compensation:-8}),z(S,function(yt){j(yt,N,M,W)})}function Q(N,M,S={}){S=q({size:{width:100}},S);var W=r.createText(M||"",S);return ut(W).add("djs-label"),Xe(N,W),W}function te(N,M,S,W={}){var X=me(M),re=Ts({x:M.x,y:M.y,width:M.width,height:M.height},W);return Q(N,X.name,{align:S,box:re,padding:7,style:{fill:Ps(M,l,c,W.stroke)}})}function V(N,M,S={}){var W={width:M.width,height:M.height,x:M.width/2+M.x,y:M.height/2+M.y};return Q(N,yi(M),{box:W,style:q({},r.getExternalStyle(),{fill:Ps(M,l,c,S.stroke)})})}function ee(N,M,S,W={}){var X=_n(S),re=Q(N,M,{box:{height:30,width:X?oi(S,W):_i(S,W)},align:"center-middle",style:{fill:Ps(S,l,c,W.stroke)}});if(X){var Re=-1*oi(S,W);vl(re,0,-Re,270)}}function Ee(N,M,S={}){var{width:W,height:X}=Ts(M,S);return m(N,W,X,El,{...S,fill:st(M,s,S.fill),fillOpacity:Ma,stroke:Ae(M,c,S.stroke)})}function Pe(N,M,S={}){var W=me(M),X=st(M,s,S.fill),re=Ae(M,c,S.stroke);return(W.get("associationDirection")==="One"||W.get("associationDirection")==="Both")&&(S.markerEnd=d(N,"association-end",X,re)),W.get("associationDirection")==="Both"&&(S.markerStart=d(N,"association-start",X,re)),S=gt(S,["markerStart","markerEnd"]),v(N,M.waypoints,{...S,stroke:re,strokeDasharray:"0, 5"})}function Se(N,M,S={}){var W=st(M,s,S.fill),X=Ae(M,c,S.stroke),re=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:.474,my:.296}}),Re=x(N,re,{fill:W,fillOpacity:Ma,stroke:X}),et=me(M);if(PT(et)){var yt=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:.33,my:(M.height-18)/M.height}});x(N,yt,{strokeWidth:2,fill:W,stroke:X})}return Re}function K(N,M,S={}){return h(N,M.width,M.height,{fillOpacity:Ma,...S,fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke)})}function oe(N,M,S={}){return w(N,M.width,M.height,{fill:st(M,s,S.fill),fillOpacity:Ma,stroke:Ae(M,c,S.stroke)})}function Y(N,M,S={}){var W=m(N,_i(M,S),oi(M,S),0,{fill:st(M,s,S.fill),fillOpacity:S.fillOpacity||Ma,stroke:Ae(M,c,S.stroke),strokeWidth:1.5}),X=me(M);if(A(X,"bpmn:Lane")){var re=X.get("name");ee(N,re,M,S)}return W}function Z(N,M,S={}){var W=Ee(N,M,S),X=pt(M);if(Vn(M)&&(Ce(W,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!X)){var re=me(M).flowElements||[],Re=re.filter(et=>A(et,"bpmn:StartEvent"));Re.length===1&&ce(Re[0],N,S,M)}return te(N,M,X?"center-top":"center-middle",S),X?G(N,M,void 0,S):G(N,M,["SubProcessMarker"],S),W}function ce(N,M,S,W){var X=22,re={fill:st(W,s,S.fill),stroke:Ae(W,c,S.stroke),width:X,height:X},Re=me(N).isInterrupting,et=Re?0:3,yt=Re?1:1.2,It=20,bt=(X-It)/2,on="translate("+bt+","+bt+")";h(M,It,It,{fill:re.fill,stroke:re.stroke,strokeWidth:yt,strokeDasharray:et,transform:on}),T(N,M,re,W)}function xe(N,M,S={}){var W=Ee(N,M,S);return te(N,M,"center-middle",S),G(N,M,void 0,S),W}var ke=this.handlers={"bpmn:AdHocSubProcess":function(N,M,S={}){return pt(M)?S=gt(S,["fill","stroke","width","height"]):S=gt(S,["fill","stroke"]),Z(N,M,S)},"bpmn:Association":function(N,M,S={}){return S=gt(S,["fill","stroke"]),Pe(N,M,S)},"bpmn:BoundaryEvent":function(N,M,S={}){var{renderIcon:W=!0}=S;S=gt(S,["fill","stroke"]);var X=me(M),re=X.get("cancelActivity");S={strokeWidth:1.5,fill:st(M,s,S.fill),fillOpacity:BT,stroke:Ae(M,c,S.stroke)},re||(S.strokeDasharray="6");var Re=K(N,M,S);return h(N,M.width,M.height,_l,{...S,fill:"none"}),W&&T(M,N,S),Re},"bpmn:BusinessRuleTask":function(N,M,S={}){S=gt(S,["fill","stroke"]);var W=xe(N,M,S),X=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),re=x(N,X);Ce(re,{fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke),strokeWidth:1});var Re=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),et=x(N,Re);return Ce(et,{fill:Ae(M,c,S.stroke),stroke:Ae(M,c,S.stroke),strokeWidth:1}),W},"bpmn:CallActivity":function(N,M,S={}){return S=gt(S,["fill","stroke"]),Z(N,M,{strokeWidth:5,...S})},"bpmn:ComplexGateway":function(N,M,S={}){S=gt(S,["fill","stroke"]);var W=oe(N,M,S),X=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:M.width,containerHeight:M.height,position:{mx:.46,my:.26}});return x(N,X,{fill:Ae(M,c,S.stroke),stroke:Ae(M,c,S.stroke),strokeWidth:1}),W},"bpmn:DataInput":function(N,M,S={}){S=gt(S,["fill","stroke"]);var W=i.getRawPath("DATA_ARROW"),X=Se(N,M,S);return x(N,W,{fill:"none",stroke:Ae(M,c,S.stroke),strokeWidth:1}),X},"bpmn:DataInputAssociation":function(N,M,S={}){return S=gt(S,["fill","stroke"]),Pe(N,M,{...S,markerEnd:d(N,"association-end",st(M,s,S.fill),Ae(M,c,S.stroke))})},"bpmn:DataObject":function(N,M,S={}){return S=gt(S,["fill","stroke"]),Se(N,M,S)},"bpmn:DataObjectReference":D("bpmn:DataObject"),"bpmn:DataOutput":function(N,M,S={}){S=gt(S,["fill","stroke"]);var W=i.getRawPath("DATA_ARROW"),X=Se(N,M,S);return x(N,W,{strokeWidth:1,fill:Ae(M,c,S.stroke),stroke:Ae(M,c,S.stroke)}),X},"bpmn:DataOutputAssociation":function(N,M,S={}){return S=gt(S,["fill","stroke"]),Pe(N,M,{...S,markerEnd:d(N,"association-end",st(M,s,S.fill),Ae(M,c,S.stroke))})},"bpmn:DataStoreReference":function(N,M,S={}){S=gt(S,["fill","stroke"]);var W=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:0,my:.133}});return x(N,W,{fill:st(M,s,S.fill),fillOpacity:Ma,stroke:Ae(M,c,S.stroke),strokeWidth:2})},"bpmn:EndEvent":function(N,M,S={}){var{renderIcon:W=!0}=S;S=gt(S,["fill","stroke"]);var X=K(N,M,{...S,strokeWidth:4});return W&&T(M,N,S),X},"bpmn:EventBasedGateway":function(N,M,S={}){S=gt(S,["fill","stroke"]);var W=me(M),X=oe(N,M,S);h(N,M.width,M.height,M.height*.2,{fill:st(M,"none",S.fill),stroke:Ae(M,c,S.stroke),strokeWidth:1});var re=W.get("eventGatewayType"),Re=!!W.get("instantiate");function et(){var It=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:M.width,containerHeight:M.height,position:{mx:.36,my:.44}});x(N,It,{fill:"none",stroke:Ae(M,c,S.stroke),strokeWidth:2})}if(re==="Parallel"){var yt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:M.width,containerHeight:M.height,position:{mx:.474,my:.296}});x(N,yt,{fill:"none",stroke:Ae(M,c,S.stroke),strokeWidth:1})}else re==="Exclusive"&&(Re||h(N,M.width,M.height,M.height*.26,{fill:"none",stroke:Ae(M,c,S.stroke),strokeWidth:1}),et());return X},"bpmn:ExclusiveGateway":function(N,M,S={}){S=gt(S,["fill","stroke"]);var W=oe(N,M,S),X=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:M.width,containerHeight:M.height,position:{mx:.32,my:.3}}),re=ht(M);return re.get("isMarkerVisible")&&x(N,X,{fill:Ae(M,c,S.stroke),stroke:Ae(M,c,S.stroke),strokeWidth:1}),W},"bpmn:Gateway":function(N,M,S={}){return S=gt(S,["fill","stroke"]),oe(N,M,S)},"bpmn:Group":function(N,M,S={}){return S=gt(S,["fill","stroke","width","height"]),m(N,M.width,M.height,El,{stroke:Ae(M,c,S.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:_i(M,S),height:oi(M,S)})},"bpmn:InclusiveGateway":function(N,M,S={}){S=gt(S,["fill","stroke"]);var W=oe(N,M,S);return h(N,M.width,M.height,M.height*.24,{fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke),strokeWidth:2.5}),W},"bpmn:IntermediateEvent":function(N,M,S={}){var{renderIcon:W=!0}=S;S=gt(S,["fill","stroke"]);var X=K(N,M,{...S,strokeWidth:1.5});return h(N,M.width,M.height,_l,{fill:"none",stroke:Ae(M,c,S.stroke),strokeWidth:1.5}),W&&T(M,N,S),X},"bpmn:IntermediateCatchEvent":D("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":D("bpmn:IntermediateEvent"),"bpmn:Lane":function(N,M,S={}){return S=gt(S,["fill","stroke","width","height"]),Y(N,M,{...S,fillOpacity:NT})},"bpmn:ManualTask":function(N,M,S={}){S=gt(S,["fill","stroke"]);var W=xe(N,M,S),X=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(N,X,{fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke),strokeWidth:.5}),W},"bpmn:MessageFlow":function(N,M,S={}){S=gt(S,["fill","stroke"]);var W=me(M),X=ht(M),re=st(M,s,S.fill),Re=Ae(M,c,S.stroke),et=v(N,M.waypoints,{markerEnd:d(N,"messageflow-end",re,Re),markerStart:d(N,"messageflow-start",re,Re),stroke:Re,strokeDasharray:"10, 11",strokeWidth:1.5});if(W.get("messageRef")){var yt=et.getPointAtLength(et.getTotalLength()/2),It=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:yt.x,y:yt.y}}),bt={strokeWidth:1};X.get("messageVisibleKind")==="initiating"?(bt.fill=re,bt.stroke=Re):(bt.fill=Re,bt.stroke=re);var on=x(N,It,bt),Mn=W.get("messageRef"),An=Mn.get("name"),Nt=Q(N,An,{align:"center-top",fitBox:!0,style:{fill:Re}}),xn=on.getBBox(),Nn=Nt.getBBox(),xr=yt.x-Nn.width/2,vi=yt.y+xn.height/2+DT;vl(Nt,xr,vi,0)}return et},"bpmn:ParallelGateway":function(N,M,S={}){S=gt(S,["fill","stroke"]);var W=oe(N,M,S),X=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:M.width,containerHeight:M.height,position:{mx:.46,my:.2}});return x(N,X,{fill:Ae(M,c,S.stroke),stroke:Ae(M,c,S.stroke),strokeWidth:1}),W},"bpmn:Participant":function(N,M,S={}){S=gt(S,["fill","stroke","width","height"]);var W=Y(N,M,S),X=pt(M),re=_n(M),Re=me(M),et=Re.get("name");if(X){var yt=re?[{x:30,y:0},{x:30,y:oi(M,S)}]:[{x:0,y:30},{x:_i(M,S),y:30}];y(N,yt,{stroke:Ae(M,c,S.stroke),strokeWidth:LT}),ee(N,et,M,S)}else{var It=Ts(M,S);re||(It.height=_i(M,S),It.width=oi(M,S));var bt=Q(N,et,{box:It,align:"center-middle",style:{fill:Ps(M,l,c,S.stroke)}});if(!re){var on=-1*oi(M,S);vl(bt,0,-on,270)}}return Re.get("participantMultiplicity")&&j("ParticipantMultiplicityMarker",N,M,S),W},"bpmn:ReceiveTask":function(N,M,S={}){S=gt(S,["fill","stroke"]);var W=me(M),X=xe(N,M,S),re;return W.get("instantiate")?(h(N,28,28,20*.22,{fill:st(M,s,S.fill),stroke:Ae(M,c,S.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}}),x(N,re,{fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke),strokeWidth:1}),X},"bpmn:ScriptTask":function(N,M,S={}){S=gt(S,["fill","stroke"]);var W=xe(N,M,S),X=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(N,X,{fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke),strokeWidth:1}),W},"bpmn:SendTask":function(N,M,S={}){S=gt(S,["fill","stroke"]);var W=xe(N,M,S),X=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(N,X,{fill:Ae(M,c,S.stroke),stroke:st(M,s,S.fill),strokeWidth:1}),W},"bpmn:SequenceFlow":function(N,M,S={}){S=gt(S,["fill","stroke"]);var W=st(M,s,S.fill),X=Ae(M,c,S.stroke),re=v(N,M.waypoints,{markerEnd:d(N,"sequenceflow-end",W,X),stroke:X}),Re=me(M),{source:et}=M;if(et){var yt=me(et);Re.get("conditionExpression")&&A(yt,"bpmn:Activity")&&Ce(re,{markerStart:d(N,"conditional-flow-marker",W,X)}),yt.get("default")&&(A(yt,"bpmn:Gateway")||A(yt,"bpmn:Activity"))&&yt.get("default")===Re&&Ce(re,{markerStart:d(N,"conditional-default-flow-marker",W,X)})}return re},"bpmn:ServiceTask":function(N,M,S={}){S=gt(S,["fill","stroke"]);var W=xe(N,M,S);h(N,10,10,{fill:st(M,s,S.fill),stroke:"none",transform:"translate(6, 6)"});var X=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(N,X,{fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke),strokeWidth:1}),h(N,10,10,{fill:st(M,s,S.fill),stroke:"none",transform:"translate(11, 10)"});var re=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(N,re,{fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke),strokeWidth:1}),W},"bpmn:StartEvent":function(N,M,S={}){var{renderIcon:W=!0}=S;S=gt(S,["fill","stroke"]);var X=me(M);X.get("isInterrupting")||(S={...S,strokeDasharray:"6"});var re=K(N,M,S);return W&&T(M,N,S),re},"bpmn:SubProcess":function(N,M,S={}){return pt(M)?S=gt(S,["fill","stroke","width","height"]):S=gt(S,["fill","stroke"]),Z(N,M,S)},"bpmn:Task":function(N,M,S={}){return S=gt(S,["fill","stroke"]),xe(N,M,S)},"bpmn:TextAnnotation":function(N,M,S={}){S=gt(S,["fill","stroke"]);var{width:W,height:X}=Ts(M,S),re=m(N,W,X,0,0,{fill:"none",stroke:"none"}),Re=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:W,containerHeight:X,position:{mx:0,my:0}});x(N,Re,{stroke:Ae(M,c,S.stroke)});var et=me(M),yt=et.get("text")||"";return Q(N,yt,{align:"left-top",box:Ts(M,S),padding:Ca,style:{fill:Ps(M,l,c,S.stroke)}}),re},"bpmn:Transaction":function(N,M,S={}){pt(M)?S=gt(S,["fill","stroke","width","height"]):S=gt(S,["fill","stroke"]);var W=Z(N,M,{strokeWidth:1.5,...S}),X=n.style(["no-fill","no-events"],{stroke:Ae(M,c,S.stroke),strokeWidth:1.5}),re=pt(M);return re||(S={}),m(N,_i(M,S),oi(M,S),El-_l,_l,X),W},"bpmn:UserTask":function(N,M,S={}){S=gt(S,["fill","stroke"]);var W=xe(N,M,S),X=15,re=12,Re=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:X,y:re}});x(N,Re,{fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke),strokeWidth:.5});var et=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:X,y:re}});x(N,et,{fill:st(M,s,S.fill),stroke:Ae(M,c,S.stroke),strokeWidth:.5});var yt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:X,y:re}});return x(N,yt,{fill:Ae(M,c,S.stroke),stroke:Ae(M,c,S.stroke),strokeWidth:.5}),W},label:function(N,M,S={}){return V(N,M,S)}};this._drawPath=x,this._renderer=C}Te(Ir,vo),Ir.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Ir.prototype.canRender=function(e){return A(e,"bpmn:BaseElement")},Ir.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Ir.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Ir.prototype.getShapePath=function(e){return it(e)?Xf(e,IT):A(e,"bpmn:Event")?Uv(e):A(e,"bpmn:Activity")?Xf(e,El):A(e,"bpmn:Gateway")?TT(e):kT(e)};function gt(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var $T=0,FT={width:150,height:50};function jT(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function HT(e){return mn(e)?q({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Zf=null;function zT(){return Zf||(Zf=document.createElement("canvas").getContext("2d")),Zf}function GT(e){var t=[];return e.fontStyle&&t.push(e.fontStyle),e.fontVariant&&t.push(e.fontVariant),e.fontWeight&&t.push(e.fontWeight),e.fontStretch&&t.push(e.fontStretch),t.push(qv(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function qv(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function VT(e,t){var n=zT();if(!n)return{width:0,height:0};n.font=GT(t),"letterSpacing"in n&&(n.letterSpacing=qv(t.letterSpacing)||"0px");var i=e==="",o=i?"dummy":e.replace(/\s+$/,""),r=n.measureText(o);return{width:i?0:r.width,height:"fontBoundingBoxAscent"in r?r.fontBoundingBoxAscent+r.fontBoundingBoxDescent:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent}}function WT(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=VT(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return UT(e,o,i,r);o=YT(o,r.width,t)}}function UT(e,t,n,i){if(t.length<n.length){var o=n.slice(t.length).trim();e.unshift(o)}return{width:i.width,height:i.height,text:t}}var Yv="";function qT(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===Yv)&&o.pop();break}var a=o[o.length-1];return a&&a===Yv&&(o[o.length-1]="-"),o.join("")}function YT(e,t,n){var i=Math.max(e.length*(n/t),1),o=qT(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function Sl(e){this._config=q({},{size:FT,padding:$T,style:{},align:"center-top"},e||{})}Sl.prototype.createText=function(e,t){return this.layoutText(e,t).element},Sl.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Sl.prototype.layoutText=function(e,t){for(var n=q({},this._config.size,t.box),i=q({},this._config.style,t.style),o=jT(t.align||this._config.align),r=HT(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=KT(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(WT(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=ti(l,function(m,w,y){return m+(s||w.height)},0)+r.top+r.bottom,f=ti(l,function(m,w,y){return w.width>m?w.width:m},0),d=r.top;o.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||l[0].height)/4;var g=Be("text");Ce(g,i),z(l,function(m){var w;switch(d+=s||m.height,o.horizontal){case"left":w=r.left;break;case"right":w=(a?f:u)-r.right-m.width;break;default:w=Math.max(((a?f:u)-m.width)/2+r.left,0)}var y=Be("tspan");Ce(y,{x:w,y:d}),y.textContent=m.text,Xe(g,y)});var h={width:f,height:p};return{dimensions:h,element:g}};function KT(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var XT=12,ZT=1.2,QT=40;function Kv(e){var t=q({fontFamily:"Arial, sans-serif",fontSize:XT,fontWeight:"normal",lineHeight:ZT},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=q({},t,{fontSize:n},e&&e.externalStyle||{}),o=new Sl({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Lr.width),height:30},l=r(s,c,{style:i});return{x:Math.round(a.x+a.width/2-l.width/2),y:a.y,width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(a,s){var c=r(s,a,{style:t,align:"left-top",padding:Ca});return{x:a.x,y:a.y,width:a.width,height:Math.max(QT,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,q({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Kv.$inject=["config.textRenderer"];function JT(){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=ik(i.d,{mx:o,my:r,e:a});return p}}var ek=/\{([^{}]+)\}/g,tk=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function nk(e,t,n){var i=n;return t.replace(tk,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 ik(e,t){return String(e).replace(ek,function(n,i){return nk(n,i,t)})}const ok={__init__:["bpmnRenderer"],bpmnRenderer:["type",Ir],textRenderer:["type",Kv],pathMap:["type",JT]};function rk(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ks={translate:["value",rk]};function Rl(e,t,n){return q({id:e.id,type:e.$type,businessObject:e,di:t},n)}function ak(e,t,n){var i=e.waypoint;return!i||i.length<2?[Ye(t),Ye(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function Xv(e,t,n){return new Error(`element ${Gn(t)} referenced by ${Gn(e)}#${n} not yet drawn`)}function _o(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}_o.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],_o.prototype.add=function(e,t,n){var i,o,r;if(A(t,"bpmndi:BPMNPlane")){var a=A(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Rl(e,t,a)),this._canvas.addRootElement(i)}else if(A(t,"bpmndi:BPMNShape")){var s=!pt(e,t),c=ck(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Rl(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")&&(sk(n,Ye(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(Rl(e,t,{hidden:o,source:u,target:p,waypoints:ak(t,u,p)})),A(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${Gn(t)} for element ${Gn(e)}`);return Jo(e)&&yi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},_o.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Gn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw Xv(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},_o.prototype.addLabel=function(e,t,n){var i,o,r;return i=ET(t,n),o=yi(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(Rl(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)},_o.prototype._getConnectedElement=function(e,t){var n,i,o=e.$type;if(i=e[t+"Ref"],t==="source"&&o==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&o==="bpmn:DataOutputAssociation"||t==="target"&&o==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?Xv(e,i,t+"Ref"):new Error(`${Gn(e)}#${t} Ref not specified`)},_o.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},_o.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},_o.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function sk(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 ck(e){return A(e,"bpmn:Group")}const Zv={__depends__:[ok,{__depends__:[ks],bpmnImporter:["type",_o]}]};function Os(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 lk=1e3;function ge(e){this._eventBus=e}ge.$inject=["eventBus"];function uk(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}ge.prototype.on=function(e,t,n,i,o,r){if((wn(t)||qe(t))&&(r=o,o=i,i=n,n=t,t=null),wn(n)&&(r=o,o=i,i=n,n=lk),mn(o)&&(r=o,o=!1),!wn(i))throw new Error("handlerFn must be a function");Ue(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?uk(i,r):i,r)})},ge.prototype.canExecute=Eo("canExecute"),ge.prototype.preExecute=Eo("preExecute"),ge.prototype.preExecuted=Eo("preExecuted"),ge.prototype.execute=Eo("execute"),ge.prototype.executed=Eo("executed"),ge.prototype.postExecute=Eo("postExecute"),ge.prototype.postExecuted=Eo("postExecuted"),ge.prototype.revert=Eo("revert"),ge.prototype.reverted=Eo("reverted");function Eo(e){return function(n,i,o,r,a){(wn(n)||qe(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var Jf=["top","bottom","left","right"],Cl=10;function ed(e,t){ge.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(wl(o)&&!Ot(o)){var r=dk(o);r&&i(o,r)}}function i(o,r){var a=Ye(o),s=o.label,c=Ye(s);if(s.parent){var l=ze(o),u;switch(r){case"top":u={x:a.x,y:l.top-Cl-s.height/2};break;case"left":u={x:l.left-Cl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Cl+s.height/2};break;case"right":u={x:l.right+Cl+s.width/2,y:a.y};break}var p=zi(u,c);t.moveShape(s,p)}}}Te(ed,ge),ed.$inject=["eventBus","modeling"];function pk(e){var t=e.host,n=Ye(e),i=On(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=Jf.filter(function(a){return o.indexOf(a)===-1});return r}function fk(e){var t=Ye(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 Qv(t,i)});return n}function dk(e){var t=Ye(e.label),n=Ye(e),i=Qv(n,t);if(hk(i)){var o=fk(e);if(e.host){var r=pk(e);o=o.concat(r)}var a=Jf.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?On(e.label,e)!=="intersect"?void 0:i:a[0]}}function Qv(e,t){return On(t,e,5)}function hk(e){return Jf.indexOf(e)!==-1}function td(e){ge.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(td,ge),td.$inject=["eventBus"];var gk=1500;function nd(e,t,n){e.invoke(ge,this),this.preExecute("elements.delete",gk,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 z(r,l=>{const u=new Set(aa(wa(Array.from(s),sn(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Te(nd,ge),nd.$inject=["injector","eventBus","canvas"];function id(e,t){e.invoke(ge,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")});z(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Te(id,ge),id.$inject=["injector","modeling"];function Aa(e,t){for(Jn(t)&&(t=[t]);e=e.parent;)if(ot(e,t))return e;return null}function Jv(e,t){var n=Aa(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Aa(e,i),n)return _n(n);if(ot(e,i))return _n(e);var o;for(o=me(e);o&&!A(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=me(a);return s&&s.get("processRef")===o});return r?_n(r):!0}var eb=500;function Ml(e,t){t.invoke(ge,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",eb,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return tb(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",eb,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];tb(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}Ml.$inject=["bpmnReplace","injector"],Te(Ml,ge),Ml.prototype._replaceShape=function(e,t){var n=mk(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function mk(e){var t=me(e),n=t.eventDefinitions;return n&&n[0]}function tb(e,t){return!it(e)&&ot(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function od(e,t){ge.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")&&z(r.outgoing,function(a){var s=a.target,c=n(s);A(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}od.$inject=["eventBus","modeling"],Te(od,ge);function nb(e){return e.create("bpmn:Category")}function yk(e){return e.create("bpmn:CategoryValue")}function ib(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=yk(e)),n.$parent||(n.$parent=nb(e)),n}function vk(e,t,n){return nn(t.get("categoryValue"),e),e.$parent=t,nn(n.get("rootElements"),t),t.$parent=n,e}function bk(e){var t=e.$parent;return t&&(tn(t.get("categoryValue"),e),e.$parent=null),e}function xk(e){var t=e.$parent;return t&&(tn(t.get("rootElements"),e),e.$parent=null),e}var wk=500;function rd(e,t,n){n.invoke(ge,this);function i(c){return t.filter(function(l){return A(l,"bpmn:Group")&&!l.labelTarget}).map(me).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&&vk(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&xk(l),c&&!o(c,u)&&bk(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,me(l))},!0),this.executed(["shape.move","shape.resize"],wk,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,me(l))},!0),this.executed("group.updateRefs",function(c){ob(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){ob(c).forEach(function(l){s(l.categoryValue,l.category,me(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,me(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}rd.$inject=["bpmnjs","elementRegistry","injector"],Te(rd,ge);function ob(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function ad(e,t,n){ge.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",o,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",r,!0),this.postExecuted("element.updateProperties",a,!0);function i(m){const w=m.source,y=m.target;Pa(w)&&Ds(y)&&u(y)}function o(m){const w=m.connection,y=m.source,v=m.target;Pa(y)&&Al(v)&&(l(v),f(y,[w]))}function r(m){const w=m.newTarget,y=m.oldSource,v=m.oldTarget;if(v!==w){const x=y;Ds(v)&&u(v),Pa(x)&&Al(w)&&l(w)}}function a(m){const{element:w}=m;Ds(w)?(p(w),d(w)):Al(w)&&g(w)}function s(m){const{newData:w,oldShape:y}=m;if(Pa(m.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){const v=y.outgoing.find(({target:x})=>Ds(x));v&&v.target&&(m._connectionTarget=v.target)}else if(!Pa(m.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){const v=y.outgoing.find(({target:x})=>Al(x));v&&v.target&&(m._connectionTarget=v.target),h(y)}}function c(m){const{_connectionTarget:w,newShape:y}=m;w&&t.connect(y,w)}function l(m){t.updateProperties(m,{isForCompensation:!0})}function u(m){t.updateProperties(m,{isForCompensation:void 0})}function p(m){for(const w of m.incoming)n.canConnect(w.source,m)||t.removeConnection(w);for(const w of m.outgoing)n.canConnect(m,w.target)||t.removeConnection(w)}function f(m,w){m.outgoing.filter(x=>A(x,"bpmn:Association")).filter(x=>Ds(x.target)&&!w.includes(x)).forEach(x=>t.removeConnection(x))}function d(m){const w=m.attachers.slice();w.length&&t.removeElements(w)}function g(m){const w=m.incoming.filter(y=>Pa(y.source));t.removeElements(w)}function h(m){const w=m.outgoing.filter(y=>A(y,"bpmn:SequenceFlow"));t.removeElements(w)}}Te(ad,ge),ad.$inject=["eventBus","modeling","bpmnRules"];function Ds(e){const t=me(e);return t&&t.get("isForCompensation")}function Pa(e){return e&&A(e,"bpmn:BoundaryEvent")&&Ra(e,"bpmn:CompensateEventDefinition")}function Al(e){return e&&A(e,"bpmn:Activity")&&!Vn(e)}function sd(e){e.invoke(ge,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=Aa(i,"bpmn:Participant"))})}sd.$inject=["injector"],Te(sd,ge);function cd(e,t){ge.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}})}cd.$inject=["eventBus","bpmnFactory"],Te(cd,ge);var ld=20,ud=20,rb=30,Pl=2e3;function pd(e,t,n){ge.call(this,t),t.on(["create.start","shape.move.start"],Pl,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")&&!it(p)&&!Ot(p)});if(c.length){var l=sn(c),u=_k(a,l);q(a,u),r.createConstraints=Ek(a,l)}}}),t.on("create.start",Pl,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",Pl,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",Pl,function(o){var r=o.elements,a=o.parent,s=Sk(r),c;s&&A(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=me(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=me(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)&&me(s).set("processRef",me(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)&&me(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)}pd.$inject=["canvas","eventBus","modeling"],Te(pd,ge);function _k(e,t){t={width:t.width+ld*2+rb,height:t.height+ud*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 Ek(e,t){return t=ze(t),{bottom:t.top+e.height/2-ud,left:t.right-e.width/2+ld,top:t.bottom-e.height/2+ud,right:t.left+e.width/2-ld-rb}}function Sk(e){return Bt(e,function(t){return A(t,"bpmn:Participant")})}var ab="__targetRef_placeholder";function fd(e,t){ge.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],sb(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],sb(r));function n(a,s,c){var l=a.get("dataInputAssociations");return Bt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Bt(c,function(u){return u.name===ab});return!l&&s&&(l=t.create("bpmn:Property",{name:ab}),nn(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||tn(a.get("properties"),c))}function r(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,f=s.newTarget,d=f&&f.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,m=c.businessObject,w;h&&h!==p&&o(h,l),d&&d!==p&&o(d,l),p?(w=i(p,!0),m.targetRef=w):m.targetRef=null}}fd.$inject=["eventBus","bpmnFactory"],Te(fd,ge);function sb(e){return function(t){var n=t.context,i=n.connection;if(A(i,"bpmn:DataInputAssociation"))return e(t)}}function Tl(e){this._bpmnUpdater=e}Tl.$inject=["bpmnUpdater"],Tl.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,o=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,o),[]},Tl.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 dd(e,t,n,i){ge.call(this,i),t.registerHandler("dataStore.updateContainment",Tl);function o(){return n.filter(function(s){return A(s,"bpmn:Participant")&&me(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:ht(s),newSemanticParent:u.processRef||u,newDiParent:ht(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:Ck(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"])&&A(u,"bpmn:Collaboration")&&r(u).filter(function(p){return Rk(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)})})}dd.$inject=["canvas","commandStack","elementRegistry","eventBus"],Te(dd,ge);function Rk(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 Ck(e,t){for(;e.parent;){if(A(e.parent,t))return e.parent;e=e.parent}}var kl=Math.max,Ol=Math.min,Mk=20;function cb(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function Ak(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 Pk(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 Dl(e,t,n){var i=t[e],o=n.min&&n.min[e],r=n.max&&n.max[e];return qe(o)&&(i=(/top|left/.test(e)?Ol:kl)(i,o)),qe(r)&&(i=(/top|left/.test(e)?kl:Ol)(i,r)),i}function Tk(e,t){if(!t)return e;var n=ze(e);return gl({top:Dl("top",n,t),right:Dl("right",n,t),bottom:Dl("bottom",n,t),left:Dl("left",n,t)})}function kk(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:Ol(r.top,a.top),left:Ol(r.left,a.left),bottom:kl(r.bottom,a.bottom),right:kl(r.right,a.right)};return gl(s)}function Ls(e,t){return typeof e<"u"?e:Mk}function Ok(e,t){var n,i,o,r;return typeof t=="object"?(n=Ls(t.left),i=Ls(t.right),o=Ls(t.top),r=Ls(t.bottom)):n=i=o=r=Ls(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function Dk(e){return!(e.waypoints||e.type==="label")}function lb(e,t){var n;if(e.length===void 0?n=rt(e.children,Dk):n=e,n.length)return Ok(sn(n),t)}var er=Math.abs;function Lk(e,t){return cb(ze(t),ze(e))}var Ik=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Ei=30;function Ll(e,t){return t=t||[],e.children.filter(function(n){A(n,"bpmn:Lane")&&(Ll(n,t),t.push(n))}),t}function tr(e){return e.children.filter(function(t){return A(t,"bpmn:Lane")})}function Si(e){return Aa(e,Ik)||e}function Bk(e,t){var n=Si(e),i=A(n,"bpmn:Process")?[]:[n],o=Ll(n,i),r=ze(e),a=ze(t),s=Lk(e,t),c=[],l=_n(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=ze(u);s.top&&(er(h.bottom-r.top)<10&&(d=a.top-h.bottom),er(h.top-r.top)<5&&(p=a.top-h.top)),s.left&&(er(h.right-r.left)<10&&(f=a.left-h.right),er(h.left-r.left)<5&&(g=a.left-h.left)),s.bottom&&(er(h.top-r.bottom)<10&&(p=a.bottom-h.top),er(h.bottom-r.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(er(h.left-r.right)<10&&(g=a.right-h.left),er(h.right-r.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:u,newBounds:Pk(u,{top:p,right:f,bottom:d,left:g})})}}),c}var Nk=500;function hd(e,t){ge.call(this,e);function n(i,o){var r=_n(i),a=tr(o),s=[],c=[],l=[],u=[];if(Dr(a,function(m){return r?m.y>i.y?c.push(m):s.push(m):m.x>i.x?u.push(m):l.push(m),m.children}),!!a.length){var p;r?c.length&&s.length?p=i.height/2:p=i.height:u.length&&l.length?p=i.width/2:p=i.width;var f,d,g,h;s.length&&(f=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),l.length&&(g=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:p,y:0},"e")),u.length&&(h=t.calculateAdjustments(u,"x",-p,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",Nk,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))})}hd.$inject=["eventBus","spaceTool"],Te(hd,ge);var ub=500;function Il(e,t){t.invoke(ge,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",ub,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return pb(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",ub,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;pb(a,Fk(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}Il.$inject=["bpmnReplace","injector"],Te(Il,ge),Il.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=me(e),n=t.eventDefinitions;return n&&n[0]}function pb(e,t){return!it(e)&&A(e,"bpmn:BoundaryEvent")&&!t}function Fk(e,t){return e.indexOf(t)!==-1}var Bl=Math.round,jk=Math.max;function Hk(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 zk(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var fb=10;function Gk(e,t){var n,i;for(n=0;i=e[n];n++)if(Ss(i,t)<=fb)return{point:e[n],bendpoint:!0,index:n};return null}function Vk(e,t){var n=yv(Hk(t,fb),zk(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=jk(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:Bl(i.x+o.x)/2,y:Bl(i.y+o.y)/2},index:i.segment2}:{point:{x:Bl(i.x),y:Bl(i.y)},index:i.segment2}:null}function gd(e,t){return Gk(e,t)||Vk(e,t)}function md(e,t,n){ge.call(this,e);function i(o,r,a){var s=r.waypoints,c,l,u,p,f,d,g,h=o.outgoing.slice(),m=o.incoming.slice(),w;qe(a.width)?w=Ye(a):w=a;var y=gd(s,w);if(y){if(c=s.slice(0,y.index),l=s.slice(y.index+(y.bendpoint?1:0)),!c.length||!l.length)return;u=y.bendpoint?s[y.index]:w,(c.length===1||!db(o,c[c.length-1]))&&c.push(hb(u)),(l.length===1||!db(o,l[0]))&&l.unshift(hb(u))}p=r.source,f=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||w),d=r),t.canConnect(o,f,r)&&(d?g=n.connect(o,f,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||w),g=r));var v=[].concat(d&&rt(m,function(x){return x.source===d.source})||[],g&&rt(h,function(x){return x.target===g.target})||[]);v.length&&n.removeElements(v)}this.preExecute("elements.move",function(o){var r=o.newParent,a=o.shapes,s=o.delta,c=a[0];if(!(!c||!r)){r&&r.waypoints&&(o.newParent=r=r.parent);var l=Ye(c),u={x:l.x+s.x,y:l.y+s.y},p=Bt(r.children,function(f){var d=t.canInsert(a,f);return d&&gd(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(md,ge),md.$inject=["eventBus","bpmnRules","modeling"];function db(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 hb(e){return q({},e)}function yd(e,t){ge.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)&&Ta(o)){var c=[];A(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&Ta(l)):c=a.incoming.filter(l=>l!==o&&Ta(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(Ta).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(Ta).forEach(function(s){const c=a.incoming.filter(Ta).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}yd.$inject=["eventBus","modeling"],Te(yd,ge);function Ta(e){return A(e,"bpmn:SequenceFlow")}var Nl=1500,gb=2e3;function mb(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"],Nl,function(i){var o=i.context,r=o.shape||i.shape,a=i.hover;A(a,"bpmn:Lane")&&!ot(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Si(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"],Nl,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"],Nl,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"],Nl,function(i){var o=i.context,r=o.start;A(r,"bpmn:Lane")&&(o.start=Si(r)||r)}),t.on("shape.move.start",gb,function(i){var o=i.shape;A(o,"bpmn:Lane")&&(i.shape=Si(o)||o)}),t.on("spaceTool.move",gb,function(i){var o=i.hover;o&&A(o,"bpmn:Lane")&&(i.hover=Si(o))})}mb.$inject=["elementRegistry","eventBus","canvas"];var yb=770;function vd(e,t,n,i){n.invoke(ge,this);function o(s,c){var l=me(s),u=c.categoryValue||l.categoryValueRef;u||(u=ib(e,l));var p=c.category||u.$parent||nb(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=me(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=me(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=me(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&&!me(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&&!me(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||me(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",yb,function(s){var c=s.descriptor,l=s.element;if(!(!A(l,"bpmn:Group")||l.labelTarget)){var u=me(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",yb,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})}vd.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Te(vd,ge);function bd(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 vb(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=bd(i,o,r,a),l=bd(i,o,r,s),u;c&&l?bb(c,r)>bb(l,r)?u=l:u=c:u=c||l,i.original=u}function n(i){var o=i.waypoints;t(o[0],o[1],Ye(i.source)),t(o[o.length-1],o[o.length-2],Ye(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}vb.$inject=["eventBus"];function bb(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function xd(e){ge.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=me(i),r=ht(i);if(ot(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}xd.$inject=["eventBus"],Te(xd,ge);function xb(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function wb(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function Wk(e,t){return t?{x:Math.cos(t)*e.x-Math.sin(t)*e.y,y:Math.sin(t)*e.x+Math.cos(t)*e.y}:e}function Uk(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],o=i[0].n*t[0]+i[1].n*t[1],r=i[0].lambda*t[0]+i[1].lambda*t[1];return-o/r}function wd(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=Uk([n.x,n.y],[o.x,o.y],[e.x,e.y]);return{x:n.x+r*o.x,y:n.y+r*o.y}}function _b(e,t){var n=wd(e,t),i={x:n.x-e.x,y:n.y-e.y};return xb(i)}function Is(e,t){return xb({x:e.x-t.x,y:e.y-t.y})}var Eb=Math.sqrt,Sb=Math.min,qk=Math.max,Rb=Math.abs;function Cb(e){return Math.pow(e,2)}function Bs(e,t){return Eb(Cb(e.x-t.x)+Cb(e.y-t.y))}function Yk(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],Ab(i,o)?l=[i]:(r=Bs(e,i),a=Bs(e,o),c=Sb(r,a),l=Kk(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:Ab(i,l[0])?n:n+1}),l.length===2&&(s=Zk(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Bs(i,s)/Bs(i,o)}),p=Bs(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function Kk(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=Eb(d),h=-p+g,m=-p-g,w={x:e.x-o*h,y:e.y-r*h};if(d===0)return[w];var y={x:e.x-o*m,y:e.y-r*m};return[w,y].filter(function(v){return Xk(v,e,t)})}function Xk(e,t,n){return Mb(e.x,t.x,n.x)&&Mb(e.y,t.y,n.y)}function Mb(e,t,n){return e>=Sb(t,n)-$l&&e<=qk(t,n)+$l}function Zk(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var $l=.1;function Ab(e,t){return Rb(e.x-t.x)<=$l&&Rb(e.y-t.y)<=$l}function Qk(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=Tb(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 Pb(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=Yk(e,n),c=s.segmentIndex,l=Qk(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=kb(n,c),p=kb(t,l),f=s.position,d=e2(u,f),g=Jk(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,w=n[m];if(t.indexOf(w)!==-1)return a;if(h===0){var y=t[m];return o=y.x-s.position.x,r=y.y-s.position.y,{delta:{x:o,y:r},point:{x:e.x+o,y:e.y+r}}}h<0&&m!==0&&m<n.length-1&&(d=Tb(n,m))}var v={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},x=Wk({x:e.x-f.x,y:e.y-f.y},g);return o=v.x+x.x-e.x,r=v.y+x.y-e.y,{point:xo(v),delta:xo({x:o,y:r})}}function Tb(e,t){var n=Is(e[t-1],e[t]),i=Is(e[t],e[t+1]),o=n/(n+i);return o}function Jk(e,t){var n=wb(e),i=wb(t);return i-n}function kb(e,t){return[e[t],e[t+1]]}function e2(e,t){var n=Is(e[0],e[1]),i=Is(e[0],t);return n===0?0:i/n}function t2(e,t,n,i){var o=Ye(e);return Pb(o,t,n,i).delta}function Ns(e,t,n){var i=Os(t),o=Os(n),r=zi(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return xo({x:o.x+a.x,y:o.y+a.y})}function Ob(e,t,n){var i=Os(e),o=Os(t),r=Os(n),a=zi(e,i),s=zi(i,o),c=n2(i,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:r.x+l.x,y:r.y+l.y};return xo({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function n2(e,t,n){var i=ze(t),o=ze(n);if(i2(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 i2(e,t){return o2(e,t)||r2(e,t)}function o2(e,t){return e.right!==t.right&&e.left!==t.left}function r2(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Db="name",Lb="text";function _d(e,t,n,i){ge.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{me(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if(Db in l&&t.updateLabel(c,l[Db]),Lb in l&&A(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Lb]||"");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)||!Jo(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=q({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),t2(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=me(c);u&&Jo(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(wl(c)){var p=c.label,f=Ye(p),d=c2(u),g=s2(f,d),h=a2(g,u,l);t.moveShape(p,h)}})}Te(_d,ge),_d.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function a2(e,t,n){var i=Ns(e,t,n);return xo(zi(i,e))}function s2(e,t){if(t.length){var n=l2(e,t);return wd(e,n)}}function c2(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 l2(e,t){var n=t.map(function(o){return{line:o,distance:_b(e,o)}}),i=Ui(n,"distance");return i[0].line}function u2(e,t,n,i){return Pb(e,t,n,i).point}function Ed(e,t){ge.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=q({},r.hints),c=r.newWaypoints||a.waypoints,l=r.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),u2(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(Ed,ge),Ed.$inject=["eventBus","modeling"];function Fl(e,t,n){var i=Hl(e),o=Bb(i,t),r=i[0];return o.length?o[o.length-1]:Ns(r.original||r,n,t)}function jl(e,t,n){var i=Hl(e),o=Bb(i,t),r=i[i.length-1];return o.length?o[0]:Ns(r.original||r,n,t)}function Sd(e,t,n){var i=Hl(e),o=Ib(t,n),r=i[0];return Ns(r.original||r,o,t)}function Rd(e,t,n){var i=Hl(e),o=Ib(t,n),r=i[i.length-1];return Ns(r.original||r,o,t)}function Ib(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Hl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Bb(e,t){var n=jn(e,f2);return rt(n,function(i){return p2(i,t)})}function p2(e,t){return On(t,e,1)==="intersect"}function f2(e){return e.original||e}function Cd(e,t){ge.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(d2(i,o)){var r=h2(i);r.incoming.forEach(function(a){var s=jl(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=Fl(a,o,i);t.reconnectStart(a,o,s)})}},!0)}Cd.$inject=["eventBus","modeling"],Te(Cd,ge);function d2(e,t){return A(e,"bpmn:Participant")&&pt(e)&&A(t,"bpmn:Participant")&&!pt(t)}function h2(e){var t=_s([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 g2=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Nb(e){const t=me(e);if(!A(t,"bpmn:BoundaryEvent")&&!(A(t,"bpmn:StartEvent")&&Vn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:g2.some(i=>A(n[0],i))}function $b(e){return A(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Md(e,t){e.invoke(ge,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!Nb(o))return;const a=$b(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=me(i).get(a),l=me(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}Md.$inject=["injector","modeling"],Te(Md,ge);function Ad(e,t){ge.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=ht(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}Te(Ad,ge),Ad.$inject=["eventBus","modeling"];function Pd(e,t,n){ge.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=m2(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}Te(Pd,ge),Pd.$inject=["eventBus","bpmnRules","modeling"];function ka(e){return e.original||e}function m2(e,t){var n=bd(ka(e[e.length-2]),ka(e[e.length-1]),ka(t[1]),ka(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[ka(e[0]),ka(t[t.length-1])]}function Td(e,t){ge.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)}Td.$inject=["eventBus","modeling"],Te(Td,ge);function kd(e,t,n,i){ge.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,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=Bt(p.outgoing,ca({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}Te(kd,ge),kd.$inject=["eventBus","modeling","bpmnRules","injector"];function zl(e,t,n,i,o,r){i.invoke(ge,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){Vn(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(zl,ge),zl.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)},zl.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var y2=1500,v2={width:140,height:120},Od={width:300,height:60},Dd={width:60,height:300},Gl={width:300,height:150},Vl={width:150,height:300},Fb={width:140,height:120},jb={width:100,height:40};function Hb(e){e.on("resize.start",y2,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=E2(i,o,r)),A(i,"bpmn:SubProcess")&&pt(i)&&(n.minDimensions=Fb),A(i,"bpmn:TextAnnotation")&&(n.minDimensions=jb)})}Hb.$inject=["eventBus"];var nr=Math.abs,b2=Math.min,x2=Math.max;function zb(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function Oa(e,t,n){return zb(e,t,n,b2)}function Da(e,t,n){return zb(e,t,n,x2)}var w2={top:20,left:50,right:20,bottom:20},_2={top:50,left:20,right:20,bottom:20};function E2(e,t,n){var i=Si(e),o=!0,r=!0,a=Ll(i,[i]),s=ze(e),c={},l={},u=_n(e),p=u?Od:Dd;/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=ze(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&&nr(s.top-h.bottom)<10&&Da(c,"top",h.top+p.height),nr(s.top-h.top)<5&&Oa(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&nr(s.right-h.left)<10&&Oa(c,"right",h.right-p.width),nr(s.right-h.right)<5&&Da(l,"right",h.left+p.width)),/s/.test(t)&&(n&&nr(s.bottom-h.top)<10&&Oa(c,"bottom",h.bottom-p.height),nr(s.bottom-h.bottom)<5&&Da(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&nr(s.left-h.right)<10&&Da(c,"left",h.left+p.width),nr(s.left-h.left)<5&&Oa(l,"left",h.right-p.width))});var f=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(A(g,"bpmn:FlowElement")||A(g,"bpmn:Artifact"))}),d=u?w2:_2;return f.forEach(function(g){var h=ze(g);/n/.test(t)&&(!u||o)&&Oa(l,"top",h.top-d.top),/e/.test(t)&&(u||r)&&Da(l,"right",h.right+d.right),/s/.test(t)&&(!u||r)&&Da(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||o)&&Oa(l,"left",h.left-d.left)}),{min:l,max:c}}function Gb(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function La(e){return e.originalEvent||e.srcEvent}function Ld(e){Gb(e),Gb(La(e))}function Br(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function Vb(){return/mac/i.test(navigator.platform)}function Wb(e,t){return(La(e)||e).button===t}function ir(e){return Wb(e,0)}function S2(e){return Wb(e,1)}function $s(e){var t=La(e)||e;return ir(e)?Vb()?t.metaKey:t.ctrlKey:!1}function Wl(e){var t=La(e)||e;return ir(e)&&t.shiftKey}var Ub=1001;function qb(e,t){e.on("resize.start",Ub+500,function(n){var i=n.context,o=i.shape;(A(o,"bpmn:Lane")||A(o,"bpmn:Participant"))&&(i.balanced=!$s(n))}),e.on("resize.end",Ub,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=_v(a),t.resizeLane(o,a,i.balanced)),!1})}qb.$inject=["eventBus","modeling"];var R2=500;function Id(e,t,n,i,o){n.invoke(ge,this);function r(u){return ot(u,["bpmn:ReceiveTask","bpmn:SendTask"])||C2(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!Bt(f,ca({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(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=me(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),nn(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");tn(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!r(f))){var d=me(f),g=c(d);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",R2,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)})}Id.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Te(Id,ge);function C2(e,t){return Ue(t)||(t=[t]),$o(t,function(n){return Ra(e,n)})}var Yb=Math.max;function Kb(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;A(a,"bpmn:Participant")&&(r[s]=A2(a,i,o)),A(a,"bpmn:Lane")&&(r[s]=_n(a)?Od:Dd),A(a,"bpmn:SubProcess")&&pt(a)&&(r[s]=Fb),A(a,"bpmn:TextAnnotation")&&(r[s]=jb),A(a,"bpmn:Group")&&(r[s]=v2)}),r})}Kb.$inject=["eventBus"];function M2(e){return e==="x"}function A2(e,t,n){var i=_n(e);if(!k2(e))return i?Gl:Vl;var o=M2(t),r={};return o?i?r=Gl:r={width:T2(e,n,o),height:Vl.height}:i?r={width:Gl.width,height:P2(e,n,o)}:r=Vl,r}function P2(e,t,n){var i;return i=O2(e,t,n),Yb(Gl.height,i)}function T2(e,t,n){var i;return i=D2(e,t,n),Yb(Vl.width,i)}function k2(e){return!!tr(e).length}function O2(e,t,n){var i=tr(e),o;return o=Bd(i,t,n),e.height-o.height+Od.height}function D2(e,t,n){var i=tr(e),o;return o=Bd(i,t,n),e.width-o.width+Dd.width}function Bd(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=tr(o),r.length?Bd(r,t,n):o}var Xb="_plane";function Zb(e){var t=e.id;return L2(t)}function to(e){var t=e.id;return A(e,"bpmn:SubProcess")?Qb(t):t}function Nr(e){return Qb(e)}function Ul(e){var t=ht(e);return A(t,"bpmndi:BPMNPlane")}function Qb(e){return e+Xb}function L2(e){return e.replace(new RegExp(Xb+"$"),"")}var Jb=400,I2=600,ex={x:180,y:160};function So(e,t,n,i,o,r,a){ge.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")&&!pt(p)}function l(p){var f=p.shape,d=p.newRootElement,g=me(f);d=s._addDiagram(d||g),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=me(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=tx(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;!A(f,"bpmn:SubProcess")||!pt(f)||z(As([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(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(A(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,m=d.id;if(h!==m){if(Ul(f)){a.updateId(f,Nr(m)),a.updateId(h,m);return}var w=a.get(Nr(h));w&&a.updateId(Nr(h),Nr(m))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(A(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,m=d.id;if(h!==m){if(Ul(f)){a.updateId(f,Nr(h)),a.updateId(m,h);return}var w=a.get(Nr(m));w&&a.updateId(w,Nr(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Ul(f)){var d=f,g=a.get(Zb(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",Jb,function(p){var f=p.shape;A(f,"bpmn:SubProcess")&&(pt(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Jb,function(p){var f=p.shape;A(f,"bpmn:SubProcess")&&(pt(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",I2,function(p){var f=p.shape;if(A(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(pt(f))s._moveChildrenToShape(d.children.slice(),f),z(As(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=tx(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=A(ht(h),"bpmndi:BPMNPlane");if(m){var w=Zb(h),y=Bt(g,function(v){return v.id===w});y&&(f.parent=y.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}Te(So,ge),So.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var o=sn(i),r;if(!t.x)r={x:ex.x-o.x,y:ex.y-o.y};else{var a=Ye(t),s=Ye(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},So.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Wv(e).map(i=>i.annotation));n.size&&z(As(e.children),i=>{n.has(i.annotation)&&z(i.associations,o=>{t.removeConnection(o)})})},So.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(o){o.hidden=!!t,i=i.concat(o),o.children&&(i=i.concat(n._showRecursively(o.children,o.collapsed||t)))}),i},So.prototype._addDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),n.push(e.di.$parent),e},So.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),o=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=o;var r=n.createRoot({id:to(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},So.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Bt(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},So.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function B2(e){var t=[];return z(As(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function tx(e){return e.children.slice().concat(B2(e.children)).concat(N2(e))}function N2(e){return Hf(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Nd(e,t){e.invoke(ge,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"))||!pt(o))){var r=$2(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}Nd.$inject=["injector","modeling"],Te(Nd,ge);function $2(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function $d(e,t){ge.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,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}}})}Te($d,ge),$d.$inject=["eventBus","textRenderer"];function Fd(e,t){ge.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(pt(i))return;var o=_s(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||A(a,"bpmn:Association")&&(A(a.source,"bpmn:TextAnnotation")||A(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Ye(i)):t.reconnectStart(a,i,Ye(i)))}},!0)}Te(Fd,ge),Fd.$inject=["eventBus","modeling"];var jd=500;function Hd(e,t,n){ge.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=F2(c).concat([a]),p=lb(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"],jd,function(a){var s=a.context,c=s.shape;A(c,"bpmn:SubProcess")&&(c.collapsed?ht(c).isExpanded=!1:(i(c.children),ht(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],jd,function(a){var s=a.context,c=s.shape;c.collapsed?ht(c).isExpanded=!1:ht(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],jd,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(Hd,ge),Hd.$inject=["eventBus","elementFactory","modeling"];function F2(e){return e.filter(function(t){return!t.hidden})}function zd(e,t,n,i){t.invoke(ge,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;it(a)||(A(a,"bpmn:Participant")&&pt(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(zd,ge),zd.$inject=["canvas","injector","moddle","modeling"];function Gd(e,t){ge.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;j2(o,r)&&t.updateProperties(r,{default:null})})}Te(Gd,ge),Gd.$inject=["eventBus","modeling"];function j2(e,t){if(!A(e,"bpmn:SequenceFlow"))return!1;var n=me(t),i=me(e);return n.get("default")===i}var H2=500,z2=5e3,nx=["shape.create","shape.delete","shape.move","shape.resize"],ix=[...nx,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Vd(e,t){ge.call(this,e);var n;function i(){return n=n||new G2,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(ix,z2,function(){i()}),this.postExecuted(ix,H2,function(){r()}),this.preExecute(nx,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))})}Vd.$inject=["eventBus","modeling"],Te(Vd,ge);function G2(){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 V2=500,W2=5e3,ox=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],rx=[...ox,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Wd(e,t){ge.call(this,e);var n;function i(){return n=n||new U2,n.enter(),n}function o(){if(!n)throw new Error("out of bounds release");return n}function r(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(rx,W2,function(){i()}),this.postExecuted(rx,V2,function(){r()}),this.preExecute(ox,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)})}Wd.$inject=["eventBus","modeling"],Te(Wd,ge);function U2(){this.affectedFlowElements=new Set,this.affectedGroupEntries=new Map,this.counter=0,this.addFlowElement=function(e){this.affectedFlowElements.add(e)},this.addGroup=function(e){this.affectedGroupEntries.has(e)||this.affectedGroupEntries.set(e,{categoryValue:e.businessObject.categoryValueRef,groupShape:e})},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function Ud(e,t){ge.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)q2(r)&&!K2(r)&&t.updateProperties(r,{isForCompensation:void 0})})}Te(Ud,ge),Ud.$inject=["eventBus","modeling"];function q2(e){const t=me(e);return t&&t.isForCompensation}function Y2(e){return e&&A(e,"bpmn:BoundaryEvent")&&Ra(e,"bpmn:CompensateEventDefinition")}function K2(e){return e.incoming.filter(n=>Y2(n.source)).length>0}const X2={__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",ed],appendBehavior:["type",td],associationBehavior:["type",id],attachEventBehavior:["type",Ml],artifactBehavior:["type",nd],boundaryEventBehavior:["type",od],categoryRootElementReferenceBehavior:["type",rd],compensateBoundaryEventBehaviour:["type",ad],createBehavior:["type",sd],createDataObjectBehavior:["type",cd],createParticipantBehavior:["type",pd],dataInputAssociationBehavior:["type",fd],dataStoreBehavior:["type",dd],deleteLaneBehavior:["type",hd],detachEventBehavior:["type",Il],dropOnFlowBehavior:["type",md],eventBasedGatewayBehavior:["type",yd],fixHoverBehavior:["type",mb],groupBehavior:["type",vd],importDockingFix:["type",vb],isHorizontalFix:["type",xd],labelBehavior:["type",_d],layoutConnectionBehavior:["type",Ed],messageFlowBehavior:["type",Cd],nonInterruptingBehavior:["type",Md],removeElementBehavior:["type",Pd],removeEmbeddedLabelBoundsBehavior:["type",Ad],removeParticipantBehavior:["type",Td],replaceConnectionBehavior:["type",kd],replaceElementBehaviour:["type",zl],resizeBehavior:["type",Hb],resizeLaneBehavior:["type",qb],rootElementReferenceBehavior:["type",Id],spaceToolBehavior:["type",Kb],subProcessPlaneBehavior:["type",So],subProcessStartEventBehavior:["type",Nd],textAnnotationBehavior:["type",$d],toggleCollapseConnectionBehaviour:["type",Fd],toggleElementCollapseBehaviour:["type",Hd],unclaimIdBehavior:["type",zd],unsetDefaultFlowBehavior:["type",Gd],updateFlowNodeRefsBehavior:["type",Vd],updateCategoryValueRefsBehavior:["type",Wd],setCompensationActivityAfterPasteBehavior:["type",Ud]};function qd(e){this._commandStack=e.get("commandStack",!1)}qd.$inject=["injector"],qd.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",qd]};function Ri(e){ge.call(this,e),this.init()}Ri.$inject=["eventBus"],Te(Ri,ge),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 ax(e,t){var n=On(e,t,-15);return n!=="intersect"?n:null}function Ln(e){Ri.call(this,e)}Te(Ln,Ri),Ln.$inject=["eventBus"],Ln.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return Z2(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 Yl(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Yl(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 bx(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Ot(i)&&!Kl(t,i)?!1:No(t,function(o){return Ot(o)?Yl(o.source,o.target,o):o.host?Fs(o,o.host,null,n):Zd(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 dx(a)&&!n.includes(a.host)})?!1:Fs(n,t,null,i)||yx(n,t,i)||vx(n,t)||Kl(n,t)}),this.addRule("shape.create",function(e){return Zd(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Fs(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Sx(n,t)})},Ln.prototype.canConnectMessageFlow=_x,Ln.prototype.canConnectSequenceFlow=Ex,Ln.prototype.canConnectDataAssociation=Qd,Ln.prototype.canConnectAssociation=xx,Ln.prototype.canConnectCompensationAssociation=wx,Ln.prototype.canMove=vx,Ln.prototype.canAttach=Fs,Ln.prototype.canReplace=yx,Ln.prototype.canDrop=Ia,Ln.prototype.canInsert=Kl,Ln.prototype.canCreate=Zd,Ln.prototype.canConnect=Yl,Ln.prototype.canResize=bx,Ln.prototype.canCopy=Sx;function Z2(e){return Yd(e)?null:ot(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Yd(e){return!e||it(e)}function sx(e){do{if(A(e,"bpmn:Process"))return me(e);if(A(e,"bpmn:Participant"))return me(e).processRef||me(e)}while(e=e.parent)}function Kd(e){return A(e,"bpmn:TextAnnotation")}function Xd(e){return A(e,"bpmn:Group")&&!e.labelTarget}function cx(e){return A(e,"bpmn:BoundaryEvent")&&io(e,"bpmn:CompensateEventDefinition")}function ql(e){return me(e).isForCompensation}function Q2(e,t){var n=sx(e),i=sx(t);return n===i}function J2(e){return A(e,"bpmn:InteractionNode")&&!A(e,"bpmn:BoundaryEvent")&&(!A(e,"bpmn:Event")||A(e,"bpmn:ThrowEvent")&&px(e,"bpmn:MessageEventDefinition"))}function eO(e){return A(e,"bpmn:InteractionNode")&&!ql(e)&&(!A(e,"bpmn:Event")||A(e,"bpmn:CatchEvent")&&px(e,"bpmn:MessageEventDefinition"))&&!(A(e,"bpmn:BoundaryEvent")&&!io(e,"bpmn:MessageEventDefinition"))}function lx(e){for(var t=e;t=t.parent;){if(A(t,"bpmn:FlowElementsContainer"))return me(t);if(A(t,"bpmn:Participant"))return me(t).processRef}return null}function ux(e,t){var n=lx(e),i=lx(t);return n===i}function io(e,t){var n=me(e);return!!Bt(n.eventDefinitions||[],function(i){return A(i,t)})}function px(e,t){var n=me(e);return(n.eventDefinitions||[]).every(function(i){return A(i,t)})}function tO(e){return A(e,"bpmn:FlowNode")&&!A(e,"bpmn:EndEvent")&&!Vn(e)&&!(A(e,"bpmn:IntermediateThrowEvent")&&io(e,"bpmn:LinkEventDefinition"))&&!cx(e)&&!ql(e)}function nO(e){return A(e,"bpmn:FlowNode")&&!A(e,"bpmn:StartEvent")&&!A(e,"bpmn:BoundaryEvent")&&!Vn(e)&&!(A(e,"bpmn:IntermediateCatchEvent")&&io(e,"bpmn:LinkEventDefinition"))&&!ql(e)}function iO(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 oO(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function fx(e,t){var n=oO(t);return n.indexOf(e)!==-1}function Yl(e,t,n){if(Yd(e)||Yd(t))return null;if(!A(n,"bpmn:DataAssociation")){if(_x(e,t))return{type:"bpmn:MessageFlow"};if(Ex(e,t))return{type:"bpmn:SequenceFlow"}}var i=Qd(e,t);return i||(wx(e,t)?{type:"bpmn:Association",associationDirection:"One"}:xx(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Ia(e,t){return it(e)||Xd(e)?!0:A(t,"bpmn:Participant")&&!pt(t)?!1:A(e,"bpmn:Participant")?A(t,"bpmn:Process")||A(t,"bpmn:Collaboration"):ot(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")&&!rO(e)?!1:A(e,"bpmn:FlowElement")&&!A(e,"bpmn:DataStoreReference")?A(t,"bpmn:FlowElementsContainer")?pt(t):ot(t,["bpmn:Participant","bpmn:Lane"]):A(e,"bpmn:DataStoreReference")&&A(t,"bpmn:Collaboration")?$o(me(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"]):A(e,"bpmn:MessageFlow")?A(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function rO(e){return me(e).cancelActivity&&(hx(e)||gx(e))}function dx(e){return!it(e)&&A(e,"bpmn:BoundaryEvent")}function aO(e){return A(e,"bpmn:Lane")}function sO(e){return dx(e)||A(e,"bpmn:IntermediateThrowEvent")&&hx(e)?!0:A(e,"bpmn:IntermediateCatchEvent")&&gx(e)}function hx(e){var t=me(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function gx(e){return mx(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function mx(e,t){return t.some(function(n){return io(e,n)})}function cO(e){return A(e,"bpmn:ReceiveTask")&&Bt(e.incoming,function(t){return A(t.source,"bpmn:EventBasedGateway")})}function Fs(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return it(o)||!sO(o)||Vn(t)||!A(t,"bpmn:Activity")||ql(t)||i&&!ax(i,t)||cO(t)?!1:"attach"}function yx(e,t,n){if(!t)return!1;var i={replacements:[]};return z(e,function(o){Vn(t)||A(o,"bpmn:StartEvent")&&o.type!=="label"&&Ia(o,t)&&(yT(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(vT(o)||bT(o)||xT(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),mx(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")&&Ia(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),A(o,"bpmn:BoundaryEvent")&&Fs(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function vx(e,t){return $o(e,aO)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Ia(n,t)})}function Zd(e,t,n,i){return t?it(e)||Xd(e)?!0:Ia(e,t)||Kl(e,t):!1}function bx(e,t,n){return A(e,"bpmn:SubProcess")?pt(e)&&(!t||t.width>=100&&t.height>=80):A(e,"bpmn:Lane")||A(e,"bpmn:Participant")?!0:Kd(e)?n?n==="e"||n==="w":!0:Xd(e)?!0:it(e)?n?n==="e"||n==="w":!0:!1}function lO(e,t){var n=Kd(e),i=Kd(t);return(n||i)&&n!==i}function xx(e,t){return fx(t,e)||fx(e,t)?!1:lO(e,t)?!0:!!Qd(e,t)}function wx(e,t){return ux(e,t)&&cx(e)&&A(t,"bpmn:Activity")&&!pO(t,e)&&!Vn(t)}function _x(e,t){return Cx(e)&&!Cx(t)?!1:J2(e)&&eO(t)&&!Q2(e,t)}function Ex(e,t){return tO(e)&&nO(t)&&ux(e,t)&&!(A(e,"bpmn:EventBasedGateway")&&!iO(t))}function Qd(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 Kl(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)&&A(e,"bpmn:FlowNode")&&!A(e,"bpmn:BoundaryEvent")&&Ia(e,t.parent)}function Jd(e,t){return e&&t&&e.indexOf(t)!==-1}function Sx(e,t){return it(t)?!0:!(A(t,"bpmn:Lane")&&!Jd(e,t.parent)||A(t,"bpmn:MessageFlow")&&!uO(e,t))}function uO(e,t){var n=Rx(t.source),i=Rx(t.target);return Jd(e,n)&&Jd(e,i)}function Rx(e){for(;e;e=e.parent)if(A(e,"bpmn:Participant"))return e;return null}function Cx(e){return Aa(e,"bpmn:Process")||Aa(e,"bpmn:Collaboration")}function pO(e,t){return e.attachers.includes(t)}const fO={__depends__:[no],__init__:["bpmnRules"],bpmnRules:["type",Ln]};var dO=2e3;function Mx(e,t){e.on("saveXML.start",dO,n);function n(){var i=t.getRootElements();z(i,function(o){var r=ht(o),a,s;a=_s([o]),a=rt(a,function(c){return c!==o&&!c.labelTarget}),s=jn(a,ht),r.set("planeElement",s)})}}Mx.$inject=["eventBus","canvas"];const hO={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Mx]};function Xl(e){ge.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)})}Xl.prototype.getOrdering=function(e,t){return null},Te(Xl,ge);function eh(e,t){Xl.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=Bt(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||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=Wg(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}}}eh.$inject=["eventBus","canvas"],Te(eh,Xl);const gO={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",eh]};function js(){}js.prototype.get=function(){return this._data},js.prototype.set=function(e){this._data=e},js.prototype.clear=function(){var e=this._data;return delete this._data,e},js.prototype.isEmpty=function(){return!this._data};const mO={clipboard:["type",js]};var Ax=1500;function Px(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",Ax,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Ax,function(c){s&&t.fire("element.out",{element:s,gfx:a})}),t.on("element.out",function(){a=null,s=null})})(),this._findTargetGfx=function(a){var s,c;if(a instanceof MouseEvent)return s=Br(a),c=document.elementFromPoint(s.x,s.y),yO(c)}}Px.$inject=["elementRegistry","eventBus","injector"];function yO(e){return kr(e,"svg, .djs-element",!0)}const vO={__init__:["hoverFix"],hoverFix:["type",Px]};function bO(e){return!0}function Zl(e){return ir(e)||S2(e)}var Tx=500;function kx(e,t,n){var i=this;function o(P,T,$){if(!s(P,T)){var j,G,Q;$?G=t.getGraphics($):(j=T.delegateTarget||T.target,j&&(G=j,$=t.get(G))),!(!G||!$)&&(Q=e.fire(P,{element:$,gfx:G,originalEvent:T}),Q===!1&&(T.stopPropagation(),T.preventDefault()))}}var r={};function a(P){return r[P]}function s(P,T){var $=l[P]||ir;return!$(T)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":bO,"element.mousedown":Zl,"element.mouseup":Zl,"element.click":Zl,"element.dblclick":Zl};function u(P,T,$){var j=c[P];if(!j)throw new Error("unmapped DOM event name <"+P+">");return o(j,T,$)}var p="svg, .djs-element";function f(P,T,$,j){var G=r[$]=function(Q){o($,Q)};j&&(l[$]=j),G.$delegate=ni.bind(P,p,T,G)}function d(P,T,$){var j=a($);j&&ni.unbind(P,T,j.$delegate)}function g(P){z(c,function(T,$){f(P,$,T)})}function h(P){z(c,function(T,$){d(P,$,T)})}e.on("canvas.destroy",function(P){h(P.svg)}),e.on("canvas.init",function(P){g(P.svg)}),e.on(["shape.added","connection.added"],function(P){var T=P.element,$=P.gfx;e.fire("interactionEvents.createHit",{element:T,gfx:$})}),e.on(["shape.changed","connection.changed"],Tx,function(P){var T=P.element,$=P.gfx;e.fire("interactionEvents.updateHit",{element:T,gfx:$})}),e.on("interactionEvents.createHit",Tx,function(P){var T=P.element,$=P.gfx;i.createDefaultHit(T,$)}),e.on("interactionEvents.updateHit",function(P){var T=P.element,$=P.gfx;i.updateDefaultHit(T,$)});var m=E("djs-hit djs-hit-stroke"),w=E("djs-hit djs-hit-click-stroke"),y=E("djs-hit djs-hit-all"),v=E("djs-hit djs-hit-no-move"),x={all:y,"click-stroke":w,stroke:m,"no-move":v};function E(P,T){return T=q({stroke:"white",strokeWidth:15},T||{}),n.cls(P,["no-fill","no-border"],T)}function C(P,T){var $=x[T];if(!$)throw new Error("invalid hit type <"+T+">");return Ce(P,$),P}function D(P,T){Xe(P,T)}this.removeHits=function(P){var T=ys(".djs-hit",P);z(T,an)},this.createDefaultHit=function(P,T){var $=P.waypoints,j=P.isFrame,G;return $?this.createWaypointsHit(T,$):(G=j?"stroke":"all",this.createBoxHit(T,G,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,T){var $=ws(T);return C($,"stroke"),D(P,$),$},this.createBoxHit=function(P,T,$){$=q({x:0,y:0},$);var j=Be("rect");return C(j,T),Ce(j,$),D(P,j),j},this.updateDefaultHit=function(P,T){var $=Ct(".djs-hit",T);if($)return P.waypoints?jf($,P.waypoints):Ce($,{width:P.width,height:P.height}),$},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}kx.$inject=["eventBus","elementRegistry","styles"];const Ql={__init__:["interactionEvents"],interactionEvents:["type",kx]};function Ba(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)})}Ba.$inject=["eventBus","canvas"],Ba.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()})}},Ba.prototype.get=function(){return Array.from(this._selectedElements)},Ba.prototype.isSelected=function(e){return this._selectedElements.has(e)},Ba.prototype.select=function(e,t){var n=this.get();Ue(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 Ox="hover",Dx="selected";function Lx(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,Ox)}),t.on("element.out",function(o){i(o.element,Ox)}),t.on("selection.changed",function(o){function r(l){i(l,Dx)}function a(l){n(l,Dx)}var s=new Set(o.oldSelection),c=new Set(o.newSelection);for(let l of s)c.has(l)||r(l);for(let l of c)s.has(l)||a(l)})}Lx.$inject=["canvas","eventBus"];function Ix(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;Ue(l)?t.select(l):t.select(s.filter(xO))}}),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=Bt(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(ir(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=Wl(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}Ix.$inject=["eventBus","selection","canvas","elementRegistry"];function xO(e){return!e.hidden}const Ci={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ql],selection:["type",Ba],selectionVisuals:["type",Lx],selectionBehavior:["type",Ix]};var wO=/^djs-cursor-.*$/;function Jl(e){var t=Mt(document.body);t.removeMatching(wO),e&&t.add("djs-cursor-"+e)}function Bx(){Jl(null)}var _O=5e3;function Nx(e,t){t=t||"element.click";function n(){return!1}return e.once(t,_O,n),function(){e.off(t,n)}}var EO=["c","C"],SO=["v","V"],RO=["d","D"],CO=["x","X"],MO=["y","Y"],$x=["z","Z"];function AO(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function ri(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function vn(e,t){return e=Ue(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function th(e){return e.shiftKey}function PO(e){return ri(e)&&vn(EO,e)}function TO(e){return ri(e)&&vn(SO,e)}function kO(e){return ri(e)&&vn(RO,e)}function OO(e){return ri(e)&&vn(CO,e)}function DO(e){return ri(e)&&!th(e)&&vn($x,e)}function LO(e){return ri(e)&&(vn(MO,e)||vn($x,e)&&th(e))}var Na=Math.round,Fx="djs-drag-active";function $r(e){e.preventDefault()}function IO(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 jx(e,t,n,i){var o={threshold:5,trapClick:!0},r;function a(v){var x=t.viewbox(),E=t._container.getBoundingClientRect();return{x:x.x+(v.x-E.left)/x.scale,y:x.y+(v.y-E.top)/x.scale}}function s(v,x){x=x||r;var E=e.createEvent(q({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+v,E)===!1?!1:e.fire(x.prefix+"."+v,E)}function c(v){var x=v.filter(function(E){return i.get(E.id)});x.length&&n.select(x)}function l(v,x){var E=r.payload,C=r.displacement,D=r.globalStart,P=Br(v),T=zi(P,D),$=r.localStart,j=a(P),G=zi(j,$);if(!r.active&&(x||BO(T)>r.threshold)){if(q(E,{x:Na($.x+C.x),y:Na($.y+C.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return m();r.active=!0,r.keepSelection||(E.previousSelection=n.get(),n.select(null)),r.cursor&&Jl(r.cursor),t.addMarker(t.getRootElement(),Fx)}Ld(v),r.active&&(q(E,{x:Na(j.x+C.x),y:Na(j.y+C.y),dx:Na(G.x),dy:Na(G.y)},{originalEvent:v}),s("move"))}function u(v){var x,E=!0;r.active&&(v&&(r.payload.originalEvent=v,Ld(v)),E=s("end")),E===!1&&s("rejected"),x=w(E!==!0),s("ended",x)}function p(v){vn("Escape",v)&&($r(v),m())}function f(v){var x;r.active&&(x=Nx(e),setTimeout(x,400),$r(v)),u(v)}function d(v){l(v)}function g(v){var x=r.payload;x.hoverGfx=v.gfx,x.hover=v.element,s("hover")}function h(v){s("out");var x=r.payload;x.hoverGfx=null,x.hover=null}function m(v){var x;if(r){var E=r.active;E&&s("cancel"),x=w(v),E&&s("canceled",x)}}function w(v){var x,E;s("cleanup"),Bx(),r.trapClick?E=f:E=u,je.unbind(document,"mousemove",l),je.unbind(document,"dragstart",$r),je.unbind(document,"selectstart",$r),je.unbind(document,"mousedown",E,!0),je.unbind(document,"mouseup",E,!0),je.unbind(document,"keyup",p),je.unbind(document,"touchstart",d,!0),je.unbind(document,"touchcancel",m,!0),je.unbind(document,"touchmove",l,!0),je.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),Fx);var C=r.payload.previousSelection;return v!==!1&&C&&!n.get().length&&c(C),x=r,r=null,x}function y(v,x,E,C){r&&m(!1),typeof x=="string"&&(C=E,E=x,x=null),C=q({},o,C||{});var D=C.data||{},P,T,$,j,G;if(C.trapClick?j=f:j=u,v?(P=La(v)||v,T=Br(v),Ld(v),P.type==="dragstart"&&$r(P)):(P=null,T={x:0,y:0}),$=a(T),x||(x=$),G=IO(P),r=q({prefix:E,data:D,payload:{},globalStart:T,displacement:zi(x,$),localStart:$,isTouch:G},C),C.manual||(G?(je.bind(document,"touchstart",d,!0),je.bind(document,"touchcancel",m,!0),je.bind(document,"touchmove",l,!0),je.bind(document,"touchend",u,!0)):(je.bind(document,"mousemove",l),je.bind(document,"dragstart",$r),je.bind(document,"selectstart",$r),je.bind(document,"mousedown",j,!0),je.bind(document,"mouseup",j,!0)),je.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return m(),!1;C.autoActivate&&l(v,!0)}e.on("diagram.destroy",m),this.init=y,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=m,this.context=function(){return r},this.setOptions=function(v){q(o,v)}}jx.$inject=["eventBus","canvas","selection","elementRegistry"];const Ro={__depends__:[vO,Ci],dragging:["type",jx]};function Fr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Fr.prototype.next=function(){return this._prefix+ ++this._counter};const NO=new Fr("ps");var $O=["marker-start","marker-mid","marker-end"],FO=["circle","ellipse","line","path","polygon","polyline","path","rect"];function or(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}or.$inject=["elementRegistry","eventBus","canvas","styles"],or.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")},or.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},or.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=Of(n);return this._cloneMarkers(Zo(o),i),Ce(o,this._styles.cls(i,[])),Xe(t,o),Ce(o,"data-preview-support-element-id",e.id),o},or.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 Xe(t,n),Ce(n,"data-preview-support-element-id",e.id),n},or.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),GO(e)&&$O.forEach(function(o){if(Ce(e,o)){var r=jO(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},or.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,NO.next()].join("-"),a=Ct("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Of(n);s.id=r,ut(s).add(o);var c=Ct(":scope > defs",e);c||(c=Be("defs"),Xe(e,c)),Xe(c,s);var l=zO(s.id);Ce(t,i,l)};function jO(e,t,n){var i=HO(Ce(e,t));return Ct("marker#"+i,n||document)}function HO(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function zO(e){return"url(#"+e+")"}function GO(e){return FO.indexOf(e.nodeName)!==-1}const $a={__init__:["previewSupport"],previewSupport:["type",or]};var VO="drop-ok",Hx="drop-not-ok",zx="attach-ok",Gx="new-parent",Vx="create",WO=2e3;function Wx(e,t,n,i,o){function r(c,l,u,p,f){if(!l)return!1;c=rt(c,function(y){var v=y.labelTarget;return!y.parent&&!(it(y)&&c.indexOf(v)!==-1)});var d=Bt(c,function(y){return!Ot(y)}),g=!1,h=!1,m=!1;qx(c)&&(g=o.allowed("shape.attach",{position:u,shape:d,target:l})),g||(qx(c)?m=o.allowed("shape.create",{position:u,shape:d,source:p,target:l}):m=o.allowed("elements.create",{elements:c,position:u,target:l}));var w=f.connectionTarget;return m||g?(d&&p&&(h=o.allowed("connection.create",{source:w===p?d:p,target:w===p?p:d,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):m===null||g===null?null:!1}function a(c,l){[zx,VO,Hx,Gx].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}Ux(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,zx):a(p,h?Gx:Hx))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,p=l.shape,f=l.elements,d=l.target,g=l.canExecute,h=g&&g.attach,m=g&&g.connect,w=l.hints||{};if(g===!1||!d)return!1;Ux(c);var y={x:c.x,y:c.y};m?p=i.appendShape(u,p,y,d,{attach:h,connection:m===!0?{}:m,connectionTarget:w.connectionTarget}):(f=i.createElements(f,y,d,q({},w,{attach:h})),p=Bt(f,function(v){return!Ot(v)})),q(l,{elements:f,shape:p}),q(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Vx&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],WO,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Ue(l)||(l=[l]);var p=Bt(l,function(g){return!Ot(g)});if(p){u=q({elements:l,hints:{},shape:p},u||{}),z(l,function(g){qe(g.x)||(g.x=0),qe(g.y)||(g.y=0)});var f=rt(l,function(g){return!g.hidden}),d=sn(f);z(l,function(g){Ot(g)&&(g.waypoints=jn(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),q(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,Vx,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}Wx.$inject=["canvas","dragging","eventBus","modeling","rules"];function Ux(e){var t=e.context,n=t.createConstraints;n&&(n.left&&(e.x=Math.max(e.x,n.left)),n.right&&(e.x=Math.min(e.x,n.right)),n.top&&(e.y=Math.max(e.y,n.top)),n.bottom&&(e.y=Math.min(e.y,n.bottom)))}function qx(e){return e&&e.length===1&&!Ot(e[0])}var UO=750;function Yx(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(Zo(u),l)):(u=n._createContainer("shape",c),n.drawShape(Zo(u),l),Dn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",UO,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=r(l));var p;s?(u.parentNode||(p=e.getActiveLayer(),Xe(p,u)),Dn(u,a.x,a.y)):an(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&an(c)})}Yx.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const eu={__depends__:[Ro,$a,no,Ci],__init__:["create","createPreview"],create:["type",Wx],createPreview:["type",Yx]};function nh(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)})}nh.$inject=["eventBus"],nh.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||qO(0,0)};function qO(e,t){var n=document.createEvent("MouseEvent"),i=e,o=t,r=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,o,r,a,!1,!1,!1,!1,0,null),n}const Hs={__init__:["mouse"],mouse:["type",nh]};var Kx=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),YO(u)&&(l.priority=2,l.host=u.host.id),Ot(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=KO(u)),it(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),z(["x","y","width","height"],function(f){qe(u[f])&&(l[f]=u[f])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",Kx,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",Kx,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;q(l,{createElementsBehavior:!1})})}ai.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],ai.prototype.copy=function(e,t={}){var n,i;return Ue(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Ue(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){qe(r.x)||(r.x=0),qe(r.y)||(r.y=0)});var o=sn(e);return z(e,function(r){Ot(r)&&(r.waypoints=jn(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),q(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,q({},i))},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=q({},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(Ot(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)),!(Ot(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=fl(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=r.get(p);if(!d){var g={element:p,depth:f};o.push(g),r.set(p,g);return}if(d.depth<f){o=l(d,o);var h={element:d.element,depth:f};o.push(h),r.set(p,h)}}function l(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Dr(a,function(p,f,d){if(it(p))return;z(p.labels,function(m){c(m,d)});function g(m){m&&m.length&&z(m,function(w){z(w.labels,function(y){c(y,d)}),c(w,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=jn(o,function(p){return p.element});var u=new Set(e);return o=jn(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=jn(o,function(p){return p.element}),z(o,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,u)){Zx(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){Zx(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function YO(e){return!!e.host}function KO(e){return jn(e.waypoints,function(t){return t=Xx(t),t.original&&(t.original=Xx(t.original)),t})}function Xx(e){return q({},e)}function Zx(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const XO={__depends__:[mO,eu,Hs,no],__init__:["copyPaste"],copyPaste:["type",ai]};function ih(e,t,n){Ue(n)||(n=[n]),z(n,function(i){Sr(e[i])||(t[i]=e[i])})}var oh=750;function Qx(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",oh,function(c){var l=c.descriptor,u=c.element,p=me(u);if(it(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(ht(u),!0);d.bpmnElement=f,ih(f,l,"name"),ih(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=me(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(me(c).attachedToRef=me(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=me(l[u.labelTarget]),u.di=ht(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,ih(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",oh,function(c){var l=c.descriptor,u=c.element;if(A(u,"bpmn:Participant")){var p=me(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")&&z(As(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",oh,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}Qx.$inject=["bpmnFactory","eventBus","moddleCopy"];const ZO=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],QO=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function zs(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:o}=i;if(!(!o||!o.length))return Ui(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=mn(o)&&o.$descriptor;if(a&&QO.includes(a))return r;if(a&&ZO.includes(a)||a&&s&&!Bt(s.properties,ca({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})}zs.$inject=["eventBus","bpmnFactory","moddle"],zs.prototype.copyElement=function(e,t,n,i=!1){n&&!Ue(n)&&(n=[n]),n=n||rh(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||(Ue(o)&&(n=o),z(n,r=>{let a;ei(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!gn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},zs.prototype.copyProperty=function(e,t,n,i=!1){let o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(o===!1)return;if(o)return mn(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):Ue(e)?ti(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):mn(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(o=this._bpmnFactory.create(e.$type),o.$parent=t,o=this.copyElement(e,o,null,i),o):e},zs.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function rh(e,t){return ti(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Jx={__depends__:[XO],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Qx],moddleCopy:["type",zs]};var ew=Math.round;function ah(e,t){this._modeling=e,this._eventBus=t}ah.$inject=["modeling","eventBus"],ah.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=ew(s+r/2),u=ew(c+a/2),p=i.replaceShape(e,q({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function tw(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}tw.$inject=["selection","eventBus"];const JO={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",tw],replace:["type",ah]};function eD(e,t,n){Ue(n)||(n=[n]),z(n,function(i){Sr(e[i])||(t[i]=e[i])})}var tD=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function nD(e,t){var n=e&&ei(e,"collapsed")?e.collapsed:!pt(e),i;return t&&(ei(t,"collapsed")||ei(t,"isExpanded"))?i=ei(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function nw(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(tu(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&nD(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),eD(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=rh(p.$descriptor),h=rh(f.$descriptor,!0),m=iD(g,h);q(f,Bi(c,tD));var w=rt(m,function(x){return x==="eventDefinitions"?iw(s,c.eventDefinitionType):x==="loopCharacteristics"?!Vn(f):ei(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!Vn(f):!0});if(f=n.copyElement(p,f,w),c.eventDefinitionType&&(iw(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),A(p,"bpmn:Activity")){if(tu(p))d.isExpanded=pt(s);else if(c&&ei(c,"isExpanded")){d.isExpanded=c.isExpanded;var y=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=y.width,d.height=y.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}pt(s)&&!A(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(tu(p)&&!tu(f)&&(l.moveChildren=!1),A(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var v=_n(s);ht(s).isHorizontal||(ht(d).isHorizontal=v),d.width=v?s.width:t.getDefaultSize(d).width,d.height=v?t.getDefaultSize(d).height:s.height}return r.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,ot(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ot(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}nw.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function tu(e){return A(e,"bpmn:SubProcess")}function iw(e,t){var n=me(e);return t&&n.get("eventDefinitions").some(function(i){return A(i,t)})}function iD(e,t){return e.filter(function(n){return t.includes(n)})}const ow={__depends__:[Jx,JO,Ci],bpmnReplace:["type",nw]};var oD=250;function jr(e){this._eventBus=e,this._tools=[],this._active=null}jr.$inject=["eventBus"],jr.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},jr.prototype.isActive=function(e){return e&&this._active===e},jr.prototype.length=function(e){return this._tools.length},jr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},jr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(o){var r=o.context;if(!r.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),z(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,oD,function(o){this._active&&(rD(o)||this.setActive(null))},this)};function rD(e){var t=e.originalEvent&&e.originalEvent.target;return t&&kr(t,'.group[data-group="tools"]')}const nu={__depends__:[Ro],__init__:["toolManager"],toolManager:["type",jr]};function aD(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 sD(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 cD(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 sh=Math.abs,lD=Math.round,Co={x:"width",y:"height"},rw="crosshair",rr={n:"top",w:"left",s:"bottom",e:"right"},uD=1500,iu={n:"s",w:"e",s:"n",e:"w"},ou=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",uD,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&sw(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){sw(c);var h={x:0,y:0};h[u]=lD(c["d"+u]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(m){s.activateSelection(m.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:rw,data:{context:{reactivate:n}},trapClick:!1})},Mi.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:rw,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=sh(e.dx)>sh(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(sh(i)<5)return!1;i<0&&(i*=-1),$s(e)&&(i*=-1);var r=aD(n,i),a=this._canvas.getRootElement();!Wl(e)&&e.hover&&(a=e.hover);var s=[..._s(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,o),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:r,shapes:c.resizingShapes,start:o}),u=pD(c,n,r,o,l);return q(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),Jl("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 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(Ot(d)){u.push(d);return}var g=d[t],h=g+d[Co[t]];if(fD(d)&&(n>0&&Ye(d)[t]>i||n<0&&Ye(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}},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 aw(e){return{top:e.top-ou,right:e.right+ou,bottom:e.bottom+ou,left:e.left-ou}}function sw(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;qe(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),qe(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),qe(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),qe(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function pD(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=ze(f),m=rt(g,function(G){return!Ot(G)&&!it(G)&&!u.has(G)&&!p.has(G)}),w=rt(g,function(G){return!Ot(G)&&!it(G)&&u.has(G)}),y,v,x,E=[],C=[],D,P,T,$;m.length&&(v=aw(ze(sn(m))),y=i-h[rr[n]]+v[rr[n]],n==="n"?s.bottom=l=qe(l)?Math.min(l,y):y:n==="w"?s.right=l=qe(l)?Math.min(l,y):y:n==="s"?s.top=c=qe(c)?Math.max(c,y):y:n==="e"&&(s.left=c=qe(c)?Math.max(c,y):y)),w.length&&(x=aw(ze(sn(w))),y=i-x[rr[iu[n]]]+h[rr[iu[n]]],n==="n"?s.bottom=l=qe(l)?Math.min(l,y):y:n==="w"?s.right=l=qe(l)?Math.min(l,y):y:n==="s"?s.top=c=qe(c)?Math.max(c,y):y:n==="e"&&(s.left=c=qe(c)?Math.max(c,y):y)),d&&d.length&&(d.forEach(function(G){u.has(G)?E.push(G):C.push(G)}),E.length&&(D=ze(sn(E.map(Ye))),P=h[rr[iu[n]]]-(D[rr[iu[n]]]-i)),C.length&&(T=ze(sn(C.map(Ye))),$=T[rr[n]]-(h[rr[n]]-i)),n==="n"?(y=Math.min(P||1/0,$||1/0),s.bottom=l=qe(l)?Math.min(l,y):y):n==="w"?(y=Math.min(P||1/0,$||1/0),s.right=l=qe(l)?Math.min(l,y):y):n==="s"?(y=Math.max(P||-1/0,$||-1/0),s.top=c=qe(c)?Math.max(c,y):y):n==="e"&&(y=Math.max(P||-1/0,$||-1/0),s.left=c=qe(c)?Math.max(c,y):y));var j=o&&o[f.id];j&&(n==="n"?(y=i+f[Co[t]]-j[Co[t]],s.bottom=l=qe(l)?Math.min(l,y):y):n==="w"?(y=i+f[Co[t]]-j[Co[t]],s.right=l=qe(l)?Math.min(l,y):y):n==="s"?(y=i-f[Co[t]]+j[Co[t]],s.top=c=qe(c)?Math.max(c,y):y):n==="e"&&(y=i-f[Co[t]]+j[Co[t]],s.left=c=qe(c)?Math.max(c,y):y))}),s}}function fD(e){return!!e.host}var ch="djs-dragging",cw="djs-resizing",dD=250,ru=Math.max;function lw(e,t,n,i,o){function r(a,s){z(a,function(c){o.addDragger(c,s),n.addMarker(c,ch)})}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"])),Xe(s,u);var p=Be("path");Ce(p,"d",l.x),ut(p).add("djs-crosshair"),Xe(u,p);var f=Be("path");Ce(f,"d",l.y),ut(f).add("djs-crosshair"),Xe(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&&an(c)}),e.on("spaceTool.move",dD,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"),ut(c).add("djs-crosshair"),Xe(f,c),s.line=c;var d=Be("g");Ce(d,i.cls("djs-drag-group",["no-events"])),Xe(n.getActiveLayer(),d),r(u,d);var g=new Set(u);z(p,function(C){g.add(C)});var h=new Set,m=s.movingConnections=[];g.forEach(function(C){z(C.outgoing,function(D){h.has(D)||!Ot(D)||!g.has(D.target)||(h.add(D),m.push(D))})}),r(m,d),s.dragGroup=d}if(!s.frameGroup){var w=Be("g");Ce(w,i.cls("djs-frame-group",["no-events"])),Xe(n.getActiveLayer(),w);var y=[];z(p,function(C){var D=o.addFrame(C,w),P=D.getBBox();y.push({element:D,initialBounds:P}),n.addMarker(C,cw)}),s.frameGroup=w,s.frames=y}var v={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Ce(c,{d:v[l]});var x={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[x[s.axis]]=0,Dn(s.dragGroup,E.x,E.y),z(s.frames,function(C){var D=C.element,P=C.initialBounds,T,$;s.direction==="e"?Ce(D,{width:ru(P.width+E.x,5)}):(T=ru(P.width-E.x,5),Ce(D,{width:T,x:P.x+P.width-T})),s.direction==="s"?Ce(D,{height:ru(P.height+E.y,5)}):($=ru(P.height-E.y,5),Ce(D,{height:$,y:P.y+P.height-$}))})}}),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,ch)}),z(l,function(g){n.removeMarker(g,ch)}),f&&(an(p),an(f)),z(u,function(g){n.removeMarker(g,cw)}),d&&an(d)})}lw.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const hD={__init__:["spaceToolPreview"],__depends__:[Ro,no,nu,$a,Hs],spaceTool:["type",Mi],spaceToolPreview:["type",lw]};function au(e,t){e.invoke(Mi,this),this._canvas=t}au.$inject=["injector","canvas"],Te(au,Mi),au.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=aa(wa(o.children.filter(l=>A(l,"bpmn:Artifact")),sn(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")||gD(l)&&(t==="y"&&_n(l)||t==="x"&&!_n(l)))}),c};function gD(e){return A(e,"bpmn:Participant")&&!me(e).processRef}const uw={__depends__:[hD],spaceTool:["type",au]};function Kt(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Kt.$inject=["eventBus","injector"],Kt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Kt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let o=this._fire(e,"canExecute",n);if(o===void 0){if(!i)return!1;i.canExecute&&(o=i.canExecute(t))}return o},Kt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Kt.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Kt.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Kt.prototype.register=function(e,t){this._setHandler(e,t)},Kt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Kt.prototype.canUndo=function(){return!!this._getUndoAction()},Kt.prototype.canRedo=function(){return!!this._getRedoAction()},Kt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Kt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Kt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},Kt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let o;n=this._eventBus.createEvent(n);for(const r of i)if(o=this._eventBus.fire("commandStack."+r,n),n.cancelBubble)break;return o},Kt.prototype._createId=function(){return this._uid++},Kt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Kt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,o=this._getHandler(n);if(!o)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),o.preExecute&&o.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),o.execute&&this._markDirty(o.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),o.postExecute&&o.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Kt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Kt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Ug("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Kt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Ue(e)?e:[e],t.dirty=t.dirty.concat(e))},Kt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Kt.prototype._revertedAction=function(e){this._stackIdx--},Kt.prototype._getHandler=function(e){return this._handlerMap[e]},Kt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const mD={commandStack:["type",Kt]};function ar(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 yD=250,pw=1400;function lh(e,t,n){ge.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",pw,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=fw(a),r.validatedShapes=fw(s)}),i&&t.on("shape.move.start",yD,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",pw,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;ar(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=zf(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&&(nn(s.labels,a,c),a.labelTarget=s)})}Te(lh,ge),lh.$inject=["injector","eventBus","modeling"];function fw(e){var t=new Set(e);return rt(e,function(n){return!t.has(n.labelTarget)})}const vD={__init__:["labelSupport"],labelSupport:["type",lh]};var bD=251,dw=1401,hw="attach-ok";function uh(e,t,n,i,o){ge.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",dw,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=xD(c),s.validatedShapes=wD(l)}),r&&t.on("shape.move.start",bD,function(a){var s=a.context,c=s.shapes,l=ph(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,hw),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,hw)}))}}),this.preExecuted("elements.move",dw,function(a){var s=a.context,c=s.closure,l=s.shapes,u=ph(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 _D(p)&&!ED(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;ar(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=Ob(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=Ob(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;ar(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}Te(uh,ge),uh.$inject=["injector","eventBus","canvas","rules","modeling"];function ph(e){return Tp(jn(e,function(t){return t.attachers||[]}))}function xD(e){var t=ph(e);return SS("id",e,t)}function wD(e){var t=sa(e,"id");return rt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function _D(e){return!!e.host}function ED(e,t){return e.indexOf(t)!==-1}const SD={__depends__:[no],__init__:["attachSupport"],attachSupport:["type",uh]};function gw(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(sv(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)})}gw.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const fh={__init__:["changeSupport"],changeSupport:["type",gw]};function Ai(e){this._model=e}Ai.$inject=["moddle"],Ai.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"])},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":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))},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",q({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 jn(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",q({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Ai.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",q({bpmnElement:e},t))};function si(e,t,n){ge.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(w){A(w,"bpmn:BaseElement")&&i.updateParent(w)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;A(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,w=g.newSource,y=me(h),v=me(m),x=me(w);y.conditionExpression&&!ot(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=y.conditionExpression,delete y.conditionExpression),m!==w&&v.default===y&&(g.oldDefault=v.default,delete v.default)})),this.reverted("connection.reconnect",ci(function(d){var g=d.context,h=g.connection,m=g.oldSource,w=g.newSource,y=me(h),v=me(m),x=me(w);g.oldConditionExpression&&(y.conditionExpression=g.oldConditionExpression),g.oldDefault&&(v.default=g.oldDefault,delete x.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],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=ht(g),w=m&&m.get("label");Jo(g)||Ul(g)||(h&&!w?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&w&&m.set("label",void 0))}}Te(si,ge),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)&&!(A(e,"bpmn:DataStoreReference")&&e.parent&&A(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=ht(e),r=n&&n.businessObject,a=ht(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)}},si.prototype.updateBounds=function(e){var t=ht(e),n=CD(e);if(n){var i=zi(n,t.get("bounds"));q(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)),q(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;A(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),tn(i,e)),A(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),nn(o,e))}},si.prototype.updateDiConnection=function(e,t,n){var i=ht(e),o=ht(t),r=ht(n);i.sourceElement&&i.sourceElement.bpmnElement!==me(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==me(n)&&(i.targetElement=n&&r)},si.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):(tn(n,e),e.$parent=null)}};function RD(e){for(;e&&!A(e,"bpmn:Definitions");)e=e.$parent;return e}si.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)},si.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=RD(e.$parent||t),e.$parent&&(tn(r.get("rootElements"),o),o.$parent=null),t&&(nn(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),tn(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);tn(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},si.prototype.updateConnectionWaypoints=function(e){var t=ht(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},si.prototype.updateConnection=function(e){var t=e.connection,n=me(t),i=t.source,o=me(i),r=t.target,a=me(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&&(tn(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(tn(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;A(i,"bpmn:BaseElement")&&e(t)}}function CD(e){if(A(e,"bpmn:Activity")){var t=ht(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function sr(e,t){wo.call(this),this._bpmnFactory=e,this._moddle=t}Te(sr,wo),sr.$inject=["bpmnFactory","moddle"],sr.prototype._baseCreate=wo.prototype.create,sr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,q({type:"label",di:n},Lr,t))}return this.createElement(e,t)},sr.prototype.createElement=function(e,t){t=q({},t||{});var n,i=t.businessObject,o=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!AD(o)){var r=q({},o||{},{id:i.id+"_di"});e==="root"?o=this._bpmnFactory.createDiPlane(i,r):e==="connection"?o=this._bpmnFactory.createDiEdge(i,r):o=this._bpmnFactory.createDiShape(i,r)}A(i,"bpmn:Group")&&(t=q({isFrame:!0},t)),t=MD(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=dh(o,t,"isExpanded")),ot(i,["bpmn:Lane","bpmn:Participant"])&&(t=dh(o,t,"isHorizontal")),A(i,"bpmn:SubProcess")&&(t.collapsed=!pt(i,o)),A(i,"bpmn:ExclusiveGateway")&&(ei(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),gn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),gn(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,o),t=q({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},sr.prototype.getDefaultSize=function(e,t){var n=me(e);if(t=t||ht(e),A(n,"bpmn:SubProcess"))return pt(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 pt(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}},sr.prototype.createParticipantShape=function(e){return mn(e)||(e={isExpanded:e}),e=q({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function MD(e,t,n){return z(n,function(i){t=dh(e,t,i)}),t}function dh(e,t,n){return t[n]===void 0?t:(e[n]=t[n],qi(t,[n]))}function AD(e){return ot(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function su(e,t){this._modeling=e,this._canvas=t}su.$inject=["modeling","canvas"],su.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;z(n,function(o){var r={x:0,y:0};gn(i.left)?r.x=i.left-o.x:gn(i.right)?r.x=i.right-o.width-o.x:gn(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:gn(i.top)?r.y=i.top-o.y:gn(i.bottom)?r.y=i.bottom-o.height-o.y:gn(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},su.prototype.postExecute=function(e){};function cu(e){this._modeling=e}cu.$inject=["modeling"],cu.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,o=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:o.attach}),e.shape=i},cu.prototype.postExecute=function(e){var t=e.hints||{};PD(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 PD(e,t){return $o(e.outgoing,function(n){return n.target===t})}function lu(e,t){this._canvas=e,this._layouter=t}lu.$inject=["canvas","layouter"],lu.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},lu.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var uu=Math.round;function hh(e){this._modeling=e}hh.$inject=["modeling"],hh.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){qe(p.x)||(p.x=0),qe(p.y)||(p.y=0)});var s=rt(t,function(p){return!p.hidden}),c=sn(s);z(t,function(p){Ot(p)&&(p.waypoints=jn(p.waypoints,function(f){return{x:uu(f.x-c.x-c.width/2+o.x),y:uu(f.y-c.y-c.height/2+o.y)}})),q(p,{x:uu(p.x-c.x-c.width/2+o.x),y:uu(p.y-c.y-c.height/2+o.y)})});var l=new Set(fl(t)),u={};z(t,function(p){if(Ot(p)){u[p.id]=qe(i)?a.createConnection(u[p.source.id],u[p.target.id],i,p,p.parent||n,r):a.createConnection(u[p.source.id],u[p.target.id],p,p.parent||n,r);return}var f=q({},r);l.has(p)||(f.autoResize=!1),it(p)&&(f=qi(f,["attach"])),u[p.id]=qe(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=aa(u)};var mw=Math.round;function cr(e){this._canvas=e}cr.$inject=["canvas"],cr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,o=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?q(t,n):q(t,{x:n.x-mw(t.width/2),y:n.y-mw(t.height/2)}),this._canvas.addShape(t,i,o),t},cr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Gs(e){cr.call(this,e)}Te(Gs,cr),Gs.$inject=["canvas"];var TD=cr.prototype.execute;Gs.prototype.execute=function(e){var t=e.shape;return OD(t),t.labelTarget=e.labelTarget,TD.call(this,e)};var kD=cr.prototype.revert;Gs.prototype.revert=function(e){return e.shape.labelTarget=null,kD.call(this,e)};function OD(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Vs(e,t){this._canvas=e,this._modeling=t}Vs.$inject=["canvas","modeling"],Vs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;ar(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ar(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Vs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=zf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Vs.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,nn(n.children,t,i),this._canvas.addConnection(t,n),t};function gh(e,t){this._modeling=e,this._elementRegistry=t}gh.$inject=["modeling","elementRegistry"],gh.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 Ws(e,t){this._canvas=e,this._modeling=t}Ws.$inject=["canvas","modeling"],Ws.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;ar(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ar(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),ar(n.children,function(i){Ot(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Ws.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=zf(i.children,n),t.removeShape(n),n},Ws.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return nn(i.children,n,o),t.addShape(n,i),n};function pu(e){this._modeling=e}pu.$inject=["modeling"];var yw={x:"y",y:"x"};pu.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(m,w){m.range.min=Math.min(w[i],m.range.min),m.range.max=Math.max(w[i]+w[o],m.range.max)}function a(m){return m[i]+m[o]/2}function s(m){return m.length-1}function c(m){return m.max-m.min}function l(m,w){var y={y:0};y[i]=m-a(w),y[i]&&(y[yw[i]]=0,t.moveElements([w],y,w.parent))}var u=n[0],p=s(n),f=n[p],d,g,h=0;z(n,function(m,w){var y,v,x;if(m.elements.length<2){w&&w!==n.length-1&&(r(m,m.elements[0]),h+=c(m.range));return}y=Ui(m.elements,i),v=y[0],w===p&&(v=y[s(y)]),x=a(v),m.range=null,z(y,function(E){if(l(x,E),m.range===null){m.range={min:E[i],max:E[i]+E[o]};return}r(m,E)}),w&&w!==n.length-1&&(h+=c(m.range))}),g=Math.abs(f.range.min-u.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&z(n,function(m,w){var y={},v;m===u||m===f||(v=n[w-1],m.range.max=0,z(m.elements,function(x,E){y[yw[i]]=0,y[i]=v.range.max-x[i]+d,m.range.min!==x[i]&&(y[i]+=x[i]-m.range.min),y[i]&&t.moveElements([x],y,x.parent),m.range.max=Math.max(x[i]+x[o],E?m.range.max:0)}))})},pu.prototype.postExecute=function(e){};function fu(e,t){this._layouter=e,this._canvas=t}fu.$inject=["layouter","canvas"],fu.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return q(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},fu.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function mh(){}mh.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=tn(r.children,t),nn(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},mh.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return tn(n.children,t),nn(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 yh(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}yh.prototype.add=function(e,t){return this.addAll([e],t)},yh.prototype.addAll=function(e,t){var n=cP(e,!!t,this);return q(this,n),this};function Us(e){this._modeling=e}Us.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Us.prototype.moveClosure=function(e,t,n,i,o){var r=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;o&&o.parent===n&&(u=!0),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&&Sd(p,p.source,t),connectionEnd:d&&Rd(p,p.target,t)})})},Us.prototype.getClosure=function(e){return new yh().addAll(e,!0)};function du(e){this._helper=new Us(e)}du.$inject=["modeling"],du.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},du.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function Hr(e){this._modeling=e,this._helper=new Us(e)}Hr.$inject=["modeling"],Hr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,o=e.newParentIndex,r=t.parent;return e.oldBounds=Bi(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=tn(r.children,t),nn(i.children,t,o),q(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Hr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(z(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:Rd(r,t,n)})}),z(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:Sd(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Hr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return nn(n.children,t,i),q(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},Hr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Hr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function qs(e){this._modeling=e}qs.$inject=["modeling"],qs.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,o=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return Ue(o)&&(e.oldWaypoints=i.waypoints,i.waypoints=o),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},qs.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,o=e.dockingOrPoints,r=e.hints||{},a={};r.connectionStart&&(a.connectionStart=r.connectionStart),r.connectionEnd&&(a.connectionEnd=r.connectionEnd),r.layoutConnection!==!1&&(n&&(!i||r.docking==="source")&&(a.connectionStart=a.connectionStart||vw(Ue(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||vw(Ue(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},qs.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,o=e.connection;return t&&(o.source=t),n&&(o.target=n),i&&(o.waypoints=i),o};function vw(e){return e.original||e}function Mo(e,t){this._modeling=e,this._rules=t}Mo.$inject=["modeling","rules"],Mo.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,o=e.oldShape,r=e.newData,a=e.hints||{},s;function c(g,h,m){return i.allowed("connection.reconnect",{connection:m,source:g,target:h})}var l={x:r.x,y:r.y},u={x:o.x,y:o.y,width:o.width,height:o.height};s=e.newShape=e.newShape||t.createShape(r,l,o.parent,a),o.host&&n.updateAttachment(s,o.host);var p;a.moveChildren!==!1&&(p=o.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=o.incoming.slice(),d=o.outgoing.slice();z(f,function(g){var h=g.source,m=c(h,s,g);m&&t.reconnectEnd(g,s,jl(g,s,u),a)}),z(d,function(g){var h=g.target,m=c(s,h,g);m&&t.reconnectStart(g,s,Fl(g,s,u),a)})},Mo.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Mo.prototype.execute=function(e){},Mo.prototype.revert=function(e){},Mo.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Mo.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Mo.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Ys(e){this._modeling=e}Ys.$inject=["modeling"],Ys.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},q(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ys.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(z(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:jl(r,n,i)})}),z(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:Fl(r,n,i)})}))},Ys.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return q(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function lr(e){this._modeling=e}lr.$inject=["modeling"],lr.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]=LD(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(sD(i,o),t,n,r,i,o,a)},lr.prototype.execute=function(){},lr.prototype.revert=function(){},lr.prototype.moveShapes=function(e,t){var n=this;z(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},lr.prototype.resizeShapes=function(e,t,n){var i=this;z(e,function(o){var r=cD(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},lr.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=DD(u),g=xw(n),h={},m=c.has(p)||l.has(p),w=c.has(f)||l.has(f);m&&w?(d=jn(d,function(y){return ww(y,i,n)&&(y[g]=y[g]+t[g]),y.original&&ww(y.original,i,n)&&(y.original[g]=y.original[g]+t[g]),y}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(m||w)&&(c.has(p)?h.connectionStart=Sd(u,p,t):c.has(f)?h.connectionEnd=Rd(u,f,t):l.has(p)?h.connectionStart=Fl(u,p,a[p.id]):l.has(f)&&(h.connectionEnd=jl(u,f,a[f.id])),s._modeling.layoutConnection(u,h))})};function bw(e){return q({},e)}function DD(e){return jn(e.waypoints,function(t){return t=bw(t),t.original&&(t.original=bw(t.original)),t})}function xw(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function ww(e,t,n){var i=xw(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function LD(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function hu(e){this._modeling=e}hu.$inject=["modeling"],hu.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=_w(n),t.collapsed=!t.collapsed;var i=Ew(n,t.collapsed);return[t].concat(i)},hu.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=Sw(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function _w(e){var t={};return z(e,function(n){t[n.id]=n.hidden,n.children&&(t=q({},t,_w(n.children)))}),t}function Ew(e,t){var n=[];return z(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Ew(i.children,i.collapsed||t)))}),n}function Sw(e,t){var n=[];return z(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Sw(i.children,t)))}),n}function gu(e){this._modeling=e}gu.$inject=["modeling"],gu.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Rw(i,t),Cw(n,t),t.host=n,t},gu.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,Rw(n,t),Cw(i,t,o),t};function Rw(e,t){return tn(e&&e.attachers,t)}function Cw(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),nn(i,t,n)}}function vh(){}vh.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},vh.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Dt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Dt.$inject=["eventBus","elementFactory","commandStack"],Dt.prototype.getHandlers=function(){return{"shape.append":cu,"shape.create":cr,"shape.delete":Ws,"shape.move":Hr,"shape.resize":Ys,"shape.replace":Mo,"shape.toggleCollapse":hu,spaceTool:lr,"label.create":Gs,"connection.create":lu,"connection.delete":Vs,"connection.move":mh,"connection.layout":fu,"connection.updateWaypoints":vh,"connection.reconnect":qs,"elements.create":hh,"elements.move":du,"elements.delete":gh,"elements.distribute":pu,"elements.align":su,"element.updateAttachment":gu}},Dt.prototype.registerHandlers=function(e){z(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Dt.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)},Dt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Dt.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)},Dt.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)},Dt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Dt.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},Dt.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},Dt.prototype.createElements=function(e,t,n,i,o){Ue(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},Dt.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},Dt.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},Dt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Dt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Dt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Dt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Dt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Dt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Dt.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},Dt.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)},Dt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Dt.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)},Dt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,q(i,{docking:"source"}))},Dt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,q(i,{docking:"target"}))},Dt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Dt.prototype._create=function(e,t){return qP(t)?t:this._elementFactory.create(e,t)},Dt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ks(e){this._elementRegistry=e}Ks.$inject=["elementRegistry"],Ks.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var o=e.changed||this._getVisualReferences(n).concat(t),r=e.oldProperties||ID(n,Tc(i));return Mw(n,i),e.oldProperties=r,e.changed=o,o},Ks.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Mw(n,t),i},Ks.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return A(e,"bpmn:DataObject")?BD(e,t):[]};function ID(e,t){return ti(t,function(n,i){return n[i]=e.get(i),n},{})}function Mw(e,t){z(t,function(n,i){e.set(i,n)})}function BD(e,t){return t.filter(function(n){return A(n,"bpmn:DataObjectReference")&&me(n).dataObjectRef===e})}var Xs="default",Ao="id",Aw="di",ND={width:0,height:0};function Zs(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Zs.$inject=["elementRegistry","moddle","modeling","textRenderer"],Zs.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,o=this._moddle.ids,r=t.businessObject,a=zD(e.properties),s=e.oldProperties||$D(t,a);return Pw(a,r)&&(o.unclaim(r[Ao]),i.updateId(t,a[Ao]),o.claim(a[Ao],r)),Xs in a&&(a[Xs]&&n.push(i.get(a[Xs].id)),r[Xs]&&n.push(i.get(r[Xs].id))),Tw(t,a),e.oldProperties=s,e.changed=n,n},Zs.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&me(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,ND)}},Zs.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,o=t.businessObject,r=this._elementRegistry,a=this._moddle.ids;return Tw(t,i),Pw(n,o)&&(a.unclaim(n[Ao]),r.updateId(t,i[Ao]),a.claim(i[Ao],o)),e.changed};function Pw(e,t){return Ao in e&&e[Ao]!==t[Ao]}function $D(e,t){var n=Tc(t),i=e.businessObject,o=ht(e);return ti(n,function(r,a){return a!==Aw?r[a]=i.get(a):r[a]=FD(o,Tc(t.di)),r},{})}function FD(e,t){return ti(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Tw(e,t){var n=e.businessObject,i=ht(e);z(t,function(o,r){r!==Aw?n.set(r,o):i&&jD(i,o)})}function jD(e,t){z(t,function(n,i){e.set(i,n)})}var HD=["default"];function zD(e){var t=q({},e);return HD.forEach(function(n){n in e&&(t[n]=me(t[n]))}),t}function mu(e,t){this._canvas=e,this._modeling=t}mu.$inject=["canvas","modeling"],mu.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=t.getRootElement(),r=o.businessObject,a=r.$parent,s=ht(o);return t.setRootElement(n),t.removeRootElement(o),nn(a.rootElements,i),i.$parent=a,tn(a.rootElements,r),r.$parent=null,o.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=o,[]},mu.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=e.oldRoot,r=o.businessObject,a=i.$parent,s=ht(n);return t.setRootElement(o),t.removeRootElement(n),tn(a.rootElements,i),i.$parent=null,nn(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function bh(e,t){this._modeling=e,this._spaceTool=t}bh.$inject=["modeling","spaceTool"],bh.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=tr(s),l=_n(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=[];Dr(r,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:rt(x.children,function(E){return E!==i})});var f,d,g,h,m;o==="top"?(f=-120,d=i.y,g=d+10,h="n",m="y"):o==="left"?(f=-120,d=i.x,g=d+10,h="w",m="x"):o==="bottom"?(f=120,d=i.y+i.height,g=d-10,h="s",m="y"):o==="right"&&(f=120,d=i.x+i.width,g=d-10,h="e",m="x");var w=t.calculateAdjustments(p,m,f,g),y=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(w.movingShapes,w.resizingShapes,y,h,g);var v=l?{x:i.x+(a?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},v,s)};function xh(e){this._modeling=e}xh.$inject=["modeling"],xh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=tr(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=_n(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 Qs(e,t){this._modeling=e,this._spaceTool=t}Qs.$inject=["modeling","spaceTool"],Qs.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Qs.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=Bk(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},Qs.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ze(e),o=ze(t),r=cb(o,i),a=Si(e),s=[],c=[];Dr(a,function(g){return s.push(g),(A(g,"bpmn:Lane")||A(g,"bpmn:Participant"))&&c.push(g),g.children});var l,u,p,f,d;(r.bottom||r.top)&&(l=r.bottom||r.top,u=e.y+(r.bottom?e.height:0)+(r.bottom?-10:10),p=r.bottom?"s":"n",f=r.top>0||r.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:l},p)),(r.left||r.right)&&(l=r.right||r.left,u=e.x+(r.right?e.width:0)+(r.right?-10:100),p=r.right?"e":"w",f=r.left>0||r.right<0?-l:l,d=n.calculateAdjustments(c,"x",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},p))};var Js="flowNodeRef",wh="lanes";function yu(){}yu.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]=Ll(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(wh),d=f.slice(),g=l(u);i.push({flowNode:p,remove:d,add:g})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(Js).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},yu.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,o=i.get(wh);n.remove.forEach(function(r){tn(o,r),tn(r.get(Js),i)}),n.add.forEach(function(r){nn(o,r),nn(r.get(Js),i)})}),[]},yu.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get(wh);n.add.forEach(function(r){tn(o,r),tn(r.get(Js),i)}),n.remove.forEach(function(r){nn(o,r),nn(r.get(Js),i)})}),[]};var _h="categoryValueRef";function ec(e,t){this._bpmnFactory=e,this._elementRegistry=t}ec.$inject=["bpmnFactory","elementRegistry"],ec.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(y,v,x){if(v){var E=a.get(y);E||(E={},a.set(y,E)),!(x&&E.present)&&(!x&&E.past||(x?E.present={categoryValue:v,root:Eh(y)}:E.past={categoryValue:v}))}}function c(y){o.set(y,me(y))}function l(){n.filter(function(y){return A(y,"bpmn:FlowElement")&&!it(y)&&y.parent}).forEach(c)}function u(y){var v=me(y),x=v.get("categoryValueRef");return x||(x=ib(i,v),r.push(GD(y,x))),x}function p(y){return y.reduce(function(v,x){var E=Eh(x),C=v.get(E);return C||(C=[],v.set(E,C)),C.push(x),v},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(y){return A(y,"bpmn:Group")&&!it(y)&&y.parent}).forEach(function(y){var v=me(y).get("categoryValueRef");if(!v){var x=Eh(y),E=f.get(x)||[],C=wa(E,y),D=Object.keys(C).length>0;D&&(v=u(y))}s(y,v,!0)}),t.forEach(function(y){s(y.groupShape,y.categoryValue,!1)}),r.length&&l();var d=Array.from(o.keys()),g=Array.from(a.values()).reduce(function(y,v){return v.present&&y.add(v.present.categoryValue),v.past&&y.add(v.past.categoryValue),y},new Set),h=new Map,m=p(d);a.forEach(function(y,v){var x=y.present;if(x){var E=m.get(x.root)||[],C=wa(E,v);E.forEach(function(D){if(C[D.id]){var P=h.get(D);P||(P=new Set,h.set(D,P)),P.add(x.categoryValue)}})}});var w=d.reduce(function(y,v){var x=o.get(v),E=x.get(_h),C=new Set(E),D=h.get(v)||new Set,P=Array.from(D).filter(function($){return!C.has($)}),T=E.filter(function($){return g.has($)&&!D.has($)});return(P.length||T.length)&&y.push({businessObject:x,categoryValuesToAdd:P,categoryValuesToRemove:T}),y},[]);return{flowElements:w,groups:r}},ec.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),VD(t.groups),UD(t.flowElements),[]},ec.prototype.revert=function(e){var t=e.updates;return qD(t.flowElements),WD(t.groups),[]};function GD(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function VD(e){e.forEach(function(t){me(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function WD(e){e.forEach(function(t){me(t.groupShape).categoryValueRef=null})}function UD(e){e.forEach(function(t){var n=t.businessObject,i=n.get(_h);t.categoryValuesToRemove.forEach(function(o){tn(i,o)}),t.categoryValuesToAdd.forEach(function(o){nn(i,o,!0)})})}function qD(e){e.forEach(function(t){var n=t.businessObject,i=n.get(_h);t.categoryValuesToAdd.forEach(function(o){tn(i,o)}),t.categoryValuesToRemove.forEach(function(o){nn(i,o,!0)})})}function Eh(e){for(;e.parent;)e=e.parent;return e}function vu(e){this._moddle=e}vu.$inject=["moddle"],vu.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),[]},vu.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 YD={fill:void 0,stroke:void 0};function Sh(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Jn(t)){var n=KD(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Sh.$inject=["commandStack"],Sh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||YD,i=this,o={};"fill"in n&&q(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&q(o,{"border-color":this._normalizeColor(n.stroke)}),z(t,function(r){var a=Ot(r)?Bi(o,["border-color"]):o,s=ht(r);if(XD(a),it(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(!ot(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function KD(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 XD(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var ZD={width:0,height:0};function kw(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return RT(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!it(l)&&Jo(l)&&!wl(l)&&!Ow(p)){var f=7,d=Yf(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)&&!A(u,"bpmn:TextAnnotation"))){if(it(u)&&Ow(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,ZD)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}kw.$inject=["modeling","textRenderer","bpmnFactory"];function Ow(e){return!e||!e.trim()}function In(e,t,n,i){Dt.call(this,e,t,n),this._bpmnRules=i}Te(In,Dt),In.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],In.prototype.getHandlers=function(){var e=Dt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ks,e["element.updateProperties"]=Zs,e["canvas.updateRoot"]=mu,e["lane.add"]=bh,e["lane.resize"]=Qs,e["lane.split"]=xh,e["lane.updateRefs"]=yu,e["group.updateRefs"]=ec,e["id.updateClaim"]=vu,e["element.setColor"]=Sh,e["element.updateLabel"]=kw,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 Dw(){}Dw.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Ye(t.source||e.source),t.connectionEnd||Ye(t.target||e.target)]};var bu=20,QD=5,xu=Math.round,Lw=20,JD={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function eL(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function tL(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Iw(e,t,n){var i=On(t,e,QD),o=n.split(":")[0],r=xu((t.x-e.x)/2+e.x),a=xu((t.y-e.y)/2+e.y),s,c,l=tL(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=eL(i,o),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+bu*(/l/.test(o)?-1:1),y:f?a+bu:a}):(f=r===e.x,s={x:f?r+bu:r,y:e.y+bu*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:Rh(e,s,c).concat(s),directions:c,turnNextDirections:f}}function nL(e,t,n){return Iw(e,t,n)}function iL(e,t,n){var i=Iw(t,e,Bw(n));return{waypoints:i.waypoints.slice().reverse(),directions:Bw(i.directions),turnNextDirections:i.turnNextDirections}}function oL(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=Rh(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function Bw(e){return e.split(":").reverse().join(":")}function rL(e,t,n){var i=xu((t.x-e.x)/2+e.x),o=xu((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 Rh(e,t,n){if(n=n||"h:h",!hL(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if($w(n)){var i=nL(e,t,n),o=iL(e,t,n),r=oL(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return rL(e,t,n)}function aL(e,t,n){var i=Rh(e,t,n);return i.unshift(e),i.push(t),jw(i)}function sL(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=_S(r,"straight")[0]||"h:h",s=JD[a]||0,c=On(e,t,s),l=dL(c,a);n=n||Ye(e),i=i||Ye(t);var u=l.split(":"),p=Fw(n,e,u[0],gL(c)),f=Fw(i,t,u[1],c);return aL(p,f,l)}function cL(e,t,n,i,o,r){Ue(n)&&(o=n,r=i,n=Ye(e),i=Ye(t)),r=q({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&uL(e,t,n,i,r),c||(c=r.connectionEnd&&fL(t,e,i,o),c)||(c=r.connectionStart&&pL(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:sL(e,t,n,i,r)}function lL(e,t,n){return e>=t&&e<=n}function Nw(e,t,n){var i={x:"width",y:"height"};return lL(t[e],n[e],n[e]+n[i[e]])}function uL(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"?Nw(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:Nw(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 pL(e,t,n,i){return Ch(e,t,n,i)}function fL(e,t,n,i){var o=i.slice().reverse();return o=Ch(e,t,n,o),o?o.reverse():null}function Ch(e,t,n,i){function o(u){return u.length<3?!0:u.length>4?!1:!!Bt(u,function(p,f){var d=u[f-1];return d&&Ss(p,d)<3})}function r(u,p,f){var d=bo(p,u);switch(d){case"v":return{x:f.x,y:u.y};case"h":return{x:u.x,y:f.y}}return{x:u.x,y:u.y}}function a(u,p,f){var d;for(d=u.length-2;d!==0;d--)if(lv(u[d],p,Lw)||lv(u[d],f,Lw))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=Ch(e,t,n,l)),c&&bo(c)?null:c}function dL(e,t){if($w(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 hL(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function $w(e){return e&&/t|r|b|l/.test(e)}function gL(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 Fw(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 jw(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return Gf(o,r,n,0)||t.push(n),t},[])}var mL=-10,yL=40,vL={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},bL={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},Mh={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},tc={top:"t",right:"r",bottom:"b",left:"l"};function wu(e){this._elementRegistry=e}Te(wu,Dw),wu.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=Hw(o&&o[0],n)),a||(a=Hw(o&&o[o.length-1],i)),(A(e,"bpmn:Association")||A(e,"bpmn:DataAssociation"))&&o&&!zw(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=Jv(n,s)?vL:bL;return A(e,"bpmn:MessageFlow")?c=wL(n,i,u):(A(e,"bpmn:SequenceFlow")||zw(n,i))&&(n===i?c={preferredLayouts:ML(n,e,u)}:A(n,"bpmn:BoundaryEvent")?c={preferredLayouts:AL(n,i,a,u)}:nc(n)||nc(i)?c={preferredLayouts:u.subProcess,preserveDocking:EL(n)}:A(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:A(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=q(c,t),l=jw(cL(n,i,r,a,o,c))),l||[r,a]};function xL(e){var t=e.host;return On(Ye(e),t,mL)}function wL(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:_L(e,t)}}function _L(e,t){return A(t,"bpmn:Participant")?"source":A(e,"bpmn:Participant")?"target":nc(t)?"source":nc(e)||A(t,"bpmn:Event")?"target":A(e,"bpmn:Event")?"source":null}function EL(e){return nc(e)?"target":"source"}function Hw(e,t){return e?e.original||e:Ye(t)}function zw(e,t){return A(t,"bpmn:Activity")&&A(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function nc(e){return A(e,"bpmn:SubProcess")&&pt(e)}function zr(e,t){return e===t}function SL(e,t){return t.indexOf(e)!==-1}function Fa(e){var t=/right|left/.exec(e);return t&&t[0]}function ja(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Gw(e,t){return Mh[e]===t}function RL(e,t){var n=Fa(e),i=Mh[n];return t.indexOf(i)!==-1}function CL(e,t){var n=ja(e),i=Mh[n];return t.indexOf(i)!==-1}function Vw(e){return e==="right"||e==="left"}function ML(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 AL(e,t,n,i){var o=Ye(e),r=Ye(t),a=xL(e),s,c,l=zr(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?PL(a,u,e,t,n,i):(s=TL(a,p,u,i.isHorizontal),c=kL(a,p,u,i.isHorizontal),[s+":"+c])}function PL(e,t,n,i,o,r){var a=t?e:r.isHorizontal?ja(e):Fa(e),s=tc[a],c;return t?Vw(e)?c=Ww("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=Ww("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function Ww(e,t,n,i){var o=yL;return!(Ah(e,i,n,o)||Ah(e,i,{x:n.x+n.width,y:n.y+n.height},o)||Ah(e,i,Ye(t),o))}function Ah(e,t,n,i){return Math.abs(t[e]-n[e])<i}function TL(e,t,n,i){if(n)return tc[e];var o=ja(e),r=Fa(e),a=ja(t),s=Fa(t);if(i){if(zr(o,a)||Gw(r,s))return tc[o]}else if(zr(r,s)||Gw(o,a))return tc[r];return tc[i?r:o]}function kL(e,t,n,i){if(n)return Vw(e)?RL(e,t)||zr(e,t)?"h":"v":CL(e,t)||zr(e,t)?"v":"h";var o=ja(e),r=Fa(e),a=ja(t),s=Fa(t);return a&&!s?"v":s&&!a?"h":i?zr(o,a)?"h":"v":zr(r,s)?"v":"h"}wu.$inject=["elementRegistry"];function Uw(e){return q({original:e.point.original||e.point},e.actual)}function ur(e,t){this._elementRegistry=e,this._graphicsFactory=t}ur.$inject=["elementRegistry","graphicsFactory"],ur.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(Uw(i)),r.push(Uw(o)),r},ur.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}},ur.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return Rs(i,o,n)},ur.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},ur.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},ur.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Ph={__init__:["modeling","bpmnUpdater"],__depends__:[X2,fO,hO,gO,ow,mD,vD,SD,Ci,fh,uw],bpmnFactory:["type",Ai],bpmnUpdater:["type",si],elementFactory:["type",sr],modeling:["type",In],layouter:["type",wu],connectionDocking:["type",ur]};var OL=10,qw=50,DL=250;function Th(e,t,n,i){for(var o;o=LL(e,n,t);)n=i(t,n,o);return n}function kh(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 LL(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 Bt(o,function(r){if(r===n)return!1;var a=On(r,i,OL);return a==="intersect"})}function IL(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||qw,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||DL,c=t.reference||"start";r||(r=FL);function l(g,h){return o==="n"?c==="start"?ze(g).top-ze(h).bottom:c==="center"?ze(g).top-Ye(h).y:ze(g).top-ze(h).top:o==="w"?c==="start"?ze(g).left-ze(h).right:c==="center"?ze(g).left-Ye(h).x:ze(g).left-ze(h).left:o==="s"?c==="start"?ze(h).top-ze(g).bottom:c==="center"?Ye(h).y-ze(g).bottom:ze(h).bottom-ze(g).bottom:c==="start"?ze(h).left-ze(g).right:c==="center"?Ye(h).x-ze(g).right:ze(h).right-ze(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,w=h.weight;return m<0||m>s||(g[String(m)]||(g[String(m)]=0),g[String(m)]+=1*w,(!g.distance||g[g.distance]<g[String(m)])&&(g.distance=m)),g},{});return d.distance||i}function BL(e){var t=Oh(e);return e.host&&(t=t.concat(Oh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Oh(i))},[]))),t}function Oh(e){return $L(e).concat(NL(e))}function NL(e){return e.incoming.map(function(t){return t.source})}function $L(e){return e.outgoing.map(function(t){return t.target})}function FL(){return!0}var jL=100;function Yw(e,t,n){e.on("autoPlace",jL,function(i){var o=i.shape,r=i.source;return HL(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}}Yw.$inject=["eventBus","modeling","canvas"];function HL(e,t,n){n||(n={});var i=n.defaultDistance||qw,o=Ye(e),r=ze(e);return{x:r.right+i+t.width/2,y:o.y}}function Kw(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Kw.$inject=["eventBus","selection"];const zL={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Yw],autoPlaceSelectionBehavior:["type",Kw]};function Xw(e,t,n){var i=Jv(e,n);if(A(t,"bpmn:TextAnnotation"))return VL(e,t,i);if(ot(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return WL(e,t,i);if(A(t,"bpmn:FlowNode"))return GL(e,t,i)}function GL(e,t,n){var i=ze(e),o=Ye(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=IL(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=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+Zw(l,c,r)}:{x:o.x+Zw(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Th(e,t,u,kh(f))}function Zw(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function VL(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};Ot(e)&&(o=Ye(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 Th(e,t,o,kh(a))}function WL(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 Th(e,t,o,kh(a))}function Qw(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return Xw(o,i,t)})}Qw.$inject=["eventBus","elementRegistry"];const _u={__depends__:[zL],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Qw]},UL=1500;class Jw{constructor(t){t.on("moddleCopy.canCopyProperties",UL,({sourceElement:n,targetElement:i})=>{var r;if(!((r=n==null?void 0:n.$instanceOf)!=null&&r.call(n,Rr)))return;const o=Sn(n);o!==void 0&&i.set("xml:lang",o)})}}Fn(Jw,"$inject",["eventBus"]);const e_={__init__:["translationLocaleCopy"],translationLocaleCopy:["type",Jw]},qL=500,Eu=1,t_=(e,t)=>{if((e==null?void 0:e.type)!=="bpmn:TextAnnotation"||!(t!=null&&t.original))return;const{x:n,y:i}=t.original;(n<e.x-Eu||n>e.x+e.width+Eu||i<e.y-Eu||i>e.y+e.height+Eu)&&(t.original={x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)})};class n_{constructor(t){t.on("bpmnElement.added",qL,({element:n})=>{if((n==null?void 0:n.type)!=="bpmn:Association")return;const i=n.waypoints;!i||i.length<2||(t_(n.source,i[0]),t_(n.target,i[i.length-1]))})}}Fn(n_,"$inject",["eventBus"]);const i_={__init__:["annotationImportDocking"],annotationImportDocking:["type",n_]},o_=[Zv,ks,Ph,_u,jp,e_,i_];function YL(e={}){mm(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Sa({container:t,moddleExtensions:e.moddleExtensions??$c,additionalModules:[...o_,...e.additionalModules??[]]})}const r_={"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 XL(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 ZL={"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":"연관선"},QL="요소";function Dh(e){return(e&&ZL[e.type])??QL}const a_=20;function JL(e){const t=e.replace(/\s+/g," ").trim();return t.length>a_?`${t.slice(0,a_)}…`:t}function Su(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:JL(o.name),a=r===void 0?i+Dh(o):r,s=r===void 0?a:`「${r}」`;return n?s+XL(a,n).slice(a.length):s}function eI(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&&Dh(r)===Dh(a);return[Su(e,t,i),Su(e,n,o,s?"다른 ":"")]}function tI(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 nI(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 Ru={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function iI(e,t){const n=(o,r)=>Su(t,o,r),i=(o,r,a,s)=>eI(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)}의 ${Ru[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)}의 ${Ru[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${Ru[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${Ru[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 oI(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Su(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const s_="기타",Lh={error:0,warning:1,info:2};function c_(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${lt(i)}`,source:"geometry",code:i.kind,severity:tI(i),targetRefs:nI(i),category:r_[i.kind]??s_,message:iI(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:r_[i.ruleId]??s_,message:oI(i,t)});return n}function l_(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function Ha(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function Ih(e,t){if(t===void 0||e.length===0)return!1;const n=Ha(e[0],t);return e.some(i=>Ha(i,t)!==n)}function u_(e,t){const n=Ih(e,t);return e.slice().sort((i,o)=>(n?Number(Ha(o,t))-Number(Ha(i,t)):0)||Lh[i.severity]-Lh[o.severity])}const p_="i18n-untranslated",f_="i18n-review-requested",Bh="i18nDisplay.redrawn",d_=[["untranslated",p_],["reviewRequested",f_]];class Nh{constructor(t,n,i,o,r,a,s,c){Fn(this,"config");Fn(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(Oc,{element:f.labelTarget??f,locale:this.displayLocale,text:d,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",f=>{if(!this.config)return;const{element:d,newLabel:g,oldLabel:h}=f.context;(g??"")!==(h??"")&&i.execute(Oc,{element:d.labelTarget??d,locale:this.displayLocale,text:g??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:h??""})})}configure(t){!t&&!this.config||(this.config=t,this.displayLocale=t==null?void 0:t.designLocale,this.rerenderAll())}locales(){if(!this.config)return[];const{designLocale:t,companionLocales:n}=this.config;return[t,...n.filter(i=>i!==t)]}setDisplayLocale(t){if(this.config)return this.displayLocale=this.locales().includes(t)?t:this.config.designLocale,this.rerenderAll(),this.displayLocale}getDisplayLocale(){return this.displayLocale}rootLang(){var i,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=Cr(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=Fo(n).filter(f=>Sn(f)),s=f=>f.body??"",c=a.find(f=>Sn(f)===o&&s(f)),l=jo(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(Sn);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 d_)r.toggle(g,(o==null?void 0:o.status)===d);if(!o||o.native)return n();const{target:a,key:s}=Cr((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 d_)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(Bh)}}Fn(Nh,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const h_={__depends__:[jp],__init__:["i18nDisplay"],i18nDisplay:["type",Nh]};var rI=new Fr("ov"),aI=500;function Cn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=rI,this._overlayDefaults=q({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=sI(n.getContainer()),this._init()}Cn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Cn.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,ca({type:e.type})):t.overlays.slice():[]}else return e.type?rt(this._overlays,ca({type:e.type})):e.id?this._overlays[e.id]:null},Cn.prototype.add=function(e,t,n){if(mn(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=q({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Cn.prototype.remove=function(e){var t=this.get(e)||[];Ue(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)}})},Cn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Cn.prototype.show=function(){Cu(this._overlayRoot)},Cn.prototype.hide=function(){Cu(this._overlayRoot,!1)},Cn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],cl(this._overlayRoot)},Cn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=sn(t);i=r.x,o=r.y}g_(n,i,o),Rn(e.html,"data-container-id",t.id)},Cn.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=sn(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=sn(i).height:s=i.height,r=t.bottom*-1+s}g_(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Cn.prototype._createOverlayContainer=function(e){var t=zt('<div class="djs-overlays" />');qn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Cn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";m_(this._overlayRoot,n)},Cn.prototype._getOverlayContainer=function(e,t){var n=Bt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Cn.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=zt(i)),r=this._getOverlayContainer(n),o=zt('<div class="djs-overlay" data-overlay-id="'+t+'">'),qn(o,{position:"absolute"}),o.appendChild(i),e.type&&Mt(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Cu(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())},Cn.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&&(gn(o)&&o>t.scale||gn(r)&&r<t.scale))&&(c=!1),Cu(a,c),this._updateOverlayScale(e,t)},Cn.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),gn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),gn(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),gn(a)&&(s="scale("+a+","+a+")"),m_(r,s)},Cn.prototype._updateOverlaysVisibilty=function(e){var t=this;z(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Cn.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",aI,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&&Mt(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 sI(e){var t=zt('<div class="djs-overlay-container" />');return qn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function g_(e,t,n){qn(e,{left:t+"px",top:n+"px"})}function Cu(e,t){e.style.display=t===!1?"none":""}function m_(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Mu={__init__:["overlays"],overlays:["type",Cn]};function $h(e,t){t.invoke(ge,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($h,ge),$h.$inject=["canvas","injector"];const cI={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",$h]};function Gr(e){return CSS.escape(e)}var lI={"&":"&","<":"<",">":">",'"':""","'":"'"};function y_(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return lI[t]})}var uI="bjs-breadcrumbs-shown";function v_(e,t,n){var i=zt('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=Mt(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=me(l),p=Bt(a,function(f){return f===u});p&&s()});function s(c){c&&(a=pI(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(m){var w=me(m);return w&&w.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=y_(p.name||p.id),h=zt('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var u=l.length>1;r.toggle(uI,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}v_.$inject=["eventBus","elementRegistry","canvas"];function pI(e){for(var t=me(e),n=[],i=t;i;i=i.$parent)(A(i,"bpmn:SubProcess")||A(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function b_(e,t){var n=null,i=new fI;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})}b_.$inject=["eventBus","canvas"];function fI(){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 x_={x:180,y:160};function Vr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}Vr.prototype._handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach(function(i){!i.plane||!i.plane.bpmnElement||(t._processToDiagramMap[i.plane.bpmnElement.id]=i)});var n=e.diagrams.filter(i=>i.plane).flatMap(i=>t._createNewDiagrams(i.plane));n.forEach(function(i){t._movePlaneElementsToOrigin(i.plane)})}},Vr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(r){var a=r.bpmnElement;if(a){var s=a.$parent;A(a,"bpmn:SubProcess")&&!r.isExpanded&&n.push(a),hI(a,e)&&i.push({diElement:r,parent:s})}});var o=[];return n.forEach(function(r){if(!t._processToDiagramMap[r.id]){var a=t._createDiagram(r);t._processToDiagramMap[r.id]=a,o.push(a)}}),i.forEach(function(r){for(var a=r.diElement,s=r.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),o},Vr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=dI(e),i={x:n.x-x_.x,y:n.y-x_.y};t.forEach(function(o){o.waypoint?o.waypoint.forEach(function(r){r.x=r.x-i.x,r.y=r.y-i.y}):o.bounds&&(o.bounds.x=o.bounds.x-i.x,o.bounds.y=o.bounds.y-i.y)})},Vr.prototype._moveToDiPlane=function(e,t){var n=w_(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Vr.prototype._createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n},Vr.$inject=["eventBus","moddle"];function w_(e){return A(e,"bpmndi:BPMNDiagram")?e:w_(e.$parent)}function dI(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)}}),gl(t)}function hI(e,t){var n=e.$parent;return!(!A(n,"bpmn:SubProcess")||n===t.bpmnElement||ot(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Au=250,gI='<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>',mI="bjs-drilldown-empty";function pr(e,t,n,i,o){ge.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",Au,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Au,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Au,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"],Au,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(pr,ge),pr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},pr.prototype._canDrillDown=function(e){var t=this._canvas;return A(e,"bpmn:SubProcess")&&t.findRoot(to(e))},pr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=me(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;Mt(i.html).toggle(mI,!o)}},pr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=me(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=zt('<button type="button" class="bjs-drilldown">'+gI+"</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)},pr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},pr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const yI={__depends__:[Mu,fh,cI],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",v_],drilldownCentering:["type",b_],drilldownOverlayBehavior:["type",pr],subprocessCompatibility:["type",Vr]};function fr(e){Yt.call(this,e)}Te(fr,Yt),fr.prototype._modules=[Zv,yI,Mu,Ci,ks],fr.prototype._moddleExtensions={};var Pu="keyboard.keydown",vI="keyboard.keyup",bI=1e3,__="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function Yn(e,t){var n=this;this._config=e=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),e.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(__));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Yn.$inject=["config.keyboard","eventBus"],Yn.prototype._keydownHandler=function(e){this._keyHandler(e,Pu)},Yn.prototype._keyupHandler=function(e){this._keyHandler(e,vI)},Yn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Pu,i),n&&e.preventDefault()}},Yn.prototype._isEventIgnored=function(e){return!1},Yn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(__)),this.unbind(),e=this._node=this._target,je.bind(e,"keydown",this._keydownHandler),je.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Yn.prototype.getBinding=function(){return this._node},Yn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),je.unbind(e,"keydown",this._keydownHandler),je.unbind(e,"keyup",this._keyupHandler)),this._node=null},Yn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Yn.prototype.addListener=function(e,t,n){wn(e)&&(n=t,t=e,e=bI),this._eventBus.on(n||Pu,e,t)},Yn.prototype.removeListener=function(e,t){this._eventBus.off(t||Pu,e)},Yn.prototype.hasModifier=AO,Yn.prototype.isCmd=ri,Yn.prototype.isShift=th,Yn.prototype.isKey=vn;var xI=500;function za(e,t){var n=this;e.on("editorActions.init",xI,function(i){var o=i.editorActions;n.registerBindings(t,o)})}za.$inject=["eventBus","keyboard"],za.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(DO(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(LO(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(PO(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(TO(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(kO(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(OO(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(vn(["+","Add","="],o)&&ri(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(vn(["-","Subtract"],o)&&ri(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(vn("0",o)&&ri(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(vn(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const Fh={__init__:["keyboard","keyboardBindings"],keyboard:["type",Yn],keyboardBindings:["type",za]};var wI={moveSpeed:50,moveSpeedAccelerated:200};function E_(e,t,n){var i=this;this._config=q({},wI,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})}}E_.$inject=["config.keyboardMove","keyboard","canvas"];const S_={__depends__:[Fh],__init__:["keyboardMove"],keyboardMove:["type",E_]};var _I=15;function R_(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function o(s){var c=n.start,l=n.button,u=Br(s),p=zi(u,c);if(!n.dragging&&EI(p)>_I&&(n.dragging=!0,l===0&&Nx(e),Jl("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){je.unbind(document,"mousemove",o),je.unbind(document,"mouseup",r),n=null,Bx()}function a(s){if(!kr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Br(s)},je.bind(document,"mousemove",o),je.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}R_.$inject=["eventBus","canvas"];function EI(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const C_={__init__:["moveCanvas"],moveCanvas:["type",R_]};function M_(e,t){var n=Qf(e.min),i=Qf(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function SI(e,t){return Math.max(e.min,Math.min(e.max,t))}var RI=Math.sign||function(e){return e>=0?1:-1},jh={min:.2,max:4},A_=10,CI=.1,MI=.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||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=M_(jh,A_*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||Vb()&&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))*RI(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=M_(jh,A_);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(SI(jh,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&&je[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},oo.prototype._init=function(e){this.toggle(e)};const P_={__init__:["zoomScroll"],zoomScroll:["type",oo]};function ic(e){fr.call(this,e)}Te(ic,fr),ic.prototype._navigationModules=[S_,C_,P_],ic.prototype._modules=[].concat(fr.prototype._modules,ic.prototype._navigationModules);function Hh(e){return e&&e[e.length-1]}function T_(e){return e.y}function k_(e){return e.x}var AI={left:k_,center:k_,right:function(e){return e.x+e.width},top:T_,middle:T_,bottom:function(e){return e.y+e.height}};function Ga(e,t){this._modeling=e,this._rules=t}Ga.$inject=["modeling","rules"],Ga.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}},Ga.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Ga.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=Hh(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]=Hh(c).center,r;l=t[0],t=Ui(t,function(f){return f[i]+f[o]}),u=Hh(t),r[e]=p(l,u)}return r},Ga.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}),Ue(i)&&(o=i),!(o.length<2||!i)){var r=AI[t],a=Ui(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const PI={__init__:["alignElements"],alignElements:["type",Ga]},TI=new Fr;function Va(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Va.$inject=["eventBus"],Va.prototype.schedule=function(e,t=TI.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Va.prototype._schedule=function(e,t){const n=kI();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}},Va.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Va.prototype._cancel=function(e){clearTimeout(e.executionId)};function kI(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const OI={scheduler:["type",Va]};var DI="djs-element-hidden",Tu=".entry",LI=1e3,O_=8,II=300;function ln(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}ln.$inject=["canvas","elementRegistry","eventBus","scheduler"],ln.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=Ue(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=Ue(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},ln.prototype._createContainer=function(){var e=zt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},ln.prototype.registerProvider=function(e,t){t||(t=e,e=LI),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},ln.prototype.getEntries=function(e){var t=this._getProviders(),n=Ue(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return z(t,function(o){if(wn(o[n])){var r=o[n](e);wn(r)?i=r(i):z(r,function(a,s){i[s]=a})}}),i},ln.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=Rn(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},II);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},ln.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(wn(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},ln.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))}},ln.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},ln.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=zt(o.html||'<div class="entry" draggable="true"></div>'),c;Rn(s,"data-action",r),c=Ct("[data-group="+Gr(a)+"]",n),c||(c=zt('<div class="group"></div>'),Rn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&BI(s,o.className),o.title&&Rn(s,"title",o.title),o.imageUrl&&(i=zt("<img>"),Rn(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Mt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},ln.prototype._createHtml=function(e){var t=this,n=zt('<div class="djs-context-pad"></div>');return ni.bind(n,Tu,"click",function(i){t.trigger("click",i)}),ni.bind(n,Tu,"dragstart",function(i){t.trigger("dragstart",i)}),ni.bind(n,Tu,"mouseover",function(i){t.trigger("mouseover",i)}),ni.bind(n,Tu,"mouseout",function(i){t.trigger("mouseout",i)}),je.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},ln.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()&&$I(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},ln.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},ln.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Ue(e)!==Ue(n)?!1:Ue(e)?e.length===n.length&&No(e,function(i){return n.includes(i)}):n===e},ln.prototype.isShown=function(){return this.isOpen()&&Mt(this._current.html).has("open")},ln.prototype.show=function(){this.isOpen()&&(Mt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},ln.prototype.hide=function(){this.isOpen()&&(Mt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},ln.prototype._getPosition=function(e){if(!Ue(e)&&Ot(e)){var t=this._canvas.viewbox(),n=NI(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+O_*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+O_*this._canvas.zoom(),top:s.top-a.top}},ln.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")},ln.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Ue(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,DI)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},ln.prototype._getTargetBounds=function(e){var t=this,n=Ue(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 BI(e,t){var n=Mt(e);t=Ue(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function NI(e){return e.waypoints[e.waypoints.length-1]}function $I(e,t){return e=Ue(e)?e:[e],t=Ue(t)?t:[t],e.length===t.length&&No(e,function(n){return t.includes(n)})}const D_={__depends__:[Ql,OI,Mu],contextPad:["type",ln]};var ku,Xt,L_,dr,I_,B_,N_,zh,Ou,oc,$_,Gh,Vh,Wh,Du={},Lu=[],FI=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Iu=Array.isArray;function Po(e,t){for(var n in t)e[n]=t[n];return e}function Uh(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function F_(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?ku.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 Bu(e,a,i,o,null)}function Bu(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??++L_,__i:-1,__u:0};return o==null&&Xt.vnode!=null&&Xt.vnode(r),r}function Nu(e){return e.children}function $u(e,t){this.props=e,this.context=t}function Wr(e,t){if(t==null)return e.__?Wr(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Wr(e):null}function jI(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=Po({},t);r.__v=t.__v+1,Xt.vnode&&Xt.vnode(r),qh(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Wr(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,q_(i,r,o),t.__e=t.__=null,r.__e!=n&&j_(r)}}function j_(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}),j_(e)}function H_(e){(!e.__d&&(e.__d=!0)&&dr.push(e)&&!Fu.__r++||I_!=Xt.debounceRendering)&&((I_=Xt.debounceRendering)||B_)(Fu)}function Fu(){try{for(var e,t=1;dr.length;)dr.length>t&&dr.sort(N_),e=dr.shift(),t=dr.length,jI(e)}finally{dr.length=Fu.__r=0}}function z_(e,t,n,i,o,r,a,s,c,l,u){var p,f,d,g,h,m,w=i&&i.__k||Lu,y=t.length;for(c=HI(n,t,w,c,y),p=0;p<y;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&w[d.__i]||Du,d.__i=p,m=qh(e,d,f,o,r,a,s,c,l,u),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Yh(f.ref,null,d),u.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=G_(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 HI(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]=Bu(null,a,null,null,null):Iu(a)?a=e.__k[r]=Bu(Nu,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=Bu(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=zI(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(o>u?f--:o<u&&f++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,a.__u|=4))):e.__k[r]=null;if(p)for(r=0;r<u;r++)(s=n[r])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Wr(s)),K_(s,s));return i}function G_(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=G_(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Wr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function zI(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 V_(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||FI.test(t)?n:n+"px"}function ju(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||V_(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||V_(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace($_,"$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[oc]=i[oc]:(n[oc]=Gh,e.addEventListener(t,r?Wh:Vh,r)):e.removeEventListener(t,r?Wh:Vh,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 W_(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Ou]==null)t[Ou]=Gh++;else if(t[Ou]<n[oc])return;return n(Xt.event?Xt.event(t):t)}}}function qh(e,t,n,i,o,r,a,s,c,l){var u,p,f,d,g,h,m,w,y,v,x,E,C,D,P,T,$=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Xt.__b)&&u(t);e:if(typeof $=="function"){p=a.length;try{if(y=t.props,v=$.prototype&&$.prototype.render,x=(u=$.contextType)&&i[u.__c],E=u?x?x.props.value:u.__:i,n.__c?w=(f=t.__c=n.__c).__=f.__E:(v?t.__c=f=new $(y,E):(t.__c=f=new $u(y,E),f.constructor=$,f.render=VI),x&&x.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),v&&f.__s==null&&(f.__s=f.state),v&&$.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Po({},f.__s)),Po(f.__s,$.getDerivedStateFromProps(y,f.__s))),g=f.props,h=f.state,f.__v=t,d)v&&$.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),v&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(v&&$.getDerivedStateFromProps==null&&y!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(y,E),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(y,f.__s,E)===!1){t.__v!=n.__v&&(f.props=y,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(j){j&&(j.__=t)}),Lu.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Wr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(y,f.__s,E),v&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,m)})}if(f.context=E,f.props=y,f.__P=e,f.__e=!1,C=Xt.__r,D=0,v)f.state=f.__s,f.__d=!1,C&&C(t),u=f.render(f.props,f.state,f.context),Lu.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,C&&C(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++D<25);f.state=f.__s,f.getChildContext!=null&&(i=Po(Po({},i),f.getChildContext())),v&&!d&&f.getSnapshotBeforeUpdate!=null&&(m=f.getSnapshotBeforeUpdate(g,h)),P=u!=null&&u.type===Nu&&u.key==null?Y_(u.props.children):u,s=z_(e,Iu(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(T=r.length;T--;)Uh(r[T])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),j.then||U_(t),Xt.__e(j,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=GI(n.__e,t,n,i,o,r,a,c,l);return(u=Xt.diffed)&&u(t),128&t.__u?void 0:s}function U_(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(U_))}function q_(e,t,n){for(var i=0;i<n.length;i++)Yh(n[i],n[++i],n[++i]);Xt.__c&&Xt.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Xt.__e(r,o.__v)}})}function Y_(e){return typeof e!="object"||e==null||e.__b>0?e:Iu(e)?e.map(Y_):e.constructor!==void 0?null:Po({},e)}function GI(e,t,n,i,o,r,a,s,c){var l,u,p,f,d,g,h,m=n.props||Du,w=t.props,y=t.type;if(y=="svg"?o="http://www.w3.org/2000/svg":y=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),r!=null){for(l=0;l<r.length;l++)if((d=r[l])&&"setAttribute"in d==!!y&&(y?d.localName==y:d.nodeType==3)){e=d,r[l]=null;break}}if(e==null){if(y==null)return document.createTextNode(w);e=document.createElementNS(o,y,w.is&&w),s&&(Xt.__m&&Xt.__m(t,r),s=!1),r=null}if(y==null)m===w||s&&e.data==w||(e.data=w);else{if(r=y=="textarea"&&w.defaultValue!=null?null:r&&ku.call(e.childNodes),!s&&r!=null)for(m={},l=0;l<e.attributes.length;l++)m[(d=e.attributes[l]).name]=d.value;for(l in m)d=m[l],l=="dangerouslySetInnerHTML"?p=d:l=="children"||l in w||l=="value"&&"defaultValue"in w||l=="checked"&&"defaultChecked"in w||ju(e,l,null,d,o);for(l in w)d=w[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?g=d:l=="checked"?h=d:s&&typeof d!="function"||m[l]===d||ju(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=""),z_(t.type=="template"?e.content:e,Iu(f)?f:[f],t,n,i,y=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&Wr(n,0),s,c),r!=null)for(l=r.length;l--;)Uh(r[l]);s&&y!="textarea"||(l="value",y=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||y=="progress"&&!g||y=="option"&&g!=m[l])&&ju(e,l,g,m[l],o),l="checked",h!=null&&h!=e[l]&&ju(e,l,h,m[l],o))}return e}function Yh(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(o){Xt.__e(o,n)}}function K_(e,t,n){var i,o;if(Xt.unmount&&Xt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Yh(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Xt.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&K_(i[o],t,n||typeof e.type!="function");n||Uh(e.__e),e.__c=e.__=e.__e=void 0}function VI(e,t,n){return this.constructor(e,n)}function X_(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Xt.__&&Xt.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],qh(t,e=t.__k=F_(Nu,null,[e]),o||Du,Du,t.namespaceURI,o?null:t.firstChild?ku.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),q_(r,e,a),e.props.children=null}ku=Lu.slice,Xt={__e:function(e,t,n,i){for(var o,r,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&r.getDerivedStateFromError!=null&&(o.setState(r.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,i||{}),a=o.__d),a)return o.__E=o}catch(s){e=s}throw e}},L_=0,$u.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Po({},this.state),typeof e=="function"&&(e=e(Po({},n),this.props)),e&&Po(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),H_(this))},$u.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),H_(this))},$u.prototype.render=Nu,dr=[],B_=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,N_=function(e,t){return e.__v.__b-t.__v.__b},Fu.__r=0,zh=Math.random().toString(8),Ou="__d"+zh,oc="__a"+zh,$_=/(PointerCapture)$|Capture$/i,Gh=0,Vh=W_(!1),Wh=W_(!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},Q_=new Map;function WI(e){var t=Q_.get(this);return t||(t=new Map,Q_.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 Lt=WI.bind(F_),Wa,un,Kh,J_,rc=0,e0=[],bn=Xt,t0=bn.__b,n0=bn.__r,i0=bn.diffed,o0=bn.__c,r0=bn.unmount,a0=bn.__;function Hu(e,t){bn.__h&&bn.__h(un,e,rc||t),rc=0;var n=un.__H||(un.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Xh(e){return rc=1,UI(c0,e)}function UI(e,t,n){var i=Hu(Wa++,2);if(i.t=e,!i.__c&&(i.__=[c0(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=un,!un.__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};un.__f=!0;var r=un.shouldComponentUpdate,a=un.componentWillUpdate;un.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)},un.shouldComponentUpdate=o}return i.__N||i.__}function zu(e,t){var n=Hu(Wa++,3);!bn.__s&&Jh(n.__H,t)&&(n.__=e,n.u=t,un.__H.__h.push(n))}function Zh(e,t){var n=Hu(Wa++,4);!bn.__s&&Jh(n.__H,t)&&(n.__=e,n.u=t,un.__h.push(n))}function Gu(e){return rc=5,To(function(){return{current:e}},[])}function To(e,t){var n=Hu(Wa++,7);return Jh(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ac(e,t){return rc=8,To(function(){return e},t)}function qI(){for(var e;e=e0.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Vu),t.__h.some(Qh),t.__h=[]}catch(n){t.__h=[],bn.__e(n,e.__v)}}}bn.__b=function(e){un=null,t0&&t0(e)},bn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),a0&&a0(e,t)},bn.__r=function(e){n0&&n0(e),Wa=0;var t=(un=e.__c).__H;t&&(Kh===un?(t.__h=[],un.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Vu),t.__h.some(Qh),t.__h=[],Wa=0)),Kh=un},bn.diffed=function(e){i0&&i0(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(e0.push(t)!==1&&J_===bn.requestAnimationFrame||((J_=bn.requestAnimationFrame)||YI)(qI)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Kh=un=null},bn.__c=function(e,t){t.some(function(n){try{n.__h.some(Vu),n.__h=n.__h.filter(function(i){return!i.__||Qh(i)})}catch(i){t.some(function(o){o.__h&&(o.__h=[])}),t=[],bn.__e(i,n.__v)}}),o0&&o0(e,t)},bn.unmount=function(e){r0&&r0(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Vu(i)}catch(o){t=o}}),n.__H=void 0,t&&bn.__e(t,n.__v))};var s0=typeof requestAnimationFrame=="function";function YI(e){var t,n=function(){clearTimeout(i),s0&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);s0&&(t=requestAnimationFrame(n))}function Vu(e){var t=un,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),un=t}function Qh(e){var t=un;e.__c=e.__(),un=t}function Jh(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function c0(e,t){return typeof t=="function"?t(e):t}function KI(e){const{navigationStack:t,setNavigationStack:n}=e,i=To(()=>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 Lt`
|
|
12
12
|
<div class="djs-popup-breadcrumbs">
|
|
13
|
-
${o&&
|
|
13
|
+
${o&&Lt`
|
|
14
14
|
<button
|
|
15
15
|
type="button"
|
|
16
16
|
class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--back"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
</svg>
|
|
24
24
|
</button>
|
|
25
25
|
`}
|
|
26
|
-
${i.map((a,s)=>
|
|
26
|
+
${i.map((a,s)=>Lt`
|
|
27
27
|
<button
|
|
28
28
|
key=${s}
|
|
29
29
|
type="button"
|
|
@@ -35,22 +35,22 @@
|
|
|
35
35
|
</button>
|
|
36
36
|
<span class="djs-popup-breadcrumbs-item--separator" aria-hidden="true"></span>
|
|
37
37
|
`)}
|
|
38
|
-
${r&&
|
|
38
|
+
${r&&Lt`
|
|
39
39
|
<span class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--current" title=${r}>
|
|
40
40
|
${r}
|
|
41
41
|
</span>
|
|
42
42
|
`}
|
|
43
43
|
</div>
|
|
44
|
-
`}function
|
|
44
|
+
`}function l0(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=l0(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Wu(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=l0(e))&&(i&&(i+=" "),i+=t);return i}function XI(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:o,title:r}=e,a=To(()=>ZI(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return Lt`
|
|
45
45
|
<div class="djs-popup-header">
|
|
46
46
|
<h3 class="djs-popup-title" title=${r}>${r}</h3>
|
|
47
|
-
${a.map(l=>
|
|
47
|
+
${a.map(l=>Lt`
|
|
48
48
|
<ul key=${l.id} class="djs-popup-header-group" data-header-group=${l.id}>
|
|
49
49
|
|
|
50
|
-
${l.entries.map(u=>
|
|
50
|
+
${l.entries.map(u=>Lt`
|
|
51
51
|
<li key=${u.id}>
|
|
52
52
|
<${s(u)?"button":"span"}
|
|
53
|
-
class=${
|
|
53
|
+
class=${QI(u,u===i)}
|
|
54
54
|
onClick=${p=>c(p,u)}
|
|
55
55
|
title=${u.title||u.label}
|
|
56
56
|
data-id=${u.id}
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
onFocus=${()=>s(u)&&o(u)}
|
|
61
61
|
onBlur=${()=>s(u)&&o(null)}
|
|
62
62
|
>
|
|
63
|
-
${u.imageUrl&&
|
|
64
|
-
${u.label?
|
|
63
|
+
${u.imageUrl&&Lt`<img class="djs-popup-entry-icon" src=${u.imageUrl} alt="" />`||u.imageHtml&&Lt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:u.imageHtml}} />`}
|
|
64
|
+
${u.label?Lt`
|
|
65
65
|
<span class="djs-popup-label">${u.label}</span>
|
|
66
66
|
`:null}
|
|
67
67
|
</${u.action?"button":"span"}>
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
</ul>
|
|
71
71
|
`)}
|
|
72
72
|
</div>
|
|
73
|
-
`}function
|
|
73
|
+
`}function ZI(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 QI(e,t){return Wu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function u0(e,t){return`${e}-entry-${t.id}`}function JI(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 Lt`
|
|
74
74
|
<li
|
|
75
|
-
class=${
|
|
75
|
+
class=${Wu("entry",{selected:i,disabled:n.disabled})}
|
|
76
76
|
data-id=${n.id}
|
|
77
|
-
id=${
|
|
77
|
+
id=${u0(t,n)}
|
|
78
78
|
role="option"
|
|
79
79
|
aria-selected=${i||void 0}
|
|
80
80
|
aria-haspopup=${n.entries?"true":void 0}
|
|
@@ -88,17 +88,17 @@
|
|
|
88
88
|
>
|
|
89
89
|
<div class="djs-popup-entry-content">
|
|
90
90
|
<span
|
|
91
|
-
class=${
|
|
91
|
+
class=${Wu("djs-popup-entry-name",n.className)}
|
|
92
92
|
>
|
|
93
|
-
${n.imageUrl&&
|
|
93
|
+
${n.imageUrl&&Lt`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&Lt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
|
|
94
94
|
|
|
95
|
-
${n.label?
|
|
95
|
+
${n.label?Lt`
|
|
96
96
|
<span class="djs-popup-label">
|
|
97
97
|
${n.label}
|
|
98
98
|
</span>
|
|
99
99
|
`:null}
|
|
100
100
|
|
|
101
|
-
${n.documentationRef&&
|
|
101
|
+
${n.documentationRef&&Lt`
|
|
102
102
|
<a
|
|
103
103
|
class="djs-popup-entry-docs"
|
|
104
104
|
href=${n.documentationRef}
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
</a>
|
|
116
116
|
`}
|
|
117
117
|
</span>
|
|
118
|
-
${n.description&&
|
|
118
|
+
${n.description&&Lt`
|
|
119
119
|
<span
|
|
120
120
|
class="djs-popup-entry-description"
|
|
121
121
|
>
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
</span>
|
|
124
124
|
`}
|
|
125
125
|
</div>
|
|
126
|
-
${n.entries&&
|
|
126
|
+
${n.entries&&Lt`
|
|
127
127
|
<div class="djs-popup-entry-chevron" aria-hidden="true">
|
|
128
128
|
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
129
129
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.96967 1.46967C4.26256 1.17678 4.73744 1.17678 5.03033 1.46967L9.03033 5.46967C9.32322 5.76256 9.32322 6.23744 9.03033 6.53033L5.03033 10.5303C4.73744 10.8232 4.26256 10.8232 3.96967 10.5303C3.67678 10.2374 3.67678 9.76256 3.96967 9.46967L7.43934 6L3.96967 2.53033C3.67678 2.23744 3.67678 1.76256 3.96967 1.46967Z" fill="currentColor"/>
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
</div>
|
|
132
132
|
`}
|
|
133
133
|
</li>
|
|
134
|
-
`}function
|
|
134
|
+
`}function eB(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:o,idPrefix:r,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=Gu();Zh(()=>{if(!o||!o.current)return;const h=p.current;if(!h)return;const m=h.querySelector(".selected");m&&tB(m)},[t]);const f=()=>{o.current=!1},d=h=>{o.current||n(h)},g=()=>{o.current||n(null)};return Lt`
|
|
135
135
|
<div
|
|
136
136
|
class="djs-popup-results"
|
|
137
137
|
ref=${p}
|
|
@@ -142,9 +142,9 @@
|
|
|
142
142
|
aria-activedescendant=${l}
|
|
143
143
|
onMouseMove=${f}
|
|
144
144
|
>
|
|
145
|
-
${i.map(h=>
|
|
146
|
-
${h.name&&
|
|
147
|
-
<div key=${h.id} id=${
|
|
145
|
+
${i.map(h=>Lt`
|
|
146
|
+
${h.name&&Lt`
|
|
147
|
+
<div key=${h.id} id=${p0(r,h)} class="entry-header" title=${h.name}>
|
|
148
148
|
${h.name}
|
|
149
149
|
</div>
|
|
150
150
|
`}
|
|
@@ -152,10 +152,10 @@
|
|
|
152
152
|
class="djs-popup-group"
|
|
153
153
|
data-group=${h.id}
|
|
154
154
|
role="group"
|
|
155
|
-
aria-labelledby=${h.name?
|
|
155
|
+
aria-labelledby=${h.name?p0(r,h):void 0}
|
|
156
156
|
>
|
|
157
|
-
${h.entries.map(m=>
|
|
158
|
-
<${
|
|
157
|
+
${h.entries.map(m=>Lt`
|
|
158
|
+
<${JI}
|
|
159
159
|
key=${m.id}
|
|
160
160
|
idPrefix=${r}
|
|
161
161
|
entry=${m}
|
|
@@ -168,19 +168,19 @@
|
|
|
168
168
|
</ul>
|
|
169
169
|
`)}
|
|
170
170
|
</div>
|
|
171
|
-
`}function
|
|
172
|
-
<${
|
|
171
|
+
`}function p0(e,t){return`${e}-group-${t.id}`}function tB(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const nB=new Fr("djs-popup");function iB(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]=Xh([]);zu(()=>{m([])},[f]);const[w,y]=Xh(""),v=w.trim().length>0,x=To(()=>aB(f),[f]),E=To(()=>gn(l)?x.length>5:!1,[l,x]),C=To(()=>{const Y=h.length?h[h.length-1].entries:f;return E?v?p(x.filter(({searchable:Z})=>Z!==!1),w,{keys:["label","search","description"]}).map(({item:Z})=>Z):Y.filter(({rank:Z=0})=>Z>=0):Y},[E,v,x,w,p,h,f]),D=To(()=>v?C.length?[{id:"default",entries:C}]:[]:sB(C),[C,v]),[P,T]=Xh(C[0]),$=Gu(null),j=Gu(!1),G=To(()=>nB.next(),[]),Q=`${G}-results`,te=P&&u0(G,P);zu(()=>{const Y=$.current;Y&&C.includes(Y)?T(Y):T(C[0]),$.current=null},[C]);const V=ac(Y=>{const Z=rB(D);let xe=Z.indexOf(P)+Y;xe<0&&(xe=Z.length-1),xe>=Z.length&&(xe=0),j.current=!0,T(Z[xe])},[D,P]),ee=ac(Y=>{Y>0&&P&&P.entries&&(j.current=!0,m(Z=>[...Z,P])),Y<0&&h.length>0&&(j.current=!0,$.current=h[h.length+Y],m(Z=>Z.slice(0,Y)))},[P,h]),Ee=ac((Y,Z,ce)=>{if(!(!Z||Z.disabled))return Z.entries?(Y.preventDefault(),ee(1)):n(Y,Z,ce)},[n,ee]),Pe=ac(Y=>{if(Y.key==="Enter"&&P){const Z=Y.target;return!!kr(Z,"a, button",!0)||P.disabled?void 0:Ee(Y,P)}if(Y.key==="Backspace"){const Z=Y.target;if(!(Tf(Z,"input")&&Z.value!==""))return ee(-1),Y.preventDefault()}if(Y.key==="ArrowUp")return V(-1),Y.preventDefault();if(Y.key==="ArrowDown")return V(1),Y.preventDefault();if(Y.key==="ArrowRight")return ee(1),Y.preventDefault();if(Y.key==="ArrowLeft")return ee(-1),Y.preventDefault()},[P,V,ee,Ee]),Se=ac(Y=>{Tf(Y.target,"input")&&y(()=>Y.target.value)},[y]);zu(()=>(d(),()=>{g()}),[]);const K=!v&&h.length>0,oe=(a||o.length>0)&&!K;return Lt`
|
|
172
|
+
<${f0}
|
|
173
173
|
onClose=${t}
|
|
174
|
-
onKeyup=${
|
|
175
|
-
onKeydown=${
|
|
174
|
+
onKeyup=${Se}
|
|
175
|
+
onKeydown=${Pe}
|
|
176
176
|
className=${i}
|
|
177
177
|
position=${r}
|
|
178
178
|
width=${s}
|
|
179
179
|
scale=${c}
|
|
180
180
|
navigationStack=${h}
|
|
181
181
|
>
|
|
182
|
-
${oe&&
|
|
183
|
-
<${
|
|
182
|
+
${oe&&Lt`
|
|
183
|
+
<${XI}
|
|
184
184
|
headerEntries=${o}
|
|
185
185
|
onSelect=${n}
|
|
186
186
|
selectedEntry=${P}
|
|
@@ -188,16 +188,16 @@
|
|
|
188
188
|
title=${a}
|
|
189
189
|
/>
|
|
190
190
|
`}
|
|
191
|
-
${K&&
|
|
192
|
-
<${
|
|
191
|
+
${K&&Lt`
|
|
192
|
+
<${KI}
|
|
193
193
|
navigationStack=${h}
|
|
194
194
|
setNavigationStack=${m}
|
|
195
195
|
/>
|
|
196
196
|
`}
|
|
197
|
-
${f.length>0&&
|
|
197
|
+
${f.length>0&&Lt`
|
|
198
198
|
<div class="djs-popup-body">
|
|
199
199
|
|
|
200
|
-
${E&&
|
|
200
|
+
${E&&Lt`
|
|
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,32 +209,32 @@
|
|
|
209
209
|
aria-label="${a||"Search"}"
|
|
210
210
|
aria-expanded="true"
|
|
211
211
|
aria-controls=${Q}
|
|
212
|
-
aria-activedescendant=${
|
|
212
|
+
aria-activedescendant=${te||void 0}
|
|
213
213
|
aria-autocomplete="list"
|
|
214
214
|
/>
|
|
215
215
|
</div>
|
|
216
216
|
`}
|
|
217
217
|
|
|
218
|
-
${v&&
|
|
218
|
+
${v&&Lt`
|
|
219
219
|
<div class="djs-popup-search-count" aria-live="polite">
|
|
220
|
-
${
|
|
220
|
+
${C.length} ${C.length===1?"result":"results"} found
|
|
221
221
|
</div>
|
|
222
222
|
`}
|
|
223
223
|
|
|
224
|
-
<${
|
|
224
|
+
<${eB}
|
|
225
225
|
groupedEntries=${D}
|
|
226
226
|
selectedEntry=${P}
|
|
227
227
|
setSelectedEntry=${T}
|
|
228
228
|
keyboardSelection=${j}
|
|
229
|
-
onAction=${
|
|
230
|
-
idPrefix=${
|
|
229
|
+
onAction=${Ee}
|
|
230
|
+
idPrefix=${G}
|
|
231
231
|
id=${Q}
|
|
232
232
|
ariaLabel=${a||"Results"}
|
|
233
233
|
tabIndex=${E?-1:0}
|
|
234
|
-
ariaActivedescendant=${E?void 0:
|
|
234
|
+
ariaActivedescendant=${E?void 0:te||void 0}
|
|
235
235
|
/>
|
|
236
236
|
|
|
237
|
-
${P&&P.documentationRef&&
|
|
237
|
+
${P&&P.documentationRef&&Lt`
|
|
238
238
|
<div class="djs-popup-footer">
|
|
239
239
|
<a
|
|
240
240
|
class="djs-popup-footer-docs"
|
|
@@ -254,14 +254,14 @@
|
|
|
254
254
|
`}
|
|
255
255
|
</div>
|
|
256
256
|
`}
|
|
257
|
-
${u&&
|
|
258
|
-
<div class="djs-popup-no-results">${
|
|
257
|
+
${u&&C.length===0&&Lt`
|
|
258
|
+
<div class="djs-popup-no-results">${wn(u)?u(w):u}</div>
|
|
259
259
|
`}
|
|
260
|
-
</${
|
|
261
|
-
`}function
|
|
260
|
+
</${f0}>
|
|
261
|
+
`}function f0(e){const{onClose:t,onKeydown:n,onKeyup:i,className:o,children:r,navigationStack:a,position:s}=e,c=Gu();return Zh(()=>{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]),Zh(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),zu(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!kr(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)}},[]),Lt`
|
|
262
262
|
<div
|
|
263
|
-
class=${
|
|
264
|
-
style=${
|
|
263
|
+
class=${Wu("djs-popup",o)}
|
|
264
|
+
style=${oB(e)}
|
|
265
265
|
onKeydown=${n}
|
|
266
266
|
onKeyup=${i}
|
|
267
267
|
ref=${c}
|
|
@@ -269,8 +269,8 @@
|
|
|
269
269
|
>
|
|
270
270
|
${r}
|
|
271
271
|
</div>
|
|
272
|
-
`}function
|
|
273
|
-
<${
|
|
272
|
+
`}function oB(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:gn(t)?n:void 0,maxWidth:gn(t)?"unset":void 0,"transform-origin":"top left"}}function rB(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function aB(e){const t=[];function n(i){i.forEach(o=>{if(o.entries){n(o.entries);return}t.push(o)})}return n(e),t}function sB(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 cB="data-id",d0=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],lB=1e3;function Zt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var o=gn(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:o},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",r=>{const a=this.isOpen()&&this._current.target;r.element===a&&this.refresh()})}Zt.$inject=["config.popupMenu","eventBus","canvas","search"],Zt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:o,options:r}=this._current,a=h0(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),l=this._updateScale(this._current.container);X_(Lt`
|
|
273
|
+
<${iB}
|
|
274
274
|
onClose=${f=>this.close(f)}
|
|
275
275
|
onSelect=${(f,d,g)=>this.trigger(f,d,g)}
|
|
276
276
|
position=${c}
|
|
@@ -284,7 +284,7 @@
|
|
|
284
284
|
searchFn=${this._search}
|
|
285
285
|
...${{...r}}
|
|
286
286
|
/>
|
|
287
|
-
`,this._current.container)},
|
|
287
|
+
`,this._current.container)},Zt.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");var o=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(o===!1)return;this.isOpen()&&this.close();const{entries:r,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:r,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},Zt.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:o}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:o},this._emit("refresh"),this._render()},Zt.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),o=this._getHeaderEntries(e,n),r=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:o,emptyPlaceholder:r,empty:!(Object.keys(i).length||Object.keys(o).length)}},Zt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Zt.prototype.reset=function(){const e=this._current.container;X_(null,e),Xi(e)},Zt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Zt.prototype._onOpened=function(){this._emit("opened")},Zt.prototype._onClosed=function(){this._emit("closed")},Zt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=zt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Zt.prototype._bindAutoClose=function(){this._eventBus.once(d0,this.close,this)},Zt.prototype._unbindAutoClose=function(){this._eventBus.off(d0,this.close,this)},Zt.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,o=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),gn(n)&&e<n&&(o=n),gn(i)&&e>i&&(o=i)),o},Zt.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),o={},r=t.x,a=t.y;return t.x+i.width>n.width&&(o.x=!0),t.y+i.height>n.height&&(o.y=!0),o.x&&o.y?(r=t.x-i.width,a=t.y-i.height):o.x?(r=t.x-i.width,a=t.y):o.y&&t.y<i.height?(r=t.x,a=10):o.y&&(r=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:r,y:a}},Zt.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length?!0:this._getContext(e,t).empty},Zt.prototype.registerProvider=function(e,t,n){n||(n=t,t=lB),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Zt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Zt.prototype._getEntries=function(e,t){var n={};return z(t,function(i){if(!i.getPopupMenuEntries){z(i.getEntries(e),function(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);wn(o)?n=o(n):z(o,function(r,a){n[a]=r})}),n},Zt.prototype._getHeaderEntries=function(e,t){var n={};return z(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;z(i.getHeaderEntries(e),function(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);wn(o)?n=o(n):z(o,function(r,a){n[a]=r})}),n},Zt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>wn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Zt.prototype.isOpen=function(){return!!this._current},Zt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let o=kr(e.delegateTarget||e.target,".entry",!0),r=Rn(o,cB);t={id:r,...this._getEntry(r)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(wn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Zt.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};function h0(e,t=[]){return Object.entries(e).map(([n,i])=>{const o={id:n,...i};return o.entries?o.entries=h0(o.entries,[...t,...g0(o.search)]):t.length&&(o.search=[...t,...g0(o.search)]),o})}function g0(e){return e?Ue(e)?e:[e]:[]}function uB(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=pB(r,o,i);return a?{item:r,tokens:a}:[]}).sort(fB(i))}function pB(e,t,n){const{matchedWords:i,tokens:o}=n.reduce((r,a)=>{const s=e[a],{tokens:c,matchedWords:l}=Ue(s)?s.reduce((u,p)=>{const{tokens:f,matchedWords:d}=x0(p,t);return{tokens:[...u.tokens,f],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):x0(s,t);return{tokens:{...r.tokens,[a]:c},matchedWords:{...r.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:o}function fB(e){return(t,n)=>{let i=0,o=1;for(const r of e){const a=dB(t.tokens[r],n.tokens[r]);if(a!==0){i+=a*o,o*=m0;continue}const s=hB(t.item[r],n.item[r]);if(s!==0){i+=s*o,o*=m0;continue}}return i}}function dB(e,t){return y0(t)-y0(e)}const m0=.5,Ua={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function y0(e){const t=e.reduce((s,c)=>s+v0(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 v0(e){if(Ue(e))return Math.max(...e.map(v0));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Ua.FULL:e.wordEnd?Ua.START_FULL_WORD:Ua.START_WORD_PART:e.wordStart?Ua.WORD_START:Ua.WORD_PART)*t:Ua.NO_MATCH*t}function b0(e=""){return Ue(e)?e.join(", "):e}function hB(e,t){return b0(e).localeCompare(b0(t))}function x0(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},o=t.map(gB),r=[`(?<all>${o.join("\\s+")})`,...o].join("|"),a=new RegExp(r,"ig");let s,c=0;for(;s=a.exec(e);){const[u]=s,p=s.index,f=s.index+u.length,d=p===0,g=f===e.length,h=!!((l=s.groups)!=null&&l.all),m=d||/\s/.test(e.charAt(p-1)),w=g||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:u,index:s.index,match:!0,wordStart:m,wordEnd:w,start:d,end:g,all:h});const y=h?t:[u];for(const v of y)i[v.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function gB(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const w0={search:["value",uB]},eg={__depends__:[w0],__init__:["popupMenu"],popupMenu:["type",Zt]};var _0={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>`},hB=900;function Va(e,t,n,i){e.registerProvider(hB,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)&&q(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">${w0.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);q(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},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 gB=["left","center","right","top","middle","bottom"];function ac(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}ac.$inject=["popupMenu","alignElements","translate","rules"],ac.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&q(t,this._getEntries(e)),t},ac.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},ac.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return z(gB,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:w0[r],action:function(){t.trigger(e,r),i.close()}}}),o};function Vu(e){Ci.call(this,e)}Vu.$inject=["eventBus"],Le(Vu,Ci),Vu.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=ul(n),n.length<2?!1:n})};const mB={__depends__:[MI,O_,Jh],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Va],alignElementsMenuProvider:["type",ac],bpmnAlignElements:["type",Vu]};function To(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=Pp(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});z(u,function(p,f){We(l)&&(p=p.filter(function(d){return Lt(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)})}To.$inject=["eventBus","elementRegistry","modeling","rules"],Le(To,de),To.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=ze(on(e)),r=ze(t),a={};return o.top-r.top<i.top&&(a.top=o.top-n.top),o.left-r.left<i.left&&(a.left=o.left-n.left),r.right-o.right<i.right&&(a.right=o.right+n.right),r.bottom-o.bottom<i.bottom&&(a.bottom=o.bottom+n.bottom),dl(q({},r,a))},To.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(yB(i,t)){var o=vB(Ni(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:o});var r=t.parent;r&&this._expand([t],r)}}},To.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},To.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},To.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function yB(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function vB(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 Wu(e){e.invoke(To,this)}Wu.$inject=["injector"],Le(Wu,To),Wu.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 sc(e){Ci.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}sc.$inject=["eventBus"],Le(sc,Ci),sc.prototype.canResize=function(e,t){return!1};function Uu(e,t){sc.call(this,e),this._modeling=t}Le(Uu,sc),Uu.$inject=["eventBus","modeling"],Uu.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 z(e,function(i){if(A(i,"bpmn:Lane")||nt(i)){n=!1;return}}),n};const bB={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Wu],bpmnAutoResizeProvider:["type",Uu]};function Wa(e,t,n){this._canvas=n,this._opts=q({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(o){var r=i._toBorderPoint(o);i.startScroll(r)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}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++)xB(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 xB(e,t,n){return t<e&&e<n}Wa.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Wa.prototype.setOptions=function(e){this._opts=q({},this._opts,e)},Wa.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Ir(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const wB={__depends__:[So],__init__:["autoScroll"],autoScroll:["type",Wa]};var _0="djs-bendpoint",E0="djs-segment-dragger";function _B(e,t){var n=Ir(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 eg(e,t,n){var i=_B(e,n),o=hd(t,i);return o}function tg(e,t){var n=$e("g");lt(n).add(_0),Ke(e,n);var i=$e("circle");Ae(i,{cx:0,cy:0,r:4}),lt(i).add("djs-visual"),Ke(n,i);var o=$e("circle");return Ae(o,{cx:0,cy:0,r:10}),lt(o).add("djs-hit"),Ke(n,o),t&<(n).add(t),n}function EB(e,t,n,i){var o=$e("g");Ke(e,o);var r=18,a=6,s=11,c=RB(t,n,i),l=a+s,u=$e("rect");Ae(u,{x:-r/2,y:-a/2,width:r,height:a}),lt(u).add("djs-visual"),Ke(o,u);var p=$e("rect");return Ae(p,{x:-c/2,y:-l/2,width:c,height:l}),lt(p).add("djs-hit"),Ke(o,p),Iv(o,i==="v"?90:0),o}function S0(e,t,n){var i=$e("g"),o=Gf(t,n),r=vo(t,n);return Ke(e,i),EB(i,t,n,r),lt(i).add(E0),lt(i).add(r==="h"?"horizontal":"vertical"),kn(i,o.x,o.y),i}function ng(e){return Math.abs(Math.round(e*2/3))}function SB(e,t){var n=CB(e,t);return xd(e,n)}function RB(e,t,n){var i=t.x-e.x,o=t.y-e.y;return ng(n==="h"?i:o)}function CB(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=wb(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function R0(e,t,n,i,o){function r(v,x,E){var M=v.index,D=v.point,P,T,N,j,V,Q;return M<=0||v.bendpoint?!1:(P=x[M-1],T=x[M],N=Gf(P,T),j=vo(P,T),V=Math.abs(D.x-N.x),Q=Math.abs(D.y-N.y),j&&V<=E&&Q<=E)}function a(v,x){var E=v.waypoints,M,D,P,T;return x.index<=0||x.bendpoint||(M={start:E[x.index-1],end:E[x.index]},D=vo(M.start,M.end),!D)?null:(D==="h"?P=M.end.x-M.start.x:P=M.end.y-M.start.y,T=ng(P)/2,T)}function s(v,x){var E=x.waypoints,M=eg(t,E,v),D;if(M){D=a(x,M);var P;if(r(M,E,D)?P=o.start(v,x,M.index):P=i.start(v,x,M.index,!M.bendpoint),P!==!1)return!0}}function c(v,x,E){je.bind(v,x,function(M){n.triggerMouseEvent(x,M,E),M.stopPropagation()})}function l(v,x){var E=t.getLayer("overlays"),M=Et('.djs-bendpoints[data-element-id="'+zr(v.id)+'"]',E);return!M&&x&&(M=$e("g"),Ae(M,{"data-element-id":v.id}),lt(M).add("djs-bendpoints"),Ke(E,M),c(M,"mousedown",v),c(M,"click",v),c(M,"dblclick",v)),M}function u(v,x){return Et('.djs-segment-dragger[data-segment-idx="'+v+'"]',x)}function p(v,x){x.waypoints.forEach(function(E,M){var D=tg(v);Ke(v,D),kn(D,E.x,E.y)}),tg(v,"floating")}function f(v,x){for(var E=x.waypoints,M,D,P,T=1;T<E.length;T++)M=E[T-1],D=E[T],vo(M,D)&&(P=S0(v,M,D),Ae(P,{"data-segment-idx":T}),c(P,"mousemove",x))}function d(v){z(ms("."+_0,v),function(x){nn(x)})}function g(v){z(ms("."+E0,v),function(x){nn(x)})}function h(v){var x=l(v);return x||(x=l(v,!0),p(x,v),f(x,v)),x}function m(v){var x=l(v);x&&(g(x),d(x),f(x,v),p(x,v))}function w(v,x){var E=Et(".floating",v),M=x.point;E&&(kn(E,M.x,M.y),lt(E).add("positioned"))}function y(v,x,E){var M=u(x.index,v),D=E[x.index-1],P=E[x.index],T=x.point,N=Gf(D,P),j=vo(D,P),V,Q;M&&(V=MB(M),Q={x:T.x-N.x,y:T.y-N.y},j==="v"&&(Q={x:Q.y,y:Q.x}),kn(V,Q.x,Q.y))}e.on("connection.changed",function(v){m(v.element)}),e.on("connection.remove",function(v){var x=l(v.element);x&&nn(x)}),e.on("element.marker.update",function(v){var x=v.element,E;x.waypoints&&(E=h(x),v.add?lt(E).add(v.marker):lt(E).remove(v.marker))}),e.on("element.mousemove",function(v){var x=v.element,E=x.waypoints,M,D;if(E){if(M=l(x,!0),D=eg(t,E,v.originalEvent),!D)return;w(M,D),D.bendpoint||y(M,D,E)}}),e.on("element.mousedown",function(v){if(nr(v)){var x=v.originalEvent,E=v.element;if(E.waypoints)return s(x,E)}}),e.on("selection.changed",function(v){var x=v.newSelection,E=x[0];E&&E.waypoints&&h(E)}),e.on("element.hover",function(v){var x=v.element;x.waypoints&&h(x)}),e.on("element.out",function(v){var x=v.element;if(x.waypoints){var E=l(x);if(E){var M=Et(".floating",E);M&<(M).remove("positioned")}}}),e.on("element.updateId",function(v){var x=v.element,E=v.newId;if(x.waypoints){var M=l(x);M&&Ae(M,{"data-element-id":E})}}),this.addHandles=h,this.updateHandles=m,this.getBendpointsContainer=l,this.getSegmentDragger=u}R0.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function MB(e){return Et(".djs-visual",e)}var C0=Math.round,Wr="reconnectStart",Ur="reconnectEnd",cc="updateWaypoints";function ig(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=Wr:!l&&c===d.length-1?g=Ur:g=cc;var h=g===cc?"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===cc?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=o.allowed(g,{connection:c,source:f===Wr?p:l,target:f===Ur?p:u}),d){s.source=f===Wr?p:l,s.target=f===Ur?p:u;return}d===!1&&(d=s.allowed=o.allowed(g,{connection:c,source:f===Ur?p:u,target:f===Wr?p:l})),d&&(s.source=f===Ur?p:u,s.target=f===Wr?p:l)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==cc&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,p=s.insert,f=u.waypoints.slice(),d=s.source,g=s.target,h=s.type,m=s.hints||{},w={x:C0(a.x),y:C0(a.y)};if(!c)return!1;h===cc?(p?f.splice(l,0,w):f[l]=w,m.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),r.updateWaypoints(u,OP(f),m)):(h===Wr?(m.docking="source",qu(s)&&(m.docking="target",m.newWaypoints=f.reverse())):h===Ur&&(m.docking="target",qu(s)&&(m.docking="source",m.newWaypoints=f.reverse())),r.reconnect(u,d,g,w,m))},this)}ig.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],ig.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 qu(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===Wr)return t&&i&&t===i&&n!==i;if(o===Ur)return t&&n&&t===n&&n!==i}var AB="reconnectStart",PB="reconnectEnd",M0="updateWaypoints",lc="connect-ok",Yu="connect-not-ok",A0="connect-hover",P0="djs-updating",T0="djs-dragging",k0=1100;function O0(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=tg(i.getLayer("overlays"));lt(f).add("djs-dragging"),i.addMarker(c,T0),i.addMarker(c,P0)}),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,A0),l===M0)return;s?(i.removeMarker(c,Yu),i.addMarker(c,lc)):s===!1&&(i.removeMarker(c,lc),i.addMarker(c,Yu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],k0,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,A0),i.removeMarker(s,c?lc:Yu))}),n.on("bendpoint.move.move",function(r){var a=r.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,f=a.connection,d=f.source,g=f.target,h=f.waypoints.slice(),m={x:r.x,y:r.y},w=a.hints||{},y={};o&&(w.connectionStart&&(y.connectionStart=w.connectionStart),w.connectionEnd&&(y.connectionEnd=w.connectionEnd),p===AB?qu(a)?(y.connectionEnd=y.connectionEnd||m,y.source=g,y.target=u||d,h=h.reverse()):(y.connectionStart=y.connectionStart||m,y.source=u||d,y.target=g):p===PB?qu(a)?(y.connectionStart=y.connectionStart||m,y.source=u||g,y.target=d,h=h.reverse()):(y.connectionEnd=y.connectionEnd||m,y.source=d,y.target=u||g):(y.noCropping=!0,y.noLayout=!0,h[c]=m),p===M0&&(h=e.cropWaypoints(f,h)),y.waypoints=h,o.drawPreview(a,s,y)),kn(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],k0,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,nn(c),i.removeMarker(s,P0),i.removeMarker(s,T0),l&&(i.removeMarker(l,lc),i.removeMarker(l,u?lc:Yu)),o&&o.cleanUp(a)})}O0.$inject=["bendpointMove","injector","eventBus","canvas"];var D0="connect-hover",L0="djs-updating";function I0(e,t,n){return og(e,t,e[t]+n)}function og(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function TB(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 og(t,i,s)}function B0(e){return e==="x"?"y":"x"}function N0(e,t,n){var i,o;return e.original?e.original:(i=qe(t),o=B0(n),og(e,o,i[o]))}function $0(e,t,n,i,o,r){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var g,h=n.getGraphics(f),m=d-1,w=d,y=f.waypoints,v=y[m],x=y[w],E=eg(n,y,p),M,D,P;if(M=vo(v,x),!!M)return D=M==="v"?"x":"y",m===0&&(v=N0(v,f.source,D)),w===y.length-1&&(x=N0(x,f.target,D)),E?P=E.point:P={x:(v.x+x.x)/2,y:(v.y+x.y)/2},g={connection:f,segmentStartIndex:m,segmentEndIndex:w,segmentStart:v,segmentEnd:x,axis:D,dragPosition:P},i.init(p,P,"connectionSegment.move",{cursor:D==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:h,context:g}})};function s(p,f){if(!a)return f;var d=p.waypoints,g;return p.waypoints=f,g=a.getCroppedWaypoints(p),p.waypoints=d,g}function c(p){o.update("connection",p.connection,p.connectionGfx)}function l(p,f,d){var g=p.newWaypoints,h=p.segmentStartIndex+f,m=g[h],w=p.segmentEndIndex+f,y=g[w],v=B0(p.axis),x=TB(d,m,y,v);kn(p.draggerGfx,x.x,x.y)}function u(p,f){var d=0,g=p.filter(function(h,m){return zf(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=S0(g,f.segmentStart,f.segmentEnd),lt(f.draggerGfx).add("djs-dragging"),n.addMarker(d,L0)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,m=f.segmentStart,w=f.segmentEnd,y=f.axis,v=f.originalWaypoints.slice(),x=I0(m,y,p["d"+y]),E=I0(w,y,p["d"+y]),M=v.length,D=0;v[g]=x,v[h]=E;var P,T;g<2&&(P=Tn(d.source,x),g===1?P==="intersect"&&(v.shift(),v[0]=x,D--):P!=="intersect"&&(v.unshift(m),D++)),h>M-3&&(T=Tn(d.target,E),h===M-2?T==="intersect"&&(v.pop(),v[v.length-1]=E):T!=="intersect"&&v.push(w)),f.newWaypoints=d.waypoints=s(d,v),l(f,D,p),f.newSegmentStartIndex=g+D,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,D0)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,D0)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&nn(f.draggerGfx),n.removeMarker(d,L0)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,g=f.newWaypoints,h=f.newSegmentStartIndex;g=g.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var m=u(g,h),w=m.waypoints,y=s(d,w),v=m.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+v}};r.updateWaypoints(d,y,x)})}$0.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var kB=Math.abs,F0=Math.round;function OB(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],kB(o-e)<=n)return o}function j0(e){return{x:e.x,y:e.y}}function H0(e){return{x:e.x+e.width,y:e.y+e.height}}function Ti(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:F0(e.x+e.width/2),y:F0(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 cn(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,o=e[t],r=e.snapped=e.snapped||{};return n===!1?r[t]=!1:(r[t]=!0,i=n-o,e[t]+=i,e["d"+t]+=i),o}function z0(e){return e.children||[]}var DB=Math.abs,G0=Math.round,rg=10;function V0(e){function t(r,a){if(We(r)){for(var s=r.length;s--;)if(DB(r[s]-a)<=rg)return r[s]}else{r=+r;var c=a%r;if(c<rg)return a-c;if(c>r-rg)return a-c+r}return a}function n(r,a){if(r.waypoints)return SB(a,r);if(r.width)return{x:G0(r.width/2+r.x),y:G0(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;q(r,{dx:r.dx-p,dy:r.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&cn(r,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&cn(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);!Tt(s)||!c||!c.x||!c.y||(cn(r,"x",c.x),cn(r,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var a=r.context,s=o(a),c=a.hover,l=c&&n(c,r),u=r.x,p=r.y,f,d;if(s){f=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var g=u-f,h=p-d;q(r,{dx:r.dx-g,dy:r.dy-h,x:r.x-g,y:r.y-h}),(g||s.vertical.indexOf(u)!==-1)&&cn(r,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&cn(r,"y",d)}})}V0.$inject=["eventBus"];const LB={__depends__:[So,io],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",R0],bendpointMove:["type",ig],bendpointMovePreview:["type",O0],connectionSegmentMove:["type",$0],bendpointSnapping:["type",V0]};function W0(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,g={connectionStart:ag(s)?u:l,connectionEnd:ag(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}}})}}W0.$inject=["eventBus","dragging","modeling","rules"];function ag(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var IB=1100,BB=900,U0="connect-ok",q0="connect-not-ok";function Y0(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;ag(r)&&(g=d,h=f),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",BB,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?U0:q0)}),t.on(["connect.out","connect.cleanup"],IB,function(o){var r=o.hover;r&&(n.removeMarker(r,U0),n.removeMarker(r,q0))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}Y0.$inject=["injector","eventBus","canvas"];const sg={__depends__:[Mi,io,So],__init__:["connectPreview"],connect:["type",W0],connectPreview:["type",Y0]};var NB="djs-dragger";function ko(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)}ko.$inject=["injector","canvas","graphicsFactory","elementFactory"],ko.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()),ys(i),o||(o=e.getConnection=$B(function(h,m,w){return g.getConnection(h,m,w)})),t&&(d=o(t,r,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:r,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[r?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)"})},ko.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)},ko.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&&Ss(r,s,!0)||e,t=i&&Ss(a,s,!1)||t,[e,t]},ko.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&nn(e.connectionPreviewGfx)},ko.prototype.getConnection=function(e){var t=FB(e);return this._elementFactory.createConnection(t)},ko.prototype.createConnectionPreviewGfx=function(){var e=$e("g");return Ae(e,{pointerEvents:"none"}),lt(e).add(NB),Ke(this._canvas.getActiveLayer(),e),e},ko.prototype.createNoopConnection=function(e,t){return xs([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function $B(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 FB(e){return hn(e)?e:{}}const jB={__init__:["connectionPreview"],connectionPreview:["type",ko]},Ku="complex-preview";class K0{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(Ku);n.filter(s=>!HB(s)).forEach(s=>{let c;Tt(s)?(c=this._graphicsFactory._createContainer("connection",$e("g")),this._graphicsFactory.drawConnection(Xo(c),s)):(c=this._graphicsFactory._createContainer("shape",$e("g")),this._graphicsFactory.drawShape(Xo(c),s),kn(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);Tt(s)?kn(l,c.x,c.y):kn(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",$e("g"));this._graphicsFactory.drawShape(Xo(l),s,{width:c.width,height:c.height}),kn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){ys(this._canvas.getLayer(Ku)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Ku)}hide(){this._canvas.hideLayer(Ku)}}K0.$inject=["canvas","graphicsFactory","previewSupport"];function HB(e){return e.hidden}const zB={__depends__:[Ia],__init__:["complexPreview"],complexPreview:["type",K0]},X0=Math.round;function Xu(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}Xu.prototype.create=function(e,t,n){const i=this._complexPreview,o=this._connectionDocking,r=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,l=r.createShape(q({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;q(l,{x:u.x-X0(l.width/2),y:u.y-X0(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))})},Xu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Xu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const GB={__depends__:[xu,zB,Ah],__init__:["appendPreview"],appendPreview:["type",Xu]};var Z0=Math.min,Q0=Math.max;function cg(e){e.preventDefault()}function uc(e){e.stopPropagation()}function VB(e){return e.nodeType===Node.TEXT_NODE}function WB(e){return[].slice.call(e)}function Vi(e){this.container=e.container,this.parent=$t('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Et("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Kn(this.autoResize,this),this.handlePaste=Kn(this.handlePaste,this)}Vi.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=Ni(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);q(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var l=Ni(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return q(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&q(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,je.bind(a,"keydown",this.keyHandler),je.bind(a,"mousedown",uc),je.bind(a,"paste",o.handlePaste),je.bind(a,"focusout",this.focusoutHandler),i.autoResize&&je.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},Vi.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)}},Vi.prototype.insertText=function(e){e=UB(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Vi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=WB(a.childNodes),c,l;if(VB(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&&Zi(g)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Vi.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})}},Vi.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){cg(g),uc(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,je.bind(document,"mousemove",f),je.bind(document,"mouseup",d)},f=function(g){cg(g),uc(g);var h=Z0(Q0(l+g.clientX-s,i),r),m=Z0(Q0(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){cg(g),uc(g),je.unbind(document,"mousemove",f,!1),je.unbind(document,"mouseup",d,!1)};je.bind(n,"mousedown",p)}q(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Vi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),je.unbind(t,"keydown",this.keyHandler),je.unbind(t,"mousedown",uc),je.unbind(t,"input",this.autoResize),je.unbind(t,"paste",this.handlePaste),je.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Zi(n)),Zi(e)},Vi.prototype.getValue=function(){return this.content.innerText.trim()},Vi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Vi.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};function UB(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
-
`)}function li(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Vi({container:t.getContainer(),keyHandler:Kn(this._handleKey,this),resizeHandler:Kn(this._handleResize,this),focusoutHandler:Kn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}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 J0={__depends__:[Xl],__init__:["directEditing"],directEditing:["type",li]};function qB(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 YB={task:{label:"Task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},"user-task":{label:"User task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},"service-task":{label:"Service task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},"send-task":{label:"Send task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},"receive-task":{label:"Receive task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},"manual-task":{label:"Manual task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},"rule-task":{label:"Business rule task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},"script-task":{label:"Script task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},"call-activity":{label:"Call activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},transaction:{label:"Transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},"event-subprocess":{label:"Event sub-process",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},"collapsed-subprocess":{label:"Sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},"expanded-subprocess":{label:"Sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},"collapsed-ad-hoc-subprocess":{label:"Ad-hoc sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},"expanded-ad-hoc-subprocess":{label:"Ad-hoc sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},"exclusive-gateway":{label:"Exclusive gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},"parallel-gateway":{label:"Parallel gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},"inclusive-gateway":{label:"Inclusive gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},"complex-gateway":{label:"Complex gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},"event-based-gateway":{label:"Event-based gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}},"data-store-reference":{label:"Data store reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}},"data-object-reference":{label:"Data object reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}},"expanded-pool":{label:"Expanded pool/participant",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},"collapsed-pool":{label:"Empty pool/participant",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}},"none-start-event":{label:"Start event",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},"none-intermediate-throwing":{label:"Intermediate throw event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},"none-boundary-event":{label:"Boundary event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:BoundaryEvent"}},"none-end-event":{label:"End event",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},"message-start":{label:"Message start event",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},"timer-start":{label:"Timer start event",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},"conditional-start":{label:"Conditional start event",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},"signal-start":{label:"Signal start event",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},"error-start":{label:"Error start event",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},"escalation-start":{label:"Escalation start event",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},"compensation-start":{label:"Compensation start event",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},"non-interrupting-message-start":{label:"Message start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},"non-interrupting-timer-start":{label:"Timer start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},"non-interrupting-conditional-start":{label:"Conditional start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},"non-interrupting-signal-start":{label:"Signal start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},"non-interrupting-escalation-start":{label:"Escalation start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}},"message-intermediate-catch":{label:"Message intermediate catch event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"message-intermediate-throw":{label:"Message intermediate throw event",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"timer-intermediate-catch":{label:"Timer intermediate catch event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},"escalation-intermediate-throw":{label:"Escalation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"conditional-intermediate-catch":{label:"Conditional intermediate catch event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},"link-intermediate-catch":{label:"Link intermediate catch event",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"link-intermediate-throw":{label:"Link intermediate throw event",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"compensation-intermediate-throw":{label:"Compensation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-intermediate-catch":{label:"Signal intermediate catch event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"signal-intermediate-throw":{label:"Signal intermediate throw event",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"message-boundary":{label:"Message boundary event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},"timer-boundary":{label:"Timer boundary event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},"escalation-boundary":{label:"Escalation boundary event",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},"conditional-boundary":{label:"Conditional boundary event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},"error-boundary":{label:"Error boundary event",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},"cancel-boundary":{label:"Cancel boundary event",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},"signal-boundary":{label:"Signal boundary event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},"compensation-boundary":{label:"Compensation boundary event",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},"non-interrupting-message-boundary":{label:"Message boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},"non-interrupting-timer-boundary":{label:"Timer boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},"non-interrupting-escalation-boundary":{label:"Escalation boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},"non-interrupting-conditional-boundary":{label:"Conditional boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},"non-interrupting-signal-boundary":{label:"Signal boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}},"message-end":{label:"Message end event",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"escalation-end":{label:"Escalation end event",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"error-end":{label:"Error end event",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},"cancel-end":{label:"Cancel end event",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},"compensation-end":{label:"Compensation end event",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-end":{label:"Signal end event",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"terminate-end":{label:"Terminate end event",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}};function pe(e,t={}){var n=YB[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var KB=[pe("none-start-event",{actionName:"replace-with-none-start"}),pe("none-intermediate-throwing"),pe("none-end-event",{actionName:"replace-with-none-end"}),pe("message-start"),pe("timer-start"),pe("conditional-start"),pe("signal-start")],XB=[pe("none-start-event",{actionName:"replace-with-none-start"}),pe("none-intermediate-throwing"),pe("none-end-event",{actionName:"replace-with-none-end"})],ZB=[pe("none-start-event",{actionName:"replace-with-none-start"}),pe("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),pe("none-end-event",{actionName:"replace-with-none-end"}),pe("message-intermediate-catch"),pe("message-intermediate-throw"),pe("timer-intermediate-catch"),pe("escalation-intermediate-throw"),pe("conditional-intermediate-catch"),pe("link-intermediate-catch"),pe("link-intermediate-throw"),pe("compensation-intermediate-throw"),pe("signal-intermediate-catch"),pe("signal-intermediate-throw")],QB=[pe("none-start-event",{actionName:"replace-with-none-start"}),pe("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),pe("none-end-event",{actionName:"replace-with-none-end"}),pe("message-end"),pe("escalation-end"),pe("error-end"),pe("cancel-end"),pe("compensation-end"),pe("signal-end"),pe("terminate-end")],JB=[pe("exclusive-gateway"),pe("parallel-gateway"),pe("inclusive-gateway"),pe("complex-gateway"),pe("event-based-gateway")],eN=[pe("transaction"),pe("event-subprocess"),pe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),pe("collapsed-subprocess")],tN=[pe("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),pe("transaction"),pe("event-subprocess"),pe("collapsed-ad-hoc-subprocess")],eE=[pe("transaction"),pe("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),pe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),pe("event-subprocess")],nN=eE,tE=[pe("task"),pe("user-task"),pe("service-task"),pe("send-task"),pe("receive-task"),pe("manual-task"),pe("rule-task"),pe("script-task"),pe("call-activity"),pe("collapsed-subprocess"),pe("expanded-subprocess"),pe("collapsed-ad-hoc-subprocess"),pe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],iN=[pe("data-store-reference")],oN=[pe("data-object-reference")],rN=[pe("message-boundary"),pe("timer-boundary"),pe("escalation-boundary"),pe("conditional-boundary"),pe("error-boundary"),pe("cancel-boundary"),pe("signal-boundary"),pe("compensation-boundary"),pe("non-interrupting-message-boundary"),pe("non-interrupting-timer-boundary"),pe("non-interrupting-escalation-boundary"),pe("non-interrupting-conditional-boundary"),pe("non-interrupting-signal-boundary")],aN=[pe("message-start"),pe("timer-start"),pe("conditional-start"),pe("signal-start"),pe("error-start"),pe("escalation-start"),pe("compensation-start"),pe("non-interrupting-message-start"),pe("non-interrupting-timer-start"),pe("non-interrupting-conditional-start"),pe("non-interrupting-signal-start"),pe("non-interrupting-escalation-start")],sN=[{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"}],cN=[pe("expanded-pool"),pe("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],lN={"bpmn:MessageEventDefinition":[pe("message-start"),pe("message-intermediate-catch"),pe("message-intermediate-throw"),pe("message-end")],"bpmn:TimerEventDefinition":[pe("timer-start"),pe("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[pe("conditional-start"),pe("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[pe("signal-start"),pe("signal-intermediate-catch"),pe("signal-intermediate-throw"),pe("signal-end")],"bpmn:ErrorEventDefinition":[pe("error-start"),pe("error-end")],"bpmn:EscalationEventDefinition":[pe("escalation-start"),pe("escalation-intermediate-throw"),pe("escalation-end")],"bpmn:CompensateEventDefinition":[pe("compensation-start"),pe("compensation-intermediate-throw"),pe("compensation-end")]};const nE={"start-event-non-interrupting":`
|
|
315
|
+
</svg>`},mB=900;function qa(e,t,n,i){e.registerProvider(mB,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}qa.$inject=["contextPad","popupMenu","translate","canvas"],qa.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&q(t,this._getEntries(e)),t},qa.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},qa.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${_0.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);q(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},qa.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 yB=["left","center","right","top","middle","bottom"];function sc(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}sc.$inject=["popupMenu","alignElements","translate","rules"],sc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&q(t,this._getEntries(e)),t},sc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},sc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return z(yB,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:_0[r],action:function(){t.trigger(e,r),i.close()}}}),o};function Uu(e){Ri.call(this,e)}Uu.$inject=["eventBus"],Te(Uu,Ri),Uu.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=fl(n),n.length<2?!1:n})};const vB={__depends__:[PI,D_,eg],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",qa],alignElementsMenuProvider:["type",sc],bpmnAlignElements:["type",Uu]};function ko(e,t,n,i){ge.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=Tp(aa(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=sa(s,function(p){return p.parent.id});z(u,function(p,f){Ue(l)&&(p=p.filter(function(d){return Bt(l,ca({id:d.id}))})),o._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(r){var a=r.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||o._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(r){var a=r.context,s=a.hints,c=a.shape,l=c.parent;s&&s.autoResize===!1||l&&o._expand([c],l)})}ko.$inject=["eventBus","elementRegistry","modeling","rules"],Te(ko,ge),ko.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=ze(sn(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),gl(q({},r,a))},ko.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(bB(i,t)){var o=xB(Bi(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:o});var r=t.parent;r&&this._expand([t],r)}}},ko.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},ko.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},ko.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function bB(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function xB(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 qu(e){e.invoke(ko,this)}qu.$inject=["injector"],Te(qu,ko),qu.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 cc(e){Ri.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}cc.$inject=["eventBus"],Te(cc,Ri),cc.prototype.canResize=function(e,t){return!1};function Yu(e,t){cc.call(this,e),this._modeling=t}Te(Yu,cc),Yu.$inject=["eventBus","modeling"],Yu.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 z(e,function(i){if(A(i,"bpmn:Lane")||it(i)){n=!1;return}}),n};const wB={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",qu],bpmnAutoResizeProvider:["type",Yu]};function Ya(e,t,n){this._canvas=n,this._opts=q({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(o){var r=i._toBorderPoint(o);i.startScroll(r)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Ya.$inject=["config.autoScroll","eventBus","canvas"],Ya.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++)_B(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 _B(e,t,n){return t<e&&e<n}Ya.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Ya.prototype.setOptions=function(e){this._opts=q({},this._opts,e)},Ya.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Br(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const EB={__depends__:[Ro],__init__:["autoScroll"],autoScroll:["type",Ya]};var E0="djs-bendpoint",S0="djs-segment-dragger";function SB(e,t){var n=Br(t),i=e._container.getBoundingClientRect(),o;o={x:i.left,y:i.top};var r=e.viewbox();return{x:r.x+(n.x-o.x)/r.scale,y:r.y+(n.y-o.y)/r.scale}}function tg(e,t,n){var i=SB(e,n),o=gd(t,i);return o}function ng(e,t){var n=Be("g");ut(n).add(E0),Xe(e,n);var i=Be("circle");Ce(i,{cx:0,cy:0,r:4}),ut(i).add("djs-visual"),Xe(n,i);var o=Be("circle");return Ce(o,{cx:0,cy:0,r:10}),ut(o).add("djs-hit"),Xe(n,o),t&&ut(n).add(t),n}function RB(e,t,n,i){var o=Be("g");Xe(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}),ut(u).add("djs-visual"),Xe(o,u);var p=Be("rect");return Ce(p,{x:-c/2,y:-l/2,width:c,height:l}),ut(p).add("djs-hit"),Xe(o,p),Bv(o,i==="v"?90:0),o}function R0(e,t,n){var i=Be("g"),o=Vf(t,n),r=bo(t,n);return Xe(e,i),RB(i,t,n,r),ut(i).add(S0),ut(i).add(r==="h"?"horizontal":"vertical"),Dn(i,o.x,o.y),i}function ig(e){return Math.abs(Math.round(e*2/3))}function CB(e,t){var n=AB(e,t);return wd(e,n)}function MB(e,t,n){var i=t.x-e.x,o=t.y-e.y;return ig(n==="h"?i:o)}function AB(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=_b(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function C0(e,t,n,i,o){function r(v,x,E){var C=v.index,D=v.point,P,T,$,j,G,Q;return C<=0||v.bendpoint?!1:(P=x[C-1],T=x[C],$=Vf(P,T),j=bo(P,T),G=Math.abs(D.x-$.x),Q=Math.abs(D.y-$.y),j&&G<=E&&Q<=E)}function a(v,x){var E=v.waypoints,C,D,P,T;return x.index<=0||x.bendpoint||(C={start:E[x.index-1],end:E[x.index]},D=bo(C.start,C.end),!D)?null:(D==="h"?P=C.end.x-C.start.x:P=C.end.y-C.start.y,T=ig(P)/2,T)}function s(v,x){var E=x.waypoints,C=tg(t,E,v),D;if(C){D=a(x,C);var P;if(r(C,E,D)?P=o.start(v,x,C.index):P=i.start(v,x,C.index,!C.bendpoint),P!==!1)return!0}}function c(v,x,E){je.bind(v,x,function(C){n.triggerMouseEvent(x,C,E),C.stopPropagation()})}function l(v,x){var E=t.getLayer("overlays"),C=Ct('.djs-bendpoints[data-element-id="'+Gr(v.id)+'"]',E);return!C&&x&&(C=Be("g"),Ce(C,{"data-element-id":v.id}),ut(C).add("djs-bendpoints"),Xe(E,C),c(C,"mousedown",v),c(C,"click",v),c(C,"dblclick",v)),C}function u(v,x){return Ct('.djs-segment-dragger[data-segment-idx="'+v+'"]',x)}function p(v,x){x.waypoints.forEach(function(E,C){var D=ng(v);Xe(v,D),Dn(D,E.x,E.y)}),ng(v,"floating")}function f(v,x){for(var E=x.waypoints,C,D,P,T=1;T<E.length;T++)C=E[T-1],D=E[T],bo(C,D)&&(P=R0(v,C,D),Ce(P,{"data-segment-idx":T}),c(P,"mousemove",x))}function d(v){z(ys("."+E0,v),function(x){an(x)})}function g(v){z(ys("."+S0,v),function(x){an(x)})}function h(v){var x=l(v);return x||(x=l(v,!0),p(x,v),f(x,v)),x}function m(v){var x=l(v);x&&(g(x),d(x),f(x,v),p(x,v))}function w(v,x){var E=Ct(".floating",v),C=x.point;E&&(Dn(E,C.x,C.y),ut(E).add("positioned"))}function y(v,x,E){var C=u(x.index,v),D=E[x.index-1],P=E[x.index],T=x.point,$=Vf(D,P),j=bo(D,P),G,Q;C&&(G=PB(C),Q={x:T.x-$.x,y:T.y-$.y},j==="v"&&(Q={x:Q.y,y:Q.x}),Dn(G,Q.x,Q.y))}e.on("connection.changed",function(v){m(v.element)}),e.on("connection.remove",function(v){var x=l(v.element);x&&an(x)}),e.on("element.marker.update",function(v){var x=v.element,E;x.waypoints&&(E=h(x),v.add?ut(E).add(v.marker):ut(E).remove(v.marker))}),e.on("element.mousemove",function(v){var x=v.element,E=x.waypoints,C,D;if(E){if(C=l(x,!0),D=tg(t,E,v.originalEvent),!D)return;w(C,D),D.bendpoint||y(C,D,E)}}),e.on("element.mousedown",function(v){if(ir(v)){var x=v.originalEvent,E=v.element;if(E.waypoints)return s(x,E)}}),e.on("selection.changed",function(v){var x=v.newSelection,E=x[0];E&&E.waypoints&&h(E)}),e.on("element.hover",function(v){var x=v.element;x.waypoints&&h(x)}),e.on("element.out",function(v){var x=v.element;if(x.waypoints){var E=l(x);if(E){var C=Ct(".floating",E);C&&ut(C).remove("positioned")}}}),e.on("element.updateId",function(v){var x=v.element,E=v.newId;if(x.waypoints){var C=l(x);C&&Ce(C,{"data-element-id":E})}}),this.addHandles=h,this.updateHandles=m,this.getBendpointsContainer=l,this.getSegmentDragger=u}C0.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function PB(e){return Ct(".djs-visual",e)}var M0=Math.round,Ur="reconnectStart",qr="reconnectEnd",lc="updateWaypoints";function og(e,t,n,i,o,r){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,g;!l&&c===0?g=Ur:!l&&c===d.length-1?g=qr:g=lc;var h=g===lc?"connection.updateWaypoints":"connection.reconnect",m=o.allowed(h,{connection:s,source:p,target:f});if(m===!1&&(m=o.allowed(h,{connection:s,source:f,target:p})),m!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:m,bendpointIndex:c,connection:s,source:p,target:f,insert:l,type:g}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var g=f===lc?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=o.allowed(g,{connection:c,source:f===Ur?p:l,target:f===qr?p:u}),d){s.source=f===Ur?p:l,s.target=f===qr?p:u;return}d===!1&&(d=s.allowed=o.allowed(g,{connection:c,source:f===qr?p:u,target:f===Ur?p:l})),d&&(s.source=f===qr?p:u,s.target=f===Ur?p:l)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==lc&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,p=s.insert,f=u.waypoints.slice(),d=s.source,g=s.target,h=s.type,m=s.hints||{},w={x:M0(a.x),y:M0(a.y)};if(!c)return!1;h===lc?(p?f.splice(l,0,w):f[l]=w,m.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),r.updateWaypoints(u,LP(f),m)):(h===Ur?(m.docking="source",Ku(s)&&(m.docking="target",m.newWaypoints=f.reverse())):h===qr&&(m.docking="target",Ku(s)&&(m.docking="source",m.newWaypoints=f.reverse())),r.reconnect(u,d,g,w,m))},this)}og.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],og.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 Ku(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===Ur)return t&&i&&t===i&&n!==i;if(o===qr)return t&&n&&t===n&&n!==i}var TB="reconnectStart",kB="reconnectEnd",A0="updateWaypoints",uc="connect-ok",Xu="connect-not-ok",P0="connect-hover",T0="djs-updating",k0="djs-dragging",O0=1100;function D0(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=ng(i.getLayer("overlays"));ut(f).add("djs-dragging"),i.addMarker(c,k0),i.addMarker(c,T0)}),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,P0),l===A0)return;s?(i.removeMarker(c,Xu),i.addMarker(c,uc)):s===!1&&(i.removeMarker(c,uc),i.addMarker(c,Xu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],O0,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,P0),i.removeMarker(s,c?uc:Xu))}),n.on("bendpoint.move.move",function(r){var a=r.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,f=a.connection,d=f.source,g=f.target,h=f.waypoints.slice(),m={x:r.x,y:r.y},w=a.hints||{},y={};o&&(w.connectionStart&&(y.connectionStart=w.connectionStart),w.connectionEnd&&(y.connectionEnd=w.connectionEnd),p===TB?Ku(a)?(y.connectionEnd=y.connectionEnd||m,y.source=g,y.target=u||d,h=h.reverse()):(y.connectionStart=y.connectionStart||m,y.source=u||d,y.target=g):p===kB?Ku(a)?(y.connectionStart=y.connectionStart||m,y.source=u||g,y.target=d,h=h.reverse()):(y.connectionEnd=y.connectionEnd||m,y.source=d,y.target=u||g):(y.noCropping=!0,y.noLayout=!0,h[c]=m),p===A0&&(h=e.cropWaypoints(f,h)),y.waypoints=h,o.drawPreview(a,s,y)),Dn(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],O0,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,an(c),i.removeMarker(s,T0),i.removeMarker(s,k0),l&&(i.removeMarker(l,uc),i.removeMarker(l,u?uc:Xu)),o&&o.cleanUp(a)})}D0.$inject=["bendpointMove","injector","eventBus","canvas"];var L0="connect-hover",I0="djs-updating";function B0(e,t,n){return rg(e,t,e[t]+n)}function rg(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function OB(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 rg(t,i,s)}function N0(e){return e==="x"?"y":"x"}function $0(e,t,n){var i,o;return e.original?e.original:(i=Ye(t),o=N0(n),rg(e,o,i[o]))}function F0(e,t,n,i,o,r){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var g,h=n.getGraphics(f),m=d-1,w=d,y=f.waypoints,v=y[m],x=y[w],E=tg(n,y,p),C,D,P;if(C=bo(v,x),!!C)return D=C==="v"?"x":"y",m===0&&(v=$0(v,f.source,D)),w===y.length-1&&(x=$0(x,f.target,D)),E?P=E.point:P={x:(v.x+x.x)/2,y:(v.y+x.y)/2},g={connection:f,segmentStartIndex:m,segmentEndIndex:w,segmentStart:v,segmentEnd:x,axis:D,dragPosition:P},i.init(p,P,"connectionSegment.move",{cursor:D==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:h,context:g}})};function s(p,f){if(!a)return f;var d=p.waypoints,g;return p.waypoints=f,g=a.getCroppedWaypoints(p),p.waypoints=d,g}function c(p){o.update("connection",p.connection,p.connectionGfx)}function l(p,f,d){var g=p.newWaypoints,h=p.segmentStartIndex+f,m=g[h],w=p.segmentEndIndex+f,y=g[w],v=N0(p.axis),x=OB(d,m,y,v);Dn(p.draggerGfx,x.x,x.y)}function u(p,f){var d=0,g=p.filter(function(h,m){return Gf(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=R0(g,f.segmentStart,f.segmentEnd),ut(f.draggerGfx).add("djs-dragging"),n.addMarker(d,I0)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,m=f.segmentStart,w=f.segmentEnd,y=f.axis,v=f.originalWaypoints.slice(),x=B0(m,y,p["d"+y]),E=B0(w,y,p["d"+y]),C=v.length,D=0;v[g]=x,v[h]=E;var P,T;g<2&&(P=On(d.source,x),g===1?P==="intersect"&&(v.shift(),v[0]=x,D--):P!=="intersect"&&(v.unshift(m),D++)),h>C-3&&(T=On(d.target,E),h===C-2?T==="intersect"&&(v.pop(),v[v.length-1]=E):T!=="intersect"&&v.push(w)),f.newWaypoints=d.waypoints=s(d,v),l(f,D,p),f.newSegmentStartIndex=g+D,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,L0)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,L0)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&an(f.draggerGfx),n.removeMarker(d,I0)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,g=f.newWaypoints,h=f.newSegmentStartIndex;g=g.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var m=u(g,h),w=m.waypoints,y=s(d,w),v=m.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+v}};r.updateWaypoints(d,y,x)})}F0.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var DB=Math.abs,j0=Math.round;function LB(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],DB(o-e)<=n)return o}function H0(e){return{x:e.x,y:e.y}}function z0(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:j0(e.x+e.width/2),y:j0(e.y+e.height/2)}}function Ka(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function pn(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 G0(e){return e.children||[]}var IB=Math.abs,V0=Math.round,ag=10;function W0(e){function t(r,a){if(Ue(r)){for(var s=r.length;s--;)if(IB(r[s]-a)<=ag)return r[s]}else{r=+r;var c=a%r;if(c<ag)return a-c;if(c>r-ag)return a-c+r}return a}function n(r,a){if(r.waypoints)return CB(a,r);if(r.width)return{x:V0(r.width/2+r.x),y:V0(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;q(r,{dx:r.dx-p,dy:r.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&pn(r,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&pn(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);!Ot(s)||!c||!c.x||!c.y||(pn(r,"x",c.x),pn(r,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var a=r.context,s=o(a),c=a.hover,l=c&&n(c,r),u=r.x,p=r.y,f,d;if(s){f=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var g=u-f,h=p-d;q(r,{dx:r.dx-g,dy:r.dy-h,x:r.x-g,y:r.y-h}),(g||s.vertical.indexOf(u)!==-1)&&pn(r,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&pn(r,"y",d)}})}W0.$inject=["eventBus"];const BB={__depends__:[Ro,no],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",C0],bendpointMove:["type",og],bendpointMovePreview:["type",D0],connectionSegmentMove:["type",F0],bendpointSnapping:["type",W0]};function U0(e,t,n,i){function o(a,s){return i.allowed("connection.create",{source:a,target:s})}function r(a,s){return o(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,l=a.hover,u;if(s.hover=l,u=s.canExecute=o(c,l),!ra(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!ra(u)&&u!==!1&&(s.source=l,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,l=s.connectionStart,u={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,g={connectionStart:sg(s)?u:l,connectionEnd:sg(s)?l:u};mn(c)&&(d=c),s.connection=n.connect(p,f,d,g)}),this.start=function(a,s,c,l){mn(c)||(l=c,c=Ye(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}U0.$inject=["eventBus","dragging","modeling","rules"];function sg(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var NB=1100,$B=900,q0="connect-ok",Y0="connect-not-ok";function K0(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;sg(r)&&(g=d,h=f),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",$B,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?q0:Y0)}),t.on(["connect.out","connect.cleanup"],NB,function(o){var r=o.hover;r&&(n.removeMarker(r,q0),n.removeMarker(r,Y0))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}K0.$inject=["injector","eventBus","canvas"];const cg={__depends__:[Ci,no,Ro],__init__:["connectPreview"],connect:["type",U0],connectPreview:["type",K0]};var FB="djs-dragger";function Oo(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Oo.$inject=["injector","canvas","graphicsFactory","elementFactory"],Oo.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,o=e.getConnection,r=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,l=n.connectionEnd,u=n.noLayout,p=n.noCropping,f=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),vs(i),o||(o=e.getConnection=jB(function(h,m,w){return g.getConnection(h,m,w)})),t&&(d=o(t,r,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:r,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[r?Ye(r):c,a?Ye(a):l]),this._connectionDocking&&(r||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,r,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Oo.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||Ye(n),r=t.connectionEnd||Ye(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);Xe(e,s)},Oo.prototype.cropWaypoints=function(e,t,n,i){var o=this._graphicsFactory,r=n&&o.getShapePath(n),a=i&&o.getShapePath(i),s=o.getConnectionPath({waypoints:[e,t]});return e=n&&Rs(r,s,!0)||e,t=i&&Rs(a,s,!1)||t,[e,t]},Oo.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&an(e.connectionPreviewGfx)},Oo.prototype.getConnection=function(e){var t=HB(e);return this._elementFactory.createConnection(t)},Oo.prototype.createConnectionPreviewGfx=function(){var e=Be("g");return Ce(e,{pointerEvents:"none"}),ut(e).add(FB),Xe(this._canvas.getActiveLayer(),e),e},Oo.prototype.createNoopConnection=function(e,t){return ws([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function jB(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 HB(e){return mn(e)?e:{}}const zB={__init__:["connectionPreview"],connectionPreview:["type",Oo]},Zu="complex-preview";class X0{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(Zu);n.filter(s=>!GB(s)).forEach(s=>{let c;Ot(s)?(c=this._graphicsFactory._createContainer("connection",Be("g")),this._graphicsFactory.drawConnection(Zo(c),s)):(c=this._graphicsFactory._createContainer("shape",Be("g")),this._graphicsFactory.drawShape(Zo(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);Ot(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(Zo(l),s,{width:c.width,height:c.height}),Dn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){vs(this._canvas.getLayer(Zu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Zu)}hide(){this._canvas.hideLayer(Zu)}}X0.$inject=["canvas","graphicsFactory","previewSupport"];function GB(e){return e.hidden}const VB={__depends__:[$a],__init__:["complexPreview"],complexPreview:["type",X0]},Z0=Math.round;function Qu(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}Qu.prototype.create=function(e,t,n){const i=this._complexPreview,o=this._connectionDocking,r=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,l=r.createShape(q({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;q(l,{x:u.x-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=>!ra(d))})},Qu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Qu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const WB={__depends__:[_u,VB,Ph],__init__:["appendPreview"],appendPreview:["type",Qu]};var Q0=Math.min,J0=Math.max;function lg(e){e.preventDefault()}function pc(e){e.stopPropagation()}function UB(e){return e.nodeType===Node.TEXT_NODE}function qB(e){return[].slice.call(e)}function Gi(e){this.container=e.container,this.parent=zt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Ct("[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)}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"]);q(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var l=Bi(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return q(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&q(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,je.bind(a,"keydown",this.keyHandler),je.bind(a,"mousedown",pc),je.bind(a,"paste",o.handlePaste),je.bind(a,"focusout",this.focusoutHandler),i.autoResize&&je.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},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=YB(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=qB(a.childNodes),c,l;if(UB(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)})},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=zt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(g){lg(g),pc(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,je.bind(document,"mousemove",f),je.bind(document,"mouseup",d)},f=function(g){lg(g),pc(g);var h=Q0(J0(l+g.clientX-s,i),r),m=Q0(J0(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){lg(g),pc(g),je.unbind(document,"mousemove",f,!1),je.unbind(document,"mouseup",d,!1)};je.bind(n,"mousedown",p)}q(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Gi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),je.unbind(t,"keydown",this.keyHandler),je.unbind(t,"mousedown",pc),je.unbind(t,"input",this.autoResize),je.unbind(t,"paste",this.handlePaste),je.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),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 YB(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 Gi({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=Bt(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 eE={__depends__:[Ql],__init__:["directEditing"],directEditing:["type",li]};function KB(e){return function(t){var n=t.target,i=me(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===pt(e);return!r||!a||!s||!c}}const XB={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=XB[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var ZB=[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")],QB=[fe("none-start-event",{actionName:"replace-with-none-start"}),fe("none-intermediate-throwing"),fe("none-end-event",{actionName:"replace-with-none-end"})],JB=[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")],eN=[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")],tN=[fe("exclusive-gateway"),fe("parallel-gateway"),fe("inclusive-gateway"),fe("complex-gateway"),fe("event-based-gateway")],nN=[fe("transaction"),fe("event-subprocess"),fe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),fe("collapsed-subprocess")],iN=[fe("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),fe("transaction"),fe("event-subprocess"),fe("collapsed-ad-hoc-subprocess")],tE=[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")],oN=tE,nE=[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"})],rN=[fe("data-store-reference")],aN=[fe("data-object-reference")],sN=[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")],cN=[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")],lN=[{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"}],uN=[fe("expanded-pool"),fe("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],pN={"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 iE={"start-event-non-interrupting":`
|
|
317
317
|
<svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
|
|
318
318
|
<g transform="translate(0 995.64)">
|
|
319
319
|
<path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>
|
|
@@ -324,7 +324,7 @@
|
|
|
324
324
|
<circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
|
|
325
325
|
<circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
|
|
326
326
|
</g>
|
|
327
|
-
</svg>`};function ki(e,t,n,i,o,r,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=o,this._rules=r,this._translate=a,this._moddleCopy=s,this._register()}ki.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],ki.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},ki.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if(We(e)||!n.allowed("shape.replace",{element:e}))return{};var a=qB(e);return A(t,"bpmn:DataObjectReference")?this._createEntries(e,iN):A(t,"bpmn:DataStoreReference")&&!A(e.parent,"bpmn:Collaboration")?this._createEntries(e,oN):(A(t,"bpmn:Event")&&!A(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=lN[o]||[],!Hn(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(KB.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:Participant")?(r=rt(cN,function(c){return ut(e)!==c.target.isExpanded}),this._createEntries(e,r)):A(t,"bpmn:StartEvent")&&Hn(t.$parent)?(r=rt(aN.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")&&!Hn(t.$parent)&&A(t.$parent,"bpmn:SubProcess")?(r=rt(XB.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:EndEvent")?(r=rt(QB.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(rN,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(JB,a),this._createEntries(e,r)):A(t,"bpmn:Transaction")?(r=rt(eE,a),this._createEntries(e,r)):Hn(t)&&ut(e)?(r=rt(nN,a),this._createEntries(e,r)):A(t,"bpmn:AdHocSubProcess")&&ut(e)?(r=rt(tN,a),this._createEntries(e,r)):A(t,"bpmn:SubProcess")&&ut(e)?(r=rt(eN,a),this._createEntries(e,r)):A(t,"bpmn:SubProcess")&&!ut(e)?(r=rt(tE,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,sN):A(t,"bpmn:FlowNode")?(r=rt(tE,a),this._createEntries(e,r)):{})},ki.prototype.getPopupMenuHeaderEntries=function(e){var t={};return A(e,"bpmn:Activity")&&!Hn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),A(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),A(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Bb(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},ki.prototype._createEntries=function(e,t){var n={},i=this;return z(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},ki.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&&(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},ki.prototype._createEntry=function(e,t,n){var i=this._translate,o=this._bpmnReplace.replaceElement,r=function(){return o(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||r,{label:i(a),className:e.className,action:n}},ki.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&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=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"}}}},ki.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function o(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var r=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:r,action:o}}},ki.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function o(a,s){var c=s.active,l;c||(l=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:l})}var r=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!r,action:o}}},ki.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ge(e),i=this,o=Nb(e),r=A(e,"bpmn:BoundaryEvent")?nE["intermediate-event-non-interrupting"]:nE["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 uN={__depends__:[Jh,iw,xu],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",ki]};function pc(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(!(!Ns(d)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}pc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],pc.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&q(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,o){t.removeElements(o.slice())}}}}),n},pc.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return We(t)?Bo(e,n=>t.includes(n)):t},pc.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,o=this._connect,r=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&q(u,g()),u;var p=e.businessObject;function f(v,x){o.start(v,x)}function d(v,x){n.removeElements([x])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(v){var x=5,E=t.getPad(v).html,M=E.getBoundingClientRect(),D={x:M.left,y:M.bottom+x};return D}function m(v,x,E,M){function D(N,j){var V=i.createShape(q({type:v},M));r.start(N,V,{source:j})}var P=s?function(N,j){var V=i.createShape(q({type:v},M));s.append(j,V)}:D,T=s?function(N,j){return l.create(j,v,M),()=>{l.cleanUp()}}:null;return{group:"model",className:x,title:E,action:{dragstart:D,click:P,hover:T}}}function w(v){return function(x,E){n.splitLane(E,v),t.open(E,!0)}}if(it(p,["bpmn:Lane","bpmn:Participant"])&&ut(e)){var y=er(e);q(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(v,x){n.addLane(x,"top")}}}}),y.length<2&&((xn(e)?e.height>=120:e.width>=120)&&q(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:w(2)}}}),(xn(e)?e.height>=180:e.width>=180)&&q(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:w(3)}}})),q(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(v,x){n.addLane(x,"bottom")}}}})}return A(p,"bpmn:FlowNode")&&(A(p,"bpmn:EventBasedGateway")?q(u,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):iE(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?q(u,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!A(p,"bpmn:EndEvent")&&!p.isForCompensation&&!iE(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Hn(p)&&q(u,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||q(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(v,x){var E=q(h(x),{cursor:{x:v.x,y:v.y}});a.open(x,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),A(p,"bpmn:SequenceFlow")&&q(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),A(p,"bpmn:MessageFlow")&&q(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),it(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&q(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),A(p,"bpmn:TextAnnotation")&&q(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"])&&q(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")&&q(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&q(u,g()),u};function iE(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 pN={__depends__:[GB,J0,O_,Mi,sg,Ql,uN],__init__:["contextPadProvider"],contextPadProvider:["type",pc]};var fN={horizontal:["x","width"],vertical:["y","height"]},oE=5;function Oo(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:[]})}Oo.$inject=["modeling","rules"],Oo.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Oo.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},Oo.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},Oo.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=qi(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},Oo.prototype._setOrientation=function(e){var t=fN[e];this._axis=t[0],this._dimension=t[1]},Oo.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)},Oo.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+oE,max:t+n-oE}};const dN={__init__:["distributeElements"],distributeElements:["type",Oo]};function Zu(e){Ci.call(this,e)}Zu.$inject=["eventBus"],Le(Zu,Ci),Zu.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=ul(t),t.length<3?!1:t})};var rE={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(Ue(e)||!n.allowed("shape.replace",{element:e}))return{};var a=KB(e);return A(t,"bpmn:DataObjectReference")?this._createEntries(e,rN):A(t,"bpmn:DataStoreReference")&&!A(e.parent,"bpmn:Collaboration")?this._createEntries(e,aN):(A(t,"bpmn:Event")&&!A(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=pN[o]||[],!Vn(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(ZB.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:Participant")?(r=rt(uN,function(c){return pt(e)!==c.target.isExpanded}),this._createEntries(e,r)):A(t,"bpmn:StartEvent")&&Vn(t.$parent)?(r=rt(cN.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")&&!Vn(t.$parent)&&A(t.$parent,"bpmn:SubProcess")?(r=rt(QB.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:EndEvent")?(r=rt(eN.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(sN,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(JB.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:Gateway")?(r=rt(tN,a),this._createEntries(e,r)):A(t,"bpmn:Transaction")?(r=rt(tE,a),this._createEntries(e,r)):Vn(t)&&pt(e)?(r=rt(oN,a),this._createEntries(e,r)):A(t,"bpmn:AdHocSubProcess")&&pt(e)?(r=rt(iN,a),this._createEntries(e,r)):A(t,"bpmn:SubProcess")&&pt(e)?(r=rt(nN,a),this._createEntries(e,r)):A(t,"bpmn:SubProcess")&&!pt(e)?(r=rt(nE,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,lN):A(t,"bpmn:FlowNode")?(r=rt(nE,a),this._createEntries(e,r)):{})},Ti.prototype.getPopupMenuHeaderEntries=function(e){var t={};return A(e,"bpmn:Activity")&&!Vn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),A(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),A(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Nb(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Ti.prototype._createEntries=function(e,t){var n={},i=this;return z(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},Ti.prototype._createSequenceFlowEntries=function(e,t){var n=me(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&&(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=me(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=me(e),i=this,o=$b(e),r=A(e,"bpmn:BoundaryEvent")?iE["intermediate-event-non-interrupting"]:iE["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 fN={__depends__:[eg,ow,_u],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Ti]};function fc(e,t,n,i,o,r,a,s,c,l,u,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=o,this._elementFactory=r,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=l,this._rules=u,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var g=d.context,h=g.shape;if(!(!$s(d)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}fc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],fc.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&q(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,o){t.removeElements(o.slice())}}}}),n},fc.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Ue(t)?No(e,n=>t.includes(n)):t},fc.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,o=this._connect,r=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&q(u,g()),u;var p=e.businessObject;function f(v,x){o.start(v,x)}function d(v,x){n.removeElements([x])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(v){var x=5,E=t.getPad(v).html,C=E.getBoundingClientRect(),D={x:C.left,y:C.bottom+x};return D}function m(v,x,E,C){function D($,j){var G=i.createShape(q({type:v},C));r.start($,G,{source:j})}var P=s?function($,j){var G=i.createShape(q({type:v},C));s.append(j,G)}:D,T=s?function($,j){return l.create(j,v,C),()=>{l.cleanUp()}}:null;return{group:"model",className:x,title:E,action:{dragstart:D,click:P,hover:T}}}function w(v){return function(x,E){n.splitLane(E,v),t.open(E,!0)}}if(ot(p,["bpmn:Lane","bpmn:Participant"])&&pt(e)){var y=tr(e);q(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(v,x){n.addLane(x,"top")}}}}),y.length<2&&((_n(e)?e.height>=120:e.width>=120)&&q(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:w(2)}}}),(_n(e)?e.height>=180:e.width>=180)&&q(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:w(3)}}})),q(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(v,x){n.addLane(x,"bottom")}}}})}return A(p,"bpmn:FlowNode")&&(A(p,"bpmn:EventBasedGateway")?q(u,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):oE(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?q(u,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!A(p,"bpmn:EndEvent")&&!p.isForCompensation&&!oE(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Vn(p)&&q(u,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||q(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(v,x){var E=q(h(x),{cursor:{x:v.x,y:v.y}});a.open(x,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),A(p,"bpmn:SequenceFlow")&&q(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),A(p,"bpmn:MessageFlow")&&q(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"])&&q(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),A(p,"bpmn:TextAnnotation")&&q(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"])&&q(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")&&q(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&q(u,g()),u};function oE(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 dN={__depends__:[WB,eE,D_,Ci,cg,eu,fN],__init__:["contextPadProvider"],contextPadProvider:["type",fc]};var hN={horizontal:["x","width"],vertical:["y","height"]},rE=5;function Do(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Ue(i)?i:i?n:[]})}Do.$inject=["modeling","rules"],Do.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Do.prototype.trigger=function(e,t){var n=this._modeling,i,o;if(!(e.length<3)&&(this._setOrientation(t),o=this._filterElements(e),i=this._createGroups(o),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},Do.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(z(t,function(r){o=r(o,n,i)}),o):e},Do.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,o=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var r=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},Do.prototype._setOrientation=function(e){var t=hN[e];this._axis=t[0],this._dimension=t[1]},Do.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Do.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+rE,max:t+n-rE}};const gN={__init__:["distributeElements"],distributeElements:["type",Do]};function Ju(e){Ri.call(this,e)}Ju.$inject=["eventBus"],Te(Ju,Ri),Ju.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=fl(t),t.length<3?!1:t})};var aE={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>`},hN=900;function fc(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",hN,this)}fc.$inject=["popupMenu","distributeElements","translate","rules"],fc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&q(t,this._getEntries(e)),t},fc.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},fc.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:rE.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:rE.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const gN={__depends__:[Jh,dN],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Zu],distributeElementsMenuProvider:["type",fc]};var aE="is not a registered action",mN="is already registered";function Oi(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Oi.$inject=["eventBus","injector"],Oi.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),o=e.get("zoomScroll",!1),r=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),r&&i&&this.register("copy",function(){var u=i.get();if(u.length)return r.copy(u)}),r&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return r.duplicate(u)}),r&&this.register("paste",function(){r.paste()}),r&&i&&s&&this.register("cut",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u});if(p!==!1){var f=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)})},Oi.prototype.trigger=function(e,t){if(!this._actions[e])throw lg(e,aE);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Oi.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);z(e,function(i,o){n._registerAction(o,i)})},Oi.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw lg(e,mN);this._actions[e]=t},Oi.prototype.unregister=function(e){if(!this.isRegistered(e))throw lg(e,aE);this._actions[e]=void 0},Oi.prototype.getActions=function(){return Object.keys(this._actions)},Oi.prototype.isRegistered=function(e){return!!this._actions[e]};function lg(e,t){return new Error(e+" "+t)}const yN={__init__:["editorActions"],editorActions:["type",Oi]};function Qu(e){e.invoke(Oi,this)}Le(Qu,Oi),Qu.$inject=["injector"],Qu.prototype._registerDefaultActions=function(e){Oi.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),o=e.get("spaceTool",!1),r=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),l=e.get("alignElements",!1),u=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var g=t.getRootElement(),h=n.filter(function(m){return m!==g});return i.select(h),h}),o&&this._registerAction("spaceTool",function(){o.toggle()}),r&&this._registerAction("lassoTool",function(){r.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(g){var h=i.get(),m=g.type;h.length&&c.trigger(h,m)}),i&&l&&this._registerAction("alignElements",function(g){var h=i.get(),m=[],w=g.type;h.length&&(m=rt(h,function(y){return!A(y,"bpmn:Lane")}),l.trigger(m,w))}),i&&f&&this._registerAction("setColor",function(g){var h=i.get();h.length&&f.setColor(h,g)}),i&&u&&this._registerAction("directEditing",function(){var g=i.get();g.length&&u.activate(g[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,m;A(g,"bpmn:Collaboration")?m=n.filter(function(w){return A(w.parent,"bpmn:Collaboration")}):m=n.filter(function(w){return w!==g&&!A(w.parent,"bpmn:SubProcess")}),h=on(m),f.moveElements(m,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const vN={__depends__:[yN],editorActions:["type",Qu]};function sE(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")})}sE.$inject=["eventBus"];function qr(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)}})}qr.$inject=["eventBus","gridSnapping","modeling"],Le(qr,de),qr.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},qr.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},qr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),o=/e/.test(t),r={};return r.width=n.snapValue(e.width,{min:e.width}),o&&(i?(r.x=n.snapValue(e.x,{max:e.x}),r.width+=n.snapValue(e.x-r.x,{min:e.x-r.x})):e.x=e.x+e.width-r.width),q(e,r),e},qr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),o=/s/.test(t),r={};return r.height=n.snapValue(e.height,{min:e.height}),i&&(o?(r.y=n.snapValue(e.y,{max:e.y}),r.height+=n.snapValue(e.y-r.y,{min:e.y-r.y})):e.y=e.y+e.height-r.height),q(e,r),e};var bN=2e3;function cE(e,t){e.on(["spaceTool.move","spaceTool.end"],bN,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)}})}cE.$inject=["eventBus","gridSnapping"];const xN={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",qr],gridSnappingSpaceToolBehavior:["type",cE]};var Ju=10;function ug(e,t,n){return n||(n="round"),Math[n](e/t)*t}var wN=1200,_N=800;function dr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",_N,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"],wN,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=SN(r,l,e);p&&(u.offset=p);var f=EN(r,l);f&&q(u,f),Ua(r,l)||o.snapEvent(r,l,u)})}})}dr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);cn(e,t,i)},dr.prototype.getGridSpacing=function(){return Ju},dr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=ug(e,Ju);var i,o;return t&&t.min&&(i=t.min,Ue(i)&&(i=ug(i+n,Ju,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,Ue(o)&&(o=ug(o+n,Ju,"floor"),e=Math.min(e,o))),e-=n,e},dr.prototype.isActive=function(){return this.active},dr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},dr.prototype.toggleActive=function(){this.setActive(!this.active)},dr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function EN(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&&(ep(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&&(ep(t)?uE(s)?a.x.max=c.left:a.x.min=c.right:lE(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(ep(t)?uE(s)?a.x.min=l.left:a.x.max=l.right:lE(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function SN(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)||(ep(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 ep(e){return e==="x"}function lE(e){return e.indexOf("n")!==-1}function uE(e){return e.indexOf("w")!==-1}const RN={__depends__:[xN],__init__:["gridSnapping"],gridSnapping:["type",dr]};var CN=2e3;function pE(e,t,n){e.on("autoPlace",CN,function(i){var o=i.source,r=qe(o),a=i.shape,s=Kw(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")&&(MN(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}pE.$inject=["eventBus","gridSnapping","elementRegistry"];function MN(e){return e==="x"}var AN=1750;function fE(e,t,n){t.on(["create.start","shape.move.start"],AN,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}))}})}fE.$inject=["canvas","eventBus","gridSnapping"];var PN=3e3;function tp(e,t,n){de.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],PN,function(o){var r=o.context,a=r.connection,s=r.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||TN(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}tp.$inject=["eventBus","gridSnapping","modeling"],Le(tp,de),tp.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=DN(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function TN(e){return e.length>3}function kN(e){return e==="h"}function ON(e){return e==="v"}function DN(e,t,n){var i=vo(t,n),o={};return kN(i)&&(o.y=e.snapValue(t.y)),ON(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=q({},t,o),n=q({},n,o)),[t,n]}const LN={__depends__:[RN,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",pE],gridSnappingParticipantBehavior:["type",fE],gridSnappingLayoutConnectionBehavior:["type",tp]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",sE]};var IN=30,dE=30;function dc(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)})}dc.$inject=["eventBus","interactionEvents"],dc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},dc.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:IN,height:e.height}:{width:e.width,height:dE};return this._interactionEvents.createBoxHit(t,"all",n),!0},dc.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:dE}),!0};const BN={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",dc]};function np(e){e.invoke(Fa,this)}Le(np,Fa),np.$inject=["injector"],np.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 NN={__depends__:[$h],__init__:["keyboardBindings"],keyboardBindings:["type",np]};var $N={moveSpeed:1,moveSpeedAccelerated:10},FN=1500,hE="left",gE="up",mE="right",yE="down",jN={ArrowLeft:hE,Left:hE,ArrowUp:gE,Up:gE,ArrowRight:mE,Right:mE,ArrowDown:yE,Down:yE},HN={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 vE(e,t,n,i,o){var r=this;this._config=q({},$N,e||{}),t.addListener(FN,function(a){var s=a.keyEvent,c=jN[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=HN[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}vE.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const zN={__depends__:[$h,Mi],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",vE]};var bE=10;function hc(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=Ck(u,p,l),c.newBounds=Ak(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=wv(p),!GN(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)})}hc.prototype.canResize=function(e){var t=this._rules,n=Ni(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},hc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=q({shape:t},n),r=o.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,xE(t,r),"resize",{autoActivate:!0,cursor:VN(r),data:{shape:t,context:o}})},hc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:bE,height:bE},o=cb(t,e.childrenBoxPadding),Pk(n,t,i,o)},hc.$inject=["eventBus","rules","modeling","dragging"];function GN(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function xE(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 VN(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 wE="djs-resizing",_E="resize-not-ok",WN=500;function EE(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,wE)),s.width>5&&Ae(c,{x:s.x,width:s.width}),s.height>5&&Ae(c,{y:s.y,height:s.height}),r.canExecute?lt(c).remove(_E):lt(c).add(_E)}function o(r){var a=r.shape,s=r.frame;s&&nn(r.frame),t.removeMarker(a,wE)}e.on("resize.move",WN,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}EE.$inject=["eventBus","canvas","previewSupport"];var ip=-6,op=8,rp=20,gc="djs-resizer",UN=["n","w","s","e","nw","ne","se","sw"];function hr(e,t,n,i){this._resize=i,this._canvas=t;var o=this;e.on("selection.changed",function(r){var a=r.newSelection;o.removeResizers(),a.length===1&&z(a,Kn(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}hr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){nr(r)&&i.activate(r,e,n)}je.bind(t,"mousedown",o),je.bind(t,"touchstart",o)},hr.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=qN(i),a=$e("g");lt(a).add(gc),lt(a).add(gc+"-"+e.id),lt(a).add(gc+"-"+i),Ke(o,a);var s=$e("rect");Ae(s,{x:-op/2+r.x,y:-op/2+r.y,width:op,height:op}),lt(s).add(gc+"-visual"),Ke(a,s);var c=$e("rect");return Ae(c,{x:-rp/2+r.x,y:-rp/2+r.y,width:rp,height:rp}),lt(c).add(gc+"-hit"),Ke(a,c),ml(a,t,n),a},hr.prototype.createResizer=function(e,t){var n=xE(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},hr.prototype.addResizer=function(e){var t=this;Tt(e)||z(UN,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},hr.prototype.removeResizers=function(){var e=this._getResizersParent();ys(e)},hr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},hr.$inject=["eventBus","canvas","selection","resize"];function qN(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-ip:e.indexOf("w")!==-1&&(t.x=ip),e.indexOf("s")!==-1?t.y=-ip:e.indexOf("n")!==-1&&(t.y=ip),t}const SE={__depends__:[io,So,Ia],__init__:["resize","resizePreview","resizeHandles"],resize:["type",hc],resizePreview:["type",EE],resizeHandles:["type",hr]};var YN=2e3;function mc(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"],YN,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)}}mc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],mc.prototype.activate=function(e){var t=mi(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);q(n,i);var o={},r=n.style||{};return q(r,{backgroundColor:null,border:null}),(it(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||RE(e))&&q(o,{centerVertically:!0}),Qo(e)&&(q(o,{resizable:!0,autoResize:!0}),q(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),A(e,"bpmn:TextAnnotation")&&(q(o,{resizable:!0,autoResize:!0}),q(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),q(n,{options:o,style:r}),n}},mc.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 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};q(r,h),q(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?"rotate(-90deg)":null})}if(XN(e)){var m=xn(e),w=m?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:o.x-i.height/2,y:o.y-i.width/2};q(r,w),q(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?null:"rotate(-90deg)"})}(it(e,["bpmn:Task","bpmn:CallActivity"])||RE(e))&&(q(r,{width:i.width,height:i.height}),q(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),KN(e)&&(q(r,{width:i.width,x:i.x}),q(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var y=1,v=i.width+2*y;if(n.labelTarget&&(q(r,{width:v,height:i.height+2*y,x:i.x-y,y:i.y-y}),q(d,{fontSize:l+"px",lineHeight:u})),Qo(n)&&!bl(n)&&!nt(n)){var x=qf(e),E=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),M=l,D=Dr.width*a+2*y;q(r,{width:D,height:M+2*y,x:E.x-D/2,y:E.y-M/2-y}),q(d,{fontSize:l+"px",lineHeight:u})}return A(e,"bpmn:TextAnnotation")&&(q(r,{width:i.width+2*y,height:i.height+2*y,x:i.x-y,y:i.y-y,minWidth:30*a,minHeight:10*a}),q(d,{textAlign:"left",paddingTop:Ea*a+"px",paddingBottom:Ea*a+"px",paddingLeft:Ea*a+"px",paddingRight:Ea*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:r,style:d}},mc.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}),QN(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function RE(e){return A(e,"bpmn:SubProcess")&&!ut(e)}function KN(e){return A(e,"bpmn:SubProcess")&&ut(e)}function XN(e){return A(e,"bpmn:Participant")&&!ut(e)}function ZN(e){return A(e,"bpmn:Participant")&&ut(e)}function QN(e){return!e||!e.trim()}var CE="djs-element-hidden",ME="djs-label-hidden";function AE(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=$e("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=$e("path");Ae(p,{d:u,strokeWidth:2,stroke:JN(r)}),Ke(s,p),Ke(o,s),kn(s,r.x,r.y)}A(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,CE):(A(r,"bpmn:Task")||A(r,"bpmn:CallActivity")||A(r,"bpmn:SubProcess")||A(r,"bpmn:Participant")||A(r,"bpmn:Lane"))&&t.addMarker(r,ME)}),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}});Ae(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,CE),t.removeMarker(r,ME)),r=void 0,a=void 0,s&&(nn(s),s=void 0)})}AE.$inject=["eventBus","canvas","pathMap"];function JN(e,t){var n=dt(e);return n.get("stroke")||t||"black"}const e$={__depends__:[ph,SE,J0],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",mc],labelEditingPreview:["type",AE]};var t$=500,n$=1e3;function ao(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){AP(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"],t$,function(r){var a=r.element,s=r.gfx,c=Et(".djs-outline",s);c&&i.updateOutline(a,c)})}ao.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},ao.prototype._createOutlineGfx=function(){var e=$e("rect");return Ae(e,q({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},ao.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},ao.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&z(i,function(o){n=n||o.updateOutline(t,e)}),n||Ae(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},ao.prototype.updateConnectionOutline=function(e,t){var n=on(t);Ae(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},ao.prototype.registerProvider=function(e,t){t||(t=e,e=n$),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},ao.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},ao.prototype.getOutline=function(e){var t,n=this._getProviders();return z(n,function(i){bn(i.getOutline)&&(t=t||i.getOutline(e))}),t},ao.$inject=["eventBus","styles","elementRegistry"];var ap=6;function pg(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)})}pg.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");ys(t);var n=e.length>1,i=this._canvas.getContainer();if(lt(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=i$(on(e)),r=$e("rect");Ae(r,q({rx:3},o)),lt(r).add("djs-selection-outline"),Ke(t,r)}},pg.$inject=["eventBus","canvas","selection"];function i$(e){return{x:e.x-ap,y:e.y-ap,width:e.width+ap*2,height:e.height+ap*2}}const fg={__depends__:[Mi],__init__:["outline","multiSelectionOutline"],outline:["type",ao],multiSelectionOutline:["type",pg]},PE=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],TE={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},o$=15,sp=2;function kE(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=>it(g,PE));if(f.length===1){const g=f[0];nt(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(f.length===2){const g=f.find(nt),h=f.find(m=>{var w;return(w=m.labels)==null?void 0:w.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!it(p,PE)||!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=xs([qe(f),qe(p)],TE),g=d.getAttribute("d"),m=o.isSelected(p)?c(p):l(p),w=Ss(m,g);if(!w)return;const v=o.isSelected(f)?c(f):l(f),x=Ss(v,g)||qe(f);Ls(x,w)<o$||(Ff(d,[x,w]),Ke(r,d))}function s(){ms(`.${TE.class}`,r).forEach(nn)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+gr(f,"x")-sp,y:p.y+gr(f,"y")-sp,width:gr(f,"width")+sp*2,height:gr(f,"height")+sp*2};return Kf(d,gr(f,"rx"))}if(f.cx){const d=gr(f,"r"),g={x:p.x+gr(f,"cx")-d,y:p.y+gr(f,"cy")-d,width:d*2,height:d*2};return Wv(g)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}kE.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function gr(e,t){return parseFloat(Ae(e,t)||0)}const r$={__depends__:[Mi,fg],__init__:["labelLink"],labelLink:["type",kE]};var a$=new $r("tt");function s$(e){var t=$t('<div class="djs-tooltip-container" />');return Vn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function c$(e,t,n){Vn(e,{left:t+"px",top:n+"px"})}function dg(e,t){e.style.display=t===!1?"none":""}var OE="djs-tooltip",hg="."+OE;function Zn(e,t){this._eventBus=e,this._canvas=t,this._ids=a$,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=s$(t.getContainer());var n=this;ni.bind(this._tooltipRoot,hg,"mousedown",function(i){i.stopPropagation()}),ni.bind(this._tooltipRoot,hg,"mouseover",function(i){n.trigger("mouseover",i)}),ni.bind(this._tooltipRoot,hg,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Zn.$inject=["eventBus","canvas"],Zn.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=q({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Zn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Rn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Zn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Zn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Zn.prototype.setTimeout=function(e){if(e=this.get(e),!!e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},Zn.prototype.remove=function(e){var t=this.get(e);t&&(Zi(t.html),Zi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Zn.prototype.show=function(){dg(this._tooltipRoot)},Zn.prototype.hide=function(){dg(this._tooltipRoot,!1)},Zn.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},Zn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,o=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),Jn(n)&&(n=$t(n)),i=$t('<div data-tooltip-id="'+t+'" class="'+OE+'">'),Vn(i,{position:"absolute"}),i.appendChild(n),e.type&&Rt(i).add("djs-tooltip-"+e.type),e.className&&Rt(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Zn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;c$(n,t.x,t.y)},Zn.prototype._updateTooltipVisibilty=function(e){z(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),dg(i,o))})},Zn.prototype._init=function(){var e=this;function t(n){e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}this._eventBus.on("canvas.viewbox.changing",function(n){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(n){t(n.viewbox)})};const l$={__init__:["tooltips"],tooltips:["type",Zn]};var u$="flow elements must be children of pools/participants",p$="Data object must be placed within a pool/participant.";function DE(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(u$)):A(a,"bpmn:DataObjectReference")&&i(o,n(p$)))})}DE.$inject=["eventBus","tooltips","translate"];const f$={__depends__:[l$],__init__:["modelingFeedback"],modelingFeedback:["type",DE]};var d$=500,h$=1250,g$=1500,cp=Math.round;function m$(e){return{x:e.x+cp(e.width/2),y:e.y+cp(e.height/2)}}function LE(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",g$,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=y$(u),q(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",h$,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",d$,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=cp(l.x),l.y=cp(l.y),!(l.x===0&&l.y===0)&&n.moveElements(f,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(nr(s)){var c=ka(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=m$(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(f!==!1)return!0}}this.start=a}LE.$inject=["eventBus","dragging","modeling","selection","rules"];function y$(e){var t=ra(e,"id");return rt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var IE=499,gg="djs-dragging",BE="drop-ok",NE="drop-not-ok",$E="new-parent",FE="attach-ok";function jE(e,t,n,i){function o(c){var l=r(c),u=v$(l);return u}function r(c){var l=ws(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[FE,BE,NE,$E].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,gg),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",IE,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,f=o(u);if(!l.dragGroup){var d=$e("g");Ae(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=Pp([p,r(u)]):p=r(u),z(p,function(h){t.addMarker(h,gg)}),l.allDraggedElements=p,l.differentParents=b$(u)}),e.on("shape.move.move",IE,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,FE):l.canExecute&&f&&p.id!==f.id?a(p,$E):a(p,l.canExecute?BE:NE)),kn(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,gg)}),p&&nn(p)}),this.makeDraggable=s}jE.$inject=["eventBus","canvas","styles","previewSupport"];function v$(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=rt(e,function(i){return Tt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function b$(e){return wS(ra(e,function(t){return t.parent&&t.parent.id}))!==1}const x$={__depends__:[Xl,Mi,fg,io,So,Ia],__init__:["move","movePreview"],move:["type",LE],movePreview:["type",jE]};var HE=".djs-palette-toggle",zE=".entry",w$=HE+", "+zE,mg="djs-palette-",_$="shown",yg="open",GE="two-column",E$=1e3;function ln(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()})}ln.$inject=["eventBus","canvas"],ln.prototype.registerProvider=function(e,t){t||(t=e,e=E$),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},ln.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(R$,{})},ln.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},ln.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=$t(ln.HTML_MARKUP);n.appendChild(i),Rt(n).add(mg+_$),ni.bind(i,w$,"click",function(o){var r=o.delegateTarget;if(Pf(r,HE))return e.toggle();e.trigger("click",o)}),je.bind(i,"mousedown",function(o){o.stopPropagation()}),ni.bind(i,zE,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},ln.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},ln.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(GE,o),a.toggle(mg+GE,o),"open"in e&&(r.toggle(yg,e.open),a.toggle(mg+yg,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},ln.prototype._update=function(){var e=Et(".djs-palette-entries",this._container),t=this._entries=this.getEntries();al(e),z(t,function(n,i){var o=n.group||"default",r=Et("[data-group="+zr(o)+"]",e);r||(r=$t('<div class="group"></div>'),Rn(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&&(Rn(s,"data-action",i),n.title&&Rn(s,"title",n.title),n.className&&S$(s,n.className),n.imageUrl)){var c=$t("<img>");Rn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},ln.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=Rn(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},ln.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()}},ln.prototype._layoutChanged=function(){this._toggleState({})},ln.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},ln.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},ln.prototype.open=function(){this._toggleState({open:!0})},ln.prototype.toggle=function(){this.isOpen()?this.close():this.open()},ln.prototype.isActiveTool=function(e){return e&&this._activeTool===e},ln.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")}})},ln.prototype.isOpen=function(){return Rt(this._container).has(yg)},ln.prototype._getParentContainer=function(){return this._canvas.getContainer()},ln.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function S$(e,t){var n=Rt(e),i=We(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function R$(e,t){var n=t.getPaletteEntries();return bn(n)?n(e):(z(n,function(i,o){e[o]=i}),e)}const C$={__init__:["palette"],palette:["type",ln]};var VE="crosshair",WE="selected",M$="djs-dragging-active-lasso";function mr(e,t,n,i,o,r,a){this._selection=o,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=$e("rect");Ae(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&&Ae(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,WE);for(const m of g)h.has(m)||t.addMarker(m,WE)}},remove:function(p){this.update(p),p.frame&&nn(p.frame),l(!1)}};function l(p){lt(t.getContainer()).toggle(M$,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=UE(p),f.add=Gl(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=UE(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(Gl(p))return s.activateLasso(p.originalEvent),!0})}mr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],mr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:VE,data:{context:{}},keepSelection:!0})},mr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:VE,data:{context:{}},keepSelection:!0})},mr.prototype._select=function(e){this._selection.select(e)},mr.prototype.select=function(e,t,n=[]){var i=oa(va(e,t));this._select([...n,...i])},mr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},mr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function UE(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 A$={__depends__:[eu,js],__init__:["lassoTool"],lassoTool:["type",mr]};var vg=1500,qE="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",vg,function(c){if(Ns(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(vg,function(c){if(!(!YE(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(vg,function(c){!YE(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!Ns(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:qE,data:{context:n||{}}})},qa.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:qE,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 YE(e){return mn("Space",e)}const P$={__depends__:[eu,js],__init__:["handTool"],handTool:["type",qa]};var KE="connect-ok",XE="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?KE:XE))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?KE:XE)}),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 T$={__depends__:[sg,io,So,eu,js],globalConnect:["type",Ya]};function bg(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)}bg.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],bg.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,o=this._lassoTool,r=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,g,h){function m(w){var y=n.createShape(q({type:p},h));t.start(w,y)}return{group:f,className:d,title:g,action:{dragstart:m,click:m}}}function l(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function u(p){t.start(p,n.createParticipantShape())}return q(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){r.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){o.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:l,click:l}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:u,click:u}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const k$={__depends__:[C$,Ql,lw,A$,P$,T$,Ts],__init__:["paletteProvider"],paletteProvider:["type",bg]};var O$=250;function xg(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);q(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=Et('[data-element-id="'+zr(f.id)+'"]',s.dragGroup);g&&Ae(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="'+zr(u)+'"]',s.dragGroup);p&&Ae(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",O$,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}xg.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Le(xg,de);const D$={__depends__:[Ia],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",xg]};var L$=1250,wg=40,I$=20,B$=10,ZE=20,QE=["x","y"],N$=Math.abs;function JE(e){e.on(["connect.hover","connect.move","connect.end"],L$,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&&$$(t,r,z$(r)),r&&H$(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Ti(o),it(r,["bpmn:Event","bpmn:Gateway"])&&e1(t,Ti(r)),it(r,["bpmn:Task","bpmn:SubProcess"])&&F$(t,r),A(a,"bpmn:BoundaryEvent")&&s===a.host&&j$(t)):t1(i,"bpmn:MessageFlow")?(A(o,"bpmn:Event")&&(n.connectionStart=Ti(o)),A(r,"bpmn:Event")&&e1(t,Ti(r))):n.connectionStart=n.initialConnectionStart)})}JE.$inject=["eventBus"];function $$(e,t,n){QE.forEach(function(i){var o=n1(i,t);e[i]<t[i]+n?cn(e,i,t[i]+n):e[i]>t[i]+o-n&&cn(e,i,t[i]+o-n)})}function F$(e,t){var n=Ti(t);QE.forEach(function(i){G$(e,t,i)&&cn(e,i,n[i])})}function j$(e){var t=e.context,n=t.source,i=t.target;if(!V$(t)){var o=Ti(n),r=Tn(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;N$(c-o[s])<wg&&(c>o[s]?l=o[s]+wg:l=o[s]-wg,cn(e,s,l))})}}function e1(e,t){cn(e,"x",t.x),cn(e,"y",t.y)}function t1(e,t){return e&&e.type===t}function H$(e,t){return No(t,function(n){return t1(e,n)})}function n1(e,t){return e==="x"?t.width:t.height}function z$(e){return A(e,"bpmn:Task")?B$:I$}function G$(e,t,n){return e[n]>t[n]+ZE&&e[n]<t[n]+n1(n,t)-ZE}function V$(e){var t=e.hover,n=e.source;return t&&n&&t===n}function yr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}yr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},yr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},yr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},yr.prototype.getSnapLocations=function(){return this._snapLocations},yr.prototype.setSnapLocations=function(e){this._snapLocations=e},yr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new lp,n.initDefaults(this._defaultSnaps)),n};function lp(){this._snapValues={}}lp.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)},lp.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&OB(e[n],o[n],i)},lp.prototype.initDefaults=function(e){var t=this;z(e||{},function(n,i){z(n,function(o){t.add(i,o)})})};var W$=1250;function so(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"],W$,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&ri(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()})}so.$inject=["elementRegistry","eventBus","snapping"],so.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new yr);var r;t.get(i.id)?r=Ti(i,e):r={x:e.x+Ti(i).x,y:e.y+Ti(i).y};var a={x:r.x-i.width/2,y:r.y-i.height/2},s={x:r.x+i.width/2,y:r.y+i.height/2};return o.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),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},so.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return z(i,function(o){if(nt(o)){nt(t)&&e.add("mid",Ti(o));return}if(Tt(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",Ti(o))}),!Ue(t.x)||!Ue(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Ti(t)),e},so.prototype.getSnapTargets=function(e,t){return z0(t).filter(function(n){return!U$(n)})};function U$(e){return!!e.hidden}var i1=1500;function Ka(e,t){t.invoke(so,this),e.on(["create.move","create.end"],i1,X$),e.on(["create.move","create.end","shape.move.move","shape.move.end"],i1,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!Ua(n)&&q$(n,r)})}Le(Ka,so),Ka.$inject=["eventBus","injector"],Ka.prototype.initSnap=function(e){var t=so.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",r1(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",r1(r,i,e))}),A(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ka.prototype.addSnapTargetPoints=function(e,t,n){so.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);z(i,function(r){(K$(r)||Y$([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",j0(r)),e.add("bottom-right",H0(r)))});var o=this._elementRegistry;return z(t.incoming,function(r){if(o.get(t.id)){o1(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)){o1(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 so.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!A(n,"bpmn:Lane")})};function q$(e,t){var n=ze(t),i=rx(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=qe(r),/top/.test(i)?cn(e,"y",n.top-a.y):/bottom/.test(i)&&cn(e,"y",n.bottom-a.y),/left/.test(i)?cn(e,"x",n.left-a.x):/right/.test(i)&&cn(e,"x",n.right-a.x)}function Y$(e,t){return e.every(function(n){return A(n,t)})}function K$(e){return A(e,"bpmn:SubProcess")&&ut(e)?!0:A(e,"bpmn:Participant")}function X$(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)&&cn(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&cn(e,"y",e.y)}}function o1(e,t){return e.indexOf(t)!==-1}function r1(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 yc(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&&ri(i.originalEvent))&&!Ua(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),e5(s)&&cn(i,"x",i.x),t5(s)&&cn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}yc.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new yr);var r=a1(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},yc.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return z(o,function(r){e.add("corner",H0(r)),e.add("corner",j0(r))}),e.add("corner",a1(t,i)),e},yc.$inject=["eventBus","snapping"],yc.prototype.getSnapTargets=function(e,t){return z0(t).filter(function(n){return!Q$(n,e)&&!Tt(n)&&!J$(n)&&!nt(n)})};function a1(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 Q$(e,t){return e.host===t}function J$(e){return!!e.hidden}function e5(e){return e==="n"||e==="s"}function t5(e){return e==="e"||e==="w"}var n5=7,i5=1e3;function vr(e){this._canvas=e,this._asyncHide=kp(Kn(this.hide,this),i5)}vr.$inject=["canvas"],vr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:Ua(e,"x"),y:Ua(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,n5),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)&&cn(e,a,s.originValue)})},vr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=$e("path");return Ae(n,{d:"M0,0 L0,0"}),lt(n).add("djs-snap-line"),Ke(t,n),{update:function(i){Ue(i)?e==="horizontal"?Ae(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Ae(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Ae(n,{display:"none"})}}},vr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},vr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},vr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},vr.prototype.hide=function(){z(this._snapLines,function(e){e.update()})};const o5={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",so],resizeSnapping:["type",yc],snapping:["type",vr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",JE],createMoveSnapping:["type",Ka]};var s1=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=Et(Je.INPUT_SELECTOR,this._container),this._resultsContainer=Et(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:ni.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){mn("ArrowUp",n)&&n.preventDefault(),mn("ArrowDown",n)&&n.preventDefault()}),t(this._container,Je.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)})},Je.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ni.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=Et(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(){al(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Je.prototype._getCurrentResult=function(){return Et(Je.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Je.prototype._createResultNode=function(e,t){var n=$t(Je.RESULT_HTML);return e.primaryTokens.length>0&&c1(n,e.primaryTokens,Je.RESULT_PRIMARY_HTML),c1(n,e.secondaryTokens,Je.RESULT_SECONDARY_HTML),Rn(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,Rt(this._canvas.getContainer()).add("djs-search-open"),Rt(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,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())},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&&Rt(t).remove(Je.RESULT_SELECTED_CLASS);var n=Rn(e,Je.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Rt(e).add(Je.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:s1}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Je.prototype._select=function(e){var t=Rn(e,Je.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:s1}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Je.prototype._getBoxHtml=function(){const e=$t(Je.BOX_HTML),t=Et(Je.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function c1(e,t,n){var i=r5(t),o=$t(n);o.innerHTML=i,e.appendChild(o)}function r5(e){var t="";return e.forEach(function(n){var i=m_(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">
|
|
335
|
+
</svg>`},mN=900;function dc(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",mN,this)}dc.$inject=["popupMenu","distributeElements","translate","rules"],dc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&q(t,this._getEntries(e)),t},dc.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},dc.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,o={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:aE.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:aE.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const yN={__depends__:[eg,gN],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Ju],distributeElementsMenuProvider:["type",dc]};var sE="is not a registered action",vN="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=Ue(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&&(Ue(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 ug(e,sE);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);z(e,function(i,o){n._registerAction(o,i)})},ki.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw ug(e,vN);this._actions[e]=t},ki.prototype.unregister=function(e){if(!this.isRegistered(e))throw ug(e,sE);this._actions[e]=void 0},ki.prototype.getActions=function(){return Object.keys(this._actions)},ki.prototype.isRegistered=function(e){return!!this._actions[e]};function ug(e,t){return new Error(e+" "+t)}const bN={__init__:["editorActions"],editorActions:["type",ki]};function ep(e){e.invoke(ki,this)}Te(ep,ki),ep.$inject=["injector"],ep.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 g=t.getRootElement(),h=n.filter(function(m){return m!==g});return i.select(h),h}),o&&this._registerAction("spaceTool",function(){o.toggle()}),r&&this._registerAction("lassoTool",function(){r.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(g){var h=i.get(),m=g.type;h.length&&c.trigger(h,m)}),i&&l&&this._registerAction("alignElements",function(g){var h=i.get(),m=[],w=g.type;h.length&&(m=rt(h,function(y){return!A(y,"bpmn:Lane")}),l.trigger(m,w))}),i&&f&&this._registerAction("setColor",function(g){var h=i.get();h.length&&f.setColor(h,g)}),i&&u&&this._registerAction("directEditing",function(){var g=i.get();g.length&&u.activate(g[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,m;A(g,"bpmn:Collaboration")?m=n.filter(function(w){return A(w.parent,"bpmn:Collaboration")}):m=n.filter(function(w){return w!==g&&!A(w.parent,"bpmn:SubProcess")}),h=sn(m),f.moveElements(m,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const xN={__depends__:[bN],editorActions:["type",ep]};function cE(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")})}cE.$inject=["eventBus"];function Yr(e,t){ge.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)}})}Yr.$inject=["eventBus","gridSnapping","modeling"],Te(Yr,ge),Yr.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t},Yr.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e},Yr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),o=/e/.test(t),r={};return r.width=n.snapValue(e.width,{min:e.width}),o&&(i?(r.x=n.snapValue(e.x,{max:e.x}),r.width+=n.snapValue(e.x-r.x,{min:e.x-r.x})):e.x=e.x+e.width-r.width),q(e,r),e},Yr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),o=/s/.test(t),r={};return r.height=n.snapValue(e.height,{min:e.height}),i&&(o?(r.y=n.snapValue(e.y,{max:e.y}),r.height+=n.snapValue(e.y-r.y,{min:e.y-r.y})):e.y=e.y+e.height-r.height),q(e,r),e};var wN=2e3;function lE(e,t){e.on(["spaceTool.move","spaceTool.end"],wN,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)}})}lE.$inject=["eventBus","gridSnapping"];const _N={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Yr],gridSnappingSpaceToolBehavior:["type",lE]};var tp=10;function pg(e,t,n){return n||(n="round"),Math[n](e/t)*t}var EN=1200,SN=800;function hr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",SN,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"],EN,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=RN(r,l);f&&q(u,f),Ka(r,l)||o.snapEvent(r,l,u)})}})}hr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);pn(e,t,i)},hr.prototype.getGridSpacing=function(){return tp},hr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=pg(e,tp);var i,o;return t&&t.min&&(i=t.min,qe(i)&&(i=pg(i+n,tp,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,qe(o)&&(o=pg(o+n,tp,"floor"),e=Math.min(e,o))),e-=n,e},hr.prototype.isActive=function(){return this.active},hr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},hr.prototype.toggleActive=function(){this.setActive(!this.active)},hr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function RN(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&&(np(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&&(np(t)?pE(s)?a.x.max=c.left:a.x.min=c.right:uE(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(np(t)?pE(s)?a.x.min=l.left:a.x.max=l.right:uE(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&&qe(s[t])||(s||(s=r.snapOffset={}),qe(s[t])||(s[t]=0),!o)||(n.get(o.id)||(np(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 np(e){return e==="x"}function uE(e){return e.indexOf("n")!==-1}function pE(e){return e.indexOf("w")!==-1}const MN={__depends__:[_N],__init__:["gridSnapping"],gridSnapping:["type",hr]};var AN=2e3;function fE(e,t,n){e.on("autoPlace",AN,function(i){var o=i.source,r=Ye(o),a=i.shape,s=Xw(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")&&(PN(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}fE.$inject=["eventBus","gridSnapping","elementRegistry"];function PN(e){return e==="x"}var TN=1750;function dE(e,t,n){t.on(["create.start","shape.move.start"],TN,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}))}})}dE.$inject=["canvas","eventBus","gridSnapping"];var kN=3e3;function ip(e,t,n){ge.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],kN,function(o){var r=o.context,a=r.connection,s=r.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||ON(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}ip.$inject=["eventBus","gridSnapping","modeling"],Te(ip,ge),ip.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=IN(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function ON(e){return e.length>3}function DN(e){return e==="h"}function LN(e){return e==="v"}function IN(e,t,n){var i=bo(t,n),o={};return DN(i)&&(o.y=e.snapValue(t.y)),LN(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=q({},t,o),n=q({},n,o)),[t,n]}const BN={__depends__:[MN,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",fE],gridSnappingParticipantBehavior:["type",dE],gridSnappingLayoutConnectionBehavior:["type",ip]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",cE]};var NN=30,hE=30;function hc(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var o=i.element,r=i.gfx;if(A(o,"bpmn:Lane"))return n._createParticipantHit(o,r);if(A(o,"bpmn:Participant"))return pt(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(A(o,"bpmn:SubProcess"))return pt(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}hc.$inject=["eventBus","interactionEvents"],hc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},hc.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=_n(e)?{width:NN,height:e.height}:{width:e.width,height:hE};return this._interactionEvents.createBoxHit(t,"all",n),!0},hc.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:hE}),!0};const $N={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",hc]};function op(e){e.invoke(za,this)}Te(op,za),op.$inject=["injector"],op.prototype.registerBindings=function(e,t){za.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 FN={__depends__:[Fh],__init__:["keyboardBindings"],keyboardBindings:["type",op]};var jN={moveSpeed:1,moveSpeedAccelerated:10},HN=1500,gE="left",mE="up",yE="right",vE="down",zN={ArrowLeft:gE,Left:gE,ArrowUp:mE,Up:mE,ArrowRight:yE,Right:yE,ArrowDown:vE,Down:vE},GN={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 bE(e,t,n,i,o){var r=this;this._config=q({},jN,e||{}),t.addListener(HN,function(a){var s=a.keyEvent,c=zN[s.key];if(c&&!t.isCmd(s)){var l=t.isShift(s);return r.moveSelection(c,l),!0}}),this.moveSelection=function(a,s){var c=o.get();if(c.length){var l=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=GN[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}bE.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const VN={__depends__:[Fh,Ci],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",bE]};var xE=10;function gc(e,t,n,i){this._dragging=i,this._rules=t;var o=this;function r(c,l){var u=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=l,d=Ak(u,p,l),c.newBounds=Tk(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=_v(p),!WN(l,p))return;n.resizeShape(l,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var l={x:c.dx,y:c.dy};r(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}gc.prototype.canResize=function(e){var t=this._rules,n=Bi(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},gc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=q({shape:t},n),r=o.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,wE(t,r),"resize",{autoActivate:!0,cursor:UN(r),data:{shape:t,context:o}})},gc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:xE,height:xE},o=lb(t,e.childrenBoxPadding),kk(n,t,i,o)},gc.$inject=["eventBus","rules","modeling","dragging"];function WN(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function wE(e,t){var n=Ye(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 UN(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 _E="djs-resizing",EE="resize-not-ok",qN=500;function SE(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,_E)),s.width>5&&Ce(c,{x:s.x,width:s.width}),s.height>5&&Ce(c,{y:s.y,height:s.height}),r.canExecute?ut(c).remove(EE):ut(c).add(EE)}function o(r){var a=r.shape,s=r.frame;s&&an(r.frame),t.removeMarker(a,_E)}e.on("resize.move",qN,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}SE.$inject=["eventBus","canvas","previewSupport"];var rp=-6,ap=8,sp=20,mc="djs-resizer",YN=["n","w","s","e","nw","ne","se","sw"];function gr(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))})}gr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){ir(r)&&i.activate(r,e,n)}je.bind(t,"mousedown",o),je.bind(t,"touchstart",o)},gr.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=KN(i),a=Be("g");ut(a).add(mc),ut(a).add(mc+"-"+e.id),ut(a).add(mc+"-"+i),Xe(o,a);var s=Be("rect");Ce(s,{x:-ap/2+r.x,y:-ap/2+r.y,width:ap,height:ap}),ut(s).add(mc+"-visual"),Xe(a,s);var c=Be("rect");return Ce(c,{x:-sp/2+r.x,y:-sp/2+r.y,width:sp,height:sp}),ut(c).add(mc+"-hit"),Xe(a,c),vl(a,t,n),a},gr.prototype.createResizer=function(e,t){var n=wE(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},gr.prototype.addResizer=function(e){var t=this;Ot(e)||z(YN,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},gr.prototype.removeResizers=function(){var e=this._getResizersParent();vs(e)},gr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},gr.$inject=["eventBus","canvas","selection","resize"];function KN(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-rp:e.indexOf("w")!==-1&&(t.x=rp),e.indexOf("s")!==-1?t.y=-rp:e.indexOf("n")!==-1&&(t.y=rp),t}const RE={__depends__:[no,Ro,$a],__init__:["resize","resizePreview","resizeHandles"],resize:["type",gc],resizePreview:["type",SE],resizeHandles:["type",gr]};var XN=2e3;function yc(e,t,n,i,o,r,a){this._bpmnFactory=t,this._canvas=n,this._modeling=o,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],XN,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)}}yc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],yc.prototype.activate=function(e){var t=yi(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);q(n,i);var o={},r=n.style||{};return q(r,{backgroundColor:null,border:null}),(ot(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||CE(e))&&q(o,{centerVertically:!0}),Jo(e)&&(q(o,{resizable:!0,autoResize:!0}),q(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),A(e,"bpmn:TextAnnotation")&&(q(o,{resizable:!0,autoResize:!0}),q(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),q(n,{options:o,style:r}),n}},yc.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),o={x:i.x+i.width/2,y:i.y+i.height/2},r={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),l=c.fontSize*a,u=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(A(e,"bpmn:Lane")||JN(e)){var g=_n(e),h=g?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:o.y-30*a/2}:{width:i.width,height:30*a};q(r,h),q(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?"rotate(-90deg)":null})}if(QN(e)){var m=_n(e),w=m?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:o.x-i.height/2,y:o.y-i.width/2};q(r,w),q(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?null:"rotate(-90deg)"})}(ot(e,["bpmn:Task","bpmn:CallActivity"])||CE(e))&&(q(r,{width:i.width,height:i.height}),q(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),ZN(e)&&(q(r,{width:i.width,x:i.x}),q(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var y=1,v=i.width+2*y;if(n.labelTarget&&(q(r,{width:v,height:i.height+2*y,x:i.x-y,y:i.y-y}),q(d,{fontSize:l+"px",lineHeight:u})),Jo(n)&&!wl(n)&&!it(n)){var x=Yf(e),E=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),C=l,D=Lr.width*a+2*y;q(r,{width:D,height:C+2*y,x:E.x-D/2,y:E.y-C/2-y}),q(d,{fontSize:l+"px",lineHeight:u})}return A(e,"bpmn:TextAnnotation")&&(q(r,{width:i.width+2*y,height:i.height+2*y,x:i.x-y,y:i.y-y,minWidth:30*a,minHeight:10*a}),q(d,{textAlign:"left",paddingTop:Ca*a+"px",paddingBottom:Ca*a+"px",paddingLeft:Ca*a+"px",paddingRight:Ca*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:r,style:d}},yc.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}),e$(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function CE(e){return A(e,"bpmn:SubProcess")&&!pt(e)}function ZN(e){return A(e,"bpmn:SubProcess")&&pt(e)}function QN(e){return A(e,"bpmn:Participant")&&!pt(e)}function JN(e){return A(e,"bpmn:Participant")&&pt(e)}function e$(e){return!e||!e.trim()}var ME="djs-element-hidden",AE="djs-label-hidden";function PE(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:t$(r)}),Xe(s,p),Xe(o,s),Dn(s,r.x,r.y)}A(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,ME):(A(r,"bpmn:Task")||A(r,"bpmn:CallActivity")||A(r,"bpmn:SubProcess")||A(r,"bpmn:Participant")||A(r,"bpmn:Lane"))&&t.addMarker(r,AE)}),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,ME),t.removeMarker(r,AE)),r=void 0,a=void 0,s&&(an(s),s=void 0)})}PE.$inject=["eventBus","canvas","pathMap"];function t$(e,t){var n=ht(e);return n.get("stroke")||t||"black"}const n$={__depends__:[fh,RE,eE],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",yc],labelEditingPreview:["type",PE]};var i$=500,o$=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){TP(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"],i$,function(r){var a=r.element,s=r.gfx,c=Ct(".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=Ct(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Xe(t,n),this.updateOutline(e,n)),n},ro.prototype._createOutlineGfx=function(){var e=Be("rect");return Ce(e,q({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||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=sn(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=o$),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){wn(i.getOutline)&&(t=t||i.getOutline(e))}),t},ro.$inject=["eventBus","styles","elementRegistry"];var cp=6;function fg(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)})}fg.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");vs(t);var n=e.length>1,i=this._canvas.getContainer();if(ut(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=r$(sn(e)),r=Be("rect");Ce(r,q({rx:3},o)),ut(r).add("djs-selection-outline"),Xe(t,r)}},fg.$inject=["eventBus","canvas","selection"];function r$(e){return{x:e.x-cp,y:e.y-cp,width:e.width+cp*2,height:e.height+cp*2}}const dg={__depends__:[Ci],__init__:["outline","multiSelectionOutline"],outline:["type",ro],multiSelectionOutline:["type",fg]},TE=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],kE={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},a$=15,lp=2;function OE(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,TE));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 w;return(w=m.labels)==null?void 0:w.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!ot(p,TE)||!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=ws([Ye(f),Ye(p)],kE),g=d.getAttribute("d"),m=o.isSelected(p)?c(p):l(p),w=Rs(m,g);if(!w)return;const v=o.isSelected(f)?c(f):l(f),x=Rs(v,g)||Ye(f);Is(x,w)<a$||(jf(d,[x,w]),Xe(r,d))}function s(){ys(`.${kE.class}`,r).forEach(an)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+mr(f,"x")-lp,y:p.y+mr(f,"y")-lp,width:mr(f,"width")+lp*2,height:mr(f,"height")+lp*2};return Xf(d,mr(f,"rx"))}if(f.cx){const d=mr(f,"r"),g={x:p.x+mr(f,"cx")-d,y:p.y+mr(f,"cy")-d,width:d*2,height:d*2};return Uv(g)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}OE.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function mr(e,t){return parseFloat(Ce(e,t)||0)}const s$={__depends__:[Ci,dg],__init__:["labelLink"],labelLink:["type",OE]};var c$=new Fr("tt");function l$(e){var t=zt('<div class="djs-tooltip-container" />');return qn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function u$(e,t,n){qn(e,{left:t+"px",top:n+"px"})}function hg(e,t){e.style.display=t===!1?"none":""}var DE="djs-tooltip",gg="."+DE;function Qn(e,t){this._eventBus=e,this._canvas=t,this._ids=c$,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=l$(t.getContainer());var n=this;ni.bind(this._tooltipRoot,gg,"mousedown",function(i){i.stopPropagation()}),ni.bind(this._tooltipRoot,gg,"mouseover",function(i){n.trigger("mouseover",i)}),ni.bind(this._tooltipRoot,gg,"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=q({},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(Rn(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(){hg(this._tooltipRoot)},Qn.prototype.hide=function(){hg(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=zt(n)),i=zt('<div data-tooltip-id="'+t+'" class="'+DE+'">'),qn(i,{position:"absolute"}),i.appendChild(n),e.type&&Mt(i).add("djs-tooltip-"+e.type),e.className&&Mt(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;u$(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),hg(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 p$={__init__:["tooltips"],tooltips:["type",Qn]};var f$="flow elements must be children of pools/participants",d$="Data object must be placed within a pool/participant.";function LE(e,t,n){function i(o,r,a){t.add({position:{x:o.x+5,y:o.y+5},type:"error",timeout:2e3,html:"<div>"+r+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(o){var r=o.context,a=r.shape,s=r.target;A(s,"bpmn:Collaboration")&&(A(a,"bpmn:FlowNode")?i(o,n(f$)):A(a,"bpmn:DataObjectReference")&&i(o,n(d$)))})}LE.$inject=["eventBus","tooltips","translate"];const h$={__depends__:[p$],__init__:["modelingFeedback"],modelingFeedback:["type",LE]};var g$=500,m$=1250,y$=1500,up=Math.round;function v$(e){return{x:e.x+up(e.width/2),y:e.y+up(e.height/2)}}function IE(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",y$,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=b$(u),q(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",m$,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",g$,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=up(l.x),l.y=up(l.y),!(l.x===0&&l.y===0)&&n.moveElements(f,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(ir(s)){var c=La(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(mn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!ut(s.target).has("djs-hit-no-move")){var p=v$(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}IE.$inject=["eventBus","dragging","modeling","selection","rules"];function b$(e){var t=sa(e,"id");return rt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var BE=499,mg="djs-dragging",NE="drop-ok",$E="drop-not-ok",FE="new-parent",jE="attach-ok";function HE(e,t,n,i){function o(c){var l=r(c),u=x$(l);return u}function r(c){var l=_s(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[jE,NE,$E,FE].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,mg),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",BE,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 g=t.getActiveLayer();Xe(g,d),l.dragGroup=d}f.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=Tp([p,r(u)]):p=r(u),z(p,function(h){t.addMarker(h,mg)}),l.allDraggedElements=p,l.differentParents=w$(u)}),e.on("shape.move.move",BE,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,jE):l.canExecute&&f&&p.id!==f.id?a(p,FE):a(p,l.canExecute?NE:$E)),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,mg)}),p&&an(p)}),this.makeDraggable=s}HE.$inject=["eventBus","canvas","styles","previewSupport"];function x$(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=rt(e,function(i){return Ot(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function w$(e){return ES(sa(e,function(t){return t.parent&&t.parent.id}))!==1}const _$={__depends__:[Ql,Ci,dg,no,Ro,$a],__init__:["move","movePreview"],move:["type",IE],movePreview:["type",HE]};var zE=".djs-palette-toggle",GE=".entry",E$=zE+", "+GE,yg="djs-palette-",S$="shown",vg="open",VE="two-column",R$=1e3;function fn(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()})}fn.$inject=["eventBus","canvas"],fn.prototype.registerProvider=function(e,t){t||(t=e,e=R$),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},fn.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(M$,{})},fn.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},fn.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=zt(fn.HTML_MARKUP);n.appendChild(i),Mt(n).add(yg+S$),ni.bind(i,E$,"click",function(o){var r=o.delegateTarget;if(Tf(r,zE))return e.toggle();e.trigger("click",o)}),je.bind(i,"mousedown",function(o){o.stopPropagation()}),ni.bind(i,GE,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},fn.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},fn.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=Mt(n),a=Mt(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(VE,o),a.toggle(yg+VE,o),"open"in e&&(r.toggle(vg,e.open),a.toggle(yg+vg,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},fn.prototype._update=function(){var e=Ct(".djs-palette-entries",this._container),t=this._entries=this.getEntries();cl(e),z(t,function(n,i){var o=n.group||"default",r=Ct("[data-group="+Gr(o)+"]",e);r||(r=zt('<div class="group"></div>'),Rn(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=zt(a);if(r.appendChild(s),!n.separator&&(Rn(s,"data-action",i),n.title&&Rn(s,"title",n.title),n.className&&C$(s,n.className),n.imageUrl)){var c=zt("<img>");Rn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},fn.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=Rn(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},fn.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(wn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},fn.prototype._layoutChanged=function(){this._toggleState({})},fn.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},fn.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},fn.prototype.open=function(){this._toggleState({open:!0})},fn.prototype.toggle=function(){this.isOpen()?this.close():this.open()},fn.prototype.isActiveTool=function(e){return e&&this._activeTool===e},fn.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Ct(".djs-palette-entries",this._container),this._toolsContainer=Ct("[data-group=tools]",t)),n=this._toolsContainer,z(n.children,function(i){var o=i.getAttribute("data-action");if(o){var r=Mt(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},fn.prototype.isOpen=function(){return Mt(this._container).has(vg)},fn.prototype._getParentContainer=function(){return this._canvas.getContainer()},fn.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=Mt(e),i=Ue(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function M$(e,t){var n=t.getPaletteEntries();return wn(n)?n(e):(z(n,function(i,o){e[o]=i}),e)}const A$={__init__:["palette"],palette:["type",fn]};var WE="crosshair",UE="selected",P$="djs-dragging-active-lasso";function yr(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}),Xe(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 g=p.marked,h=p.lastMarked;if(g&&h){for(const m of h)g.has(m)||t.removeMarker(m,UE);for(const m of g)h.has(m)||t.addMarker(m,UE)}},remove:function(p){this.update(p),p.frame&&an(p.frame),l(!1)}};function l(p){ut(t.getContainer()).toggle(P$,p)}function u(p){var f=i.getAll();return new Set(aa(wa(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=qE(p),f.add=Wl(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=qE(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(Wl(p))return s.activateLasso(p.originalEvent),!0})}yr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],yr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:WE,data:{context:{}},keepSelection:!0})},yr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:WE,data:{context:{}},keepSelection:!0})},yr.prototype._select=function(e){this._selection.select(e)},yr.prototype.select=function(e,t,n=[]){var i=aa(wa(e,t));this._select([...n,...i])},yr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},yr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function qE(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 T$={__depends__:[nu,Hs],__init__:["lassoTool"],lassoTool:["type",yr]};var bg=1500,YE="grab";function Xa(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",bg,function(c){if($s(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(bg,function(c){if(!(!KE(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(bg,function(c){!KE(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var l=c.originalEvent.target;if(!c.hover&&!(l instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var l=t.viewbox().scale;t.scroll({dx:c.dx*l,dy:c.dy*l})}),e.on("hand.move.end",function(c){var l=c.context,u=l.reactivate;return!$s(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Xa.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Xa.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:YE,data:{context:n||{}}})},Xa.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:YE,data:{context:{reactivate:n}}})},Xa.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Xa.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function KE(e){return vn("Space",e)}const k$={__depends__:[nu,Hs],__init__:["handTool"],handTool:["type",Xa]};var XE="connect-ok",ZE="connect-not-ok";function Za(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?XE: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?XE: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})}Za.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Za.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Za.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Za.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Za.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const O$={__depends__:[cg,no,Ro,nu,Hs],globalConnect:["type",Za]};function xg(e,t,n,i,o,r,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=o,this._handTool=r,this._globalConnect=a,this._translate=s,e.registerProvider(this)}xg.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],xg.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,o=this._lassoTool,r=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,g,h){function m(w){var y=n.createShape(q({type:p},h));t.start(w,y)}return{group:f,className:d,title:g,action:{dragstart:m,click:m}}}function l(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function u(p){t.start(p,n.createParticipantShape())}return q(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){r.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){o.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:l,click:l}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:u,click:u}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const D$={__depends__:[A$,eu,uw,T$,k$,O$,ks],__init__:["paletteProvider"],paletteProvider:["type",xg]};var L$=250;function wg(e,t,n,i,o){ge.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);q(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=Ct('[data-element-id="'+Gr(f.id)+'"]',s.dragGroup);g&&Ce(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=Ct('[data-element-id="'+Gr(u)+'"]',s.dragGroup);p&&Ce(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",L$,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}wg.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Te(wg,ge);const I$={__depends__:[$a],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",wg]};var B$=1250,_g=40,N$=20,$$=10,QE=20,JE=["x","y"],F$=Math.abs;function e1(e){e.on(["connect.hover","connect.move","connect.end"],B$,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&&j$(t,r,V$(r)),r&&G$(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Pi(o),ot(r,["bpmn:Event","bpmn:Gateway"])&&t1(t,Pi(r)),ot(r,["bpmn:Task","bpmn:SubProcess"])&&H$(t,r),A(a,"bpmn:BoundaryEvent")&&s===a.host&&z$(t)):n1(i,"bpmn:MessageFlow")?(A(o,"bpmn:Event")&&(n.connectionStart=Pi(o)),A(r,"bpmn:Event")&&t1(t,Pi(r))):n.connectionStart=n.initialConnectionStart)})}e1.$inject=["eventBus"];function j$(e,t,n){JE.forEach(function(i){var o=i1(i,t);e[i]<t[i]+n?pn(e,i,t[i]+n):e[i]>t[i]+o-n&&pn(e,i,t[i]+o-n)})}function H$(e,t){var n=Pi(t);JE.forEach(function(i){W$(e,t,i)&&pn(e,i,n[i])})}function z$(e){var t=e.context,n=t.source,i=t.target;if(!U$(t)){var o=Pi(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;F$(c-o[s])<_g&&(c>o[s]?l=o[s]+_g:l=o[s]-_g,pn(e,s,l))})}}function t1(e,t){pn(e,"x",t.x),pn(e,"y",t.y)}function n1(e,t){return e&&e.type===t}function G$(e,t){return $o(t,function(n){return n1(e,n)})}function i1(e,t){return e==="x"?t.width:t.height}function V$(e){return A(e,"bpmn:Task")?$$:N$}function W$(e,t,n){return e[n]>t[n]+QE&&e[n]<t[n]+i1(n,t)-QE}function U$(e){var t=e.hover,n=e.source;return t&&n&&t===n}function vr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}vr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},vr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},vr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},vr.prototype.getSnapLocations=function(){return this._snapLocations},vr.prototype.setSnapLocations=function(e){this._snapLocations=e},vr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new pp,n.initDefaults(this._defaultSnaps)),n};function pp(){this._snapValues={}}pp.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)},pp.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&LB(e[n],o[n],i)},pp.prototype.initDefaults=function(e){var t=this;z(e||{},function(n,i){z(n,function(o){t.add(i,o)})})};var q$=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"],q$,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&ri(o.originalEvent))&&!(Ka(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 vr);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}),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",Pi(o));return}if(Ot(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",Pi(o))}),!qe(t.x)||!qe(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Pi(t)),e},ao.prototype.getSnapTargets=function(e,t){return G0(t).filter(function(n){return!Y$(n)})};function Y$(e){return!!e.hidden}var o1=1500;function Qa(e,t){t.invoke(ao,this),e.on(["create.move","create.end"],o1,Q$),e.on(["create.move","create.end","shape.move.move","shape.move.end"],o1,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!Ka(n)&&K$(n,r)})}Te(Qa,ao),Qa.$inject=["eventBus","injector"],Qa.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",a1(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",a1(r,i,e))}),A(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Qa.prototype.addSnapTargetPoints=function(e,t,n){ao.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);z(i,function(r){(Z$(r)||X$([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",H0(r)),e.add("bottom-right",z0(r)))});var o=this._elementRegistry;return z(t.incoming,function(r){if(o.get(t.id)){r1(i,r.source)||e.add("mid",Ye(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)){r1(i,r.target)||e.add("mid",Ye(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},Qa.prototype.getSnapTargets=function(e,t){return ao.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!A(n,"bpmn:Lane")})};function K$(e,t){var n=ze(t),i=ax(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=Ye(r),/top/.test(i)?pn(e,"y",n.top-a.y):/bottom/.test(i)&&pn(e,"y",n.bottom-a.y),/left/.test(i)?pn(e,"x",n.left-a.x):/right/.test(i)&&pn(e,"x",n.right-a.x)}function X$(e,t){return e.every(function(n){return A(n,t)})}function Z$(e){return A(e,"bpmn:SubProcess")&&pt(e)?!0:A(e,"bpmn:Participant")}function Q$(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)&&pn(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&pn(e,"y",e.y)}}function r1(e,t){return e.indexOf(t)!==-1}function a1(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var J$=1250;function vc(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],J$,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&ri(i.originalEvent))&&!Ka(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),n5(s)&&pn(i,"x",i.x),i5(s)&&pn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}vc.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new vr);var r=s1(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},vc.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return z(o,function(r){e.add("corner",z0(r)),e.add("corner",H0(r))}),e.add("corner",s1(t,i)),e},vc.$inject=["eventBus","snapping"],vc.prototype.getSnapTargets=function(e,t){return G0(t).filter(function(n){return!e5(n,e)&&!Ot(n)&&!t5(n)&&!it(n)})};function s1(e,t){var n=Ye(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 e5(e,t){return e.host===t}function t5(e){return!!e.hidden}function n5(e){return e==="n"||e==="s"}function i5(e){return e==="e"||e==="w"}var o5=7,r5=1e3;function br(e){this._canvas=e,this._asyncHide=Op(Xn(this.hide,this),r5)}br.$inject=["canvas"],br.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:Ka(e,"x"),y:Ka(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,o5),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];mn(s)&&pn(e,a,s.originValue)})},br.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Be("path");return Ce(n,{d:"M0,0 L0,0"}),ut(n).add("djs-snap-line"),Xe(t,n),{update:function(i){qe(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"})}}},br.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},br.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},br.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},br.prototype.hide=function(){z(this._snapLines,function(e){e.update()})};const a5={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",ao],resizeSnapping:["type",vc],snapping:["type",br]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",e1],createMoveSnapping:["type",Qa]};var c1=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=Ct(Je.INPUT_SELECTOR,this._container),this._resultsContainer=Ct(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:ni.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){vn("ArrowUp",n)&&n.preventDefault(),vn("ArrowDown",n)&&n.preventDefault()}),t(this._container,Je.INPUT_SELECTOR,"keyup",function(n){if(vn("Escape",n))return e.close();if(vn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(vn("ArrowUp",n))return e._scrollToDirection(!0);if(vn("ArrowDown",n))return e._scrollToDirection();vn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Je.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ni.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=Ct(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(){cl(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Je.prototype._getCurrentResult=function(){return Ct(Je.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Je.prototype._createResultNode=function(e,t){var n=zt(Je.RESULT_HTML);return e.primaryTokens.length>0&&l1(n,e.primaryTokens,Je.RESULT_PRIMARY_HTML),l1(n,e.secondaryTokens,Je.RESULT_SECONDARY_HTML),Rn(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,Mt(this._canvas.getContainer()).add("djs-search-open"),Mt(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,Mt(this._canvas.getContainer()).remove("djs-search-open"),Mt(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&&Mt(t).remove(Je.RESULT_SELECTED_CLASS);var n=Rn(e,Je.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Mt(e).add(Je.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:c1}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Je.prototype._select=function(e){var t=Rn(e,Je.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:c1}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Je.prototype._getBoxHtml=function(){const e=zt(Je.BOX_HTML),t=Ct(Je.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function l1(e,t,n){var i=s5(t),o=zt(n);o.innerHTML=i,e.appendChild(o)}function s5(e){var t="";return e.forEach(function(n){var i=y_(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>`,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 a5={__depends__:[Ts,Ru,Mi],searchPad:["type",Je]};function _g(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}_g.$inject=["elementRegistry","searchPad","canvas","search"],_g.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(s5)};function s5(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const c5={__depends__:[a5,x0],__init__:["bpmnSearch"],bpmnSearch:["type",_g]},l5="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",u5="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",p5={width:36,height:50},f5={width:50,height:50};function l1(e,t,n){return $e("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Di=5;function up(e,t){this._styles=t,e.registerProvider(this)}up.$inject=["outline","styles"],up.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(ST(e))return n=$e("rect"),Ae(n,q({x:-Di,y:-Di,rx:4,width:e.width+Di*2,height:e.height+Di*2},t)),n;if(!nt(e))return A(e,"bpmn:Gateway")?(n=$e("rect"),q(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Ae(n,q({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=$e("rect"),Ae(n,q({x:-Di,y:-Di,rx:14,width:e.width+Di*2,height:e.height+Di*2},t))):A(e,"bpmn:EndEvent")?(n=$e("circle"),Ae(n,q({cx:e.width/2,cy:e.height/2,r:e.width/2+Di+1},t))):A(e,"bpmn:Event")?(n=$e("circle"),Ae(n,q({cx:e.width/2,cy:e.height/2,r:e.width/2+Di},t))):A(e,"bpmn:DataObjectReference")&&u1(e,"bpmn:DataObjectReference")?n=l1(l5,{x:-6,y:-6},t):A(e,"bpmn:DataStoreReference")&&u1(e,"bpmn:DataStoreReference")&&(n=l1(u5,{x:-6,y:-6},t)),n},up.prototype.updateOutline=function(e,t){if(!nt(e))return it(e,["bpmn:SubProcess","bpmn:Group"])?(Ae(t,{width:e.width+Di*2,height:e.height+Di*2}),!0):!!it(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function u1(e,t){var n;return t==="bpmn:DataObjectReference"?n=p5:t==="bpmn:DataStoreReference"&&(n=f5),e.width===n.width&&e.height===n.height}const d5={__depends__:[fg],__init__:["outlineProvider"],outlineProvider:["type",up]};var h5='<?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 co(e){wa.call(this,e)}Le(co,wa),co.Viewer=pr,co.NavigatedViewer=nc,co.prototype.createDiagram=function(){return this.importXML(h5)},co.prototype._interactionModules=[E_,R_,A_],co.prototype._modelingModules=[mB,xu,wB,bB,LB,sg,jB,pN,Qx,Ql,gN,vN,LN,BN,NN,zN,e$,r$,Ah,f$,x$,k$,D$,SE,o5,c5,d5],co.prototype._modules=[].concat(pr.prototype._modules,co.prototype._interactionModules,co.prototype._modelingModules);var pp=50,g5=new $r,p1={min:.2,max:4},m5=10,y5=.1,v5=250,b5=100,x5=2e3;function Ln(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=g5.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||dp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=fp({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);Eg(p,r._canvas),r._update()}function s(u){return function(f){var d=Sg(f);(!r._state._svgClientRect||dp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(d);var g=fp({x:d.x-r._state._svgClientRect.left,y:d.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),h=i.viewbox(),m=_5(g,h),w=r._viewportDom.getBoundingClientRect(),y={x:d.x-w.left+1,y:d.y-w.top+1};q(r._state,{cachedViewbox:h,initialDragPosition:{x:d.x,y:d.y},isDragging:!0,offsetViewport:m,offsetViewportDom:y,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),je.bind(document,"mousemove",c),je.bind(document,"mouseup",l)}}function c(u){var p=Sg(u);if(r._state.isDragging){(!r._state._svgClientRect||dp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var f=r._state.offsetViewportDom,d=r._state.viewportClientRect,g=r._state.parentClientRect;q(r._viewportDom.style,{top:p.y-f.y-g.top+"px",left:p.x-f.x-g.left+"px"});var h=d1(g,{top:p.y-f.y-g.top,left:p.x-f.x-g.left,width:d.width,height:d.height});q(r._overlay.style,{clipPath:h});var m=fp({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);Eg({x:m.x-r._state.offsetViewport.x,y:m.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=Sg(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),q(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),je.unbind(document,"mousemove",c),je.unbind(document,"mouseup",l))}je.bind(this._viewportDom,"mousedown",s(!1)),je.bind(this._svg,"mousedown",s(!0)),je.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||dp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!M5(u,r._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,f=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*A5(u.deltaY)*-p;if(r._state.zoomDelta+=f,Math.abs(r._state.zoomDelta)>y5){var d=f>0?1:-1,g=Math.log(i.zoom())/Math.log(10),h=P5(p1,m5*2),m=Math.round(g/h)*h;m+=h*d;var w=Math.pow(10,m);i.zoom(T5(p1,w),y),r._state.zoomDelta=0;var y=fp({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);Eg(y,r._canvas),r._update()}}}),je.bind(this._toggle,"click",function(u){u.preventDefault(),u.stopPropagation(),r.toggle()}),n.on(["shape.added","connection.added"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._addElement(u.element),r._scheduleUpdate()}),n.on(["shape.removed","connection.removed"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._removeElement(u.element),r._scheduleUpdate()}),n.on("elements.changed",v5,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)})}Ln.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],Ln.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=$e("svg");Ae(r,{width:"100%",height:"100%"}),Ke(o,r);var a=this._elementsGroup=$e("g");Ke(r,a);var s=this._viewportGroup=$e("g");Ke(r,s);var c=this._viewport=$e("rect");lt(c).add("viewport"),Ke(s,c),je.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)},Ln.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=Ue(this._config.debounceDelay)?this._config.debounceDelay:b5,n=Ue(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:x5,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)}},Ln.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)})}},Ln.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(h1(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-pp,o=o-pp,r=r+pp*2,a=a+pp*2,this._lastViewbox={x:i,y:o,width:r,height:a},Ae(this._svg,{viewBox:i+", "+o+", "+r+", "+a}),Ae(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var l=this._state._parentClientRect=this._parent.getBoundingClientRect(),u=this._viewport.getBoundingClientRect(),p={top:u.top-l.top,left:u.left-l.left,width:u.width,height:u.height};q(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var f=d1(l,p);q(this._overlay.style,{clipPath:f})}}},Ln.prototype.open=function(){q(this._state,{isOpen:!0}),Rt(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};Rn(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Ln.prototype.close=function(){q(this._state,{isOpen:!1}),Rt(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};Rn(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},Ln.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},Ln.prototype.isOpen=function(){return this._state.isOpen},Ln.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)}},Ln.prototype._updateElementId=function(e,t){try{var n=Et("#"+zr(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},Ln.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},Ln.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("#"+zr(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=S5(e);return s!==-1?a?R5(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),w5(e)?(n=e.parent,i=0,o=0,typeof n.x<"u"&&typeof n.y<"u"&&(i=-n.x,o=-n.y),Ae(r,{transform:"translate("+i+" "+o+")"})):(i=e.x,o=e.y,a&&(n=e.parent,i-=n.x,o-=n.y),Ae(r,{transform:"translate("+i+" "+o+")"})),e.children&&e.children.length&&e.children.forEach(function(c){t._addElement(c)}),r}}},Ln.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&nn(t)},Ln.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=Xo(t),n)){var i=k5(kf(n));return Ae(i,{id:this._prefixId(e.id)}),i}},Ln.prototype._clear=function(){ys(this._elementsGroup)},Ln.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function w5(e){return e.waypoints}function _5(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 fp(e,t,n){var i=t.getBoundingClientRect(),o=E5(n,i.width/i.height),r=f1(e.x,0,i.width,o.x,o.x+o.width),a=f1(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function Eg(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 E5(e,t){var n=e.width/e.height,i=q({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var o=i.width*(1/t),r=i.y-(o-i.height)/2;q(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;q(i,{x:s,width:a})}return i}function f1(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function S5(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function R5(e,t,n){var i=C5(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function C5(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function dp(e){return e.width===0&&e.height===0}function M5(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var A5=Math.sign||function(e){return e>=0?1:-1};function P5(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 T5(e,t){return Math.max(e.min,Math.min(e.max,t))}function d1(e,t){var n=[lo(t.left,t.top),lo(t.left+t.width,t.top),lo(t.left+t.width,t.top+t.height),lo(t.left,t.top+t.height),lo(t.left,e.height),lo(e.width,e.height),lo(e.width,0),lo(0,0),lo(0,e.height),lo(t.left,e.height)].join(", ");return"polygon("+n+")"}function lo(e,t){return e+"px "+t+"px"}function h1(e){return Bo(e,function(t){return hn(t)?h1(t):Ue(t)&&isFinite(t)})}function Sg(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function k5(e){return ms("[id]",e).forEach(function(t){t.remove()}),e}var O5={__init__:["minimap"],minimap:["type",Ln]};const g1={closed:"미니맵",open:"접기"};class m1{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(Ih,()=>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?g1.open:g1.closed)}}Bn(m1,"$inject",["eventBus","minimap","canvas"]);const D5={__depends__:[O5],__init__:["minimapI18n"],minimapI18n:["type",m1]},L5=ye.defineComponent({__name:"BpmnModelerView",props:{xml:{},labelFontFamily:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=ye.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 ye.onMounted(async()=>{a=new co({container:r.value,moddleExtensions:Bc,additionalModules:[d_,D5,Jw,n_],...i.labelFontFamily?{textRenderer:{defaultStyle:{fontFamily:i.labelFontFamily}}}:{}}),i.xml&&await s(i.xml),o("ready")}),ye.watch(()=>i.xml,l=>{l&&a&&s(l)}),ye.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(ye.openBlock(),ye.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),Rg=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},I5=Rg(L5,[["__scopeId","data-v-17ae2a23"]]),B5=["title","aria-expanded"],N5=["title","onClick"],$5={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},F5={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},j5={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},H5={key:0,class:"bwl-validation__body"},z5={key:0,class:"bwl-validation__empty"},G5={key:1,class:"bwl-validation__empty"},V5={key:2,class:"bwl-validation__list"},W5=["onClick"],U5={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},q5={class:"bwl-validation__msg"},Y5=["title"],K5=Rg(ye.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=ye.computed(()=>s_(n.issues.value,n.describeElement)),o=ye.computed(()=>c_(i.value)),r=g=>$a(g,n.changeScope.value),a=ye.computed(()=>Lh(i.value,n.changeScope.value)),s=ye.ref({error:!0,warning:!0,info:!0}),c=ye.computed(()=>l_(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=ye.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)=>(ye.openBlock(),ye.createElementBlock("section",{class:ye.normalizeClass(["bwl-validation",{"is-open":l.value}])},[ye.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=m=>l.value=!l.value)},[ye.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(ye.openBlock(),ye.createElementBlock("svg",{class:ye.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[ye.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=ye.createElementVNode("span",null,"검증",-1))],8,B5),ye.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=ye.withModifiers(()=>{},["stop"]))},[(ye.openBlock(),ye.createElementBlock(ye.Fragment,null,ye.renderList(u,m=>ye.createElementVNode("button",{key:m,type:"button",class:ye.normalizeClass(["bwl-validation__count",[`is-${m}`,{"is-off":!s.value[m]}]]),title:l.value?`${p[m]} ${s.value[m]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:w=>f(m)},[(ye.openBlock(),ye.createElementBlock("svg",$5,[h[4]||(h[4]=ye.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),m==="error"?(ye.openBlock(),ye.createElementBlock("path",F5)):(ye.openBlock(),ye.createElementBlock("path",j5))])),ye.createElementVNode("span",null,ye.toDisplayString(o.value[m]),1)],10,N5)),64))])]),l.value?(ye.openBlock(),ye.createElementBlock("div",H5,[i.value.length===0?(ye.openBlock(),ye.createElementBlock("p",z5,"발견된 문제가 없습니다.")):c.value.length===0?(ye.openBlock(),ye.createElementBlock("p",G5," 선택한 심각도에 해당하는 항목이 없습니다. ")):(ye.openBlock(),ye.createElementBlock("ul",V5,[(ye.openBlock(!0),ye.createElementBlock(ye.Fragment,null,ye.renderList(c.value,m=>(ye.openBlock(),ye.createElementBlock("li",{key:m.key,class:ye.normalizeClass(["bwl-validation__item",[`is-${m.severity}`,{"is-clickable":m.targetRefs.length>0}]]),onClick:w=>d(m)},[h[5]||(h[5]=ye.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(m)?(ye.openBlock(),ye.createElementBlock("span",U5,"이번 변경")):ye.createCommentVNode("",!0),ye.createElementVNode("span",q5,ye.toDisplayString(m.message),1),ye.createElementVNode("span",{class:"bwl-validation__cat",title:m.code},ye.toDisplayString(m.category),9,Y5)],10,W5))),128))]))])):ye.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),X5={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},Z5=["aria-checked","title","data-locale","onClick"],Q5={class:"bwl-locale__label"},J5={key:0,class:"bwl-locale__badge"},e3=Rg(ye.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=ye.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?(ye.openBlock(),ye.createElementBlock("div",X5,[(ye.openBlock(!0),ye.createElementBlock(ye.Fragment,null,ye.renderList(o.value,s=>(ye.openBlock(),ye.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:ye.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=>ye.unref(n).setDisplayLocale(s.locale)},[ye.createElementVNode("span",Q5,ye.toDisplayString(s.label),1),s.pending>0?(ye.openBlock(),ye.createElementBlock("span",J5,ye.toDisplayString(s.pending),1)):ye.createCommentVNode("",!0)],10,Z5))),128))])):ye.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);J.ADDABLE_FLOW_NODE_TYPES=Ec,J.APPLY_BPMN_OPS_SCHEMA=VS,J.BPMN_EVENT_DEFINITION_TYPES=Rc,J.BPMN_MODDLE_EXTENSIONS=Bc,J.BWL_MODDLE_SCHEMA=Hg,J.BWL_NS=jg,J.BWL_PREFIX=Cp,J.BWL_REVIEW_REQUEST_TYPE=Mc,J.BWL_SIDES=Mp,J.BpmnDisplayLocaleSwitcher=e3,J.BpmnModelerView=I5,J.BpmnValidationPanel=K5,J.EDITOR=fA,J.FLOW_LABEL_INDENT=wm,J.GROUP_BORDER_MIN_RUN=Jp,J.GROUP_BORDER_NEAR=fa,J.HEADLESS_BPMN_MODULES=i_,J.HEADLESS_TEXT_METRICS=ua,J.I18N_DISPLAY_REDRAWN_EVENT=Ih,J.I18N_NS=CS,J.I18N_PREFIX=Ug,J.I18N_REVIEW_REQUESTED_CLASS=p_,J.I18N_TRANSLATION_TYPE=Sr,J.I18N_UNTRANSLATED_CLASS=u_,J.I18nDisplay=Bh,J.I18nDisplayModule=d_,J.IR_EVENT_DEFINITIONS=Sc,J.IR_FLOW_NODE_TYPES=_r,J.IR_TEXT_LOCALES=Cc,J.LABEL_FORK_MARGIN=nf,J.LABEL_SHAPE_MIN_DEPTH=Dm,J.SET_TRANSLATIONS_COMMAND=Ip,J.SEVERITY_ORDER=Dh,J.SYMBOLIC_OP_KINDS=qg,J.SYMBOLIC_OP_SCHEMA=Yg,J.SetTranslationsHandler=Bp,J.TranslationCommands=$p,J.TranslationCommandsModule=Fp,J.TranslationStateIndex=bA,J.UNDO_EPISODE_COMMAND=Ap,J.UPDATE_TRANSLATION_COMMAND=Tc,J.UpdateTranslationHandler=Lp,J.applyBpmnOpBatch=Ny,J.applyBpmnOps=Py,J.applyLocaleBackfill=vA,J.applyTranslationLocaleRestore=SA,J.approximateTextWidth=pa,J.auditBpmnGeometry=Bm,J.auditBpmnGeometryXml=jC,J.auditBpmnSemantics=Sf,J.auditBpmnSemanticsXml=eA,J.auditGeometry=pt,J.auditTargetsOf=Fn,J.axisSegmentsOf=tn,J.blackBoxNameRect=ef,J.buildBpmnOpBatch=cA,J.buildRegistryIndex=$m,J.collectTranslationStates=Vy,J.containerBoundarySegments=ha,J.countBySeverity=c_,J.createBpmnEditorController=dA,J.createBpmnModdle=dm,J.createHeadlessBpmnModeler=UL,J.crossedShapesOf=jt,J.crossingCost=di,J.describeProcess=Dy,J.describeProcessXml=YM,J.diffBpmnElements=By,J.diffBpmnElementsXml=aA,J.documentLocalesOf=os,J.edgeCrossCount=us,J.edgeCrossingPairsOf=go,J.edgeCrossingStatsOf=Am,J.executeAsUndoEpisode=Gg,J.followMovedEdgeLabels=uy,J.forwardThreePointCandidates=Gc,J.geometryFindingKey=ct,J.inferScriptLocale=rl,J.installHeadlessBpmnDom=gm,J.irEventDefinitionOf=Rp,J.isAddableFlowNodeType=$g,J.isChangeScopeMixed=Lh,J.isEdgeOverlapFinding=tf,J.isInChangeScope=$a,J.isIrEventDefinition=Fg,J.isIrFlowNodeType=Ng,J.isIrTextLocale=mS,J.labelRectsOf=Go,J.labelShapeDepth=Lm,J.labelSlot=Rr,J.lineCrossesLabel=$i,J.lineThroughLabel=Em,J.lineThroughShapeLabel=Om,J.loadBpmnXml=la,J.localeTextsOf=Dp,J.lowerOps=Cy,J.oppositeOverlapCount=CC,J.oppositeOverlapOf=xm,J.planBackEdgeBoundaryClearance=Zm,J.planCrossPoolRoute=Um,J.planEdgeRepair=Wc,J.planLabelLineClearance=vf,J.planLabelPlacement=sy,J.planLocaleBackfill=yA,J.planMiddleSegmentShifts=jm,J.planOppositeOverlapRepair=ey,J.planSegmentDetours=zc,J.planShapeLabelClearance=dy,J.planTranslationLocaleRestore=EA,J.poolOverlapsOf=af,J.redockIntroducedDetachedEndpoints=gy,J.repairIntroducedBoundaryHugging=Qm,J.repairIntroducedCrossings=lf,J.repairIntroducedEdgeCrossings=Hm,J.repairIntroducedFakeMerges=ny,J.repairIntroducedLabelLines=py,J.repairIntroducedOppositeOverlaps=ay,J.repairIntroducedShapeLabelLines=hy,J.repairIntroducedSharedSegmentLabels=fy,J.rerouteIntroducedCrossPoolEdges=qm,J.resolverServicesOf=xy,J.reviewRequestValuesOf=Np,J.reviewRequestsOf=Fo,J.rootLangOf=Op,J.saveBpmnXml=hC,J.sceneCrossingCost=Mm,J.sceneFromDefinitions=Im,J.sceneFromRegistry=Ge,J.segmentShapeClearance=ls,J.shapesUnderLabel=ps,J.sharedEndpointCrossingPairsOf=Fi,J.sharedSegmentUnderLabel=Hc,J.sharedSpansOf=jc,J.sortPanelIssues=l_,J.toPanelIssues=s_,J.touchedElements=sA,J.translationLocale=Sn,J.translationsOf=$o,J.unreadableOverlapCount=fi,J.unreadableOverlapOf=Pr,J.validateOps=by,J.warningMessages=Qp,Object.defineProperty(J,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 c5={__depends__:[ks,Mu,Ci],searchPad:["type",Je]};function Eg(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Eg.$inject=["elementRegistry","searchPad","canvas","search"],Eg.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(l5)};function l5(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const u5={__depends__:[c5,w0],__init__:["bpmnSearch"],bpmnSearch:["type",Eg]},p5="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",f5="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",d5={width:36,height:50},h5={width:50,height:50};function u1(e,t,n){return Be("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Oi=5;function fp(e,t){this._styles=t,e.registerProvider(this)}fp.$inject=["outline","styles"],fp.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(CT(e))return n=Be("rect"),Ce(n,q({x:-Oi,y:-Oi,rx:4,width:e.width+Oi*2,height:e.height+Oi*2},t)),n;if(!it(e))return A(e,"bpmn:Gateway")?(n=Be("rect"),q(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Ce(n,q({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"),Ce(n,q({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,q({cx:e.width/2,cy:e.height/2,r:e.width/2+Oi+1},t))):A(e,"bpmn:Event")?(n=Be("circle"),Ce(n,q({cx:e.width/2,cy:e.height/2,r:e.width/2+Oi},t))):A(e,"bpmn:DataObjectReference")&&p1(e,"bpmn:DataObjectReference")?n=u1(p5,{x:-6,y:-6},t):A(e,"bpmn:DataStoreReference")&&p1(e,"bpmn:DataStoreReference")&&(n=u1(f5,{x:-6,y:-6},t)),n},fp.prototype.updateOutline=function(e,t){if(!it(e))return ot(e,["bpmn:SubProcess","bpmn:Group"])?(Ce(t,{width:e.width+Oi*2,height:e.height+Oi*2}),!0):!!ot(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function p1(e,t){var n;return t==="bpmn:DataObjectReference"?n=d5:t==="bpmn:DataStoreReference"&&(n=h5),e.width===n.width&&e.height===n.height}const g5={__depends__:[dg],__init__:["outlineProvider"],outlineProvider:["type",fp]};var m5='<?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){Sa.call(this,e)}Te(so,Sa),so.Viewer=fr,so.NavigatedViewer=ic,so.prototype.createDiagram=function(){return this.importXML(m5)},so.prototype._interactionModules=[S_,C_,P_],so.prototype._modelingModules=[vB,_u,EB,wB,BB,cg,zB,dN,Jx,eu,yN,xN,BN,$N,FN,VN,n$,s$,Ph,h$,_$,D$,I$,RE,a5,u5,g5],so.prototype._modules=[].concat(fr.prototype._modules,so.prototype._interactionModules,so.prototype._modelingModules);var dp=50,y5=new Fr,f1={min:.2,max:4},v5=10,b5=.1,x5=250,w5=100,_5=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=y5.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||gp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=hp({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);Sg(p,r._canvas),r._update()}function s(u){return function(f){var d=Rg(f);(!r._state._svgClientRect||gp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(d);var g=hp({x:d.x-r._state._svgClientRect.left,y:d.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),h=i.viewbox(),m=S5(g,h),w=r._viewportDom.getBoundingClientRect(),y={x:d.x-w.left+1,y:d.y-w.top+1};q(r._state,{cachedViewbox:h,initialDragPosition:{x:d.x,y:d.y},isDragging:!0,offsetViewport:m,offsetViewportDom:y,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),je.bind(document,"mousemove",c),je.bind(document,"mouseup",l)}}function c(u){var p=Rg(u);if(r._state.isDragging){(!r._state._svgClientRect||gp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var f=r._state.offsetViewportDom,d=r._state.viewportClientRect,g=r._state.parentClientRect;q(r._viewportDom.style,{top:p.y-f.y-g.top+"px",left:p.x-f.x-g.left+"px"});var h=h1(g,{top:p.y-f.y-g.top,left:p.x-f.x-g.left,width:d.width,height:d.height});q(r._overlay.style,{clipPath:h});var m=hp({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);Sg({x:m.x-r._state.offsetViewport.x,y:m.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=Rg(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),q(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),je.unbind(document,"mousemove",c),je.unbind(document,"mouseup",l))}je.bind(this._viewportDom,"mousedown",s(!1)),je.bind(this._svg,"mousedown",s(!0)),je.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||gp(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))*T5(u.deltaY)*-p;if(r._state.zoomDelta+=f,Math.abs(r._state.zoomDelta)>b5){var d=f>0?1:-1,g=Math.log(i.zoom())/Math.log(10),h=k5(f1,v5*2),m=Math.round(g/h)*h;m+=h*d;var w=Math.pow(10,m);i.zoom(O5(f1,w),y),r._state.zoomDelta=0;var y=hp({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);Sg(y,r._canvas),r._update()}}}),je.bind(this._toggle,"click",function(u){u.preventDefault(),u.stopPropagation(),r.toggle()}),n.on(["shape.added","connection.added"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._addElement(u.element),r._scheduleUpdate()}),n.on(["shape.removed","connection.removed"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._removeElement(u.element),r._scheduleUpdate()}),n.on("elements.changed",x5,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");Mt(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");Mt(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");Mt(o).add("map"),n.appendChild(o);var r=this._svg=Be("svg");Ce(r,{width:"100%",height:"100%"}),Xe(o,r);var a=this._elementsGroup=Be("g");Xe(r,a);var s=this._viewportGroup=Be("g");Xe(r,s);var c=this._viewport=Be("rect");ut(c).add("viewport"),Xe(s,c),je.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");Mt(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");Mt(u).add("overlay"),this._parent.appendChild(u)},Bn.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=qe(this._config.debounceDelay)?this._config.debounceDelay:w5,n=qe(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:_5,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(g1(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-dp,o=o-dp,r=r+dp*2,a=a+dp*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};q(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var f=h1(l,p);q(this._overlay.style,{clipPath:f})}}},Bn.prototype.open=function(){q(this._state,{isOpen:!0}),Mt(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};Rn(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Bn.prototype.close=function(){q(this._state,{isOpen:!1}),Mt(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};Rn(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=Ct("#"+Gr(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},Bn.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},Bn.prototype._addElement=function(e){var t=this;if(this._removeElement(e),!!this.isOnActivePlane(e)&&!e.hidden){var n,i,o,r=this._createElement(e),a=Ct("#"+Gr(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=C5(e);return s!==-1?a?M5(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),E5(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}}},Bn.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&an(t)},Bn.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=Zo(t),n)){var i=D5(Of(n));return Ce(i,{id:this._prefixId(e.id)}),i}},Bn.prototype._clear=function(){vs(this._elementsGroup)},Bn.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function E5(e){return e.waypoints}function S5(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 hp(e,t,n){var i=t.getBoundingClientRect(),o=R5(n,i.width/i.height),r=d1(e.x,0,i.width,o.x,o.x+o.width),a=d1(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function Sg(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 R5(e,t){var n=e.width/e.height,i=q({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var o=i.width*(1/t),r=i.y-(o-i.height)/2;q(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;q(i,{x:s,width:a})}return i}function d1(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 M5(e,t,n){var i=A5(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function A5(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function gp(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 T5=Math.sign||function(e){return e>=0?1:-1};function k5(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 O5(e,t){return Math.max(e.min,Math.min(e.max,t))}function h1(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 g1(e){return No(e,function(t){return mn(t)?g1(t):qe(t)&&isFinite(t)})}function Rg(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function D5(e){return ys("[id]",e).forEach(function(t){t.remove()}),e}var L5={__init__:["minimap"],minimap:["type",Bn]};const m1={closed:"미니맵",open:"접기"};class y1{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(Bh,()=>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?m1.open:m1.closed)}}Fn(y1,"$inject",["eventBus","minimap","canvas"]);const I5={__depends__:[L5],__init__:["minimapI18n"],minimapI18n:["type",y1]},B5=be.defineComponent({__name:"BpmnModelerView",props:{xml:{},labelFontFamily:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=be.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=Jp(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 be.onMounted(async()=>{a=new so({container:r.value,moddleExtensions:$c,additionalModules:[h_,I5,e_,i_],...i.labelFontFamily?{textRenderer:{defaultStyle:{fontFamily:i.labelFontFamily}}}:{}}),i.xml&&await s(i.xml),o("ready")}),be.watch(()=>i.xml,l=>{l&&a&&s(l)}),be.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(be.openBlock(),be.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),Cg=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},N5=Cg(B5,[["__scopeId","data-v-17ae2a23"]]),$5=["title","aria-expanded"],F5=["title","onClick"],j5={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},H5={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},z5={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},G5={key:0,class:"bwl-validation__body"},V5={key:0,class:"bwl-validation__empty"},W5={key:1,class:"bwl-validation__empty"},U5={key:2,class:"bwl-validation__list"},q5=["onClick"],Y5={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},K5={class:"bwl-validation__msg"},X5=["title"],Z5=Cg(be.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=be.computed(()=>c_(n.issues.value,n.describeElement)),o=be.computed(()=>l_(i.value)),r=g=>Ha(g,n.changeScope.value),a=be.computed(()=>Ih(i.value,n.changeScope.value)),s=be.ref({error:!0,warning:!0,info:!0}),c=be.computed(()=>u_(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=be.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)=>(be.openBlock(),be.createElementBlock("section",{class:be.normalizeClass(["bwl-validation",{"is-open":l.value}])},[be.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=m=>l.value=!l.value)},[be.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(be.openBlock(),be.createElementBlock("svg",{class:be.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[be.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=be.createElementVNode("span",null,"검증",-1))],8,$5),be.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=be.withModifiers(()=>{},["stop"]))},[(be.openBlock(),be.createElementBlock(be.Fragment,null,be.renderList(u,m=>be.createElementVNode("button",{key:m,type:"button",class:be.normalizeClass(["bwl-validation__count",[`is-${m}`,{"is-off":!s.value[m]}]]),title:l.value?`${p[m]} ${s.value[m]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:w=>f(m)},[(be.openBlock(),be.createElementBlock("svg",j5,[h[4]||(h[4]=be.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),m==="error"?(be.openBlock(),be.createElementBlock("path",H5)):(be.openBlock(),be.createElementBlock("path",z5))])),be.createElementVNode("span",null,be.toDisplayString(o.value[m]),1)],10,F5)),64))])]),l.value?(be.openBlock(),be.createElementBlock("div",G5,[i.value.length===0?(be.openBlock(),be.createElementBlock("p",V5,"발견된 문제가 없습니다.")):c.value.length===0?(be.openBlock(),be.createElementBlock("p",W5," 선택한 심각도에 해당하는 항목이 없습니다. ")):(be.openBlock(),be.createElementBlock("ul",U5,[(be.openBlock(!0),be.createElementBlock(be.Fragment,null,be.renderList(c.value,m=>(be.openBlock(),be.createElementBlock("li",{key:m.key,class:be.normalizeClass(["bwl-validation__item",[`is-${m.severity}`,{"is-clickable":m.targetRefs.length>0}]]),onClick:w=>d(m)},[h[5]||(h[5]=be.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(m)?(be.openBlock(),be.createElementBlock("span",Y5,"이번 변경")):be.createCommentVNode("",!0),be.createElementVNode("span",K5,be.toDisplayString(m.message),1),be.createElementVNode("span",{class:"bwl-validation__cat",title:m.code},be.toDisplayString(m.category),9,X5)],10,q5))),128))]))])):be.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),Q5={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},J5=["aria-checked","title","data-locale","onClick"],e3={class:"bwl-locale__label"},t3={key:0,class:"bwl-locale__badge"},n3=Cg(be.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=be.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?(be.openBlock(),be.createElementBlock("div",Q5,[(be.openBlock(!0),be.createElementBlock(be.Fragment,null,be.renderList(o.value,s=>(be.openBlock(),be.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:be.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=>be.unref(n).setDisplayLocale(s.locale)},[be.createElementVNode("span",e3,be.toDisplayString(s.label),1),s.pending>0?(be.openBlock(),be.createElementBlock("span",t3,be.toDisplayString(s.pending),1)):be.createCommentVNode("",!0)],10,J5))),128))])):be.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);J.ADDABLE_FLOW_NODE_TYPES=Rc,J.APPLY_BPMN_OPS_SCHEMA=US,J.BPMN_EVENT_DEFINITION_TYPES=Mc,J.BPMN_MODDLE_EXTENSIONS=$c,J.BWL_MODDLE_SCHEMA=zg,J.BWL_NS=Hg,J.BWL_PREFIX=Mp,J.BWL_REVIEW_REQUEST_TYPE=Pc,J.BWL_SIDES=Ap,J.BpmnDisplayLocaleSwitcher=n3,J.BpmnModelerView=N5,J.BpmnValidationPanel=Z5,J.EDITOR=hA,J.FLOW_LABEL_INDENT=_m,J.GROUP_BORDER_MIN_RUN=ef,J.GROUP_BORDER_NEAR=ha,J.HEADLESS_BPMN_MODULES=o_,J.HEADLESS_TEXT_METRICS=fa,J.I18N_DISPLAY_REDRAWN_EVENT=Bh,J.I18N_NS=AS,J.I18N_PREFIX=qg,J.I18N_REVIEW_REQUESTED_CLASS=f_,J.I18N_TRANSLATION_TYPE=Rr,J.I18N_UNTRANSLATED_CLASS=p_,J.I18nDisplay=Nh,J.I18nDisplayModule=h_,J.IR_EVENT_DEFINITIONS=Cc,J.IR_FLOW_NODE_TYPES=Er,J.IR_TEXT_LOCALES=Ac,J.LABEL_FORK_MARGIN=of,J.LABEL_SHAPE_MIN_DEPTH=Lm,J.SET_TRANSLATIONS_COMMAND=Bp,J.SEVERITY_ORDER=Lh,J.SYMBOLIC_OP_KINDS=Yg,J.SYMBOLIC_OP_SCHEMA=Kg,J.SetTranslationsHandler=Np,J.TranslationCommands=Fp,J.TranslationCommandsModule=jp,J.TranslationStateIndex=wA,J.UNDO_EPISODE_COMMAND=Pp,J.UPDATE_TRANSLATION_COMMAND=Oc,J.UpdateTranslationHandler=Ip,J.applyBpmnOpBatch=$y,J.applyBpmnOps=Ty,J.applyLocaleBackfill=xA,J.applyTranslationLocaleRestore=CA,J.approximateTextWidth=da,J.auditBpmnGeometry=Nm,J.auditBpmnGeometryXml=zC,J.auditBpmnSemantics=Rf,J.auditBpmnSemanticsXml=nA,J.auditGeometry=ft,J.auditTargetsOf=zn,J.axisSegmentsOf=rn,J.blackBoxNameRect=tf,J.buildBpmnOpBatch=uA,J.buildRegistryIndex=Fm,J.collectTranslationStates=Wy,J.containerBoundarySegments=ma,J.countBySeverity=l_,J.createBpmnEditorController=gA,J.createBpmnModdle=hm,J.createHeadlessBpmnModeler=YL,J.crossedShapesOf=Gt,J.crossingCost=hi,J.describeProcess=Ly,J.describeProcessXml=XM,J.diffBpmnElements=Ny,J.diffBpmnElementsXml=cA,J.documentLocalesOf=as,J.edgeCrossCount=ps,J.edgeCrossingPairsOf=mo,J.edgeCrossingStatsOf=Pm,J.executeAsUndoEpisode=Vg,J.followMovedEdgeLabels=py,J.forwardThreePointCandidates=Wc,J.geometryFindingKey=lt,J.inferScriptLocale=sl,J.installHeadlessBpmnDom=mm,J.irEventDefinitionOf=Cp,J.isAddableFlowNodeType=Fg,J.isChangeScopeMixed=Ih,J.isEdgeOverlapFinding=nf,J.isInChangeScope=Ha,J.isIrEventDefinition=jg,J.isIrFlowNodeType=$g,J.isIrTextLocale=vS,J.labelRectsOf=Vo,J.labelShapeDepth=Im,J.labelSlot=Cr,J.lineCrossesLabel=Ni,J.lineThroughLabel=Sm,J.lineThroughShapeLabel=Dm,J.loadBpmnXml=pa,J.localeTextsOf=Lp,J.lowerOps=My,J.oppositeOverlapCount=AC,J.oppositeOverlapOf=wm,J.planBackEdgeBoundaryClearance=Qm,J.planCrossPoolRoute=qm,J.planEdgeRepair=qc,J.planLabelLineClearance=bf,J.planLabelPlacement=cy,J.planLocaleBackfill=bA,J.planMiddleSegmentShifts=Hm,J.planOppositeOverlapRepair=ty,J.planSegmentDetours=Vc,J.planShapeLabelClearance=hy,J.planTranslationLocaleRestore=RA,J.poolOverlapsOf=sf,J.redockIntroducedDetachedEndpoints=my,J.repairIntroducedBoundaryHugging=Jm,J.repairIntroducedCrossings=uf,J.repairIntroducedEdgeCrossings=zm,J.repairIntroducedFakeMerges=iy,J.repairIntroducedLabelLines=fy,J.repairIntroducedOppositeOverlaps=sy,J.repairIntroducedShapeLabelLines=gy,J.repairIntroducedSharedSegmentLabels=dy,J.rerouteIntroducedCrossPoolEdges=Ym,J.resolverServicesOf=wy,J.reviewRequestValuesOf=$p,J.reviewRequestsOf=jo,J.rootLangOf=Dp,J.saveBpmnXml=mC,J.sceneCrossingCost=Am,J.sceneFromDefinitions=Bm,J.sceneFromRegistry=Ge,J.segmentShapeClearance=ya,J.shapesUnderLabel=fs,J.sharedEndpointCrossingPairsOf=$i,J.sharedSegmentUnderLabel=Gc,J.sharedSpansOf=zc,J.sortPanelIssues=u_,J.toPanelIssues=c_,J.touchedElements=lA,J.translationLocale=Sn,J.translationsOf=Fo,J.unreadableOverlapCount=di,J.unreadableOverlapOf=Tr,J.validateOps=xy,J.warningMessages=Jp,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})}));
|