index-15b0df12.js 529 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. var q2=Object.defineProperty,K2=Object.defineProperties;var Y2=Object.getOwnPropertyDescriptors;var qs=Object.getOwnPropertySymbols;var Yy=Object.prototype.hasOwnProperty,Xy=Object.prototype.propertyIsEnumerable;var nu=(Be,ze,Le)=>ze in Be?q2(Be,ze,{enumerable:!0,configurable:!0,writable:!0,value:Le}):Be[ze]=Le,Ce=(Be,ze)=>{for(var Le in ze||(ze={}))Yy.call(ze,Le)&&nu(Be,Le,ze[Le]);if(qs)for(var Le of qs(ze))Xy.call(ze,Le)&&nu(Be,Le,ze[Le]);return Be},Pn=(Be,ze)=>K2(Be,Y2(ze));var Zy=(Be,ze)=>{var Le={};for(var q in Be)Yy.call(Be,q)&&ze.indexOf(q)<0&&(Le[q]=Be[q]);if(Be!=null&&qs)for(var q of qs(Be))ze.indexOf(q)<0&&Xy.call(Be,q)&&(Le[q]=Be[q]);return Le};var Qy=(Be,ze,Le)=>(nu(Be,typeof ze!="symbol"?ze+"":ze,Le),Le);var Ui=(Be,ze,Le)=>new Promise((q,Lo)=>{var Zs=An=>{try{Er(Le.next(An))}catch(wr){Lo(wr)}},Vt=An=>{try{Er(Le.throw(An))}catch(wr){Lo(wr)}},Er=An=>An.done?q(An.value):Promise.resolve(An.value).then(Zs,Vt);Er((Le=Le.apply(Be,ze)).next())});import{bX as Ks,a4 as Jy,__tla as X2}from"./index-b5895273.js";import{i as ie,a as le,f as k,b as ce,c as ye,d as rt,g as No,e as N,h as Ys,r as Gt,j as Oo,k as pn,s as ln,l as eg,m as Ct,n as pt,o as Mt,p as Z2,q as un,t as tg,u as kn,v as bt,w as Tn,x as hn,y as ot,z as Xs,A as iu,B as ng,C as Q2,D as J2,E as ru,F as ek,G as tk}from"./index.esm-5037906b.js";import{y as nk,l as at,q as ig}from"./preact.module-8c2bd209.js";let jo,ik=Promise.all([(()=>{try{return X2}catch(Be){}})()]).then(()=>Ui(void 0,null,function*(){var Be={exports:{}};typeof Object.create=="function"?Be.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Be.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}};var ze=Be.exports;const Le=Ks(ze);function q(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function Lo(e,t){return t={exports:{}},e(t,t.exports),t.exports}var Zs=Lo(function(e){var t=e.exports=function(n,i){if(i||(i=16),n===void 0&&(n=128),n<=0)return"0";for(var r=Math.log(Math.pow(2,n))/Math.log(i),o=2;r===1/0;o*=2)r=Math.log(Math.pow(2,n/o))/Math.log(i)*o;for(var a=r-Math.floor(r),s="",o=0;o<Math.floor(r);o++){var c=Math.floor(Math.random()*i).toString(i);s=c+s}if(a){var p=Math.pow(i,a),c=Math.floor(Math.random()*p).toString(i);s=c+s}var l=parseInt(s,i);return l!==1/0&&l>=Math.pow(2,n)?t(n,i):s};t.rack=function(n,i,r){var o=function(s){var c=0;do{if(c++>10)if(r)n+=r;else throw new Error("too many ID collisions, use more bits");var p=t(n,i)}while(Object.hasOwnProperty.call(a,p));return a[p]=s,p},a=o.hats={};return o.get=function(s){return o.hats[s]},o.set=function(s,c){return o.hats[s]=c,o},o.bits=n||128,o.base=i||16,o}});function Vt(e){if(!(this instanceof Vt))return new Vt(e);e=e||[128,36,1],this._seed=e.length?Zs.rack(e[0],e[1],e[2]):e}Vt.prototype.next=function(e){return this._seed(e||!0)},Vt.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Vt.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Vt.prototype.assigned=function(e){return this._seed.get(e)||!1},Vt.prototype.unclaim=function(e){delete this._seed.hats[e]},Vt.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};function Er(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}const An=Object.prototype.toString,wr=Object.prototype.hasOwnProperty;function rg(e){return e===void 0}function og(e){return An.call(e)==="[object Array]"}function ag(e,t){return wr.call(e,t)}function ou(e,t){let n,i;if(rg(e))return;const r=og(e)?cg:sg;for(let o in e)if(ag(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function sg(e){return e}function cg(e){return Number(e)}function st(e,...t){const n=e.style;return ou(t,function(i){i&&ou(i,function(r,o){n[o]=r})}),e}function ft(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const pg=Object.prototype.toString;function Je(e){return new Yn(e)}function Yn(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Yn.prototype.add=function(e){return this.list.add(e),this},Yn.prototype.remove=function(e){return pg.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Yn.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},Yn.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Yn.prototype.array=function(){return Array.from(this.list)},Yn.prototype.has=Yn.prototype.contains=function(e){return this.list.contains(e)};function Io(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e}function Sr(e,t){return e&&typeof e.matches=="function"&&e.matches(t)}function Mn(e,t,n){for(var i=n?e:e.parentNode;i&&i.nodeType!==document.DOCUMENT_NODE&&i.nodeType!==document.DOCUMENT_FRAGMENT_NODE;){if(Sr(i,t))return i;i=i.parentNode}return Sr(i,t)?i:null}var $o={},zo,Qs,Js;function au(){zo=window.addEventListener?"addEventListener":"attachEvent",Qs=window.removeEventListener?"removeEventListener":"detachEvent",Js=zo!=="addEventListener"?"on":""}var lg=$o.bind=function(e,t,n,i){return zo||au(),e[zo](Js+t,n,i||!1),n},ug=$o.unbind=function(e,t,n,i){return Qs||au(),e[Qs](Js+t,n,i||!1),n},J=Er({__proto__:null,bind:lg,unbind:ug,default:$o},[$o]),su=["focus","blur"];function hg(e,t,n,i,r){return su.indexOf(n)!==-1&&(r=!0),J.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Mn(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function dg(e,t,n,i){return su.indexOf(t)!==-1&&(i=!0),J.unbind(e,t,n,i)}var Rt={bind:hg,unbind:dg},fg=mg,cu=!1,Fo;typeof document<"u"&&(Fo=document.createElement("div"),Fo.innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',cu=!Fo.getElementsByTagName("link").length,Fo=void 0);var Xe={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:cu?[1,"X<div>","</div>"]:[0,"",""]};Xe.td=Xe.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Xe.option=Xe.optgroup=[1,'<select multiple="multiple">',"</select>"],Xe.thead=Xe.tbody=Xe.colgroup=Xe.caption=Xe.tfoot=[1,"<table>","</table>"],Xe.polyline=Xe.ellipse=Xe.polygon=Xe.circle=Xe.text=Xe.line=Xe.path=Xe.rect=Xe.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function mg(e,t){if(typeof e!="string")throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var i=n[1];if(i=="body"){var c=t.createElement("html");return c.innerHTML=e,c.removeChild(c.lastChild)}var r=Object.prototype.hasOwnProperty.call(Xe,i)?Xe[i]:Xe._default,o=r[0],a=r[1],s=r[2],c=t.createElement("div");for(c.innerHTML=a+e+s;o--;)c=c.lastChild;if(c.firstChild==c.lastChild)return c.removeChild(c.firstChild);for(var p=t.createDocumentFragment();c.firstChild;)p.appendChild(c.removeChild(c.firstChild));return p}var Me=fg;function Ae(e,t){return t=t||document,t.querySelector(e)}function ec(e,t){return t=t||document,t.querySelectorAll(e)}function dn(e){e.parentNode&&e.parentNode.removeChild(e)}function vg(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch(n){}return e}function pu(e,t){return t.appendChild(vg(e,t))}function ee(e,t){return pu(t,e),e}var tc=2,lu={"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":tc,"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":tc,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function yg(e,t){return lu[t]?e.style[t]:e.getAttributeNS(null,t)}function uu(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=lu[i];r?(r===tc&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function gg(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)uu(e,r,t[r])}function Y(e,t,n){if(typeof t=="string")if(n!==void 0)uu(e,t,n);else return yg(e,t);else gg(e,t);return e}const bg=Object.prototype.toString;function he(e){return new Xn(e)}function Xn(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Xn.prototype.add=function(e){return this.list.add(e),this},Xn.prototype.remove=function(e){return bg.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Xn.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},Xn.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Xn.prototype.array=function(){return Array.from(this.list)},Xn.prototype.has=Xn.prototype.contains=function(e){return this.list.contains(e)};function Fe(e){var t=e.parentNode;return t&&t.removeChild(e),e}function Ho(e){for(var t;t=e.firstChild;)Fe(t);return e}function hu(e){return e.cloneNode(!0)}var nc={svg:"http://www.w3.org/2000/svg"},du='<svg xmlns="'+nc.svg+'"';function fu(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(nc.svg)===-1&&(e=du+e.substring(4)):(e=du+">"+e+"</svg>",t=!0);var n=xg(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function xg(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Z(e,t){var n;return e.charAt(0)==="<"?(n=fu(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(nc.svg,e),t&&Y(n,t),n}var ic=null;function rc(){return ic===null&&(ic=Z("svg")),ic}function mu(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function _g(e,t,n,i,r,o){var a=rc().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return mu(a,e);case 6:return mu(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Cr(e){return e?rc().createSVGTransformFromMatrix(e):rc().createSVGTransform()}var vu=/([&<>]{1})/g,Eg=/([\n\r"]{1})/g,wg={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function oc(e,t){function n(i,r){return wg[r]||r}return e.replace(t,n)}function yu(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(oc(e.textContent,vu));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(r=e.attributes,n=0,i=r.length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',oc(o.value,Eg),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)yu(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",oc(e.nodeValue,vu),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function Sg(e,t){var n=fu(t);if(Ho(e),!!t){Rg(n)||(n=n.documentElement);for(var i=Pg(n.childNodes),r=0;r<i.length;r++)pu(i[r],e)}}function Cg(e){for(var t=e.firstChild,n=[];t;)yu(t,n),t=t.nextSibling;return n.join("")}function Rg(e){return e.nodeName==="#document-fragment"}function gu(e,t){if(t!==void 0){try{Sg(e,t)}catch(n){throw new Error("error parsing SVG: "+n.message)}return e}else return Cg(e)}function Pg(e){return Array.prototype.slice.call(e)}function kg(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function Tg(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(kg(e,i))}function Rr(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),Tg(n,t)),n.consolidate()}const Ag=/^class[ {]/;function Mg(e){return Ag.test(e.toString())}function ac(e){return Array.isArray(e)}function sc(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Go(...e){e.length===1&&ac(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const Dg=/constructor\s*[^(]*\(\s*([^)]*)\)/m,Bg=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,Ng=/\/\*([^*]*)\*\//m;function Og(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(Mg(e)?Dg:Bg);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(Ng);return(r&&r[1]||i).trim()})||[]}function bu(e,t){t=t||{get:function(E,_){if(n.push(E),_===!1)return null;throw a(`No provider for "${E}"!`)}};const n=[],i=this._providers=Object.create(t._providers||null),r=this._instances=Object.create(null),o=r.injector=this,a=function(E){const _=n.join(" -> ");return n.length=0,new Error(_?`${E} (Resolving: ${_})`:E)};function s(E,_){if(!i[E]&&E.indexOf(".")!==-1){const x=E.split(".");let S=s(x.shift());for(;x.length;)S=S[x.shift()];return S}if(sc(r,E))return r[E];if(sc(i,E)){if(n.indexOf(E)!==-1)throw n.push(E),a("Cannot resolve circular dependency!");return n.push(E),r[E]=i[E][0](i[E][1]),n.pop(),r[E]}return t.get(E,_)}function c(E,_){if(typeof _>"u"&&(_={}),typeof E!="function")if(ac(E))E=Go(E.slice());else throw a(`Cannot invoke "${E}". Expected a function!`);const x=(E.$inject||Og(E)).map(S=>sc(_,S)?_[S]:s(S));return{fn:E,dependencies:x}}function p(E){const{fn:_,dependencies:x}=c(E),S=Function.prototype.bind.apply(_,[null].concat(x));return new S}function l(E,_,x){const{fn:S,dependencies:M}=c(E,x);return S.apply(_,M)}function u(E){return Go(_=>E.get(_))}function h(E,_){if(_&&_.length){const x=Object.create(null),S=Object.create(null),M=[],j=[],B=[];let D,$,z,F;for(let U in i)D=i[U],_.indexOf(U)!==-1&&(D[2]==="private"?($=M.indexOf(D[3]),$===-1?(z=D[3].createChild([],_),F=u(z),M.push(D[3]),j.push(z),B.push(F),x[U]=[F,U,"private",z]):x[U]=[B[$],U,"private",j[$]]):x[U]=[D[2],D[1]],S[U]=!0),(D[2]==="factory"||D[2]==="type")&&D[1].$scope&&_.forEach(ue=>{D[1].$scope.indexOf(ue)!==-1&&(x[U]=[D[2],D[1]],S[ue]=!0)});_.forEach(U=>{if(!S[U])throw new Error('No provider for "'+U+'". Cannot use provider from the parent!')}),E.unshift(x)}return new bu(E,o)}const d={factory:l,type:p,value:function(E){return E}};function f(E,_){const x=E.__init__||[];return function(){x.forEach(S=>{typeof S=="string"?_.get(S):_.invoke(S)})}}function v(E){const _=E.__exports__;if(_){const x=E.__modules__,S=Object.keys(E).reduce(($,z)=>(z!=="__exports__"&&z!=="__modules__"&&z!=="__init__"&&z!=="__depends__"&&($[z]=E[z]),$),Object.create(null)),M=(x||[]).concat(S),j=h(M),B=Go(function($){return j.get($)});_.forEach(function($){i[$]=[B,$,"private",j]});const D=(E.__init__||[]).slice();return D.unshift(function(){j.init()}),E=Object.assign({},E,{__init__:D}),f(E,j)}return Object.keys(E).forEach(function(x){if(x==="__init__"||x==="__depends__")return;if(E[x][2]==="private"){i[x]=E[x];return}const S=E[x][0],M=E[x][1];i[x]=[d[S],jg(S,M),S]}),f(E,o)}function g(E,_){return E.indexOf(_)!==-1||(E=(_.__depends__||[]).reduce(g,E),E.indexOf(_)!==-1)?E:E.concat(_)}function R(E){const _=E.reduce(g,[]).map(v);let x=!1;return function(){x||(x=!0,_.forEach(S=>S()))}}this.get=s,this.invoke=l,this.instantiate=p,this.createChild=h,this.init=R(e)}function jg(e,t){return e!=="value"&&ac(t)&&(t=Go(t.slice())),t}var Lg=1e3;function fn(e,t){var n=this;t=t||Lg,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}fn.prototype.canRender=function(e){},fn.prototype.drawShape=function(e,t){},fn.prototype.drawConnection=function(e,t){},fn.prototype.getShapePath=function(e){},fn.prototype.getConnectionPath=function(e){};function wi(e){return e.flat().join(",").replace(/,?([A-z]),?/g,"$1")}function Ig(e){return["M",e.x,e.y]}function cc(e){return["L",e.x,e.y]}function $g(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function zg(e,t){const n=e.length,i=[Ig(e[0])];for(let r=1;r<n;r++){const o=e[r-1],a=e[r],s=e[r+1];if(!s||!t){i.push(cc(a));continue}const c=Math.min(t,pc(a.x-o.x,a.y-o.y),pc(s.x-a.x,s.y-a.y));if(!c){i.push(cc(a));continue}const p=Vo(a,o,c),l=Vo(a,o,c*.5),u=Vo(a,s,c),h=Vo(a,s,c*.5);i.push(cc(p)),i.push($g(l,h,u))}return i}function Vo(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=pc(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function pc(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Wo(e,t,n){ie(t)&&(n=t,t=null),t||(t={});const i=Z("path",t);return ie(n)&&(i.dataset.cornerRadius=String(n)),xu(i,e)}function xu(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Y(e,{d:wi(zg(t,n))}),e}function Uo(e){return ce(e,function(t){return!ye(e,function(n){return n!==t&&_u(t,n)})})}function _u(e,t){if(t){if(e===t)return t;if(e.parent)return _u(e.parent,t)}}function Eu(e,t,n){var i=!n||e.indexOf(t)===-1;return i&&e.push(t),i}function Si(e,t,n){n=n||0,le(e)||(e=[e]),k(e,function(i,r){var o=t(i,r,n);le(o)&&o.length&&Si(o,t,n+1)})}function Fg(e,t,n){var i=[],r=[];return Si(e,function(o,a,s){Eu(i,o,t);var c=o.children;if((n===-1||s<n)&&c&&Eu(r,c,t))return c}),i}function Pr(e,t){return Fg(e,!t,-1)}function Hg(e,t,n){Ys(t)&&(t=!0),rt(t)&&(n=t,t=!0),n=n||{};var i=kr(n.allShapes),r=kr(n.allConnections),o=kr(n.enclosedElements),a=kr(n.enclosedConnections),s=kr(n.topLevel,t&&No(e,function(l){return l.id}));function c(l){s[l.source.id]&&s[l.target.id]&&(s[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function p(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,k(l.incoming,c),k(l.outgoing,c),l.children}return Si(e,p),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Ve(e,t){t=!!t,le(e)||(e=[e]);var n,i,r,o;return k(e,function(a){var s=a;a.waypoints&&!t&&(s=Ve(a.waypoints,!0));var c=s.x,p=s.y,l=s.height||0,u=s.width||0;(c<n||n===void 0)&&(n=c),(p<i||i===void 0)&&(i=p),(c+u>r||r===void 0)&&(r=c+u),(p+l>o||o===void 0)&&(o=p+l)}),{x:n,y:i,height:o-i,width:r-n}}function Gg(e,t){var n={};return k(e,function(i){var r=i;r.waypoints&&(r=Ve(r)),!ie(t.y)&&r.x>t.x&&(n[i.id]=i),!ie(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(ie(t.width)&&ie(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!ie(t.width)||!ie(t.height))&&(n[i.id]=i)}),n}function wu(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Su(e){return!!(e&&e.isFrame)}function kr(e,t){return N({},e||{},t||{})}var Vg=1;function Zn(e,t){fn.call(this,e,Vg),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})}q(Zn,fn),Zn.prototype.canRender=function(){return!0},Zn.prototype.drawShape=function(e,t,n){var i=Z("rect");return Y(i,{x:0,y:0,width:t.width||0,height:t.height||0}),Su(t)?Y(i,N({},this.FRAME_STYLE,n||{})):Y(i,N({},this.SHAPE_STYLE,n||{})),ee(e,i),i},Zn.prototype.drawConnection=function(e,t,n){var i=Wo(t.waypoints,N({},this.CONNECTION_STYLE,n||{}));return ee(e,i),i},Zn.prototype.getShapePath=function(e){var t=e.x,n=e.y,i=e.width,r=e.height,o=[["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]];return wi(o)},Zn.prototype.getConnectionPath=function(e){var t=e.waypoints,n,i,r=[];for(n=0;i=t[n];n++)i=i.original||i,r.push([n===0?"M":"L",i.x,i.y]);return wi(r)},Zn.$inject=["eventBus","styles"];function Wg(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return N(o,{class:n})},this.style=function(n,i){!le(n)&&!i&&(i=n,n=[]);var r=Gt(n,function(o,a){return N(o,e[a]||{})},{});return i?N(r,i):r},this.computeStyle=function(n,i,r){return le(i)||(r=i,i=[]),t.style(i||[],N({},r,n||{}))}}const Ug={__init__:["defaultRenderer"],defaultRenderer:["type",Zn],styles:["type",Wg]};function We(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Ze(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 lc(e,t){return!e||!t?-1:e.indexOf(t)}function Tr(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function uc(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=Tr(e,t);return Math.abs(r/o)<=i}var qg=2;function Dn(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(Kg(r,n))return o;return!1}function Kg(e,t){const n=t[0];return Oo(t,function(i){return Math.abs(n[e]-i[e])<=qg})}function Cu(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 hc(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Yg=/,?([a-z]),?/gi,Ru=parseFloat,Ue=Math,Qn=Ue.PI,mn=Ue.min,vn=Ue.max,Pu=Ue.pow,Jn=Ue.abs,Xg=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,Zg=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,qo=Array.isArray||function(e){return e instanceof Array};function dc(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ar(e){if(typeof e=="function"||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)dc(e,n)&&(t[n]=Ar(e[n]));return t}function Qg(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 Jg(e){function t(){var n=Array.prototype.slice.call(arguments,0),i=n.join("\u2400"),r=t.cache=t.cache||{},o=t.count=t.count||[];return dc(r,i)?(Qg(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e.apply(0,n),r[i])}return t}function e0(e){if(!e)return null;var t=qi(e);if(t.arr)return Ar(t.arr);var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},i=[];return qo(e)&&qo(e[0])&&(i=Ar(e)),i.length||String(e).replace(Xg,function(r,o,a){var s=[],c=o.toLowerCase();for(a.replace(Zg,function(p,l){l&&s.push(+l)}),c=="m"&&s.length>2&&(i.push([o].concat(s.splice(0,2))),c="l",o=o=="m"?"l":"L");s.length>=n[c]&&(i.push([o].concat(s.splice(0,n[c]))),!!n[c]););}),i.toString=qi.toString,t.arr=Ar(i),i}function qi(e){var t=qi.ps=qi.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout(function(){for(var n in t)dc(t,n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])}),t[e]}function fc(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 ku(){return this.join(",").replace(Yg,"$1")}function Ko(e){var t=Ar(e);return t.toString=ku,t}function Tu(e,t,n,i,r,o,a,s,c){var p=1-c,l=Pu(p,3),u=Pu(p,2),h=c*c,d=h*c,f=l*e+u*3*c*n+p*3*c*c*r+d*a,v=l*t+u*3*c*i+p*3*c*c*o+d*s;return{x:Yo(f),y:Yo(v)}}function Au(e){var t=a0.apply(null,e);return fc(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function ei(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function t0(e,t){return e=fc(e),t=fc(t),ei(t,e.x,e.y)||ei(t,e.x2,e.y)||ei(t,e.x,e.y2)||ei(t,e.x2,e.y2)||ei(e,t.x,t.y)||ei(e,t.x2,t.y)||ei(e,t.x,t.y2)||ei(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 Mu(e,t,n,i,r){var o=-3*t+9*n-9*i+3*r,a=e*o+6*t-12*n+6*i;return e*a-3*t+3*n}function Du(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var p=c/2,l=12,u=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],h=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,f=0;f<l;f++){var v=p*u[f]+p,g=Mu(v,e,n,r,a),R=Mu(v,t,i,o,s),E=g*g+R*R;d+=h[f]*Ue.sqrt(E)}return p*d}function n0(e,t,n,i,r,o,a,s){if(!(vn(e,n)<mn(r,a)||mn(e,n)>vn(r,a)||vn(t,i)<mn(o,s)||mn(t,i)>vn(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),p=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var u=Yo(c/l),h=Yo(p/l),d=+u.toFixed(2),f=+h.toFixed(2);if(!(d<+mn(e,n).toFixed(2)||d>+vn(e,n).toFixed(2)||d<+mn(r,a).toFixed(2)||d>+vn(r,a).toFixed(2)||f<+mn(t,i).toFixed(2)||f>+vn(t,i).toFixed(2)||f<+mn(o,s).toFixed(2)||f>+vn(o,s).toFixed(2)))return{x:u,y:h}}}}function Yo(e){return Math.round(e*1e11)/1e11}function i0(e,t,n){var i=Au(e),r=Au(t);if(!t0(i,r))return n?0:[];for(var o=Du.apply(0,e),a=Du.apply(0,t),s=Bu(e)?1:~~(o/5)||1,c=Bu(t)?1:~~(a/5)||1,p=[],l=[],u={},h=n?0:[],d=0;d<s+1;d++){var f=Tu.apply(0,e.concat(d/s));p.push({x:f.x,y:f.y,t:d/s})}for(d=0;d<c+1;d++)f=Tu.apply(0,t.concat(d/c)),l.push({x:f.x,y:f.y,t:d/c});for(d=0;d<s;d++)for(var v=0;v<c;v++){var g=p[d],R=p[d+1],E=l[v],_=l[v+1],x=Jn(R.x-g.x)<.01?"y":"x",S=Jn(_.x-E.x)<.01?"y":"x",M=n0(g.x,g.y,R.x,R.y,E.x,E.y,_.x,_.y),j;if(M){if(j=M.x.toFixed(9)+"#"+M.y.toFixed(9),u[j])continue;u[j]=!0;var B=g.t+Jn((M[x]-g[x])/(R[x]-g[x]))*(R.t-g.t),D=E.t+Jn((M[S]-E[S])/(_[S]-E[S]))*(_.t-E.t);B>=0&&B<=1&&D>=0&&D<=1&&(n?h++:h.push({x:M.x,y:M.y,t1:B,t2:D}))}}return h}function r0(e,t,n){e=ju(e),t=ju(t);for(var i,r,o,a,s,c,p,l,u,h,d=n?0:[],f=0,v=e.length;f<v;f++){var g=e[f];if(g[0]=="M")i=s=g[1],r=c=g[2];else{g[0]=="C"?(u=[i,r].concat(g.slice(1)),i=u[6],r=u[7]):(u=[i,r,i,r,s,c,s,c],i=s,r=c);for(var R=0,E=t.length;R<E;R++){var _=t[R];if(_[0]=="M")o=p=_[1],a=l=_[2];else{_[0]=="C"?(h=[o,a].concat(_.slice(1)),o=h[6],a=h[7]):(h=[o,a,o,a,p,l,p,l],o=p,a=l);var x=i0(u,h,n);if(n)d+=x;else{for(var S=0,M=x.length;S<M;S++)x[S].segment1=f,x[S].segment2=R,x[S].bez1=u,x[S].bez2=h;d=d.concat(x)}}}}}return d}function o0(e){var t=qi(e);if(t.abs)return Ko(t.abs);if((!qo(e)||!qo(e&&e[0]))&&(e=e0(e)),!e||!e.length)return[["M",0,0]];var n=[],i=0,r=0,o=0,a=0,s=0,c;e[0][0]=="M"&&(i=+e[0][1],r=+e[0][2],o=i,a=r,s++,n[0]=["M",i,r]);for(var p,l,u=s,h=e.length;u<h;u++){if(n.push(p=[]),l=e[u],c=l[0],c!=c.toUpperCase())switch(p[0]=c.toUpperCase(),p[0]){case"A":p[1]=l[1],p[2]=l[2],p[3]=l[3],p[4]=l[4],p[5]=l[5],p[6]=+l[6]+i,p[7]=+l[7]+r;break;case"V":p[1]=+l[1]+r;break;case"H":p[1]=+l[1]+i;break;case"M":o=+l[1]+i,a=+l[2]+r;default:for(var d=1,f=l.length;d<f;d++)p[d]=+l[d]+(d%2?i:r)}else for(var v=0,g=l.length;v<g;v++)p[v]=l[v];switch(c=c.toUpperCase(),p[0]){case"Z":i=+o,r=+a;break;case"H":i=p[1];break;case"V":r=p[1];break;case"M":o=p[p.length-2],a=p[p.length-1];default:i=p[p.length-2],r=p[p.length-1]}}return n.toString=ku,t.abs=Ko(n),n}function Bu(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Xo(e,t,n,i){return[e,t,n,i,n,i]}function Nu(e,t,n,i,r,o){var a=.3333333333333333,s=2/3;return[a*e+s*n,a*t+s*i,a*r+s*n,a*o+s*i,r,o]}function Ou(e,t,n,i,r,o,a,s,c,p){var l=Qn*120/180,u=Qn/180*(+r||0),h=[],d,f=Jg(function(se,Se,be){var me=se*Ue.cos(be)-Se*Ue.sin(be),nt=se*Ue.sin(be)+Se*Ue.cos(be);return{x:me,y:nt}});if(p)j=p[0],B=p[1],S=p[2],M=p[3];else{d=f(e,t,-u),e=d.x,t=d.y,d=f(s,c,-u),s=d.x,c=d.y;var v=(e-s)/2,g=(t-c)/2,R=v*v/(n*n)+g*g/(i*i);R>1&&(R=Ue.sqrt(R),n=R*n,i=R*i);var E=n*n,_=i*i,x=(o==a?-1:1)*Ue.sqrt(Jn((E*_-E*g*g-_*v*v)/(E*g*g+_*v*v))),S=x*n*g/i+(e+s)/2,M=x*-i*v/n+(t+c)/2,j=Ue.asin(((t-M)/i).toFixed(9)),B=Ue.asin(((c-M)/i).toFixed(9));j=e<S?Qn-j:j,B=s<S?Qn-B:B,j<0&&(j=Qn*2+j),B<0&&(B=Qn*2+B),a&&j>B&&(j=j-Qn*2),!a&&B>j&&(B=B-Qn*2)}var D=B-j;if(Jn(D)>l){var $=B,z=s,F=c;B=j+l*(a&&B>j?1:-1),s=S+n*Ue.cos(B),c=M+i*Ue.sin(B),h=Ou(s,c,n,i,r,0,a,z,F,[B,$,S,M])}D=B-j;var U=Ue.cos(j),ue=Ue.sin(j),It=Ue.cos(B),Re=Ue.sin(B),pe=Ue.tan(D/4),wt=4/3*n*pe,C=4/3*i*pe,m=[e,t],A=[e+wt*ue,t-C*U],O=[s+wt*Re,c-C*It],T=[s,c];if(A[0]=2*m[0]-A[0],A[1]=2*m[1]-A[1],p)return[A,O,T].concat(h);h=[A,O,T].concat(h).join().split(",");for(var L=[],G=0,oe=h.length;G<oe;G++)L[G]=G%2?f(h[G-1],h[G],u).y:f(h[G],h[G+1],u).x;return L}function a0(e,t,n,i,r,o,a,s){for(var c=[],p=[[],[]],l,u,h,d,f,v,g,R,E=0;E<2;++E){if(E==0?(u=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,h=3*n-3*e):(u=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,h=3*i-3*t),Jn(l)<1e-12){if(Jn(u)<1e-12)continue;d=-h/u,0<d&&d<1&&c.push(d);continue}g=u*u-4*h*l,R=Ue.sqrt(g),!(g<0)&&(f=(-u+R)/(2*l),0<f&&f<1&&c.push(f),v=(-u-R)/(2*l),0<v&&v<1&&c.push(v))}for(var _=c.length,x=_,S;_--;)d=c[_],S=1-d,p[0][_]=S*S*S*e+3*S*S*d*n+3*S*d*d*r+d*d*d*a,p[1][_]=S*S*S*t+3*S*S*d*i+3*S*d*d*o+d*d*d*s;return p[0][x]=e,p[1][x]=t,p[0][x+1]=a,p[1][x+1]=s,p[0].length=p[1].length=x+2,{x0:mn.apply(0,p[0]),y0:mn.apply(0,p[1]),x1:vn.apply(0,p[0]),y1:vn.apply(0,p[1])}}function ju(e){var t=qi(e);if(t.curve)return Ko(t.curve);for(var n=o0(e),i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},r=function(d,f,v){var g,R;if(!d)return["C",f.x,f.y,f.x,f.y,f.x,f.y];switch(!(d[0]in{T:1,Q:1})&&(f.qx=f.qy=null),d[0]){case"M":f.X=d[1],f.Y=d[2];break;case"A":d=["C"].concat(Ou.apply(0,[f.x,f.y].concat(d.slice(1))));break;case"S":v=="C"||v=="S"?(g=f.x*2-f.bx,R=f.y*2-f.by):(g=f.x,R=f.y),d=["C",g,R].concat(d.slice(1));break;case"T":v=="Q"||v=="T"?(f.qx=f.x*2-f.qx,f.qy=f.y*2-f.qy):(f.qx=f.x,f.qy=f.y),d=["C"].concat(Nu(f.x,f.y,f.qx,f.qy,d[1],d[2]));break;case"Q":f.qx=d[1],f.qy=d[2],d=["C"].concat(Nu(f.x,f.y,d[1],d[2],d[3],d[4]));break;case"L":d=["C"].concat(Xo(f.x,f.y,d[1],d[2]));break;case"H":d=["C"].concat(Xo(f.x,f.y,d[1],f.y));break;case"V":d=["C"].concat(Xo(f.x,f.y,f.x,d[1]));break;case"Z":d=["C"].concat(Xo(f.x,f.y,f.X,f.Y));break}return d},o=function(d,f){if(d[f].length>7){d[f].shift();for(var v=d[f];v.length;)a[f]="A",d.splice(f++,0,["C"].concat(v.splice(0,6)));d.splice(f,1),l=n.length}},a=[],s="",c="",p=0,l=n.length;p<l;p++){n[p]&&(s=n[p][0]),s!="C"&&(a[p]=s,p&&(c=a[p-1])),n[p]=r(n[p],i,c),a[p]!="A"&&s=="C"&&(a[p]="C"),o(n,p);var u=n[p],h=u.length;i.x=u[h-2],i.y=u[h-1],i.bx=Ru(u[h-4])||i.x,i.by=Ru(u[h-3])||i.y}return t.curve=Ko(n),n}var s0=r0;const Lu=Ks(s0);function De(e){return rt(e)&&pn(e,"waypoints")}function xe(e){return rt(e)&&pn(e,"labelTarget")}function Iu(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function ti(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function X(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Zo(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function c0(e){return ti({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function p0(e){for(var t=e.waypoints,n=t.reduce(function(p,l,u){var h=t[u-1];if(h){var d=p[p.length-1],f=d&&d.endLength||0,v=h0(h,l);p.push({start:h,end:l,startLength:f,endLength:f+v,length:v})}return p},[]),i=n.reduce(function(p,l){return p+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function ne(e){return De(e)?p0(e):c0(e)}function lt(e,t,n){n=n||0,rt(n)||(n={x:n,y:n});var i=X(e),r=X(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,p=o?"top":s?"bottom":null,l=c?"left":a?"right":null;return l&&p?p+"-"+l:l||p||"intersect"}function mc(e,t,n){var i=l0(e,t);return i.length===1||i.length===2&&Tr(i[0],i[1])<1?ti(i[0]):i.length>1?(i=ln(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),ti(i[n?0:i.length-1])):null}function l0(e,t){return Lu(e,t)}function u0(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Tr(n,r)===0||uc(i,r,n)?e.splice(t,1):t++;return e}function h0(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Qo(e,t){return Math.round(e*t)/t}function $u(e){return ie(e)?e+"px":e}function d0(e){for(;e.parent;)e=e.parent;return e}function f0(e){e=N({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),st(n,{position:"relative",overflow:"hidden",width:$u(e.width),height:$u(e.height)}),t.appendChild(n),n}function zu(e,t,n){const i=Z("g");he(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const m0="base",Fu=0,v0=1,y0={shape:["x","y","width","height"],connection:["waypoints"]};function ae(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._init(e||{})}ae.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],ae.prototype._init=function(e){const t=this._eventBus,n=this._container=f0(e),i=this._svg=Z("svg");Y(i,{width:"100%",height:"100%"}),ee(n,i);const r=this._viewport=zu(i,"viewport");e.deferUpdate&&(this._viewboxChanged=eg(Ct(this._viewboxChanged,this),300)),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},ae.prototype._destroy=function(){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},ae.prototype._clear=function(){this._elementRegistry.getAll().forEach(e=>{const t=wu(e);t==="root"?this.removeRootElement(e):this._removeElement(e,t)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},ae.prototype.getDefaultLayer=function(){return this.getLayer(m0,Fu)},ae.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},ae.prototype._getChildIndex=function(e){return Gt(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},ae.prototype._createLayer=function(e,t){typeof t>"u"&&(t=v0);const n=this._getChildIndex(t);return{group:zu(this._viewport,"layer-"+e,n),index:t,visible:!0}},ae.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},ae.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&&(Fe(n),t.visible=!1),n},ae.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Fe(t.group))},ae.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},ae.prototype.findRoot=function(e){return typeof e=="string"&&(e=this._elementRegistry.get(e)),e?(this._findPlaneForRoot(d0(e))||{}).rootElement:void 0},ae.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},ae.prototype._findPlaneForRoot=function(e){return ye(this._planes,function(t){return t.rootElement===e})},ae.prototype.getContainer=function(){return this._container},ae.prototype._updateMarker=function(e,t,n){let i;e.id||(e=this._elementRegistry.get(e)),i=this._elementRegistry._elements[e.id],i&&(k([i.gfx,i.secondaryGfx],function(r){r&&(n?he(r).add(t):he(r).remove(t))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},ae.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},ae.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},ae.prototype.hasMarker=function(e,t){e.id||(e=this._elementRegistry.get(e));const n=this.getGraphics(e);return he(n).has(t)},ae.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},ae.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},ae.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,Fu);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},ae.prototype.removeRootElement=function(e){if(typeof e=="string"&&(e=this._elementRegistry.get(e)),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(t){return t.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},ae.prototype.setRootElement=function(e){if(e===this._rootElement)return;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},ae.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)},ae.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})},ae.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})},ae.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=y0[e];if(!Oo(n,function(i){return typeof t[i]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},ae.prototype._setParent=function(e,t,n){Ze(t.children,e,n),e.parent=t},ae.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},ae.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},ae.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},ae.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),We(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},ae.prototype.removeShape=function(e){return this._removeElement(e,"shape")},ae.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},ae.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},ae.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},ae.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},ae.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return this._cachedViewbox;const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,p;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);Rr(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Rr(t),r=a?a.matrix:_g(),s=Qo(r.a,1e3),c=Qo(-r.e||0,1e3),p=Qo(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:p?p/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},ae.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=N({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Hu(t,n)}),{x:n.e,y:n.f}},ae.prototype.scrollToElement=function(e,t){let n=100;typeof e=="string"&&(e=this._elementRegistry.get(e));const i=this.findRoot(e);if(i!==this.getRootElement()&&this.setRootElement(i),i===e)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 r=Ve(e),o=X(r),a=this.viewbox(),s=this.zoom();let c,p;a.y+=t.top/s,a.x+=t.left/s,a.width-=(t.right+t.left)/s,a.height-=(t.bottom+t.top)/s;const l=X(a);if(!(r.width<a.width&&r.height<a.height))c=r.x-a.x,p=r.y-a.y;else{const u=Math.max(0,o.right-l.right),h=Math.min(0,o.left-l.left),d=Math.max(0,o.bottom-l.bottom),f=Math.min(0,o.top-l.top);c=u||h,p=d||f}this.scroll({dx:-c*s,dy:-p*s})},ae.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)}),Qo(i.a,1e3)};function Hu(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}ae.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},ae.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,p,l;c=i.getCTM();const u=c.a;return t?(a=N(o,t),s=a.matrixTransform(c.inverse()),p=r.translate(s.x,s.y).scale(1/u*e).translate(-s.x,-s.y),l=c.multiply(p)):l=r.scale(e),Hu(this._viewport,l),l},ae.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},ae.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},ae.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Ki="data-element-id";function Dt(e){this._elements={},this._eventBus=e}Dt.$inject=["eventBus"],Dt.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Y(t,Ki,i),n&&Y(n,Ki,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Dt.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Y(i.gfx,Ki,""),i.secondaryGfx&&Y(i.secondaryGfx,Ki,""),delete t[n])},Dt.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)},Dt.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Y(t,Ki,i),t},Dt.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Y(e,Ki);var n=this._elements[t];return n&&n.element},Dt.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Dt.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var r=n[i],o=t[r],a=o.element,s=o.gfx;if(e(a,s))return a}},Dt.prototype.getAll=function(){return this.filter(function(e){return e})},Dt.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)})},Dt.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Dt.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")};var vc={exports:{}},Jo={};function g0(e,t,n,i){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(o){var a=this.indexOf(o);return a!==-1&&(this.splice(a,1),t.unset(o,r,i)),o}}),Object.defineProperty(e,"contains",{value:function(o){return this.indexOf(o)!==-1}}),Object.defineProperty(e,"add",{value:function(o,a){var s=this.indexOf(o);if(typeof a>"u"){if(s!==-1)return;a=this.length}s!==-1&&this.splice(s,1),this.splice(a,0,o),s===-1&&t.set(o,r,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function b0(e){return e.__refs_collection===!0}Jo.extend=g0,Jo.isExtended=b0;var Gu=Jo;function x0(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Vu(e,t,n){var i=Gu.extend(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach(function(r){e.set(r,t.inverse,n)})}function _0(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(o){if(o!==r){var a=r;r=null,a&&e.unset(a,i,n),r=o,e.set(r,i,n)}}})}function ni(e,t){if(!(this instanceof ni))return new ni(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}ni.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?Vu(this,t,e):_0(this,t,e)},ni.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return Gu.isExtended(n)||Vu(this,t,e),n},ni.prototype.ensureBound=function(e,t){x0(e,t)||this.bind(e,t)},ni.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},ni.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var E0=ni;vc.exports=E0,vc.exports.Collection=Jo;var w0=vc.exports;const Mr=Ks(w0);var yc=new Mr({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Wu=new Mr({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Uu=new Mr({name:"attachers",collection:!0},{name:"host"}),qu=new Mr({name:"outgoing",collection:!0},{name:"source"}),Ku=new Mr({name:"incoming",collection:!0},{name:"target"});function Yi(){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)}}),yc.bind(this,"parent"),Wu.bind(this,"labels"),qu.bind(this,"outgoing"),Ku.bind(this,"incoming")}function Dr(){Yi.call(this),yc.bind(this,"children"),Uu.bind(this,"host"),Uu.bind(this,"attachers")}q(Dr,Yi);function Yu(){Yi.call(this),yc.bind(this,"children")}q(Yu,Dr);function Xu(){Dr.call(this),Wu.bind(this,"labelTarget")}q(Xu,Dr);function Zu(){Yi.call(this),qu.bind(this,"source"),Ku.bind(this,"target")}q(Zu,Yi);var S0={connection:Zu,shape:Dr,label:Xu,root:Yu};function C0(e,t){var n=S0[e];if(!n)throw new Error("unknown type: <"+e+">");return N(new n,t)}function R0(e){return e instanceof Yi}function Bn(){this._uid=12}Bn.prototype.createRoot=function(e){return this.create("root",e)},Bn.prototype.createLabel=function(e){return this.create("label",e)},Bn.prototype.createShape=function(e){return this.create("shape",e)},Bn.prototype.createConnection=function(e){return this.create("connection",e)},Bn.prototype.create=function(e,t){return t=N({},t||{}),t.id||(t.id=e+"_"+this._uid++),C0(e,t)};var ea="__fn",Qu=1e3,P0=Array.prototype.slice;function Pt(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Pt.prototype.on=function(e,t,n,i){if(e=le(e)?e:[e],pt(t)&&(i=n,n=t,t=Qu),!ie(t))throw new Error("priority must be a number");var r=n;i&&(r=Ct(n,i),r[ea]=n[ea]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Pt.prototype.once=function(e,t,n,i){var r=this;if(pt(t)&&(i=n,n=t,t=Qu),!ie(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[ea]=n,this.on(e,t,o)},Pt.prototype.off=function(e,t){e=le(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Pt.prototype.createEvent=function(e){var t=new Br;return t.init(e),t},Pt.prototype.fire=function(e,t){var n,i,r,o;if(o=P0.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 Br?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},Pt.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Pt.prototype._destroy=function(){this._listeners={}},Pt.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Pt.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=k0(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(r){if(!this.handleError(r))throw r}return i},Pt.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},Pt.prototype._getListeners=function(e){return this._listeners[e]},Pt.prototype._setListeners=function(e,t){this._listeners[e]=t},Pt.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[ea]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function Br(){}Br.prototype.stopPropagation=function(){this.cancelBubble=!0},Br.prototype.preventDefault=function(){this.defaultPrevented=!0},Br.prototype.init=function(e){N(this,e||{})};function k0(e,t){return e.apply(null,t)}function ta(e){return e.childNodes[0]}function T0(e){return e.parentNode.childNodes[1]}function gc(e,t,n,i,r){var o=Cr();o.setTranslate(t,n);var a=Cr();a.setRotate(i||0,0,0);var s=Cr();s.setScale(r||1,r||1),Rr(e,[o,a,s])}function kt(e,t,n){var i=Cr();i.setTranslate(t,n),Rr(e,i)}function Ju(e,t){var n=Cr();n.setRotate(t,0,0),Rr(e,n)}function Bt(e,t){this._eventBus=e,this._elementRegistry=t}Bt.$inject=["eventBus","elementRegistry"],Bt.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=T0(t),n||(n=Z("g"),he(n).add("djs-children"),ee(t.parentNode,n))):n=t,n},Bt.prototype._clear=function(e){var t=ta(e);return Io(t),t},Bt.prototype._createContainer=function(e,t,n,i){var r=Z("g");he(r).add("djs-group"),typeof n<"u"?eh(r,t,t.childNodes[n]):ee(t,r);var o=Z("g");he(o).add("djs-element"),he(o).add("djs-"+e),i&&he(o).add("djs-frame"),ee(r,o);var a=Z("g");return he(a).add("djs-visual"),ee(o,a),o},Bt.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Su(t))},Bt.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Gt(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),k(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r);k(o.slice().reverse(),function(s){var c=n.getGraphics(s);eh(c.parentNode,a)})}})},Bt.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Bt.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Bt.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Bt.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Bt.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),kt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Y(n,"display","none"):Y(n,"display","block")}},Bt.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Fe(t.parentNode)};function eh(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const A0={__depends__:[Ug],__init__:["canvas"],canvas:["type",ae],elementRegistry:["type",Dt],elementFactory:["type",Bn],eventBus:["type",Pt],graphicsFactory:["type",Bt]};function M0(e){var t=new bu(e);return t.init(),t}function D0(e){e=e||{};var t={config:["value",e]},n=[t,A0].concat(e.modules||[]);return M0(n)}function Xi(e,t){this._injector=t=t||D0(e),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}Xi.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Xi.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function bc(){}bc.prototype.get=function(e){return this.$model.properties.get(this,e)},bc.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function th(e,t){this.model=e,this.properties=t}th.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(bc.prototype);k(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(a){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),k(a,Ct(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var B0={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},nh={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 xc(e,t){var n=nh[e];return n?n(t):t}function _c(e){return!!B0[e]}function ih(e){return!!nh[e]}function mt(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function Nt(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}Nt.prototype.build=function(){return un(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Nt.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)},Nt.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},Nt.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=mt(r[0],i),a=mt(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},Nt.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},Nt.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Nt.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},Nt.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},Nt.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Nt.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")},Nt.prototype.hasProperty=function(e){return this.propertiesByName[e]},Nt.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(k(e.properties,Ct(function(o){o=N({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function ii(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,k(e,Ct(this.registerPackage,this))}ii.prototype.getPackage=function(e){return this.packageMap[e]},ii.prototype.getPackages=function(){return this.packages},ii.prototype.registerPackage=function(e){e=N({},e);var t=this.packageMap;rh(t,e,"prefix"),rh(t,e,"uri"),k(e.types,Ct(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},ii.prototype.registerType=function(e,t){e=N({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:N(e.meta||{})});var n=mt(e.name,t.prefix),i=n.name,r={};k(e.properties,Ct(function(o){var a=mt(o.name,n.prefix),s=a.name;_c(o.type)||(o.type=mt(o.type,a.prefix).name),N(o,{ns:a,name:s}),r[s]=o},this)),N(e,{ns:n,name:i,propertiesByName:r}),k(e.extends,Ct(function(o){var a=mt(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},ii.prototype.mapTypes=function(e,t,n){var i=_c(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,p){var l=mt(c,_c(c)?"":e.prefix);r.mapTypes(l,t,p)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");k(i.superClass,n?a:s),t(i,!n),k(i.traits,a)},ii.prototype.getEffectiveDescriptor=function(e){var t=mt(e),n=new Nt(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},ii.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function rh(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Ci(e){this.model=e}Ci.prototype.set=function(e,t,n){if(!Mt(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;N0(n)?i?delete e[r]:delete e.$attrs[Ec(t)]:i?r in e?e[r]=n:oh(e,i,n):e.$attrs[Ec(t)]=n},Ci.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Ec(t)];var i=n.name;return!e[i]&&n.isMany&&oh(e,n,[]),e[i]},Ci.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=N({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Ci.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Ci.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Ci.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(typeof r<"u"){const o=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw o;typeof console<"u"}return null};function N0(e){return typeof e>"u"}function oh(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Ec(e){return e.replace(/^:/,"")}function Wt(e,t={}){this.properties=new Ci(this),this.factory=new th(this,this.properties),this.registry=new ii(e,this.properties),this.typeCache={},this.config=t}Wt.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Wt.prototype.getType=function(e){var t=this.typeCache,n=Mt(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Wt.prototype.createAny=function(e,t,n){var i=mt(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){Z2(this,[a],s)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),k(n,function(a,s){rt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Wt.prototype.getPackage=function(e){return this.registry.getPackage(e)},Wt.prototype.getPackages=function(){return this.registry.getPackages()},Wt.prototype.getElementDescriptor=function(e){return e.$descriptor},Wt.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Wt.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Wt.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var O0=String.fromCharCode,j0=Object.prototype.hasOwnProperty,L0=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Nr={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Nr).forEach(function(e){Nr[e.toUpperCase()]=Nr[e]});function I0(e,t,n,i){return i?j0.call(Nr,i)?Nr[i]:"&"+i+";":O0(t||parseInt(n,16))}function Ri(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(L0,I0):e}var $0="http://www.w3.org/2001/XMLSchema-instance",z0="xsi",ah="xsi:type",sh="non-whitespace outside of root node";function Zi(e){return new Error(e)}function ch(e){return"missing namespace for prefix <"+e+">"}function na(e){return{get:e,enumerable:!0}}function F0(e){var t={},n;for(n in e)t[n]=e[n];return t}function wc(e){return e+"$uri"}function H0(e){var t={},n,i;for(n in e)i=e[n],t[i]=i,t[wc(i)]=n;return t}function ph(){return{line:0,column:0}}function G0(e){throw e}function lh(e){if(!this)return new lh(e);var t=e&&e.proxy,n,i,r,o,a=G0,s,c,p,l,u=ph,h=!1,d=!1,f=null,v=!1,g;function R(x){x instanceof Error||(x=Zi(x)),f=x,a(x,u)}function E(x){s&&(x instanceof Error||(x=Zi(x)),s(x,u))}this.on=function(x,S){if(typeof S!="function")throw Zi("required args <name, cb>");switch(x){case"openTag":i=S;break;case"text":n=S;break;case"closeTag":r=S;break;case"error":a=S;break;case"warn":s=S;break;case"cdata":o=S;break;case"attention":l=S;break;case"question":p=S;break;case"comment":c=S;break;default:throw Zi("unsupported event: "+x)}return this},this.ns=function(x){if(typeof x>"u"&&(x={}),typeof x!="object")throw Zi("required args <nsMap={}>");var S={},M;for(M in x)S[M]=x[M];return S[$0]=z0,d=!0,g=S,this},this.parse=function(x){if(typeof x!="string")throw Zi("required args <xml=string>");return f=null,_(x),u=ph,v=!1,f},this.stop=function(){v=!0};function _(x){var S=d?[]:null,M=d?H0(g):null,j,B=[],D=0,$=!1,z=!1,F=0,U=0,ue,It,Re,pe,wt,C,m,A,O,T="",L=0,G;function oe(){if(G!==null)return G;var Se,be,me,nt=d&&M.xmlns,dt=d&&h?[]:null,ke=L,je=T,St=je.length,$t,gt,$e,zt,we,it={},Is={},Ft,Q,Pe;e:for(;ke<St;ke++)if(Ft=!1,Q=je.charCodeAt(ke),!(Q===32||Q<14&&Q>8)){for((Q<65||Q>122||Q>90&&Q<97)&&Q!==95&&Q!==58&&(E("illegal first char attribute name"),Ft=!0),Pe=ke+1;Pe<St;Pe++)if(Q=je.charCodeAt(Pe),!(Q>96&&Q<123||Q>64&&Q<91||Q>47&&Q<59||Q===46||Q===45||Q===95)){if(Q===32||Q<14&&Q>8){E("missing attribute value"),ke=Pe;continue e}if(Q===61)break;E("illegal attribute name char"),Ft=!0}if(we=je.substring(ke,Pe),we==="xmlns:xmlns"&&(E("illegal declaration of xmlns"),Ft=!0),Q=je.charCodeAt(Pe+1),Q===34)Pe=je.indexOf('"',ke=Pe+2),Pe===-1&&(Pe=je.indexOf("'",ke),Pe!==-1&&(E("attribute value quote missmatch"),Ft=!0));else if(Q===39)Pe=je.indexOf("'",ke=Pe+2),Pe===-1&&(Pe=je.indexOf('"',ke),Pe!==-1&&(E("attribute value quote missmatch"),Ft=!0));else for(E("missing attribute value quotes"),Ft=!0,Pe=Pe+1;Pe<St&&(Q=je.charCodeAt(Pe+1),!(Q===32||Q<14&&Q>8));Pe++);for(Pe===-1&&(E("missing closing quotes"),Pe=St,Ft=!0),Ft||($e=je.substring(ke,Pe)),ke=Pe;Pe+1<St&&(Q=je.charCodeAt(Pe+1),!(Q===32||Q<14&&Q>8));Pe++)ke===Pe&&(E("illegal character after attribute end"),Ft=!0);if(ke=Pe+1,Ft)continue e;if(we in Is){E("attribute <"+we+"> already defined");continue}if(Is[we]=!0,!d){it[we]=$e;continue}if(h){if(gt=we==="xmlns"?"xmlns":we.charCodeAt(0)===120&&we.substr(0,6)==="xmlns:"?we.substr(6):null,gt!==null){if(Se=Ri($e),be=wc(gt),zt=g[Se],!zt){if(gt==="xmlns"||be in M&&M[be]!==Se)do zt="ns"+D++;while(typeof M[zt]<"u");else zt=gt;g[Se]=zt}M[gt]!==zt&&($t||(M=F0(M),$t=!0),M[gt]=zt,gt==="xmlns"&&(M[wc(zt)]=Se,nt=zt),M[be]=Se),it[we]=$e;continue}dt.push(we,$e);continue}if(Q=we.indexOf(":"),Q===-1){it[we]=$e;continue}if(!(me=M[we.substring(0,Q)])){E(ch(we.substring(0,Q)));continue}we=nt===me?we.substr(Q+1):me+we.substr(Q),we===ah&&(Q=$e.indexOf(":"),Q!==-1?(me=$e.substring(0,Q),me=M[me]||me,$e=me+$e.substring(Q)):$e=nt+":"+$e),it[we]=$e}if(h)for(ke=0,St=dt.length;ke<St;ke++){if(we=dt[ke++],$e=dt[ke],Q=we.indexOf(":"),Q!==-1){if(!(me=M[we.substring(0,Q)])){E(ch(we.substring(0,Q)));continue}we=nt===me?we.substr(Q+1):me+we.substr(Q),we===ah&&(Q=$e.indexOf(":"),Q!==-1?(me=$e.substring(0,Q),me=M[me]||me,$e=me+$e.substring(Q)):$e=nt+":"+$e)}it[we]=$e}return G=it}function se(){for(var Se=/(\r\n|\r|\n)/g,be=0,me=0,nt=0,dt=U,ke,je;F>=nt&&(ke=Se.exec(x),!(!ke||(dt=ke[0].length+ke.index,dt>F)));)be+=1,nt=dt;return F==-1?(me=dt,je=x.substring(U)):U===0?je=x.substring(U,F):(me=F-nt,je=U==-1?x.substring(F):x.substring(F,U+1)),{data:je,line:be,column:me}}for(u=se,t&&(O=Object.create({},{name:na(function(){return m}),originalName:na(function(){return A}),attrs:na(oe),ns:na(function(){return M})}));U!==-1;){if(x.charCodeAt(U)===60?F=U:F=x.indexOf("<",U),F===-1){if(B.length)return R("unexpected end of file");if(U===0)return R("missing start tag");U<x.length&&x.substring(U).trim()&&E(sh);return}if(U!==F){if(B.length){if(n&&(n(x.substring(U,F),Ri,u),v))return}else if(x.substring(U,F).trim()&&(E(sh),v))return}if(pe=x.charCodeAt(F+1),pe===33){if(Re=x.charCodeAt(F+2),Re===91&&x.substr(F+3,6)==="CDATA["){if(U=x.indexOf("]]>",F),U===-1)return R("unclosed cdata");if(o&&(o(x.substring(F+9,U),u),v))return;U+=3;continue}if(Re===45&&x.charCodeAt(F+3)===45){if(U=x.indexOf("-->",F),U===-1)return R("unclosed comment");if(c&&(c(x.substring(F+4,U),Ri,u),v))return;U+=3;continue}}if(pe===63){if(U=x.indexOf("?>",F),U===-1)return R("unclosed question");if(p&&(p(x.substring(F,U+2),u),v))return;U+=2;continue}for(ue=F+1;;ue++){if(wt=x.charCodeAt(ue),isNaN(wt))return U=-1,R("unclosed tag");if(wt===34)Re=x.indexOf('"',ue+1),ue=Re!==-1?Re:ue;else if(wt===39)Re=x.indexOf("'",ue+1),ue=Re!==-1?Re:ue;else if(wt===62){U=ue;break}}if(pe===33){if(l&&(l(x.substring(F,U+1),Ri,u),v))return;U+=1;continue}if(G={},pe===47){if($=!1,z=!0,!B.length)return R("missing open tag");if(ue=m=B.pop(),Re=F+2+ue.length,x.substring(F+2,Re)!==ue)return R("closing tag mismatch");for(;Re<U;Re++)if(pe=x.charCodeAt(Re),!(pe===32||pe>8&&pe<14))return R("close tag")}else{if(x.charCodeAt(U-1)===47?(ue=m=x.substring(F+1,U-1),$=!0,z=!0):(ue=m=x.substring(F+1,U),$=!0,z=!1),!(pe>96&&pe<123||pe>64&&pe<91||pe===95||pe===58))return R("illegal first char nodeName");for(Re=1,It=ue.length;Re<It;Re++)if(pe=ue.charCodeAt(Re),!(pe>96&&pe<123||pe>64&&pe<91||pe>47&&pe<59||pe===45||pe===95||pe==46)){if(pe===32||pe<14&&pe>8){m=ue.substring(0,Re),G=null;break}return R("invalid nodeName")}z||B.push(m)}if(d){if(j=M,$&&(z||S.push(j),G===null&&(h=ue.indexOf("xmlns",Re)!==-1)&&(L=Re,T=ue,oe(),h=!1)),A=m,pe=m.indexOf(":"),pe!==-1){if(C=M[m.substring(0,pe)],!C)return R("missing namespace on <"+A+">");m=m.substr(pe+1)}else C=M.xmlns;C&&(m=C+":"+m)}if($&&(L=Re,T=ue,i&&(t?i(O,Ri,z,u):i(m,oe,Ri,z,u),v)))return;if(z){if(r&&(r(t?O:m,Ri,$,u),v))return;d&&($?M=j:M=S.pop())}U+=1}}}function uh(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var V0={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},ia="xsi:type";function hh(e){return e.xml&&e.xml.serialize}function dh(e){return hh(e)===ia}function W0(e){return hh(e)==="property"}function U0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function fh(e,t){return uh(t)?e.prefix+":"+U0(e.localName):e.name}function q0(e,t){var n=e.name,i=e.localName,r=t.xml&&t.xml.typePrefix;return r&&i.indexOf(r)===0?e.prefix+":"+i.slice(r.length):n}function K0(e,t){var n=mt(e),i=t.getPackage(n.prefix);return q0(n,i)}function ri(e){return new Error(e)}function Nn(e){return e.$descriptor}function Y0(e){N(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw ri("expected element");var n=this.elementsById,i=Nn(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw ri("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Or(){}Or.prototype.handleEnd=function(){},Or.prototype.handleText=function(){},Or.prototype.handleNode=function(){};function Sc(){}Sc.prototype=Object.create(Or.prototype),Sc.prototype.handleNode=function(){return this};function Qi(){}Qi.prototype=Object.create(Or.prototype),Qi.prototype.handleText=function(e){this.body=(this.body||"")+e};function jr(e,t){this.property=e,this.context=t}jr.prototype=Object.create(Qi.prototype),jr.prototype.handleNode=function(e){if(this.element)throw ri("expected no sub nodes");return this.element=this.createReference(e),this},jr.prototype.handleEnd=function(){this.element.id=this.body},jr.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Cc(e,t){this.element=t,this.propertyDesc=e}Cc.prototype=Object.create(Qi.prototype),Cc.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=xc(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function ra(){}ra.prototype=Object.create(Qi.prototype),ra.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 vt(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}vt.prototype=Object.create(ra.prototype),vt.prototype.addReference=function(e){this.context.addReference(e)},vt.prototype.handleText=function(e){var t=this.element,n=Nn(t),i=n.bodyProperty;if(!i)throw ri("unexpected body text <"+e+">");Qi.prototype.handleText.call(this,e)},vt.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Nn(t),i=n.bodyProperty;i&&e!==void 0&&(e=xc(i.type,e),t.set(i.name,e))},vt.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Nn(n),r=this.context,o=new n({}),a=this.model,s;return k(t,function(c,p){var l=i.propertiesByName[p],u;l&&l.isReference?l.isMany?(u=c.split(" "),k(u,function(h){r.addReference({element:o,property:l.ns.name,id:h})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=xc(l.type,c):p!=="xmlns"&&(s=mt(p,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+p+">",element:o,property:p,value:c})),o.set(p,c))}),o},vt.prototype.getPropertyForNode=function(e){var t=e.name,n=mt(t),i=this.type,r=this.model,o=Nn(i),a=n.name,s=o.propertiesByName[a],c,p;if(s&&!s.isAttr)return dh(s)&&(c=e.attributes[ia],c)?(c=K0(c,r),p=r.getType(c),N({},s,{effectiveType:Nn(p).name})):s;var l=r.getPackage(n.prefix);if(l){if(c=fh(n,l),p=r.getType(c),s=ye(o.properties,function(u){return!u.isVirtual&&!u.isReference&&!u.isAttribute&&p.hasType(u.type)}),s)return N({},s,{effectiveType:Nn(p).name})}else if(s=ye(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw ri("unrecognized element <"+n.name+">")},vt.prototype.toString=function(){return"ElementDescriptor["+Nn(this.type).name+"]"},vt.prototype.valueHandler=function(e,t){return new Cc(e,t)},vt.prototype.referenceHandler=function(e){return new jr(e,this.context)},vt.prototype.handler=function(e){return e==="Element"?new Ji(this.model,e,this.context):new vt(this.model,e,this.context)},vt.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,ih(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(N(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Rc(e,t,n){vt.call(this,e,t,n)}Rc.prototype=Object.create(vt.prototype),Rc.prototype.createElement=function(e){var t=e.name,n=mt(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&fh(n,o)||t;if(!r.hasType(a))throw ri("unexpected element <"+e.originalName+">");return vt.prototype.createElement.call(this,e)};function Ji(e,t,n){this.model=e,this.context=n}Ji.prototype=Object.create(ra.prototype),Ji.prototype.createElement=function(e){var t=e.name,n=mt(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},Ji.prototype.handleChild=function(e){var t=new Ji(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,r;return i!==void 0&&(r=n.$children=n.$children||[],r.push(i),i.$parent=n),t},Ji.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Pc(e){e instanceof Wt&&(e={model:e}),N(this,{lax:!1},e)}Pc.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof vt?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new Y0(N({},t,{rootHandler:i})),s=new lh({proxy:!0}),c=X0();i.context=a,c.push(i);function p(S,M,j){var B=M(),D=B.line,$=B.column,z=B.data;z.charAt(0)==="<"&&z.indexOf(" ")!==-1&&(z=z.slice(0,z.indexOf(" "))+">");var F="unparsable content "+(z?z+" ":"")+`detected
  2. line: `+D+`
  3. column: `+$+`
  4. nested error: `+S.message;if(j)return a.addWarning({message:F,error:S}),!0;throw ri(F)}function l(S,M){return p(S,M,!0)}function u(){var S=a.elementsById,M=a.references,j,B;for(j=0;B=M[j];j++){var D=B.element,$=S[B.id],z=Nn(D).propertiesByName[B.property];if($||a.addWarning({message:"unresolved reference <"+B.id+">",element:B.element,property:B.property,value:B.id}),z.isMany){var F=D.get(z.name),U=F.indexOf(B);U===-1&&(U=F.length),$?F[U]=$:F.splice(U,1)}else D.set(z.name,$)}}function h(){c.pop().handleEnd()}var d=/^<\?xml /i,f=/ encoding="([^"]+)"/i,v=/^utf-8$/i;function g(S){if(d.test(S)){var M=f.exec(S),j=M&&M[1];!j||v.test(j)||a.addWarning({message:"unsupported document encoding <"+j+">, falling back to UTF-8"})}}function R(S,M){var j=c.peek();try{c.push(j.handleNode(S))}catch(B){p(B,M,o)&&c.push(new Sc)}}function E(S,M){try{c.peek().handleText(S)}catch(j){l(j,M)}}function _(S,M){S.trim()&&E(S,M)}var x=r.getPackages().reduce(function(S,M){return S[M.uri]=M.prefix,S},{"http://www.w3.org/XML/1998/namespace":"xml"});return s.ns(x).on("openTag",function(S,M,j,B){var D=S.attrs||{},$=Object.keys(D).reduce(function(F,U){var ue=M(D[U]);return F[U]=ue,F},{}),z={name:S.name,originalName:S.originalName,attributes:$,ns:S.ns};R(z,B)}).on("question",g).on("closeTag",h).on("cdata",E).on("text",function(S,M,j){_(M(S),j)}).on("error",p).on("warn",l),new Promise(function(S,M){var j;try{s.parse(e),u()}catch(F){j=F}var B=i.element;!j&&!B&&(j=ri("failed to parse document as <"+i.type.$descriptor.name+">"));var D=a.warnings,$=a.references,z=a.elementsById;return j?(j.warnings=D,M(j)):S({rootElement:B,elementsById:z,references:$,warnings:D})})},Pc.prototype.handler=function(e){return new Rc(this.model,e)};function X0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var Z0=`<?xml version="1.0" encoding="UTF-8"?>
  5. `,Q0=/<|>|'|"|&|\n\r|\n/g,mh=/<|>|&/g;function J0(e){var t={},n={},i={},r=[],o=[];this.byUri=function(a){return n[a]||e&&e.byUri(a)},this.add=function(a,s){n[a.uri]=a,s?r.push(a):o.push(a),this.mapPrefix(a.prefix,a.uri)},this.uriByPrefix=function(a){return t[a||"xmlns"]},this.mapPrefix=function(a,s){t[a||"xmlns"]=s},this.getNSKey=function(a){return a.prefix!==void 0?a.uri+"|"+a.prefix:a.uri},this.logUsed=function(a){var s=a.uri,c=this.getNSKey(a);i[c]=this.byUri(s),e&&e.logUsed(a)},this.getUsed=function(a){function s(l){var u=c.getNSKey(l);return i[u]}var c=this,p=[].concat(r,o);return p.filter(s)}}function eb(e){return e.charAt(0).toLowerCase()+e.slice(1)}function tb(e,t){return uh(t)?eb(e):e}function vh(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function yh(e){return Mt(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function nb(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 ib(e,t){return t.isGeneric?N({localName:t.ns.localName},e):N({localName:tb(t.ns.localName,t.$pkg)},e)}function rb(e,t){return N({localName:t.ns.localName},e)}function ob(e){var t=e.$descriptor;return ce(t.properties,function(n){var i=n.name;if(n.isVirtual||!pn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var ab={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},sb={"<":"lt",">":"gt","&":"amp"};function gh(e,t,n){return e=Mt(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function cb(e){return gh(e,Q0,ab)}function pb(e){return gh(e,mh,sb)}function lb(e){return ce(e,function(t){return t.isAttr})}function ub(e){return ce(e,function(t){return!t.isAttr})}function kc(e){this.tagName=e}kc.prototype.build=function(e){return this.element=e,this},kc.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Pi(){}Pi.prototype.serializeValue=Pi.prototype.serializeTo=function(e){e.append(this.escape?pb(this.value):this.value)},Pi.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(mh)!==-1&&(this.escape=!0),this};function Tc(e){this.tagName=e}vh(Tc,Pi),Tc.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Ne(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Ne.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,r,o=t.isGeneric;return o?i=this.parseGeneric(e):i=this.parseNsAttributes(e),n?this.ns=this.nsPropertyTagName(n):this.ns=this.nsTagName(t),this.tagName=this.addTagName(this.ns),o||(r=ob(e),this.parseAttributes(lb(r)),this.parseContainments(ub(r))),this.parseGenericAttributes(e,i),this},Ne.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return ib(t,e)},Ne.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return rb(t,e)},Ne.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Ne.prototype.nsAttributeName=function(e){var t;if(Mt(e)?t=mt(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}:N({localName:t.localName},n)},Ne.prototype.parseGeneric=function(e){var t=this,n=this.body,i=[];return k(e,function(r,o){var a;o==="$body"?n.push(new Pi().build({type:"String"},r)):o==="$children"?k(r,function(s){n.push(new Ne(t).build(s))}):o.indexOf("$")!==0&&(a=t.parseNsAttribute(e,o,r),a&&i.push({name:o,value:r}))}),i},Ne.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=mt(t),o;if(r.prefix==="xmlns"&&(o={prefix:r.localName,uri:n}),!r.prefix&&r.localName==="xmlns"&&(o={uri:n}),!o)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(o,!0,!0);else{var a=this.logNamespaceUsed(o,!0);this.getNamespaces().logUsed(a)}},Ne.prototype.parseNsAttributes=function(e,t){var n=this,i=e.$attrs,r=[];return k(i,function(o,a){var s=n.parseNsAttribute(e,a,o);s&&r.push(s)}),r},Ne.prototype.parseGenericAttributes=function(e,t){var n=this;k(t,function(i){if(i.name!==ia)try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(r){}})},Ne.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;k(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Pi().build(r,o[0]));else if(ih(r.type))k(o,function(l){n.push(new Tc(t.addTagName(t.nsPropertyTagName(r))).build(r,l))});else if(a)k(o,function(l){n.push(new kc(t.addTagName(t.nsPropertyTagName(r))).build(l))});else{var c=dh(r),p=W0(r);k(o,function(l){var u;c?u=new oa(t,r):p?u=new Ne(t,r):u=new Ne(t),n.push(u.build(l))})}})},Ne.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new J0(i):t=i),t},Ne.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix,a=i.byUri(r);return(!a||n)&&i.add(e,t),i.mapPrefix(o,r),e},Ne.prototype.logNamespaceUsed=function(e,t){var n=this.element,i=n.$model,r=this.getNamespaces(t),o=e.prefix,a=e.uri,s,c,p;if(!o&&!a)return{localName:e.localName};if(p=V0[o]||i&&(i.getPackage(o)||{}).uri,a=a||p||r.uriByPrefix(o),!a)throw new Error("no namespace uri given for prefix <"+o+">");if(e=r.byUri(a),!e){for(s=o,c=1;r.uriByPrefix(s);)s=o+"_"+c++;e=this.logNamespace({prefix:s,uri:a},p===a)}return o&&r.mapPrefix(o,a),e},Ne.prototype.parseAttributes=function(e){var t=this,n=this.element;k(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];k(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},Ne.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),yh(e)},Ne.prototype.addAttribute=function(e,t){var n=this.attrs;Mt(t)&&(t=cb(t));var i=tg(n,function(o){return o.name.localName===e.localName&&o.name.uri===e.uri&&o.name.prefix===e.prefix}),r={name:e,value:t};i!==-1?n.splice(i,1,r):n.push(r)},Ne.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=nb(n).concat(t)),k(t,function(i){e.append(" ").append(yh(i.name)).append('="').append(i.value).append('"')})},Ne.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Pi;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),k(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function oa(e,t){Ne.call(this,e,t)}vh(oa,Ne),oa.prototype.parseNsAttributes=function(e){var t=Ne.prototype.parseNsAttributes.call(this,e),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(ia),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},oa.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function hb(){this.value="",this.write=function(e){this.value+=e}}function db(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 fb(e){e=N({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new hb,o=new db(r,e.format);if(e.preamble&&o.append(Z0),new Ne().build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function aa(e,t){Wt.call(this,e,t)}aa.prototype=Object.create(Wt.prototype),aa.prototype.fromXML=function(e,t,n){Mt(t)||(n=t,t="bpmn:Definitions");var i=new Pc(N({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},aa.prototype.toXML=function(e,t){var n=new fb(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var mb="BPMN20",vb="http://www.omg.org/spec/BPMN/20100524/MODEL",yb="bpmn",gb=[],bb=[{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",isAttr:!0,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"}]}],xb=[{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"}]}],_b={tagAlias:"lowerCase",typePrefix:"t"},Eb={name:mb,uri:vb,prefix:yb,associations:gb,types:bb,enumerations:xb,xml:_b},wb="BPMNDI",Sb="http://www.omg.org/spec/BPMN/20100524/DI",Cb="bpmndi",Rb=[{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"]}],Pb=[{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"}]}],kb=[],Tb={name:wb,uri:Sb,prefix:Cb,types:Rb,enumerations:Pb,associations:kb},Ab="DC",Mb="http://www.omg.org/spec/DD/20100524/DC",Db="dc",Bb=[{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}]}],Nb=[],Ob={name:Ab,uri:Mb,prefix:Db,types:Bb,associations:Nb},jb="DI",Lb="http://www.omg.org/spec/DD/20100524/DI",Ib="di",$b=[{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"}]}],zb=[],Fb={tagAlias:"lowerCase"},Hb={name:jb,uri:Lb,prefix:Ib,types:$b,associations:zb,xml:Fb},Gb="bpmn.io colors for BPMN",Vb="http://bpmn.io/schema/bpmn/biocolor/1.0",Wb="bioc",Ub=[{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"}]}],qb=[],Kb=[],Yb={name:Gb,uri:Vb,prefix:Wb,types:Ub,enumerations:qb,associations:Kb},Xb="BPMN in Color",Zb="http://www.omg.org/spec/BPMN/non-normative/color/1.0",Qb="color",Jb=[{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"}]}],ex=[],tx=[],nx={name:Xb,uri:Zb,prefix:Qb,types:Jb,enumerations:ex,associations:tx},ix={bpmn:Eb,bpmndi:Tb,dc:Ob,di:Hb,bioc:Yb,color:nx};function rx(e,t){var n=N({},ix,e);return new aa(n,t)}function yt(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function er(e){return function(){if(!window.Promise)throw new Error("Promises is not supported in this environment. Please polyfill Promise.");var t=arguments.length;if(t>=1&&pt(arguments[t-1])){var n=arguments[t-1],i=Array.prototype.slice.call(arguments,0,-1);e.apply(this,i).then(function(r){var o=Object.keys(r)[0];return n(null,r[o])},function(r){return n(r,r.warnings)})}else return e.apply(this,arguments)}}var ox="Tried to access di from the businessObject. The di is available through the diagram element only. For more information, see https://github.com/bpmn-io/bpmn-js/issues/1472";function bh(e){pn(e,"di")||Object.defineProperty(e,"di",{enumerable:!1,get:function(){throw new Error(ox)}})}function xt(e,t){return e.$instanceOf(t)}function ax(e){return ye(e.rootElements,function(t){return xt(t,"bpmn:Process")||xt(t,"bpmn:Collaboration")})}function sx(e,t){var n={},i=[],r={};function o(T,L){return function(G){T(G,L)}}function a(T){n[T.id]=T}function s(T){return n[T.id]}function c(T,L){var G=T.gfx;if(G)throw new Error(t("already rendered {element}",{element:yt(T)}));return e.element(T,r[T.id],L)}function p(T,L){return e.root(T,r[T.id],L)}function l(T,L){try{var G=r[T.id]&&c(T,L);return a(T),G}catch(oe){u(oe.message,{element:T,error:oe})}}function u(T,L){e.error(T,L)}var h=this.registerDi=function(T){var L=T.bpmnElement;L?r[L.id]?u(t("multiple DI elements defined for {element}",{element:yt(L)}),{element:L}):(r[L.id]=T,bh(L)):u(t("no bpmnElement referenced in {element}",{element:yt(T)}),{element:T})};function d(T){f(T.plane)}function f(T){h(T),k(T.planeElement,v)}function v(T){h(T)}this.handleDefinitions=function(T,L){var G=T.diagrams;if(L&&G.indexOf(L)===-1)throw new Error(t("diagram not part of bpmn:Definitions"));if(!L&&G&&G.length&&(L=G[0]),!L)throw new Error(t("no diagram to display"));r={},d(L);var oe=L.plane;if(!oe)throw new Error(t("no plane for {element}",{element:yt(L)}));var se=oe.bpmnElement;if(!se)if(se=ax(T),se)u(t("correcting missing bpmnElement on {plane} to {rootElement}",{plane:yt(oe),rootElement:yt(se)})),oe.bpmnElement=se,h(oe);else throw new Error(t("no process or collaboration to display"));var Se=p(se,oe);if(xt(se,"bpmn:Process")||xt(se,"bpmn:SubProcess"))R(se,Se);else if(xt(se,"bpmn:Collaboration"))A(se,Se),E(T.rootElements,Se);else throw new Error(t("unsupported bpmnElement for {plane}: {rootElement}",{plane:yt(oe),rootElement:yt(se)}));g(i)};var g=this.handleDeferred=function(){for(var T;i.length;)T=i.shift(),T()};function R(T,L){wt(T,L),$(T.ioSpecification,L),D(T.artifacts,L),a(T)}function E(T,L){var G=ce(T,function(oe){return!s(oe)&&xt(oe,"bpmn:Process")&&oe.laneSets});G.forEach(o(R,L))}function _(T,L){l(T,L)}function x(T,L){k(T,o(_,L))}function S(T,L){l(T,L)}function M(T,L){l(T,L)}function j(T,L){l(T,L)}function B(T,L){l(T,L)}function D(T,L){k(T,function(G){xt(G,"bpmn:Association")?i.push(function(){B(G,L)}):B(G,L)})}function $(T,L){T&&(k(T.dataInputs,o(M,L)),k(T.dataOutputs,o(j,L)))}var z=this.handleSubProcess=function(T,L){wt(T,L),D(T.artifacts,L)};function F(T,L){var G=l(T,L);xt(T,"bpmn:SubProcess")&&z(T,G||L),xt(T,"bpmn:Activity")&&$(T.ioSpecification,L),i.push(function(){k(T.dataInputAssociations,o(S,L)),k(T.dataOutputAssociations,o(S,L))})}function U(T,L){l(T,L)}function ue(T,L){l(T,L)}function It(T,L){i.push(function(){var G=l(T,L);T.childLaneSet&&Re(T.childLaneSet,G||L),O(T)})}function Re(T,L){k(T.lanes,o(It,L))}function pe(T,L){k(T,o(Re,L))}function wt(T,L){C(T.flowElements,L),T.laneSets&&pe(T.laneSets,L)}function C(T,L){k(T,function(G){xt(G,"bpmn:SequenceFlow")?i.push(function(){U(G,L)}):xt(G,"bpmn:BoundaryEvent")?i.unshift(function(){F(G,L)}):xt(G,"bpmn:FlowNode")?F(G,L):xt(G,"bpmn:DataObject")||(xt(G,"bpmn:DataStoreReference")||xt(G,"bpmn:DataObjectReference")?ue(G,L):u(t("unrecognized flowElement {element} in context {context}",{element:yt(G),context:L?yt(L.businessObject):"null"}),{element:G,context:L}))})}function m(T,L){var G=l(T,L),oe=T.processRef;oe&&R(oe,G||L)}function A(T,L){k(T.participants,o(m,L)),D(T.artifacts,L),i.push(function(){x(T.messageFlows,L)})}function O(T){k(T.flowNodeRef,function(L){var G=L.get("lanes");G&&G.push(T)})}}function y(e,t){var n=W(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function de(e,t){return kn(t,function(n){return y(e,n)})}function W(e){return e&&e.businessObject||e}function ge(e){return e&&e.di}function cx(e,t,n){var i,r,o,a,s,c=[];function p(l,u){var h={root:function(g,R){return i.add(g,R)},element:function(g,R,E){return i.add(g,R,E)},error:function(g,R){c.push({message:g,context:R})}},d=new sx(h,o);u=u||l.diagrams&&l.diagrams[0];var f=px(l,u);if(!f)throw new Error(o("no diagram to display"));k(f,function(g){d.handleDefinitions(l,g)});var v=u.plane.bpmnElement.id;a.setRootElement(a.findRoot(v+"_plane")||a.findRoot(v))}return new Promise(function(l,u){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("translate"),a=e.get("canvas"),r.fire("import.render.start",{definitions:t}),p(t,n),r.fire("import.render.complete",{error:s,warnings:c}),l({warnings:c})}catch(h){return h.warnings=c,u(h)}})}function px(e,t){if(t){var n=t.plane.bpmnElement,i=n;!y(n,"bpmn:Process")&&!y(n,"bpmn:Collaboration")&&(i=lx(n));var r;y(i,"bpmn:Collaboration")?r=i:r=ye(e.rootElements,function(p){if(y(p,"bpmn:Collaboration"))return ye(p.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=bt(r.participants,function(p){return p.processRef}),o.push(r));var a=xh(o),s=[t],c=[n];return k(e.diagrams,function(p){var l=p.plane.bpmnElement;a.indexOf(l)!==-1&&c.indexOf(l)===-1&&(s.push(p),c.push(l))}),s}}function xh(e){var t=[];return k(e,function(n){n&&(t.push(n),t=t.concat(xh(n.flowElements)))}),t}function lx(e){for(var t=e;t;){if(y(t,"bpmn:Process"))return t;t=t.$parent}}var ux='<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>',_h=ux,Eh={verticalAlign:"middle"},wh={color:"#404040"},hx={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},dx={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},fx={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"},mx='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+_h+'</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>',yn;function vx(){yn=Me(mx),st(yn,hx),st(Ae("svg",yn),Eh),st(Ae(".backdrop",yn),dx),st(Ae(".notice",yn),fx),st(Ae(".link",yn),wh,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function yx(){yn||(vx(),Rt.bind(yn,".backdrop","click",function(e){document.body.removeChild(yn)})),document.body.appendChild(yn)}function Ee(e){e=N({},bx,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),_x(this._container),this._init(this._container,this._moddle,e)}q(Ee,Xi),Ee.prototype.importXML=function(e,t){return Ui(this,null,function*(){const n=this;function i(o){const a=n.get("eventBus").createEvent(o);return Object.defineProperty(a,"context",{enumerable:!0,get:function(){return{warnings:o.warnings,references:o.references,elementsById:o.elementsById}}}),a}let r=[];try{e=this._emit("import.parse.start",{xml:e})||e;let o;try{o=yield this._moddle.fromXML(e,"bpmn:Definitions")}catch(u){throw this._emit("import.parse.complete",{error:u}),u}let a=o.rootElement;const s=o.references,c=o.warnings,p=o.elementsById;r=r.concat(c),a=this._emit("import.parse.complete",i({error:null,definitions:a,elementsById:p,references:s,warnings:r}))||a;const l=yield this.importDefinitions(a,t);return r=r.concat(l.warnings),this._emit("import.done",{error:null,warnings:r}),{warnings:r}}catch(o){let a=o;throw r=r.concat(a.warnings||[]),sa(a,r),a=gx(a),this._emit("import.done",{error:a,warnings:a.warnings}),a}})},Ee.prototype.importXML=er(Ee.prototype.importXML),Ee.prototype.importDefinitions=function(e,t){return Ui(this,null,function*(){return this._setDefinitions(e),{warnings:(yield this.open(t)).warnings}})},Ee.prototype.importDefinitions=er(Ee.prototype.importDefinitions),Ee.prototype.open=function(e){return Ui(this,null,function*(){const t=this._definitions;let n=e;if(!t){const r=new Error("no XML imported");throw sa(r,[]),r}if(typeof e=="string"&&(n=xx(t,e),!n)){const r=new Error("BPMNDiagram <"+e+"> not found");throw sa(r,[]),r}try{this.clear()}catch(r){throw sa(r,[]),r}const{warnings:i}=yield cx(this,t,n);return{warnings:i}})},Ee.prototype.open=er(Ee.prototype.open),Ee.prototype.saveXML=function(e){return Ui(this,null,function*(){e=e||{};let t=this._definitions,n,i;try{if(!t)throw new Error("no definitions loaded");t=this._emit("saveXML.start",{definitions:t})||t,i=(yield this._moddle.toXML(t,e)).xml,i=this._emit("saveXML.serialized",{xml:i})||i}catch(o){n=o}const r=n?{error:n}:{xml:i};if(this._emit("saveXML.done",r),n)throw n;return r})},Ee.prototype.saveXML=er(Ee.prototype.saveXML),Ee.prototype.saveSVG=function(){return Ui(this,null,function*(){this._emit("saveSVG.start");let e,t;try{const n=this.get("canvas"),i=n.getActiveLayer(),r=Ae("defs",n._svg),o=gu(i),a=r?"<defs>"+gu(r)+"</defs>":"",s=i.getBBox();e=`<?xml version="1.0" encoding="utf-8"?>
  7. <!-- created with bpmn-js / http://bpmn.io -->
  8. <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
  9. <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+s.width+'" height="'+s.height+'" viewBox="'+s.x+" "+s.y+" "+s.width+" "+s.height+'" version="1.1">'+a+o+"</svg>"}catch(n){t=n}if(this._emit("saveSVG.done",{error:t,svg:e}),t)throw t;return{svg:e}})},Ee.prototype.saveSVG=er(Ee.prototype.saveSVG),Ee.prototype._setDefinitions=function(e){this._definitions=e},Ee.prototype.getModules=function(){return this._modules},Ee.prototype.clear=function(){this.getDefinitions()&&Xi.prototype.clear.call(this)},Ee.prototype.destroy=function(){Xi.prototype.destroy.call(this),dn(this._container)},Ee.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Ee.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Ee.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=Ae(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Ee.prototype.getDefinitions=function(){return this._definitions},Ee.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Ee.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=N(Tn(n,["additionalModules"]),{canvas:N({},n.canvas,{container:e}),modules:a});Xi.call(this,s),n&&n.container&&this.attachTo(n.container)},Ee.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Ee.prototype._createContainer=function(e){const t=Me('<div class="bjs-container"></div>');return st(t,{width:Sh(e.width),height:Sh(e.height),position:e.position}),t},Ee.prototype._createModdle=function(e){const t=N({},this._moddleExtensions,e.moddleExtensions);return new rx(t)},Ee.prototype._modules=[];function sa(e,t){return e.warnings=t,e}function gx(e){const t=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);return t&&(e.message="unparsable content <"+t[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+t[2]),e}const bx={width:"100%",height:"100%",position:"relative"};function Sh(e){return e+(ie(e)?"px":"")}function xx(e,t){return t&&ye(e.diagrams,function(n){return n.id===t})||null}function _x(e){const t='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+_h+"</a>",n=Me(t);st(Ae("svg",n),Eh),st(n,wh,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(n),J.bind(n,"click",function(i){yx(),i.preventDefault()})}function Lr(e){Ee.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)}q(Lr,Ee),Lr.prototype._createModdle=function(e){var t=Ee.prototype._createModdle.call(this,e);return t.ids=new Vt([32,36,1]),t},Lr.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function ve(e,t){return y(e,"bpmn:CallActivity")?!1:y(e,"bpmn:SubProcess")?(t=t||ge(e),t&&y(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):y(e,"bpmn:Participant")?!!W(e).processRef:!0}function Ex(e){return e&&W(e).isInterrupting!==!1}function Ot(e){return e&&!!W(e).triggeredByEvent}function ca(e,t){var n=W(e).eventDefinitions;return kn(n,function(i){return y(i,t)})}function wx(e){return ca(e,"bpmn:ErrorEventDefinition")}function Sx(e){return ca(e,"bpmn:EscalationEventDefinition")}function Cx(e){return ca(e,"bpmn:CompensateEventDefinition")}var Ir={width:90,height:20},Ch=15;function ki(e){return y(e,"bpmn:Event")||y(e,"bpmn:Gateway")||y(e,"bpmn:DataStoreReference")||y(e,"bpmn:DataObjectReference")||y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput")||y(e,"bpmn:SequenceFlow")||y(e,"bpmn:MessageFlow")||y(e,"bpmn:Group")}function pa(e){return xe(e.label)}function Rx(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=Px(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=Ch:a+=Ch,{x:a,y:s}}function Px(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 Ac(e){return e.waypoints?Rx(e.waypoints):y(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Ir.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Ir.height/2}}function kx(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Ir.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Ac(t),i=Ir),N({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Rh(e){if(y(e,"bpmn:FlowElement")||y(e,"bpmn:Participant")||y(e,"bpmn:Lane")||y(e,"bpmn:SequenceFlow")||y(e,"bpmn:MessageFlow")||y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput"))return"name";if(y(e,"bpmn:TextAnnotation"))return"text";if(y(e,"bpmn:Group"))return"categoryValueRef"}function Tx(e){var t=e.categoryValueRef;return t&&t.value||""}function Ut(e){var t=e.businessObject,n=Rh(t);if(n)return n==="categoryValueRef"?Tx(t):t[n]||""}function Ax(e,t){var n=e.businessObject,i=Rh(n);return i&&(i==="categoryValueRef"?n.categoryValueRef.value=t:n[i]=t),e}var $r="hsl(225, 10%, 15%)";function gn(e,t){return kn(e.eventDefinitions,function(n){return n.$type===t})}function Mx(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function Dx(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function fe(e,t){var n=ge(e);return n.get("color:background-color")||n.get("bioc:fill")||t||"white"}function K(e,t){var n=ge(e);return n.get("color:border-color")||n.get("bioc:stroke")||t||$r}function zr(e,t,n){var i=ge(e),r=i.get("label");return r&&r.get("color:color")||t||K(e,n)}function Bx(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,r=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return wi(r)}function Ph(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=[["M",n+t,i],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,o-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-o],["a",t,t,0,0,1,t,-t],["z"]];return wi(a)}function Nx(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,s=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return wi(s)}function Ox(e){var t=e.x,n=e.y,i=e.width,r=e.height,o=[["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]];return wi(o)}var jx=new Vt,la=10,Mc=3,tr=.95,Lx=.35,Ix=10;function Ti(e,t,n,i,r,o,a){fn.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,p=e&&e.defaultLabelColor,l=jx.next(),u={};function h(C){return n.computeStyle(C,{strokeLinecap:"round",strokeLinejoin:"round",stroke:$r,strokeWidth:2,fill:"white"})}function d(C){return n.computeStyle(C,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:$r,strokeWidth:2})}function f(C,m){var{ref:A={x:0,y:0},scale:O=1,element:T}=m,L=Z("marker",{id:C,viewBox:"0 0 20 20",refX:A.x,refY:A.y,markerWidth:20*O,markerHeight:20*O,orient:"auto"});ee(L,T);var G=Ae("defs",r._svg);G||(G=Z("defs"),ee(r._svg,G)),ee(G,L),u[C]=L}function v(C){return C.replace(/[^0-9a-zA-Z]+/g,"_")}function g(C,m,A){var O=C+"-"+v(m)+"-"+v(A)+"-"+l;return u[O]||R(O,C,m,A),"url(#"+O+")"}function R(C,m,A,O){if(m==="sequenceflow-end"){var T=Z("path",Ce({d:"M 1 5 L 11 10 L 1 15 Z"},h({fill:O,stroke:O,strokeWidth:1})));f(C,{element:T,ref:{x:11,y:10},scale:.5})}if(m==="messageflow-start"){var L=Z("circle",Ce({cx:6,cy:6,r:3.5},h({fill:A,stroke:O,strokeWidth:1,strokeDasharray:[1e4,1]})));f(C,{element:L,ref:{x:6,y:6}})}if(m==="messageflow-end"){var G=Z("path",Ce({d:"m 1 5 l 0 -3 l 7 3 l -7 3 z"},h({fill:A,stroke:O,strokeWidth:1,strokeDasharray:[1e4,1]})));f(C,{element:G,ref:{x:8.5,y:5}})}if(m==="association-start"){var oe=Z("path",Ce({d:"M 11 5 L 1 10 L 11 15"},d({fill:"none",stroke:O,strokeWidth:1.5,strokeDasharray:[1e4,1]})));f(C,{element:oe,ref:{x:1,y:10},scale:.5})}if(m==="association-end"){var se=Z("path",Ce({d:"M 1 5 L 11 10 L 1 15"},d({fill:"none",stroke:O,strokeWidth:1.5,strokeDasharray:[1e4,1]})));f(C,{element:se,ref:{x:11,y:10},scale:.5})}if(m==="conditional-flow-marker"){var Se=Z("path",Ce({d:"M 0 10 L 8 6 L 16 10 L 8 14 Z"},h({fill:A,stroke:O})));f(C,{element:Se,ref:{x:-1,y:10},scale:.5})}if(m==="conditional-default-flow-marker"){var be=Z("path",Ce({d:"M 6 4 L 10 16"},h({stroke:O})));f(C,{element:be,ref:{x:0,y:10},scale:.5})}}function E(C,m,A,O,T){rt(O)&&(T=O,O=0),O=O||0,T=h(T),T.fill==="none"&&delete T.fillOpacity;var L=m/2,G=A/2,oe=Z("circle",Ce({cx:L,cy:G,r:Math.round((m+A)/4-O)},T));return ee(C,oe),oe}function _(C,m,A,O,T,L){rt(T)&&(L=T,T=0),T=T||0,L=h(L);var G=Z("rect",Ce({x:T,y:T,width:m-T*2,height:A-T*2,rx:O,ry:O},L));return ee(C,G),G}function x(C,m,A,O){var T=m/2,L=A/2,G=[{x:T,y:0},{x:m,y:L},{x:T,y:A},{x:0,y:L}],oe=G.map(function(Se){return Se.x+","+Se.y}).join(" ");O=h(O);var se=Z("polygon",Pn(Ce({},O),{points:oe}));return ee(C,se),se}function S(C,m,A,O){A=d(A);var T=Wo(m,A,O);return ee(C,T),T}function M(C,m,A){return S(C,m,A,5)}function j(C,m,A){A=d(A);var O=Z("path",Pn(Ce({},A),{d:m}));return ee(C,O),O}function B(C,m,A,O){return j(m,A,N({"data-marker":C},O))}function D(C){return Re[C]}function $(C){return function(m,A,O){return D(C)(m,A,O)}}function z(C,m){var A=W(C),O=Mx(A);return A.eventDefinitions&&A.eventDefinitions.length>1?A.parallelMultiple?D("bpmn:ParallelMultipleEventDefinition")(m,C,O):D("bpmn:MultipleEventDefinition")(m,C,O):gn(A,"bpmn:MessageEventDefinition")?D("bpmn:MessageEventDefinition")(m,C,O):gn(A,"bpmn:TimerEventDefinition")?D("bpmn:TimerEventDefinition")(m,C,O):gn(A,"bpmn:ConditionalEventDefinition")?D("bpmn:ConditionalEventDefinition")(m,C):gn(A,"bpmn:SignalEventDefinition")?D("bpmn:SignalEventDefinition")(m,C,O):gn(A,"bpmn:EscalationEventDefinition")?D("bpmn:EscalationEventDefinition")(m,C,O):gn(A,"bpmn:LinkEventDefinition")?D("bpmn:LinkEventDefinition")(m,C,O):gn(A,"bpmn:ErrorEventDefinition")?D("bpmn:ErrorEventDefinition")(m,C,O):gn(A,"bpmn:CancelEventDefinition")?D("bpmn:CancelEventDefinition")(m,C,O):gn(A,"bpmn:CompensateEventDefinition")?D("bpmn:CompensateEventDefinition")(m,C,O):gn(A,"bpmn:TerminateEventDefinition")?D("bpmn:TerminateEventDefinition")(m,C,O):null}function F(C,m,A){A=N({size:{width:100}},A);var O=o.createText(m||"",A);return he(O).add("djs-label"),ee(C,O),O}function U(C,m,A){var O=W(m);return F(C,O.name,{box:m,align:A,padding:7,style:{fill:zr(m,p,c)}})}function ue(C,m){var A={width:90,height:30,x:m.width/2+m.x,y:m.height/2+m.y};return F(C,Ut(m),{box:A,fitBox:!0,style:N({},o.getExternalStyle(),{fill:zr(m,p,c)})})}function It(C,m,A){var O=F(C,m,{box:{height:30,width:A.height},align:"center-middle",style:{fill:zr(A,p,c)}}),T=-1*A.height;gc(O,0,-T,270)}var Re=this.handlers={"bpmn:Event":function(C,m,A){return"fillOpacity"in A||(A.fillOpacity=tr),E(C,m.width,m.height,A)},"bpmn:StartEvent":function(C,m,A){var O={fill:fe(m,s),stroke:K(m,c)},T=W(m);T.isInterrupting||(O={strokeDasharray:"6",fill:fe(m,s),stroke:K(m,c)});var L=D("bpmn:Event")(C,m,O);return(!A||A.renderIcon!==!1)&&z(m,C),L},"bpmn:MessageEventDefinition":function(C,m,A){var O=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:m.width,containerHeight:m.height,position:{mx:.235,my:.315}}),T=A?K(m,c):fe(m,s),L=A?fe(m,s):K(m,c),G=j(C,O,{strokeWidth:1,fill:T,stroke:L});return G},"bpmn:TimerEventDefinition":function(C,m){var A=E(C,m.width,m.height,.2*m.height,{strokeWidth:2,fill:fe(m,s),stroke:K(m,c)}),O=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:m.width,containerHeight:m.height,position:{mx:.5,my:.5}});j(C,O,{strokeWidth:2,stroke:K(m,c)});for(var T=0;T<12;T++){var L=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:m.width,containerHeight:m.height,position:{mx:.5,my:.5}}),G=m.width/2,oe=m.height/2;j(C,L,{strokeWidth:1,transform:"rotate("+T*30+","+oe+","+G+")",stroke:K(m,c)})}return A},"bpmn:EscalationEventDefinition":function(C,m,A){var O=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:.5,my:.2}}),T=A?K(m,c):"none";return j(C,O,{strokeWidth:1,fill:T,stroke:K(m,c)})},"bpmn:ConditionalEventDefinition":function(C,m){var A=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:.5,my:.222}});return j(C,A,{strokeWidth:1,stroke:K(m,c)})},"bpmn:LinkEventDefinition":function(C,m,A){var O=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:.57,my:.263}}),T=A?K(m,c):"none";return j(C,O,{strokeWidth:1,fill:T,stroke:K(m,c)})},"bpmn:ErrorEventDefinition":function(C,m,A){var O=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:m.width,containerHeight:m.height,position:{mx:.2,my:.722}}),T=A?K(m,c):"none";return j(C,O,{strokeWidth:1,fill:T,stroke:K(m,c)})},"bpmn:CancelEventDefinition":function(C,m,A){var O=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:.638,my:-.055}}),T=A?K(m,c):"none",L=j(C,O,{strokeWidth:1,fill:T,stroke:K(m,c)});return Ju(L,45),L},"bpmn:CompensateEventDefinition":function(C,m,A){var O=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:.22,my:.5}}),T=A?K(m,c):"none";return j(C,O,{strokeWidth:1,fill:T,stroke:K(m,c)})},"bpmn:SignalEventDefinition":function(C,m,A){var O=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:m.width,containerHeight:m.height,position:{mx:.5,my:.2}}),T=A?K(m,c):"none";return j(C,O,{strokeWidth:1,fill:T,stroke:K(m,c)})},"bpmn:MultipleEventDefinition":function(C,m,A){var O=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:m.width,containerHeight:m.height,position:{mx:.222,my:.36}}),T=A?K(m,c):"none";return j(C,O,{strokeWidth:1,fill:T})},"bpmn:ParallelMultipleEventDefinition":function(C,m){var A=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:m.width,containerHeight:m.height,position:{mx:.458,my:.194}});return j(C,A,{strokeWidth:1,fill:K(m,c),stroke:K(m,c)})},"bpmn:EndEvent":function(C,m,A){var O=D("bpmn:Event")(C,m,{strokeWidth:4,fill:fe(m,s),stroke:K(m,c)});return(!A||A.renderIcon!==!1)&&z(m,C),O},"bpmn:TerminateEventDefinition":function(C,m){var A=E(C,m.width,m.height,8,{strokeWidth:4,fill:K(m,c),stroke:K(m,c)});return A},"bpmn:IntermediateEvent":function(C,m,A){var O=D("bpmn:Event")(C,m,{strokeWidth:1.5,fill:fe(m,s),stroke:K(m,c)});return E(C,m.width,m.height,Mc,{strokeWidth:1.5,fill:fe(m,"none"),stroke:K(m,c)}),(!A||A.renderIcon!==!1)&&z(m,C),O},"bpmn:IntermediateCatchEvent":$("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":$("bpmn:IntermediateEvent"),"bpmn:Activity":function(C,m,A){return A=A||{},"fillOpacity"in A||(A.fillOpacity=tr),_(C,m.width,m.height,la,A)},"bpmn:Task":function(C,m){var A={fill:fe(m,s),stroke:K(m,c)},O=D("bpmn:Activity")(C,m,A);return U(C,m,"center-middle"),pe(C,m),O},"bpmn:ServiceTask":function(C,m){var A=D("bpmn:Task")(C,m),O=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});j(C,O,{strokeWidth:1,fill:fe(m,s),stroke:K(m,c)});var T=i.getScaledPath("TASK_TYPE_SERVICE_FILL",{abspos:{x:17.2,y:18}});j(C,T,{strokeWidth:0,fill:fe(m,s)});var L=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return j(C,L,{strokeWidth:1,fill:fe(m,s),stroke:K(m,c)}),A},"bpmn:UserTask":function(C,m){var A=D("bpmn:Task")(C,m),O=15,T=12,L=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:O,y:T}});j(C,L,{strokeWidth:.5,fill:fe(m,s),stroke:K(m,c)});var G=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:O,y:T}});j(C,G,{strokeWidth:.5,fill:fe(m,s),stroke:K(m,c)});var oe=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:O,y:T}});return j(C,oe,{strokeWidth:.5,fill:K(m,c),stroke:K(m,c)}),A},"bpmn:ManualTask":function(C,m){var A=D("bpmn:Task")(C,m),O=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return j(C,O,{strokeWidth:.5,fill:fe(m,s),stroke:K(m,c)}),A},"bpmn:SendTask":function(C,m){var A=D("bpmn:Task")(C,m),O=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return j(C,O,{strokeWidth:1,fill:K(m,c),stroke:fe(m,s)}),A},"bpmn:ReceiveTask":function(C,m){var A=W(m),O=D("bpmn:Task")(C,m),T;return A.instantiate?(E(C,28,28,20*.22,{strokeWidth:1}),T=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):T=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),j(C,T,{strokeWidth:1,fill:fe(m,s),stroke:K(m,c)}),O},"bpmn:ScriptTask":function(C,m){var A=D("bpmn:Task")(C,m),O=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return j(C,O,{strokeWidth:1,stroke:K(m,c)}),A},"bpmn:BusinessRuleTask":function(C,m){var A=D("bpmn:Task")(C,m),O=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),T=j(C,O);Y(T,{strokeWidth:1,fill:fe(m,"#aaaaaa"),stroke:K(m,c)});var L=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),G=j(C,L);return Y(G,{strokeWidth:1,stroke:K(m,c)}),A},"bpmn:SubProcess":function(C,m,A){A=Ce({fill:fe(m,s),stroke:K(m,c)},A);var O=D("bpmn:Activity")(C,m,A),T=ve(m);return Ot(m)&&Y(O,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),U(C,m,T?"center-top":"center-middle"),T?pe(C,m):pe(C,m,["SubProcessMarker"]),O},"bpmn:AdHocSubProcess":function(C,m){return D("bpmn:SubProcess")(C,m)},"bpmn:Transaction":function(C,m){var A=D("bpmn:SubProcess")(C,m,{strokeWidth:1.5}),O=n.style(["no-fill","no-events"],{stroke:K(m,c),strokeWidth:1.5});return _(C,m.width,m.height,la-3,Mc,O),A},"bpmn:CallActivity":function(C,m){return D("bpmn:SubProcess")(C,m,{strokeWidth:5})},"bpmn:Participant":function(C,m){var A=1.5,O={fillOpacity:tr,fill:fe(m,s),stroke:K(m,c),strokeWidth:A},T=D("bpmn:Lane")(C,m,O),L=ve(m);if(L){S(C,[{x:30,y:0},{x:30,y:m.height}],{stroke:K(m,c),strokeWidth:A});var G=W(m).name;It(C,G,m)}else{var oe=W(m).name;F(C,oe,{box:m,align:"center-middle",style:{fill:zr(m,p,c)}})}var se=!!W(m).participantMultiplicity;return se&&D("ParticipantMultiplicityMarker")(C,m),T},"bpmn:Lane":function(C,m,A){var O=_(C,m.width,m.height,0,Ce({fill:fe(m,s),fillOpacity:Lx,stroke:K(m,c),strokeWidth:1.5},A)),T=W(m);if(T.$type==="bpmn:Lane"){var L=T.name;It(C,L,m)}return O},"bpmn:InclusiveGateway":function(C,m){var A=D("bpmn:Gateway")(C,m);return E(C,m.width,m.height,m.height*.24,{strokeWidth:2.5,fill:fe(m,s),stroke:K(m,c)}),A},"bpmn:ExclusiveGateway":function(C,m){var A=D("bpmn:Gateway")(C,m),O=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:m.width,containerHeight:m.height,position:{mx:.32,my:.3}});return ge(m).isMarkerVisible&&j(C,O,{strokeWidth:1,fill:K(m,c),stroke:K(m,c)}),A},"bpmn:ComplexGateway":function(C,m){var A=D("bpmn:Gateway")(C,m),O=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:m.width,containerHeight:m.height,position:{mx:.46,my:.26}});return j(C,O,{strokeWidth:1,fill:K(m,c),stroke:K(m,c)}),A},"bpmn:ParallelGateway":function(C,m){var A=D("bpmn:Gateway")(C,m),O=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:m.width,containerHeight:m.height,position:{mx:.46,my:.2}});return j(C,O,{strokeWidth:1,fill:K(m,c),stroke:K(m,c)}),A},"bpmn:EventBasedGateway":function(C,m){var A=W(m),O=D("bpmn:Gateway")(C,m);E(C,m.width,m.height,m.height*.2,{strokeWidth:1,fill:"none",stroke:K(m,c)});var T=A.eventGatewayType,L=!!A.instantiate;function G(){var se=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:m.width,containerHeight:m.height,position:{mx:.36,my:.44}});j(C,se,{strokeWidth:2,fill:fe(m,"none"),stroke:K(m,c)})}if(T==="Parallel"){var oe=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:m.width,containerHeight:m.height,position:{mx:.474,my:.296}});j(C,oe,{strokeWidth:1,fill:"none"})}else T==="Exclusive"&&(L||E(C,m.width,m.height,m.height*.26,{strokeWidth:1,fill:"none",stroke:K(m,c)}),G());return O},"bpmn:Gateway":function(C,m){return x(C,m.width,m.height,{fill:fe(m,s),fillOpacity:tr,stroke:K(m,c)})},"bpmn:SequenceFlow":function(C,m){var A=fe(m,s),O=K(m,c),T=M(C,m.waypoints,{markerEnd:g("sequenceflow-end",A,O),stroke:K(m,c)}),L=W(m),G;return m.source&&(G=m.source.businessObject,L.conditionExpression&&G.$instanceOf("bpmn:Activity")&&Y(T,{markerStart:g("conditional-flow-marker",A,O)}),G.default&&(G.$instanceOf("bpmn:Gateway")||G.$instanceOf("bpmn:Activity"))&&G.default===L&&Y(T,{markerStart:g("conditional-default-flow-marker",A,O)})),T},"bpmn:Association":function(C,m,A){var O=W(m),T=fe(m,s),L=K(m,c);return A=Ce({strokeDasharray:"0, 5",stroke:K(m,c)},A),(O.associationDirection==="One"||O.associationDirection==="Both")&&(A.markerEnd=g("association-end",T,L)),O.associationDirection==="Both"&&(A.markerStart=g("association-start",T,L)),M(C,m.waypoints,A)},"bpmn:DataInputAssociation":function(C,m){var A=fe(m,s),O=K(m,c);return D("bpmn:Association")(C,m,{markerEnd:g("association-end",A,O)})},"bpmn:DataOutputAssociation":function(C,m){var A=fe(m,s),O=K(m,c);return D("bpmn:Association")(C,m,{markerEnd:g("association-end",A,O)})},"bpmn:MessageFlow":function(C,m){var A=W(m),O=ge(m),T=fe(m,s),L=K(m,c),G=M(C,m.waypoints,{markerEnd:g("messageflow-end",T,L),markerStart:g("messageflow-start",T,L),strokeDasharray:"10, 11",strokeWidth:1.5,stroke:K(m,c)});if(A.messageRef){var oe=G.getPointAtLength(G.getTotalLength()/2),se=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:oe.x,y:oe.y}}),Se={strokeWidth:1};O.messageVisibleKind==="initiating"?(Se.fill="white",Se.stroke=$r):(Se.fill="#888",Se.stroke="white");var be=j(C,se,Se),me=A.messageRef.name,nt=F(C,me,{align:"center-top",fitBox:!0,style:{fill:K(m,p)}}),dt=be.getBBox(),ke=nt.getBBox(),je=oe.x-ke.width/2,St=oe.y+dt.height/2+Ix;gc(nt,je,St,0)}return G},"bpmn:DataObject":function(C,m){var A=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:.474,my:.296}}),O=j(C,A,{fill:fe(m,s),fillOpacity:tr,stroke:K(m,c)}),T=W(m);return Dx(T)&&wt(C,m),O},"bpmn:DataObjectReference":$("bpmn:DataObject"),"bpmn:DataInput":function(C,m){var A=i.getRawPath("DATA_ARROW"),O=D("bpmn:DataObject")(C,m);return j(C,A,{strokeWidth:1}),O},"bpmn:DataOutput":function(C,m){var A=i.getRawPath("DATA_ARROW"),O=D("bpmn:DataObject")(C,m);return j(C,A,{strokeWidth:1,fill:$r}),O},"bpmn:DataStoreReference":function(C,m){var A=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:0,my:.133}}),O=j(C,A,{strokeWidth:2,fill:fe(m,s),fillOpacity:tr,stroke:K(m,c)});return O},"bpmn:BoundaryEvent":function(C,m,A){var O=W(m),T=O.cancelActivity,L={strokeWidth:1.5,fill:fe(m,s),stroke:K(m,c)};T||(L.strokeDasharray="6");var G=Pn(Ce({},L),{fillOpacity:1}),oe=Pn(Ce({},L),{fill:"none"}),se=D("bpmn:Event")(C,m,G);return E(C,m.width,m.height,Mc,oe),(!A||A.renderIcon!==!1)&&z(m,C),se},"bpmn:Group":function(C,m){return _(C,m.width,m.height,la,{stroke:K(m,c),strokeWidth:1.5,strokeDasharray:"10,6,0,6",fill:"none",pointerEvents:"none"})},label:function(C,m){return ue(C,m)},"bpmn:TextAnnotation":function(C,m){var A=_(C,m.width,m.height,0,0,{fill:"none",stroke:"none"}),O=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:0,my:0}});j(C,O,{stroke:K(m,c)});var T=W(m).text||"";return F(C,T,{box:m,align:"left-top",padding:7,style:{fill:zr(m,p,c)}}),A},ParticipantMultiplicityMarker:function(C,m){var A=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:m.width/2/m.width,my:(m.height-15)/m.height}});B("participant-multiplicity",C,A,{strokeWidth:2,fill:fe(m,s),stroke:K(m,c)})},SubProcessMarker:function(C,m){var A=_(C,14,14,0,{strokeWidth:1,fill:fe(m,s),stroke:K(m,c)});kt(A,m.width/2-7.5,m.height-20);var O=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}});B("sub-process",C,O,{fill:fe(m,s),stroke:K(m,c)})},ParallelMarker:function(C,m,A){var O=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:(m.width/2+A.parallel)/m.width,my:(m.height-20)/m.height}});B("parallel",C,O,{fill:fe(m,s),stroke:K(m,c)})},SequentialMarker:function(C,m,A){var O=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:(m.width/2+A.seq)/m.width,my:(m.height-19)/m.height}});B("sequential",C,O,{fill:fe(m,s),stroke:K(m,c)})},CompensationMarker:function(C,m,A){var O=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:(m.width/2+A.compensation)/m.width,my:(m.height-13)/m.height}});B("compensation",C,O,{strokeWidth:1,fill:fe(m,s),stroke:K(m,c)})},LoopMarker:function(C,m,A){var O=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:(m.width/2+A.loop)/m.width,my:(m.height-7)/m.height}});B("loop",C,O,{strokeWidth:1.5,fill:fe(m,s),stroke:K(m,c),strokeMiterlimit:.5})},AdhocMarker:function(C,m,A){var O=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:(m.width/2+A.adhoc)/m.width,my:(m.height-15)/m.height}});B("adhoc",C,O,{strokeWidth:1,fill:K(m,c),stroke:K(m,c)})}};function pe(C,m,A){var O=W(m),T=A&&A.indexOf("SubProcessMarker")!==-1,L;T?L={seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:L={seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},k(A,function(se){D(se)(C,m,L)}),O.isForCompensation&&D("CompensationMarker")(C,m,L),O.$type==="bpmn:AdHocSubProcess"&&D("AdhocMarker")(C,m,L);var G=O.loopCharacteristics,oe=G&&G.isSequential;G&&(oe===void 0&&D("LoopMarker")(C,m,L),oe===!1&&D("ParallelMarker")(C,m,L),oe===!0&&D("SequentialMarker")(C,m,L))}function wt(C,m){var A=(m.height-18)/m.height,O=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:.33,my:A}});j(C,O,{strokeWidth:2})}this._drawPath=j,this._renderer=D}q(Ti,fn),Ti.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Ti.prototype.canRender=function(e){return y(e,"bpmn:BaseElement")},Ti.prototype.drawShape=function(e,t){var n=t.type,i=this._renderer(n);return i(e,t)},Ti.prototype.drawConnection=function(e,t){var n=t.type,i=this._renderer(n);return i(e,t)},Ti.prototype.getShapePath=function(e){return y(e,"bpmn:Event")?Bx(e):y(e,"bpmn:Activity")?Ph(e,la):y(e,"bpmn:Gateway")?Nx(e):Ox(e)};var $x=0,zx={width:150,height:50};function Fx(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function Hx(e){return rt(e)?N({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}function Gx(e,t){t.textContent=e;var n;try{var i,r=e==="";return t.textContent=r?"dummy":e,n=t.getBBox(),i={width:n.width+n.x*2,height:n.height},r&&(i.width=0),i}catch(o){return{width:0,height:0}}}function Vx(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=Gx(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return Wx(e,r,i,o);r=qx(r,o.width,t)}}function Wx(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}var kh="\xAD";function Ux(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,r=[],o=0;if(n.length>1)for(;i=n.shift();)if(i.length+o<t)r.push(i),o+=i.length;else{(i==="-"||i===kh)&&r.pop();break}var a=r[r.length-1];return a&&a===kh&&(r[r.length-1]="-"),r.join("")}function qx(e,t,n){var i=Math.max(e.length*(n/t),1),r=Ux(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Kx(){var e=document.getElementById("helper-svg");return e||(e=Z("svg"),Y(e,{id:"helper-svg"}),st(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}function ua(e){this._config=N({},{size:zx,padding:$x,style:{},align:"center-top"},e||{})}ua.prototype.createText=function(e,t){return this.layoutText(e,t).element},ua.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},ua.prototype.layoutText=function(e,t){var n=N({},this._config.size,t.box),i=N({},this._config.style,t.style),r=Fx(t.align||this._config.align),o=Hx(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=Yx(i),c=e.split(/\u00AD?\r?\n/),p=[],l=n.width-o.left-o.right,u=Z("text");Y(u,{x:0,y:0}),Y(u,i);var h=Kx();for(ee(h,u);c.length;)p.push(Vx(c,l,u));r.vertical==="middle"&&(o.top=o.bottom=0);var d=Gt(p,function(E,_,x){return E+(s||_.height)},0)+o.top+o.bottom,f=Gt(p,function(E,_,x){return _.width>E?_.width:E},0),v=o.top;r.vertical==="middle"&&(v+=(n.height-d)/2),v-=(s||p[0].height)/4;var g=Z("text");Y(g,i),k(p,function(E){var _;switch(v+=s||E.height,r.horizontal){case"left":_=o.left;break;case"right":_=(a?f:l)-o.right-E.width;break;default:_=Math.max(((a?f:l)-E.width)/2+o.left,0)}var x=Z("tspan");Y(x,{x:_,y:v}),x.textContent=E.text,ee(g,x)}),Fe(u);var R={width:f,height:d};return{dimensions:R,element:g}};function Yx(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var Xx=12,Zx=1.2,Qx=30;function Th(e){var t=N({fontFamily:"Arial, sans-serif",fontSize:Xx,fontWeight:"normal",lineHeight:Zx},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=N({},t,{fontSize:n},e&&e.externalStyle||{}),r=new ua({style:t});this.getExternalLabelBounds=function(o,a){var s=r.getDimensions(a,{box:{width:90,height:30},style:i});return{x:Math.round(o.x+o.width/2-s.width/2),y:Math.round(o.y),width:Math.ceil(s.width),height:Math.ceil(s.height)}},this.getTextAnnotationBounds=function(o,a){var s=r.getDimensions(a,{box:o,style:t,align:"left-top",padding:5});return{x:o.x,y:o.y,width:o.width,height:Math.max(Qx,Math.round(s.height))}},this.createText=function(o,a){return r.createText(o,a||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Th.$inject=["config.textRenderer"];function Jx(){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(e){return this.pathMap[e].d},this.getScaledPath=function(e,t){var n=this.pathMap[e],i,r;t.abspos?(i=t.abspos.x,r=t.abspos.y):(i=t.containerWidth*t.position.mx,r=t.containerHeight*t.position.my);var o={};if(t.position){for(var a=t.containerHeight/n.height*t.yScaleFactor,s=t.containerWidth/n.width*t.xScaleFactor,c=0;c<n.heightElements.length;c++)o["y"+c]=n.heightElements[c]*a;for(var p=0;p<n.widthElements.length;p++)o["x"+p]=n.widthElements[p]*s}var l=i_(n.d,{mx:i,my:r,e:o});return l}}var e_=/\{([^{}]+)\}/g,t_=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function n_(e,t,n){var i=n;return t.replace(t_,function(r,o,a,s,c){o=o||s,i&&(o in i&&(i=i[o]),typeof i=="function"&&c&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function i_(e,t){return String(e).replace(e_,function(n,i){return n_(n,i,t)})}const r_={__init__:["bpmnRenderer"],bpmnRenderer:["type",Ti],textRenderer:["type",Th],pathMap:["type",Jx]};function o_(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ha={translate:["value",o_]};function da(e,t,n){return N({id:e.id,type:e.$type,businessObject:e,di:t},n)}function a_(e,t,n){var i=e.waypoint;return!i||i.length<2?[ne(t),ne(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Ah(e,t,n,i){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:yt(n),referenced:yt(t),property:i}))}function On(e,t,n,i,r,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._translate=r,this._textRenderer=o}On.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate","textRenderer"],On.prototype.add=function(e,t,n){var i,r=this._translate,o,a;if(y(t,"bpmndi:BPMNPlane")){var s=y(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(da(e,t,s)),this._canvas.addRootElement(i)}else if(y(t,"bpmndi:BPMNShape")){var c=!ve(e,t),p=c_(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(da(e,t,{collapsed:c,hidden:o,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:p})),y(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),y(e,"bpmn:Lane")&&(a=0),y(e,"bpmn:DataStoreReference")&&(s_(n,ne(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,a)}else if(y(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),h=this._getTarget(e);o=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(da(e,t,{hidden:o,source:u,target:h,waypoints:a_(t,u,h)})),y(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,a)}else throw new Error(r("unknown di {di} for element {semantic}",{di:yt(t),semantic:yt(e)}));return ki(e)&&Ut(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},On.prototype._attachBoundary=function(e,t){var n=this._translate,i=e.attachedToRef;if(!i)throw new Error(n("missing {semantic}#attachedToRef",{semantic:yt(e)}));var r=this._elementRegistry.get(i.id),o=r&&r.attachers;if(!r)throw Ah(n,e,i,"attachedToRef");t.host=r,o||(r.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},On.prototype.addLabel=function(e,t,n){var i,r,o;return i=kx(t,n),r=Ut(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(da(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Ut(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},On.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type,o=this._translate;if(i=e[t+"Ref"],t==="source"&&r==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&r==="bpmn:DataOutputAssociation"||t==="target"&&r==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?Ah(o,e,i,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:yt(e),side:t}))},On.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},On.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},On.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function s_(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 c_(e){return y(e,"bpmn:Group")}const p_={__depends__:[ha],bpmnImporter:["type",On]},l_={__depends__:[r_,p_]};function Mh(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function nr(e){return e.originalEvent||e.srcEvent}function Dc(e){Mh(e),Mh(nr(e))}function oi(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 Dh(){return/mac/i.test(navigator.platform)}function Bh(e,t){return(nr(e)||e).button===t}function ai(e){return Bh(e,0)}function u_(e){return Bh(e,1)}function ir(e){var t=nr(e)||e;return ai(e)?Dh()?t.metaKey:t.ctrlKey:!1}function Bc(e){var t=nr(e)||e;return ai(e)&&t.shiftKey}function h_(e){return!0}function fa(e){return ai(e)||u_(e)}var Nh=500;function Oh(e,t,n){var i=this;function r(B,D,$){if(!s(B,D)){var z,F,U;$?F=t.getGraphics($):(z=D.delegateTarget||D.target,z&&(F=z,$=t.get(F))),!(!F||!$)&&(U=e.fire(B,{element:$,gfx:F,originalEvent:D}),U===!1&&(D.stopPropagation(),D.preventDefault()))}}var o={};function a(B){return o[B]}function s(B,D){var $=p[B]||ai;return!$(D)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},p={"element.contextmenu":h_,"element.mousedown":fa,"element.mouseup":fa,"element.click":fa,"element.dblclick":fa};function l(B,D,$){var z=c[B];if(!z)throw new Error("unmapped DOM event name <"+B+">");return r(z,D,$)}var u="svg, .djs-element";function h(B,D,$,z){var F=o[$]=function(U){r($,U)};z&&(p[$]=z),F.$delegate=Rt.bind(B,u,D,F)}function d(B,D,$){var z=a($);z&&Rt.unbind(B,D,z.$delegate)}function f(B){k(c,function(D,$){h(B,$,D)})}function v(B){k(c,function(D,$){d(B,$,D)})}e.on("canvas.destroy",function(B){v(B.svg)}),e.on("canvas.init",function(B){f(B.svg)}),e.on(["shape.added","connection.added"],function(B){var D=B.element,$=B.gfx;e.fire("interactionEvents.createHit",{element:D,gfx:$})}),e.on(["shape.changed","connection.changed"],Nh,function(B){var D=B.element,$=B.gfx;e.fire("interactionEvents.updateHit",{element:D,gfx:$})}),e.on("interactionEvents.createHit",Nh,function(B){var D=B.element,$=B.gfx;i.createDefaultHit(D,$)}),e.on("interactionEvents.updateHit",function(B){var D=B.element,$=B.gfx;i.updateDefaultHit(D,$)});var g=S("djs-hit djs-hit-stroke"),R=S("djs-hit djs-hit-click-stroke"),E=S("djs-hit djs-hit-all"),_=S("djs-hit djs-hit-no-move"),x={all:E,"click-stroke":R,stroke:g,"no-move":_};function S(B,D){return D=N({stroke:"white",strokeWidth:15},D||{}),n.cls(B,["no-fill","no-border"],D)}function M(B,D){var $=x[D];if(!$)throw new Error("invalid hit type <"+D+">");return Y(B,$),B}function j(B,D){ee(B,D)}this.removeHits=function(B){var D=ec(".djs-hit",B);k(D,Fe)},this.createDefaultHit=function(B,D){var $=B.waypoints,z=B.isFrame,F;return $?this.createWaypointsHit(D,$):(F=z?"stroke":"all",this.createBoxHit(D,F,{width:B.width,height:B.height}))},this.createWaypointsHit=function(B,D){var $=Wo(D);return M($,"stroke"),j(B,$),$},this.createBoxHit=function(B,D,$){$=N({x:0,y:0},$);var z=Z("rect");return M(z,D),Y(z,$),j(B,z),z},this.updateDefaultHit=function(B,D){var $=Ae(".djs-hit",D);if($)return B.waypoints?xu($,B.waypoints):Y($,{width:B.width,height:B.height}),$},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=h,this.unregisterEvent=d}Oh.$inject=["eventBus","elementRegistry","styles"];const Fr={__init__:["interactionEvents"],interactionEvents:["type",Oh]};var d_=500,f_=1e3;function Ai(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),i=this;function r(o){var a=Z("rect");return Y(a,N({x:0,y:0,rx:4,width:100,height:100},n)),a}e.on(["shape.added","shape.changed"],d_,function(o){var a=o.element,s=o.gfx,c=Ae(".djs-outline",s);c||(c=i.getOutline(a)||r(),ee(s,c)),i.updateShapeOutline(c,a)}),e.on(["connection.added","connection.changed"],function(o){var a=o.element,s=o.gfx,c=Ae(".djs-outline",s);c||(c=r(),ee(s,c)),i.updateConnectionOutline(c,a)})}Ai.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&k(i,function(r){n=n||r.updateOutline(t,e)}),n||Y(e,{x:-this.offset,y:-this.offset,width:t.width+this.offset*2,height:t.height+this.offset*2})},Ai.prototype.updateConnectionOutline=function(e,t){var n=Ve(t);Y(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+this.offset*2,height:n.height+this.offset*2})},Ai.prototype.registerProvider=function(e,t){t||(t=e,e=f_),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Ai.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ai.prototype.getOutline=function(e){var t,n=this._getProviders();return k(n,function(i){pt(i.getOutline)&&(t=t||i.getOutline(e))}),t},Ai.$inject=["eventBus","styles","elementRegistry"];const jh={__init__:["outline"],outline:["type",Ai]};function rr(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],function(i){var r=i.element;n.deselect(r)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}rr.$inject=["eventBus","canvas"],rr.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(n!==-1){var i=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:t})}},rr.prototype.get=function(){return this._selectedElements},rr.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1},rr.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();le(e)||(e=e?[e]:[]);var r=this._canvas,o=r.getRootElement();e=e.filter(function(a){var s=r.findRoot(a);return o===s}),t?k(e,function(a){n.indexOf(a)===-1&&n.push(a)}):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:n})};var Lh="hover",Ih="selected",ma=6;function Nc(e,t,n){this._canvas=e;var i=this;this._multiSelectionBox=null;function r(a,s){e.addMarker(a,s)}function o(a,s){e.removeMarker(a,s)}t.on("element.hover",function(a){r(a.element,Lh)}),t.on("element.out",function(a){o(a.element,Lh)}),t.on("selection.changed",function(a){function s(u){o(u,Ih)}function c(u){r(u,Ih)}var p=a.oldSelection,l=a.newSelection;k(p,function(u){l.indexOf(u)===-1&&s(u)}),k(l,function(u){p.indexOf(u)===-1&&c(u)}),i._updateSelectionOutline(l)}),t.on("element.changed",function(a){n.isSelected(a.element)&&i._updateSelectionOutline(n.get())})}Nc.$inject=["canvas","eventBus","selection"],Nc.prototype._updateSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ho(t);var n=e.length>1,i=this._canvas.getContainer();if(he(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=m_(Ve(e)),o=Z("rect");Y(o,N({rx:3},r)),he(o).add("djs-selection-outline"),ee(t,o)}};function m_(e){return{x:e.x-ma,y:e.y-ma,width:e.width+ma*2,height:e.height+ma*2}}function $h(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},p=c.autoSelect;if(a){if(p===!1)return;le(p)?t.select(p):t.select(s.filter(v_))}}),e.on("connect.end",500,function(r){var o=r.context,a=o.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(r){var o=r.previousSelection||[],a=i.get(r.context.shape.id),s=ye(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(ai(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=ir(r)||Bc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}$h.$inject=["eventBus","selection","canvas","elementRegistry"];function v_(e){return!e.hidden}const bn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Fr,jh],selection:["type",rr],selectionVisuals:["type",Nc],selectionBehavior:["type",$h]};function Oc(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Oc.prototype.next=function(){return this._prefix+ ++this._counter};var y_=new Oc("ov"),g_=500;function et(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=y_,this._overlayDefaults=N({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=b_(n.getContainer()),this._init()}et.$inject=["config.overlays","eventBus","canvas","elementRegistry"],et.prototype.get=function(e){if(Mt(e)&&(e={id:e}),Mt(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?ce(t.overlays,hn({type:e.type})):t.overlays.slice():[]}else return e.type?ce(this._overlays,hn({type:e.type})):e.id?this._overlays[e.id]:null},et.prototype.add=function(e,t,n){if(rt(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=N({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},et.prototype.remove=function(e){var t=this.get(e)||[];le(t)||(t=[t]);var n=this;k(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(dn(i.html),dn(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},et.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},et.prototype.show=function(){va(this._overlayRoot)},et.prototype.hide=function(){va(this._overlayRoot,!1)},et.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Io(this._overlayRoot)},et.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Ve(t);i=o.x,r=o.y}zh(n,i,r),ft(e.html,"data-container-id",t.id)},et.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=Ve(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Ve(i).height:s=i.height,o=t.bottom*-1+s}zh(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},et.prototype._createOverlayContainer=function(e){var t=Me('<div class="djs-overlays" />');st(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},et.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Fh(this._overlayRoot,n)},et.prototype._getOverlayContainer=function(e,t){var n=ye(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},et.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),Mt(i)&&(i=Me(i)),o=this._getOverlayContainer(n),r=Me('<div class="djs-overlay" data-overlay-id="'+t+'">'),st(r,{position:"absolute"}),r.appendChild(i),e.type&&Je(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();va(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},et.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(ot(r)&&r>t.scale||ot(o)&&o<t.scale))&&(c=!1),va(a,c),this._updateOverlayScale(e,t)},et.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),ot(i)&&t.scale<i&&(a=(1/t.scale||1)*i),ot(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),ot(a)&&(s="scale("+a+","+a+")"),Fh(o,s)},et.prototype._updateOverlaysVisibilty=function(e){var t=this;k(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},et.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});k(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){dn(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",g_,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(k(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&Je(r.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function b_(e){var t=Me('<div class="djs-overlay-container" />');return st(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function zh(e,t,n){st(e,{left:t+"px",top:n+"px"})}function va(e,t){e.style.display=t===!1?"none":""}function Fh(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const ya={__init__:["overlays"],overlays:["type",et]};function Hh(e,t,n,i){e.on("element.changed",function(r){var o=r.element;(o.parent||o===t.getRootElement())&&(r.gfx=n.getGraphics(o)),r.gfx&&e.fire(wu(o)+".changed",r)}),e.on("elements.changed",function(r){var o=r.elements;o.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(o)}),e.on("shape.changed",function(r){i.update("shape",r.element,r.gfx)}),e.on("connection.changed",function(r){i.update("connection",r.element,r.gfx)})}Hh.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const jc={__init__:["changeSupport"],changeSupport:["type",Hh]};var x_=1e3;function V(e){this._eventBus=e}V.$inject=["eventBus"];function __(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}V.prototype.on=function(e,t,n,i,r,o){if((pt(t)||ie(t))&&(o=r,r=i,i=n,n=t,t=null),pt(n)&&(o=r,r=i,i=n,n=x_),rt(r)&&(o=r,r=!1),!pt(i))throw new Error("handlerFn must be a function");le(e)||(e=[e]);var a=this._eventBus;k(e,function(s){var c=["commandStack",s,t].filter(function(p){return p}).join(".");a.on(c,n,r?__(i,o):i,o)})},V.prototype.canExecute=jn("canExecute"),V.prototype.preExecute=jn("preExecute"),V.prototype.preExecuted=jn("preExecuted"),V.prototype.execute=jn("execute"),V.prototype.executed=jn("executed"),V.prototype.postExecute=jn("postExecute"),V.prototype.postExecuted=jn("postExecuted"),V.prototype.revert=jn("revert"),V.prototype.reverted=jn("reverted");function jn(e){return function(t,n,i,r,o){(pt(t)||ie(t))&&(o=r,r=i,i=n,n=t,t=null),this.on(t,e,n,i,r,o)}}function Lc(e,t){t.invoke(V,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)})}q(Lc,V),Lc.$inject=["canvas","injector"];const E_={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Lc]};function Hr(e){return CSS.escape(e)}var w_={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Ic(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return w_[t]})}var Gh="_plane";function Vh(e){var t=e.id;return S_(t)}function Ln(e){var t=e.id;return y(e,"bpmn:SubProcess")?Wh(t):t}function Mi(e){return Wh(e)}function $c(e){var t=ge(e);return y(t,"bpmndi:BPMNPlane")}function Wh(e){return e+Gh}function S_(e){return e.replace(new RegExp(Gh+"$"),"")}var C_="bjs-breadcrumbs-shown";function Uh(e,t,n){var i=Me('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Je(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var p=c.element,l=W(p),u=ye(a,function(h){return h===l});u&&s()});function s(c){c&&(a=R_(c));var p=a.map(function(u){var h=Ic(u.name||u.id),d=Me('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>"),f=n.findRoot(Ln(u))||n.findRoot(u.id);if(!f&&y(u,"bpmn:Process")){var v=t.find(function(g){var R=W(g);return R&&R.get("processRef")&&R.get("processRef")===u});f=n.findRoot(v.id)}return d.addEventListener("click",function(){n.setRootElement(f)}),d});i.innerHTML="";var l=p.length>1;o.toggle(C_,l),p.forEach(function(u){i.appendChild(u)})}e.on("root.set",function(c){s(c.element)})}Uh.$inject=["eventBus","elementRegistry","canvas"];function R_(e){for(var t=W(e),n=[],i=t;i;i=i.$parent)(y(i,"bpmn:SubProcess")||y(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function qh(e,t){var n=null,i=new P_;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(y(o,"bpmn:Collaboration")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,p=(a.y-s.y)*a.scale;(c!==0||p!==0)&&t.scroll({dx:c,dy:p}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}qh.$inject=["eventBus","canvas"];function P_(){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 Kh={x:180,y:160};function Di(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Di.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.forEach(function(i){var r=t._createNewDiagrams(i.plane);Array.prototype.push.apply(n,r)}),n.forEach(function(i){t._movePlaneElementsToOrigin(i.plane)})}},Di.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;y(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),T_(a,e)&&i.push({diElement:o,parent:s})}});var r=[];return n.forEach(function(o){if(!t._processToDiagramMap[o.id]){var a=t._createDiagram(o);t._processToDiagramMap[o.id]=a,r.push(a)}}),i.forEach(function(o){for(var a=o.diElement,s=o.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),r},Di.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=k_(e),i={x:n.x-Kh.x,y:n.y-Kh.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},Di.prototype._moveToDiPlane=function(e,t){var n=Yh(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Di.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},Di.$inject=["eventBus","moddle"];function Yh(e){return y(e,"bpmndi:BPMNDiagram")?e:Yh(e.$parent)}function k_(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=X(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Zo(t)}function T_(e,t){var n=e.$parent;return!(!y(n,"bpmn:SubProcess")||n===t.bpmnElement||de(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var ga=250,A_='<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>',M_="bjs-drilldown-empty";function si(e,t,n,i){V.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i;var r=this;this.executed("shape.toggleCollapse",ga,function(o){var a=o.shape;r._canDrillDown(a)?r._addOverlay(a):r._removeOverlay(a)},!0),this.reverted("shape.toggleCollapse",ga,function(o){var a=o.shape;r._canDrillDown(a)?r._addOverlay(a):r._removeOverlay(a)},!0),this.executed(["shape.create","shape.move","shape.delete"],ga,function(o){var a=o.oldParent,s=o.newParent||o.parent,c=o.shape;r._canDrillDown(c)&&r._addOverlay(c),r._updateDrilldownOverlay(a),r._updateDrilldownOverlay(s),r._updateDrilldownOverlay(c)},!0),this.reverted(["shape.create","shape.move","shape.delete"],ga,function(o){var a=o.oldParent,s=o.newParent||o.parent,c=o.shape;r._canDrillDown(c)&&r._addOverlay(c),r._updateDrilldownOverlay(a),r._updateDrilldownOverlay(s),r._updateDrilldownOverlay(c)},!0),t.on("import.render.complete",function(){n.filter(function(o){return r._canDrillDown(o)}).map(function(o){r._addOverlay(o)})})}q(si,V),si.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},si.prototype._canDrillDown=function(e){var t=this._canvas;return y(e,"bpmn:SubProcess")&&t.findRoot(Ln(e))},si.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=W(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;Je(i.html).toggle(M_,!r)}},si.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=n.get({element:e,type:"drilldown"});i.length&&this._removeOverlay(e);var r=Me('<button class="bjs-drilldown">'+A_+"</button>");r.addEventListener("click",function(){t.setRootElement(t.findRoot(Ln(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},si.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},si.$inject=["canvas","eventBus","elementRegistry","overlays"];const D_={__depends__:[ya,jc,E_],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Uh],drilldownCentering:["type",qh],drilldownOverlayBehavior:["type",si],subprocessCompatibility:["type",Di]};function ci(e){Ee.call(this,e)}q(ci,Ee),ci.prototype._modules=[l_,ha,bn,ya,D_],ci.prototype._moddleExtensions={};var B_=["c","C"],N_=["v","V"],O_=["y","Y"],Xh=["z","Z"];function j_(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function jt(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function tt(e,t){return e=le(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function zc(e){return e.shiftKey}function L_(e){return jt(e)&&tt(B_,e)}function I_(e){return jt(e)&&tt(N_,e)}function $_(e){return jt(e)&&!zc(e)&&tt(Xh,e)}function z_(e){return jt(e)&&(tt(O_,e)||tt(Xh,e)&&zc(e))}var ba="keyboard.keydown",F_="keyboard.keyup",Zh="input-handle-modified-keys",H_=1e3;function ct(e,t){var n=this;this._config=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()}),t.on("diagram.init",function(){n._fire("init")}),t.on("attach",function(){e&&e.bindTo&&n.bind(e.bindTo)}),t.on("detach",function(){n.unbind()})}ct.$inject=["config.keyboard","eventBus"],ct.prototype._keydownHandler=function(e){this._keyHandler(e,ba)},ct.prototype._keyupHandler=function(e){this._keyHandler(e,F_)},ct.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||ba,i),n&&e.preventDefault()}},ct.prototype._isEventIgnored=function(e){return e.defaultPrevented?!0:G_(e.target)&&this._isModifiedKeyIgnored(e)},ct.prototype._isModifiedKeyIgnored=function(e){if(!jt(e))return!0;var t=this._getAllowedModifiers(e.target);return t.indexOf(e.key)===-1},ct.prototype._getAllowedModifiers=function(e){var t=Mn(e,"["+Zh+"]",!0);return!t||this._node&&!this._node.contains(t)?[]:t.getAttribute(Zh).split(",")},ct.prototype.bind=function(e){this.unbind(),this._node=e,J.bind(e,"keydown",this._keydownHandler),J.bind(e,"keyup",this._keyupHandler),this._fire("bind")},ct.prototype.getBinding=function(){return this._node},ct.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),J.unbind(e,"keydown",this._keydownHandler),J.unbind(e,"keyup",this._keyupHandler)),this._node=null},ct.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},ct.prototype.addListener=function(e,t,n){pt(e)&&(n=t,t=e,e=H_),this._eventBus.on(n||ba,e,t)},ct.prototype.removeListener=function(e,t){this._eventBus.off(t||ba,e)},ct.prototype.hasModifier=j_,ct.prototype.isCmd=jt,ct.prototype.isShift=zc,ct.prototype.isKey=tt;function G_(e){return e&&(Sr(e,"input, textarea")||e.contentEditable==="true")}var V_=500;function or(e,t){var n=this;e.on("editorActions.init",V_,function(i){var r=i.editorActions;n.registerBindings(t,r)})}or.$inject=["eventBus","keyboard"],or.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if($_(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(z_(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(L_(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(I_(r))return t.trigger("paste"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(tt(["+","Add","="],r)&&jt(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(tt(["-","Subtract"],r)&&jt(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(tt("0",r)&&jt(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(tt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Fc={__init__:["keyboard","keyboardBindings"],keyboard:["type",ct],keyboardBindings:["type",or]};var W_={moveSpeed:50,moveSpeedAccelerated:200};function Qh(e,t,n){var i=this;this._config=N({},W_,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,p;switch(a.key){case"ArrowLeft":case"Left":p="left";break;case"ArrowUp":case"Up":p="up";break;case"ArrowRight":case"Right":p="right";break;case"ArrowDown":case"Down":p="down";break}return i.moveCanvas({speed:c,direction:p}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,p=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=p;break;case"up":s=p;break;case"right":a=-p;break;case"down":s=-p;break}n.scroll({dx:a,dy:s})}}Qh.$inject=["config.keyboardMove","keyboard","canvas"];const Jh={__depends__:[Fc],__init__:["keyboardMove"],keyboardMove:["type",Qh]};var U_=/^djs-cursor-.*$/;function xa(e){var t=Je(document.body);t.removeMatching(U_),e&&t.add("djs-cursor-"+e)}function ed(){xa(null)}var q_=5e3;function td(e,t){t=t||"element.click";function n(){return!1}return e.once(t,q_,n),function(){e.off(t,n)}}function Gr(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function tn(e,t){return{x:e.x-t.x,y:e.y-t.y}}var K_=15;function nd(e,t){var n;e.on("element.mousedown",500,function(a){return o(a.originalEvent)});function i(a){var s=n.start,c=n.button,p=oi(a),l=tn(p,s);if(!n.dragging&&Y_(l)>K_&&(n.dragging=!0,c===0&&td(e),xa("grab")),n.dragging){var u=n.last||n.start;l=tn(p,u),t.scroll({dx:l.x,dy:l.y}),n.last=p}a.preventDefault()}function r(a){J.unbind(document,"mousemove",i),J.unbind(document,"mouseup",r),n=null,ed()}function o(a){if(!Mn(a.target,".djs-draggable")){var s=a.button;if(!(s>=2||a.ctrlKey||a.shiftKey||a.altKey))return n={button:s,start:oi(a)},J.bind(document,"mousemove",i),J.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}nd.$inject=["eventBus","canvas"];function Y_(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const id={__init__:["moveCanvas"],moveCanvas:["type",nd]};function Hc(e){return Math.log(e)/Math.log(10)}function rd(e,t){var n=Hc(e.min),i=Hc(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function X_(e,t){return Math.max(e.min,Math.min(e.max,t))}var Z_=Math.sign||function(e){return e>=0?1:-1},Gc={min:.2,max:4},od=10,Q_=.1,J_=.75;function xn(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Ct(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||J_;var i=this;t.on("canvas.init",function(r){i._init(e.enabled!==!1)})}xn.$inject=["config.zoomScroll","eventBus","canvas"],xn.prototype.scroll=function(e){this._canvas.scroll(e)},xn.prototype.reset=function(){this._canvas.zoom("fit-viewport")},xn.prototype.zoom=function(e,t){var n=rd(Gc,od*2);this._totalDelta+=e,Math.abs(this._totalDelta)>Q_&&(this._zoom(e,t,n),this._totalDelta=0)},xn.prototype._handleWheel=function(e){if(!Mn(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n=e.ctrlKey||Dh()&&e.metaKey,i=e.shiftKey,r=-1*this._scale,o;if(n?r*=e.deltaMode===0?.02:.32:r*=e.deltaMode===0?1:16,n){var a=t.getBoundingClientRect(),s={x:e.clientX-a.left,y:e.clientY-a.top};o=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*Z_(e.deltaY)*r,this.zoom(o,s)}else i?o={dx:r*e.deltaY,dy:0}:o={dx:r*e.deltaX,dy:r*e.deltaY},this.scroll(o)}},xn.prototype.stepZoom=function(e,t){var n=rd(Gc,od);this._zoom(e,t,n)},xn.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Hc(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(X_(Gc,s),t)},xn.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return typeof e>"u"&&(e=!i),i!==e&&J[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},xn.prototype._init=function(e){this.toggle(e)};const ad={__init__:["zoomScroll"],zoomScroll:["type",xn]};function Vr(e){ci.call(this,e)}q(Vr,ci),Vr.prototype._navigationModules=[Jh,id,ad],Vr.prototype._modules=[].concat(ci.prototype._modules,Vr.prototype._navigationModules);var sd={exports:{}};(function(e){(function(t,n,i,r){var o=["","webkit","Moz","MS","ms","o"],a=n.createElement("div"),s="function",c=Math.round,p=Math.abs,l=Date.now;function u(b,w,P){return setTimeout(_(b,P),w)}function h(b,w,P){return Array.isArray(b)?(d(b,P[w],P),!0):!1}function d(b,w,P){var I;if(b)if(b.forEach)b.forEach(w,P);else if(b.length!==r)for(I=0;I<b.length;)w.call(P,b[I],I,b),I++;else for(I in b)b.hasOwnProperty(I)&&w.call(P,b[I],I,b)}function f(b,w,P){var I="DEPRECATED METHOD: "+w+`
  10. `+P+` AT
  11. `;return function(){var H=new Error("get-stack-trace"),te=H&&H.stack?H.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",_e=t.console&&(t.console.warn||t.console.log);return _e&&_e.call(t.console,I,te),b.apply(this,arguments)}}var v;typeof Object.assign!="function"?v=function(b){if(b===r||b===null)throw new TypeError("Cannot convert undefined or null to object");for(var w=Object(b),P=1;P<arguments.length;P++){var I=arguments[P];if(I!==r&&I!==null)for(var H in I)I.hasOwnProperty(H)&&(w[H]=I[H])}return w}:v=Object.assign;var g=f(function(b,w,P){for(var I=Object.keys(w),H=0;H<I.length;)(!P||P&&b[I[H]]===r)&&(b[I[H]]=w[I[H]]),H++;return b},"extend","Use `assign`."),R=f(function(b,w){return g(b,w,!0)},"merge","Use `assign`.");function E(b,w,P){var I=w.prototype,H;H=b.prototype=Object.create(I),H.constructor=b,H._super=I,P&&v(H,P)}function _(b,w){return function(){return b.apply(w,arguments)}}function x(b,w){return typeof b==s?b.apply(w&&w[0]||r,w):b}function S(b,w){return b===r?w:b}function M(b,w,P){d($(w),function(I){b.addEventListener(I,P,!1)})}function j(b,w,P){d($(w),function(I){b.removeEventListener(I,P,!1)})}function B(b,w){for(;b;){if(b==w)return!0;b=b.parentNode}return!1}function D(b,w){return b.indexOf(w)>-1}function $(b){return b.trim().split(/\s+/g)}function z(b,w,P){if(b.indexOf&&!P)return b.indexOf(w);for(var I=0;I<b.length;){if(P&&b[I][P]==w||!P&&b[I]===w)return I;I++}return-1}function F(b){return Array.prototype.slice.call(b,0)}function U(b,w,P){for(var I=[],H=[],te=0;te<b.length;){var _e=w?b[te][w]:b[te];z(H,_e)<0&&I.push(b[te]),H[te]=_e,te++}return P&&(w?I=I.sort(function(Ge,cn){return Ge[w]>cn[w]}):I=I.sort()),I}function ue(b,w){for(var P,I,H=w[0].toUpperCase()+w.slice(1),te=0;te<o.length;){if(P=o[te],I=P?P+H:w,I in b)return I;te++}return r}var It=1;function Re(){return It++}function pe(b){var w=b.ownerDocument||b;return w.defaultView||w.parentWindow||t}var wt=/mobile|tablet|ip(ad|hone|od)|android/i,C="ontouchstart"in t,m=ue(t,"PointerEvent")!==r,A=C&&wt.test(navigator.userAgent),O="touch",T="pen",L="mouse",G="kinect",oe=25,se=1,Se=2,be=4,me=8,nt=1,dt=2,ke=4,je=8,St=16,$t=dt|ke,gt=je|St,$e=$t|gt,zt=["x","y"],we=["clientX","clientY"];function it(b,w){var P=this;this.manager=b,this.callback=w,this.element=b.element,this.target=b.options.inputTarget,this.domHandler=function(I){x(b.options.enable,[b])&&P.handler(I)},this.init()}it.prototype={handler:function(){},init:function(){this.evEl&&M(this.element,this.evEl,this.domHandler),this.evTarget&&M(this.target,this.evTarget,this.domHandler),this.evWin&&M(pe(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&j(this.element,this.evEl,this.domHandler),this.evTarget&&j(this.target,this.evTarget,this.domHandler),this.evWin&&j(pe(this.element),this.evWin,this.domHandler)}};function Is(b){var w,P=b.options.inputClass;return P?w=P:m?w=ql:A?w=Fs:C?w=Kl:w=zs,new w(b,Ft)}function Ft(b,w,P){var I=P.pointers.length,H=P.changedPointers.length,te=w&se&&I-H===0,_e=w&(be|me)&&I-H===0;P.isFirst=!!te,P.isFinal=!!_e,te&&(b.session={}),P.eventType=w,Q(b,P),b.emit("hammer.input",P),b.recognize(P),b.session.prevInput=P}function Q(b,w){var P=b.session,I=w.pointers,H=I.length;P.firstInput||(P.firstInput=Dy(w)),H>1&&!P.firstMultiple?P.firstMultiple=Dy(w):H===1&&(P.firstMultiple=!1);var te=P.firstInput,_e=P.firstMultiple,Ge=_e?_e.center:te.center,cn=w.center=By(I);w.timeStamp=l(),w.deltaTime=w.timeStamp-te.timeStamp,w.angle=Ul(Ge,cn),w.distance=$s(Ge,cn),Pe(P,w),w.offsetDirection=Oy(w.deltaX,w.deltaY);var Ht=Ny(w.deltaTime,w.deltaX,w.deltaY);w.overallVelocityX=Ht.x,w.overallVelocityY=Ht.y,w.overallVelocity=p(Ht.x)>p(Ht.y)?Ht.x:Ht.y,w.scale=_e?R2(_e.pointers,I):1,w.rotation=_e?C2(_e.pointers,I):0,w.maxPointers=P.prevInput?w.pointers.length>P.prevInput.maxPointers?w.pointers.length:P.prevInput.maxPointers:w.pointers.length,S2(P,w);var Rn=b.element;B(w.srcEvent.target,Rn)&&(Rn=w.srcEvent.target),w.target=Rn}function Pe(b,w){var P=w.center,I=b.offsetDelta||{},H=b.prevDelta||{},te=b.prevInput||{};(w.eventType===se||te.eventType===be)&&(H=b.prevDelta={x:te.deltaX||0,y:te.deltaY||0},I=b.offsetDelta={x:P.x,y:P.y}),w.deltaX=H.x+(P.x-I.x),w.deltaY=H.y+(P.y-I.y)}function S2(b,w){var P=b.lastInterval||w,I=w.timeStamp-P.timeStamp,H,te,_e,Ge;if(w.eventType!=me&&(I>oe||P.velocity===r)){var cn=w.deltaX-P.deltaX,Ht=w.deltaY-P.deltaY,Rn=Ny(I,cn,Ht);te=Rn.x,_e=Rn.y,H=p(Rn.x)>p(Rn.y)?Rn.x:Rn.y,Ge=Oy(cn,Ht),b.lastInterval=w}else H=P.velocity,te=P.velocityX,_e=P.velocityY,Ge=P.direction;w.velocity=H,w.velocityX=te,w.velocityY=_e,w.direction=Ge}function Dy(b){for(var w=[],P=0;P<b.pointers.length;)w[P]={clientX:c(b.pointers[P].clientX),clientY:c(b.pointers[P].clientY)},P++;return{timeStamp:l(),pointers:w,center:By(w),deltaX:b.deltaX,deltaY:b.deltaY}}function By(b){var w=b.length;if(w===1)return{x:c(b[0].clientX),y:c(b[0].clientY)};for(var P=0,I=0,H=0;H<w;)P+=b[H].clientX,I+=b[H].clientY,H++;return{x:c(P/w),y:c(I/w)}}function Ny(b,w,P){return{x:w/b||0,y:P/b||0}}function Oy(b,w){return b===w?nt:p(b)>=p(w)?b<0?dt:ke:w<0?je:St}function $s(b,w,P){P||(P=zt);var I=w[P[0]]-b[P[0]],H=w[P[1]]-b[P[1]];return Math.sqrt(I*I+H*H)}function Ul(b,w,P){P||(P=zt);var I=w[P[0]]-b[P[0]],H=w[P[1]]-b[P[1]];return Math.atan2(H,I)*180/Math.PI}function C2(b,w){return Ul(w[1],w[0],we)+Ul(b[1],b[0],we)}function R2(b,w){return $s(w[0],w[1],we)/$s(b[0],b[1],we)}var P2={mousedown:se,mousemove:Se,mouseup:be},k2="mousedown",T2="mousemove mouseup";function zs(){this.evEl=k2,this.evWin=T2,this.pressed=!1,it.apply(this,arguments)}E(zs,it,{handler:function(b){var w=P2[b.type];w&se&&b.button===0&&(this.pressed=!0),w&Se&&b.which!==1&&(w=be),this.pressed&&(w&be&&(this.pressed=!1),this.callback(this.manager,w,{pointers:[b],changedPointers:[b],pointerType:L,srcEvent:b}))}});var A2={pointerdown:se,pointermove:Se,pointerup:be,pointercancel:me,pointerout:me},M2={2:O,3:T,4:L,5:G},jy="pointerdown",Ly="pointermove pointerup pointercancel";t.MSPointerEvent&&!t.PointerEvent&&(jy="MSPointerDown",Ly="MSPointerMove MSPointerUp MSPointerCancel");function ql(){this.evEl=jy,this.evWin=Ly,it.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}E(ql,it,{handler:function(b){var w=this.store,P=!1,I=b.type.toLowerCase().replace("ms",""),H=A2[I],te=M2[b.pointerType]||b.pointerType,_e=te==O,Ge=z(w,b.pointerId,"pointerId");H&se&&(b.button===0||_e)?Ge<0&&(w.push(b),Ge=w.length-1):H&(be|me)&&(P=!0),!(Ge<0)&&(w[Ge]=b,this.callback(this.manager,H,{pointers:w,changedPointers:[b],pointerType:te,srcEvent:b}),P&&w.splice(Ge,1))}});var D2={touchstart:se,touchmove:Se,touchend:be,touchcancel:me},B2="touchstart",N2="touchstart touchmove touchend touchcancel";function Iy(){this.evTarget=B2,this.evWin=N2,this.started=!1,it.apply(this,arguments)}E(Iy,it,{handler:function(b){var w=D2[b.type];if(w===se&&(this.started=!0),!!this.started){var P=O2.call(this,b,w);w&(be|me)&&P[0].length-P[1].length===0&&(this.started=!1),this.callback(this.manager,w,{pointers:P[0],changedPointers:P[1],pointerType:O,srcEvent:b})}}});function O2(b,w){var P=F(b.touches),I=F(b.changedTouches);return w&(be|me)&&(P=U(P.concat(I),"identifier",!0)),[P,I]}var j2={touchstart:se,touchmove:Se,touchend:be,touchcancel:me},L2="touchstart touchmove touchend touchcancel";function Fs(){this.evTarget=L2,this.targetIds={},it.apply(this,arguments)}E(Fs,it,{handler:function(b){var w=j2[b.type],P=I2.call(this,b,w);P&&this.callback(this.manager,w,{pointers:P[0],changedPointers:P[1],pointerType:O,srcEvent:b})}});function I2(b,w){var P=F(b.touches),I=this.targetIds;if(w&(se|Se)&&P.length===1)return I[P[0].identifier]=!0,[P,P];var H,te,_e=F(b.changedTouches),Ge=[],cn=this.target;if(te=P.filter(function(Ht){return B(Ht.target,cn)}),w===se)for(H=0;H<te.length;)I[te[H].identifier]=!0,H++;for(H=0;H<_e.length;)I[_e[H].identifier]&&Ge.push(_e[H]),w&(be|me)&&delete I[_e[H].identifier],H++;if(Ge.length)return[U(te.concat(Ge),"identifier",!0),Ge]}var $2=2500,$y=25;function Kl(){it.apply(this,arguments);var b=_(this.handler,this);this.touch=new Fs(this.manager,b),this.mouse=new zs(this.manager,b),this.primaryTouch=null,this.lastTouches=[]}E(Kl,it,{handler:function(b,w,P){var I=P.pointerType==O,H=P.pointerType==L;if(!(H&&P.sourceCapabilities&&P.sourceCapabilities.firesTouchEvents)){if(I)z2.call(this,w,P);else if(H&&F2.call(this,P))return;this.callback(b,w,P)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function z2(b,w){b&se?(this.primaryTouch=w.changedPointers[0].identifier,zy.call(this,w)):b&(be|me)&&zy.call(this,w)}function zy(b){var w=b.changedPointers[0];if(w.identifier===this.primaryTouch){var P={x:w.clientX,y:w.clientY};this.lastTouches.push(P);var I=this.lastTouches,H=function(){var te=I.indexOf(P);te>-1&&I.splice(te,1)};setTimeout(H,$2)}}function F2(b){for(var w=b.srcEvent.clientX,P=b.srcEvent.clientY,I=0;I<this.lastTouches.length;I++){var H=this.lastTouches[I],te=Math.abs(w-H.x),_e=Math.abs(P-H.y);if(te<=$y&&_e<=$y)return!0}return!1}var Fy=ue(a.style,"touchAction"),Hy=Fy!==r,Gy="compute",Vy="auto",Yl="manipulation",Wi="none",Mo="pan-x",Do="pan-y",Hs=G2();function Xl(b,w){this.manager=b,this.set(w)}Xl.prototype={set:function(b){b==Gy&&(b=this.compute()),Hy&&this.manager.element.style&&Hs[b]&&(this.manager.element.style[Fy]=b),this.actions=b.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var b=[];return d(this.manager.recognizers,function(w){x(w.options.enable,[w])&&(b=b.concat(w.getTouchAction()))}),H2(b.join(" "))},preventDefaults:function(b){var w=b.srcEvent,P=b.offsetDirection;if(this.manager.session.prevented){w.preventDefault();return}var I=this.actions,H=D(I,Wi)&&!Hs[Wi],te=D(I,Do)&&!Hs[Do],_e=D(I,Mo)&&!Hs[Mo];if(H){var Ge=b.pointers.length===1,cn=b.distance<2,Ht=b.deltaTime<250;if(Ge&&cn&&Ht)return}if(!(_e&&te)&&(H||te&&P&$t||_e&&P&gt))return this.preventSrc(w)},preventSrc:function(b){this.manager.session.prevented=!0,b.preventDefault()}};function H2(b){if(D(b,Wi))return Wi;var w=D(b,Mo),P=D(b,Do);return w&&P?Wi:w||P?w?Mo:Do:D(b,Yl)?Yl:Vy}function G2(){if(!Hy)return!1;var b={},w=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(P){b[P]=w?t.CSS.supports("touch-action",P):!0}),b}var Gs=1,en=2,_r=4,Ei=8,Un=Ei,Bo=16,Cn=32;function qn(b){this.options=v({},this.defaults,b||{}),this.id=Re(),this.manager=null,this.options.enable=S(this.options.enable,!0),this.state=Gs,this.simultaneous={},this.requireFail=[]}qn.prototype={defaults:{},set:function(b){return v(this.options,b),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(b){if(h(b,"recognizeWith",this))return this;var w=this.simultaneous;return b=Vs(b,this),w[b.id]||(w[b.id]=b,b.recognizeWith(this)),this},dropRecognizeWith:function(b){return h(b,"dropRecognizeWith",this)?this:(b=Vs(b,this),delete this.simultaneous[b.id],this)},requireFailure:function(b){if(h(b,"requireFailure",this))return this;var w=this.requireFail;return b=Vs(b,this),z(w,b)===-1&&(w.push(b),b.requireFailure(this)),this},dropRequireFailure:function(b){if(h(b,"dropRequireFailure",this))return this;b=Vs(b,this);var w=z(this.requireFail,b);return w>-1&&this.requireFail.splice(w,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(b){return!!this.simultaneous[b.id]},emit:function(b){var w=this,P=this.state;function I(H){w.manager.emit(H,b)}P<Ei&&I(w.options.event+Wy(P)),I(w.options.event),b.additionalEvent&&I(b.additionalEvent),P>=Ei&&I(w.options.event+Wy(P))},tryEmit:function(b){if(this.canEmit())return this.emit(b);this.state=Cn},canEmit:function(){for(var b=0;b<this.requireFail.length;){if(!(this.requireFail[b].state&(Cn|Gs)))return!1;b++}return!0},recognize:function(b){var w=v({},b);if(!x(this.options.enable,[this,w])){this.reset(),this.state=Cn;return}this.state&(Un|Bo|Cn)&&(this.state=Gs),this.state=this.process(w),this.state&(en|_r|Ei|Bo)&&this.tryEmit(w)},process:function(b){},getTouchAction:function(){},reset:function(){}};function Wy(b){return b&Bo?"cancel":b&Ei?"end":b&_r?"move":b&en?"start":""}function Uy(b){return b==St?"down":b==je?"up":b==dt?"left":b==ke?"right":""}function Vs(b,w){var P=w.manager;return P?P.get(b):b}function sn(){qn.apply(this,arguments)}E(sn,qn,{defaults:{pointers:1},attrTest:function(b){var w=this.options.pointers;return w===0||b.pointers.length===w},process:function(b){var w=this.state,P=b.eventType,I=w&(en|_r),H=this.attrTest(b);return I&&(P&me||!H)?w|Bo:I||H?P&be?w|Ei:w&en?w|_r:en:Cn}});function Ws(){sn.apply(this,arguments),this.pX=null,this.pY=null}E(Ws,sn,{defaults:{event:"pan",threshold:10,pointers:1,direction:$e},getTouchAction:function(){var b=this.options.direction,w=[];return b&$t&&w.push(Do),b&gt&&w.push(Mo),w},directionTest:function(b){var w=this.options,P=!0,I=b.distance,H=b.direction,te=b.deltaX,_e=b.deltaY;return H&w.direction||(w.direction&$t?(H=te===0?nt:te<0?dt:ke,P=te!=this.pX,I=Math.abs(b.deltaX)):(H=_e===0?nt:_e<0?je:St,P=_e!=this.pY,I=Math.abs(b.deltaY))),b.direction=H,P&&I>w.threshold&&H&w.direction},attrTest:function(b){return sn.prototype.attrTest.call(this,b)&&(this.state&en||!(this.state&en)&&this.directionTest(b))},emit:function(b){this.pX=b.deltaX,this.pY=b.deltaY;var w=Uy(b.direction);w&&(b.additionalEvent=this.options.event+w),this._super.emit.call(this,b)}});function Zl(){sn.apply(this,arguments)}E(Zl,sn,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Wi]},attrTest:function(b){return this._super.attrTest.call(this,b)&&(Math.abs(b.scale-1)>this.options.threshold||this.state&en)},emit:function(b){if(b.scale!==1){var w=b.scale<1?"in":"out";b.additionalEvent=this.options.event+w}this._super.emit.call(this,b)}});function Ql(){qn.apply(this,arguments),this._timer=null,this._input=null}E(Ql,qn,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Vy]},process:function(b){var w=this.options,P=b.pointers.length===w.pointers,I=b.distance<w.threshold,H=b.deltaTime>w.time;if(this._input=b,!I||!P||b.eventType&(be|me)&&!H)this.reset();else if(b.eventType&se)this.reset(),this._timer=u(function(){this.state=Un,this.tryEmit()},w.time,this);else if(b.eventType&be)return Un;return Cn},reset:function(){clearTimeout(this._timer)},emit:function(b){this.state===Un&&(b&&b.eventType&be?this.manager.emit(this.options.event+"up",b):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}});function Jl(){sn.apply(this,arguments)}E(Jl,sn,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Wi]},attrTest:function(b){return this._super.attrTest.call(this,b)&&(Math.abs(b.rotation)>this.options.threshold||this.state&en)}});function eu(){sn.apply(this,arguments)}E(eu,sn,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:$t|gt,pointers:1},getTouchAction:function(){return Ws.prototype.getTouchAction.call(this)},attrTest:function(b){var w=this.options.direction,P;return w&($t|gt)?P=b.overallVelocity:w&$t?P=b.overallVelocityX:w&gt&&(P=b.overallVelocityY),this._super.attrTest.call(this,b)&&w&b.offsetDirection&&b.distance>this.options.threshold&&b.maxPointers==this.options.pointers&&p(P)>this.options.velocity&&b.eventType&be},emit:function(b){var w=Uy(b.offsetDirection);w&&this.manager.emit(this.options.event+w,b),this.manager.emit(this.options.event,b)}});function Us(){qn.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}E(Us,qn,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Yl]},process:function(b){var w=this.options,P=b.pointers.length===w.pointers,I=b.distance<w.threshold,H=b.deltaTime<w.time;if(this.reset(),b.eventType&se&&this.count===0)return this.failTimeout();if(I&&H&&P){if(b.eventType!=be)return this.failTimeout();var te=this.pTime?b.timeStamp-this.pTime<w.interval:!0,_e=!this.pCenter||$s(this.pCenter,b.center)<w.posThreshold;this.pTime=b.timeStamp,this.pCenter=b.center,!_e||!te?this.count=1:this.count+=1,this._input=b;var Ge=this.count%w.taps;if(Ge===0)return this.hasRequireFailures()?(this._timer=u(function(){this.state=Un,this.tryEmit()},w.interval,this),en):Un}return Cn},failTimeout:function(){return this._timer=u(function(){this.state=Cn},this.options.interval,this),Cn},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Un&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Kn(b,w){return w=w||{},w.recognizers=S(w.recognizers,Kn.defaults.preset),new tu(b,w)}Kn.VERSION="2.0.7",Kn.defaults={domEvents:!1,touchAction:Gy,enable:!0,inputTarget:null,inputClass:null,preset:[[Jl,{enable:!1}],[Zl,{enable:!1},["rotate"]],[eu,{direction:$t}],[Ws,{direction:$t},["swipe"]],[Us],[Us,{event:"doubletap",taps:2},["tap"]],[Ql]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var V2=1,qy=2;function tu(b,w){this.options=v({},Kn.defaults,w||{}),this.options.inputTarget=this.options.inputTarget||b,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=b,this.input=Is(this),this.touchAction=new Xl(this,this.options.touchAction),Ky(this,!0),d(this.options.recognizers,function(P){var I=this.add(new P[0](P[1]));P[2]&&I.recognizeWith(P[2]),P[3]&&I.requireFailure(P[3])},this)}tu.prototype={set:function(b){return v(this.options,b),b.touchAction&&this.touchAction.update(),b.inputTarget&&(this.input.destroy(),this.input.target=b.inputTarget,this.input.init()),this},stop:function(b){this.session.stopped=b?qy:V2},recognize:function(b){var w=this.session;if(!w.stopped){this.touchAction.preventDefaults(b);var P,I=this.recognizers,H=w.curRecognizer;(!H||H&&H.state&Un)&&(H=w.curRecognizer=null);for(var te=0;te<I.length;)P=I[te],w.stopped!==qy&&(!H||P==H||P.canRecognizeWith(H))?P.recognize(b):P.reset(),!H&&P.state&(en|_r|Ei)&&(H=w.curRecognizer=P),te++}},get:function(b){if(b instanceof qn)return b;for(var w=this.recognizers,P=0;P<w.length;P++)if(w[P].options.event==b)return w[P];return null},add:function(b){if(h(b,"add",this))return this;var w=this.get(b.options.event);return w&&this.remove(w),this.recognizers.push(b),b.manager=this,this.touchAction.update(),b},remove:function(b){if(h(b,"remove",this))return this;if(b=this.get(b),b){var w=this.recognizers,P=z(w,b);P!==-1&&(w.splice(P,1),this.touchAction.update())}return this},on:function(b,w){if(b!==r&&w!==r){var P=this.handlers;return d($(b),function(I){P[I]=P[I]||[],P[I].push(w)}),this}},off:function(b,w){if(b!==r){var P=this.handlers;return d($(b),function(I){w?P[I]&&P[I].splice(z(P[I],w),1):delete P[I]}),this}},emit:function(b,w){this.options.domEvents&&W2(b,w);var P=this.handlers[b]&&this.handlers[b].slice();if(!(!P||!P.length)){w.type=b,w.preventDefault=function(){w.srcEvent.preventDefault()};for(var I=0;I<P.length;)P[I](w),I++}},destroy:function(){this.element&&Ky(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Ky(b,w){var P=b.element;if(P.style){var I;d(b.options.cssProps,function(H,te){I=ue(P.style,te),w?(b.oldCssProps[I]=P.style[I],P.style[I]=H):P.style[I]=b.oldCssProps[I]||""}),w||(b.oldCssProps={})}}function W2(b,w){var P=n.createEvent("Event");P.initEvent(b,!0,!0),P.gesture=w,w.target.dispatchEvent(P)}v(Kn,{INPUT_START:se,INPUT_MOVE:Se,INPUT_END:be,INPUT_CANCEL:me,STATE_POSSIBLE:Gs,STATE_BEGAN:en,STATE_CHANGED:_r,STATE_ENDED:Ei,STATE_RECOGNIZED:Un,STATE_CANCELLED:Bo,STATE_FAILED:Cn,DIRECTION_NONE:nt,DIRECTION_LEFT:dt,DIRECTION_RIGHT:ke,DIRECTION_UP:je,DIRECTION_DOWN:St,DIRECTION_HORIZONTAL:$t,DIRECTION_VERTICAL:gt,DIRECTION_ALL:$e,Manager:tu,Input:it,TouchAction:Xl,TouchInput:Fs,MouseInput:zs,PointerEventInput:ql,TouchMouseInput:Kl,SingleTouchInput:Iy,Recognizer:qn,AttrRecognizer:sn,Tap:Us,Pan:Ws,Swipe:eu,Pinch:Zl,Rotate:Jl,Press:Ql,on:M,off:j,each:d,merge:R,extend:g,assign:v,inherit:E,bindFn:_,prefixed:ue});var U2=typeof t<"u"?t:typeof self<"u"?self:{};U2.Hammer=Kn,typeof r=="function"&&r.amd?r(function(){return Kn}):e.exports?e.exports=Kn:t[i]=Kn})(window,document,"Hammer")})(sd);var e1=sd.exports;const Bi=Ks(e1);var t1=.2,n1=4,cd=["mousedown","mouseup","mouseover","mouseout","click","dblclick"];function _a(e,t){return t.get(e,!1)}function Vc(e){e.preventDefault(),typeof e.stopPropagation=="function"?e.stopPropagation():e.srcEvent&&typeof e.srcEvent.stopPropagation=="function"&&e.srcEvent.stopPropagation(),typeof e.stopImmediatePropagation=="function"&&e.stopImmediatePropagation()}function Wc(e){function t(p){k(cd,function(l){J.bind(e,l,Vc,!0)})}function n(p){setTimeout(function(){k(cd,function(l){J.unbind(e,l,Vc,!0)})},500)}J.bind(e,"touchstart",t,!0),J.bind(e,"touchend",n,!0),J.bind(e,"touchcancel",n,!0);var i=new Bi.Manager(e,{inputClass:Bi.TouchInput,recognizers:[],domEvents:!0}),r=new Bi.Tap,o=new Bi.Pan({threshold:10}),a=new Bi.Press,s=new Bi.Pinch,c=new Bi.Tap({event:"doubletap",taps:2});return s.requireFailure(o),s.requireFailure(a),i.add([o,a,s,c,r]),i.reset=function(p){var l=this.recognizers,u=this.session;u.stopped||(i.stop(p),setTimeout(function(){var h,d;for(h=0;d=l[h];h++)d.reset(),d.state=8;u.curRecognizer=null},0))},i.on("hammer.input",function(p){p.srcEvent.defaultPrevented&&i.reset(!0)}),i}function pd(e,t,n,i,r){var o=_a("dragging",e),a=_a("move",e),s=_a("contextPad",e),c=_a("palette",e),p;function l(d,f){return function(v){var g=u(v.target),R=g&&i.get(g);return f&&(v.srcEvent.button=f),r.fire(d,v,R)}}function u(d){var f=Mn(d,"svg, .djs-element",!0);return f}function h(d){p=Wc(d);function f(R){var E=0,_=0;function x(M){var j=M.deltaX-E,B=M.deltaY-_;t.scroll({dx:j,dy:B}),E=M.deltaX,_=M.deltaY}function S(M){p.off("panmove",x),p.off("panend",S),p.off("pancancel",S)}p.on("panmove",x),p.on("panend",S),p.on("pancancel",S)}function v(R){var E=u(R.target),_=E&&i.get(E);if(a&&t.getRootElement()!==_)return a.start(R,_,!0);f()}function g(R){var E=t.zoom(),_=R.center;function x(M){var j=1-(1-M.scale)/1.5,B=Math.max(t1,Math.min(n1,j*E));t.zoom(B,_),Vc(M)}function S(M){p.off("pinchmove",x),p.off("pinchend",S),p.off("pinchcancel",S),p.reset(!0)}p.on("pinchmove",x),p.on("pinchend",S),p.on("pinchcancel",S)}p.on("tap",l("element.click")),p.on("doubletap",l("element.dblclick",1)),p.on("panstart",v),p.on("press",v),p.on("pinchstart",g)}o&&n.on("drag.move",function(d){var f=d.originalEvent;if(!(!f||f instanceof MouseEvent)){var v=oi(f),g=document.elementFromPoint(v.x,v.y),R=u(g),E=R&&i.get(R);E!==d.hover&&(d.hover&&o.out(d),E&&(o.hover({element:E,gfx:R}),d.hover=E,d.hoverGfx=R))}}),s&&n.on("contextPad.create",function(d){var f=d.pad.html,v=Wc(f);v.on("panstart",function(g){s.trigger("dragstart",g,!0)}),v.on("press",function(g){s.trigger("dragstart",g,!0)}),v.on("tap",function(g){s.trigger("click",g)})}),c&&n.on("palette.create",function(d){var f=d.container,v=Wc(f);v.on("panstart",function(g){c.trigger("dragstart",g,!0)}),v.on("press",function(g){c.trigger("dragstart",g,!0)}),v.on("tap",function(g){c.trigger("click",g)})}),n.on("canvas.init",function(d){h(d.svg)})}pd.$inject=["injector","canvas","eventBus","elementRegistry","interactionEvents","touchFix"];function Uc(e){var t=this;e.on("canvas.init",function(n){t.addBBoxMarker(n.svg)})}Uc.$inject=["eventBus"],Uc.prototype.addBBoxMarker=function(e){var t={fill:"none",class:"outer-bound-marker"},n=Z("rect");Y(n,{x:-1e4,y:1e4,width:10,height:10}),Y(n,t),ee(e,n);var i=Z("rect");Y(i,{x:1e4,y:1e4,width:10,height:10}),Y(i,t),ee(e,i)};const i1={__depends__:[Fr],__init__:["touchInteractionEvents"],touchInteractionEvents:["type",pd],touchFix:["type",Uc]},r1={__depends__:[i1]};function qc(e){return e&&e[e.length-1]}function ld(e){return e.y}function ud(e){return e.x}var o1={left:ud,center:ud,right:function(e){return e.x+e.width},top:ld,middle:ld,bottom:function(e){return e.y+e.height}};function ar(e,t){this._modeling=e,this._rules=t}ar.$inject=["modeling","rules"],ar.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}},ar.prototype._isType=function(e,t){return t.indexOf(e)!==-1},ar.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,p,l;function u(h,d){return Math.round((h[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=qc(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(k(t,function(h){var d=h[i]+Math.round(h[r]/2);a[d]?a[d].elements.push(h):a[d]={elements:[h],center:d}}),c=ln(a,function(h){return h.elements.length>1&&(s=!0),h.elements.length}),s)return o[e]=qc(c).center,o;p=t[0],t=ln(t,function(h){return h[i]+h[r]}),l=qc(t),o[e]=u(p,l)}return o},ar.prototype.trigger=function(e,t){var n=this._modeling,i,r=ce(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),le(i)&&(r=i),!(r.length<2||!i)){var o=o1[t],a=ln(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const a1={__init__:["alignElements"],alignElements:["type",ar]};var Ea=".entry",s1=1e3,hd=12,c1=300;function _t(e,t,n,i){this._canvas=e,this._eventBus=n,this._overlays=i;var r=ot(t&&t.scale)?t.scale:{min:1,max:1.5};this._overlaysConfig={scale:r},this._current=null,this._init()}_t.$inject=["canvas","config.contextPad","eventBus","overlays"],_t.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=kn(le(r)?r:[r],function(a){return dd(n,a)});o&&e.open(r,!0)}})},_t.prototype.registerProvider=function(e,t){t||(t=e,e=s1),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},_t.prototype.getEntries=function(e){var t=this._getProviders(),n=le(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return k(t,function(r){if(pt(r[n])){var o=r[n](e);pt(o)?i=o(i):k(o,function(a,s){i[s]=a})}}),i},_t.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=ft(o,"data-action"),r=t.originalEvent||t,e==="mouseover"?this._timeout=setTimeout(()=>{this._mouseout=this.triggerEntry(i,"hover",r,n)},c1):e==="mouseout"&&(clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null)),this.triggerEntry(i,e,r,n)):t.preventDefault()},_t.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(pt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},_t.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},_t.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},_t.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this.getPad(e),i=n.html,r;k(t,function(o,a){var s=o.group||"default",c=Me(o.html||'<div class="entry" draggable="true"></div>'),p;ft(c,"data-action",a),p=Ae("[data-group="+Hr(s)+"]",i),p||(p=Me('<div class="group"></div>'),ft(p,"data-group",s),i.appendChild(p)),p.appendChild(c),o.className&&p1(c,o.className),o.title&&ft(c,"title",o.title),o.imageUrl&&(r=Me("<img>"),ft(r,"src",o.imageUrl),r.style.width="100%",r.style.height="100%",c.appendChild(r))}),Je(i).add("open"),this._current={target:e,entries:t,pad:n},this._eventBus.fire("contextPad.open",{current:this._current})},_t.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,i=Me('<div class="djs-context-pad"></div>'),r=this._getPosition(e),o=N({html:i},this._overlaysConfig,r);Rt.bind(i,Ea,"click",function(c){t.trigger("click",c)}),Rt.bind(i,Ea,"dragstart",function(c){t.trigger("dragstart",c)}),Rt.bind(i,Ea,"mouseover",function(c){t.trigger("mouseover",c)}),Rt.bind(i,Ea,"mouseout",function(c){t.trigger("mouseout",c)}),J.bind(i,"mousedown",function(c){c.stopPropagation()});var a=this._canvas.getRootElement();this._overlayId=n.add(a,"context-pad",o);var s=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{target:e,pad:s}),s},_t.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},_t.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return le(e)!==le(n)?!1:le(e)?e.length===n.length&&Oo(e,function(i){return dd(n,i)}):n===e},_t.prototype.isShown=function(){return this.isOpen()&&this._overlays.isShown()},_t.prototype._getPosition=function(e){e=De(e)?l1(e):e;var t=le(e)?e:[e],n=Ve(t);return{position:{left:n.x+n.width+hd,top:n.y-hd/2}}};function p1(e,t){var n=Je(e);t=le(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function dd(e,t){return e.indexOf(t)!==-1}function l1(e){return e.waypoints[e.waypoints.length-1]}const fd={__depends__:[Fr,ya],contextPad:["type",_t]};var md=function(e,t,n,i){var r;t[0]=0;for(var o=1;o<t.length;o++){var a=t[o++],s=t[o]?(t[0]|=a?1:2,n[t[o++]]):t[++o];a===3?i[0]=s:a===4?i[1]=Object.assign(i[1]||{},s):a===5?(i[1]=i[1]||{})[t[++o]]=s:a===6?i[1][t[++o]]+=s+"":a?(r=e.apply(s,md(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},vd=new Map;function u1(e){var t=vd.get(this);return t||(t=new Map,vd.set(this,t)),(t=md(this,t.get(e)||(t.set(e,t=function(n){for(var i,r,o=1,a="",s="",c=[0],p=function(h){o===1&&(h||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,h,a):o===3&&(h||a)?(c.push(3,h,a),o=2):o===2&&a==="..."&&h?c.push(4,h,0):o===2&&a&&!h?c.push(5,0,!0,a):o>=5&&((a||!h&&o===5)&&(c.push(o,0,a,r),o=6),h&&(c.push(o,h,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&p(),p(l));for(var u=0;u<n[l].length;u++)i=n[l][u],o===1?i==="<"?(p(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(p(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][u+1]===">")?(p(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
  12. `||i==="\r"?(p(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return p(),c}(e)),t),arguments,[])).length>1?t:t[0]}var Qe=u1.bind(nk),sr,qe,Kc,yd,Wr=0,gd=[],wa=[],bd=at.__b,xd=at.__r,_d=at.diffed,Ed=at.__c,wd=at.unmount;function Sa(e,t){at.__h&&at.__h(qe,e,Wr||t),Wr=0;var n=qe.__H||(qe.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:wa}),n.__[e]}function Yc(e){return Wr=1,h1(Cd,e)}function h1(e,t,n){var i=Sa(sr++,2);if(i.t=e,!i.__c&&(i.__=[n?n(t):Cd(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],p=i.t(c,s);c!==p&&(i.__N=[p,i.__[1]],i.__c.setState({}))}],i.__c=qe,!qe.u)){var r=function(s,c,p){if(!i.__c.__H)return!0;var l=i.__c.__H.__.filter(function(h){return h.__c});if(l.every(function(h){return!h.__N}))return!o||o.call(this,s,c,p);var u=!1;return l.forEach(function(h){if(h.__N){var d=h.__[0];h.__=h.__N,h.__N=void 0,d!==h.__[0]&&(u=!0)}}),!(!u&&i.__c.props===s)&&(!o||o.call(this,s,c,p))};qe.u=!0;var o=qe.shouldComponentUpdate,a=qe.componentWillUpdate;qe.componentWillUpdate=function(s,c,p){if(this.__e){var l=o;o=void 0,r(s,c,p),o=l}a&&a.call(this,s,c,p)},qe.shouldComponentUpdate=r}return i.__N||i.__}function Xc(e,t){var n=Sa(sr++,3);!at.__s&&Jc(n.__H,t)&&(n.__=e,n.i=t,qe.__H.__h.push(n))}function Ca(e,t){var n=Sa(sr++,4);!at.__s&&Jc(n.__H,t)&&(n.__=e,n.i=t,qe.__h.push(n))}function Zc(e){return Wr=5,Ur(function(){return{current:e}},[])}function Ur(e,t){var n=Sa(sr++,7);return Jc(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function cr(e,t){return Wr=8,Ur(function(){return e},t)}function d1(){for(var e;e=gd.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Ra),e.__H.__h.forEach(Qc),e.__H.__h=[]}catch(t){e.__H.__h=[],at.__e(t,e.__v)}}at.__b=function(e){qe=null,bd&&bd(e)},at.__r=function(e){xd&&xd(e),sr=0;var t=(qe=e.__c).__H;t&&(Kc===qe?(t.__h=[],qe.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=wa,n.__N=n.i=void 0})):(t.__h.forEach(Ra),t.__h.forEach(Qc),t.__h=[],sr=0)),Kc=qe},at.diffed=function(e){_d&&_d(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(gd.push(t)!==1&&yd===at.requestAnimationFrame||((yd=at.requestAnimationFrame)||f1)(d1)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==wa&&(n.__=n.__V),n.i=void 0,n.__V=wa})),Kc=qe=null},at.__c=function(e,t){t.some(function(n){try{n.__h.forEach(Ra),n.__h=n.__h.filter(function(i){return!i.__||Qc(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],at.__e(i,n.__v)}}),Ed&&Ed(e,t)},at.unmount=function(e){wd&&wd(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(i){try{Ra(i)}catch(r){t=r}}),n.__H=void 0,t&&at.__e(t,n.__v))};var Sd=typeof requestAnimationFrame=="function";function f1(e){var t,n=function(){clearTimeout(i),Sd&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);Sd&&(t=requestAnimationFrame(n))}function Ra(e){var t=qe,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),qe=t}function Qc(e){var t=qe;e.__c=e.__(),qe=t}function Jc(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Cd(e,t){return typeof t=="function"?t(e):t}function Rd(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Rd(e[t]))&&(i&&(i+=" "),i+=n);else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}function Pa(){for(var e,t,n=0,i="";n<arguments.length;)(e=arguments[n++])&&(t=Rd(e))&&(i&&(i+=" "),i+=t);return i}function m1(e){const{entry:t,selected:n,onMouseEnter:i,onMouseLeave:r,onAction:o}=e;return Qe`
  13. <li
  14. class=${Pa("entry",{selected:n})}
  15. data-id=${t.id}
  16. title=${t.title||t.label}
  17. onClick=${o}
  18. onMouseEnter=${i}
  19. onMouseLeave=${r}
  20. onDragStart=${a=>o(a,t,"dragstart")}
  21. draggable=${!0}
  22. >
  23. <div class="djs-popup-entry-content">
  24. <span
  25. class=${Pa("djs-popup-entry-name",t.className)}
  26. >
  27. ${t.imageUrl&&Qe`<img class="djs-popup-entry-icon" src=${t.imageUrl} alt="" />`||t.imageHtml&&Qe`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:t.imageHtml}} />`}
  28. ${t.label?Qe`
  29. <span class="djs-popup-label">
  30. ${t.label}
  31. </span>
  32. `:null}
  33. </span>
  34. ${t.description&&Qe`
  35. <span
  36. class="djs-popup-entry-description"
  37. title=${t.description}
  38. >
  39. ${t.description}
  40. </span>
  41. `}
  42. </div>
  43. ${t.documentationRef&&Qe`
  44. <div class="djs-popup-entry-docs">
  45. <a
  46. href="${t.documentationRef}"
  47. onClick=${a=>a.stopPropagation()}
  48. title="Open element documentation"
  49. target="_blank"
  50. rel="noopener"
  51. >
  52. <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
  53. <path fill-rule="evenodd" clip-rule="evenodd" d="M10.6368 10.6375V5.91761H11.9995V10.6382C11.9995 10.9973 11.8623 11.3141 11.5878 11.5885C11.3134 11.863 10.9966 12.0002 10.6375 12.0002H1.36266C0.982345 12.0002 0.660159 11.8681 0.396102 11.6041C0.132044 11.34 1.52588e-05 11.0178 1.52588e-05 10.6375V1.36267C1.52588e-05 0.98236 0.132044 0.660173 0.396102 0.396116C0.660159 0.132058 0.982345 2.95639e-05 1.36266 2.95639e-05H5.91624V1.36267H1.36266V10.6375H10.6368ZM12 0H7.2794L7.27873 1.36197H9.68701L3.06507 7.98391L4.01541 8.93425L10.6373 2.31231V4.72059H12V0Z" fill="#818798"/>
  54. </svg>
  55. </a>
  56. </div>
  57. `}
  58. </li>
  59. `}function v1(e){const s=e,{selectedEntry:t,setSelectedEntry:n,entries:i}=s,r=Zy(s,["selectedEntry","setSelectedEntry","entries"]),o=Zc(),a=Ur(()=>y1(i),[i]);return Ca(()=>{const c=o.current;if(!c)return;const p=c.querySelector(".selected");p&&g1(p)},[t]),Qe`
  60. <div class="djs-popup-results" ref=${o}>
  61. ${a.map(c=>Qe`
  62. ${c.name&&Qe`
  63. <div key=${c.id} class="entry-header" title=${c.name}>
  64. ${c.name}
  65. </div>
  66. `}
  67. <ul class="djs-popup-group" data-group=${c.id}>
  68. ${c.entries.map(p=>Qe`
  69. <${m1}
  70. key=${p.id}
  71. entry=${p}
  72. selected=${p===t}
  73. onMouseEnter=${()=>n(p)}
  74. onMouseLeave=${()=>n(null)}
  75. ...${r}
  76. />
  77. `)}
  78. </ul>
  79. `)}
  80. </div>
  81. `}function y1(e){const t=[],n=o=>t.find(a=>o.id===a.id),i=o=>!!n(o),r=o=>typeof o=="string"?{id:o}:o;return e.forEach(o=>{const a=o.group?r(o.group):{id:"default"};i(a)?n(a).entries.push(o):t.push(Pn(Ce({},a),{entries:[o]}))}),t}function g1(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}function b1(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:p,entries:l,onOpened:u,onClosed:h}=e,d=Ur(()=>ot(p)?l.length>5:!1,[p,l]),f=Zc(),[v,g]=Yc(""),R=cr((z,F)=>{if(!d)return z;const U=ue=>{if(!F)return(ue.rank||0)>=0;const It=[ue.description||"",ue.label||"",ue.search||""].join("---").toLowerCase();return F.toLowerCase().split(/\s/g).every(Re=>It.includes(Re))};return z.filter(U)},[d]),[E,_]=Yc(R(l,v)),[x,S]=Yc(E[0]),M=cr(z=>{(!x||!z.includes(x))&&S(z[0]),_(z)},[x,_,S]);Xc(()=>{M(R(l,v))},[v,l]),Xc(()=>{const z=F=>{if(F.key==="Escape")return F.preventDefault(),t()};return document.documentElement.addEventListener("keydown",z),()=>{document.documentElement.removeEventListener("keydown",z)}},[]),Ca(()=>{f.current&&f.current.focus()},[]);const j=cr(z=>{let F=E.indexOf(x)+z;F<0&&(F=E.length-1),F>=E.length&&(F=0),S(E[F])},[E,x,S]),B=cr(z=>{if(z.key==="Enter"&&x)return n(z,x);if(z.key==="ArrowUp"||z.key==="Tab"&&z.shiftKey)return j(-1),z.preventDefault();if(z.key==="ArrowDown"||z.key==="Tab")return j(1),z.preventDefault()},[n,t,x,j]),D=cr(z=>{Sr(z.target,"input")&&g(()=>z.target.value)},[g]);Xc(()=>(u(),()=>{h()}),[]);const $=Ur(()=>a||r.length>0,[a,r]);return Qe`
  82. <${Pd}
  83. onClose=${t}
  84. onKeyup=${D}
  85. onKeydown=${B}
  86. className=${i}
  87. position=${o}
  88. width=${s}
  89. scale=${c}
  90. >
  91. ${$&&Qe`
  92. <div class="djs-popup-header">
  93. <h3 class="djs-popup-title" title=${a}>${a}</h3>
  94. ${r.map(z=>Qe`
  95. <span
  96. class=${_1(z,z===x)}
  97. onClick=${F=>n(F,z)}
  98. title=${z.title||z.label}
  99. data-id=${z.id}
  100. onMouseEnter=${()=>S(z)}
  101. onMouseLeave=${()=>S(null)}
  102. >
  103. ${z.imageUrl&&Qe`<img class="djs-popup-entry-icon" src=${z.imageUrl} alt="" />`||z.imageHtml&&Qe`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:z.imageHtml}} />`}
  104. ${z.label?Qe`
  105. <span class="djs-popup-label">${z.label}</span>
  106. `:null}
  107. </span>
  108. `)}
  109. </div>
  110. `}
  111. ${l.length>0&&Qe`
  112. <div class="djs-popup-body">
  113. ${d&&Qe`
  114. <div class="djs-popup-search">
  115. <svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
  116. <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"/>
  117. </svg>
  118. <input
  119. ref=${f}
  120. type="text"
  121. />
  122. </div>
  123. `}
  124. <${v1}
  125. entries=${E}
  126. selectedEntry=${x}
  127. setSelectedEntry=${S}
  128. onAction=${n}
  129. />
  130. </div>
  131. ${E.length===0&&Qe`
  132. <div class="djs-popup-no-results">No matching entries found.</div>
  133. `}
  134. `}
  135. </${Pd}>
  136. `}function Pd(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,position:a}=e,s=Zc(),c=cr(p=>{Mn(p.target,".djs-popup",!0)||t()},[t]);return Ca(()=>{if(typeof a!="function")return;const p=s.current,l=a(p);p.style.left=`${l.x}px`,p.style.top=`${l.y}px`},[s.current,a]),Ca(()=>{s.current&&s.current.focus()},[]),Qe`
  137. <div
  138. class="djs-popup-backdrop"
  139. onClick=${c}
  140. >
  141. <div
  142. class=${Pa("djs-popup",r)}
  143. style=${x1(e)}
  144. onKeydown=${n}
  145. onKeyup=${i}
  146. ref=${s}
  147. tabIndex="-1"
  148. >
  149. ${o}
  150. </div>
  151. </div>
  152. `}function x1(e){return{transform:`scale(${e.scale})`,width:`${e.width}px`}}function _1(e,t){return Pa("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}var E1="data-id",kd=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],w1=1e3;function He(e,t,n){this._eventBus=t,this._canvas=n,this._current=null;var i=ot(e&&e.scale)?e.scale:{min:1,max:1.5};this._config={scale:i},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",r=>{const o=this.isOpen()&&this._current.target;r.element===o&&this._render()})}He.$inject=["config.popupMenu","eventBus","canvas"],He.prototype._render=function(){const{position:e,className:t,entries:n,headerEntries:i,options:r}=this._current,o=Object.entries(n).map(([p,l])=>Ce({id:p},l)),a=Object.entries(i).map(([p,l])=>Ce({id:p},l)),s=e&&(p=>this._ensureVisible(p,e)),c=this._updateScale(this._current.container);ig(Qe`
  153. <${b1}
  154. onClose=${p=>this.close(p)}
  155. onSelect=${(p,l,u)=>this.trigger(p,l,u)}
  156. position=${s}
  157. className=${t}
  158. entries=${o}
  159. headerEntries=${a}
  160. scale=${c}
  161. onOpened=${this._onOpened.bind(this)}
  162. onClosed=${this._onClosed.bind(this)}
  163. ...${Ce({},r)}
  164. />
  165. `,this._current.container)},He.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");this.isOpen()&&this.close();const{entries:r,headerEntries:o}=this._getContext(e,t);this._current={position:n,className:t,target:e,entries:r,headerEntries:o,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},He.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),r=this._getHeaderEntries(e,n);return{entries:i,headerEntries:r,empty:!(Object.keys(i).length||Object.keys(r).length)}},He.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._current=null)},He.prototype.reset=function(){const e=this._current.container;ig(null,e),dn(e)},He.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},He.prototype._onOpened=function(){this._emit("opened")},He.prototype._onClosed=function(){this._emit("closed")},He.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Me(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},He.prototype._bindAutoClose=function(){this._eventBus.once(kd,this.close,this)},He.prototype._unbindAutoClose=function(){this._eventBus.off(kd,this.close,this)},He.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,r=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),ot(n)&&e<n&&(r=n),ot(i)&&e>i&&(r=i)),r},He.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),r={},o=t.x,a=t.y;return t.x+i.width>n.width&&(r.x=!0),t.y+i.height>n.height&&(r.y=!0),r.x&&r.y?(o=t.x-i.width,a=t.y-i.height):r.x?(o=t.x-i.width,a=t.y):r.y&&t.y<i.height?(o=t.x,a=10):r.y&&(o=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:o,y:a}},He.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},He.prototype.registerProvider=function(e,t,n){n||(n=t,t=w1),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},He.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},He.prototype._getEntries=function(e,t){var n={};return k(t,function(i){if(!i.getPopupMenuEntries){k(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Tn(o,["id"])});return}var r=i.getPopupMenuEntries(e);pt(r)?n=r(n):k(r,function(o,a){n[a]=o})}),n},He.prototype._getHeaderEntries=function(e,t){var n={};return k(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;k(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Tn(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);pt(r)?n=r(n):k(r,function(o,a){n[a]=o})}),n},He.prototype.isOpen=function(){return!!this._current},He.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Mn(e.delegateTarget||e.target,".entry",!0),o=ft(r,E1);t=Ce({id:o},this._getEntry(o))}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(pt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},He.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};const ep={__init__:["popupMenu"],popupMenu:["type",He]};var S1={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
  166. <line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
  167. <rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
  168. <rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
  169. </svg>`,bottom:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
  170. <line x1="150" y1="1650" x2="1650" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
  171. <rect x="150" y="350" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
  172. <rect x="1050" y="850" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
  173. </svg>`,center:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
  174. <line x1="900" y1="150" x2="900" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
  175. <rect x="250" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
  176. <rect x="500" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
  177. </svg>`,left:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
  178. <line x1="100" y1="150" x2="100" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
  179. <rect x="100" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
  180. <rect x="100" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
  181. </svg>`,right:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
  182. <line x1="1650" y1="150" x2="1650" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
  183. <rect x="350" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
  184. <rect x="850" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
  185. </svg>`,top:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
  186. <line x1="150" y1="150" x2="1650" y2="150" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
  187. <rect x="150" y="150" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
  188. <rect x="1050" y="150" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
  189. </svg>`,middle:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
  190. <line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
  191. <rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
  192. <rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
  193. </svg>`};const Td=S1;var C1=900;function pr(e,t,n,i){e.registerProvider(C1,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}pr.$inject=["contextPad","popupMenu","translate","canvas"],pr.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&N(t,this._getEntries(e)),t},pr.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},pr.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Td.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);N(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},pr.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var R1=["left","center","right","top","middle","bottom"];function qr(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}qr.$inject=["popupMenu","alignElements","translate","rules"],qr.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&N(t,this._getEntries(e)),t},qr.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},qr.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return k(R1,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Td[o],action:function(){t.trigger(e,o),i.close()}}}),r};function qt(e){V.call(this,e),this.init()}qt.$inject=["eventBus"],q(qt,V),qt.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){i.canExecute(r,t,function(o,a,s){return n(o)},!0)})},qt.prototype.init=function(){};function ka(e){qt.call(this,e)}ka.$inject=["eventBus"],q(ka,qt),ka.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=ce(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Uo(n),n.length<2?!1:n})};const P1={__depends__:[a1,fd,ep],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",pr],alignElementsMenuProvider:["type",qr],bpmnAlignElements:["type",ka]};var k1=10,Ad=50,T1=250;function tp(e,t,n,i){for(var r;r=A1(e,n,t);)n=i(t,n,r);return n}function np(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,p=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-p+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+p+c)}}),r}}function A1(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=D1(e);return ye(r,function(o){if(o===n)return!1;var a=lt(o,i,k1);return a==="intersect"})}function M1(e,t){t||(t={});function n(f){return f.source===e?1:-1}var i=t.defaultDistance||Ad,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||T1,c=t.reference||"start";o||(o=O1);function p(f,v){return r==="n"?c==="start"?X(f).top-X(v).bottom:c==="center"?X(f).top-ne(v).y:X(f).top-X(v).top:r==="w"?c==="start"?X(f).left-X(v).right:c==="center"?X(f).left-ne(v).x:X(f).left-X(v).left:r==="s"?c==="start"?X(v).top-X(f).bottom:c==="center"?ne(v).y-X(f).bottom:X(v).bottom-X(f).bottom:c==="start"?X(v).left-X(f).right:c==="center"?ne(v).x-X(f).right:X(v).right-X(f).right}var l=e.incoming.filter(o).map(function(f){var v=a(f),g=v<0?p(f.source,e):p(e,f.source);return{id:f.source.id,distance:g,weight:v}}),u=e.outgoing.filter(o).map(function(f){var v=a(f),g=v>0?p(e,f.target):p(f.target,e);return{id:f.target.id,distance:g,weight:v}}),h=l.concat(u).reduce(function(f,v){return f[v.id+"__weight_"+v.weight]=v,f},{}),d=Gt(h,function(f,v){var g=v.distance,R=v.weight;return g<0||g>s||(f[String(g)]||(f[String(g)]=0),f[String(g)]+=1*R,(!f.distance||f[f.distance]<f[String(g)])&&(f.distance=g)),f},{});return d.distance||i}function D1(e){var t=ip(e);return e.host&&(t=t.concat(ip(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(ip(i))},[]))),t}function ip(e){return N1(e).concat(B1(e))}function B1(e){return e.incoming.map(function(t){return t.source})}function N1(e){return e.outgoing.map(function(t){return t.target})}function O1(){return!0}var j1=100;function Md(e,t,n){e.on("autoPlace",j1,function(i){var r=i.shape,o=i.source;return L1(o,r)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,r,o){e.fire("autoPlace.start",{source:i,shape:r});var a=e.fire("autoPlace",{source:i,shape:r}),s=t.appendShape(i,r,a,i.parent,o);return e.fire("autoPlace.end",{source:i,shape:s}),s}}Md.$inject=["eventBus","modeling","canvas"];function L1(e,t,n){n||(n={});var i=n.defaultDistance||Ad,r=ne(e),o=X(e);return{x:o.right+i+t.width/2,y:r.y}}function Dd(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Dd.$inject=["eventBus","selection"];const I1={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Md],autoPlaceSelectionBehavior:["type",Dd]};function Ta(e,t){for(Mt(t)&&(t=[t]);e=e.parent;)if(de(e,t))return e;return null}function Bd(e,t){if(y(t,"bpmn:TextAnnotation"))return F1(e,t);if(de(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return H1(e,t);if(y(t,"bpmn:FlowNode"))return $1(e,t)}function $1(e,t){var n=X(e),i=ne(e),r=M1(e,{filter:function(l){return y(l,"bpmn:SequenceFlow")}}),o=30,a=80,s="left";y(e,"bpmn:BoundaryEvent")&&(s=lt(e,e.host,-25),s.indexOf("top")!==-1&&(o*=-1));var c={x:n.right+r+t.width/2,y:i.y+z1(s,a)},p={y:{margin:o,minDistance:a}};return tp(e,t,c,np(p))}function z1(e,t){return e.includes("top")?-1*t:e.includes("bottom")?t:0}function F1(e,t){var n=X(e),i={x:n.right+t.width/2,y:n.top-50-t.height/2};De(e)&&(i=ne(e),i.x+=100,i.y-=50);var r={y:{margin:-30,minDistance:20}};return tp(e,t,i,np(r))}function H1(e,t){var n=X(e),i={x:n.right-10+t.width/2,y:n.bottom+40+t.width/2},r={x:{margin:30,minDistance:30}};return tp(e,t,i,np(r))}function Nd(e){e.on("autoPlace",function(t){var n=t.shape,i=t.source;return Bd(i,n)})}Nd.$inject=["eventBus"];const Od={__depends__:[I1],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Nd]};function In(e,t,n,i){V.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,p=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],p)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=Xs(iu(a.closure.topLevel)),c=a.hints,p=c?c.autoResize:!0;if(p!==!1){var l=No(s,function(u){return u.parent.id});k(l,function(u,h){le(p)&&(u=u.filter(function(d){return ye(p,hn({id:d.id}))})),r._expand(u,h)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,p=c.parent;s&&s.autoResize===!1||p&&r._expand([c],p)})}In.$inject=["eventBus","elementRegistry","modeling","rules"],q(In,V),In.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=X(Ve(e)),o=X(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),Zo(N({},o,a))},In.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(G1(i,t)){var r=V1(un(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},In.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},In.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},In.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function G1(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function V1(e,t){var n="";return e=X(e),t=X(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 Aa(e){e.invoke(In,this)}Aa.$inject=["injector"],q(Aa,In),Aa.prototype.resize=function(e,t,n){y(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Kr(e){qt.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Kr.$inject=["eventBus"],q(Kr,qt),Kr.prototype.canResize=function(e,t){return!1};function Ma(e,t){Kr.call(this,e),this._modeling=t}q(Ma,Kr),Ma.$inject=["eventBus","modeling"],Ma.prototype.canResize=function(e,t){if(y(t.di,"bpmndi:BPMNPlane")||!y(t,"bpmn:Participant")&&!y(t,"bpmn:Lane")&&!y(t,"bpmn:SubProcess"))return!1;var n=!0;return k(e,function(i){if(y(i,"bpmn:Lane")||xe(i)){n=!1;return}}),n};const W1={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Aa],bpmnAutoResizeProvider:["type",Ma]};var jd=1500;function Ld(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),p=c&&e.get(c);c&&p&&(a.stopPropagation(),r.hover({element:p,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",jd,function(s){o(s)})}),function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",jd,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=oi(a),c=document.elementFromPoint(s.x,s.y),U1(c)}}Ld.$inject=["elementRegistry","eventBus","injector"];function U1(e){return Mn(e,"svg, .djs-element",!0)}const q1={__init__:["hoverFix"],hoverFix:["type",Ld]};var lr=Math.round,Id="djs-drag-active";function Ni(e){e.preventDefault()}function K1(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function Y1(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function $d(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(_){var x=t.viewbox(),S=t._container.getBoundingClientRect();return{x:x.x+(_.x-S.left)/x.scale,y:x.y+(_.y-S.top)/x.scale}}function s(_,x){x=x||o;var S=e.createEvent(N({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+_,S)===!1?!1:e.fire(x.prefix+"."+_,S)}function c(_){var x=_.filter(function(S){return i.get(S.id)});x.length&&n.select(x)}function p(_,x){var S=o.payload,M=o.displacement,j=o.globalStart,B=oi(_),D=tn(B,j),$=o.localStart,z=a(B),F=tn(z,$);if(!o.active&&(x||Y1(D)>o.threshold)){if(N(S,{x:lr($.x+M.x),y:lr($.y+M.y),dx:0,dy:0},{originalEvent:_}),s("start")===!1)return g();o.active=!0,o.keepSelection||(S.previousSelection=n.get(),n.select(null)),o.cursor&&xa(o.cursor),t.addMarker(t.getRootElement(),Id)}Dc(_),o.active&&(N(S,{x:lr(z.x+M.x),y:lr(z.y+M.y),dx:lr(F.x),dy:lr(F.y)},{originalEvent:_}),s("move"))}function l(_){var x,S=!0;o.active&&(_&&(o.payload.originalEvent=_,Dc(_)),S=s("end")),S===!1&&s("rejected"),x=R(S!==!0),s("ended",x)}function u(_){tt("Escape",_)&&(Ni(_),g())}function h(_){var x;o.active&&(x=td(e),setTimeout(x,400),Ni(_)),l(_)}function d(_){p(_)}function f(_){var x=o.payload;x.hoverGfx=_.gfx,x.hover=_.element,s("hover")}function v(_){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function g(_){var x;if(o){var S=o.active;S&&s("cancel"),x=R(_),S&&s("canceled",x)}}function R(_){var x,S;s("cleanup"),ed(),o.trapClick?S=h:S=l,J.unbind(document,"mousemove",p),J.unbind(document,"dragstart",Ni),J.unbind(document,"selectstart",Ni),J.unbind(document,"mousedown",S,!0),J.unbind(document,"mouseup",S,!0),J.unbind(document,"keyup",u),J.unbind(document,"touchstart",d,!0),J.unbind(document,"touchcancel",g,!0),J.unbind(document,"touchmove",p,!0),J.unbind(document,"touchend",l,!0),e.off("element.hover",f),e.off("element.out",v),t.removeMarker(t.getRootElement(),Id);var M=o.payload.previousSelection;return _!==!1&&M&&!n.get().length&&c(M),x=o,o=null,x}function E(_,x,S,M){o&&g(!1),typeof x=="string"&&(M=S,S=x,x=null),M=N({},r,M||{});var j=M.data||{},B,D,$,z,F;M.trapClick?z=h:z=l,_?(B=nr(_)||_,D=oi(_),Dc(_),B.type==="dragstart"&&Ni(B)):(B=null,D={x:0,y:0}),$=a(D),x||(x=$),F=K1(B),o=N({prefix:S,data:j,payload:{},globalStart:D,displacement:tn(x,$),localStart:$,isTouch:F},M),M.manual||(F?(J.bind(document,"touchstart",d,!0),J.bind(document,"touchcancel",g,!0),J.bind(document,"touchmove",p,!0),J.bind(document,"touchend",l,!0)):(J.bind(document,"mousemove",p),J.bind(document,"dragstart",Ni),J.bind(document,"selectstart",Ni),J.bind(document,"mousedown",z,!0),J.bind(document,"mouseup",z,!0)),J.bind(document,"keyup",u),e.on("element.hover",f),e.on("element.out",v)),s("init"),M.autoActivate&&p(_,!0)}e.on("diagram.destroy",g),this.init=E,this.move=p,this.hover=f,this.out=v,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(_){N(r,_)}}$d.$inject=["eventBus","canvas","selection","elementRegistry"];const $n={__depends__:[q1,bn],dragging:["type",$d]};function ur(e,t,n){this._canvas=n,this._opts=N({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}ur.$inject=["config.autoScroll","eventBus","canvas"],ur.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)X1(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(c===0?a=n.scrollStep:c==1?s=n.scrollStep:c==2?a=-n.scrollStep:c==3&&(s=-n.scrollStep));(a!==0||s!==0)&&(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))};function X1(e,t,n){return t<e&&e<n}ur.prototype.stopScroll=function(){clearTimeout(this._scrolling)},ur.prototype.setOptions=function(e){this._opts=N({},this._opts,e)},ur.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=oi(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const Z1={__depends__:[$n],__init__:["autoScroll"],autoScroll:["type",ur]};function rp(e){this._commandStack=e.get("commandStack",!1)}rp.$inject=["injector"],rp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const _n={__init__:["rules"],rules:["type",rp]};var Da=Math.round,Q1=Math.max;function J1(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 eE(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var zd=10;function tE(e,t){var n,i;for(n=0;i=e[n];n++)if(Tr(i,t)<=zd)return{point:e[n],bendpoint:!0,index:n};return null}function nE(e,t){var n=Lu(J1(t,zd),eE(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=Q1(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Da(i.x+r.x)/2,y:Da(i.y+r.y)/2},index:i.segment2}:{point:{x:Da(i.x),y:Da(i.y)},index:i.segment2}:null}function op(e,t){return tE(e,t)||nE(e,t)}function Fd(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Hd(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function iE(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 rE(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],r=i[0].n*t[0]+i[1].n*t[1],o=i[0].lambda*t[0]+i[1].lambda*t[1];return-r/o}function ap(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=rE([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function Gd(e,t){var n=ap(e,t),i={x:n.x-e.x,y:n.y-e.y};return Fd(i)}function Ba(e,t){return Fd({x:e.x-t.x,y:e.y-t.y})}var Vd="djs-bendpoint",Wd="djs-segment-dragger";function oE(e,t){var n=oi(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function sp(e,t,n){var i=oE(e,n),r=op(t,i);return r}function cp(e,t){var n=Z("g");he(n).add(Vd),ee(e,n);var i=Z("circle");Y(i,{cx:0,cy:0,r:4}),he(i).add("djs-visual"),ee(n,i);var r=Z("circle");return Y(r,{cx:0,cy:0,r:10}),he(r).add("djs-hit"),ee(n,r),t&&he(n).add(t),n}function aE(e,t,n,i){var r=Z("g");ee(e,r);var o=18,a=6,s=11,c=cE(t,n,i),p=a+s,l=Z("rect");Y(l,{x:-o/2,y:-a/2,width:o,height:a}),he(l).add("djs-visual"),ee(r,l);var u=Z("rect");return Y(u,{x:-c/2,y:-p/2,width:c,height:p}),he(u).add("djs-hit"),ee(r,u),Ju(r,i==="v"?90:0),r}function Ud(e,t,n){var i=Z("g"),r=hc(t,n),o=Dn(t,n);return ee(e,i),aE(i,t,n,o),he(i).add(Wd),he(i).add(o==="h"?"horizontal":"vertical"),kt(i,r.x,r.y),i}function qd(e){return Math.abs(Math.round(e*2/3))}function sE(e,t){var n=pE(e,t);return ap(e,n)}function cE(e,t,n){var i=t.x-e.x,r=t.y-e.y;return qd(n==="h"?i:r)}function pE(e,t){for(var n=t.waypoints,i=1/0,r,o=0;o<n.length-1;o++){var a=n[o],s=n[o+1],c=Gd(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function Kd(e,t,n,i,r){function o(_,x,S){var M=_.index,j=_.point,B,D,$,z,F,U;return M<=0||_.bendpoint?!1:(B=x[M-1],D=x[M],$=hc(B,D),z=Dn(B,D),F=Math.abs(j.x-$.x),U=Math.abs(j.y-$.y),z&&F<=S&&U<=S)}function a(_,x){var S=_.waypoints,M,j,B,D;return x.index<=0||x.bendpoint||(M={start:S[x.index-1],end:S[x.index]},j=Dn(M.start,M.end),!j)?null:(j==="h"?B=M.end.x-M.start.x:B=M.end.y-M.start.y,D=qd(B)/2,D)}function s(_,x){var S=x.waypoints,M=sp(t,S,_),j;if(M)return j=a(x,M),o(M,S,j)?r.start(_,x,M.index):i.start(_,x,M.index,!M.bendpoint),!0}function c(_,x,S){J.bind(_,x,function(M){n.triggerMouseEvent(x,M,S),M.stopPropagation()})}function p(_,x){var S=t.getLayer("overlays"),M=Ae('.djs-bendpoints[data-element-id="'+Hr(_.id)+'"]',S);return!M&&x&&(M=Z("g"),Y(M,{"data-element-id":_.id}),he(M).add("djs-bendpoints"),ee(S,M),c(M,"mousedown",_),c(M,"click",_),c(M,"dblclick",_)),M}function l(_,x){return Ae('.djs-segment-dragger[data-segment-idx="'+_+'"]',x)}function u(_,x){x.waypoints.forEach(function(S,M){var j=cp(_);ee(_,j),kt(j,S.x,S.y)}),cp(_,"floating")}function h(_,x){for(var S=x.waypoints,M,j,B,D=1;D<S.length;D++)M=S[D-1],j=S[D],Dn(M,j)&&(B=Ud(_,M,j),Y(B,{"data-segment-idx":D}),c(B,"mousemove",x))}function d(_){k(ec("."+Vd,_),function(x){Fe(x)})}function f(_){k(ec("."+Wd,_),function(x){Fe(x)})}function v(_){var x=p(_);return x||(x=p(_,!0),u(x,_),h(x,_)),x}function g(_){var x=p(_);x&&(f(x),d(x),h(x,_),u(x,_))}function R(_,x){var S=Ae(".floating",_),M=x.point;S&&kt(S,M.x,M.y)}function E(_,x,S){var M=l(x.index,_),j=S[x.index-1],B=S[x.index],D=x.point,$=hc(j,B),z=Dn(j,B),F,U;M&&(F=lE(M),U={x:D.x-$.x,y:D.y-$.y},z==="v"&&(U={x:U.y,y:U.x}),kt(F,U.x,U.y))}e.on("connection.changed",function(_){g(_.element)}),e.on("connection.remove",function(_){var x=p(_.element);x&&Fe(x)}),e.on("element.marker.update",function(_){var x=_.element,S;x.waypoints&&(S=v(x),_.add?he(S).add(_.marker):he(S).remove(_.marker))}),e.on("element.mousemove",function(_){var x=_.element,S=x.waypoints,M,j;if(S){if(M=p(x,!0),j=sp(t,S,_.originalEvent),!j)return;R(M,j),j.bendpoint||E(M,j,S)}}),e.on("element.mousedown",function(_){if(ai(_)){var x=_.originalEvent,S=_.element;if(S.waypoints)return s(x,S)}}),e.on("selection.changed",function(_){var x=_.newSelection,S=x[0];S&&S.waypoints&&v(S)}),e.on("element.hover",function(_){var x=_.element;x.waypoints&&(v(x),n.registerEvent(_.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(_){n.unregisterEvent(_.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(_){var x=_.element,S=_.newId;if(x.waypoints){var M=p(x);M&&Y(M,{"data-element-id":S})}}),this.addHandles=v,this.updateHandles=g,this.getBendpointsContainer=p,this.getSegmentDragger=l}Kd.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function lE(e){return Ae(".djs-visual",e)}var Yd=Math.round,Oi="reconnectStart",ji="reconnectEnd",Yr="updateWaypoints";function pp(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,p){var l=n.getGraphics(s),u=s.source,h=s.target,d=s.waypoints,f;!p&&c===0?f=Oi:!p&&c===d.length-1?f=ji:f=Yr;var v=f===Yr?"connection.updateWaypoints":"connection.reconnect",g=r.allowed(v,{connection:s,source:u,target:h});g===!1&&(g=r.allowed(v,{connection:s,source:h,target:u})),g!==!1&&i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:g,bendpointIndex:c,connection:s,source:u,target:h,insert:p,type:f}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,p=c.source,l=c.target,u=a.hover,h=s.type;s.hover=u;var d;if(u){var f=h===Yr?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(f,{connection:c,source:h===Oi?u:p,target:h===ji?u:l}),d){s.source=h===Oi?u:p,s.target=h===ji?u:l;return}d===!1&&(d=s.allowed=r.allowed(f,{connection:c,source:h===ji?u:l,target:h===Oi?u:p})),d&&(s.source=h===ji?u:l,s.target=h===Oi?u:p)}}),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!==Yr&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,p=s.bendpointIndex,l=s.connection,u=s.insert,h=l.waypoints.slice(),d=s.source,f=s.target,v=s.type,g=s.hints||{},R={x:Yd(a.x),y:Yd(a.y)};if(!c)return!1;v===Yr?(u?h.splice(p,0,R):h[p]=R,g.bendpointMove={insert:u,bendpointIndex:p},h=this.cropWaypoints(l,h),o.updateWaypoints(l,u0(h),g)):(v===Oi?(g.docking="source",Na(s)&&(g.docking="target",g.newWaypoints=h.reverse())):v===ji&&(g.docking="target",Na(s)&&(g.docking="source",g.newWaypoints=h.reverse())),o.reconnect(l,d,f,R,g))},this)}pp.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],pp.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 Na(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Oi)return t&&i&&t===i&&n!==i;if(r===ji)return t&&n&&t===n&&n!==i}var uE="reconnectStart",hE="reconnectEnd",Xd="updateWaypoints",Xr="connect-ok",Oa="connect-not-ok",Zd="connect-hover",Qd="djs-updating",Jd="djs-dragging",ef=1100;function tf(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,p=a.insert,l=c.waypoints,u=l.slice();a.waypoints=l,p&&u.splice(s,0,{x:o.x,y:o.y}),c.waypoints=u;var h=a.draggerGfx=cp(i.getLayer("overlays"));he(h).add("djs-dragging"),i.addMarker(c,Jd),i.addMarker(c,Qd)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,p=a.type;if(c){if(i.addMarker(c,Zd),p===Xd)return;s?(i.removeMarker(c,Oa),i.addMarker(c,Xr)):s===!1&&(i.removeMarker(c,Xr),i.addMarker(c,Oa))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],ef,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,Zd),i.removeMarker(s,c?Xr:Oa))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,p=a.draggerGfx,l=a.hover,u=a.type,h=a.connection,d=h.source,f=h.target,v=h.waypoints.slice(),g={x:o.x,y:o.y},R=a.hints||{},E={};r&&(R.connectionStart&&(E.connectionStart=R.connectionStart),R.connectionEnd&&(E.connectionEnd=R.connectionEnd),u===uE?Na(a)?(E.connectionEnd=E.connectionEnd||g,E.source=f,E.target=l||d,v=v.reverse()):(E.connectionStart=E.connectionStart||g,E.source=l||d,E.target=f):u===hE?Na(a)?(E.connectionStart=E.connectionStart||g,E.source=l||f,E.target=d,v=v.reverse()):(E.connectionEnd=E.connectionEnd||g,E.source=d,E.target=l||f):(E.noCropping=!0,E.noLayout=!0,v[c]=g),u===Xd&&(v=e.cropWaypoints(h,v)),E.waypoints=v,r.drawPreview(a,s,E)),kt(p,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],ef,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,p=a.hover,l=a.target,u=a.waypoints;s.waypoints=u,Fe(c),i.removeMarker(s,Qd),i.removeMarker(s,Jd),p&&(i.removeMarker(p,Xr),i.removeMarker(p,l?Xr:Oa)),r&&r.cleanUp(a)})}tf.$inject=["bendpointMove","injector","eventBus","canvas"];var nf="connect-hover",rf="djs-updating";function of(e,t,n){return lp(e,t,e[t]+n)}function lp(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function dE(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(o+a,e[i]),r-a);return lp(t,i,s)}function af(e){return e==="x"?"y":"x"}function sf(e,t,n){var i,r;return e.original?e.original:(i=ne(t),r=af(n),lp(e,r,i[r]))}function cf(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(u,h,d){var f,v=n.getGraphics(h),g=d-1,R=d,E=h.waypoints,_=E[g],x=E[R],S=sp(n,E,u),M,j,B;M=Dn(_,x),M&&(j=M==="v"?"x":"y",g===0&&(_=sf(_,h.source,j)),R===E.length-1&&(x=sf(x,h.target,j)),S?B=S.point:B={x:(_.x+x.x)/2,y:(_.y+x.y)/2},f={connection:h,segmentStartIndex:g,segmentEndIndex:R,segmentStart:_,segmentEnd:x,axis:j,dragPosition:B},i.init(u,B,"connectionSegment.move",{cursor:j==="x"?"resize-ew":"resize-ns",data:{connection:h,connectionGfx:v,context:f}}))};function s(u,h){if(!a)return h;var d=u.waypoints,f;return u.waypoints=h,f=a.getCroppedWaypoints(u),u.waypoints=d,f}function c(u){r.update("connection",u.connection,u.connectionGfx)}function p(u,h,d){var f=u.newWaypoints,v=u.segmentStartIndex+h,g=f[v],R=u.segmentEndIndex+h,E=f[R],_=af(u.axis),x=dE(d,g,E,_);kt(u.draggerGfx,x.x,x.y)}function l(u,h){var d=0,f=u.filter(function(v,g){return uc(u[g-1],u[g+1],v)?(d=g<=h?d-1:d,!1):!0});return{waypoints:f,segmentOffset:d}}t.on("connectionSegment.move.start",function(u){var h=u.context,d=u.connection,f=n.getLayer("overlays");h.originalWaypoints=d.waypoints.slice(),h.draggerGfx=Ud(f,h.segmentStart,h.segmentEnd),he(h.draggerGfx).add("djs-dragging"),n.addMarker(d,rf)}),t.on("connectionSegment.move.move",function(u){var h=u.context,d=h.connection,f=h.segmentStartIndex,v=h.segmentEndIndex,g=h.segmentStart,R=h.segmentEnd,E=h.axis,_=h.originalWaypoints.slice(),x=of(g,E,u["d"+E]),S=of(R,E,u["d"+E]),M=_.length,j=0;_[f]=x,_[v]=S;var B,D;f<2&&(B=lt(d.source,x),f===1?B==="intersect"&&(_.shift(),_[0]=x,j--):B!=="intersect"&&(_.unshift(g),j++)),v>M-3&&(D=lt(d.target,S),v===M-2?D==="intersect"&&(_.pop(),_[_.length-1]=S):D!=="intersect"&&_.push(R)),h.newWaypoints=d.waypoints=s(d,_),p(h,j,u),h.newSegmentStartIndex=f+j,c(u)}),t.on("connectionSegment.move.hover",function(u){u.context.hover=u.hover,n.addMarker(u.hover,nf)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(u){var h=u.context.hover;h&&n.removeMarker(h,nf)}),t.on("connectionSegment.move.cleanup",function(u){var h=u.context,d=h.connection;h.draggerGfx&&Fe(h.draggerGfx),n.removeMarker(d,rf)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(u){var h=u.context,d=h.connection;d.waypoints=h.originalWaypoints,c(u)}),t.on("connectionSegment.move.end",function(u){var h=u.context,d=h.connection,f=h.newWaypoints,v=h.newSegmentStartIndex;f=f.map(function(S){return{original:S.original,x:Math.round(S.x),y:Math.round(S.y)}});var g=l(f,v),R=g.waypoints,E=s(d,R),_=g.segmentOffset,x={segmentMove:{segmentStartIndex:h.segmentStartIndex,newSegmentStartIndex:v+_}};o.updateWaypoints(d,E,x)})}cf.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var fE=Math.abs,pf=Math.round;function mE(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],fE(r-e)<=n)return r}function lf(e){return{x:e.x,y:e.y}}function uf(e){return{x:e.x+e.width,y:e.y+e.height}}function Kt(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:pf(e.x+e.width/2),y:pf(e.y+e.height/2)}}function hr(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Ke(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return n===!1?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function hf(e){return e.children||[]}var vE=Math.abs,df=Math.round,up=10;function ff(e){function t(o,a){if(le(o)){for(var s=o.length;s--;)if(vE(o[s]-a)<=up)return o[s]}else{o=+o;var c=a%o;if(c<up)return a-c;if(c>o-up)return a-c+o}return a}function n(o,a){if(o.waypoints)return sE(a,o);if(o.width)return{x:df(o.width/2+o.x),y:df(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,p=c.waypoints,l=a.segmentStart,u=a.segmentStartIndex,h=a.segmentEnd,d=a.segmentEndIndex,f=a.axis;if(s)return s;var v=[p[u-1],l,h,p[d+1]];return u<2&&v.unshift(n(c.source,o)),d>p.length-3&&v.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},k(v,function(g){g&&(g=g.original||g,f==="y"&&s.horizontal.push(g.y),f==="x"&&s.vertical.push(g.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,p,l;if(a){p=t(a.vertical,s),l=t(a.horizontal,c);var u=s-p,h=c-l;N(o,{dx:o.dx-u,dy:o.dy-h,x:p,y:l}),(u||a.vertical.indexOf(s)!==-1)&&Ke(o,"x",p),(h||a.horizontal.indexOf(c)!==-1)&&Ke(o,"y",l)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var p=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},k(p,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!De(s)||!c||!c.x||!c.y||(Ke(o,"x",c.x),Ke(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,p=c&&n(c,o),l=o.x,u=o.y,h,d;if(s){h=t(p?s.vertical.concat([p.x]):s.vertical,l),d=t(p?s.horizontal.concat([p.y]):s.horizontal,u);var f=l-h,v=u-d;N(o,{dx:o.dx-f,dy:o.dy-v,x:o.x-f,y:o.y-v}),(f||s.vertical.indexOf(l)!==-1)&&Ke(o,"x",h),(v||s.horizontal.indexOf(u)!==-1)&&Ke(o,"y",d)}})}ff.$inject=["eventBus"];const yE={__depends__:[$n,_n],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Kd],bendpointMove:["type",pp],bendpointMovePreview:["type",tf],connectionSegmentMove:["type",cf],bendpointSnapping:["type",ff]};function mf(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,p=a.hover,l;if(s.hover=p,l=s.canExecute=r(c,p),!ng(l)){if(l!==!1){s.source=c,s.target=p;return}l=s.canExecute=o(c,p),!ng(l)&&l!==!1&&(s.source=p,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,p=s.connectionStart,l={x:a.x,y:a.y},u=s.source,h=s.target;if(!c)return!1;var d=null,f={connectionStart:hp(s)?l:p,connectionEnd:hp(s)?p:l};rt(c)&&(d=c),s.connection=n.connect(u,h,d,f)}),this.start=function(a,s,c,p){rt(c)||(p=c,c=ne(s)),t.init(a,"connect",{autoActivate:p,data:{shape:s,context:{start:s,connectionStart:c}}})}}mf.$inject=["eventBus","dragging","modeling","rules"];function hp(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var gE=1100,bE=900,vf="connect-ok",yf="connect-not-ok";function gf(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,p=o.start,l=o.startPosition,u=o.target,h=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},f=h,v=d;hp(o)&&(f=d,v=h),i.drawPreview(o,a,{source:c||p,target:u||s,connectionStart:f,connectionEnd:v})}),t.on("connect.hover",bE,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?vf:yf)}),t.on(["connect.out","connect.cleanup"],gE,function(r){var o=r.hover;o&&(n.removeMarker(o,vf),n.removeMarker(o,yf))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}gf.$inject=["injector","eventBus","canvas"];const dp={__depends__:[bn,_n,$n],__init__:["connectPreview"],connect:["type",mf],connectPreview:["type",gf]};var xE="djs-dragger";function zn(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)}zn.$inject=["injector","canvas","graphicsFactory","elementFactory"],zn.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,p=n.connectionEnd,l=n.noLayout,u=n.noCropping,h=n.noNoop,d,f=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Ho(i),r||(r=e.getConnection=_E(function(v,g,R){return f.getConnection(v,g,R)})),t&&(d=r(t,o,a)),!d){!h&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:p,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?ne(o):c,a?ne(a):p]),this._connectionDocking&&(o||a)&&!u&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},zn.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||ne(n),o=t.connectionEnd||ne(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);ee(e,s)},zn.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return e=n&&mc(o,s,!0)||e,t=i&&mc(a,s,!1)||t,[e,t]},zn.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Fe(e.connectionPreviewGfx)},zn.prototype.getConnection=function(e){var t=EE(e);return this._elementFactory.createConnection(t)},zn.prototype.createConnectionPreviewGfx=function(){var e=Z("g");return Y(e,{pointerEvents:"none"}),he(e).add(xE),ee(this._canvas.getActiveLayer(),e),e},zn.prototype.createNoopConnection=function(e,t){return Wo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function _E(e){var t={};return function(n){var i=JSON.stringify(n),r=t[i];return r||(r=t[i]=e.apply(null,arguments)),r}}function EE(e){return rt(e)?e:{}}const wE={__init__:["connectionPreview"],connectionPreview:["type",zn]};var bf=Math.min,xf=Math.max;function fp(e){e.preventDefault()}function Zr(e){e.stopPropagation()}function SE(e){return e.nodeType===Node.TEXT_NODE}function CE(e){return[].slice.call(e)}function nn(e){this.container=e.container,this.parent=Me('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Ae("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=Ct(this.autoResize,this),this.handlePaste=Ct(this.handlePaste,this)}nn.prototype.create=function(e,t,n,i){var r=this,o=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=un(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);N(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var p=un(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return N(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},p),i.centerVertically&&N(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},p),a.innerText=n,J.bind(a,"keydown",this.keyHandler),J.bind(a,"mousedown",Zr),J.bind(a,"paste",r.handlePaste),i.autoResize&&J.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},nn.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var i;if(e.clipboardData?i=e.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),t.autoResize){var r=this.autoResize(n);r&&this.resizeHandler(r)}},nn.prototype.insertText=function(e){e=RE(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},nn.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=CE(a.childNodes),c,p;if(SE(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,p=r+e.length}else if(n===this.content&&i===this.content){var u=document.createTextNode(e);this.content.insertBefore(u,s[r]),c=u,p=u.textContent.length}else{var h=s.indexOf(n),d=s.indexOf(i);s.forEach(function(f,v){v===h?f.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):v>h&&v<=d&&dn(f)}),c=n,p=r+e.length}c&&p!==void 0&&setTimeout(function(){self.setSelection(c,p)})},nn.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},nn.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=Me('<div class="djs-direct-editing-resize-handle"></div>');var s,c,p,l,u=function(f){fp(f),Zr(f),s=f.clientX,c=f.clientY;var v=t.getBoundingClientRect();p=v.width,l=v.height,J.bind(document,"mousemove",h),J.bind(document,"mouseup",d)},h=function(f){fp(f),Zr(f);var v=bf(xf(p+f.clientX-s,i),o),g=bf(xf(l+f.clientY-c,r),a);t.style.width=v+"px",t.style.height=g+"px",e.resizeHandler({width:p,height:l,dx:f.clientX-s,dy:f.clientY-c})},d=function(f){fp(f),Zr(f),J.unbind(document,"mousemove",h,!1),J.unbind(document,"mouseup",d,!1)};J.bind(n,"mousedown",u)}N(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)},nn.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),J.unbind(t,"keydown",this.keyHandler),J.unbind(t,"mousedown",Zr),J.unbind(t,"input",this.autoResize),J.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),dn(n)),dn(e)},nn.prototype.getValue=function(){return this.content.innerText.trim()},nn.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},nn.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 RE(e){return e.replace(/\r\n|\r|\n/g,`
  194. `)}function Yt(e,t){this._eventBus=e,this._providers=[],this._textbox=new nn({container:t.getContainer(),keyHandler:Ct(this._handleKey,this),resizeHandler:Ct(this._handleResize,this)})}Yt.$inject=["eventBus","canvas"],Yt.prototype.registerProvider=function(e){this._providers.push(e)},Yt.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Yt.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Yt.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Yt.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},Yt.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue(),o=e.context.text;(r!==o||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},Yt.prototype.getValue=function(){return this._textbox.getValue()},Yt.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()},Yt.prototype._handleResize=function(e){this._fire("resize",e)},Yt.prototype.activate=function(e){this.isActive()&&this.cancel();var t,n=ye(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 _f={__depends__:[Fr],__init__:["directEditing"],directEditing:["type",Yt]};var PE=["marker-start","marker-mid","marker-end"],kE=["circle","ellipse","line","path","polygon","polyline","path","rect"];function pi(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i,this._clonedMarkers={};var r=this;t.on("drag.cleanup",function(){r.cleanUp()})}pi.$inject=["elementRegistry","eventBus","canvas","styles"],pi.prototype.cleanUp=function(){var e=this;k(e._clonedMarkers,function(t){Fe(t)}),e._clonedMarkers={}},pi.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},pi.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=hu(n),o=n.getBoundingClientRect();return this._cloneMarkers(ta(r),i),Y(r,this._styles.cls(i,[],{x:o.top,y:o.left})),ee(t,r),Y(r,"data-preview-support-element-id",e.id),r},pi.prototype.addFrame=function(e,t){var n=Z("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ee(t,n),Y(n,"data-preview-support-element-id",e.id),n},pi.prototype._cloneMarkers=function(e,t="djs-dragger"){var n=this;if(e.childNodes)for(var i=0;i<e.childNodes.length;i++)n._cloneMarkers(e.childNodes[i],t);DE(e)&&PE.forEach(function(r){if(Y(e,r)){var o=TE(e,r,n._canvas.getContainer());n._cloneMarker(e,o,r,t)}})},pi.prototype._cloneMarker=function(e,t,n,i="djs-dragger"){var r=t.id+"-"+i,o=this._clonedMarkers[r];if(!o){o=hu(t);var a=r+"-clone";o.id=a,he(o).add(i),this._clonedMarkers[r]=o;var s=Ae("defs",this._canvas._svg);s||(s=Z("defs"),ee(this._canvas._svg,s)),ee(s,o)}var c=ME(this._clonedMarkers[r].id);Y(e,n,c)};function TE(e,t,n){var i=AE(Y(e,t));return Ae("marker#"+i,n||document)}function AE(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function ME(e){return"url(#"+e+")"}function DE(e){return kE.indexOf(e.nodeName)!==-1}const Qr={__init__:["previewSupport"],previewSupport:["type",pi]};var BE="drop-ok",Ef="drop-not-ok",wf="attach-ok",Sf="new-parent",Cf="create",NE=2e3;function Rf(e,t,n,i,r){function o(c,p,l,u,h){if(!p)return!1;c=ce(c,function(E){var _=E.labelTarget;return!E.parent&&!(xe(E)&&c.indexOf(_)!==-1)});var d=ye(c,function(E){return!De(E)}),f=!1,v=!1,g=!1;kf(c)&&(f=r.allowed("shape.attach",{position:l,shape:d,target:p})),f||(kf(c)?g=r.allowed("shape.create",{position:l,shape:d,source:u,target:p}):g=r.allowed("elements.create",{elements:c,position:l,target:p}));var R=h.connectionTarget;return g||f?(d&&u&&(v=r.allowed("connection.create",{source:R===u?d:u,target:R===u?u:d,hints:{targetParent:p,targetAttach:f}})),{attach:f,connect:v}):g===null||f===null?null:!1}function a(c,p){[wf,BE,Ef,Sf].forEach(function(l){l===p?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var p=c.context,l=p.elements,u=c.hover,h=p.source,d=p.hints||{};if(!u){p.canExecute=!1,p.target=null;return}Pf(c);var f={x:c.x,y:c.y},v=p.canExecute=u&&o(l,u,f,h,d);u&&v!==null&&(p.target=u,v&&v.attach?a(u,wf):a(u,v?Sf:Ef))}),n.on(["create.end","create.out","create.cleanup"],function(c){var p=c.hover;p&&a(p,null)}),n.on("create.end",function(c){var p=c.context,l=p.source,u=p.shape,h=p.elements,d=p.target,f=p.canExecute,v=f&&f.attach,g=f&&f.connect,R=p.hints||{};if(f===!1||!d)return!1;Pf(c);var E={x:c.x,y:c.y};g?u=i.appendShape(l,u,E,d,{attach:v,connection:g===!0?{}:g,connectionTarget:R.connectionTarget}):(h=i.createElements(h,E,d,N({},R,{attach:v})),u=ye(h,function(_){return!De(_)})),N(p,{elements:h,shape:u}),N(c,{elements:h,shape:u})});function s(){var c=t.context();c&&c.prefix===Cf&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],NE,function(){n.off("elements.changed",s)})}),this.start=function(c,p,l){le(p)||(p=[p]);var u=ye(p,function(f){return!De(f)});if(u){l=N({elements:p,hints:{},shape:u},l||{}),k(p,function(f){ie(f.x)||(f.x=0),ie(f.y)||(f.y=0)});var h=ce(p,function(f){return!f.hidden}),d=Ve(h);k(p,function(f){De(f)&&(f.waypoints=bt(f.waypoints,function(v){return{x:v.x-d.x-d.width/2,y:v.y-d.y-d.height/2}})),N(f,{x:f.x-d.x-d.width/2,y:f.y-d.y-d.height/2})}),t.init(c,Cf,{cursor:"grabbing",autoActivate:!0,data:{shape:u,elements:p,context:l}})}}}Rf.$inject=["canvas","dragging","eventBus","modeling","rules"];function Pf(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 kf(e){return e&&e.length===1&&!De(e[0])}var OE=750;function Tf(e,t,n,i,r){function o(a){var s=Z("g");Y(s,r.cls("djs-drag-group",["no-events"]));var c=Z("g");return a.forEach(function(p){var l;p.hidden||(p.waypoints?(l=n._createContainer("connection",c),n.drawConnection(ta(l),p)):(l=n._createContainer("shape",c),n.drawShape(ta(l),p),kt(l,p.x,p.y)),i.addDragger(p,s,l))}),s}t.on("create.move",OE,function(a){var s=a.hover,c=a.context,p=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(p));var u;s?(l.parentNode||(u=e.getActiveLayer(),ee(u,l)),kt(l,a.x,a.y)):Fe(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Fe(c)})}Tf.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const ja={__depends__:[$n,Qr,_n,bn],__init__:["create","createPreview"],create:["type",Rf],createPreview:["type",Tf]};function Jr(){}Jr.prototype.get=function(){return this._data},Jr.prototype.set=function(e){this._data=e},Jr.prototype.clear=function(){var e=this._data;return delete this._data,e},Jr.prototype.isEmpty=function(){return!this._data};const jE={clipboard:["type",Jr]};function mp(e){var t=this;this._lastMoveEvent=null;function n(i){t._lastMoveEvent=i}e.on("canvas.init",function(i){var r=t._svg=i.svg;r.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}mp.$inject=["eventBus"],mp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||LE(0,0)};function LE(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const eo={__init__:["mouse"],mouse:["type",mp]};function rn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._clipboard=n,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var p=c.descriptor,l=c.element,u=c.elements;p.priority=1,p.id=l.id;var h=ye(u,function(d){return d===l.parent});h&&(p.parent=l.parent.id),IE(l)&&(p.priority=2,p.host=l.host.id),De(l)&&(p.priority=3,p.source=l.source.id,p.target=l.target.id,p.waypoints=$E(l)),xe(l)&&(p.priority=4,p.labelTarget=l.labelTarget.id),k(["x","y","width","height"],function(d){ie(l[d])&&(p[d]=l[d])}),p.hidden=l.hidden,p.collapsed=l.collapsed}),r.on("copyPaste.pasteElements",function(c){var p=c.hints;N(p,{createElementsBehavior:!1})})}rn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],rn.prototype.copy=function(e){var t,n;return le(e)||(e=e?[e]:[]),t=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),t===!1?n={}:n=this.createTree(le(t)?t:e),this._clipboard.set(n),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:n}),n},rn.prototype.paste=function(e){var t=this._clipboard.get();if(!this._clipboard.isEmpty()){var n=e&&e.hints||{};this._eventBus.fire("copyPaste.pasteElements",{hints:n});var i=this._createElements(t);if(e&&e.element&&e.point)return this._paste(i,e.element,e.point,n);this._create.start(this._mouse.getLastMoveEvent(),i,{hints:n||{}})}},rn.prototype._paste=function(e,t,n,i){k(e,function(o){ie(o.x)||(o.x=0),ie(o.y)||(o.y=0)});var r=Ve(e);return k(e,function(o){De(o)&&(o.waypoints=bt(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),N(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,N({},i))},rn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return k(e,function(o,a){o=ln(o,"priority"),k(o,function(s){var c=N({},Tn(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var p;if(De(c)){c.source=i[s.source],c.target=i[s.target],p=i[s.id]=t.createConnection(c),r.push(p);return}if(xe(c)){c.labelTarget=i[c.labelTarget],p=i[s.id]=t.createLabel(c),r.push(p);return}c.host&&(c.host=i[c.host]),p=i[s.id]=t.createShape(c),r.push(p)})}),r},rn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Tn(e,["id"]));return t},rn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Tn(e,["id"]));return t},rn.prototype.createShape=function(e){var t=this._elementFactory.createShape(Tn(e,["id"]));return t},rn.prototype.hasRelations=function(e,t){var n,i,r;return!(De(e)&&(i=ye(t,hn({id:e.source.id})),r=ye(t,hn({id:e.target.id})),!i||!r)||xe(e)&&(n=ye(t,hn({id:e.labelTarget.id})),!n))},rn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=Uo(e);function a(p,l){return t.allowed("element.copy",{element:p,elements:l})}function s(p,l){var u=ye(r,function(h){return p===h.element});if(!u){r.push({element:p,depth:l});return}u.depth<l&&(r=c(u,r),r.push({element:u.element,depth:l}))}function c(p,l){var u=l.indexOf(p);return u!==-1&&l.splice(u,1),l}return Si(o,function(p,l,u){if(xe(p))return;k(p.labels,function(f){s(f,u)});function h(f){f&&f.length&&k(f,function(v){k(v.labels,function(g){s(g,u)}),s(v,u)})}k([p.attachers,p.incoming,p.outgoing],h),s(p,u);var d=[];return p.children&&(d=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:d}),d}),e=bt(r,function(p){return p.element}),r=bt(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e}),p}),r=ln(r,function(p){return p.descriptor.priority}),e=bt(r,function(p){return p.element}),k(r,function(p){var l=p.depth;if(!n.hasRelations(p.element,e)){Mf(p.element,e);return}if(!a(p.element,e)){Mf(p.element,e);return}i[l]||(i[l]=[]),i[l].push(p.descriptor)}),i};function IE(e){return!!e.host}function $E(e){return bt(e.waypoints,function(t){return t=Af(t),t.original&&(t.original=Af(t.original)),t})}function Af(e){return N({},e)}function Mf(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const zE={__depends__:[jE,ja,eo,_n],__init__:["copyPaste"],copyPaste:["type",rn]};function vp(e,t,n){le(n)||(n=[n]),k(n,function(i){Ys(e[i])||(t[i]=e[i])})}var yp=750;function Df(e,t,n){function i(c,p){var l=e.create(c.$type);return n.copyElement(c,l,null,p)}t.on("copyPaste.copyElement",yp,function(c){var p=c.descriptor,l=c.element,u=W(l);if(xe(l))return p;var h=p.businessObject=i(u,!0),d=p.di=i(ge(l),!0);d.bpmnElement=h,vp(h,p,"name"),vp(d,p,"isExpanded"),u.default&&(p.default=u.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,p){c[r]=p}function s(c,p,l){var u=W(c);return c.default&&(l[c.default]={element:u,property:"default"}),c.host&&(W(c).attachedToRef=W(p[c.host])),Tn(l,Gt(l,function(h,d,f){var v=d.element,g=d.property;return f===c.id&&(v[g]=u,h.push(c.id)),h},[]))}t.on("copyPaste.pasteElement",function(c){var p=c.cache,l=c.descriptor,u=l.businessObject,h=l.di;if(xe(l)){l.businessObject=W(p[l.labelTarget]),l.di=ge(p[l.labelTarget]);return}u=l.businessObject=i(u),h=l.di=i(h),h.bpmnElement=u,vp(l,u,["isExpanded","name"]),l.type=u.$type}),t.on("copyPaste.copyElement",yp,function(c){var p=c.descriptor,l=c.element;if(y(l,"bpmn:Participant")){var u=W(l);u.processRef&&(p.processRef=i(u.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var p=c.descriptor,l=p.processRef;l&&(p.processRef=i(l))}),t.on("copyPaste.pasteElement",yp,function(c){var p=c.cache,l=c.descriptor;a(p,s(l,p,o(p)))})}Df.$inject=["bpmnFactory","eventBus","moddleCopy"];var FE=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"];function to(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",function(i){var r=i.propertyNames;if(!(!r||!r.length))return ln(r,function(o){return o==="extensionElements"})}),e.on("moddleCopy.canCopyProperty",function(i){var r=i.parent,o=rt(r)&&r.$descriptor,a=i.propertyName;if(a&&FE.indexOf(a)!==-1||a&&o&&!ye(o.properties,hn({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",function(i){var r=i.property;if(HE(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}to.$inject=["eventBus","bpmnFactory","moddle"],to.prototype.copyElement=function(e,t,n,i=!1){var r=this;n&&!le(n)&&(n=[n]),n=n||gp(e.$descriptor);var o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||(le(o)&&(n=o),k(n,function(a){var s;pn(e,a)&&(s=e.get(a));var c=r.copyProperty(s,t,a,i);if(ot(c)){var p=r._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:c,propertyName:a});p!==!1&&t.set(a,c)}})),t},to.prototype.copyProperty=function(e,t,n,i=!1){var r=this,o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(o!==!1){if(o)return rt(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;var a=this._moddle.getPropertyDescriptor(t,n);if(!a.isReference)return a.isId?e&&this._copyId(e,t,i):le(e)?Gt(e,function(s,c){return o=r.copyProperty(c,t,n,i),o?s.concat(o):s},[]):rt(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(o=r._bpmnFactory.create(e.$type),o.$parent=t,o=r.copyElement(e,o,null,i),o):e}},to.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 gp(e,t){return Gt(e.properties,function(n,i){return t&&i.default?n:n.concat(i.name)},[])}function HE(e,t){return e&&pt(e.$instanceOf)&&e.$instanceOf(t)}const Bf={__depends__:[zE],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Df],moddleCopy:["type",to]};var Nf=Math.round;function bp(e,t){this._modeling=e,this._eventBus=t}bp.$inject=["modeling","eventBus"],bp.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,p=Nf(s+o/2),l=Nf(c+a/2),u=i.replaceShape(e,N({},t,{x:p,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:u,hints:n}),u};function Of(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Of.$inject=["selection","eventBus"];const GE={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Of],replace:["type",bp]};function VE(e,t,n){le(n)||(n=[n]),k(n,function(i){Ys(e[i])||(t[i]=e[i])})}var WE=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function UE(e,t){var n=e&&pn(e,"collapsed")?e.collapsed:!ve(e),i;return t&&(pn(t,"collapsed")||pn(t,"isExpanded"))?i=pn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function jf(e,t,n,i,r,o){function a(s,c,p){p=p||{};var l=c.type,u=s.businessObject;if(La(u)&&l==="bpmn:SubProcess"&&UE(s,c))return i.toggleCollapse(s),s;var h=e.create(l),d={type:l,businessObject:h};d.di={},VE(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var f=gp(u.$descriptor),v=gp(h.$descriptor,!0),g=qE(f,v);N(h,un(c,WE));var R=ce(g,function(_){return _==="eventDefinitions"?Lf(s,c.eventDefinitionType):_==="loopCharacteristics"?!Ot(h):!(pn(h,_)||_==="processRef"&&c.isExpanded===!1||_==="triggeredByEvent")});if(h=n.copyElement(u,h,R),c.eventDefinitionType&&(Lf(h,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),y(u,"bpmn:Activity")){if(La(u))d.isExpanded=ve(s);else if(c&&pn(c,"isExpanded")){d.isExpanded=c.isExpanded;var E=t.getDefaultSize(h,{isExpanded:d.isExpanded});d.width=E.width,d.height=E.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}ve(s)&&!y(u,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}return La(u)&&!La(h)&&(p.moveChildren=!1),y(u,"bpmn:Participant")&&(c.isExpanded===!0?h.processRef=e.create("bpmn:Process"):p.moveChildren=!1,d.width=s.width,d.height=t.getDefaultSize(d).height),o.allowed("shape.resize",{shape:h})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),h.name=u.name,de(u,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&de(h,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(h.default=u.default),c.host&&!y(u,"bpmn:BoundaryEvent")&&y(h,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,p)}this.replaceElement=a}jf.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function La(e){return y(e,"bpmn:SubProcess")}function Lf(e,t){var n=W(e);return t&&n.get("eventDefinitions").some(function(i){return y(i,t)})}function qE(e,t){return e.filter(function(n){return t.includes(n)})}const If={__depends__:[Bf,GE,bn],bpmnReplace:["type",jf]};function $f(e){return function(t){var n=t.target,i=W(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===ve(e);return!o||!a||!s||!c}}var KE=[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throwing",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message Start Event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Start Event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional Start Event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal Start Event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],YE=[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throwing",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}}],XE=[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message Intermediate Catch Event",actionName:"replace-with-message-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Message Intermediate Throw Event",actionName:"replace-with-message-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Intermediate Catch Event",actionName:"replace-with-timer-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation Intermediate Throw Event",actionName:"replace-with-escalation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional Intermediate Catch Event",actionName:"replace-with-conditional-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Link Intermediate Catch Event",actionName:"replace-with-link-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},{label:"Link Intermediate Throw Event",actionName:"replace-with-link-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},{label:"Compensation Intermediate Throw Event",actionName:"replace-with-compensation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal Intermediate Catch Event",actionName:"replace-with-signal-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Signal Intermediate Throw Event",actionName:"replace-with-signal-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],ZE=[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message End Event",actionName:"replace-with-message-end",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Escalation End Event",actionName:"replace-with-escalation-end",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Error End Event",actionName:"replace-with-error-end",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel End Event",actionName:"replace-with-cancel-end",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Compensation End Event",actionName:"replace-with-compensation-end",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal End Event",actionName:"replace-with-signal-end",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Terminate End Event",actionName:"replace-with-terminate-end",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}],QE=[{label:"Exclusive Gateway",actionName:"replace-with-exclusive-gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},{label:"Parallel Gateway",actionName:"replace-with-parallel-gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},{label:"Inclusive Gateway",actionName:"replace-with-inclusive-gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},{label:"Complex Gateway",actionName:"replace-with-complex-gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},{label:"Event based Gateway",actionName:"replace-with-event-based-gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}}],JE=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Event Sub Process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Sub Process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}}],zf=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Sub Process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Event Sub Process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}}],ew=zf,Ff=[{label:"Task",actionName:"replace-with-task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},{label:"User Task",actionName:"replace-with-user-task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},{label:"Service Task",actionName:"replace-with-service-task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},{label:"Send Task",actionName:"replace-with-send-task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},{label:"Receive Task",actionName:"replace-with-receive-task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},{label:"Manual Task",actionName:"replace-with-manual-task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},{label:"Business Rule Task",actionName:"replace-with-rule-task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},{label:"Script Task",actionName:"replace-with-script-task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},{label:"Call Activity",actionName:"replace-with-call-activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},{label:"Sub Process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},{label:"Sub Process (expanded)",actionName:"replace-with-expanded-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}}],tw=[{label:"Data Store Reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],nw=[{label:"Data Object Reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],iw=[{label:"Message Boundary Event",actionName:"replace-with-message-boundary",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Boundary Event",actionName:"replace-with-timer-boundary",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation Boundary Event",actionName:"replace-with-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional Boundary Event",actionName:"replace-with-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Error Boundary Event",actionName:"replace-with-error-boundary",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel Boundary Event",actionName:"replace-with-cancel-boundary",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Signal Boundary Event",actionName:"replace-with-signal-boundary",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Compensation Boundary Event",actionName:"replace-with-compensation-boundary",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Message Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-message-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},{label:"Timer Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},{label:"Escalation Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},{label:"Conditional Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},{label:"Signal Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}}],rw=[{label:"Message Start Event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Start Event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional Start Event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal Start Event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Error Start Event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Escalation Start Event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Compensation Start Event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Message Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-message-start",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},{label:"Timer Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-start",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},{label:"Conditional Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-start",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},{label:"Signal Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-start",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},{label:"Escalation Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-start",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}}],ow=[{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"}],aw=[{label:"Expanded Pool",actionName:"replace-with-expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:function(e){var t="Empty Pool";return e.children&&e.children.length&&(t+=" (removes content)"),t},actionName:"replace-with-collapsed-pool",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}}];function Xt(e,t,n,i,r,o,a){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=a,this._register()}Xt.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate"],Xt.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Xt.prototype.getPopupMenuEntries=function(e){var t=e.businessObject,n=this._rules,i=[];if(le(e)||!n.allowed("shape.replace",{element:e}))return{};var r=$f(e);return y(t,"bpmn:DataObjectReference")?this._createEntries(e,tw):y(t,"bpmn:DataStoreReference")&&!y(e.parent,"bpmn:Collaboration")?this._createEntries(e,nw):y(t,"bpmn:StartEvent")&&!y(t.$parent,"bpmn:SubProcess")?(i=ce(KE,r),this._createEntries(e,i)):y(t,"bpmn:Participant")?(i=ce(aw,function(o){return ve(e)!==o.target.isExpanded}),this._createEntries(e,i)):y(t,"bpmn:StartEvent")&&Ot(t.$parent)?(i=ce(rw,function(o){var a=o.target,s=a.isInterrupting!==!1,c=t.isInterrupting===s;return r(o)||!r(o)&&!c}),this._createEntries(e,i)):y(t,"bpmn:StartEvent")&&!Ot(t.$parent)&&y(t.$parent,"bpmn:SubProcess")?(i=ce(YE,r),this._createEntries(e,i)):y(t,"bpmn:EndEvent")?(i=ce(ZE,function(o){var a=o.target;return a.eventDefinitionType=="bpmn:CancelEventDefinition"&&!y(t.$parent,"bpmn:Transaction")?!1:r(o)}),this._createEntries(e,i)):y(t,"bpmn:BoundaryEvent")?(i=ce(iw,function(o){var a=o.target;if(a.eventDefinitionType=="bpmn:CancelEventDefinition"&&!y(t.attachedToRef,"bpmn:Transaction"))return!1;var s=a.cancelActivity!==!1,c=t.cancelActivity==s;return r(o)||!r(o)&&!c}),this._createEntries(e,i)):y(t,"bpmn:IntermediateCatchEvent")||y(t,"bpmn:IntermediateThrowEvent")?(i=ce(XE,r),this._createEntries(e,i)):y(t,"bpmn:Gateway")?(i=ce(QE,r),this._createEntries(e,i)):y(t,"bpmn:Transaction")?(i=ce(zf,r),this._createEntries(e,i)):Ot(t)&&ve(e)?(i=ce(ew,r),this._createEntries(e,i)):y(t,"bpmn:SubProcess")&&ve(e)?(i=ce(JE,r),this._createEntries(e,i)):y(t,"bpmn:AdHocSubProcess")&&!ve(e)?(i=ce(Ff,function(o){var a=o.target,s=a.type==="bpmn:SubProcess",c=a.isExpanded===!0;return $f(a)&&(!s||c)}),this._createEntries(e,i)):y(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,ow):y(t,"bpmn:FlowNode")?(i=ce(Ff,r),y(t,"bpmn:SubProcess")&&!ve(e)&&(i=ce(i,function(o){return o.label!=="Sub Process (collapsed)"})),this._createEntries(e,i)):{}},Xt.prototype.getPopupMenuHeaderEntries=function(e){var t={};return y(e,"bpmn:Activity")&&!Ot(e)&&(t=Ce(Ce({},t),this._getLoopCharacteristicsHeaderEntries(e))),y(e,"bpmn:DataObjectReference")&&(t=Ce(Ce({},t),this._getCollectionHeaderEntries(e))),y(e,"bpmn:Participant")&&(t=Ce(Ce({},t),this._getParticipantMultiplicityHeaderEntries(e))),y(e,"bpmn:SubProcess")&&!y(e,"bpmn:Transaction")&&!Ot(e)&&(t=Ce(Ce({},t),this._getAdHocHeaderEntries(e))),t},Xt.prototype._createEntries=function(e,t){var n={},i=this;return k(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Xt.prototype._createSequenceFlowEntries=function(e,t){var n=W(e),i={},r=this._modeling,o=this._moddle,a=this;return k(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(y(n.sourceRef,"bpmn:ExclusiveGateway")||y(n.sourceRef,"bpmn:InclusiveGateway")||y(n.sourceRef,"bpmn:ComplexGateway")||y(n.sourceRef,"bpmn:Activity"))&&(i=Pn(Ce({},i),{[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:n})})}));break;case"replace-with-conditional-flow":!n.conditionExpression&&y(n.sourceRef,"bpmn:Activity")&&(i=Pn(Ce({},i),{[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:c})})}));break;default:y(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i=Pn(Ce({},i),{[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})})),(y(n.sourceRef,"bpmn:ExclusiveGateway")||y(n.sourceRef,"bpmn:InclusiveGateway")||y(n.sourceRef,"bpmn:ComplexGateway")||y(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i=Pn(Ce({},i),{[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})}))}}),i},Xt.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=function(){return r(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||o,{label:i(a),className:e.className,action:n}},Xt.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(p,l){var u=W(e).loopCharacteristics;l.active?u=void 0:((Ys(l.options.isSequential)||!u||!y(u,l.options.loopCharacteristics))&&(u=t._moddle.create(l.options.loopCharacteristics)),u.isSequential=l.options.isSequential),t._modeling.updateProperties(e,{loopCharacteristics:u})}var r=W(e),o=r.loopCharacteristics,a,s,c;return o&&(a=o.isSequential,s=o.isSequential===void 0,c=o.isSequential!==void 0&&!o.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel Multi Instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential Multi Instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Xt.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function r(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var o=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:o,action:r}}},Xt.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,p;c||(p=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:p})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant Multiplicity"),active:!!o,action:r}}},Xt.prototype._getAdHocHeaderEntries=function(e){var t=this._translate,n=W(e),i=y(n,"bpmn:AdHocSubProcess"),r=this._bpmnReplace.replaceElement;return{"toggle-adhoc":{className:"bpmn-icon-ad-hoc-marker",title:t("Ad-hoc"),active:i,action:function(o,a){return i?r(e,{type:"bpmn:SubProcess"},{autoResize:!1,layoutConnection:!1}):r(e,{type:"bpmn:AdHocSubProcess"},{autoResize:!1,layoutConnection:!1})}}}};const sw={__depends__:[ep,If,Od],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Xt]};var Ia=Math.max,$a=Math.min,cw=20;function Hf(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function pw(e,t,n){var i=n.x,r=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(o.y=e.y+r,o.height=e.height-r):t.indexOf("s")!==-1&&(o.height=e.height+r),t.indexOf("e")!==-1?o.width=e.width+i:t.indexOf("w")!==-1&&(o.x=e.x+i,o.width=e.width-i),o}function lw(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 za(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return ie(r)&&(i=(/top|left/.test(e)?$a:Ia)(i,r)),ie(o)&&(i=(/top|left/.test(e)?Ia:$a)(i,o)),i}function uw(e,t){if(!t)return e;var n=X(e);return Zo({top:za("top",n,t),right:za("right",n,t),bottom:za("bottom",n,t),left:za("left",n,t)})}function hw(e,t,n,i){var r=X(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?X(i):o,s={top:$a(o.top,a.top),left:$a(o.left,a.left),bottom:Ia(o.bottom,a.bottom),right:Ia(o.right,a.right)};return Zo(s)}function no(e,t){return typeof e<"u"?e:cw}function dw(e,t){var n,i,r,o;return typeof t=="object"?(n=no(t.left),i=no(t.right),r=no(t.top),o=no(t.bottom)):n=i=r=o=no(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function fw(e){return!(e.waypoints||e.type==="label")}function Gf(e,t){var n;if(e.length===void 0?n=ce(e.children,fw):n=e,n.length)return dw(Ve(n),t)}var Fa=Math.abs;function mw(e,t){return Hf(X(t),X(e))}var vw=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],dr=30;function Ha(e,t){return t=t||[],e.children.filter(function(n){y(n,"bpmn:Lane")&&(Ha(n,t),t.push(n))}),t}function Li(e){return e.children.filter(function(t){return y(t,"bpmn:Lane")})}function on(e){return Ta(e,vw)||e}function yw(e,t){var n=on(e),i=y(n,"bpmn:Process")?[]:[n],r=Ha(n,i),o=X(e),a=X(t),s=mw(e,t),c=[];return r.forEach(function(p){if(p!==e){var l=0,u=s.right,h=0,d=s.left,f=X(p);s.top&&(Fa(f.bottom-o.top)<10&&(h=a.top-f.bottom),Fa(f.top-o.top)<5&&(l=a.top-f.top)),s.bottom&&(Fa(f.top-o.bottom)<10&&(l=a.bottom-f.top),Fa(f.bottom-o.bottom)<5&&(h=a.bottom-f.bottom)),(l||u||h||d)&&c.push({shape:p,newBounds:lw(p,{top:l,right:u,bottom:h,left:d})})}}),c}function io(e,t,n,i,r,o,a,s,c,p,l,u){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=p,this._rules=l,this._translate=u,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(h){var d=h.context,f=d.shape;if(!(!ir(h)||!i.isOpen(f))){var v=i.getEntries(f);v.replace&&v.replace.action.click(h,f)}})}io.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate"],io.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&N(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Remove"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},io.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return le(t)?Oo(t,function(n){return gw(t,n)}):t},io.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._rules,c=this._autoPlace,p=this._translate,l={};if(e.type==="label")return l;var u=e.businessObject;function h(_,x){r.start(_,x)}function d(_,x){n.removeElements([x])}function f(_){var x=5,S=t.getPad(_).html,M=S.getBoundingClientRect(),j={x:M.left,y:M.bottom+x};return j}function v(_,x,S,M){typeof S!="string"&&(M=S,S=p("Append {type}",{type:_.replace(/^bpmn:/,"")}));function j(D,$){var z=i.createShape(N({type:_},M));o.start(D,z,{source:$})}var B=c?function(D,$){var z=i.createShape(N({type:_},M));c.append($,z)}:j;return{group:"model",className:x,title:S,action:{dragstart:j,click:B}}}function g(_){return function(x,S){n.splitLane(S,_),t.open(S,!0)}}if(de(u,["bpmn:Lane","bpmn:Participant"])&&ve(e)){var R=Li(e);N(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:p("Add Lane above"),action:{click:function(_,x){n.addLane(x,"top")}}}}),R.length<2&&(e.height>=120&&N(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:p("Divide into two Lanes"),action:{click:g(2)}}}),e.height>=180&&N(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:p("Divide into three Lanes"),action:{click:g(3)}}})),N(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:p("Add Lane below"),action:{click:function(_,x){n.addLane(x,"bottom")}}}})}y(u,"bpmn:FlowNode")&&(y(u,"bpmn:EventBasedGateway")?N(l,{"append.receive-task":v("bpmn:ReceiveTask","bpmn-icon-receive-task",p("Append ReceiveTask")),"append.message-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",p("Append MessageIntermediateCatchEvent"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",p("Append TimerIntermediateCatchEvent"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",p("Append ConditionIntermediateCatchEvent"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",p("Append SignalIntermediateCatchEvent"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Vf(u,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?N(l,{"append.compensation-activity":v("bpmn:Task","bpmn-icon-task",p("Append compensation activity"),{isForCompensation:!0})}):!y(u,"bpmn:EndEvent")&&!u.isForCompensation&&!Vf(u,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Ot(u)&&N(l,{"append.end-event":v("bpmn:EndEvent","bpmn-icon-end-event-none",p("Append EndEvent")),"append.gateway":v("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",p("Append Gateway")),"append.append-task":v("bpmn:Task","bpmn-icon-task",p("Append Task")),"append.intermediate-event":v("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",p("Append Intermediate/Boundary Event"))})),a.isEmpty(e,"bpmn-replace")||N(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:p("Change type"),action:{click:function(_,x){var S=N(f(x),{cursor:{x:_.x,y:_.y}});a.open(x,"bpmn-replace",S,{title:p("Change element"),width:300,search:!0})}}}}),y(u,"bpmn:SequenceFlow")&&N(l,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation")}),de(u,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&N(l,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation"),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using "+(u.isForCompensation?"":"Sequence/MessageFlow or ")+"Association"),action:{click:h,dragstart:h}}}),y(u,"bpmn:TextAnnotation")&&N(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using Association"),action:{click:h,dragstart:h}}}),de(u,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&N(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using DataInputAssociation"),action:{click:h,dragstart:h}}}),y(u,"bpmn:Group")&&N(l,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation")});var E=s.allowed("elements.delete",{elements:[e]});return le(E)&&(E=E[0]===e),E&&N(l,{delete:{group:"edit",className:"bpmn-icon-trash",title:p("Remove"),action:{click:d}}}),l};function Vf(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return k(o,function(a){a.$type===n&&(r=!0)}),i&&r}function gw(e,t){return e.indexOf(t)!==-1}const bw={__depends__:[_f,fd,bn,dp,ja,sw],__init__:["contextPadProvider"],contextPadProvider:["type",io]};var xw={horizontal:["x","width"],vertical:["y","height"]},Wf=5;function Fn(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return le(i)?i:i?n:[]})}Fn.$inject=["modeling","rules"],Fn.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Fn.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},Fn.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(k(t,function(o){r=o(r,n,i)}),r):e},Fn.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=ln(e,i);return k(o,function(a,s){var c=n._findRange(a,i,r),p,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(p={range:c,elements:[a]},t.push(p))}),t},Fn.prototype._setOrientation=function(e){var t=xw[e];this._axis=t[0],this._dimension=t[1]},Fn.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)},Fn.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+Wf,max:t+n-Wf}};const _w={__init__:["distributeElements"],distributeElements:["type",Fn]};function Ga(e){qt.call(this,e)}Ga.$inject=["eventBus"],q(Ga,qt),Ga.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=ce(t,function(n){var i=de(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Uo(t),t.length<3?!1:t})};var Ew={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
  195. <polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
  196. <rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
  197. <rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
  198. </svg>`,vertical:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
  199. <polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
  200. <rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
  201. <rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
  202. </svg>`};const Uf=Ew;var ww=900;function ro(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",ww,this)}ro.$inject=["popupMenu","distributeElements","translate","rules"],ro.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&N(t,this._getEntries(e)),t},ro.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},ro.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:Uf.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Uf.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const Sw={__depends__:[ep,_w],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Ga],distributeElementsMenuProvider:["type",ro]};var qf="is not a registered action",Cw="is already registered";function Zt(e,t){this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Zt.$inject=["eventBus","injector"],Zt.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),p=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&this.register("paste",function(){o.paste()}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var u=s.allowed("elements.delete",{elements:l}),h;u!==!1&&(le(u)?h=u:h=l,h.length&&n.removeElements(h.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),p&&this.register("moveSelection",function(l){p.moveSelection(l.direction,l.accelerated)})},Zt.prototype.trigger=function(e,t){if(!this._actions[e])throw xp(e,qf);return this._actions[e](t)},Zt.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);k(e,function(i,r){n._registerAction(r,i)})},Zt.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw xp(e,Cw);this._actions[e]=t},Zt.prototype.unregister=function(e){if(!this.isRegistered(e))throw xp(e,qf);this._actions[e]=void 0},Zt.prototype.getActions=function(){return Object.keys(this._actions)},Zt.prototype.isRegistered=function(e){return!!this._actions[e]};function xp(e,t){return new Error(e+" "+t)}const Rw={__init__:["editorActions"],editorActions:["type",Zt]};function Va(e){e.invoke(Zt,this)}q(Va,Zt),Va.$inject=["injector"],Va.prototype._registerDefaultActions=function(e){Zt.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),p=e.get("alignElements",!1),l=e.get("directEditing",!1),u=e.get("searchPad",!1),h=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var f=t.getRootElement(),v=n.filter(function(g){return g!==f});return i.select(v),v}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(f){var v=i.get(),g=f.type;v.length&&c.trigger(v,g)}),i&&p&&this._registerAction("alignElements",function(f){var v=i.get(),g=[],R=f.type;v.length&&(g=ce(v,function(E){return!y(E,"bpmn:Lane")}),p.trigger(g,R))}),i&&h&&this._registerAction("setColor",function(f){var v=i.get();v.length&&h.setColor(v,f)}),i&&l&&this._registerAction("directEditing",function(){var f=i.get();f.length&&l.activate(f[0])}),u&&this._registerAction("find",function(){u.toggle()}),t&&h&&this._registerAction("moveToOrigin",function(){var f=t.getRootElement(),v,g;y(f,"bpmn:Collaboration")?g=n.filter(function(R){return y(R.parent,"bpmn:Collaboration")}):g=n.filter(function(R){return R!==f&&!y(R.parent,"bpmn:SubProcess")}),v=Ve(g),h.moveElements(g,{x:-v.x,y:-v.y},f)}),i&&d&&this._registerAction("replaceElement",function(f){d.triggerEntry("replace","click",f)})};const Pw={__depends__:[Rw],editorActions:["type",Va]};function Kf(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;de(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}Kf.$inject=["eventBus"];var Wa=10;function _p(e,t,n){return n||(n="round"),Math[n](e/t)*t}var kw=1200,Tw=800;function li(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",Tw,function(){r.setActive(i)}),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],kw,function(o){var a=o.originalEvent;if(!(!r.active||a&&jt(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(p){var l={},u=Mw(o,p,e);u&&(l.offset=u);var h=Aw(o,p);h&&N(l,h),hr(o,p)||r.snapEvent(o,p,l)})}})}li.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Ke(e,t,i)},li.prototype.getGridSpacing=function(){return Wa},li.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=_p(e,Wa);var i,r;return t&&t.min&&(i=t.min,ie(i)&&(i=_p(i+n,Wa,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,ie(r)&&(r=_p(r+n,Wa,"floor"),e=Math.min(e,r))),e-=n,e},li.prototype.isActive=function(){return this.active},li.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},li.prototype.toggleActive=function(){this.setActive(!this.active)},li.$inject=["elementRegistry","eventBus","config.gridSnapping"];function Aw(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(Ua(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,p=r.max;return c&&(Ua(t)?Xf(s)?a.x.max=c.left:a.x.min=c.right:Yf(s)?a.y.max=c.top:a.y.min=c.bottom),p&&(Ua(t)?Xf(s)?a.x.min=p.left:a.x.max=p.right:Yf(s)?a.y.min=p.top:a.y.max=p.bottom),a[t]}function Mw(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&ie(s[t])||(s||(s=o.snapOffset={}),ie(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Ua(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2)),s[t]}function Ua(e){return e==="x"}function Yf(e){return e.indexOf("n")!==-1}function Xf(e){return e.indexOf("w")!==-1}function Ii(e,t){V.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},a=o.autoResize;if(a){var s=r.shape,c=r.newBounds;Mt(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Ii.$inject=["eventBus","gridSnapping","modeling"],q(Ii,V),Ii.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},Ii.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},Ii.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),N(e,o),e},Ii.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),N(e,o),e};var Dw=2e3;function Zf(e,t){e.on(["spaceTool.move","spaceTool.end"],Dw,function(n){var i=n.context;if(i.initialized){var r=i.axis,o;r==="x"?(o=t.snapValue(n.dx),n.x=n.x+o-n.dx,n.dx=o):(o=t.snapValue(n.dy),n.y=n.y+o-n.dy,n.dy=o)}})}Zf.$inject=["eventBus","gridSnapping"];const Bw={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Ii],gridSnappingSpaceToolBehavior:["type",Zf]},Nw={__depends__:[Bw],__init__:["gridSnapping"],gridSnapping:["type",li]};var Ow=2e3;function Qf(e,t){e.on("autoPlace",Ow,function(n){var i=n.source,r=ne(i),o=n.shape,a=Bd(i,o);return["x","y"].forEach(function(s){var c={};a[s]!==r[s]&&(a[s]>r[s]?c.min=a[s]:c.max=a[s],y(o,"bpmn:TextAnnotation")&&(jw(s)?c.offset=-o.width/2:c.offset=-o.height/2),a[s]=t.snapValue(a[s],c))}),a})}Qf.$inject=["eventBus","gridSnapping"];function jw(e){return e==="x"}var Lw=1750;function Jf(e,t,n){t.on(["create.start","shape.move.start"],Lw,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!y(o,"bpmn:Participant")||!y(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}Jf.$inject=["canvas","eventBus","gridSnapping"];var Iw=3e3;function qa(e,t,n){V.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],Iw,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||$w(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}qa.$inject=["eventBus","gridSnapping","modeling"],q(qa,V),qa.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=Hw(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function $w(e){return e.length>3}function zw(e){return e==="h"}function Fw(e){return e==="v"}function Hw(e,t,n){var i=Dn(t,n),r={};return zw(i)&&(r.y=e.snapValue(t.y)),Fw(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=N({},t,r),n=N({},n,r)),[t,n]}const Gw={__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Qf],gridSnappingParticipantBehavior:["type",Jf],gridSnappingLayoutConnectionBehavior:["type",qa]},Vw={__depends__:[Nw,Gw],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Kf]};var Ww=30,Uw=30;function oo(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(y(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(y(r,"bpmn:Participant"))return ve(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(y(r,"bpmn:SubProcess"))return ve(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}oo.$inject=["eventBus","interactionEvents"],oo.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},oo.prototype._createParticipantHit=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:Ww,height:e.height}),!0},oo.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:Uw}),!0};const qw={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",oo]};function Ka(e){e.invoke(or,this)}q(Ka,or),Ka.$inject=["injector"],Ka.prototype.registerBindings=function(e,t){or.prototype.registerBindings.call(this,e,t);function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("selectElements",function(i){var r=i.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0}),n("find",function(i){var r=i.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0}),n("spaceTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["s","S"],r))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["l","L"],r))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["h","H"],r))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["c","C"],r))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["e","E"],r))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["r","R"],r))return t.trigger("replaceElement",r),!0})};const Kw={__depends__:[Fc],__init__:["keyboardBindings"],keyboardBindings:["type",Ka]};var Yw={moveSpeed:1,moveSpeedAccelerated:10},Xw=1500,em="left",tm="up",nm="right",im="down",Zw={ArrowLeft:em,Left:em,ArrowUp:tm,Up:tm,ArrowRight:nm,Right:nm,ArrowDown:im,Down:im},Qw={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 rm(e,t,n,i,r){var o=this;this._config=N({},Yw,e||{}),t.addListener(Xw,function(a){var s=a.keyEvent,c=Zw[s.key];if(c&&!t.isCmd(s)){var p=t.isShift(s);return o.moveSelection(c,p),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var p=this._config[s?"moveSpeedAccelerated":"moveSpeed"],l=Qw[a](p),u=i.allowed("elements.move",{shapes:c});u&&n.moveElements(c,l)}}}rm.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const Jw={__depends__:[Fc,bn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",rm]};var om=10;function ao(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,p){var l=c.shape,u=c.direction,h=c.resizeConstraints,d;c.delta=p,d=pw(l,u,p),c.newBounds=uw(d,h),c.canExecute=r.canResize(c)}function a(c){var p=c.resizeConstraints,l=c.minBounds;p===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:X(l)})}function s(c){var p=c.shape,l=c.canExecute,u=c.newBounds;if(l){if(u=Iu(u),!eS(p,u))return;n.resizeShape(p,u)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var p={x:c.dx,y:c.dy};o(c.context,p)}),e.on("resize.end",function(c){s(c.context)})}ao.prototype.canResize=function(e){var t=this._rules,n=un(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},ao.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=N({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,am(t,o),"resize",{autoActivate:!0,cursor:tS(o),data:{shape:t,context:r}})},ao.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:om,height:om},r=Gf(t,e.childrenBoxPadding),hw(n,t,i,r)},ao.$inject=["eventBus","rules","modeling","dragging"];function eS(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function am(e,t){var n=ne(e),i=X(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function tS(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 sm="djs-resizing",cm="resize-not-ok",nS=500;function pm(e,t,n){function i(o){var a=o.shape,s=o.newBounds,c=o.frame;c||(c=o.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,sm)),s.width>5&&Y(c,{x:s.x,width:s.width}),s.height>5&&Y(c,{y:s.y,height:s.height}),o.canExecute?he(c).remove(cm):he(c).add(cm)}function r(o){var a=o.shape,s=o.frame;s&&Fe(o.frame),t.removeMarker(a,sm)}e.on("resize.move",nS,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}pm.$inject=["eventBus","canvas","previewSupport"];var Ya=-6,Xa=8,Za=20,so="djs-resizer",iS=["n","w","s","e","nw","ne","se","sw"];function ui(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&k(a,Ct(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}ui.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){ai(o)&&i.activate(o,e,n)}J.bind(t,"mousedown",r),J.bind(t,"touchstart",r)},ui.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=rS(i),a=Z("g");he(a).add(so),he(a).add(so+"-"+e.id),he(a).add(so+"-"+i),ee(r,a);var s=Z("rect");Y(s,{x:-Xa/2+o.x,y:-Xa/2+o.y,width:Xa,height:Xa}),he(s).add(so+"-visual"),ee(a,s);var c=Z("rect");return Y(c,{x:-Za/2+o.x,y:-Za/2+o.y,width:Za,height:Za}),he(c).add(so+"-hit"),ee(a,c),gc(a,t,n),a},ui.prototype.createResizer=function(e,t){var n=am(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},ui.prototype.addResizer=function(e){var t=this;De(e)||!this._resize.canResize({shape:e})||k(iS,function(n){t.createResizer(e,n)})},ui.prototype.removeResizers=function(){var e=this._getResizersParent();Ho(e)},ui.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},ui.$inject=["eventBus","canvas","selection","resize"];function rS(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Ya:e.indexOf("w")!==-1&&(t.x=Ya),e.indexOf("s")!==-1?t.y=-Ya:e.indexOf("n")!==-1&&(t.y=Ya),t}const lm={__depends__:[_n,$n,Qr],__init__:["resize","resizePreview","resizeHandles"],resize:["type",ao],resizePreview:["type",pm],resizeHandles:["type",ui]};var oS=2e3;function co(e,t,n,i,r,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],oS,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var p=c.context,l=p.shape,u=c.context.canExecute,h=c.isTouch;h||u&&(p.hints&&p.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,p){(p||de(c,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||Ep(c))&&i.activate(c)}}co.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],co.prototype.activate=function(e){var t=Ut(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);N(n,i);var r={};return(de(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Ep(e))&&N(r,{centerVertically:!0}),ki(e)&&N(r,{autoResize:!0}),y(e,"bpmn:TextAnnotation")&&N(r,{resizable:!0,autoResize:!0}),N(n,{options:r}),n}},co.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),p=c.fontSize*a,l=c.lineHeight,u=s.fontSize*a,h=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(y(e,"bpmn:Lane")||cS(e))&&(N(o,{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}),N(d,{fontSize:u+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:"rotate(-90deg)"})),(de(e,["bpmn:Task","bpmn:CallActivity"])||sS(e)||Ep(e))&&(N(o,{width:i.width,height:i.height}),N(d,{fontSize:u+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),aS(e)&&(N(o,{width:i.width,x:i.x}),N(d,{fontSize:u+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var f=90*a,v=7*a,g=4*a;if(n.labelTarget&&(N(o,{width:f,height:i.height+v+g,x:r.x-f/2,y:i.y-v}),N(d,{fontSize:p+"px",lineHeight:l,paddingTop:v+"px",paddingBottom:g+"px"})),ki(n)&&!pa(n)&&!xe(n)){var R=Ac(e),E=t.getAbsoluteBBox({x:R.x,y:R.y,width:0,height:0}),_=p+v+g;N(o,{width:f,height:_,x:E.x-f/2,y:E.y-_/2}),N(d,{fontSize:p+"px",lineHeight:l,paddingTop:v+"px",paddingBottom:g+"px"})}return y(e,"bpmn:TextAnnotation")&&(N(o,{width:i.width,height:i.height,minWidth:30*a,minHeight:10*a}),N(d,{textAlign:"left",paddingTop:5*a+"px",paddingBottom:7*a+"px",paddingLeft:7*a+"px",paddingRight:5*a+"px",fontSize:u+"px",lineHeight:h})),{bounds:o,style:d}},co.prototype.update=function(e,t,n,i){var r,o;y(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),pS(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function Ep(e){return y(e,"bpmn:SubProcess")&&!ve(e)}function aS(e){return y(e,"bpmn:SubProcess")&&ve(e)}function sS(e){return y(e,"bpmn:Participant")&&!ve(e)}function cS(e){return y(e,"bpmn:Participant")&&ve(e)}function pS(e){return!e||!e.trim()}var um="djs-element-hidden",hm="djs-label-hidden";function dm(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var p=c.active;if(o=p.element.label||p.element,y(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Z("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),u=i.path=Z("path");Y(u,{d:l,strokeWidth:2,stroke:lS(o)}),ee(s,u),ee(r,s),kt(s,o.x,o.y)}y(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,um):(y(o,"bpmn:Task")||y(o,"bpmn:CallActivity")||y(o,"bpmn:SubProcess")||y(o,"bpmn:Participant"))&&t.addMarker(o,hm)}),e.on("directEditing.resize",function(c){if(y(o,"bpmn:TextAnnotation")){var p=c.height,l=c.dy,u=Math.max(o.height/a.height*(p+l),0),h=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:u,position:{mx:0,my:0}});Y(i.path,{d:h})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var p=c.active;p&&(t.removeMarker(p.element.label||p.element,um),t.removeMarker(o,hm)),o=void 0,a=void 0,s&&(Fe(s),s=void 0)})}dm.$inject=["eventBus","canvas","pathMap"];function lS(e,t){var n=ge(e);return n.get("stroke")||t||"black"}const uS={__depends__:[jc,lm,_f],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",co],labelEditingPreview:["type",dm]};var wp=["top","bottom","left","right"],Qa=10;function Sp(e,t){V.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,p=o.hints||{};p.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(pa(r)){var o=fS(r);o&&i(r,o)}}function i(r,o){var a=ne(r),s=r.label,c=ne(s);if(s.parent){var p=X(r),l;switch(o){case"top":l={x:a.x,y:p.top-Qa-s.height/2};break;case"left":l={x:p.left-Qa-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:p.bottom+Qa+s.height/2};break;case"right":l={x:p.right+Qa+s.width/2,y:a.y};break}var u=tn(l,c);t.moveShape(s,u)}}}q(Sp,V),Sp.$inject=["eventBus","modeling"];function hS(e){var t=e.host,n=ne(e),i=lt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=wp.filter(function(a){return r.indexOf(a)===-1});return o}function dS(e){var t=ne(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 fm(t,i)});return n}function fS(e){var t=ne(e.label),n=ne(e),i=fm(n,t);if(mS(i)){var r=dS(e);if(e.host){var o=hS(e);r=r.concat(o)}var a=wp.filter(function(s){return r.indexOf(s)===-1});if(a.indexOf(i)===-1)return a[0]}}function fm(e,t){return lt(t,e,5)}function mS(e){return wp.indexOf(e)!==-1}function Cp(e){V.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(y(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)}q(Cp,V),Cp.$inject=["eventBus"];function Rp(e,t){e.invoke(V,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=ce(r.incoming.concat(r.outgoing),function(a){return y(a,"bpmn:Association")});k(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}q(Rp,V),Rp.$inject=["injector","modeling"];var mm=500;function Ja(e,t){t.invoke(V,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",mm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return vm(o,a)}),r.length===1&&r.map(function(o){return r.indexOf(o)}).forEach(function(o){var a=r[o];i.elements[o]=n._replaceShape(r[o],a)})},!0),this.preExecute("elements.move",mm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];vm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Ja.$inject=["bpmnReplace","injector"],q(Ja,V),Ja.prototype._replaceShape=function(e,t){var n=vS(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function vS(e){var t=W(e),n=t.eventDefinitions;return n&&n[0]}function vm(e,t){return!xe(e)&&de(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Pp(e,t){V.call(this,e);function n(i){return ce(i.attachers,function(r){return y(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);y(r,"bpmn:EventBasedGateway")&&y(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;y(r,"bpmn:Gateway")&&y(o,"bpmn:EventBasedGateway")&&k(o.outgoing,function(a){var s=a.target,c=n(s);y(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Pp.$inject=["eventBus","modeling"],q(Pp,V);function kp(e){e.invoke(V,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;y(i,"bpmn:Lane")&&!y(r,"bpmn:Lane")&&(n.parent=Ta(i,"bpmn:Participant"))})}kp.$inject=["injector"],q(kp,V);function Tp(e,t){V.call(this,e),this.preExecute("shape.create",function(n){var i=n.context,r=i.shape;if(y(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");r.businessObject.dataObjectRef=o}})}Tp.$inject=["eventBus","bpmnFactory"],q(Tp,V);var Ap=20,Mp=20,ym=30,es=2e3;function Dp(e,t,n){V.call(this,t),t.on(["create.start","shape.move.start"],es,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!y(a,"bpmn:Participant")||!y(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(u){return!y(u,"bpmn:Group")&&!xe(u)&&!De(u)});if(c.length){var p=Ve(c),l=yS(a,p);N(a,l),o.createConstraints=gS(a,p)}}}),t.on("create.start",es,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function p(l){l.element=s,l.gfx=c}y(a,"bpmn:Participant")&&y(s,"bpmn:Process")&&(t.on("element.hover",es,p),t.once("create.cleanup",function(){t.off("element.hover",p)}))});function i(){var r=e.getRootElement();return y(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",es,function(r){var o=r.elements,a=r.parent,s=bS(o),c;s&&y(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=W(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;y(a,"bpmn:Participant")&&y(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=W(a).get("processRef"))},!0),this.execute("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.shape,c=o.participant;a&&(!c||s===c)&&W(s).set("processRef",W(a))},!0),this.revert("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.processRef||o.processRef,c=r.shape,p=o.participant;a&&(!p||c===p)&&W(c).set("processRef",s)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,s=r.shape,c=o.participant;if(a){var p=a.children.slice();c?s===c&&n.moveElements(p,{x:0,y:0},c):n.moveElements(p,{x:0,y:0},s)}},!0)}Dp.$inject=["canvas","eventBus","modeling"],q(Dp,V);function yS(e,t){t={width:t.width+Ap*2+ym,height:t.height+Mp*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 gS(e,t){return t=X(t),{bottom:t.top+e.height/2-Mp,left:t.right-e.width/2+Ap,top:t.bottom-e.height/2+Mp,right:t.left+e.width/2-Ap-ym}}function bS(e){return ye(e,function(t){return y(t,"bpmn:Participant")})}var gm="__targetRef_placeholder";function Bp(e,t){V.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],bm(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],bm(o));function n(a,s,c){var p=a.get("dataInputAssociations");return ye(p,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),p=ye(c,function(l){return l.name===gm});return!p&&s&&(p=t.create("bpmn:Property",{name:gm}),Ze(c,p)),p}function r(a,s){var c=i(a);c&&(n(a,c,s)||We(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,p=c.businessObject,l=c.target,u=l&&l.businessObject,h=s.newTarget,d=h&&h.businessObject,f=s.oldTarget||s.target,v=f&&f.businessObject,g=c.businessObject,R;v&&v!==u&&r(v,p),d&&d!==u&&r(d,p),u?(R=i(u,!0),g.targetRef=R):g.targetRef=null}}Bp.$inject=["eventBus","bpmnFactory"],q(Bp,V);function bm(e){return function(t){var n=t.context,i=n.connection;if(y(i,"bpmn:DataInputAssociation"))return e(t)}}function ts(e){this._bpmnUpdater=e}ts.$inject=["bpmnUpdater"],ts.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},ts.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]};function Np(e,t,n,i){V.call(this,i),t.registerHandler("dataStore.updateContainment",ts);function r(){return n.filter(function(s){return y(s,"bpmn:Participant")&&W(s).processRef})[0]}function o(s){return s.children.filter(function(c){return y(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var p=s.businessObject||s;if(c=c||r(),c){var l=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:p,dataStoreDi:ge(s),newSemanticParent:l.processRef||l,newDiParent:ge(c)})}}this.preExecute("shape.create",function(s){var c=s.context,p=c.shape;y(p,"bpmn:DataStoreReference")&&p.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,p=c.shapes,l=p.filter(function(u){return y(u,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=p.filter(function(u){return!y(u,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,p=c.shape,l=p.parent;y(p,"bpmn:DataStoreReference")&&p.type!=="label"&&y(l,"bpmn:Collaboration")&&a(p)}),this.postExecute("shape.move",function(s){var c=s.context,p=c.shape,l=c.oldParent,u=p.parent;if(!y(l,"bpmn:Collaboration")&&y(p,"bpmn:DataStoreReference")&&p.type!=="label"&&y(u,"bpmn:Collaboration")){var h=y(l,"bpmn:Participant")?l:_S(l,"bpmn:Participant");a(p,h)}}),this.postExecute("shape.delete",function(s){var c=s.context,p=c.shape,l=e.getRootElement();de(p,["bpmn:Participant","bpmn:SubProcess"])&&y(l,"bpmn:Collaboration")&&o(l).filter(function(u){return xS(u,p)}).forEach(function(u){a(u)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,p=c.oldRoot,l=c.newRoot,u=o(p);u.forEach(function(h){y(l,"bpmn:Process")&&a(h,l)})})}Np.$inject=["canvas","commandStack","elementRegistry","eventBus"],q(Np,V);function xS(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 _S(e,t){for(;e.parent;){if(y(e.parent,t))return e.parent;e=e.parent}}var ES=500;function Op(e,t){V.call(this,e);function n(i,r){var o=Li(r),a=[],s=[];if(Si(o,function(u){return u.y>i.y?s.push(u):a.push(u),u.children}),!!o.length){var c;s.length&&a.length?c=i.height/2:c=i.height;var p,l;a.length&&(p=t.calculateAdjustments(a,"y",c,i.y-10),t.makeSpace(p.movingShapes,p.resizingShapes,{x:0,y:c},"s")),s.length&&(l=t.calculateAdjustments(s,"y",-c,i.y+i.height+10),t.makeSpace(l.movingShapes,l.resizingShapes,{x:0,y:-c},"n"))}}this.postExecuted("shape.delete",ES,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;y(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Op.$inject=["eventBus","spaceTool"],q(Op,V);var xm=500;function ns(e,t){t.invoke(V,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",xm,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return _m(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",xm,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;_m(a,SS(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}ns.$inject=["bpmnReplace","injector"],q(ns,V),ns.prototype._replaceShape=function(e){var t=wS(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function wS(e){var t=W(e),n=t.eventDefinitions;return n&&n[0]}function _m(e,t){return!xe(e)&&y(e,"bpmn:BoundaryEvent")&&!t}function SS(e,t){return e.indexOf(t)!==-1}function jp(e,t,n){V.call(this,e);function i(r,o,a){var s=o.waypoints,c,p,l,u,h,d,f,v=r.outgoing.slice(),g=r.incoming.slice(),R;ie(a.width)?R=ne(a):R=a;var E=op(s,R);if(E){if(c=s.slice(0,E.index),p=s.slice(E.index+(E.bendpoint?1:0)),!c.length||!p.length)return;l=E.bendpoint?s[E.index]:R,(c.length===1||!Em(r,c[c.length-1]))&&c.push(wm(l)),(p.length===1||!Em(r,p[0]))&&p.unshift(wm(l))}u=o.source,h=o.target,t.canConnect(u,r,o)&&(n.reconnectEnd(o,r,c||R),d=o),t.canConnect(r,h,o)&&(d?f=n.connect(r,h,{type:o.type,waypoints:p}):(n.reconnectStart(o,r,p||R),f=o));var _=[].concat(d&&ce(g,function(x){return x.source===d.source})||[],f&&ce(v,function(x){return x.target===f.target})||[]);_.length&&n.removeElements(_)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var p=ne(c),l={x:p.x+s.x,y:p.y+s.y},u=ye(o.children,function(h){var d=t.canInsert(a,h);return d&&op(h.waypoints,l)});u&&(r.targetFlow=u,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}q(jp,V),jp.$inject=["eventBus","bpmnRules","modeling"];function Em(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 wm(e){return N({},e)}function Lp(e,t){V.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&fr(r)){var c=[];y(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(fr):c=a.incoming.filter(function(p){return fr(p)&&y(p.source,"bpmn:EventBasedGateway")}),c.forEach(function(p){t.removeConnection(p)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(y(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(fr).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(fr).forEach(function(s){const c=a.incoming.filter(fr).filter(function(p){return p.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Lp.$inject=["eventBus","modeling"],q(Lp,V);function fr(e){return y(e,"bpmn:SequenceFlow")}var is=1500,CS=2e3;function Sm(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"],is,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;y(a,"bpmn:Lane")&&!de(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=on(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a!==s&&(o.labelTarget||y(o,"bpmn:Group"))&&(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"],is,function(i){var r=i.hover;y(r,"bpmn:Lane")&&(i.hover=on(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],is,function(i){var r=i.context,o=i.hover,a=r.type;y(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=on(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],is,function(i){var r=i.context,o=r.start;y(o,"bpmn:Lane")&&(r.start=on(o)||o)}),t.on("shape.move.start",CS,function(i){var r=i.shape;y(r,"bpmn:Lane")&&(i.shape=on(r)||r)})}Sm.$inject=["elementRegistry","eventBus","canvas"];function RS(e){return e.create("bpmn:Category")}function PS(e){return e.create("bpmn:CategoryValue")}function kS(e,t,n){return Ze(t.get("categoryValue"),e),e.$parent=t,Ze(n.get("rootElements"),t),t.$parent=n,e}function TS(e){var t=e.$parent;return t&&(We(t.get("categoryValue"),e),e.$parent=null),e}function AS(e){var t=e.$parent;return t&&(We(t.get("rootElements"),e),e.$parent=null),e}var Cm=770;function Ip(e,t,n,i,r,o){r.invoke(V,this);function a(){return n.filter(function(f){return y(f,"bpmn:Group")})}function s(f,v){return f.some(function(g){var R=W(g),E=R.categoryValueRef&&R.categoryValueRef.$parent;return E===v})}function c(f,v){return f.some(function(g){var R=W(g);return R.categoryValueRef===v})}function p(f,v,g){var R=a().filter(function(E){return E.businessObject!==g});v&&!s(R,v)&&AS(v),f&&!c(R,f)&&TS(f)}function l(f,v){return kS(f,v,t.getDefinitions())}function u(f,v){var g=W(f),R=g.categoryValueRef;R||(R=g.categoryValueRef=v.categoryValue=v.categoryValue||PS(e));var E=R.$parent;E||(E=R.$parent=v.category=v.category||RS(e)),l(R,E,t.getDefinitions())}function h(f,v){var g=v.category,R=v.categoryValue,E=W(f);R?(E.categoryValueRef=null,p(R,g,E)):p(null,E.categoryValueRef.$parent,E)}this.execute("label.create",function(f){var v=f.context,g=v.labelTarget;y(g,"bpmn:Group")&&u(g,v)}),this.revert("label.create",function(f){var v=f.context,g=v.labelTarget;y(g,"bpmn:Group")&&h(g,v)}),this.execute("shape.delete",function(f){var v=f.context,g=v.shape,R=W(g);if(!(!y(g,"bpmn:Group")||g.labelTarget)){var E=v.categoryValue=R.categoryValueRef,_;E&&(_=v.category=E.$parent,p(E,_,R),R.categoryValueRef=null)}}),this.reverted("shape.delete",function(f){var v=f.context,g=v.shape;if(!(!y(g,"bpmn:Group")||g.labelTarget)){var R=v.category,E=v.categoryValue,_=W(g);E&&(_.categoryValueRef=E,l(E,R))}}),this.execute("shape.create",function(f){var v=f.context,g=v.shape;!y(g,"bpmn:Group")||g.labelTarget||W(g).categoryValueRef&&u(g,v)}),this.reverted("shape.create",function(f){var v=f.context,g=v.shape;!y(g,"bpmn:Group")||g.labelTarget||W(g).categoryValueRef&&h(g,v)});function d(f,v){var g=e.create(f.$type);return o.copyElement(f,g,null,v)}i.on("copyPaste.copyElement",Cm,function(f){var v=f.descriptor,g=f.element;if(!(!y(g,"bpmn:Group")||g.labelTarget)){var R=W(g);if(R.categoryValueRef){var E=R.categoryValueRef;v.categoryValue=d(E,!0),E.$parent&&(v.category=d(E.$parent,!0))}}}),i.on("copyPaste.pasteElement",Cm,function(f){var v=f.descriptor,g=v.businessObject,R=v.categoryValue,E=v.category;R&&(R=g.categoryValueRef=d(R)),E&&(R.$parent=d(E)),delete v.category,delete v.categoryValue})}Ip.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],q(Ip,V);function $p(e,t,n,i){var r,o,a,s,c;return r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),r==0?null:(o=e.y-n.y,a=e.x-n.x,c=(i.x-n.x)*o-(i.y-n.y)*a,s=c/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function Rm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=$p(i,r,o,a),p=$p(i,r,o,s),l;c&&p?Pm(c,o)>Pm(p,o)?l=p:l=c:l=c||p,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],ne(i.source)),t(r[r.length-1],r[r.length-2],ne(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Rm.$inject=["eventBus"];function Pm(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zp(e){V.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,r=W(i),o=ge(i);de(r,t)&&!o.get("isHorizontal")&&o.set("isHorizontal",!0)})}zp.$inject=["eventBus"],q(zp,V);var km=Math.sqrt,Tm=Math.min,MS=Math.max,Am=Math.abs;function Mm(e){return Math.pow(e,2)}function po(e,t){return km(Mm(e.x-t.x)+Mm(e.y-t.y))}function DS(e,t){var n=0,i,r,o,a,s,c,p,l,u,h,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Bm(i,r)?p=[i]:(o=po(e,i),a=po(e,r),c=Tm(o,a),p=BS(i,r,e,c)),p.length<1)throw new Error("expected between [1, 2] circle -> line intersections");p.length===1&&(l={type:"bendpoint",position:p[0],segmentIndex:n,bendpointIndex:Bm(i,p[0])?n:n+1}),p.length===2&&(s=OS(p[0],p[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:po(i,s)/po(i,r)}),u=po(l.position,e),(!d||h>u)&&(d=l,h=u)}return d}function BS(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,p=r*a+o*s,l=a*a+s*s-i*i,u=p/c,h=l/c,d=u*u-h;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var f=km(d),v=-u+f,g=-u-f,R={x:e.x-r*v,y:e.y-o*v};if(d===0)return[R];var E={x:e.x-r*g,y:e.y-o*g};return[R,E].filter(function(_){return NS(_,e,t)})}function NS(e,t,n){return Dm(e.x,t.x,n.x)&&Dm(e.y,t.y,n.y)}function Dm(e,t,n){return e>=Tm(t,n)-rs&&e<=MS(t,n)+rs}function OS(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var rs=.1;function Bm(e,t){return Am(e.x-t.x)<=rs&&Am(e.y-t.y)<=rs}function jS(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,p=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=p&&(l=c?r+1:r-1),r<p&&(l=r,c&&n.type!=="bendpoint"&&p-1===r)){var u=Om(t,p);u<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Nm(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=DS(e,n),c=s.segmentIndex,p=jS(n,t,s,i);if(p<0||p>t.length-2||p===null)return a;var l=jm(n,c),u=jm(t,p),h=s.position,d=IS(l,h),f=LS(l,u);if(s.type==="bendpoint"){var v=t.length-n.length,g=s.bendpointIndex,R=n[g];if(t.indexOf(R)!==-1)return a;if(v===0){var E=t[g];return r=E.x-s.position.x,o=E.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}v<0&&g!==0&&g<n.length-1&&(d=Om(n,g))}var _={x:(u[1].x-u[0].x)*d+u[0].x,y:(u[1].y-u[0].y)*d+u[0].y},x=iE({x:e.x-h.x,y:e.y-h.y},f);return r=_.x+x.x-e.x,o=_.y+x.y-e.y,{point:ti(_),delta:ti({x:r,y:o})}}function Om(e,t){var n=Ba(e[t-1],e[t]),i=Ba(e[t],e[t+1]),r=n/(n+i);return r}function LS(e,t){var n=Hd(e),i=Hd(t);return i-n}function jm(e,t){return[e[t],e[t+1]]}function IS(e,t){var n=Ba(e[0],e[1]),i=Ba(e[0],t);return n===0?0:i/n}function $S(e,t,n,i){var r=ne(e);return Nm(r,t,n,i).delta}function lo(e,t,n){var i=Gr(t),r=Gr(n),o=tn(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return ti({x:r.x+a.x,y:r.y+a.y})}function Lm(e,t,n){var i=Gr(e),r=Gr(t),o=Gr(n),a=tn(e,i),s=tn(i,r),c=zS(i,t,n);if(c)return c;var p={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},l={x:o.x+p.x,y:o.y+p.y};return ti({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function zS(e,t,n){var i=X(t),r=X(n);if(FS(i,r))return null;var o=lt(t,e),a,s,c;if(o==="top")a={x:0,y:r.bottom-i.bottom};else if(o==="bottom")a={x:0,y:r.top-i.top};else if(o==="right")a={x:r.left-i.left,y:0};else if(o==="left")a={x:r.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=lt(n,s),c!==o?null:a}function FS(e,t){return HS(e,t)||GS(e,t)}function HS(e,t){return e.right!==t.right&&e.left!==t.left}function GS(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Im="name",$m="text";function Fp(e,t,n,i){V.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{W(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,p=s.properties;if(Im in p&&t.updateLabel(c,p[Im]),$m in p&&y(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},p[$m]||"");t.updateLabel(c,p.text,l)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var p=s.shape||s.connection;xe(p)||!ki(p)||Ut(p)&&t.updateLabel(p,Ut(p))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,p=s.hints||{};c&&p.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,p=c.label,l=N({},s.hints),u=s.newWaypoints||c.waypoints,h=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),$S(p,u,h,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var p=s.connection,l=p.label,u;!l||!l.parent||(u=o(a),t.moveShape(l,u))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,p=s.oldShape,l=W(c);l&&ki(l)&&p.label&&c.label&&(c.label.x=p.label.x,c.label.y=p.label.y)}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,p=s.newBounds,l=s.oldBounds;if(pa(c)){var u=c.label,h=ne(u),d=US(l),f=WS(h,d),v=VS(f,l,p);t.moveShape(u,v)}})}q(Fp,V),Fp.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function VS(e,t,n){var i=lo(e,t,n);return ti(tn(i,e))}function WS(e,t){if(t.length){var n=qS(e,t);return ap(e,n)}}function US(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 qS(e,t){var n=t.map(function(r){return{line:r,distance:Gd(e,r)}}),i=ln(n,"distance");return i[0].line}function KS(e,t,n,i){return Nm(e,t,n,i).point}function Hp(e,t){V.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=N({},o.hints),c=o.newWaypoints||a.waypoints,p=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),KS(r,c,p,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var p=c.waypoints[c.waypoints.length-1],l=n(i,p),u=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,u)}),a.forEach(function(c){var p=c.waypoints[0],l=n(i,p),u=[].concat([l],c.waypoints.slice(1));t.updateWaypoints(c,u)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(p){var l=p.waypoints[p.waypoints.length-1],u={x:l.x+c.x,y:l.y+c.y},h=[].concat(p.waypoints.slice(0,-1),[u]);t.updateWaypoints(p,h)}),a.forEach(function(p){var l=p.waypoints[0],u={x:l.x+c.x,y:l.y+c.y},h=[].concat([u],p.waypoints.slice(1));t.updateWaypoints(p,h)})})}q(Hp,V),Hp.$inject=["eventBus","modeling"];function os(e,t,n){var i=ss(e),r=Fm(i,t),o=i[0];return r.length?r[r.length-1]:lo(o.original||o,n,t)}function as(e,t,n){var i=ss(e),r=Fm(i,t),o=i[i.length-1];return r.length?r[0]:lo(o.original||o,n,t)}function Gp(e,t,n){var i=ss(e),r=zm(t,n),o=i[0];return lo(o.original||o,r,t)}function Vp(e,t,n){var i=ss(e),r=zm(t,n),o=i[i.length-1];return lo(o.original||o,r,t)}function zm(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function ss(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Fm(e,t){var n=bt(e,XS);return ce(n,function(i){return YS(i,t)})}function YS(e,t){return lt(t,e,1)==="intersect"}function XS(e){return e.original||e}function Wp(e,t){V.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(ZS(i,r)){var o=QS(i);o.incoming.forEach(function(a){var s=as(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=os(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Wp.$inject=["eventBus","modeling"],q(Wp,V);function ZS(e,t){return y(e,"bpmn:Participant")&&ve(e)&&y(t,"bpmn:Participant")&&!ve(t)}function QS(e){var t=Pr([e],!1),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){y(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){y(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}var JS="flow elements must be children of pools/participants";function Hm(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:a||2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;y(s,"bpmn:Collaboration")&&y(a,"bpmn:FlowNode")&&i(r,n(JS))})}Hm.$inject=["eventBus","tooltips","translate"];function Up(e,t){V.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=ge(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}q(Up,V),Up.$inject=["eventBus","modeling"];function qp(e,t,n){V.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!y(o,"bpmn:SequenceFlow")||!y(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=eC(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}q(qp,V),qp.$inject=["eventBus","bpmnRules","modeling"];function mr(e){return e.original||e}function eC(e,t){var n=$p(mr(e[e.length-2]),mr(e[e.length-1]),mr(t[1]),mr(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[mr(e[0]),mr(t[t.length-1])]}function Kp(e,t){V.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;y(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;i&&!i.businessObject.participants.length&&t.makeProcess()},!0)}Kp.$inject=["eventBus","modeling"],q(Kp,V);function Yp(e,t,n,i){V.call(this,e);var r=i.get("dragging",!1);function o(c){var p=c.source,l=c.target,u=c.parent;if(u){var h,d;y(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(p,l)||(d=!0),n.canConnectMessageFlow(p,l)&&(h="bpmn:MessageFlow")),y(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(p,l)||(d=!0),n.canConnectSequenceFlow(p,l)&&(h="bpmn:SequenceFlow")),y(c,"bpmn:Association")&&!n.canConnectAssociation(p,l)&&(d=!0),d&&t.removeConnection(c),h&&t.connect(p,l,{type:h,waypoints:c.waypoints.slice()})}}function a(c){var p=c.context,l=p.connection,u=p.newSource||l.source,h=p.newTarget||l.target,d,f;d=n.canConnect(u,h),!(!d||d.type===l.type)&&(f=t.connect(u,h,{type:d.type,waypoints:l.waypoints.slice()}),t.removeConnection(l),p.connection=f,r&&s(l,f))}function s(c,p){var l=r.context(),u=l&&l.payload.previousSelection,h;!u||!u.length||(h=u.indexOf(c),h!==-1&&u.splice(h,1,p))}this.postExecuted("elements.move",function(c){var p=c.closure,l=p.allConnections;k(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var p=c.context,l=p.properties,u=p.element,h=u.businessObject,d;l.default&&(d=ye(u.outgoing,hn({id:u.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&h.sourceRef.default===h&&t.updateProperties(u.source,{default:void 0})})}q(Yp,V),Yp.$inject=["eventBus","modeling","bpmnRules","injector"];function cs(e,t,n,i,r,o){i.invoke(V,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,p=s.elements,l=Gt(p,function(u,h){var d=t.canReplace([h],h.host||h.parent||c);return d?u.concat(d.replacements):u},[]);l.length&&this._replaceElements(p,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,p=s.newHost,l=[];k(s.closure.topLevel,function(h){Ot(h)?l=l.concat(h.children):l=l.concat(h)}),l.length===1&&p&&(c=p);var u=t.canReplace(l,c);u&&this._replaceElements(l,u.replacements,p)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,p=s.newShape,l=c.attachers,u;l&&l.length&&(u=t.canReplace(l,p),this._replaceElements(l,u.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,p=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(p,{id:c.id})})}q(cs,V),cs.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;k(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},cs.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var tC=1500,nC={width:140,height:120},$i={width:300,height:60},uo={width:300,height:150},Gm={width:140,height:120},Vm={width:50,height:30};function Wm(e){e.on("resize.start",tC,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(y(i,"bpmn:Lane")||y(i,"bpmn:Participant"))&&(n.resizeConstraints=pC(i,r,o)),y(i,"bpmn:Participant")&&(n.minDimensions=uo),y(i,"bpmn:SubProcess")&&ve(i)&&(n.minDimensions=Gm),y(i,"bpmn:TextAnnotation")&&(n.minDimensions=Vm)})}Wm.$inject=["eventBus"];var ps=Math.abs,iC=Math.min,rC=Math.max;function Um(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function ls(e,t,n){return Um(e,t,n,iC)}function us(e,t,n){return Um(e,t,n,rC)}var oC=20,aC=50,sC=20,cC=20;function pC(e,t,n){var i=on(e),r=!0,o=!0,a=Ha(i,[i]),s=X(e),c={},p={};/e/.test(t)?p.right=s.left+$i.width:/w/.test(t)&&(p.left=s.right-$i.width),a.forEach(function(u){var h=X(u);/n/.test(t)&&(h.top<s.top-10&&(r=!1),n&&ps(s.top-h.bottom)<10&&us(c,"top",h.top+$i.height),ps(s.top-h.top)<5&&ls(p,"top",h.bottom-$i.height)),/s/.test(t)&&(h.bottom>s.bottom+10&&(o=!1),n&&ps(s.bottom-h.top)<10&&ls(c,"bottom",h.bottom-$i.height),ps(s.bottom-h.bottom)<5&&us(p,"bottom",h.top+$i.height))});var l=i.children.filter(function(u){return!u.hidden&&!u.waypoints&&(y(u,"bpmn:FlowElement")||y(u,"bpmn:Artifact"))});return l.forEach(function(u){var h=X(u);r&&/n/.test(t)&&ls(p,"top",h.top-sC),/e/.test(t)&&us(p,"right",h.right+oC),o&&/s/.test(t)&&us(p,"bottom",h.bottom+cC),/w/.test(t)&&ls(p,"left",h.left-aC)}),{min:p,max:c}}var qm=1001;function Km(e,t){e.on("resize.start",qm+500,function(n){var i=n.context,r=i.shape;(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))&&(i.balanced=!ir(n))}),e.on("resize.end",qm,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))return o&&(a=Iu(a),t.resizeLane(r,a,i.balanced)),!1})}Km.$inject=["eventBus","modeling"];var lC=500;function Xp(e,t,n,i,r){n.invoke(V,this);function o(l){return de(l,["bpmn:ReceiveTask","bpmn:SendTask"])||uC(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var u=e.getDefinitions(),h=u.get("rootElements");return!!ye(h,hn({id:l.id}))}function s(l){if(y(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(y(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(y(l,"bpmn:MessageEventDefinition"))return"messageRef";if(y(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(de(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var u=l.get("eventDefinitions"),h=u[0];return h.get(s(h))}function p(l,u){if(de(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",u);var h=l.get("eventDefinitions"),d=h[0];return d.set(s(d),u)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var u=l.shape||l.element;if(o(u)){var h=W(u),d=c(h),f;d&&!a(d)&&(f=e.getDefinitions().get("rootElements"),Ze(f,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var u=l.addedRootElement;if(u){var h=e.getDefinitions().get("rootElements");We(h,u)}},!0),t.on("copyPaste.copyElement",function(l){var u=l.descriptor,h=l.element;if(!(h.labelTarget||!o(h))){var d=W(h),f=c(d);f&&(u.referencedRootElement=f)}}),t.on("copyPaste.pasteElement",lC,function(l){var u=l.descriptor,h=u.businessObject,d=u.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),p(h,d),delete u.referencedRootElement)})}Xp.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],q(Xp,V);function uC(e,t){return le(t)||(t=[t]),kn(t,function(n){return ca(e,n)})}var hC=Math.max;function Ym(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return k(n,function(a){var s=a.id;y(a,"bpmn:Participant")&&(dC(i)?o[s]=uo:o[s]={width:uo.width,height:fC(a,r)}),y(a,"bpmn:SubProcess")&&ve(a)&&(o[s]=Gm),y(a,"bpmn:TextAnnotation")&&(o[s]=Vm),y(a,"bpmn:Group")&&(o[s]=nC)}),o})}Ym.$inject=["eventBus"];function dC(e){return e==="x"}function fC(e,t){var n;return mC(e)?(n=vC(e,t),hC(uo.height,n)):uo.height}function mC(e){return!!Li(e).length}function vC(e,t){var n=Li(e),i;return i=Xm(n,t),e.height-i.height+$i.height}function Xm(e,t){var n,i,r;for(n=0;n<e.length;n++)if(i=e[n],t>=i.y&&t<=i.y+i.height)return r=Li(i),r.length?Xm(r,t):i}var Zm=400,yC=600,Qm={x:180,y:160};function hi(e,t,n,i,r,o,a){V.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(u){return y(u,"bpmn:SubProcess")&&!ve(u)}function p(u){var h=u.shape,d=u.newRootElement,f=W(h);d=s._addDiagram(d||f),u.newRootElement=e.addRootElement(d)}function l(u){var h=u.shape,d=W(h);s._removeDiagram(d);var f=u.newRootElement=a.get(Ln(d));e.removeRootElement(f)}this.executed("shape.create",function(u){var h=u.shape;c(h)&&p(u)},!0),this.postExecuted("shape.create",function(u){var h=u.shape,d=u.newRootElement;!d||!h.children||(s._showRecursively(h.children),s._moveChildrenToShape(h,d))},!0),this.reverted("shape.create",function(u){var h=u.shape;c(h)&&l(u)},!0),this.preExecuted("shape.delete",function(u){var h=u.shape;if(c(h)){var d=a.get(Ln(h));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(u){var h=u.shape;c(h)&&l(u)},!0),this.reverted("shape.delete",function(u){var h=u.shape;c(h)&&p(u)},!0),this.preExecuted("shape.replace",function(u){var h=u.oldShape,d=u.newShape;!c(h)||!c(d)||(u.oldRoot=e.removeRootElement(Ln(h)))},!0),this.postExecuted("shape.replace",function(u){var h=u.newShape,d=u.oldRoot,f=e.findRoot(Ln(h));if(!(!d||!f)){var v=d.children;n.moveElements(v,{x:0,y:0},f)}},!0),this.executed("element.updateProperties",function(u){var h=u.element;if(y(h,"bpmn:SubProcess")){var d=u.properties,f=u.oldProperties,v=f.id,g=d.id;if(v!==g){if($c(h)){a.updateId(h,Mi(g)),a.updateId(v,g);return}var R=a.get(Mi(v));R&&a.updateId(Mi(v),Mi(g))}}},!0),this.reverted("element.updateProperties",function(u){var h=u.element;if(y(h,"bpmn:SubProcess")){var d=u.properties,f=u.oldProperties,v=f.id,g=d.id;if(v!==g){if($c(h)){a.updateId(h,Mi(v)),a.updateId(g,v);return}var R=a.get(Mi(g));R&&a.updateId(R,Mi(v))}}},!0),t.on("element.changed",function(u){var h=u.element;if($c(h)){var d=h,f=a.get(Vh(d));!f||f===d||t.fire("element.changed",{element:f})}}),this.executed("shape.toggleCollapse",Zm,function(u){var h=u.shape;y(h,"bpmn:SubProcess")&&(ve(h)?l(u):(p(u),s._showRecursively(h.children)))},!0),this.reverted("shape.toggleCollapse",Zm,function(u){var h=u.shape;y(h,"bpmn:SubProcess")&&(ve(h)?l(u):(p(u),s._showRecursively(h.children)))},!0),this.postExecuted("shape.toggleCollapse",yC,function(u){var h=u.shape;if(y(h,"bpmn:SubProcess")){var d=u.newRootElement;d&&(ve(h)?s._moveChildrenToShape(d,h):s._moveChildrenToShape(h,d))}},!0),t.on("copyPaste.createTree",function(u){var h=u.element,d=u.children;if(c(h)){var f=Ln(h),v=a.get(f);v&&d.push.apply(d,v.children)}}),t.on("copyPaste.copyElement",function(u){var h=u.descriptor,d=u.element,f=u.elements,v=d.parent,g=y(ge(v),"bpmndi:BPMNPlane");if(g){var R=Vh(v),E=ye(f,function(_){return _.id===R});E&&(h.parent=E.id)}}),t.on("copyPaste.pasteElement",function(u){var h=u.descriptor;h.parent&&(c(h.parent)||h.parent.hidden)&&(h.hidden=!0)})}q(hi,V),hi.prototype._moveChildrenToShape=function(e,t){var n=this._modeling,i=e.children,r;if(i){i=i.concat(i.reduce(function(p,l){return l.label&&l.label.parent!==e?p.concat(l.label):p},[]));var o=i.filter(function(p){return!p.hidden});if(!o.length){n.moveElements(i,{x:0,y:0},t,{autoResize:!1});return}var a=Ve(o);if(!t.x)r={x:Qm.x-a.x,y:Qm.y-a.y};else{var s=ne(t),c=ne(a);r={x:s.x-c.x,y:s.y-c.y}}n.moveElements(i,r,t,{autoResize:!1})}},hi.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(r){r.hidden=!!t,i=i.concat(r),r.children&&(i=i.concat(n._showRecursively(r.children,r.collapsed||t)))}),i},hi.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},hi.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:Ln(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},hi.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=ye(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},hi.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function Zp(e,t){e.invoke(V,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!y(r,"bpmn:SubProcess")||!(y(i,"bpmn:Task")||y(i,"bpmn:CallActivity"))||!ve(r))){var o=gC(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Zp.$inject=["injector","modeling"],q(Zp,V);function gC(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Qp(e,t){V.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(ve(i))return;var r=Pr(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();k(s,function(p){o(p,!0)}),k(c,function(p){o(p,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||(s?t.reconnectEnd(a,i,ne(i)):t.reconnectStart(a,i,ne(i)))}},!0)}q(Qp,V),Qp.$inject=["eventBus","modeling"];var Jp=500;function el(e,t,n){V.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,p=s,l,u;return l=bC(c).concat([a]),u=Gf(l),u?(p.width=Math.max(u.width,p.width),p.height=Math.max(u.height,p.height),p.x=u.x+(u.width-p.width)/2,p.y=u.y+(u.height-p.height)/2):(p.x=a.x+(a.width-p.width)/2,p.y=a.y+(a.height-p.height)/2),p}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],Jp,function(a){var s=a.context,c=s.shape;y(c,"bpmn:SubProcess")&&(c.collapsed?ge(c).isExpanded=!1:(i(c.children),ge(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Jp,function(a){var s=a.context,c=s.shape;c.collapsed?ge(c).isExpanded=!1:ge(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Jp,function(a){var s=a.context.shape,c=t.getDefaultSize(s),p;s.collapsed?p=o(s,c):p=r(s,c),n.resizeShape(s,p,null,{autoResize:s.collapsed?!1:"nwse"})})}q(el,V),el.$inject=["eventBus","elementFactory","modeling"];function bC(e){return e.filter(function(t){return!t.hidden})}function tl(e,t,n,i){t.invoke(V,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;xe(a)||(y(a,"bpmn:Participant")&&ve(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;y(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}q(tl,V),tl.$inject=["canvas","injector","moddle","modeling"];function nl(e,t){V.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;xC(r,o)&&t.updateProperties(o,{default:null})})}q(nl,V),nl.$inject=["eventBus","modeling"];function xC(e,t){if(!y(e,"bpmn:SequenceFlow"))return!1;var n=W(t),i=W(e);return n.get("default")===i}var _C=500,EC=5e3;function il(e,t,n){V.call(this,e);var i;function r(){return i=i||new wC,i.enter(),i}function o(){if(!i)throw new Error(n("out of bounds release"));return i}function a(){if(!i)throw new Error(n("out of bounds release"));var c=i.leave();return c&&(t.updateLaneRefs(i.flowNodes,i.lanes),i=null),c}var s=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(s,EC,function(c){r()}),this.postExecuted(s,_C,function(c){a()}),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],function(c){var p=c.context,l=p.shape,u=o();l.labelTarget||(y(l,"bpmn:Lane")&&u.addLane(l),y(l,"bpmn:FlowNode")&&u.addFlowNode(l))})}il.$inject=["eventBus","modeling","translate"],q(il,V);function wC(){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}}const SC={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","modelingFeedback","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","unsetDefaultFlowBehavior"],adaptiveLabelPositioningBehavior:["type",Sp],appendBehavior:["type",Cp],associationBehavior:["type",Rp],attachEventBehavior:["type",Ja],boundaryEventBehavior:["type",Pp],createBehavior:["type",kp],createDataObjectBehavior:["type",Tp],createParticipantBehavior:["type",Dp],dataInputAssociationBehavior:["type",Bp],dataStoreBehavior:["type",Np],deleteLaneBehavior:["type",Op],detachEventBehavior:["type",ns],dropOnFlowBehavior:["type",jp],eventBasedGatewayBehavior:["type",Lp],fixHoverBehavior:["type",Sm],groupBehavior:["type",Ip],importDockingFix:["type",Rm],isHorizontalFix:["type",zp],labelBehavior:["type",Fp],layoutConnectionBehavior:["type",Hp],messageFlowBehavior:["type",Wp],modelingFeedback:["type",Hm],removeElementBehavior:["type",qp],removeEmbeddedLabelBoundsBehavior:["type",Up],removeParticipantBehavior:["type",Kp],replaceConnectionBehavior:["type",Yp],replaceElementBehaviour:["type",cs],resizeBehavior:["type",Wm],resizeLaneBehavior:["type",Km],rootElementReferenceBehavior:["type",Xp],spaceToolBehavior:["type",Ym],subProcessPlaneBehavior:["type",hi],subProcessStartEventBehavior:["type",Zp],toggleCollapseConnectionBehaviour:["type",Qp],toggleElementCollapseBehaviour:["type",el],unclaimIdBehavior:["type",tl],unsetDefaultFlowBehavior:["type",nl],updateFlowNodeRefsBehavior:["type",il]};function Jm(e,t){var n=lt(e,t,-15);return n!=="intersect"?n:null}function ut(e){qt.call(this,e)}q(ut,qt),ut.$inject=["eventBus"],ut.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return CC(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return hs(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return hs(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;return cv(t,n)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return De(i)&&!ds(t,i)?!1:Oo(t,function(r){return De(r)?hs(r.source,r.target,r):r.host?ho(r,r.host,null,n):pl(r,i,null)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position;return ho(n,t,null,i)||av(n,t,i)||sv(n,t)||ds(n,t)}),this.addRule("shape.create",function(e){return pl(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ho(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return hv(n,t)})},ut.prototype.canConnectMessageFlow=lv,ut.prototype.canConnectSequenceFlow=uv,ut.prototype.canConnectDataAssociation=ll,ut.prototype.canConnectAssociation=pv,ut.prototype.canMove=sv,ut.prototype.canAttach=ho,ut.prototype.canReplace=av,ut.prototype.canDrop=yr,ut.prototype.canInsert=ds,ut.prototype.canCreate=pl,ut.prototype.canConnect=hs,ut.prototype.canResize=cv,ut.prototype.canCopy=hv;function CC(e){return rl(e)?null:de(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function rl(e){return!e||xe(e)}function RC(e,t){return e===t}function ev(e){do{if(y(e,"bpmn:Process"))return W(e);if(y(e,"bpmn:Participant"))return W(e).processRef||W(e)}while(e=e.parent)}function ol(e){return y(e,"bpmn:TextAnnotation")}function al(e){return y(e,"bpmn:Group")&&!e.labelTarget}function sl(e){return y(e,"bpmn:BoundaryEvent")&&En(e,"bpmn:CompensateEventDefinition")}function vr(e){return W(e).isForCompensation}function PC(e,t){var n=ev(e),i=ev(t);return n===i}function kC(e){return y(e,"bpmn:InteractionNode")&&!y(e,"bpmn:BoundaryEvent")&&(!y(e,"bpmn:Event")||y(e,"bpmn:ThrowEvent")&&nv(e,"bpmn:MessageEventDefinition"))}function TC(e){return y(e,"bpmn:InteractionNode")&&!vr(e)&&(!y(e,"bpmn:Event")||y(e,"bpmn:CatchEvent")&&nv(e,"bpmn:MessageEventDefinition"))&&!(y(e,"bpmn:BoundaryEvent")&&!En(e,"bpmn:MessageEventDefinition"))}function tv(e){for(var t=e;t=t.parent;){if(y(t,"bpmn:FlowElementsContainer"))return W(t);if(y(t,"bpmn:Participant"))return W(t).processRef}return null}function AC(e,t){var n=tv(e),i=tv(t);return n===i}function En(e,t){var n=W(e);return!!ye(n.eventDefinitions||[],function(i){return y(i,t)})}function nv(e,t){var n=W(e);return(n.eventDefinitions||[]).every(function(i){return y(i,t)})}function MC(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:EndEvent")&&!Ot(e)&&!(y(e,"bpmn:IntermediateThrowEvent")&&En(e,"bpmn:LinkEventDefinition"))&&!sl(e)&&!vr(e)}function DC(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:StartEvent")&&!y(e,"bpmn:BoundaryEvent")&&!Ot(e)&&!(y(e,"bpmn:IntermediateCatchEvent")&&En(e,"bpmn:LinkEventDefinition"))&&!vr(e)}function BC(e){return y(e,"bpmn:ReceiveTask")||y(e,"bpmn:IntermediateCatchEvent")&&(En(e,"bpmn:MessageEventDefinition")||En(e,"bpmn:TimerEventDefinition")||En(e,"bpmn:ConditionalEventDefinition")||En(e,"bpmn:SignalEventDefinition"))}function NC(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function cl(e,t){var n=NC(t);return n.indexOf(e)!==-1}function hs(e,t,n){if(rl(e)||rl(t))return null;if(!y(n,"bpmn:DataAssociation")){if(lv(e,t))return{type:"bpmn:MessageFlow"};if(uv(e,t))return{type:"bpmn:SequenceFlow"}}var i=ll(e,t);return i||(sl(e)&&vr(t)?{type:"bpmn:Association",associationDirection:"One"}:pv(e,t)?{type:"bpmn:Association"}:!1)}function yr(e,t){return xe(e)||al(e)?!0:y(t,"bpmn:Participant")&&!ve(t)?!1:y(e,"bpmn:Participant")?y(t,"bpmn:Process")||y(t,"bpmn:Collaboration"):de(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:y(e,"bpmn:Lane")?y(t,"bpmn:Participant")||y(t,"bpmn:Lane"):y(e,"bpmn:BoundaryEvent")&&!OC(e)?!1:y(e,"bpmn:FlowElement")&&!y(e,"bpmn:DataStoreReference")?y(t,"bpmn:FlowElementsContainer")?ve(t):de(t,["bpmn:Participant","bpmn:Lane"]):y(e,"bpmn:DataStoreReference")&&y(t,"bpmn:Collaboration")?kn(W(t).get("participants"),function(n){return!!n.get("processRef")}):de(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?de(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):y(e,"bpmn:MessageFlow")?y(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function OC(e){return W(e).cancelActivity&&(iv(e)||rv(e))}function jC(e){return!xe(e)&&y(e,"bpmn:BoundaryEvent")}function LC(e){return y(e,"bpmn:Lane")}function IC(e){return jC(e)||y(e,"bpmn:IntermediateThrowEvent")&&iv(e)?!0:y(e,"bpmn:IntermediateCatchEvent")&&rv(e)}function iv(e){var t=W(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function rv(e){return ov(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function ov(e,t){return t.some(function(n){return En(e,n)})}function $C(e){return y(e,"bpmn:ReceiveTask")&&ye(e.incoming,function(t){return y(t.source,"bpmn:EventBasedGateway")})}function ho(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return xe(r)||!IC(r)||Ot(t)||!y(t,"bpmn:Activity")||vr(t)||i&&!Jm(i,t)||$C(t)?!1:"attach"}function av(e,t,n){if(!t)return!1;var i={replacements:[]};return k(e,function(r){Ot(t)||y(r,"bpmn:StartEvent")&&r.type!=="label"&&yr(r,t)&&(Ex(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(wx(r)||Sx(r)||Cx(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),ov(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&y(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),y(t,"bpmn:Transaction")||En(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(y(r,"bpmn:EndEvent")&&yr(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),y(r,"bpmn:BoundaryEvent")&&ho(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function sv(e,t){return kn(e,LC)?!1:t?e.every(function(n){return yr(n,t)}):!0}function pl(e,t,n,i){return t?xe(e)||al(e)?!0:RC(n,t)||n&&cl(n,t)?!1:yr(e,t)||ds(e,t):!1}function cv(e,t){return y(e,"bpmn:SubProcess")?ve(e)&&(!t||t.width>=100&&t.height>=80):y(e,"bpmn:Lane")?!t||t.width>=130&&t.height>=60:y(e,"bpmn:Participant")?!t||t.width>=250&&t.height>=50:!!(ol(e)||al(e))}function zC(e,t){var n=ol(e),i=ol(t);return(n||i)&&n!==i}function pv(e,t){return sl(e)&&vr(t)?!0:cl(t,e)||cl(e,t)?!1:zC(e,t)?!0:!!ll(e,t)}function lv(e,t){return dv(e)&&!dv(t)?!1:kC(e)&&TC(t)&&!PC(e,t)}function uv(e,t){return MC(e)&&DC(t)&&AC(e,t)&&!(y(e,"bpmn:EventBasedGateway")&&!BC(t))}function ll(e,t){return de(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&de(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:de(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&de(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function ds(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:de(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!xe(t)&&y(e,"bpmn:FlowNode")&&!y(e,"bpmn:BoundaryEvent")&&yr(e,t.parent)}function FC(e,t){return e&&t&&e.indexOf(t)!==-1}function hv(e,t){return xe(t)?!0:!(y(t,"bpmn:Lane")&&!FC(e,t.parent))}function dv(e){return Ta(e,"bpmn:Process")||Ta(e,"bpmn:Collaboration")}const HC={__depends__:[_n],__init__:["bpmnRules"],bpmnRules:["type",ut]};var GC=2e3;function fv(e,t){e.on("saveXML.start",GC,n);function n(){var i=t.getRootElements();k(i,function(r){var o=ge(r),a,s;a=Pr([r],!1),a=ce(a,function(c){return c!==r&&!c.labelTarget}),s=bt(a,ge),o.set("planeElement",s)})}}fv.$inject=["eventBus","canvas"];const VC={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",fv]};function fs(e){V.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,r=i.shape||i.connection,o=i.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,r=i.shape||i.connection,o=i.newParent||r.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}fs.prototype.getOrdering=function(e,t){return null},q(fs,V);function ul(e,t,n){fs.call(this,e);var i=[{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: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 r(s){if(s.labelTarget)return{level:10};var c=ye(i,function(p){return de(s,[p.type])});return c&&c.order||{level:1}}function o(s){var c=s.order;if(c||(s.order=c=r(s)),!c)throw new Error("no order for <"+s.id+">");return c}function a(s,c,p){for(var l=c;l&&!de(l,p);)l=l.parent;if(!l)throw new Error("no parent for <"+s.id+"> in <"+(c&&c.id)+">");return l}this.getOrdering=function(s,c){if(s.labelTarget)return{parent:t.findRoot(c)||t.getRootElement(),index:-1};var p=o(s);p.containers&&(c=a(s,c,p.containers));var l=c.children.indexOf(s),u=tg(c.children,function(h){return!s.labelTarget&&h.labelTarget?!1:p.level<o(h).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:c}}}ul.$inject=["eventBus","canvas","translate"],q(ul,fs);const WC={__depends__:[ha],__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",ul]};var UC=250;function zi(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}zi.$inject=["eventBus","dragging"],zi.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)},zi.prototype.isActive=function(e){return e&&this._active===e},zi.prototype.length=function(e){return this._tools.length},zi.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},zi.prototype.bindEvents=function(e,t){var n=this._eventBus,i=this._dragging,r=[];n.on(t.tool+".init",function(o){var a=o.context;if(!a.reactivate&&this.isActive(e)){this.setActive(null),i.cancel();return}this.setActive(e)},this),k(t,function(o){r.push(o+".ended"),r.push(o+".canceled")}),n.on(r,UC,function(o){this._active&&(qC(o)||this.setActive(null))},this)};function qC(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Mn(t,'.group[data-group="tools"]')}const ms={__depends__:[$n],__init__:["toolManager"],toolManager:["type",zi]};function KC(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 YC(e,t){var n=[];return k(e.concat(t),function(i){var r=i.incoming,o=i.outgoing;k(r.concat(o),function(a){var s=a.source,c=a.target;(fo(e,s)||fo(e,c)||fo(t,s)||fo(t,c))&&(fo(n,a)||n.push(a))})}),n}function fo(e,t){return e.indexOf(t)!==-1}function XC(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:r+c,width:o,height:a-c};case"s":return{x:i,y:r,width:o,height:a+c};case"w":return{x:i+s,y:r,width:o-s,height:a};case"e":return{x:i,y:r,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var hl=Math.abs,ZC=Math.round,Hn={x:"width",y:"height"},mv="crosshair",di={n:"top",w:"left",s:"bottom",e:"right"},QC=1500,vs={n:"s",w:"e",s:"n",e:"w"},ys=20;function Qt(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",QC,function(c){var p=c.context,l=p.initialized;l||(l=p.initialized=s.init(c,p)),l&&yv(c)}),n.on("spaceTool.end",function(c){var p=c.context,l=p.axis,u=p.direction,h=p.movingShapes,d=p.resizingShapes,f=p.start;if(p.initialized){yv(c);var v={x:0,y:0};v[l]=ZC(c["d"+l]),s.makeSpace(h,d,v,u,f),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Qt.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Qt.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:mv,data:{context:{reactivate:n}},trapClick:!1})},Qt.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:mv,data:{context:{}}})},Qt.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Qt.prototype.init=function(e,t){var n=hl(e.dx)>hl(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(hl(i)<5)return!1;i<0&&(i*=-1),ir(e)&&(i*=-1);var o=KC(n,i),a=this._canvas.getRootElement();!Bc(e)&&e.hover&&(a=e.hover);var s=[...Pr(a,!0),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),p=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),l=JC(c,n,o,r,p);return N(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),xa("resize-"+(n==="x"?"ew":"ns")),!0},Qt.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=[],c=[];function p(h){o.includes(h)||o.push(h);var d=h.label;d&&!o.includes(d)&&o.push(d)}function l(h){a.includes(h)||a.push(h)}k(e,function(h){if(!(!h.parent||xe(h))){if(De(h)){c.push(h);return}var d=h[t],f=d+h[Hn[t]];if(eR(h)&&(n>0&&ne(h)[t]>i||n<0&&ne(h)[t]<i)){s.push(h);return}if(n>0&&d>i||n<0&&f<i){p(h);return}if(d<i&&f>i&&r.allowed("shape.resize",{shape:h})){l(h);return}}}),k(o,function(h){var d=h.attachers;d&&k(d,function(f){p(f)})});var u=o.concat(a);return k(s,function(h){var d=h.host;Fi(u,d)&&p(h)}),u=o.concat(a),k(c,function(h){var d=h.source,f=h.target,v=h.label;Fi(u,d)&&Fi(u,f)&&v&&p(v)}),{movingShapes:o,resizingShapes:a}},Qt.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Qt.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function vv(e){return{top:e.top-ys,right:e.right+ys,bottom:e.bottom+ys,left:e.left-ys}}function yv(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;ie(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),ie(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),ie(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),ie(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function JC(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,p;return k(a,function(l){var u=l.attachers,h=l.children,d=X(l),f=ce(h,function($){return!De($)&&!xe($)&&!Fi(o,$)&&!Fi(a,$)}),v=ce(h,function($){return!De($)&&!xe($)&&Fi(o,$)}),g,R,E,_=[],x=[],S,M,j,B;f.length&&(R=vv(X(Ve(f))),g=i-d[di[n]]+R[di[n]],n==="n"?s.bottom=p=ie(p)?Math.min(p,g):g:n==="w"?s.right=p=ie(p)?Math.min(p,g):g:n==="s"?s.top=c=ie(c)?Math.max(c,g):g:n==="e"&&(s.left=c=ie(c)?Math.max(c,g):g)),v.length&&(E=vv(X(Ve(v))),g=i-E[di[vs[n]]]+d[di[vs[n]]],n==="n"?s.bottom=p=ie(p)?Math.min(p,g):g:n==="w"?s.right=p=ie(p)?Math.min(p,g):g:n==="s"?s.top=c=ie(c)?Math.max(c,g):g:n==="e"&&(s.left=c=ie(c)?Math.max(c,g):g)),u&&u.length&&(u.forEach(function($){Fi(o,$)?_.push($):x.push($)}),_.length&&(S=X(Ve(_.map(ne))),M=d[di[vs[n]]]-(S[di[vs[n]]]-i)),x.length&&(j=X(Ve(x.map(ne))),B=j[di[n]]-(d[di[n]]-i)),n==="n"?(g=Math.min(M||1/0,B||1/0),s.bottom=p=ie(p)?Math.min(p,g):g):n==="w"?(g=Math.min(M||1/0,B||1/0),s.right=p=ie(p)?Math.min(p,g):g):n==="s"?(g=Math.max(M||-1/0,B||-1/0),s.top=c=ie(c)?Math.max(c,g):g):n==="e"&&(g=Math.max(M||-1/0,B||-1/0),s.left=c=ie(c)?Math.max(c,g):g));var D=r&&r[l.id];D&&(n==="n"?(g=i+l[Hn[t]]-D[Hn[t]],s.bottom=p=ie(p)?Math.min(p,g):g):n==="w"?(g=i+l[Hn[t]]-D[Hn[t]],s.right=p=ie(p)?Math.min(p,g):g):n==="s"?(g=i-l[Hn[t]]+D[Hn[t]],s.top=c=ie(c)?Math.max(c,g):g):n==="e"&&(g=i-l[Hn[t]]+D[Hn[t]],s.left=c=ie(c)?Math.max(c,g):g))}),s}}function Fi(e,t){return e.indexOf(t)!==-1}function eR(e){return!!e.host}var dl="djs-dragging",gv="djs-resizing",tR=250,gs=Math.max;function bv(e,t,n,i,r){function o(a,s){k(a,function(c){r.addDragger(c,s),n.addMarker(c,dl)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,p={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},l=Z("g");Y(l,i.cls("djs-crosshair-group",["no-events"])),ee(s,l);var u=Z("path");Y(u,"d",p.x),he(u).add("djs-crosshair"),ee(l,u);var h=Z("path");Y(h,"d",p.y),he(h).add("djs-crosshair"),ee(l,h),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;kt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Fe(c)}),e.on("spaceTool.move",tR,function(a){var s=a.context,c=s.line,p=s.axis,l=s.movingShapes,u=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var h=n.getLayer("space");c=Z("path"),Y(c,"d","M0,0 L0,0"),he(c).add("djs-crosshair"),ee(h,c),s.line=c;var d=Z("g");Y(d,i.cls("djs-drag-group",["no-events"])),ee(n.getActiveLayer(),d),o(l,d);var f=s.movingConnections=t.filter(function(x){var S=!1;k(l,function(D){k(D.outgoing,function($){x===$&&(S=!0)})});var M=!1;k(l,function(D){k(D.incoming,function($){x===$&&(M=!0)})});var j=!1;k(u,function(D){k(D.outgoing,function($){x===$&&(j=!0)})});var B=!1;return k(u,function(D){k(D.incoming,function($){x===$&&(B=!0)})}),De(x)&&(S||j)&&(M||B)});o(f,d),s.dragGroup=d}if(!s.frameGroup){var v=Z("g");Y(v,i.cls("djs-frame-group",["no-events"])),ee(n.getActiveLayer(),v);var g=[];k(u,function(x){var S=r.addFrame(x,v),M=S.getBBox();g.push({element:S,initialBounds:M}),n.addMarker(x,gv)}),s.frameGroup=v,s.frames=g}var R={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Y(c,{d:R[p]});var E={x:"y",y:"x"},_={x:a.dx,y:a.dy};_[E[s.axis]]=0,kt(s.dragGroup,_.x,_.y),k(s.frames,function(x){var S=x.element,M=x.initialBounds,j,B;s.direction==="e"?Y(S,{width:gs(M.width+_.x,5)}):(j=gs(M.width-_.x,5),Y(S,{width:j,x:M.x+M.width-j})),s.direction==="s"?Y(S,{height:gs(M.height+_.y,5)}):(B=gs(M.height-_.y,5),Y(S,{height:B,y:M.y+M.height-B}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,p=s.movingConnections,l=s.resizingShapes,u=s.line,h=s.dragGroup,d=s.frameGroup;k(c,function(f){n.removeMarker(f,dl)}),k(p,function(f){n.removeMarker(f,dl)}),h&&(Fe(u),Fe(h)),k(l,function(f){n.removeMarker(f,gv)}),d&&Fe(d)})}bv.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const nR={__init__:["spaceToolPreview"],__depends__:[$n,_n,ms,Qr,eo],spaceTool:["type",Qt],spaceToolPreview:["type",bv]};function bs(e){e.invoke(Qt,this)}bs.$inject=["injector"],q(bs,Qt),bs.prototype.calculateAdjustments=function(e,t,n,i){var r=Qt.prototype.calculateAdjustments.call(this,e,t,n,i);return r.resizingShapes=r.resizingShapes.filter(function(o){return!(y(o,"bpmn:TextAnnotation")||t==="y"&&iR(o))}),r};function iR(e){return y(e,"bpmn:Participant")&&!W(e).processRef}const xv={__depends__:[nR],spaceTool:["type",bs]};function Oe(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)}Oe.$inject=["eventBus","injector"],Oe.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()},Oe.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},Oe.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Oe.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()}},Oe.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()}},Oe.prototype.register=function(e,t){this._setHandler(e,t)},Oe.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)},Oe.prototype.canUndo=function(){return!!this._getUndoAction()},Oe.prototype.canRedo=function(){return!!this._getRedoAction()},Oe.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Oe.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Oe.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)})},Oe.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},Oe.prototype._createId=function(){return this._uid++},Oe.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Oe.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Oe.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)},Oe.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:Q2("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Oe.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=le(e)?e:[e],t.dirty=t.dirty.concat(e))},Oe.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Oe.prototype._revertedAction=function(e){this._stackIdx--},Oe.prototype._getHandler=function(e){return this._handlerMap[e]},Oe.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 rR={commandStack:["type",Oe]};var oR=new Oc("tt");function aR(e){var t=Me('<div class="djs-tooltip-container" />');return st(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function sR(e,t,n){st(e,{left:t+"px",top:n+"px"})}function fl(e,t){e.style.display=t===!1?"none":""}var _v="djs-tooltip",ml="."+_v;function Et(e,t){this._eventBus=e,this._canvas=t,this._ids=oR,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=aR(t.getContainer());var n=this;Rt.bind(this._tooltipRoot,ml,"mousedown",function(i){i.stopPropagation()}),Rt.bind(this._tooltipRoot,ml,"mouseover",function(i){n.trigger("mouseover",i)}),Rt.bind(this._tooltipRoot,ml,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Et.$inject=["eventBus","canvas"],Et.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=N({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Et.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(ft(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Et.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Et.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Et.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)}},Et.prototype.remove=function(e){var t=this.get(e);t&&(dn(t.html),dn(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Et.prototype.show=function(){fl(this._tooltipRoot)},Et.prototype.hide=function(){fl(this._tooltipRoot,!1)},Et.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},Et.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),Mt(n)&&(n=Me(n)),i=Me('<div data-tooltip-id="'+t+'" class="'+_v+'">'),st(i,{position:"absolute"}),i.appendChild(n),e.type&&Je(i).add("djs-tooltip-"+e.type),e.className&&Je(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Et.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;sR(n,t.x,t.y)},Et.prototype._updateTooltipVisibilty=function(e){k(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),fl(i,r))})},Et.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 cR={__init__:["tooltips"],tooltips:["type",Et]};function fi(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(e){for(var n;n=e[0];)t(n);return e}}var pR=250,Ev=1400;function vl(e,t,n){V.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Ev,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=wv(a),o.validatedShapes=wv(s)}),i&&t.on("shape.move.start",pR,function(r){var o=r.context,a=o.shapes,s=[];k(a,function(c){k(c.labels,function(p){!p.hidden&&o.shapes.indexOf(p)===-1&&s.push(p),c.labelTarget&&s.push(c)})}),k(s,function(c){i.makeDraggable(o,c,!0)})}),this.preExecuted("elements.move",Ev,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];k(s,function(p){k(p.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;fi(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=lc(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(Ze(s.labels,a,c),a.labelTarget=s)})}q(vl,V),vl.$inject=["injector","eventBus","modeling"];function wv(e){return ce(e,function(t){return e.indexOf(t.labelTarget)===-1})}const lR={__init__:["labelSupport"],labelSupport:["type",vl]};var uR=251,Sv=1401,Cv="attach-ok";function yl(e,t,n,i,r){V.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Sv,function(a){var s=a.context,c=s.shapes,p=s.validatedShapes;s.shapes=hR(c),s.validatedShapes=dR(p)}),o&&t.on("shape.move.start",uR,function(a){var s=a.context,c=s.shapes,p=gl(c);k(p,function(l){o.makeDraggable(s,l,!0),k(l.labels,function(u){o.makeDraggable(s,u,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var p=c[0],l=p.host;l&&(n.addMarker(l,Cv),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,Cv)}))}}),this.preExecuted("elements.move",Sv,function(a){var s=a.context,c=s.closure,p=s.shapes,l=gl(p);k(l,function(u){c.add(u,c.topLevel[u.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,p=s.newHost,l;p&&c.length!==1||(p?l=c:l=ce(c,function(u){var h=u.host;return fR(u)&&!mR(c,h)}),k(l,function(u){r.updateAttachment(u,p)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;k(s,function(c){k(c.attachers,function(p){k(p.outgoing.slice(),function(l){var u=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});u||r.removeConnection(l)}),k(p.incoming.slice(),function(l){var u=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});u||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,p=s.host;p&&r.updateAttachment(c,p)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,p=s.newShape;fi(c.attachers,function(l){var u=i.allowed("elements.move",{target:p,shapes:[l]});u==="attach"?r.updateAttachment(l,p):r.removeShape(l)}),p.attachers.length&&k(p.attachers,function(l){var u=Lm(l,c,p);r.moveShape(l,u,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,p=s.oldBounds,l=s.newBounds,u=c.attachers,h=s.hints||{};h.attachSupport!==!1&&k(u,function(d){var f=Lm(d,p,l);r.moveShape(d,f,d.parent),k(d.labels,function(v){r.moveShape(v,f,v.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;fi(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}q(yl,V),yl.$inject=["injector","eventBus","canvas","rules","modeling"];function gl(e){return Xs(bt(e,function(t){return t.attachers||[]}))}function hR(e){var t=gl(e);return J2("id",e,t)}function dR(e){var t=No(e,"id");return ce(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function fR(e){return!!e.host}function mR(e,t){return e.indexOf(t)!==-1}const vR={__depends__:[_n],__init__:["attachSupport"],attachSupport:["type",yl]};function Jt(e){this._model=e}Jt.$inject=["moddle"],Jt.prototype._needsId=function(e){return de(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"])},Jt.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;y(e,"bpmn:Activity")?t="Activity":y(e,"bpmn:Event")?t="Event":y(e,"bpmn:Gateway")?t="Gateway":de(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))},Jt.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Jt.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Jt.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",N({bpmnElement:e,bounds:this.createDiBounds()},t))},Jt.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Jt.prototype.createDiWaypoints=function(e){var t=this;return bt(e,function(n){return t.createDiWaypoint(n)})},Jt.prototype.createDiWaypoint=function(e){return this.create("dc:Point",un(e,["x","y"]))},Jt.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",N({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Jt.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",N({bpmnElement:e},t))};function Tt(e,t,n,i){V.call(this,e),this._bpmnFactory=t,this._translate=i;var r=this;function o(f){var v=f.context,g=v.hints||{},R;!v.cropped&&g.createElementsBehavior!==!1&&(R=v.connection,R.waypoints=n.getCroppedWaypoints(R),v.cropped=!0)}this.executed(["connection.layout","connection.create"],o),this.reverted(["connection.layout"],function(f){delete f.context.cropped});function a(f){var v=f.context;r.updateParent(v.shape||v.connection,v.oldParent)}function s(f){var v=f.context,g=v.shape||v.connection,R=v.parent||v.newParent;r.updateParent(g,R)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],At(a)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],At(s));function c(f){var v=f.context,g=v.oldRoot,R=g.children;k(R,function(E){y(E,"bpmn:BaseElement")&&r.updateParent(E)})}this.executed(["canvas.updateRoot"],c),this.reverted(["canvas.updateRoot"],c);function p(f){var v=f.context.shape;y(v,"bpmn:BaseElement")&&r.updateBounds(v)}this.executed(["shape.move","shape.create","shape.resize"],At(function(f){f.context.shape.type!=="label"&&p(f)})),this.reverted(["shape.move","shape.create","shape.resize"],At(function(f){f.context.shape.type!=="label"&&p(f)})),e.on("shape.changed",function(f){f.element.type==="label"&&p({context:{shape:f.element}})});function l(f){r.updateConnection(f.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],At(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],At(l));function u(f){r.updateConnectionWaypoints(f.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],At(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],At(u)),this.executed("connection.reconnect",At(function(f){var v=f.context,g=v.connection,R=v.oldSource,E=v.newSource,_=W(g),x=W(R),S=W(E);_.conditionExpression&&!de(S,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(v.oldConditionExpression=_.conditionExpression,delete _.conditionExpression),R!==E&&x.default===_&&(v.oldDefault=x.default,delete x.default)})),this.reverted("connection.reconnect",At(function(f){var v=f.context,g=v.connection,R=v.oldSource,E=v.newSource,_=W(g),x=W(R),S=W(E);v.oldConditionExpression&&(_.conditionExpression=v.oldConditionExpression),v.oldDefault&&(x.default=v.oldDefault,delete S.default)}));function h(f){r.updateAttachment(f.context)}this.executed(["element.updateAttachment"],At(h)),this.reverted(["element.updateAttachment"],At(h)),this.executed("element.updateLabel",At(d)),this.reverted("element.updateLabel",At(d));function d(f){const{element:v}=f.context,g=Ut(v),R=ge(v),E=R&&R.get("label");ki(v)||(g&&!E?R.set("label",t.create("bpmndi:BPMNLabel")):!g&&E&&R.set("label",void 0))}}q(Tt,V),Tt.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],Tt.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Tt.prototype.updateParent=function(e,t){if(!xe(e)&&!(y(e,"bpmn:DataStoreReference")&&e.parent&&y(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=ge(e),o=n&&n.businessObject,a=ge(n);y(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),y(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),y(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),y(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Tt.prototype.updateBounds=function(e){var t=ge(e),n=gR(e);if(n){var i=tn(n,t.get("bounds"));N(n,{x:e.x+i.x,y:e.y+i.y})}var r=xe(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),N(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Tt.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;y(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),We(i,e)),y(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Ze(r,e))}},Tt.prototype.updateDiConnection=function(e,t,n){var i=ge(e),r=ge(t),o=ge(n);i.sourceElement&&i.sourceElement.bpmnElement!==W(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==W(n)&&(i.targetElement=n&&o)},Tt.prototype.updateDiParent=function(e,t){if(t&&!y(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(We(n,e),e.$parent=null)}};function yR(e){for(;e&&!y(e,"bpmn:Definitions");)e=e.$parent;return e}Tt.prototype.getLaneSet=function(e){var t,n;return y(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(y(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)},Tt.prototype.updateSemanticParent=function(e,t,n){var i,r=this._translate;if(e.$parent!==t&&!((y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput"))&&(y(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(y(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(y(e,"bpmn:FlowElement")){if(t){if(y(t,"bpmn:Participant"))t=t.processRef;else if(y(t,"bpmn:Lane"))do t=t.$parent.$parent;while(y(t,"bpmn:Lane"))}i="flowElements"}else if(y(e,"bpmn:Artifact")){for(;t&&!y(t,"bpmn:Process")&&!y(t,"bpmn:SubProcess")&&!y(t,"bpmn:Collaboration");)if(y(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(y(e,"bpmn:MessageFlow"))i="messageFlows";else if(y(e,"bpmn:Participant")){i="participants";var o=e.processRef,a;o&&(a=yR(e.$parent||t),e.$parent&&(We(a.get("rootElements"),o),o.$parent=null),t&&(Ze(a.get("rootElements"),o),o.$parent=a))}else y(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":y(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(r("no parent for {element} in {parent}",{element:e.id,parent:t.id}));var s;if(e.$parent&&(s=e.$parent.get(i),We(s,e)),t?(s=t.get(i),s.push(e),e.$parent=t):e.$parent=null,n){var c=n.get(i);We(s,e),t&&(c||(c=[],t.set(i,c)),c.push(e))}}},Tt.prototype.updateConnectionWaypoints=function(e){var t=ge(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Tt.prototype.updateConnection=function(e){var t=e.connection,n=W(t),i=t.source,r=W(i),o=t.target,a=W(t.target),s;if(y(n,"bpmn:DataAssociation"))y(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):y(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=y(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(We(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(We(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},Tt.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function At(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;y(i,"bpmn:BaseElement")&&e(t)}}function gR(e){if(y(e,"bpmn:Activity")){var t=ge(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function mi(e,t,n){Bn.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}q(mi,Bn),mi.$inject=["bpmnFactory","moddle","translate"],mi.prototype._baseCreate=Bn.prototype.create,mi.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,N({type:"label",di:n},Ir,t))}return this.createElement(e,t)},mi.prototype.createElement=function(e,t){var n,i=this._translate;t=N({},t||{});var r=t.businessObject,o=t.di;if(!r){if(!t.type)throw new Error(i("no shape type specified"));r=this._bpmnFactory.create(t.type),bh(r)}if(!xR(o)){var a=N({},o||{},{id:r.id+"_di"});e==="root"?o=this._bpmnFactory.createDiPlane(r,a):e==="connection"?o=this._bpmnFactory.createDiEdge(r,a):o=this._bpmnFactory.createDiShape(r,a)}y(r,"bpmn:Group")&&(t=N({isFrame:!0},t)),t=bR(r,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Rv(o,t,"isExpanded")),y(r,"bpmn:SubProcess")&&(t.collapsed=!ve(r,o)),y(r,"bpmn:ExclusiveGateway")&&(o.isMarkerVisible=!0),ot(t.triggeredByEvent)&&(r.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),ot(t.cancelActivity)&&(r.cancelActivity=t.cancelActivity,delete t.cancelActivity);var s,c;return t.eventDefinitionType&&(s=r.get("eventDefinitions")||[],c=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(c.condition=this._bpmnFactory.create("bpmn:FormalExpression")),s.push(c),c.$parent=r,r.eventDefinitions=s,delete t.eventDefinitionType),n=this.getDefaultSize(r,o),t=N({id:r.id},n,t,{businessObject:r,di:o}),this._baseCreate(e,t)},mi.prototype.getDefaultSize=function(e,t){var n=W(e);return t=t||ge(e),y(n,"bpmn:SubProcess")?ve(n,t)?{width:350,height:200}:{width:100,height:80}:y(n,"bpmn:Task")?{width:100,height:80}:y(n,"bpmn:Gateway")?{width:50,height:50}:y(n,"bpmn:Event")?{width:36,height:36}:y(n,"bpmn:Participant")?ve(n,t)?{width:600,height:250}:{width:400,height:60}:y(n,"bpmn:Lane")?{width:400,height:100}:y(n,"bpmn:DataObjectReference")?{width:36,height:50}:y(n,"bpmn:DataStoreReference")?{width:50,height:50}:y(n,"bpmn:TextAnnotation")?{width:100,height:30}:y(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},mi.prototype.createParticipantShape=function(e){return rt(e)||(e={isExpanded:e}),e=N({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function bR(e,t,n){return k(n,function(i){t=Rv(e,t,i)}),t}function Rv(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Tn(t,[n]))}function xR(e){return de(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function xs(e,t){this._modeling=e,this._canvas=t}xs.$inject=["modeling","canvas"],xs.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;k(n,function(r){var o={x:0,y:0};ot(i.left)?o.x=i.left-r.x:ot(i.right)?o.x=i.right-r.width-r.x:ot(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:ot(i.top)?o.y=i.top-r.y:ot(i.bottom)?o.y=i.bottom-r.height-r.y:ot(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},xs.prototype.postExecute=function(e){};function _s(e){this._modeling=e}_s.$inject=["modeling"],_s.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},_s.prototype.postExecute=function(e){var t=e.hints||{};_R(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 _R(e,t){return kn(e.outgoing,function(n){return n.target===t})}function Es(e,t){this._canvas=e,this._layouter=t}Es.$inject=["canvas","layouter"],Es.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},Es.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var ws=Math.round;function bl(e){this._modeling=e}bl.$inject=["modeling"],bl.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;k(t,function(u){ie(u.x)||(u.x=0),ie(u.y)||(u.y=0)});var s=ce(t,function(u){return!u.hidden}),c=Ve(s);k(t,function(u){De(u)&&(u.waypoints=bt(u.waypoints,function(h){return{x:ws(h.x-c.x-c.width/2+r.x),y:ws(h.y-c.y-c.height/2+r.y)}})),N(u,{x:ws(u.x-c.x-c.width/2+r.x),y:ws(u.y-c.y-c.height/2+r.y)})});var p=Uo(t),l={};k(t,function(u){if(De(u)){l[u.id]=ie(i)?a.createConnection(l[u.source.id],l[u.target.id],i,u,u.parent||n,o):a.createConnection(l[u.source.id],l[u.target.id],u,u.parent||n,o);return}var h=N({},o);p.indexOf(u)===-1&&(h.autoResize=!1),xe(u)&&(h=Tn(h,["attach"])),l[u.id]=ie(i)?a.createShape(u,un(u,["x","y","width","height"]),u.parent||n,i,h):a.createShape(u,un(u,["x","y","width","height"]),u.parent||n,h)}),e.elements=iu(l)};var Pv=Math.round;function vi(e){this._canvas=e}vi.$inject=["canvas"],vi.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?N(t,n):N(t,{x:n.x-Pv(t.width/2),y:n.y-Pv(t.height/2)}),this._canvas.addShape(t,i,r),t},vi.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function mo(e){vi.call(this,e)}q(mo,vi),mo.$inject=["canvas"];var ER=vi.prototype.execute;mo.prototype.execute=function(e){var t=e.shape;return SR(t),t.labelTarget=e.labelTarget,ER.call(this,e)};var wR=vi.prototype.revert;mo.prototype.revert=function(e){return e.shape.labelTarget=null,wR.call(this,e)};function SR(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function vo(e,t){this._canvas=e,this._modeling=t}vo.$inject=["canvas","modeling"],vo.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;fi(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),fi(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},vo.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=lc(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},vo.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Ze(n.children,t,i),this._canvas.addConnection(t,n),t};function xl(e,t){this._modeling=e,this._elementRegistry=t}xl.$inject=["modeling","elementRegistry"],xl.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;k(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function yo(e,t){this._canvas=e,this._modeling=t}yo.$inject=["canvas","modeling"],yo.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;fi(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),fi(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),fi(n.children,function(i){De(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},yo.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=lc(i.children,n),t.removeShape(n),n},yo.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Ze(i.children,n,r),t.addShape(n,i),n};function Ss(e){this._modeling=e}Ss.$inject=["modeling"];var kv={x:"y",y:"x"};Ss.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,R){g.range.min=Math.min(R[i],g.range.min),g.range.max=Math.max(R[i]+R[r],g.range.max)}function a(g){return g[i]+g[r]/2}function s(g){return g.length-1}function c(g){return g.max-g.min}function p(g,R){var E={y:0};E[i]=g-a(R),E[i]&&(E[kv[i]]=0,t.moveElements([R],E,R.parent))}var l=n[0],u=s(n),h=n[u],d,f,v=0;k(n,function(g,R){var E,_,x;if(g.elements.length<2){R&&R!==n.length-1&&(o(g,g.elements[0]),v+=c(g.range));return}E=ln(g.elements,i),_=E[0],R===u&&(_=E[s(E)]),x=a(_),g.range=null,k(E,function(S){if(p(x,S),g.range===null){g.range={min:S[i],max:S[i]+S[r]};return}o(g,S)}),R&&R!==n.length-1&&(v+=c(g.range))}),f=Math.abs(h.range.min-l.range.max),d=Math.round((f-v)/(n.length-1)),!(d<n.length-1)&&k(n,function(g,R){var E={},_;g===l||g===h||(_=n[R-1],g.range.max=0,k(g.elements,function(x,S){E[kv[i]]=0,E[i]=_.range.max-x[i]+d,g.range.min!==x[i]&&(E[i]+=x[i]-g.range.min),E[i]&&t.moveElements([x],E,x.parent),g.range.max=Math.max(x[i]+x[r],S?g.range.max:0)}))})},Ss.prototype.postExecute=function(e){};function Cs(e,t){this._layouter=e,this._canvas=t}Cs.$inject=["layouter","canvas"],Cs.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return N(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Cs.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function _l(){}_l.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=We(o.children,t),Ze(i.children,t,r),t.parent=i,k(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},_l.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return We(n.children,t),Ze(i.children,t,r),t.parent=i,k(t.waypoints,function(a){a.x-=o.x,a.y-=o.y,a.original&&(a.original.x-=o.x,a.original.y-=o.y)}),t};function El(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}El.prototype.add=function(e,t){return this.addAll([e],t)},El.prototype.addAll=function(e,t){var n=Hg(e,!!t,this);return N(this,n),this};function go(e){this._modeling=e}go.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},go.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,p=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),k(a,function(u){o.moveShape(u,t,p[u.id]&&!l&&n,{recurse:!1,layout:!1})}),k(s,function(u){var h=!!a[u.source.id],d=!!a[u.target.id];c[u.id]&&h&&d?o.moveConnection(u,t,p[u.id]&&!l&&n):o.layoutConnection(u,{connectionStart:h&&Gp(u,u.source,t),connectionEnd:d&&Vp(u,u.target,t)})})},go.prototype.getClosure=function(e){return new El().addAll(e,!0)};function Rs(e){this._helper=new go(e)}Rs.$inject=["modeling"],Rs.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Rs.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 Hi(e){this._modeling=e,this._helper=new go(e)}Hi.$inject=["modeling"],Hi.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=un(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=We(o.children,t),Ze(i.children,t,r),N(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Hi.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(k(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Vp(o,t,n)})}),k(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Gp(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Hi.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Ze(n.children,t,i),N(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Hi.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Hi.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function bo(e){this._modeling=e}bo.$inject=["modeling"],bo.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return le(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},bo.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||Tv(le(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Tv(le(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},bo.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function Tv(e){return e.original||e}function Gn(e,t){this._modeling=e,this._rules=t}Gn.$inject=["modeling","rules"],Gn.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(f,v,g){return i.allowed("connection.reconnect",{connection:g,source:f,target:v})}var p={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,p,r.parent,a),r.host&&n.updateAttachment(s,r.host);var u;a.moveChildren!==!1&&(u=r.children.slice(),n.moveElements(u,{x:0,y:0},s,a));var h=r.incoming.slice(),d=r.outgoing.slice();k(h,function(f){var v=f.source,g=c(v,s,f);g&&t.reconnectEnd(f,s,as(f,s,l),a)}),k(d,function(f){var v=f.target,g=c(s,v,f);g&&t.reconnectStart(f,s,os(f,s,l),a)})},Gn.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Gn.prototype.execute=function(e){},Gn.prototype.revert=function(e){},Gn.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Gn.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Gn.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function xo(e){this._modeling=e}xo.$inject=["modeling"],xo.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},N(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},xo.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(k(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:as(o,n,i)})}),k(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:os(o,n,i)})}))},xo.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return N(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function yi(e){this._modeling=e}yi.$inject=["modeling"],yi.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),k(r,function(s){a[s.id]=RR(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(YC(i,r),t,n,o,i,r,a)},yi.prototype.execute=function(){},yi.prototype.revert=function(){},yi.prototype.moveShapes=function(e,t){var n=this;k(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},yi.prototype.resizeShapes=function(e,t,n){var i=this;k(e,function(r){var o=XC(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},yi.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=r.concat(o);k(e,function(p){var l=p.source,u=p.target,h=CR(p),d=Mv(n),f={};gi(c,l)&&gi(c,u)?(h=bt(h,function(v){return Dv(v,i,n)&&(v[d]=v[d]+t[d]),v.original&&Dv(v.original,i,n)&&(v.original[d]=v.original[d]+t[d]),v}),s._modeling.updateWaypoints(p,h,{labelBehavior:!1})):(gi(c,l)||gi(c,u))&&(gi(r,l)?f.connectionStart=Gp(p,l,t):gi(r,u)?f.connectionEnd=Vp(p,u,t):gi(o,l)?f.connectionStart=os(p,l,a[l.id]):gi(o,u)&&(f.connectionEnd=as(p,u,a[u.id])),s._modeling.layoutConnection(p,f))})};function Av(e){return N({},e)}function CR(e){return bt(e.waypoints,function(t){return t=Av(t),t.original&&(t.original=Av(t.original)),t})}function Mv(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Dv(e,t,n){var i=Mv(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function gi(e,t){return e.indexOf(t)!==-1}function RR(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ps(e){this._modeling=e}Ps.$inject=["modeling"],Ps.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Bv(n),t.collapsed=!t.collapsed;var i=Nv(n,t.collapsed);return[t].concat(i)},Ps.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Ov(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Bv(e){var t={};return k(e,function(n){t[n.id]=n.hidden,n.children&&(t=N({},t,Bv(n.children)))}),t}function Nv(e,t){var n=[];return k(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Nv(i.children,i.collapsed||t)))}),n}function Ov(e,t){var n=[];return k(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Ov(i.children,t)))}),n}function ks(e){this._modeling=e}ks.$inject=["modeling"],ks.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=jv(i,t),Lv(n,t),t.host=n,t},ks.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,jv(n,t),Lv(i,t,r),t};function jv(e,t){return We(e&&e.attachers,t)}function Lv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Ze(i,t,n)}}function wl(){}wl.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},wl.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Te(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Te.$inject=["eventBus","elementFactory","commandStack"],Te.prototype.getHandlers=function(){return{"shape.append":_s,"shape.create":vi,"shape.delete":yo,"shape.move":Hi,"shape.resize":xo,"shape.replace":Gn,"shape.toggleCollapse":Ps,spaceTool:yi,"label.create":mo,"connection.create":Es,"connection.delete":vo,"connection.move":_l,"connection.layout":Cs,"connection.updateWaypoints":wl,"connection.reconnect":bo,"elements.create":bl,"elements.move":Rs,"elements.delete":xl,"elements.distribute":Ss,"elements.align":xs,"element.updateAttachment":ks}},Te.prototype.registerHandlers=function(e){k(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Te.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},Te.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Te.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},Te.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},Te.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Te.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},Te.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},Te.prototype.createElements=function(e,t,n,i,r){le(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},Te.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},Te.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},Te.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Te.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Te.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Te.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Te.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Te.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Te.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},Te.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},Te.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Te.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},Te.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,N(i,{docking:"source"}))},Te.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,N(i,{docking:"target"}))},Te.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Te.prototype._create=function(e,t){return R0(t)?t:this._elementFactory.create(e,t)},Te.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function _o(e){this._elementRegistry=e}_o.$inject=["elementRegistry"],_o.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||PR(n,ru(i));return Iv(n,i),e.oldProperties=o,e.changed=r,r},_o.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Iv(n,t),i},_o.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return y(e,"bpmn:DataObject")?kR(e,t):[]};function PR(e,t){return Gt(t,function(n,i){return n[i]=e.get(i),n},{})}function Iv(e,t){k(t,function(n,i){e.set(i,n)})}function kR(e,t){return t.filter(function(n){return y(n,"bpmn:DataObjectReference")&&W(n).dataObjectRef===e})}var Eo="default",Vn="id",$v="di",TR={width:0,height:0};function wo(e,t,n,i,r){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=i,this._textRenderer=r}wo.$inject=["elementRegistry","moddle","translate","modeling","textRenderer"],wo.prototype.execute=function(e){var t=e.element,n=[t],i=this._translate;if(!t)throw new Error(i("element required"));var r=this._elementRegistry,o=this._moddle.ids,a=t.businessObject,s=NR(e.properties),c=e.oldProperties||AR(t,s);return zv(s,a)&&(o.unclaim(a[Vn]),r.updateId(t,s[Vn]),o.claim(s[Vn],a)),Eo in s&&(s[Eo]&&n.push(r.get(s[Eo].id)),a[Eo]&&n.push(r.get(a[Eo].id))),Fv(t,s),e.oldProperties=c,e.changed=n,n},wo.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&W(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,TR)}},wo.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return Fv(t,i),zv(n,r)&&(a.unclaim(n[Vn]),o.updateId(t,i[Vn]),a.claim(i[Vn],r)),e.changed};function zv(e,t){return Vn in e&&e[Vn]!==t[Vn]}function AR(e,t){var n=ru(t),i=e.businessObject,r=ge(e);return Gt(n,function(o,a){return a!==$v?o[a]=i.get(a):o[a]=MR(r,ru(t.di)),o},{})}function MR(e,t){return Gt(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Fv(e,t){var n=e.businessObject,i=ge(e);k(t,function(r,o){o!==$v?n.set(o,r):i&&DR(i,r)})}function DR(e,t){k(t,function(n,i){e.set(i,n)})}var BR=["default"];function NR(e){var t=N({},e);return BR.forEach(function(n){n in e&&(t[n]=W(t[n]))}),t}function Ts(e,t){this._canvas=e,this._modeling=t}Ts.$inject=["canvas","modeling"],Ts.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=ge(r);return t.setRootElement(n),t.removeRootElement(r),Ze(a.rootElements,i),i.$parent=a,We(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Ts.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=ge(n);return t.setRootElement(r),t.removeRootElement(n),We(a.rootElements,i),i.$parent=null,Ze(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Sl(e,t){this._modeling=e,this._spaceTool=t}Sl.$inject=["modeling","spaceTool"],Sl.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=on(i),a=o===i,s=a?i:i.parent,c=Li(s);c.length||n.createShape({type:"bpmn:Lane"},{x:i.x+dr,y:i.y,width:i.width-dr,height:i.height},s);var p=[];Si(o,function(v){return p.push(v),v.label&&p.push(v.label),v===i?[]:ce(v.children,function(g){return g!==i})});var l=r==="top"?-120:120,u=r==="top"?i.y:i.y+i.height,h=u+(r==="top"?10:-10),d=r==="top"?"n":"s",f=t.calculateAdjustments(p,"y",l,h);t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:l},d,h),e.newLane=n.createShape({type:"bpmn:Lane"},{x:i.x+(a?dr:0),y:u-(r==="top"?120:0),width:i.width-(a?dr:0),height:120},s)};function Cl(e,t){this._modeling=e,this._translate=t}Cl.$inject=["modeling","translate"],Cl.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,i=e.shape,r=e.count,o=Li(i),a=o.length;if(a>r)throw new Error(n("more than {count} child lanes",{count:r}));var s=Math.round(i.height/r),c,p,l,u,h;for(h=0;h<r;h++)c=i.y+h*s,h===r-1?p=i.height-s*h:p=s,l={x:i.x+dr,y:c,width:i.width-dr,height:p},h<a?t.resizeShape(o[h],l):(u={type:"bpmn:Lane"},t.createShape(u,l,i))};function So(e,t){this._modeling=e,this._spaceTool=t}So.$inject=["modeling","spaceTool"],So.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},So.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=yw(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},So.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=X(e),r=X(t),o=Hf(r,i),a=on(e),s=[],c=[];Si(a,function(f){return s.push(f),(y(f,"bpmn:Lane")||y(f,"bpmn:Participant"))&&c.push(f),f.children});var p,l,u,h,d;(o.bottom||o.top)&&(p=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),u=o.bottom?"s":"n",h=o.top>0||o.bottom<0?-p:p,d=n.calculateAdjustments(s,"y",h,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:p},u)),(o.left||o.right)&&(p=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),u=o.right?"e":"w",h=o.left>0||o.right<0?-p:p,d=n.calculateAdjustments(c,"x",h,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:p,y:0},u))};var Co="flowNodeRef",Rl="lanes";function Ro(e){this._elementRegistry=e}Ro.$inject=["elementRegistry"],Ro.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,u){var h=X(u),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>h.left&&d.x<h.right&&d.y>h.top&&d.y<h.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var u=on(l);return r[u.id]||(r[u.id]=Ha(u)),r[u.id]}function p(l){if(!l.parent)return[];var u=c(l);return u.filter(function(h){return a(l,h)}).map(function(h){return h.businessObject})}return t.forEach(function(l){var u=on(l);if(!(!u||n.indexOf(u)!==-1)){var h=u.children.filter(function(d){return y(d,"bpmn:FlowNode")});h.forEach(s),n.push(u)}}),e.forEach(s),o.forEach(function(l){var u=l.businessObject,h=u.get(Rl),d=h.slice(),f=p(l);i.push({flowNode:u,remove:d,add:f})}),t.forEach(function(l){var u=l.businessObject;l.parent||u.get(Co).forEach(function(h){i.push({flowNode:h,remove:[u],add:[]})})}),i},Ro.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,r=i.get(Rl);n.remove.forEach(function(o){We(r,o),We(o.get(Co),i)}),n.add.forEach(function(o){Ze(r,o),Ze(o.get(Co),i)})}),[]},Ro.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Rl);n.add.forEach(function(o){We(r,o),We(o.get(Co),i)}),n.remove.forEach(function(o){Ze(r,o),Ze(o.get(Co),i)})}),[]};function As(e){this._moddle=e}As.$inject=["moddle"],As.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.claim(n,i):t.unclaim(n),[]},As.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var OR={fill:void 0,stroke:void 0};function Pl(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Mt(t)){var n=jR(t);if(n)return n}throw new Error("invalid color value: "+t)}}}Pl.$inject=["commandStack"],Pl.prototype.postExecute=function(e){var t=e.elements,n=e.colors||OR,i=this,r={};"fill"in n&&N(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&N(r,{"border-color":this._normalizeColor(n.stroke)}),k(t,function(o){var a=De(o)?un(r,["border-color"]):r,s=ge(o);if(LR(a),xe(o))i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}});else{if(!de(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function jR(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 LR(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var IR={width:0,height:0};function Hv(e,t,n){function i(c,p){var l=c.label||c,u=c.labelTarget||c;return Ax(l,p),[l,u]}function r(c){var p=c.element,l=p.businessObject,u=c.newLabel;if(!xe(p)&&ki(p)&&!pa(p)&&!Gv(u)){var h=7,d=Ac(p);d={x:d.x,y:d.y+h},e.createLabel(p,d,{id:l.id+"_label",businessObject:l,di:p.di})}}function o(c){return c.oldLabel=Ut(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var p=c.element,l=p.label||p,u=c.newLabel,h=c.newBounds,d=c.hints||{};if(!(!xe(l)&&!y(l,"bpmn:TextAnnotation"))){if(xe(l)&&Gv(u)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var f=Ut(p);typeof h>"u"&&(h=t.getExternalLabelBounds(l,f)),h&&e.resizeShape(l,h,IR)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Hv.$inject=["modeling","textRenderer","bpmnFactory"];function Gv(e){return!e||!e.trim()}function ht(e,t,n,i){Te.call(this,e,t,n),this._bpmnRules=i}q(ht,Te),ht.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],ht.prototype.getHandlers=function(){var e=Te.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=_o,e["element.updateProperties"]=wo,e["canvas.updateRoot"]=Ts,e["lane.add"]=Sl,e["lane.resize"]=So,e["lane.split"]=Cl,e["lane.updateRefs"]=Ro,e["id.updateClaim"]=As,e["element.setColor"]=Pl,e["element.updateLabel"]=Hv,e},ht.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},ht.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},ht.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},ht.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},ht.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},ht.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},ht.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},ht.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},ht.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};this._commandStack.execute("canvas.updateRoot",t)},ht.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},ht.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},ht.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},ht.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Vv(){}Vv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||ne(t.source||e.source),t.connectionEnd||ne(t.target||e.target)]};var Ms=20,$R=5,Ds=Math.round,Wv=20,zR={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function FR(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function HR(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Uv(e,t,n){var i=lt(t,e,$R),r=n.split(":")[0],o=Ds((t.x-e.x)/2+e.x),a=Ds((t.y-e.y)/2+e.y),s,c,p=HR(r,i),l=/h|r|l/.test(r),u=!1,h=!1;return p?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(u=FR(i,r),c=l?"h:v":"v:h",u?l?(h=a===e.y,s={x:e.x+Ms*(/l/.test(r)?-1:1),y:h?a+Ms:a}):(h=o===e.x,s={x:h?o+Ms:o,y:e.y+Ms*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:kl(e,s,c).concat(s),directions:c,turnNextDirections:h}}function GR(e,t,n){return Uv(e,t,n)}function VR(e,t,n){var i=Uv(t,e,qv(n));return{waypoints:i.waypoints.slice().reverse(),directions:qv(i.directions),turnNextDirections:i.turnNextDirections}}function WR(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var r=n+":"+i,o=kl(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function qv(e){return e.split(":").reverse().join(":")}function UR(e,t,n){var i=Ds((t.x-e.x)/2+e.x),r=Ds((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function kl(e,t,n){if(n=n||"h:h",!tP(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Yv(n)){var i=GR(e,t,n),r=VR(e,t,n),o=WR(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return UR(e,t,n)}function qR(e,t,n){var i=kl(e,t,n);return i.unshift(e),i.push(t),Zv(i)}function KR(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=ek(o,"straight")[0]||"h:h",s=zR[a]||0,c=lt(e,t,s),p=eP(c,a);n=n||ne(e),i=i||ne(t);var l=p.split(":"),u=Xv(n,e,l[0],nP(c)),h=Xv(i,t,l[1],c);return qR(u,h,p)}function YR(e,t,n,i,r,o){le(n)&&(r=n,o=i,n=ne(e),i=ne(t)),o=N({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&ZR(e,t,n,i,o),c||(c=o.connectionEnd&&JR(t,e,i,r),c)||(c=o.connectionStart&&QR(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:KR(e,t,n,i,o)}function XR(e,t,n){return e>=t&&e<=n}function Kv(e,t,n){var i={x:"width",y:"height"};return XR(t[e],n[e],n[e]+n[i[e]])}function ZR(e,t,n,i,r){var o={},a,s;return s=lt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Kv(a,i,e)?(o[a]=i[a],[{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y,original:{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y}},{x:i.x,y:i.y}]):null:Kv(a,n,t)?(o[a]=n[a],[{x:n.x,y:n.y},{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y,original:{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y}}]):null):null}function QR(e,t,n,i){return Tl(e,t,n,i)}function JR(e,t,n,i){var r=i.slice().reverse();return r=Tl(e,t,n,r),r?r.reverse():null}function Tl(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!ye(l,function(u,h){var d=l[h-1];return d&&Tr(u,d)<3})}function o(l,u,h){var d=Dn(u,l);switch(d){case"v":return{x:h.x,y:l.y};case"h":return{x:l.x,y:h.y}}return{x:l.x,y:l.y}}function a(l,u,h){var d;for(d=l.length-2;d!==0;d--)if(Cu(l[d],u,Wv)||Cu(l[d],h,Wv))return l.slice(d);return l}if(r(i))return null;var s=i[0],c=i.slice(),p;return c[0]=n,c[1]=o(c[1],s,n),p=a(c,e,t),p!==c&&(c=Tl(e,t,n,p)),c&&Dn(c)?null:c}function eP(e,t){if(Yv(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 tP(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Yv(e){return e&&/t|r|b|l/.test(e)}function nP(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 Xv(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 Zv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return uc(r,o,n,0)||t.push(n),t},[])}var iP=-10,rP=40,Al={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Bs={top:"t",right:"r",bottom:"b",left:"l"};function Ml(){}q(Ml,Vv),Ml.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s,c;return o||(o=Qv(r&&r[0],n)),a||(a=Qv(r&&r[r.length-1],i)),(y(e,"bpmn:Association")||y(e,"bpmn:DataAssociation"))&&r&&!Jv(n,i)?[].concat([o],r.slice(1,-1),[a]):(y(e,"bpmn:MessageFlow")?s=aP(n,i):(y(e,"bpmn:SequenceFlow")||Jv(n,i))&&(n===i?s={preferredLayouts:fP(n,e)}:y(n,"bpmn:BoundaryEvent")?s={preferredLayouts:mP(n,i,a)}:Po(n)||Po(i)?s=cP(n):y(n,"bpmn:Gateway")?s={preferredLayouts:["v:h"]}:y(i,"bpmn:Gateway")?s={preferredLayouts:["h:v"]}:s={preferredLayouts:["h:h"]}),s&&(s=N(s,t),c=Zv(YR(n,i,o,a,r,s))),c||[o,a])};function oP(e){var t=e.host;return lt(ne(e),t,iP)}function aP(e,t){return{preferredLayouts:["straight","v:v"],preserveDocking:sP(e,t)}}function sP(e,t){return y(t,"bpmn:Participant")?"source":y(e,"bpmn:Participant")?"target":Po(t)?"source":Po(e)||y(t,"bpmn:Event")?"target":y(e,"bpmn:Event")?"source":null}function cP(e){return{preferredLayouts:["straight","h:h"],preserveDocking:pP(e)}}function pP(e){return Po(e)?"target":"source"}function Qv(e,t){return e?e.original||e:ne(t)}function Jv(e,t){return y(t,"bpmn:Activity")&&y(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Po(e){return y(e,"bpmn:SubProcess")&&ve(e)}function ko(e,t){return e===t}function lP(e,t){return t.indexOf(e)!==-1}function To(e){var t=/right|left/.exec(e);return t&&t[0]}function Gi(e){var t=/top|bottom/.exec(e);return t&&t[0]}function uP(e,t){return Al[e]===t}function hP(e,t){var n=To(e),i=Al[n];return t.indexOf(i)!==-1}function dP(e,t){var n=Gi(e),i=Al[n];return t.indexOf(i)!==-1}function Dl(e){return e==="right"||e==="left"}function fP(e,t){var n=t.waypoints,i=n&&n.length&&lt(n[0],e);return i==="top"?["t:r"]:i==="right"?["r:b"]:i==="left"?["l:t"]:["b:l"]}function mP(e,t,n){var i=ne(e),r=ne(t),o=oP(e),a,s,c=ko(e.host,t),p=lP(o,["top","right","bottom","left"]),l=lt(r,i,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return c?vP(o,p,e,t,n):(a=yP(o,l,p),s=gP(o,l,p),[a+":"+s])}function vP(e,t,n,i,r){var o=t?e:Gi(e),a=Bs[o],s;return t?Dl(e)?s=ey("y",n,i,r)?"h":"b":s=ey("x",n,i,r)?"v":"l":s="v",[a+":"+s]}function ey(e,t,n,i){var r=rP;return!(Bl(e,i,n,r)||Bl(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Bl(e,i,ne(t),r))}function Bl(e,t,n,i){return Math.abs(t[e]-n[e])<i}function yP(e,t,n){return n?Bs[e]:ko(Gi(e),Gi(t))||uP(To(e),To(t))?Bs[Gi(e)]:Bs[To(e)]}function gP(e,t,n){return n?Dl(e)?hP(e,t)||ko(e,t)?"h":"v":dP(e,t)||ko(e,t)?"v":"h":Dl(t)||ko(Gi(e),Gi(t))&&To(t)?"h":"v"}function ty(e){return N({original:e.point.original||e.point},e.actual)}function bi(e,t){this._elementRegistry=e,this._graphicsFactory=t}bi.$inject=["elementRegistry","graphicsFactory"],bi.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(ty(i)),o.push(ty(r)),o},bi.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},bi.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return mc(i,r,n)},bi.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},bi.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},bi.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const bP={__init__:["modeling","bpmnUpdater"],__depends__:[SC,HC,VC,WC,If,rR,cR,lR,vR,bn,jc,xv],bpmnFactory:["type",Jt],bpmnUpdater:["type",Tt],elementFactory:["type",mi],modeling:["type",ht],layouter:["type",Ml],connectionDocking:["type",bi]};var xP=500,_P=1250,EP=1500,Ns=Math.round;function wP(e){return{x:e.x+Ns(e.width/2),y:e.y+Ns(e.height/2)}}function ny(e,t,n,i,r){function o(s,c,p,l){return r.allowed("elements.move",{shapes:s,delta:c,position:p,target:l})}e.on("shape.move.start",EP,function(s){var c=s.context,p=s.shape,l=i.get().slice();l.indexOf(p)===-1&&(l=[p]),l=SP(l),N(c,{shapes:l,validatedShapes:l,shape:p})}),e.on("shape.move.start",_P,function(s){var c=s.context,p=c.validatedShapes,l;if(l=c.canExecute=o(p),!l)return!1}),e.on("shape.move.move",xP,function(s){var c=s.context,p=c.validatedShapes,l=s.hover,u={x:s.dx,y:s.dy},h={x:s.x,y:s.y},d;if(d=o(p,u,h,l),c.delta=u,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,p=c.delta,l=c.canExecute,u=l==="attach",h=c.shapes;if(l===!1)return!1;p.x=Ns(p.x),p.y=Ns(p.y),!(p.x===0&&p.y===0)&&n.moveElements(h,p,c.target,{primaryShape:c.shape,attach:u})}),e.on("element.mousedown",function(s){if(ai(s)){var c=nr(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,p,l){if(rt(p)&&(l=p,p=!1),!(c.waypoints||!c.parent)&&!he(s.target).has("djs-hit-no-move")){var u=wP(c);return t.init(s,u,"shape.move",{cursor:"grabbing",autoActivate:p,data:{shape:c,context:l||{}}}),!0}}this.start=a}ny.$inject=["eventBus","dragging","modeling","selection","rules"];function SP(e){var t=No(e,"id");return ce(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var iy=499,Nl="djs-dragging",ry="drop-ok",oy="drop-not-ok",ay="new-parent",sy="attach-ok";function cy(e,t,n,i){function r(c){var p=o(c),l=CP(p);return l}function o(c){var p=Pr(c,!0),l=bt(p,function(u){return(u.incoming||[]).concat(u.outgoing||[])});return Xs(p.concat(l))}function a(c,p){[sy,ry,oy,ay].forEach(function(l){l===p?t.addMarker(c,l):t.removeMarker(c,l)})}function s(c,p,l){i.addDragger(p,c.dragGroup),l&&t.addMarker(p,Nl),c.allDraggedElements?c.allDraggedElements.push(p):c.allDraggedElements=[p]}e.on("shape.move.start",iy,function(c){var p=c.context,l=p.shapes,u=p.allDraggedElements,h=r(l);if(!p.dragGroup){var d=Z("g");Y(d,n.cls("djs-drag-group",["no-events"]));var f=t.getActiveLayer();ee(f,d),p.dragGroup=d}h.forEach(function(v){i.addDragger(v,p.dragGroup)}),u?u=Xs([u,o(l)]):u=o(l),k(u,function(v){t.addMarker(v,Nl)}),p.allDraggedElements=u,p.differentParents=RP(l)}),e.on("shape.move.move",iy,function(c){var p=c.context,l=p.dragGroup,u=p.target,h=p.shape.parent,d=p.canExecute;u&&(d==="attach"?a(u,sy):p.canExecute&&u&&u.id!==h.id?a(u,ay):a(u,p.canExecute?ry:oy)),kt(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var p=c.context,l=p.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var p=c.context,l=p.allDraggedElements,u=p.dragGroup;k(l,function(h){t.removeMarker(h,Nl)}),u&&Fe(u)}),this.makeDraggable=s}cy.$inject=["eventBus","canvas","styles","previewSupport"];function CP(e){var t=ce(e,function(n){return De(n)?ye(e,hn({id:n.source.id}))&&ye(e,hn({id:n.target.id})):!0});return t}function RP(e){return tk(No(e,function(t){return t.parent&&t.parent.id}))!==1}const PP={__depends__:[Fr,bn,jh,_n,$n,Qr],__init__:["move","movePreview"],move:["type",ny],movePreview:["type",cy]};var py=".djs-palette-toggle",ly=".entry",kP=py+", "+ly,Ol="djs-palette-",TP="shown",jl="open",uy="two-column",AP=1e3;function Ye(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var r=i.tool;n.updateToolHighlight(r)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}Ye.$inject=["eventBus","canvas"],Ye.prototype.registerProvider=function(e,t){t||(t=e,e=AP),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Ye.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(DP,{})},Ye.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Ye.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Me(Ye.HTML_MARKUP);n.appendChild(i),Je(n).add(Ol+TP),Rt.bind(i,kP,"click",function(r){var o=r.delegateTarget;if(Sr(o,py))return e.toggle();e.trigger("click",r)}),J.bind(i,"mousedown",function(r){r.stopPropagation()}),Rt.bind(i,ly,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Ye.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Ye.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=Je(n),a=Je(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(uy,r),a.toggle(Ol+uy,r),"open"in e&&(o.toggle(jl,e.open),a.toggle(Ol+jl,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Ye.prototype._update=function(){var e=Ae(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Io(e),k(t,function(n,i){var r=n.group||"default",o=Ae("[data-group="+Hr(r)+"]",e);o||(o=Me('<div class="group"></div>'),ft(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Me(a);if(o.appendChild(s),!n.separator&&(ft(s,"data-action",i),n.title&&ft(s,"title",n.title),n.className&&MP(s,n.className),n.imageUrl)){var c=Me("<img>");ft(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Ye.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=ft(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Ye.prototype.triggerEntry=function(e,t,n,i){var r=this._entries,o,a;if(o=r[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(pt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Ye.prototype._layoutChanged=function(){this._toggleState({})},Ye.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Ye.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ye.prototype.open=function(){this._toggleState({open:!0})},Ye.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ye.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ye.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Ae(".djs-palette-entries",this._container),this._toolsContainer=Ae("[data-group=tools]",t)),n=this._toolsContainer,k(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=Je(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Ye.prototype.isOpen=function(){return Je(this._container).has(jl)},Ye.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ye.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function MP(e,t){var n=Je(e),i=le(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function DP(e,t){var n=t.getPaletteEntries();return pt(n)?n(e):(k(n,function(i,r){e[r]=i}),e)}const BP={__init__:["palette"],palette:["type",Ye]};var hy="crosshair";function Vi(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var l=t.getActiveLayer(),u;u=p.frame=Z("rect"),Y(u,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ee(l,u)},update:function(p){var l=p.frame,u=p.bbox;Y(l,{x:u.x,y:u.y,width:u.width,height:u.height})},remove:function(p){p.frame&&Fe(p.frame)}};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var l=p.originalEvent.target;!p.hover&&!(l instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",function(p){var l=Ll(p),u=i.filter(function(h){return h});s.select(u,l)}),e.on("lasso.start",function(p){var l=p.context;l.bbox=Ll(p),c.create(l)}),e.on("lasso.move",function(p){var l=p.context;l.bbox=Ll(p),c.update(l)}),e.on("lasso.cleanup",function(p){var l=p.context;c.remove(l)}),e.on("element.mousedown",1500,function(p){if(Bc(p))return s.activateLasso(p.originalEvent),!0})}Vi.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Vi.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:hy,data:{context:{}}})},Vi.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:hy,data:{context:{}}})},Vi.prototype.select=function(e,t){var n=Gg(e,t);this._selection.select(iu(n))},Vi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Vi.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Ll(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 NP={__depends__:[ms,eo],__init__:["lassoTool"],lassoTool:["type",Vi]};var Il=1500,dy="grab";function gr(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var a=this,s=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Il,function(c){if(ir(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Il,function(c){if(!(!fy(c.keyEvent)||a.isActive())){var p=a._mouse.getLastMoveEvent();a.activateMove(p,!!p)}},"keyboard.keydown"),s&&s.addListener(Il,function(c){!fy(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var p=c.originalEvent.target;if(!c.hover&&!(p instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var p=t.viewbox().scale;t.scroll({dx:c.dx*p,dy:c.dy*p})}),e.on("hand.move.end",function(c){var p=c.context,l=p.reactivate;return!ir(c)&&l&&e.once("hand.move.ended",function(u){a.activateHand(u.originalEvent,!0,!0)}),!1})}gr.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],gr.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:dy,data:{context:n||{}}})},gr.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:dy,data:{context:{reactivate:n}}})},gr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},gr.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function fy(e){return tt("Space",e)}const OP={__depends__:[ms,eo],__init__:["handTool"],handTool:["type",gr]};var my="connect-ok",vy="connect-not-ok";function br(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var p=c.context,l=c.hover,u=p.canStartConnect=s.canStartConnect(l);u!==null&&(p.startTarget=l,i.addMarker(l,u?my:vy))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var p=c.context.startTarget,l=c.context.canStartConnect;p&&i.removeMarker(p,l?my:vy)}),e.on(["global-connect.ended"],function(c){var p=c.context,l=p.startTarget,u={x:c.x,y:c.y},h=s.canStartConnect(l);if(h)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,u)}),!1})}br.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],br.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},br.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},br.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},br.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const jP={__depends__:[dp,_n,$n,ms,eo],globalConnect:["type",br]};function $l(e,t,n,i,r,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}$l.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],$l.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(u,h,d,f,v){function g(E){var _=n.createShape(N({type:u},v));if(v){var x=ge(_);x.isExpanded=v.isExpanded}t.start(E,_)}var R=u.replace(/^bpmn:/,"");return{group:h,className:d,title:f||s("Create {type}",{type:R}),action:{dragstart:g,click:g}}}function p(u){var h=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:h});t.start(u,[h,d],{hints:{autoSelect:[h]}})}function l(u){t.start(u,n.createParticipantShape())}return N(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate the hand tool"),action:{click:function(u){o.activateHand(u)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate the lasso tool"),action:{click:function(u){r.activateSelection(u)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate the create/remove space tool"),action:{click:function(u){i.activateSelection(u)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate the global connect tool"),action:{click:function(u){a.start(u)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create StartEvent")),"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 EndEvent")),"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 DataObjectReference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create DataStoreReference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded SubProcess"),action:{dragstart:p,click:p}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create Pool/Participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create Group"))}),e};const LP={__depends__:[BP,ja,xv,NP,OP,jP,ha],__init__:["paletteProvider"],paletteProvider:["type",$l]};var IP=250;function zl(e,t,n,i,r){V.call(this,e);function o(s){var c=s.canExecute.replacements;k(c,function(p){var l=p.oldElementId,u={type:p.newElementType};if(!s.visualReplacements[l]){var h=t.get(l);N(u,{x:h.x,y:h.y});var d=n.createShape(u);i.addShape(d,h.parent);var f=Ae('[data-element-id="'+Hr(h.id)+'"]',s.dragGroup);f&&Y(f,{display:"none"});var v=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=v,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;k(c,function(p,l){var u=Ae('[data-element-id="'+Hr(l)+'"]',s.dragGroup);u&&Y(u,{display:"inline"}),p.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",IP,function(s){var c=s.context,p=c.canExecute;c.visualReplacements||(c.visualReplacements={}),p&&p.replacements?o(c):a(c)})}zl.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],q(zl,V);const $P={__depends__:[Qr],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",zl]};var zP=1250,Fl=40,FP=20,HP=10,yy=20,gy=["x","y"],GP=Math.abs;function by(e){e.on(["connect.hover","connect.move","connect.end"],zP,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&jt(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&VP(t,o,KP(o)),o&&qP(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Kt(r),de(o,["bpmn:Event","bpmn:Gateway"])&&xy(t,Kt(o)),de(o,["bpmn:Task","bpmn:SubProcess"])&&WP(t,o),y(a,"bpmn:BoundaryEvent")&&s===a.host&&UP(t)):_y(i,"bpmn:MessageFlow")?(y(r,"bpmn:Event")&&(n.connectionStart=Kt(r)),y(o,"bpmn:Event")&&xy(t,Kt(o))):n.connectionStart=n.initialConnectionStart)})}by.$inject=["eventBus"];function VP(e,t,n){gy.forEach(function(i){var r=Ey(i,t);e[i]<t[i]+n?Ke(e,i,t[i]+n):e[i]>t[i]+r-n&&Ke(e,i,t[i]+r-n)})}function WP(e,t){var n=Kt(t);gy.forEach(function(i){YP(e,t,i)&&Ke(e,i,n[i])})}function UP(e){var t=e.context,n=t.source,i=t.target;if(!XP(t)){var r=Kt(n),o=lt(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(s){var c=e[s],p;GP(c-r[s])<Fl&&(c>r[s]?p=r[s]+Fl:p=r[s]-Fl,Ke(e,s,p))})}}function xy(e,t){Ke(e,"x",t.x),Ke(e,"y",t.y)}function _y(e,t){return e&&e.type===t}function qP(e,t){return kn(t,function(n){return _y(e,n)})}function Ey(e,t){return e==="x"?t.width:t.height}function KP(e){return y(e,"bpmn:Task")?HP:FP}function YP(e,t,n){return e[n]>t[n]+yy&&e[n]<t[n]+Ey(n,t)-yy}function XP(e){var t=e.hover,n=e.source;return t&&n&&t===n}function xi(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}xi.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},xi.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},xi.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},xi.prototype.getSnapLocations=function(){return this._snapLocations},xi.prototype.setSnapLocations=function(e){this._snapLocations=e},xi.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Os,n.initDefaults(this._defaultSnaps)),n};function Os(){this._snapValues={}}Os.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)},Os.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&mE(e[n],r[n],i)},Os.prototype.initDefaults=function(e){var t=this;k(e||{},function(n,i){k(n,function(r){t.add(i,r)})})};var ZP=1250;function wn(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],ZP,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&jt(r.originalEvent))&&!(hr(r)||!c)){var p=s.pointsForTarget(c);p.initialized||(p=i.addSnapTargetPoints(p,a,c),p.initialized=!0),n.snap(r,p)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}wn.$inject=["elementRegistry","eventBus","snapping"],wn.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new xi);var o;t.get(i.id)?o=Kt(i,e):o={x:e.x+Kt(i).x,y:e.y+Kt(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),xe(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},wn.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return k(i,function(r){if(xe(r)){xe(t)&&e.add("mid",Kt(r));return}if(De(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);k(o,function(a){e.add("mid",a)});return}e.add("mid",Kt(r))}),!ie(t.x)||!ie(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Kt(t)),e},wn.prototype.getSnapTargets=function(e,t){return hf(t).filter(function(n){return!QP(n)})};function QP(e){return!!e.hidden}var wy=1500;function xr(e,t){t.invoke(wn,this),e.on(["create.move","create.end"],wy,n2),e.on(["create.move","create.end","shape.move.move","shape.move.end"],wy,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!hr(n)&&JP(n,o)})}q(xr,wn),xr.$inject=["eventBus","injector"],xr.prototype.initSnap=function(e){var t=wn.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return k(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Cy(o,i,e))}),k(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Cy(o,i,e))}),y(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},xr.prototype.addSnapTargetPoints=function(e,t,n){wn.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);k(i,function(o){(t2(o)||e2([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",lf(o)),e.add("bottom-right",uf(o)))});var r=this._elementRegistry;return k(t.incoming,function(o){if(r.get(t.id)){Sy(i,o.source)||e.add("mid",ne(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),k(t.outgoing,function(o){if(r.get(t.id)){Sy(i,o.target)||e.add("mid",ne(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),y(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},xr.prototype.getSnapTargets=function(e,t){return wn.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!y(n,"bpmn:Lane")})};function JP(e,t){var n=X(t),i=Jm(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=ne(o),/top/.test(i)?Ke(e,"y",n.top-a.y):/bottom/.test(i)&&Ke(e,"y",n.bottom-a.y),/left/.test(i)?Ke(e,"x",n.left-a.x):/right/.test(i)&&Ke(e,"x",n.right-a.x)}function e2(e,t){return e.every(function(n){return y(n,t)})}function t2(e){return y(e,"bpmn:SubProcess")&&ve(e)?!0:y(e,"bpmn:Participant")}function n2(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,r=n.right,o=n.bottom,a=n.left;(a&&a>=e.x||r&&r<=e.x)&&Ke(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Ke(e,"y",e.y)}}function Sy(e,t){return e.indexOf(t)!==-1}function Cy(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var i2=1250;function Ao(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],i2,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&jt(i.originalEvent))&&!hr(i)){var p=c.pointsForTarget(a);p.initialized||(p=n.addSnapTargetPoints(p,o,a,s),p.initialized=!0),a2(s)&&Ke(i,"x",i.x),s2(s)&&Ke(i,"y",i.y),t.snap(i,p)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ao.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new xi);var o=Ry(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ao.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return k(r,function(o){e.add("corner",uf(o)),e.add("corner",lf(o))}),e.add("corner",Ry(t,i)),e},Ao.$inject=["eventBus","snapping"],Ao.prototype.getSnapTargets=function(e,t){return hf(t).filter(function(n){return!r2(n,e)&&!De(n)&&!o2(n)&&!xe(n)})};function Ry(e,t){var n=ne(e),i=X(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function r2(e,t){return e.host===t}function o2(e){return!!e.hidden}function a2(e){return e==="n"||e==="s"}function s2(e){return e==="e"||e==="w"}var c2=7,p2=1e3;function _i(e){this._canvas=e,this._asyncHide=eg(Ct(this.hide,this),p2)}_i.$inject=["canvas"],_i.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:hr(e,"x"),y:hr(e,"y")};k(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(k(["x","y"],function(p){var l;o[p]||(l=t.snap(c,a,p,c2),l!==void 0&&(o[p]={value:l,originValue:l-s[p]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),k(["x","y"],function(a){var s=o[a];rt(s)&&Ke(e,a,s.originValue)})},_i.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Z("path");return Y(n,{d:"M0,0 L0,0"}),he(n).add("djs-snap-line"),ee(t,n),{update:function(i){ie(i)?e==="horizontal"?Y(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Y(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Y(n,{display:"none"})}}},_i.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},_i.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},_i.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},_i.prototype.hide=function(){k(this._snapLines,function(e){e.update()})};const l2={__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",wn],resizeSnapping:["type",Ao],snapping:["type",_i]},u2={__depends__:[l2],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",by],createMoveSnapping:["type",xr]};function re(e,t,n,i){this._open=!1,this._results=[],this._eventMaps=[],this._canvas=e,this._eventBus=t,this._overlays=n,this._selection=i,this._container=Me(re.BOX_HTML),this._searchInput=Ae(re.INPUT_SELECTOR,this._container),this._resultsContainer=Ae(re.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}re.$inject=["canvas","eventBus","overlays","selection"],re.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Rt.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close()}),t(this._container,re.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,re.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,re.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,re.INPUT_SELECTOR,"keydown",function(n){tt("ArrowUp",n)&&n.preventDefault(),tt("ArrowDown",n)&&n.preventDefault()}),t(this._container,re.INPUT_SELECTOR,"keyup",function(n){if(tt("Escape",n))return e.close();if(tt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close()}if(tt("ArrowUp",n))return e._scrollToDirection(!0);if(tt("ArrowDown",n))return e._scrollToDirection();tt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},re.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Rt.unbind(e.el,e.type,e.listener)})},re.prototype._search=function(e){var t=this;if(this._clearResults(),!(!e||e==="")){var n=this._searchProvider.find(e);if(n.length){n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=Ae(re.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}}},re.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},re.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)}},re.prototype._clearResults=function(){Io(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},re.prototype._getCurrentResult=function(){return Ae(re.RESULT_SELECTED_SELECTOR,this._resultsContainer)},re.prototype._createResultNode=function(e,t){var n=Me(re.RESULT_HTML);return e.primaryTokens.length>0&&Py(n,e.primaryTokens,re.RESULT_PRIMARY_HTML),Py(n,e.secondaryTokens,re.RESULT_SECONDARY_HTML),ft(n,re.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},re.prototype.registerProvider=function(e){this._searchProvider=e},re.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,Je(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},re.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,Je(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},re.prototype.toggle=function(){this.isOpen()?this.close():this.open()},re.prototype.isOpen=function(){return this._open},re.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Je(t).remove(re.RESULT_SELECTED_CLASS);var n=ft(e,re.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Je(e).add(re.RESULT_SELECTED_CLASS),this._resetOverlay(i),this._canvas.scrollToElement(i,{top:400}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},re.prototype._select=function(e){var t=ft(e,re.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this.close(),this._resetOverlay(),this._canvas.scrollToElement(n,{top:400}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},re.prototype._resetOverlay=function(e){if(this._overlayId&&this._overlays.remove(this._overlayId),e){var t=Ve(e),n=h2(t);this._overlayId=this._overlays.add(e,n)}};function h2(e){var t=6,n=e.width+t*2,i=e.height+t*2,r={width:n+"px",height:i+"px"},o=Me('<div class="'+re.OVERLAY_CLASS+'"></div>');return st(o,r),{position:{bottom:i-t,right:n-t},show:!0,html:o}}function Py(e,t,n){var i=d2(t),r=Me(n);r.innerHTML=i,e.appendChild(r)}function d2(e){var t="";return e.forEach(function(n){n.matched?t+='<strong class="'+re.RESULT_HIGHLIGHT_CLASS+'">'+Ic(n.matched)+"</strong>":t+=Ic(n.normal)}),t!==""?t:null}re.CONTAINER_SELECTOR=".djs-search-container",re.INPUT_SELECTOR=".djs-search-input input",re.RESULTS_CONTAINER_SELECTOR=".djs-search-results",re.RESULT_SELECTOR=".djs-search-result",re.RESULT_SELECTED_CLASS="djs-search-result-selected",re.RESULT_SELECTED_SELECTOR="."+re.RESULT_SELECTED_CLASS,re.RESULT_ID_ATTRIBUTE="data-result-id",re.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",re.OVERLAY_CLASS="djs-search-overlay",re.BOX_HTML='<div class="djs-search-container djs-draggable djs-scrollable"><div class="djs-search-input"><input type="text"/></div><div class="djs-search-results"></div></div>',re.RESULT_HTML='<div class="djs-search-result"></div>',re.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',re.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const f2={__depends__:[ya,bn],searchPad:["type",re]};function Hl(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}Hl.$inject=["elementRegistry","searchPad","canvas"],Hl.prototype.find=function(e){var t=this._canvas.getRootElement(),n=this._elementRegistry.filter(function(i){return!i.labelTarget});return n=ce(n,function(i){return i!==t}),n=bt(n,function(i){return{primaryTokens:Ty(Ut(i),e),secondaryTokens:Ty(i.id,e),element:i}}),n=ce(n,function(i){return ky(i.primaryTokens)||ky(i.secondaryTokens)}),n=ln(n,function(i){return Ut(i.element)+i.element.id}),n};function ky(e){var t=ce(e,function(n){return!!n.matched});return t.length>0}function Ty(e,t){var n=[],i=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();var r=e.indexOf(t);return r>-1?(r!==0&&n.push({normal:i.substr(0,r)}),n.push({matched:i.substr(r,t.length)}),t.length+r<e.length&&n.push({normal:i.substr(t.length+r,e.length)})):n.push({normal:i}),n}const m2={__depends__:[f2],__init__:["bpmnSearch"],bpmnSearch:["type",Hl]};var v2='<?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 Lt(e){Lr.call(this,e)}q(Lt,Lr),Lt.Viewer=ci,Lt.NavigatedViewer=Vr,Lt.prototype.createDiagram=function(){return this.importXML(v2)},Lt.prototype.createDiagram=er(Lt.prototype.createDiagram),Lt.prototype._interactionModules=[Jh,id,r1,ad],Lt.prototype._modelingModules=[P1,Od,Z1,W1,yE,dp,wE,bw,Bf,ja,Sw,Pw,Vw,qw,Kw,Jw,uS,bP,PP,LP,$P,lm,u2,m2],Lt.prototype._modules=[].concat(ci.prototype._modules,Lt.prototype._interactionModules,Lt.prototype._modelingModules);function Ie(e,t){if(t){const n=e.replace(t.type,e);return e+n}return e}const{t:Sn}=Jy();function Gl(e,t,n,i,r,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}Gl.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Gl.prototype.getPaletteEntries=function(){const e={},t=this._create,n=this._elementFactory,i=this._handTool,r=this._globalConnect;function o(s,c,p,l,u){function h(f){const v=n.createShape(N({type:s},u));u&&(v.businessObject.di.isExpanded=u.isExpanded),t.start(f,v)}const d=s.replace(/^bpmn:/,"");return{group:c,className:p,title:l||Ie("Create {type}",{type:d}),action:{dragstart:h,click:h}}}function a(s){const c=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),p=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:c});t.start(s,[c,p],{hints:{autoSelect:[p]}})}return N(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:Ie(Sn("\u6FC0\u6D3B\u624B\u52A8\u5DE5\u5177")),action:{click:function(s){i.activateHand(s)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:Ie(Sn("\u6FC0\u6D3B\u5168\u5C40\u8FDE\u63A5\u5DE5\u5177")),action:{click:function(s){r.toggle(s)}}},"create.end-event":o("bpmn:EndEvent","event","bpmn-icon-end-event-none",Ie(Sn("\u521B\u5EFA\u7ED3\u675F\u8282\u70B9"))),"create.exclusive-gateway":o("bpmn:ExclusiveGateway","event","bpmn-icon-gateway-xor",Ie(Sn("\u521B\u5EFA\u4E92\u65A5\u7F51\u5173"))),"create.inclusive-gateway":o("bpmn:InclusiveGateway","event","bpmn-icon-gateway-or",Ie(Sn("\u521B\u5EFA\u76F8\u5BB9\u7F51\u5173"))),"create.parallel-gateway":o("bpmn:ParallelGateway","event","bpmn-icon-gateway-parallel",Ie(Sn("\u521B\u5EFA\u5E76\u884C\u7F51\u5173"))),"create.user-task":o("bpmn:UserTask","event","bpmn-icon-user",Ie(Sn("\u521B\u5EFA\u7528\u6237\u8282\u70B9"))),"create.script-task":o("bpmn:ScriptTask","event","bpmn-icon-script",Ie(Sn("\u521B\u5EFA\u811A\u672C\u8282\u70B9"))),"create.CallActivity":o("bpmn:CallActivity","event","bpmn-icon-call-activity",Ie(Sn("\u521B\u5EFA\u5916\u90E8\u6D41\u7A0B"))),"create.subprocess-expanded":{group:"event",className:"bpmn-icon-subprocess-expanded",title:Ie(Sn("\u521B\u5EFA\u5B50\u6D41\u7A0B")),action:{dragstart:a,click:a}}}),e};const y2=1500,g2=2;class Vl extends fn{constructor(t,n,i){super(t,y2),this.bpmnRenderer=n,this.paletteEntries=i}canRender(t){return de(t,["bpmn:Task","bpmn:Event"])&&!t.labelTarget}drawShape(t,n){const i=this.paletteEntries,r=ye(i,o=>y(n,o.type));return r&&r.drawShape instanceof Function?r.drawShape(t,n,this.bpmnRenderer):this.bpmnRenderer.drawShape(t,n)}getShapePath(t){return y(t,"bpmn:Task")?Ph(t,g2):this.bpmnRenderer.getShapePath(t)}}Qy(Vl,"$inject"),Vl.$inject=["eventBus","bpmnRenderer","config.paletteEntries"];function an(e,t){const n=js(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function js(e){return e&&e.businessObject||e}function b2(e){return an(e,"bpmn:CallActivity")?!1:an(e,"bpmn:SubProcess")?!!js(e).di.isExpanded:an(e,"bpmn:Participant")?!!js(e).processRef:!0}function x2(e){return e&&!!js(e).triggeredByEvent}function Ls(e,t){return kn(t,function(n){return an(e,n)})}function _2(e){return e.children.filter(function(t){return an(t,"bpmn:Lane")})}const{t:Wn}=Jy();function Wl(e,t,n,i,r,o,a,s,c,p,l){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=p,this._rules=l,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1))}Wl.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","rules"],Wl.prototype.getContextPadEntries=function(e){const t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._autoPlace,s={};if(e.type==="label")return s;if(an(e,"bpmn:EndEvent")||an(e,"bpmn:SequenceFlow"))return{delete:{group:"event2",className:"bpmn-icon-trash",title:Ie(Wn("\u5220\u9664")),action:{click:l}},connect:{group:"none",className:"bpmn-icon-text-annotation",title:"a",action:{}},replace:{group:"none",className:"bpmn-icon-text-annotation",title:"a",action:{}},"append.gateway":{group:"none",className:"bpmn-icon-text-annotation",title:"a",action:{}},"append.append-task":{group:"none",className:"bpmn-icon-text-annotation",title:"a",action:{}},"append.intermediate-event":{group:"none",className:"bpmn-icon-text-annotation",title:"a",action:{}},"append.text-annotation":{group:"none",className:"bpmn-icon-text-annotation",title:"a",action:{}}};const c=e.businessObject;function p(d,f){r.start(d,f)}function l(){n.removeElements([e])}function u(d,f,v,g){typeof v!="string"&&(g=v,v=Ie("Append {type}",{type:d.replace(/^bpmn:/,"")}));function R(E,_){const x=i.createShape(N({type:d},g));o.start(E,x,{source:_})}return{group:"event1",className:f,title:v,action:{dragstart:R,click:a?function(E,_){const x=i.createShape(N({type:d},g));a.append(_,x)}:R}}}function h(d){return function(f,v){n.splitLane(v,d),t.open(v,!0)}}if(Ls(c,["bpmn:Lane","bpmn:Participant"])&&b2(c)&&(_2(e).length<2&&(e.height>=120&&N(s,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:Ie("Divide into two Lanes"),action:{click:h(2)}}}),e.height>=180&&N(s,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:Ie("Divide into three Lanes"),action:{click:h(3)}}})),N(s,{})),Ls(c,["bpmn:Lane","bpmn:Participant"]),an(c,"bpmn:FlowNode")&&(an(c,"bpmn:EventBasedGateway")||Ay(c,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")||!an(c,"bpmn:EndEvent")&&!c.isForCompensation&&!Ay(c,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!x2(c)&&N(s,{"append.end-event":u("bpmn:EndEvent","bpmn-icon-end-event-none",Ie(Wn("\u521B\u5EFA\u7ED3\u675F\u8282\u70B9"))),"append.script-task":u("bpmn:ScriptTask","bpmn-icon-script",Ie(Wn("\u521B\u5EFA\u811A\u672C\u8282\u70B9"))),"append.user-task":u("bpmn:UserTask","bpmn-icon-user",Ie(Wn("\u521B\u5EFA\u7528\u6237\u8282\u70B9"))),"append.exclusive-gateway":u("bpmn:ExclusiveGateway","bpmn-icon-gateway-xor",Ie(Wn("\u4E92\u65A5\u7F51\u5173"))),"append.inclusive-gateway":u("bpmn:InclusiveGateway","bpmn-icon-gateway-or",Ie(Wn("\u76F8\u5BB9\u7F51\u5173"))),"append.parallel-gateway":u("bpmn:ParallelGateway","bpmn-icon-gateway-parallel",Ie(Wn("\u5E76\u884C\u7F51\u5173"))),connect:{group:"event2",className:"bpmn-icon-connection-multi",title:Ie(Wn("\u8FDE\u63A5\u7EBF")),action:{click:p,dragstart:p}},delete:{group:an(e,"bpmn:StartEvent")?"none":"event2",className:"bpmn-icon-trash",title:Ie(Wn("\u5220\u9664")),action:{click:l}}})),Ls(c,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])){const d={group:"none",className:"",title:Ie(""),action:{}};N(s,{"append.text-annotation":d,"append.gateway":d,"append.append-task":d,"append.intermediate-event":d,replace:d})}return s};function Ay(e,t,n){const i=e.$instanceOf(t);let r=!1;const o=e.eventDefinitions||[];return k(o,function(a){a.$type===n&&(r=!0)}),i&&r}function My(e){e.on(["create.init"],function(t){}),e.on(["create.init","shape.move.init"],function(t){const n=t.context,i=t.shape;Ls(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}My.$inject=["eventBus"];const E2={__init__:["paletteProvider","customRenderer","customContextPad","bpmnGridSnapping"],paletteProvider:["type",Gl],customRenderer:["type",Vl],customContextPad:["type",Wl],bpmnGridSnapping:["type",My]};jo=function(e){Lt.call(this,e),this._customElements=[]},Le(jo,Lt);const w2=[E2];jo.prototype._modules=[].concat(jo.prototype._modules,w2)}));export{jo as C,ik as __tla};