Home
last modified time | relevance | path

Searched refs:_paste (Results 1 – 4 of 4) sorted by relevance

/plugin/bpmnioeditor/vendor/bpmnio-js/
Dbpmn-modeler.production.min.js34 …oint)return this._paste(i,e.element,e.point,n);this._create.start(this._mouse.getLastMoveEvent(),i…
Dbpmn-modeler.development.js33033 return this._paste(elements, context.element, context.point, hints);
33049 CopyPaste.prototype._paste = function(elements, target, position, hints) {
/plugin/bpmnio/vendor/bpmn-js/dist/
H A Dbpmn-modeler.production.min.js262 </svg>`},Eu=HC;var $C=900;function oi(e,t,n,r){e.registerProvider($C,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=r}oi.$inject=["contextPad","popupMenu","translate","canvas"];oi.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&C(t,this._getEntries(e)),t};oi.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")};oi.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Eu.align}</div>`,action:{click:function(t,n){var r=e._getMenuPosition(n);C(r,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",r)}}}}};oi.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,r=n.getBoundingClientRect(),i={x:r.left,y:r.bottom+t};return i};N();var zC=["left","center","right","top","middle","bottom"];function Oi(e,t,n,r){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",this)}Oi.$inject=["popupMenu","alignElements","translate","rules"];Oi.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&C(t,this._getEntries(e)),t};Oi.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})};Oi.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,r=this._popupMenu,i={};return E(zC,function(o){i["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Eu[o],action:function(){t.trigger(e,o),r.close()}}}),i};function Ot(e){k.call(this,e),this.init()}Ot.$inject=["eventBus"];B(Ot,k);Ot.prototype.addRule=function(e,t,n){var r=this;typeof e=="string"&&(e=[e]),e.forEach(function(i){r.canExecute(i,t,function(o,a,s){return n(o)},!0)})};Ot.prototype.init=function(){};N();function ko(e){Ot.call(this,e)}ko.$inject=["eventBus"];B(ko,Ot);ko.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Q(t,function(r){return!(r.waypoints||r.host||r.labelTarget)});return n=zr(n),n.length<2?!1:n})};var Yv={__depends__:[uv,su,Do],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",oi],alignElementsMenuProvider:["type",Oi],bpmnAlignElements:["type",ko]};N();var GC=10,Pf=50,VC=250;function wu(e,t,n,r){for(var i;i=WC(e,n,t);)n=r(t,n,i);return n}function Su(e){return function(t,n,r){var i={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,u=a.minDistance;c<0?i[o]=Math.min(r[o]+c-t[s]/2,n[o]-u+c):i[o]=Math.max(r[o]+r[s]+c+t[s]/2,n[o]+u+c)}}),i}}function WC(e,t,n){var r={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},i=UC(e);return re(i,function(o){if(o===n)return!1;var a=He(o,r,GC);return a==="intersect"})}function Xv(e,t){t||(t={});function n(m){return m.source===e?1:-1}var r=t.defaultDistance||Pf,i=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||VC,c=t.reference||"start";o||(o=YC);function u(m,g){return i==="n"?c==="start"?Z(m).top-Z(g).bottom:c==="center"?Z(m).top-X(g).y:Z(m).top-Z(g).top:i==="w"?c==="start"?Z(m).left-Z(g).right:c==="center"?Z(m).left-X(g).x:Z(m).left-Z(g).left:i==="s"?c==="start"?Z(g).top-Z(m).bottom:c==="center"?X(g).y-Z(m).bottom:Z(g).bottom-Z(m).bottom:c==="start"?Z(g).left-Z(m).right:c==="center"?X(g).x-Z(m).right:Z(g).right-Z(m).right}var p=e.incoming.filter(o).map(function(m){var g=a(m),v=g<0?u(m.source,e):u(e,m.source);return{id:m.source.id,distance:v,weight:g}}),l=e.outgoing.filter(o).map(function(m){var g=a(m),v=g>0?u(e,m.target):u(m.target,e);return{id:m.target.id,distance:v,weight:g}}),f=p.concat(l).reduce(function(m,g){return m[g.id+"__weight_"+g.weight]=g,m},{}),d=Ge(f,function(m,g){var v=g.distance,w=g.weight;return v<0||v>s||(m[String(v)]||(m[String(v)]=0),m[String(v)]+=1*w,(!m.distance||m[m.distance]<m[String(v)])&&(m.distance=v)),m},{});return d.distance||r}function UC(e){var t=Rf(e);return e.host&&(t=t.concat(Rf(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,r){return n.concat(Rf(r))},[]))),t}function Rf(e){return KC(e).concat(qC(e))}function qC(e){return e.incoming.map(function(t){return t.source})}function KC(e){return e.outgoing.map(function(t){return t.target})}function YC(){return!0}var XC=100;function Cu(e,t,n){e.on("autoPlace",XC,function(r){var i=r.shape,o=r.source;return ZC(o,i)}),e.on("autoPlace.end",function(r){n.scrollToElement(r.shape)}),this.append=function(r,i,o){e.fire("autoPlace.start",{source:r,shape:i});var a=e.fire("autoPlace",{source:r,shape:i}),s=t.appendShape(r,i,a,r.parent,o);return e.fire("autoPlace.end",{source:r,shape:s}),s}}Cu.$inject=["eventBus","modeling","canvas"];function ZC(e,t,n){n||(n={});var r=n.defaultDistance||Pf,i=X(e),o=Z(e);return{x:o.right+r+t.width/2,y:i.y}}function Ru(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Ru.$inject=["eventBus","selection"];var Zv={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Cu],autoPlaceSelectionBehavior:["type",Ru]};N();function kr(e,t){for(st(t)&&(t=[t]);e=e.parent;)if(te(e,t))return e;return null}function Pu(e,t){var n=kr(e,"bpmn:Process");if(n)return!0;var r=["bpmn:Participant","bpmn:Lane"];if(n=kr(e,r),n)return Me(n);if(te(e,r))return Me(e);var i;for(i=j(e);i&&!h(i,"bpmn:Process");i=i.$parent);if(!t)return!0;var o=t.find(function(a){var s=j(a);return s&&s.get("processRef")===i});return o?Me(o):!0}function Au(e,t,n){var r=Pu(e,n);if(h(t,"bpmn:TextAnnotation"))return JC(e,t,r);if(te(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return eR(e,t,r);if(h(t,"bpmn:FlowNode"))return QC(e,t,r)}function QC(e,t,n){var r=Z(e),i=X(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=Xv(e,{filter:function(d){return h(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;h(e,"bpmn:BoundaryEvent")&&(u=He(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var p=n?{x:r.right+a+t.width/2,y:i.y+Qv(u,c,o)}:{x:i.x+Qv(u,c,o),y:r.bottom+a+t.height/2},l={margin:s,minDistance:c},f=n?{y:l}:{x:l};return wu(e,t,p,Su(f))}function Qv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function JC(e,t,n){var r=Z(e),i=n?{x:r.right+t.width/2,y:r.top-50-t.height/2}:{x:r.right+50+t.width/2,y:r.bottom+t.height/2};de(e)&&(i=X(e),n?(i.x+=100,i.y-=50):(i.x+=100,i.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return wu(e,t,i,Su(a))}function eR(e,t,n){var r=Z(e),i=n?{x:r.right-10+t.width/2,y:r.bottom+40+t.width/2}:{x:r.left-40-t.width/2,y:r.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return wu(e,t,i,Su(a))}function Tu(e,t){e.on("autoPlace",function(n){var r=n.shape,i=n.source;return Au(i,r,t)})}Tu.$inject=["eventBus","elementRegistry"];var No={__depends__:[Zv],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Tu]};N();function $n(e,t,n,r){k.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=r;var i=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,u=a.parent||a.newParent;s.autoResize!==!1&&i._expand([c],u)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=_i(Sn(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var p=Vt(s,function(l){return l.parent.id});E(p,function(l,f){q(u)&&(l=l.filter(function(d){return re(u,Ct({id:d.id}))})),i._expand(l,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||i._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&i._expand([c],u)})}$n.$inject=["eventBus","elementRegistry","modeling","rules"];B($n,k);$n.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),r=this.getPadding(t),i=Z(Ce(e)),o=Z(t),a={};return i.top-o.top<r.top&&(a.top=i.top-n.top),i.left-o.left<r.left&&(a.left=i.left-n.left),o.right-i.right<r.right&&(a.right=i.right+n.right),o.bottom-i.bottom<r.bottom&&(a.bottom=i.bottom+n.bottom),Si(C({},o,a))};$n.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 r=this._getOptimalBounds(e,t);if(tR(r,t)){var i=nR(mt(t,["x","y","width","height"]),r);this.resize(t,r,{autoResize:i});var o=t.parent;o&&this._expand([t],o)}}};$n.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}};$n.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}};$n.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function tR(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function nR(e,t){var n="";return e=Z(e),t=Z(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 Oo(e){e.invoke($n,this)}Oo.$inject=["injector"];B(Oo,$n);Oo.prototype.resize=function(e,t,n){h(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};N();function Bi(e){Ot.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Bi.$inject=["eventBus"];B(Bi,Ot);Bi.prototype.canResize=function(e,t){return!1};function Bo(e,t){Bi.call(this,e),this._modeling=t}B(Bo,Bi);Bo.$inject=["eventBus","modeling"];Bo.prototype.canResize=function(e,t){if(h(t.di,"bpmndi:BPMNPlane")||!h(t,"bpmn:Participant")&&!h(t,"bpmn:Lane")&&!h(t,"bpmn:SubProcess"))return!1;var n=!0;return E(e,function(r){if(h(r,"bpmn:Lane")||ee(r)){n=!1;return}}),n};var Jv={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Oo],bpmnAutoResizeProvider:["type",Bo]};var eg=1500;function Mu(e,t,n){var r=this,i=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=r._findTargetGfx(s),u=c&&e.get(c);c&&u&&(a.stopPropagation(),i.hover({element:u,gfx:c}),i.move(s))}}i&&t.on("drag.start",function(a){t.once("drag.move",eg,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",eg,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=An(a),c=document.elementFromPoint(s.x,s.y),rR(c)}}Mu.$inject=["elementRegistry","eventBus","injector"];function rR(e){return Bn(e,"svg, .djs-element",!0)}var tg={__init__:["hoverFix"],hoverFix:["type",Mu]};N();var Io=Math.round,ng="djs-drag-active";function Ii(e){e.preventDefault()}function iR(e){return typeof TouchEvent!="undefined"&&e instanceof TouchEvent}function oR(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Du(e,t,n,r){var i={threshold:5,trapClick:!0},o;function a(x){var b=t.viewbox(),R=t._container.getBoundingClientRect();return{x:b.x+(x.x-R.left)/b.scale,y:b.y+(x.y-R.top)/b.scale}}function s(x,b){b=b||o;var R=e.createEvent(C({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+x,R)===!1?!1:e.fire(b.prefix+"."+x,R)}function c(x){var b=x.filter(function(R){return r.get(R.id)});b.length&&n.select(b)}function u(x,b){var R=o.payload,A=o.displacement,O=o.globalStart,T=An(x),I=Dt(T,O),L=o.localStart,W=a(T),z=Dt(W,L);if(!o.active&&(b||oR(I)>o.threshold)){if(C(R,{x:Io(L.x+A.x),y:Io(L.y+A.y),dx:0,dy:0},{originalEvent:x}),s("start")===!1)return v();o.active=!0,o.keepSelection||(R.previousSelection=n.get(),n.select(null)),o.cursor&&Di(o.cursor),t.addMarker(t.getRootElement(),ng)}Wc(x),o.active&&(C(R,{x:Io(W.x+A.x),y:Io(W.y+A.y),dx:Io(z.x),dy:Io(z.y)},{originalEvent:x}),s("move"))}function p(x){var b,R=!0;o.active&&(x&&(o.payload.originalEvent=x,Wc(x)),R=s("end")),R===!1&&s("rejected"),b=w(R!==!0),s("ended",b)}function l(x){Ke("Escape",x)&&(Ii(x),v())}function f(x){var b;o.active&&(b=nu(e),setTimeout(b,400),Ii(x)),p(x)}function d(x){u(x)}function m(x){var b=o.payload;b.hoverGfx=x.gfx,b.hover=x.element,s("hover")}function g(x){s("out");var b=o.payload;b.hoverGfx=null,b.hover=null}function v(x){var b;if(o){var R=o.active;R&&s("cancel"),b=w(x),R&&s("canceled",b)}}function w(x){var b,R;s("cleanup"),tu(),o.trapClick?R=f:R=p,se.unbind(document,"mousemove",u),se.unbind(document,"dragstart",Ii),se.unbind(document,"selectstart",Ii),se.unbind(document,"mousedown",R,!0),se.unbind(document,"mouseup",R,!0),se.unbind(document,"keyup",l),se.unbind(document,"touchstart",d,!0),se.unbind(document,"touchcancel",v,!0),se.unbind(document,"touchmove",u,!0),se.unbind(document,"touchend",p,!0),e.off("element.hover",m),e.off("element.out",g),t.removeMarker(t.getRootElement(),ng);var A=o.payload.previousSelection;return x!==!1&&A&&!n.get().length&&c(A),b=o,o=null,b}function S(x,b,R,A){o&&v(!1),typeof b=="string"&&(A=R,R=b,b=null),A=C({},i,A||{});var O=A.data||{},T,I,L,W,z;if(A.trapClick?W=f:W=p,x?(T=Ar(x)||x,I=An(x),Wc(x),T.type==="dragstart"&&Ii(T)):(T=null,I={x:0,y:0}),L=a(I),b||(b=L),z=iR(T),o=C({prefix:R,data:O,payload:{},globalStart:I,displacement:Dt(b,L),localStart:L,isTouch:z},A),A.manual||(z?(se.bind(document,"touchstart",d,!0),se.bind(document,"touchcancel",v,!0),se.bind(document,"touchmove",u,!0),se.bind(document,"touchend",p,!0)):(se.bind(document,"mousemove",u),se.bind(document,"dragstart",Ii),se.bind(document,"selectstart",Ii),se.bind(document,"mousedown",W,!0),se.bind(document,"mouseup",W,!0)),se.bind(document,"keyup",l),e.on("element.hover",m),e.on("element.out",g)),s("init")===!1)return v(),!1;A.autoActivate&&u(x,!0)}e.on("diagram.destroy",v),this.init=S,this.move=u,this.hover=m,this.out=g,this.end=p,this.cancel=v,this.context=function(){return o},this.setOptions=function(x){C(i,x)}}Du.$inject=["eventBus","canvas","selection","elementRegistry"];var kt={__depends__:[tg,rt],dragging:["type",Du]};N();function ai(e,t,n){this._canvas=n,this._opts=C({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var r=this;t.on("drag.move",function(i){var o=r._toBorderPoint(i);r.startScroll(o)}),t.on(["drag.cleanup"],function(){r.stopScroll()})}ai.$inject=["config.autoScroll","eventBus","canvas"];ai.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,r=this,i=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,i.width-e.x,i.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)aR(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(){r.startScroll(e)},n.scrollRepeatTimeout))};function aR(e,t,n){return t<e&&e<n}ai.prototype.stopScroll=function(){clearTimeout(this._scrolling)};ai.prototype.setOptions=function(e){this._opts=C({},this._opts,e)};ai.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=An(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var rg={__depends__:[kt],__init__:["autoScroll"],autoScroll:["type",ai]};function Wa(e){this._commandStack=e.get("commandStack",!1)}Wa.$inject=["injector"];Wa.prototype.allowed=function(e,t){var n=!0,r=this._commandStack;return r&&(n=r.canExecute(e,t)),n===void 0?!0:n};var Et={__init__:["rules"],rules:["type",Wa]};N();var ku=Math.round,sR=Math.max;function cR(e,t){var n=e.x,r=e.y;return[["M",n,r],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function uR(e){var t=[];return e.forEach(function(n,r){t.push([r===0?"M":"L",n.x,n.y])}),t}var ig=10;function pR(e,t){var n,r;for(n=0;r=e[n];n++)if(Gr(r,t)<=ig)return{point:e[n],bendpoint:!0,index:n};return null}function lR(e,t){var n=Da(cR(t,ig),uR(e)),r=n[0],i=n[n.length-1],o;return r?r!==i?r.segment2!==i.segment2?(o=sR(r.segment2,i.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:ku(r.x+i.x)/2,y:ku(r.y+i.y)/2},index:r.segment2}:{point:{x:ku(r.x),y:ku(r.y)},index:r.segment2}:null}function Ua(e,t){return pR(e,t)||lR(e,t)}function og(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Af(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function ag(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 fR(e,t,n){var r=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],i=r[0].n*t[0]+r[1].n*t[1],o=r[0].lambda*t[0]+r[1].lambda*t[1];return-i/o}function qa(e,t){var n=t[0],r=t[1],i={x:r.x-n.x,y:r.y-n.y},o=fR([n.x,n.y],[i.x,i.y],[e.x,e.y]);return{x:n.x+o*i.x,y:n.y+o*i.y}}function Nu(e,t){var n=qa(e,t),r={x:n.x-e.x,y:n.y-e.y};return og(r)}function Li(e,t){return og({x:e.x-t.x,y:e.y-t.y})}var Tf="djs-bendpoint",Mf="djs-segment-dragger";function dR(e,t){var n=An(t),r=e._container.getBoundingClientRect(),i;i={x:r.left,y:r.top};var o=e.viewbox();return{x:o.x+(n.x-i.x)/o.scale,y:o.y+(n.y-i.y)/o.scale}}function Ka(e,t,n){var r=dR(e,n),i=Ua(t,r);return i}function Ya(e,t){var n=U("g");pe(n).add(Tf),J(e,n);var r=U("circle");$(r,{cx:0,cy:0,r:4}),pe(r).add("djs-visual"),J(n,r);var i=U("circle");return $(i,{cx:0,cy:0,r:10}),pe(i).add("djs-hit"),J(n,i),t&&pe(n).add(t),n}function mR(e,t,n,r){var i=U("g");J(e,i);var o=18,a=6,s=11,c=hR(t,n,r),u=a+s,p=U("rect");$(p,{x:-o/2,y:-a/2,width:o,height:a}),pe(p).add("djs-visual"),J(i,p);var l=U("rect");return $(l,{x:-c/2,y:-u/2,width:c,height:u}),pe(l).add("djs-hit"),J(i,l),Rc(i,r==="v"?90:0,0,0),i}function Bu(e,t,n){var r=U("g"),i=Ma(t,n),o=en(t,n);return J(e,r),mR(r,t,n,o),pe(r).add(Mf),pe(r).add(o==="h"?"horizontal":"vertical"),Fe(r,i.x,i.y),r}function Ou(e){return Math.abs(Math.round(e*2/3))}function sg(e,t){var n=vR(e,t);return qa(e,n)}function hR(e,t,n){var r=t.x-e.x,i=t.y-e.y;return Ou(n==="h"?r:i)}function vR(e,t){for(var n=t.waypoints,r=1/0,i,o=0;o<n.length-1;o++){var a=n[o],s=n[o+1],c=Nu(e,[a,s]);c<r&&(r=c,i=o)}return[n[i],n[i+1]]}function Iu(e,t,n,r,i){function o(x,b,R){var A=x.index,O=x.point,T,I,L,W,z,K;return A<=0||x.bendpoint?!1:(T=b[A-1],I=b[A],L=Ma(T,I),W=en(T,I),z=Math.abs(O.x-L.x),K=Math.abs(O.y-L.y),W&&z<=R&&K<=R)}function a(x,b){var R=x.waypoints,A,O,T,I;return b.index<=0||b.bendpoint||(A={start:R[b.index-1],end:R[b.index]},O=en(A.start,A.end),!O)?null:(O==="h"?T=A.end.x-A.start.x:T=A.end.y-A.start.y,I=Ou(T)/2,I)}function s(x,b){var R=b.waypoints,A=Ka(t,R,x),O;if(A){O=a(b,A);var T;if(o(A,R,O)?T=i.start(x,b,A.index):T=r.start(x,b,A.index,!A.bendpoint),T!==!1)return!0}}function c(x,b,R){se.bind(x,b,function(A){n.triggerMouseEvent(b,A,R),A.stopPropagation()})}function u(x,b){var R=t.getLayer("overlays"),A=_e('.djs-bendpoints[data-element-id="'+Rr(x.id)+'"]',R);return!A&&b&&(A=U("g"),$(A,{"data-element-id":x.id}),pe(A).add("djs-bendpoints"),J(R,A),c(A,"mousedown",x),c(A,"click",x),c(A,"dblclick",x)),A}function p(x,b){return _e('.djs-segment-dragger[data-segment-idx="'+x+'"]',b)}function l(x,b){b.waypoints.forEach(function(R,A){var O=Ya(x);J(x,O),Fe(O,R.x,R.y)}),Ya(x,"floating")}function f(x,b){for(var R=b.waypoints,A,O,T,I=1;I<R.length;I++)A=R[I-1],O=R[I],en(A,O)&&(T=Bu(x,A,O),$(T,{"data-segment-idx":I}),c(T,"mousemove",b))}function d(x){E(xi("."+Tf,x),function(b){Pe(b)})}function m(x){E(xi("."+Mf,x),function(b){Pe(b)})}function g(x){var b=u(x);return b||(b=u(x,!0),l(b,x),f(b,x)),b}function v(x){var b=u(x);b&&(m(b),d(b),f(b,x),l(b,x))}function w(x,b){var R=_e(".floating",x),A=b.point;R&&Fe(R,A.x,A.y)}function S(x,b,R){var A=p(b.index,x),O=R[b.index-1],T=R[b.index],I=b.point,L=Ma(O,T),W=en(O,T),z,K;A&&(z=gR(A),K={x:I.x-L.x,y:I.y-L.y},W==="v"&&(K={x:K.y,y:K.x}),Fe(z,K.x,K.y))}e.on("connection.changed",function(x){v(x.element)}),e.on("connection.remove",function(x){var b=u(x.element);b&&Pe(b)}),e.on("element.marker.update",function(x){var b=x.element,R;b.waypoints&&(R=g(b),x.add?pe(R).add(x.marker):pe(R).remove(x.marker))}),e.on("element.mousemove",function(x){var b=x.element,R=b.waypoints,A,O;if(R){if(A=u(b,!0),O=Ka(t,R,x.originalEvent),!O)return;w(A,O),O.bendpoint||S(A,O,R)}}),e.on("element.mousedown",function(x){if(gn(x)){var b=x.originalEvent,R=x.element;if(R.waypoints)return s(b,R)}}),e.on("selection.changed",function(x){var b=x.newSelection,R=b[0];R&&R.waypoints&&g(R)}),e.on("element.hover",function(x){var b=x.element;b.waypoints&&g(b)}),e.on("element.updateId",function(x){var b=x.element,R=x.newId;if(b.waypoints){var A=u(b);A&&$(A,{"data-element-id":R})}}),this.addHandles=g,this.updateHandles=v,this.getBendpointsContainer=u,this.getSegmentDragger=p}Iu.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function gR(e){return _e(".djs-visual",e)}var cg=Math.round,ji="reconnectStart",Fi="reconnectEnd",Xa="updateWaypoints";function Qa(e,t,n,r,i,o){this._injector=e,this.start=function(a,s,c,u){var p=n.getGraphics(s),l=s.source,f=s.target,d=s.waypoints,m;!u&&c===0?m=ji:!u&&c===d.length-1?m=Fi:m=Xa;var g=m===Xa?"connection.updateWaypoints":"connection.reconnect",v=i.allowed(g,{connection:s,source:l,target:f});if(v===!1&&(v=i.allowed(g,{connection:s,source:f,target:l})),v!==!1)return r.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:p,context:{allowed:v,bendpointIndex:c,connection:s,source:l,target:f,insert:u,type:m}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,p=c.target,l=a.hover,f=s.type;s.hover=l;var d;if(l){var m=f===Xa?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=i.allowed(m,{connection:c,source:f===ji?l:u,target:f===Fi?l:p}),d){s.source=f===ji?l:u,s.target=f===Fi?l:p;return}d===!1&&(d=s.allowed=i.allowed(m,{connection:c,source:f===Fi?l:p,target:f===ji?l:u})),d&&(s.source=f===Fi?l:p,s.target=f===ji?l:u)}}),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!==Xa&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,p=s.connection,l=s.insert,f=p.waypoints.slice(),d=s.source,m=s.target,g=s.type,v=s.hints||{},w={x:cg(a.x),y:cg(a.y)};if(!c)return!1;g===Xa?(l?f.splice(u,0,w):f[u]=w,v.bendpointMove={insert:l,bendpointIndex:u},f=this.cropWaypoints(p,f),o.updateWaypoints(p,Am(f),v)):(g===ji?(v.docking="source",Za(s)&&(v.docking="target",v.newWaypoints=f.reverse())):g===Fi&&(v.docking="target",Za(s)&&(v.docking="source",v.newWaypoints=f.reverse())),o.reconnect(p,d,m,w,v))},this)}Qa.$inject=["injector","eventBus","canvas","dragging","rules","modeling"];Qa.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var r=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=r,t};function Za(e){var t=e.hover,n=e.source,r=e.target,i=e.type;if(i===ji)return t&&r&&t===r&&n!==r;if(i===Fi)return t&&n&&t===n&&n!==r}var yR="reconnectStart",_R="reconnectEnd",ug="updateWaypoints",Ja="connect-ok",Lu="connect-not-ok",pg="connect-hover",lg="djs-updating",fg="djs-dragging",dg=1100;function ju(e,t,n,r){this._injector=t;var i=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,p=c.waypoints,l=p.slice();a.waypoints=p,u&&l.splice(s,0,{x:o.x,y:o.y}),c.waypoints=l;var f=a.draggerGfx=Ya(r.getLayer("overlays"));pe(f).add("djs-dragging"),r.addMarker(c,fg),r.addMarker(c,lg)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,u=a.type;if(c){if(r.addMarker(c,pg),u===ug)return;s?(r.removeMarker(c,Lu),r.addMarker(c,Ja)):s===!1&&(r.removeMarker(c,Ja),r.addMarker(c,Lu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],dg,function(o){var a=o.context,s=a.hover,c=a.target;s&&(r.removeMarker(s,pg),r.removeMarker(s,c?Ja:Lu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,p=a.hover,l=a.type,f=a.connection,d=f.source,m=f.target,g=f.waypoints.slice(),v={x:o.x,y:o.y},w=a.hints||{},S={};i&&(w.connectionStart&&(S.connectionStart=w.connectionStart),w.connectionEnd&&(S.connectionEnd=w.connectionEnd),l===yR?Za(a)?(S.connectionEnd=S.connectionEnd||v,S.source=m,S.target=p||d,g=g.reverse()):(S.connectionStart=S.connectionStart||v,S.source=p||d,S.target=m):l===_R?Za(a)?(S.connectionStart=S.connectionStart||v,S.source=p||m,S.target=d,g=g.reverse()):(S.connectionEnd=S.connectionEnd||v,S.source=d,S.target=p||m):(S.noCropping=!0,S.noLayout=!0,g[c]=v),l===ug&&(g=e.cropWaypoints(f,g)),S.waypoints=g,i.drawPreview(a,s,S)),Fe(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],dg,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,p=a.target,l=a.waypoints;s.waypoints=l,Pe(c),r.removeMarker(s,lg),r.removeMarker(s,fg),u&&(r.removeMarker(u,Ja),r.removeMarker(u,p?Ja:Lu)),i&&i.cleanUp(a)})}ju.$inject=["bendpointMove","injector","eventBus","canvas"];var mg="connect-hover",hg="djs-updating";function vg(e,t,n){return Df(e,t,e[t]+n)}function Df(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function bR(e,t,n,r){var i=Math.max(t[r],n[r]),o=Math.min(t[r],n[r]),a=20,s=Math.min(Math.max(o+a,e[r]),i-a);return Df(t,r,s)}function yg(e){return e==="x"?"y":"x"}function gg(e,t,n){var r,i;return e.original?e.original:(r=X(t),i=yg(n),Df(e,i,r[i]))}function Fu(e,t,n,r,i,o){var a=e.get("connectionDocking",!1);this.start=function(l,f,d){var m,g=n.getGraphics(f),v=d-1,w=d,S=f.waypoints,x=S[v],b=S[w],R=Ka(n,S,l),A,O,T;if(A=en(x,b),!!A)return O=A==="v"?"x":"y",v===0&&(x=gg(x,f.source,O)),w===S.length-1&&(b=gg(b,f.target,O)),R?T=R.point:T={x:(x.x+b.x)/2,y:(x.y+b.y)/2},m={connection:f,segmentStartIndex:v,segmentEndIndex:w,segmentStart:x,segmentEnd:b,axis:O,dragPosition:T},r.init(l,T,"connectionSegment.move",{cursor:O==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:g,context:m}})};function s(l,f){if(!a)return f;var d=l.waypoints,m;return l.waypoints=f,m=a.getCroppedWaypoints(l),l.waypoints=d,m}function c(l){i.update("connection",l.connection,l.connectionGfx)}function u(l,f,d){var m=l.newWaypoints,g=l.segmentStartIndex+f,v=m[g],w=l.segmentEndIndex+f,S=m[w],x=yg(l.axis),b=bR(d,v,S,x);Fe(l.draggerGfx,b.x,b.y)}function p(l,f){var d=0,m=l.filter(function(g,v){return uo(l[v-1],l[v+1],g)?(d=v<=f?d-1:d,!1):!0});return{waypoints:m,segmentOffset:d}}t.on("connectionSegment.move.start",function(l){var f=l.context,d=l.connection,m=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=Bu(m,f.segmentStart,f.segmentEnd),pe(f.draggerGfx).add("djs-dragging"),n.addMarker(d,hg)}),t.on("connectionSegment.move.move",function(l){var f=l.context,d=f.connection,m=f.segmentStartIndex,g=f.segmentEndIndex,v=f.segmentStart,w=f.segmentEnd,S=f.axis,x=f.originalWaypoints.slice(),b=vg(v,S,l["d"+S]),R=vg(w,S,l["d"+S]),A=x.length,O=0;x[m]=b,x[g]=R;var T,I;m<2&&(T=He(d.source,b),m===1?T==="intersect"&&(x.shift(),x[0]=b,O--):T!=="intersect"&&(x.unshift(v),O++)),g>A-3&&(I=He(d.target,R),g===A-2?I==="intersect"&&(x.pop(),x[x.length-1]=R):I!=="intersect"&&x.push(w)),f.newWaypoints=d.waypoints=s(d,x),u(f,O,l),f.newSegmentStartIndex=m+O,c(l)}),t.on("connectionSegment.move.hover",function(l){l.context.hover=l.hover,n.addMarker(l.hover,mg)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(l){var f=l.context.hover;f&&n.removeMarker(f,mg)}),t.on("connectionSegment.move.cleanup",function(l){var f=l.context,d=f.connection;f.draggerGfx&&Pe(f.draggerGfx),n.removeMarker(d,hg)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(l){var f=l.context,d=f.connection;d.waypoints=f.originalWaypoints,c(l)}),t.on("connectionSegment.move.end",function(l){var f=l.context,d=f.connection,m=f.newWaypoints,g=f.newSegmentStartIndex;m=m.map(function(R){return{original:R.original,x:Math.round(R.x),y:Math.round(R.y)}});var v=p(m,g),w=v.waypoints,S=s(d,w),x=v.segmentOffset,b={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:g+x}};o.updateWaypoints(d,S,b)})}Fu.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];N();var xR=Math.abs,_g=Math.round;function bg(e,t,n){n=n===void 0?10:n;var r,i;for(r=0;r<t.length;r++)if(i=t[r],xR(i-e)<=n)return i}function Hu(e){return{x:e.x,y:e.y}}function $u(e){return{x:e.x+e.width,y:e.y+e.height}}function rn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:_g(e.x+e.width/2),y:_g(e.y+e.height/2)}}function zn(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function ze(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 r,i=e[t],o=e.snapped=e.snapped||{};return n===!1?o[t]=!1:(o[t]=!0,r=n-i,e[t]+=r,e["d"+t]+=r),i}function zu(e){return e.children||[]}var ER=Math.abs,xg=Math.round,kf=10;function Gu(e){function t(o,a){if(q(o)){for(var s=o.length;s--;)if(ER(o[s]-a)<=kf)return o[s]}else{o=+o;var c=a%o;if(c<kf)return a-c;if(c>o-kf)return a-c+o}return a}function n(o,a){if(o.waypoints)return sg(a,o);if(o.width)return{x:xg(o.width/2+o.x),y:xg(o.height/2+o.y)}}function r(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,p=a.segmentStart,l=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,m=a.axis;if(s)return s;var g=[u[l-1],p,f,u[d+1]];return l<2&&g.unshift(n(c.source,o)),d>u.length-3&&g.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},E(g,function(v){v&&(v=v.original||v,m==="y"&&s.horizontal.push(v.y),m==="x"&&s.vertical.push(v.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=r(o),s=o.x,c=o.y,u,p;if(a){u=t(a.vertical,s),p=t(a.horizontal,c);var l=s-u,f=c-p;C(o,{dx:o.dx-l,dy:o.dy-f,x:u,y:p}),(l||a.vertical.indexOf(s)!==-1)&&ze(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&ze(o,"y",p)}});function i(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},E(u,function(p){p&&(p=p.original||p,a.horizontal.push(p.y),a.vertical.push(p.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||(ze(o,"x",c.x),ze(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=i(a),c=a.hover,u=c&&n(c,o),p=o.x,l=o.y,f,d;if(s){f=t(u?s.vertical.concat([u.x]):s.vertical,p),d=t(u?s.horizontal.concat([u.y]):s.horizontal,l);var m=p-f,g=l-d;C(o,{dx:o.dx-m,dy:o.dy-g,x:o.x-m,y:o.y-g}),(m||s.vertical.indexOf(p)!==-1)&&ze(o,"x",f),(g||s.horizontal.indexOf(l)!==-1)&&ze(o,"y",d)}})}Gu.$inject=["eventBus"];var Eg={__depends__:[kt,Et],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Iu],bendpointMove:["type",Qa],bendpointMovePreview:["type",ju],connectionSegmentMove:["type",Fu],bendpointSnapping:["type",Gu]};N();function Wu(e,t,n,r){function i(a,s){return r.allowed("connection.create",{source:a,target:s})}function o(a,s){return i(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,p;if(s.hover=u,p=s.canExecute=i(c,u),!Yn(p)){if(p!==!1){s.source=c,s.target=u;return}p=s.canExecute=o(c,u),!Yn(p)&&p!==!1&&(s.source=u,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,u=s.connectionStart,p={x:a.x,y:a.y},l=s.source,f=s.target;if(!c)return!1;var d=null,m={connectionStart:Vu(s)?p:u,connectionEnd:Vu(s)?u:p};Se(c)&&(d=c),s.connection=n.connect(l,f,d,m)}),this.start=function(a,s,c,u){Se(c)||(u=c,c=X(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}Wu.$inject=["eventBus","dragging","modeling","rules"];function Vu(e){var t=e.hover,n=e.source,r=e.target;return t&&n&&t===n&&n!==r}var wR=1100,SR=900,wg="connect-ok",Sg="connect-not-ok";function Uu(e,t,n){var r=e.get("connectionPreview",!1);r&&t.on("connect.move",function(i){var o=i.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,p=o.startPosition,l=o.target,f=o.connectionStart||p,d=o.connectionEnd||{x:i.x,y:i.y},m=f,g=d;Vu(o)&&(m=d,g=f),r.drawPreview(o,a,{source:c||u,target:l||s,connectionStart:m,connectionEnd:g})}),t.on("connect.hover",SR,function(i){var o=i.context,a=i.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?wg:Sg)}),t.on(["connect.out","connect.cleanup"],wR,function(i){var o=i.hover;o&&(n.removeMarker(o,wg),n.removeMarker(o,Sg))}),r&&t.on("connect.cleanup",function(i){r.cleanUp(i.context)})}Uu.$inject=["injector","eventBus","canvas"];var Lo={__depends__:[rt,Et,kt],__init__:["connectPreview"],connect:["type",Wu],connectPreview:["type",Uu]};N();var CR="djs-dragger";function Gn(e,t,n,r){this._canvas=t,this._graphicsFactory=n,this._elementFactory=r,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Gn.$inject=["injector","canvas","graphicsFactory","elementFactory"];Gn.prototype.drawPreview=function(e,t,n){n=n||{};var r=e.connectionPreviewGfx,i=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,p=n.noLayout,l=n.noCropping,f=n.noNoop,d,m=this;if(r||(r=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),_r(r),i||(i=e.getConnection=RR(function(g,v,w){return m.getConnection(g,v,w)})),t&&(d=i(t,o,a)),!d){!f&&this.drawNoopPreview(r,n);return}d.waypoints=s||[],this._layouter&&!p&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?X(o):c,a?X(a):u]),this._connectionDocking&&(o||a)&&!l&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(r,d,{stroke:"var(--element-dragger-color)"})};Gn.prototype.drawNoopPreview=function(e,t){var n=t.source,r=t.target,i=t.connectionStart||X(n),o=t.connectionEnd||X(r),a=this.cropWaypoints(i,o,n,r),s=this.createNoopConnection(a[0],a[1]);J(e,s)};Gn.prototype.cropWaypoints=function(e,t,n,r){var i=this._graphicsFactory,o=n&&i.getShapePath(n),a=r&&i.getShapePath(r),s=i.getConnectionPath({waypoints:[e,t]});return e=n&&qr(o,s,!0)||e,t=r&&qr(a,s,!1)||t,[e,t]};Gn.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Pe(e.connectionPreviewGfx)};Gn.prototype.getConnection=function(e){var t=PR(e);return this._elementFactory.createConnection(t)};Gn.prototype.createConnectionPreviewGfx=function(){var e=U("g");return $(e,{pointerEvents:"none"}),pe(e).add(CR),J(this._canvas.getActiveLayer(),e),e};Gn.prototype.createNoopConnection=function(e,t){return Xn([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function RR(e){var t={};return function(n){var r=JSON.stringify(n),i=t[r];return i||(i=t[r]=e.apply(null,arguments)),i}}function PR(e){return Se(e)?e:{}}var Cg={__init__:["connectionPreview"],connectionPreview:["type",Gn]};var AR=new or("ps"),TR=["marker-start","marker-mid","marker-end"],MR=["circle","ellipse","line","path","polygon","polyline","path","rect"];function cr(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._styles=r}cr.$inject=["elementRegistry","eventBus","canvas","styles"];cr.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")};cr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)};cr.prototype.addDragger=function(e,t,n,r="djs-dragger"){n=n||this.getGfx(e);var i=Sl(n),o=n.getBoundingClientRect();return this._cloneMarkers(Ln(i),r),$(i,this._styles.cls(r,[],{x:o.top,y:o.left})),J(t,i),$(i,"data-preview-support-element-id",e.id),i};cr.prototype.addFrame=function(e,t){var n=U("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return J(t,n),$(n,"data-preview-support-element-id",e.id),n};cr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var r=this;e.childNodes&&e.childNodes.forEach(i=>{r._cloneMarkers(i,t,n)}),OR(e)&&TR.forEach(function(i){if($(e,i)){var o=DR(e,i,r._canvas.getContainer());o&&r._cloneMarker(n,e,o,i,t)}})};cr.prototype._cloneMarker=function(e,t,n,r,i="djs-dragger"){var o=[n.id,i,AR.next()].join("-"),a=_e("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Sl(n);s.id=o,pe(s).add(i);var c=_e(":scope > defs",e);c||(c=U("defs"),J(e,c)),J(c,s);var u=NR(s.id);$(t,r,u)};function DR(e,t,n){var r=kR($(e,t));return _e("marker#"+r,n||document)}function kR(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function NR(e){return"url(#"+e+")"}function OR(e){return MR.indexOf(e.nodeName)!==-1}var Dn={__init__:["previewSupport"],previewSupport:["type",cr]};var qu="complex-preview",jo=class{constructor(t,n,r){this._canvas=t,this._graphicsFactory=n,this._previewSupport=r,this._markers=[]}create(t){this.cleanUp();let{created:n=[],moved:r=[],removed:i=[],resized:o=[]}=t,a=this._canvas.getLayer(qu);n.filter(s=>!BR(s)).forEach(s=>{let c;de(s)?(c=this._graphicsFactory._createContainer("connection",U("g")),this._graphicsFactory.drawConnection(Ln(c),s)):(c=this._graphicsFactory._createContainer("shape",U("g")),this._graphicsFactory.drawShape(Ln(c),s),Fe(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),r.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);let u=this._previewSupport.addDragger(s,a);de(s)?Fe(u,c.x,c.y):Fe(u,s.x+c.x,s.y+c.y)}),i.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");let u=this._graphicsFactory._createContainer("shape",U("g"));this._graphicsFactory.drawShape(Ln(u),s,{width:c.width,height:c.height}),Fe(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){_r(this._canvas.getLayer(qu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(qu)}hide(){this._canvas.hideLayer(qu)}};jo.$inject=["canvas","graphicsFactory","previewSupport"];function BR(e){return e.hidden}var Rg={__depends__:[Dn],__init__:["complexPreview"],complexPreview:["type",jo]};var Nf=["top","bottom","left","right"],Ku=10;function es(e,t){k.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(i){var o=i.context,a=o.connection,s=a.source,c=a.target,u=o.hints||{};u.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(i){var o=i.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(i){var o=i.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(i){if(Xr(i)&&!de(i)){var o=jR(i);o&&r(i,o)}}function r(i,o){var a=X(i),s=i.label,c=X(s);if(s.parent){var u=Z(i),p;switch(o){case"top":p={x:a.x,y:u.top-Ku-s.height/2};break;case"left":p={x:u.left-Ku-s.width/2,y:a.y};break;case"bottom":p={x:a.x,y:u.bottom+Ku+s.height/2};break;case"right":p={x:u.right+Ku+s.width/2,y:a.y};break}var l=Dt(p,c);t.moveShape(s,l)}}}B(es,k);es.$inject=["eventBus","modeling"];function IR(e){var t=e.host,n=X(e),r=He(n,t),i;r.indexOf("-")>=0?i=r.split("-"):i=[r];var o=Nf.filter(function(a){return i.indexOf(a)===-1});return o}function LR(e){var t=X(e),n=[].concat(e.incoming.map(function(r){return r.waypoints[r.waypoints.length-2]}),e.outgoing.map(function(r){return r.waypoints[1]})).map(function(r){return Pg(t,r)});return n}function jR(e){var t=X(e.label),n=X(e),r=Pg(n,t);if(FR(r)){var i=LR(e);if(e.host){var o=IR(e);i=i.concat(o)}var a=Nf.filter(function(s){return i.indexOf(s)===-1});return a.indexOf(r)!==-1?He(e.label,e)!=="intersect"?void 0:r:a[0]}}function Pg(e,t){return He(t,e,5)}function FR(e){return Nf.indexOf(e)!==-1}function ts(e){k.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,r=t.shape;t.position||(h(r,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-r.height/2}:t.position={x:n.x+n.width+80+r.width/2,y:n.y+n.height/2})},!0)}B(ts,k);ts.$inject=["eventBus"];N();var HR=1500;function ns(e,t,n){e.invoke(k,this),this.preExecute("elements.delete",HR,function(i){var o=i.context,a=o.elements,s=r(a);s.length&&(o.elements=a.concat(s))}),t.on("shape.move.start",function(i){var o=i.context.shapes,a=r(o);a.length&&(i.context.shapes=o.concat(a))});function r(i){var o=Q(i,u=>h(u,"bpmn:Participant")||h(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>h(u,"bpmn:Artifact"))),c=new Set;return E(o,u=>{let p=new Set(Sn(wi(Array.from(s),Ce(u))));c=c.union(p),s=s.difference(p)}),Array.from(c)}}B(ns,k);ns.$inject=["injector","eventBus","canvas"];N();function rs(e,t){e.invoke(k,this),this.postExecute("shape.move",function(n){var r=n.newParent,i=n.shape,o=Q(i.incoming.concat(i.outgoing),function(a){return h(a,"bpmn:Association")});E(o,function(a){t.moveConnection(a,{x:0,y:0},r)})},!0)}B(rs,k);rs.$inject=["injector","modeling"];var Ag=500;function Fo(e,t){t.invoke(k,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Ag,function(r){var i=r.elements;i=i.filter(function(o){var a=o.host;return Tg(o,a)}),i.length===1&&i.map(function(o){return i.indexOf(o)}).forEach(function(o){var a=i[o];r.elements[o]=n._replaceShape(i[o],a)})},!0),this.preExecute("elements.move",Ag,function(r){var i=r.shapes,o=r.newHost;if(i.length===1){var a=i[0];Tg(a,o)&&(r.shapes=[n._replaceShape(a,o)])}},!0)}Fo.$inject=["bpmnReplace","injector"];B(Fo,k);Fo.prototype._replaceShape=function(e,t){var n=$R(e),r={type:"bpmn:BoundaryEvent",host:t};return n&&(r.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,r,{layoutConnection:!1})};function $R(e){var t=j(e),n=t.eventDefinitions;return n&&n[0]}function Tg(e,t){return!ee(e)&&te(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}N();function is(e,t){k.call(this,e);function n(r){return Q(r.attachers,function(i){return h(i,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(r){var i=r.context.source,o=r.context.target,a=n(o);h(i,"bpmn:EventBasedGateway")&&h(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(r){var i=r.context.oldSource,o=r.context.newSource;h(i,"bpmn:Gateway")&&h(o,"bpmn:EventBasedGateway")&&E(o.outgoing,function(a){var s=a.target,c=n(s);h(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}is.$inject=["eventBus","modeling"];B(is,k);function as(e,t,n){k.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",i,!0),this.postExecuted("connection.delete",r,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function r(v){let w=v.source,S=v.target;Ho(w)&&os(S)&&p(S)}function i(v){let w=v.connection,S=v.source,x=v.target;Ho(S)&&Yu(x)&&(u(x),f(S,[w]))}function o(v){let w=v.newTarget,S=v.oldSource,x=v.oldTarget;if(x!==w){let b=S;os(x)&&p(x),Ho(b)&&Yu(w)&&u(w)}}function a(v){let{element:w}=v;os(w)?(l(w),d(w)):Yu(w)&&m(w)}function s(v){let{newData:w,oldShape:S}=v;if(Ho(v.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){let x=S.outgoing.find(({target:b})=>os(b));x&&x.target&&(v._connectionTarget=x.target)}else if(!Ho(v.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){let x=S.outgoing.find(({target:b})=>Yu(b));x&&x.target&&(v._connectionTarget=x.target),g(S)}}function c(v){let{_connectionTarget:w,newShape:S}=v;w&&t.connect(S,w)}function u(v){t.updateProperties(v,{isForCompensation:!0})}function p(v){t.updateProperties(v,{isForCompensation:void 0})}function l(v){for(let w of v.incoming)n.canConnect(w.source,v)||t.removeConnection(w);for(let w of v.outgoing)n.canConnect(v,w.target)||t.removeConnection(w)}function f(v,w){v.outgoing.filter(b=>h(b,"bpmn:Association")).filter(b=>os(b.target)&&!w.includes(b)).forEach(b=>t.removeConnection(b))}function d(v){let w=v.attachers.slice();w.length&&t.removeElements(w)}function m(v){let w=v.incoming.filter(S=>Ho(S.source));t.removeElements(w)}function g(v){let w=v.outgoing.filter(S=>h(S,"bpmn:SequenceFlow"));t.removeElements(w)}}B(as,k);as.$inject=["eventBus","modeling","bpmnRules"];function os(e){let t=j(e);return t&&t.get("isForCompensation")}function Ho(e){return e&&h(e,"bpmn:BoundaryEvent")&&Er(e,"bpmn:CompensateEventDefinition")}function Yu(e){return e&&h(e,"bpmn:Activity")&&!Qe(e)}function ss(e){e.invoke(k,this),this.preExecute("shape.create",1500,function(t){var n=t.context,r=n.parent,i=n.shape;h(r,"bpmn:Lane")&&!h(i,"bpmn:Lane")&&(n.parent=kr(r,"bpmn:Participant"))})}ss.$inject=["injector"];B(ss,k);function cs(e,t){k.call(this,e),this.preExecute("shape.create",function(n){var a;var r=n.context,i=r.shape;if(h(i,"bpmn:DataObjectReference")&&i.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=i.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,i.businessObject.dataObjectRef=o}})}cs.$inject=["eventBus","bpmnFactory"];B(cs,k);N();var Of=20,Bf=20,Mg=30,Xu=2e3;function us(e,t,n){k.call(this,t),t.on(["create.start","shape.move.start"],Xu,function(i){var o=i.context,a=o.shape,s=e.getRootElement();if(!(!h(a,"bpmn:Participant")||!h(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(l){return!h(l,"bpmn:Group")&&!ee(l)&&!de(l)});if(c.length){var u=Ce(c),p=zR(a,u);C(a,p),o.createConstraints=GR(a,u)}}}),t.on("create.start",Xu,function(i){var o=i.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(p){p.element=s,p.gfx=c}h(a,"bpmn:Participant")&&h(s,"bpmn:Process")&&(t.on("element.hover",Xu,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function r(){var i=e.getRootElement();return h(i,"bpmn:Collaboration")?i:n.makeCollaboration()}this.preExecute("elements.create",Xu,function(i){var o=i.elements,a=i.parent,s=VR(o),c;s&&h(a,"bpmn:Process")&&(i.parent=r(),c=i.hints=i.hints||{},c.participant=s,c.process=a,c.processRef=j(s).get("processRef"))},!0),this.preExecute("shape.create",function(i){var o=i.parent,a=i.shape;h(a,"bpmn:Participant")&&h(o,"bpmn:Process")&&(i.parent=r(),i.process=o,i.processRef=j(a).get("processRef"))},!0),this.execute("shape.create",function(i){var o=i.hints||{},a=i.process||o.process,s=i.shape,c=o.participant;a&&(!c||s===c)&&j(s).set("processRef",j(a))},!0),this.revert("shape.create",function(i){var o=i.hints||{},a=i.process||o.process,s=i.processRef||o.processRef,c=i.shape,u=o.participant;a&&(!u||c===u)&&j(c).set("processRef",s)},!0),this.postExecute("shape.create",function(i){var o=i.hints||{},a=i.process||i.hints.process,s=i.shape,c=o.participant;if(a){var u=a.children.slice();c?s===c&&n.moveElements(u,{x:0,y:0},c):n.moveElements(u,{x:0,y:0},s)}},!0)}us.$inject=["canvas","eventBus","modeling"];B(us,k);function zR(e,t){t={width:t.width+Of*2+Mg,height:t.height+Bf*2};var n=Math.max(e.width,t.width),r=Math.max(e.height,t.height);return{x:-n/2,y:-r/2,width:n,height:r}}function GR(e,t){return t=Z(t),{bottom:t.top+e.height/2-Bf,left:t.right-e.width/2+Of,top:t.bottom-e.height/2+Bf,right:t.left+e.width/2-Of-Mg}}function VR(e){return re(e,function(t){return h(t,"bpmn:Participant")})}N();var Dg="__targetRef_placeholder";function ps(e,t){k.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],kg(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],kg(o));function n(a,s,c){var u=a.get("dataInputAssociations");return re(u,function(p){return p!==c&&p.targetRef===s})}function r(a,s){var c=a.get("properties"),u=re(c,function(p){return p.name===Dg});return!u&&s&&(u=t.create("bpmn:Property",{name:Dg}),Ae(c,u)),u}function i(a,s){var c=r(a);c&&(n(a,c,s)||Oe(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,p=c.target,l=p&&p.businessObject,f=s.newTarget,d=f&&f.businessObject,m=s.oldTarget||s.target,g=m&&m.businessObject,v=c.businessObject,w;g&&g!==l&&i(g,u),d&&d!==l&&i(d,u),l?(w=r(l,!0),v.targetRef=w):v.targetRef=null}}ps.$inject=["eventBus","bpmnFactory"];B(ps,k);function kg(e){return function(t){var n=t.context,r=n.connection;if(h(r,"bpmn:DataInputAssociation"))return e(t)}}function $o(e){this._bpmnUpdater=e}$o.$inject=["bpmnUpdater"];$o.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.newSemanticParent,i=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]};$o.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.oldSemanticParent,i=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]};function ls(e,t,n,r){k.call(this,r),t.registerHandler("dataStore.updateContainment",$o);function i(){return n.filter(function(s){return h(s,"bpmn:Participant")&&j(s).processRef})[0]}function o(s){return s.children.filter(function(c){return h(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||i(),c){var p=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:ce(s),newSemanticParent:p.processRef||p,newDiParent:ce(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;h(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,p=u.filter(function(l){return h(l,"bpmn:DataStoreReference")});p.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(l){return!h(l,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,p=u.parent;h(u,"bpmn:DataStoreReference")&&u.type!=="label"&&h(p,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,p=c.oldParent,l=u.parent;if(!h(p,"bpmn:Collaboration")&&h(u,"bpmn:DataStoreReference")&&u.type!=="label"&&h(l,"bpmn:Collaboration")){var f=h(p,"bpmn:Participant")?p:UR(p,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,p=e.getRootElement();te(u,["bpmn:Participant","bpmn:SubProcess"])&&h(p,"bpmn:Collaboration")&&o(p).filter(function(l){return WR(l,u)}).forEach(function(l){a(l)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,p=c.newRoot,l=o(u);l.forEach(function(f){h(p,"bpmn:Process")&&a(f,p)})})}ls.$inject=["canvas","commandStack","elementRegistry","eventBus"];B(ls,k);function WR(e,t){for(var n=e.businessObject||e,r=t.businessObject||t;n.$parent;){if(n.$parent===r.processRef||r)return!0;n=n.$parent}return!1}function UR(e,t){for(;e.parent;){if(h(e.parent,t))return e.parent;e=e.parent}}N();var Qu=Math.max,Ju=Math.min,qR=20;function ep(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function Ng(e,t,n){var r=n.x,i=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(o.y=e.y+i,o.height=e.height-i):t.indexOf("s")!==-1&&(o.height=e.height+i),t.indexOf("e")!==-1?o.width=e.width+r:t.indexOf("w")!==-1&&(o.x=e.x+r,o.width=e.width-r),o}function Og(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 Zu(e,t,n){var r=t[e],i=n.min&&n.min[e],o=n.max&&n.max[e];return ne(i)&&(r=(/top|left/.test(e)?Ju:Qu)(r,i)),ne(o)&&(r=(/top|left/.test(e)?Qu:Ju)(r,o)),r}function Bg(e,t){if(!t)return e;var n=Z(e);return Si({top:Zu("top",n,t),right:Zu("right",n,t),bottom:Zu("bottom",n,t),left:Zu("left",n,t)})}function Ig(e,t,n,r){var i=Z(t),o={top:/n/.test(e)?i.bottom-n.height:i.top,left:/w/.test(e)?i.right-n.width:i.left,bottom:/s/.test(e)?i.top+n.height:i.bottom,right:/e/.test(e)?i.left+n.width:i.right},a=r?Z(r):o,s={top:Ju(o.top,a.top),left:Ju(o.left,a.left),bottom:Qu(o.bottom,a.bottom),right:Qu(o.right,a.right)};return Si(s)}function fs(e,t){return typeof e!="undefined"?e:qR}function KR(e,t){var n,r,i,o;return typeof t=="object"?(n=fs(t.left),r=fs(t.right),i=fs(t.top),o=fs(t.bottom)):n=r=i=o=fs(t),{x:e.x-n,y:e.y-i,width:e.width+n+r,height:e.height+i+o}}function YR(e){return!(e.waypoints||e.type==="label")}function tp(e,t){var n;if(e.length===void 0?n=Q(e.children,YR):n=e,n.length)return KR(Ce(n),t)}var si=Math.abs;function XR(e,t){return ep(Z(t),Z(e))}var ZR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],on=30;function zo(e,t){return t=t||[],e.children.filter(function(n){h(n,"bpmn:Lane")&&(zo(n,t),t.push(n))}),t}function yn(e){return e.children.filter(function(t){return h(t,"bpmn:Lane")})}function Bt(e){return kr(e,ZR)||e}function Lg(e,t){var n=Bt(e),r=h(n,"bpmn:Process")?[]:[n],i=zo(n,r),o=Z(e),a=Z(t),s=XR(e,t),c=[],u=Me(e);return i.forEach(function(p){if(p!==e){var l=u?0:s.top,f=u?s.right:0,d=u?0:s.bottom,m=u?s.left:0,g=Z(p);s.top&&(si(g.bottom-o.top)<10&&(d=a.top-g.bottom),si(g.top-o.top)<5&&(l=a.top-g.top)),s.left&&(si(g.right-o.left)<10&&(f=a.left-g.right),si(g.left-o.left)<5&&(m=a.left-g.left)),s.bottom&&(si(g.top-o.bottom)<10&&(l=a.bottom-g.top),si(g.bottom-o.bottom)<5&&(d=a.bottom-g.bottom)),s.right&&(si(g.left-o.right)<10&&(m=a.right-g.left),si(g.right-o.right)<5&&(f=a.right-g.right)),(l||f||d||m)&&c.push({shape:p,newBounds:Og(p,{top:l,right:f,bottom:d,left:m})})}}),c}var QR=500;function ds(e,t){k.call(this,e);function n(r,i){var o=Me(r),a=yn(i),s=[],c=[],u=[],p=[];if(In(a,function(v){return o?v.y>r.y?c.push(v):s.push(v):v.x>r.x?p.push(v):u.push(v),v.children}),!!a.length){var l;o?c.length&&s.length?l=r.height/2:l=r.height:p.length&&u.length?l=r.width/2:l=r.width;var f,d,m,g;s.length&&(f=t.calculateAdjustments(s,"y",l,r.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:l},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-l,r.y+r.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-l},"n")),u.length&&(m=t.calculateAdjustments(u,"x",l,r.x-10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:l,y:0},"e")),p.length&&(g=t.calculateAdjustments(p,"x",-l,r.x+r.width+10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:-l,y:0},"w"))}}this.postExecuted("shape.delete",QR,function(r){var i=r.context,o=i.hints,a=i.shape,s=i.oldParent;h(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}ds.$inject=["eventBus","spaceTool"];B(ds,k);var jg=500;function Go(e,t){t.invoke(k,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",jg,function(r){var i=r.elements;i.filter(function(o){var a=o.host;return Fg(o,a)}).map(function(o){return i.indexOf(o)}).forEach(function(o){r.elements[o]=n._replaceShape(i[o])})},!0),this.preExecute("elements.move",jg,function(r){var i=r.shapes,o=r.newHost;i.forEach(function(a,s){var c=a.host;Fg(a,eP(i,c)?c:o)&&(i[s]=n._replaceShape(a))})},!0)}Go.$inject=["bpmnReplace","injector"];B(Go,k);Go.prototype._replaceShape=function(e){var t=JR(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function JR(e){var t=j(e),n=t.eventDefinitions;return n&&n[0]}function Fg(e,t){return!ee(e)&&h(e,"bpmn:BoundaryEvent")&&!t}function eP(e,t){return e.indexOf(t)!==-1}N();function ms(e,t,n){k.call(this,e);function r(i,o,a){var s=o.waypoints,c,u,p,l,f,d,m,g=i.outgoing.slice(),v=i.incoming.slice(),w;ne(a.width)?w=X(a):w=a;var S=Ua(s,w);if(S){if(c=s.slice(0,S.index),u=s.slice(S.index+(S.bendpoint?1:0)),!c.length||!u.length)return;p=S.bendpoint?s[S.index]:w,(c.length===1||!Hg(i,c[c.length-1]))&&c.push($g(p)),(u.length===1||!Hg(i,u[0]))&&u.unshift($g(p))}l=o.source,f=o.target,t.canConnect(l,i,o)&&(n.reconnectEnd(o,i,c||w),d=o),t.canConnect(i,f,o)&&(d?m=n.connect(i,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,i,u||w),m=o));var x=[].concat(d&&Q(v,function(b){return b.source===d.source})||[],m&&Q(g,function(b){return b.target===m.target})||[]);x.length&&n.removeElements(x)}this.preExecute("elements.move",function(i){var o=i.newParent,a=i.shapes,s=i.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(i.newParent=o=o.parent);var u=X(c),p={x:u.x+s.x,y:u.y+s.y},l=re(o.children,function(f){var d=t.canInsert(a,f);return d&&Ua(f.waypoints,p)});l&&(i.targetFlow=l,i.position=p)}},!0),this.postExecuted("elements.move",function(i){var o=i.shapes,a=i.targetFlow,s=i.position;a&&r(o[0],a,s)},!0),this.preExecute("shape.create",function(i){var o=i.parent,a=i.shape;t.canInsert(a,o)&&(i.targetFlow=o,i.parent=o.parent)},!0),this.postExecuted("shape.create",function(i){var o=i.shape,a=i.targetFlow,s=i.position;a&&r(o,a,s)},!0)}B(ms,k);ms.$inject=["eventBus","bpmnRules","modeling"];function Hg(e,t){var n=t.x,r=t.y;return n>=e.x&&n<=e.x+e.width&&r>=e.y&&r<=e.y+e.height}function $g(e){return C({},e)}function hs(e,t){k.call(this,e),this.preExecuted("connection.create",function(n){var r=n.context,i=r.connection,o=r.source,a=r.target,s=r.hints;if(!(s&&s.createElementsBehavior===!1)&&Vo(i)){var c=[];h(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==i&&Vo(u)):c=a.incoming.filter(u=>u!==i&&Vo(u)&&h(u.source,"bpmn:EventBasedGateway")),c.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var r=n.context,i=r.newShape;if(h(i,"bpmn:EventBasedGateway")){var o=i.outgoing.filter(Vo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Vo).forEach(function(s){let c=a.incoming.filter(Vo).filter(function(u){return u.source===i});(s.source!==i||c.length>1)&&t.removeConnection(s)})})}})}hs.$inject=["eventBus","modeling"];B(hs,k);function Vo(e){return h(e,"bpmn:SequenceFlow")}var np=1500,zg=2e3;function rp(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"],np,function(r){var i=r.context,o=i.shape||r.shape,a=r.hover;h(a,"bpmn:Lane")&&!te(o,["bpmn:Lane","bpmn:Participant"])&&(r.hover=Bt(a),r.hoverGfx=e.getGraphics(r.hover));var s=n.getRootElement();a!==s&&(o.labelTarget||te(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(r.hover=s,r.hoverGfx=e.getGraphics(r.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],np,function(r){var i=r.hover;h(i,"bpmn:Lane")&&(r.hover=Bt(i)||i,r.hoverGfx=e.getGraphics(r.hover))}),t.on(["bendpoint.move.hover"],np,function(r){var i=r.context,o=r.hover,a=i.type;h(o,"bpmn:Lane")&&/reconnect/.test(a)&&(r.hover=Bt(o)||o,r.hoverGfx=e.getGraphics(r.hover))}),t.on(["connect.start"],np,function(r){var i=r.context,o=i.start;h(o,"bpmn:Lane")&&(i.start=Bt(o)||o)}),t.on("shape.move.start",zg,function(r){var i=r.shape;h(i,"bpmn:Lane")&&(r.shape=Bt(i)||i)}),t.on("spaceTool.move",zg,function(r){var i=r.hover;i&&h(i,"bpmn:Lane")&&(r.hover=Bt(i))})}rp.$inject=["elementRegistry","eventBus","canvas"];function Gg(e){return e.create("bpmn:Category")}function Vg(e){return e.create("bpmn:CategoryValue")}function Wg(e,t,n){return Ae(t.get("categoryValue"),e),e.$parent=t,Ae(n.get("rootElements"),t),t.$parent=n,e}function Ug(e){var t=e.$parent;return t&&(Oe(t.get("categoryValue"),e),e.$parent=null),e}function qg(e){var t=e.$parent;return t&&(Oe(t.get("rootElements"),e),e.$parent=null),e}var Kg=770;function vs(e,t,n,r,i,o){i.invoke(k,this);function a(){return n.filter(function(m){return h(m,"bpmn:Group")})}function s(m,g){return m.some(function(v){var w=j(v),S=w.categoryValueRef&&w.categoryValueRef.$parent;return S===g})}function c(m,g){return m.some(function(v){var w=j(v);return w.categoryValueRef===g})}function u(m,g,v){var w=a().filter(function(S){return S.businessObject!==v});g&&!s(w,g)&&qg(g),m&&!c(w,m)&&Ug(m)}function p(m,g){return Wg(m,g,t.getDefinitions())}function l(m,g){var v=j(m),w=v.categoryValueRef;w||(w=v.categoryValueRef=g.categoryValue=g.categoryValue||Vg(e));var S=w.$parent;S||(S=w.$parent=g.category=g.category||Gg(e)),p(w,S,t.getDefinitions())}function f(m,g){var v=g.category,w=g.categoryValue,S=j(m);w?(S.categoryValueRef=null,u(w,v,S)):u(null,S.categoryValueRef.$parent,S)}this.execute("label.create",function(m){var g=m.context,v=g.labelTarget;h(v,"bpmn:Group")&&l(v,g)}),this.revert("label.create",function(m){var g=m.context,v=g.labelTarget;h(v,"bpmn:Group")&&f(v,g)}),this.execute("shape.delete",function(m){var g=m.context,v=g.shape,w=j(v);if(!(!h(v,"bpmn:Group")||v.labelTarget)){var S=g.categoryValue=w.categoryValueRef,x;S&&(x=g.category=S.$parent,u(S,x,w),w.categoryValueRef=null)}}),this.reverted("shape.delete",function(m){var g=m.context,v=g.shape;if(!(!h(v,"bpmn:Group")||v.labelTarget)){var w=g.category,S=g.categoryValue,x=j(v);S&&(x.categoryValueRef=S,p(S,w))}}),this.execute("shape.create",function(m){var g=m.context,v=g.shape;!h(v,"bpmn:Group")||v.labelTarget||j(v).categoryValueRef&&l(v,g)}),this.reverted("shape.create",function(m){var g=m.context,v=g.shape;!h(v,"bpmn:Group")||v.labelTarget||j(v).categoryValueRef&&f(v,g)});function d(m,g){var v=e.create(m.$type);return o.copyElement(m,v,null,g)}r.on("copyPaste.copyElement",Kg,function(m){var g=m.descriptor,v=m.element;if(!(!h(v,"bpmn:Group")||v.labelTarget)){var w=j(v);if(w.categoryValueRef){var S=w.categoryValueRef;g.categoryValue=d(S,!0),S.$parent&&(g.category=d(S.$parent,!0))}}}),r.on("copyPaste.pasteElement",Kg,function(m){var g=m.descriptor,v=g.businessObject,w=g.categoryValue,S=g.category;w&&(w=v.categoryValueRef=d(w)),S&&(w.$parent=d(S)),delete g.category,delete g.categoryValue})}vs.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"];B(vs,k);function Wo(e,t,n,r){var i,o,a,s,c;return i=(r.y-n.y)*(t.x-e.x)-(r.x-n.x)*(t.y-e.y),i==0?null:(o=e.y-n.y,a=e.x-n.x,c=(r.x-n.x)*o-(r.y-n.y)*a,s=c/i,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function ip(e){function t(r,i,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Wo(r,i,o,a),u=Wo(r,i,o,s),p;c&&u?Yg(c,o)>Yg(u,o)?p=u:p=c:p=c||u,r.original=p}function n(r){var i=r.waypoints;t(i[0],i[1],X(r.source)),t(i[i.length-1],i[i.length-2],X(r.target))}e.on("bpmnElement.added",function(r){var i=r.element;i.waypoints&&n(i)})}ip.$inject=["eventBus"];function Yg(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function gs(e){k.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var r=n.context.shape,i=j(r),o=ce(r);if(te(i,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}gs.$inject=["eventBus"];B(gs,k);N();var ey=Math.sqrt,ty=Math.min,tP=Math.max,Xg=Math.abs;function Zg(e){return Math.pow(e,2)}function ys(e,t){return ey(Zg(e.x-t.x)+Zg(e.y-t.y))}function ny(e,t){var n=0,r,i,o,a,s,c,u,p,l,f,d;for(n=0;n<t.length-1;n++){if(r=t[n],i=t[n+1],Jg(r,i)?u=[r]:(o=ys(e,r),a=ys(e,i),c=ty(o,a),u=nP(r,i,e,c)),u.length<1)throw new Error("expected between [1, 2] circle -> line intersections");u.length===1&&(p={type:"bendpoint",position:u[0],segmentIndex:n,bendpointIndex:Jg(r,u[0])?n:n+1}),u.length===2&&(s=iP(u[0],u[1]),p={type:"segment",position:s,segmentIndex:n,relativeLocation:ys(r,s)/ys(r,i)}),l=ys(p.position,e),(!d||f>l)&&(d=p,f=l)}return d}function nP(e,t,n,r){var i=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=i*i+o*o,u=i*a+o*s,p=a*a+s*s-r*r,l=u/c,f=p/c,d=l*l-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var m=ey(d),g=-l+m,v=-l-m,w={x:e.x-i*g,y:e.y-o*g};if(d===0)return[w];var S={x:e.x-i*v,y:e.y-o*v};return[w,S].filter(function(x){return rP(x,e,t)})}function rP(e,t,n){return Qg(e.x,t.x,n.x)&&Qg(e.y,t.y,n.y)}function Qg(e,t,n){return e>=ty(t,n)-op&&e<=tP(t,n)+op}function iP(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var op=.1;function Jg(e,t){return Xg(e.x-t.x)<=op&&Xg(e.y-t.y)<=op}function iy(e,t,n,r){var i=n.segmentIndex,o=t.length-e.length;if(r.segmentMove){var a=r.segmentMove.segmentStartIndex,s=r.segmentMove.newSegmentStartIndex;return i===a?s:i>=s?i+o<s?s:i+o:i}if(r.bendpointMove){var c=r.bendpointMove.insert,u=r.bendpointMove.bendpointIndex,p;if(o===0)return i;if(i>=u&&(p=c?i+1:i-1),i<u&&(p=i,c&&n.type!=="bendpoint"&&u-1===i)){var l=oy(t,u);l<n.relativeLocation&&p++}return p}return o===0?i:r.connectionStart&&i===0?0:r.connectionEnd&&i===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function ap(e,t,n,r){var i=0,o=0,a={point:e,delta:{x:0,y:0}},s=ny(e,n),c=s.segmentIndex,u=iy(n,t,s,r);if(u<0||u>t.length-2||u===null)return a;var p=ry(n,c),l=ry(t,u),f=s.position,d=aP(p,f),m=oP(p,l);if(s.type==="bendpoint"){var g=t.length-n.length,v=s.bendpointIndex,w=n[v];if(t.indexOf(w)!==-1)return a;if(g===0){var S=t[v];return i=S.x-s.position.x,o=S.y-s.position.y,{delta:{x:i,y:o},point:{x:e.x+i,y:e.y+o}}}g<0&&v!==0&&v<n.length-1&&(d=oy(n,v))}var x={x:(l[1].x-l[0].x)*d+l[0].x,y:(l[1].y-l[0].y)*d+l[0].y},b=ag({x:e.x-f.x,y:e.y-f.y},m);return i=x.x+b.x-e.x,o=x.y+b.y-e.y,{point:Rn(x),delta:Rn({x:i,y:o})}}function oy(e,t){var n=Li(e[t-1],e[t]),r=Li(e[t],e[t+1]),i=n/(n+r);return i}function oP(e,t){var n=Af(e),r=Af(t);return r-n}function ry(e,t){return[e[t],e[t+1]]}function aP(e,t){var n=Li(e[0],e[1]),r=Li(e[0],t);return n===0?0:r/n}function ay(e,t,n,r){var i=X(e);return ap(i,t,n,r).delta}function Hi(e,t,n){var r=So(t),i=So(n),o=Dt(e,r),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Rn({x:i.x+a.x,y:i.y+a.y})}function If(e,t,n){var r=So(e),i=So(t),o=So(n),a=Dt(e,r),s=Dt(r,i),c=sP(r,t,n);if(c)return c;var u={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},p={x:o.x+u.x,y:o.y+u.y};return Rn({x:p.x+a.x-e.x,y:p.y+a.y-e.y})}function sP(e,t,n){var r=Z(t),i=Z(n);if(cP(r,i))return null;var o=He(t,e),a,s,c;if(o==="top")a={x:0,y:i.bottom-r.bottom};else if(o==="bottom")a={x:0,y:i.top-r.top};else if(o==="right")a={x:i.left-r.left,y:0};else if(o==="left")a={x:i.right-r.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=He(n,s),c!==o?null:a}function cP(e,t){return uP(e,t)||pP(e,t)}function uP(e,t){return e.right!==t.right&&e.left!==t.left}function pP(e,t){return e.top!==t.top&&e.bottom!==t.bottom}N();var sy="name",cy="text";function _s(e,t,n,r){k.call(this,e),this.postExecute("element.updateProperties",i),this.postExecute("element.updateModdleProperties",a=>{j(a.context.element)===a.context.moddleElement&&i(a)});function i(a){var s=a.context,c=s.element,u=s.properties;if(sy in u&&t.updateLabel(c,u[sy]),cy in u&&h(c,"bpmn:TextAnnotation")){var p=r.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[cy]||"");t.updateLabel(c,u.text,p)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var u=s.shape||s.connection;ee(u)||!mn(u)||gt(u)&&t.updateLabel(u,gt(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,p=C({},s.hints),l=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof p.startChanged=="undefined"&&(p.startChanged=!!p.connectionStart),typeof p.endChanged=="undefined"&&(p.endChanged=!!p.connectionEnd),ay(u,l,f,p)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,p=u.label,l;!p||!p.parent||(l=o(a),t.moveShape(p,l))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,p=j(c);p&&mn(p)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!ee(c)||u.autoResize)){var p=s.newBounds,l=r.getDimensions(gt(c)||"",{box:p,style:r.getExternalStyle()}),f=Math.ceil(l.height),d=p.y!==c.y,m=c.y+c.height;s.newBounds={width:p.width,height:f,x:p.x,y:d?m-f:p.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,p=s.oldBounds;if(Xr(c)){var l=c.label,f=X(l),d=dP(p),m=fP(f,d),g=lP(m,p,u);t.moveShape(l,g)}})}B(_s,k);_s.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function lP(e,t,n){var r=Hi(e,t,n);return Rn(Dt(r,e))}function fP(e,t){if(t.length){var n=mP(e,t);return qa(e,n)}}function dP(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 mP(e,t){var n=t.map(function(i){return{line:i,distance:Nu(e,i)}}),r=At(n,"distance");return r[0].line}N();function uy(e,t,n,r){return ap(e,t,n,r).point}function bs(e,t){k.call(this,e);function n(r,i){var o=r.context,a=o.connection,s=C({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged=="undefined"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged=="undefined"&&(s.endChanged=!!s.connectionEnd),uy(i,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(r){var i=r.context,o=i.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],p=n(r,u),l=[].concat(c.waypoints.slice(0,-1),[p]);t.updateWaypoints(c,l)}),a.forEach(function(c){var u=c.waypoints[0],p=n(r,u),l=[].concat([p],c.waypoints.slice(1));t.updateWaypoints(c,l)})}),this.postExecute(["connection.move"],function(r){var i=r.context,o=i.connection,a=o.outgoing,s=o.incoming,c=i.delta;s.forEach(function(u){var p=u.waypoints[u.waypoints.length-1],l={x:p.x+c.x,y:p.y+c.y},f=[].concat(u.waypoints.slice(0,-1),[l]);t.updateWaypoints(u,f)}),a.forEach(function(u){var p=u.waypoints[0],l={x:p.x+c.x,y:p.y+c.y},f=[].concat([l],u.waypoints.slice(1));t.updateWaypoints(u,f)})})}B(bs,k);bs.$inject=["eventBus","modeling"];N();function ci(e,t,n){var r=sp(e),i=ly(r,t),o=r[0];return i.length?i[i.length-1]:Hi(o.original||o,n,t)}function ui(e,t,n){var r=sp(e),i=ly(r,t),o=r[r.length-1];return i.length?i[0]:Hi(o.original||o,n,t)}function Uo(e,t,n){var r=sp(e),i=py(t,n),o=r[0];return Hi(o.original||o,i,t)}function qo(e,t,n){var r=sp(e),i=py(t,n),o=r[r.length-1];return Hi(o.original||o,i,t)}function py(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function sp(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function ly(e,t){var n=je(e,vP);return Q(n,function(r){return hP(r,t)})}function hP(e,t){return He(t,e,1)==="intersect"}function vP(e){return e.original||e}function xs(e,t){k.call(this,e),this.postExecute("shape.replace",function(n){var r=n.oldShape,i=n.newShape;if(gP(r,i)){var o=yP(r);o.incoming.forEach(function(a){var s=ui(a,i,r);t.reconnectEnd(a,i,s)}),o.outgoing.forEach(function(a){var s=ci(a,i,r);t.reconnectStart(a,i,s)})}},!0)}xs.$inject=["eventBus","modeling"];B(xs,k);function gP(e,t){return h(e,"bpmn:Participant")&&ie(e)&&h(t,"bpmn:Participant")&&!ie(t)}function yP(e){var t=Zn([e],!1),n=[],r=[];return t.forEach(function(i){i!==e&&(i.incoming.forEach(function(o){h(o,"bpmn:MessageFlow")&&n.push(o)}),i.outgoing.forEach(function(o){h(o,"bpmn:MessageFlow")&&r.push(o)}))},[]),{incoming:n,outgoing:r}}var _P=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function cp(e){let t=j(e);if(!h(t,"bpmn:BoundaryEvent")&&!(h(t,"bpmn:StartEvent")&&Qe(t.$parent)))return!1;let n=t.get("eventDefinitions");return!n||!n.length?!1:_P.some(r=>h(n[0],r))}function up(e){return h(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Es(e,t){e.invoke(k,this),this.postExecuted("shape.replace",function(n){let r=n.context.oldShape,i=n.context.newShape,o=n.context.hints;if(!cp(i))return;let a=up(i);if(o.targetElement&&o.targetElement[a]!==void 0)return;let c=j(r).get(a),u=j(i).get(a);c!==u&&t.updateProperties(i,{[a]:c})})}Es.$inject=["injector","modeling"];B(Es,k);function ws(e,t){k.call(this,e),this.preExecute("shape.resize",function(n){var r=n.shape,i=ce(r),o=i&&i.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(r,o,{bounds:void 0})},!0)}B(ws,k);ws.$inject=["eventBus","modeling"];function Ss(e,t,n){k.call(this,e),this.preExecute("shape.delete",function(r){var i=r.context.shape;if(!(i.incoming.length!==1||i.outgoing.length!==1)){var o=i.incoming[0],a=i.outgoing[0];if(!(!h(o,"bpmn:SequenceFlow")||!h(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=bP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}B(Ss,k);Ss.$inject=["eventBus","bpmnRules","modeling"];function Ko(e){return e.original||e}function bP(e,t){var n=Wo(Ko(e[e.length-2]),Ko(e[e.length-1]),Ko(t[1]),Ko(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Ko(e[0]),Ko(t[t.length-1])]}function Cs(e,t){k.call(this,e),this.preExecute("shape.delete",function(n){var r=n.shape,i=r.parent;h(r,"bpmn:Participant")&&(n.collaborationRoot=i)},!0),this.postExecute("shape.delete",function(n){var r=n.collaborationRoot;if(r&&!r.businessObject.participants.length){var i=t.makeProcess(),o=r.children.slice();t.moveElements(o,{x:0,y:0},i)}},!0)}Cs.$inject=["eventBus","modeling"];B(Cs,k);N();function Rs(e,t,n,r){k.call(this,e);var i=r.get("dragging",!1);function o(c){var u=c.source,p=c.target,l=c.parent;if(l){var f,d;h(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,p)||(d=!0),n.canConnectMessageFlow(u,p)&&(f="bpmn:MessageFlow")),h(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,p)||(d=!0),n.canConnectSequenceFlow(u,p)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(u,p,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,p=u.connection,l=u.newSource||p.source,f=u.newTarget||p.target,d,m;d=n.canConnect(l,f),!(!d||d.type===p.type)&&(m=t.connect(l,f,{type:d.type,associationDirection:d.associationDirection,waypoints:p.waypoints.slice()}),p.parent&&t.removeConnection(p),u.connection=m,i&&s(p,m))}function s(c,u){var p=i.context(),l=p&&p.payload.previousSelection,f;!l||!l.length||(f=l.indexOf(c),f!==-1&&l.splice(f,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,p=u.allConnections;E(p,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,p=u.properties,l=u.element,f=l.businessObject,d;p.default&&(d=re(l.outgoing,Ct({id:l.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),p.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(l.source,{default:void 0})})}B(Rs,k);Rs.$inject=["eventBus","modeling","bpmnRules","injector"];N();function Yo(e,t,n,r,i,o){r.invoke(k,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,p=Ge(u,function(l,f){var d=t.canReplace([f],f.host||f.parent||c);return d?l.concat(d.replacements):l},[]);p.length&&this._replaceElements(u,p)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,p=[];E(s.closure.topLevel,function(f){Qe(f)?p=p.concat(f.children):p=p.concat(f)}),p.length===1&&u&&(c=u);var l=t.canReplace(p,c);l&&this._replaceElements(p,l.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,p=c.attachers,l;p&&p.length&&(l=t.canReplace(p,u),this._replaceElements(p,l.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;i.unclaimId(c.businessObject.id,c.businessObject),i.updateProperties(u,{id:c.id})})}B(Yo,k);Yo.prototype._replaceElements=function(e,t){var n=this._elementRegistry,r=this._bpmnReplace,i=this._selection;E(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=r.replaceElement(s,a,{select:!1})}),t&&i.select(e)};Yo.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var xP=1500,fy={width:140,height:120},pp={width:300,height:60},lp={width:60,height:300},Ps={width:300,height:150},As={width:150,height:300},Lf={width:140,height:120},jf={width:100,height:40};function fp(e){e.on("resize.start",xP,function(t){var n=t.context,r=n.shape,i=n.direction,o=n.balanced;(h(r,"bpmn:Lane")||h(r,"bpmn:Participant"))&&(n.resizeConstraints=RP(r,i,o)),h(r,"bpmn:SubProcess")&&ie(r)&&(n.minDimensions=Lf),h(r,"bpmn:TextAnnotation")&&(n.minDimensions=jf)})}fp.$inject=["eventBus"];var pi=Math.abs,EP=Math.min,wP=Math.max;function dy(e,t,n,r){var i=e[t];e[t]=i===void 0?n:r(n,i)}function Xo(e,t,n){return dy(e,t,n,EP)}function Zo(e,t,n){return dy(e,t,n,wP)}var SP={top:20,left:50,right:20,bottom:20},CP={top:50,left:20,right:20,bottom:20};function RP(e,t,n){var r=Bt(e),i=!0,o=!0,a=zo(r,[r]),s=Z(e),c={},u={},p=Me(e),l=p?pp:lp;/n/.test(t)?u.top=s.bottom-l.height:/e/.test(t)?u.right=s.left+l.width:/s/.test(t)?u.bottom=s.top+l.height:/w/.test(t)&&(u.left=s.right-l.width),a.forEach(function(m){var g=Z(m);p?(g.top<s.top-10&&(i=!1),g.bottom>s.bottom+10&&(o=!1)):(g.left<s.left-10&&(i=!1),g.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&pi(s.top-g.bottom)<10&&Zo(c,"top",g.top+l.height),pi(s.top-g.top)<5&&Xo(u,"top",g.bottom-l.height)),/e/.test(t)&&(n&&pi(s.right-g.left)<10&&Xo(c,"right",g.right-l.width),pi(s.right-g.right)<5&&Zo(u,"right",g.left+l.width)),/s/.test(t)&&(n&&pi(s.bottom-g.top)<10&&Xo(c,"bottom",g.bottom-l.height),pi(s.bottom-g.bottom)<5&&Zo(u,"bottom",g.top+l.height)),/w/.test(t)&&(n&&pi(s.left-g.right)<10&&Zo(c,"left",g.left+l.width),pi(s.left-g.left)<5&&Xo(u,"left",g.right-l.width))});var f=r.children.filter(function(m){return!m.hidden&&!m.waypoints&&(h(m,"bpmn:FlowElement")||h(m,"bpmn:Artifact"))}),d=p?SP:CP;return f.forEach(function(m){var g=Z(m);/n/.test(t)&&(!p||i)&&Xo(u,"top",g.top-d.top),/e/.test(t)&&(p||o)&&Zo(u,"right",g.right+d.right),/s/.test(t)&&(!p||o)&&Zo(u,"bottom",g.bottom+d.bottom),/w/.test(t)&&(p||i)&&Xo(u,"left",g.left-d.left)}),{min:u,max:c}}var my=1001;function dp(e,t){e.on("resize.start",my+500,function(n){var r=n.context,i=r.shape;(h(i,"bpmn:Lane")||h(i,"bpmn:Participant"))&&(r.balanced=!Tr(n))}),e.on("resize.end",my,function(n){var r=n.context,i=r.shape,o=r.canExecute,a=r.newBounds;if(h(i,"bpmn:Lane")||h(i,"bpmn:Participant"))return o&&(a=wc(a),t.resizeLane(i,a,r.balanced)),!1})}dp.$inject=["eventBus","modeling"];N();var PP=500;function Ts(e,t,n,r,i){n.invoke(k,this);function o(p){return te(p,["bpmn:ReceiveTask","bpmn:SendTask"])||AP(p,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(p){var l=e.getDefinitions(),f=l.get("rootElements");return!!re(f,Ct({id:p.id}))}function s(p){if(h(p,"bpmn:ErrorEventDefinition"))return"errorRef";if(h(p,"bpmn:EscalationEventDefinition"))return"escalationRef";if(h(p,"bpmn:MessageEventDefinition"))return"messageRef";if(h(p,"bpmn:SignalEventDefinition"))return"signalRef"}function c(p){if(te(p,["bpmn:ReceiveTask","bpmn:SendTask"]))return p.get("messageRef");var l=p.get("eventDefinitions"),f=l[0];return f.get(s(f))}function u(p,l){if(te(p,["bpmn:ReceiveTask","bpmn:SendTask"]))return p.set("messageRef",l);var f=p.get("eventDefinitions"),d=f[0];return d.set(s(d),l)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(p){var l=p.shape||p.element;if(o(l)){var f=j(l),d=c(f),m;d&&!a(d)&&(m=e.getDefinitions().get("rootElements"),Ae(m,d),p.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(p){var l=p.addedRootElement;if(l){var f=e.getDefinitions().get("rootElements");Oe(f,l)}},!0),t.on("copyPaste.copyElement",function(p){var l=p.descriptor,f=p.element;if(!(f.labelTarget||!o(f))){var d=j(f),m=c(d);m&&(l.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",PP,function(p){var l=p.descriptor,f=l.businessObject,d=l.referencedRootElement;d&&(a(d)||(d=r.copyElement(d,i.create(d.$type))),u(f,d),delete l.referencedRootElement)})}Ts.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"];B(Ts,k);function AP(e,t){return q(t)||(t=[t]),Lt(t,function(n){return Er(e,n)})}N();var hy=Math.max;function mp(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,r=t.axis,i=t.start,o={};return E(n,function(a){var s=a.id;h(a,"bpmn:Participant")&&(o[s]=MP(a,r,i)),h(a,"bpmn:Lane")&&(o[s]=Me(a)?pp:lp),h(a,"bpmn:SubProcess")&&ie(a)&&(o[s]=Lf),h(a,"bpmn:TextAnnotation")&&(o[s]=jf),h(a,"bpmn:Group")&&(o[s]=fy)}),o})}mp.$inject=["eventBus"];function TP(e){return e==="x"}function MP(e,t,n){var r=Me(e);if(!NP(e))return r?Ps:As;var i=TP(t),o={};return i?r?o=Ps:o={width:kP(e,n,i),height:As.height}:r?o={width:Ps.width,height:DP(e,n,i)}:o=As,o}function DP(e,t,n){var r;return r=OP(e,t,n),hy(Ps.height,r)}function kP(e,t,n){var r;return r=BP(e,t,n),hy(As.width,r)}function NP(e){return!!yn(e).length}function OP(e,t,n){var r=yn(e),i;return i=Ff(r,t,n),e.height-i.height+pp.height}function BP(e,t,n){var r=yn(e),i;return i=Ff(r,t,n),e.width-i.width+lp.width}function Ff(e,t,n){var r,i,o;for(r=0;r<e.length;r++)if(i=e[r],!n&&t>=i.y&&t<=i.y+i.height||n&&t>=i.x&&t<=i.x+i.width)return o=yn(i),o.length?Ff(o,t,n):i}N();var vy=400,IP=600,gy={x:180,y:160};function Vn(e,t,n,r,i,o,a){k.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=r,this._bpmnFactory=i,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(l){return h(l,"bpmn:SubProcess")&&!ie(l)}function u(l){var f=l.shape,d=l.newRootElement,m=j(f);d=s._addDiagram(d||m),l.newRootElement=e.addRootElement(d)}function p(l){var f=l.shape,d=j(f);s._removeDiagram(d);var m=l.newRootElement=a.get(vn(d));e.removeRootElement(m)}this.executed("shape.create",function(l){var f=l.shape;c(f)&&u(l)},!0),this.postExecuted("elements.create",function(l){var f=l.elements;E(f,function(d){if(c(d)){var m=a.get(vn(d));if(!(!m||!d.children||!d.children.length)){var g=yy(d);s._showRecursively(g),s._moveChildrenToShape(g,m)}}})},!0),this.reverted("shape.create",function(l){var f=l.shape;c(f)&&p(l)},!0),this.preExecute("shape.delete",function(l){var f=l.shape;!h(f,"bpmn:SubProcess")||!ie(f)||E(Ti([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(l){var f=l.shape;if(c(f)){var d=a.get(vn(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(l){var f=l.shape;c(f)&&p(l)},!0),this.reverted("shape.delete",function(l){var f=l.shape;c(f)&&u(l)},!0),this.preExecuted("shape.replace",function(l){var f=l.oldShape,d=l.newShape;!c(f)||!c(d)||(l.oldRoot=e.removeRootElement(vn(f)))},!0),this.postExecuted("shape.replace",function(l){var f=l.newShape,d=l.oldRoot,m=e.findRoot(vn(f));if(!(!d||!m)){var g=d.children;n.moveElements(g,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(l){var f=l.element;if(h(f,"bpmn:SubProcess")){var d=l.properties,m=l.oldProperties,g=m.id,v=d.id;if(g!==v){if(Eo(f)){a.updateId(f,Jr(v)),a.updateId(g,v);return}var w=a.get(Jr(g));w&&a.updateId(Jr(g),Jr(v))}}},!0),this.reverted("element.updateProperties",function(l){var f=l.element;if(h(f,"bpmn:SubProcess")){var d=l.properties,m=l.oldProperties,g=m.id,v=d.id;if(g!==v){if(Eo(f)){a.updateId(f,Jr(g)),a.updateId(v,g);return}var w=a.get(Jr(v));w&&a.updateId(w,Jr(g))}}},!0),t.on("element.changed",function(l){var f=l.element;if(Eo(f)){var d=f,m=a.get(rf(d));!m||m===d||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",vy,function(l){var f=l.shape;h(f,"bpmn:SubProcess")&&(ie(f)?p(l):(u(l),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",vy,function(l){var f=l.shape;h(f,"bpmn:SubProcess")&&(ie(f)?p(l):(u(l),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",IP,function(l){var f=l.shape;if(h(f,"bpmn:SubProcess")){var d=l.newRootElement;if(d)if(ie(f))s._moveChildrenToShape(d.children.slice(),f),E(Ti(f.children),g=>{n.moveShape(g.annotation,{x:0,y:0},f.parent),E(g.associations,v=>{n.moveConnection(v,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var m=yy(f);s._moveChildrenToShape(m,d)}}},!0),t.on("copyPaste.createTree",function(l){var f=l.element,d=l.children;if(c(f)){var m=vn(f),g=a.get(m);g&&d.push.apply(d,g.children)}}),t.on("copyPaste.copyElement",function(l){var f=l.descriptor,d=l.element,m=l.elements,g=d.parent,v=h(ce(g),"bpmndi:BPMNPlane");if(v){var w=rf(g),S=re(m,function(x){return x.id===w});S&&(f.parent=S.id)}}),t.on("copyPaste.pasteElement",function(l){var f=l.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}B(Vn,k);Vn.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var r=e.filter(function(c){return!c.hidden});if(!r.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var i=Ce(r),o;if(!t.x)o={x:gy.x-i.x,y:gy.y-i.y};else{var a=X(t),s=X(i);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}};Vn.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Jl(e).map(r=>r.annotation));n.size&&E(Ti(e.children),r=>{n.has(r.annotation)&&E(r.associations,i=>{t.removeConnection(i)})})};Vn.prototype._showRecursively=function(e,t){var n=this,r=[];return e.forEach(function(i){i.hidden=!!t,r=r.concat(i),i.children&&(r=r.concat(n._showRecursively(i.children,i.collapsed||t)))}),r};Vn.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};Vn.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,r=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),i=t.create("bpmndi:BPMNDiagram",{plane:r});r.$parent=i;var o=n.createRoot({id:vn(e),type:e.$type,di:r,businessObject:e,collapsed:!0});return o};Vn.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,r=re(n,function(i){return i.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(r),1),r};Vn.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function LP(e){var t=[];return E(Ti(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function yy(e){return e.children.slice().concat(LP(e.children)).concat(jP(e))}function jP(e){return Ta(e.children||[],!0,-1).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Ms(e,t){e.invoke(k,this),this.postExecuted("shape.replace",function(n){var r=n.context.oldShape,i=n.context.newShape;if(!(!h(i,"bpmn:SubProcess")||h(i,"bpmn:AdHocSubProcess")||!(h(r,"bpmn:Task")||h(r,"bpmn:CallActivity"))||!ie(i))){var o=FP(i);t.createShape({type:"bpmn:StartEvent"},o,i)}})}Ms.$inject=["injector","modeling"];B(Ms,k);function FP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Ds(e,t){k.call(this,e),this.preExecute("connection.create",function(n){let{target:r}=n;h(r,"bpmn:TextAnnotation")&&(n.parent=r.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){let r=n.shapes||[n.shape];r.length===1&&h(r[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var r=n.context,i=r.shape,o=r.hints||{};if(!(!h(i,"bpmn:TextAnnotation")||o.autoResize)){var a=r.newBounds,s=t.getTextAnnotationBounds(a,gt(i)||""),c=a.y!==i.y&&Math.abs(a.y+a.height-(i.y+i.height))<=1,u=i.y+i.height;r.newBounds={width:a.width,height:s.height,x:a.x,y:c?u-s.height:a.y}}})}B(Ds,k);Ds.$inject=["eventBus","textRenderer"];N();function ks(e,t){k.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var r=n.shape;if(ie(r))return;var i=Zn(r);i.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();E(s,function(u){o(u,!0)}),E(c,function(u){o(u,!1)})});function o(a,s){i.indexOf(a.source)!==-1&&i.indexOf(a.target)!==-1||h(a,"bpmn:Association")&&(h(a.source,"bpmn:TextAnnotation")||h(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,r,X(r)):t.reconnectStart(a,r,X(r)))}},!0)}B(ks,k);ks.$inject=["eventBus","modeling"];var Hf=500;function Ns(e,t,n){k.call(this,e);function r(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function i(a,s){var c=a.children,u=s,p,l;return p=HP(c).concat([a]),l=tp(p),l?(u.width=Math.max(l.width,u.width),u.height=Math.max(l.height,u.height),u.x=l.x+(l.width-u.width)/2,u.y=l.y+(l.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}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"],Hf,function(a){var s=a.context,c=s.shape;h(c,"bpmn:SubProcess")&&(c.collapsed?ce(c).isExpanded=!1:(r(c.children),ce(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Hf,function(a){var s=a.context,c=s.shape;c.collapsed?ce(c).isExpanded=!1:ce(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Hf,function(a){var s=a.context.shape,c=t.getDefaultSize(s),u;s.collapsed?u=o(s,c):u=i(s,c),n.resizeShape(s,u,null,{autoResize:s.collapsed?!1:"nwse"})})}B(Ns,k);Ns.$inject=["eventBus","elementFactory","modeling"];function HP(e){return e.filter(function(t){return!t.hidden})}function Os(e,t,n,r){t.invoke(k,this),this.preExecute("shape.delete",function(i){var o=i.context,a=o.shape,s=a.businessObject;ee(a)||(h(a,"bpmn:Participant")&&ie(a)&&n.ids.unclaim(s.processRef.id),r.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(i){var o=i.context,a=o.connection,s=a.businessObject;r.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var i=e.getRootElement(),o=i.businessObject;h(i,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}B(Os,k);Os.$inject=["canvas","injector","moddle","modeling"];function Bs(e,t){k.call(this,e),this.preExecute("connection.delete",function(n){var r=n.context,i=r.connection,o=i.source;$P(i,o)&&t.updateProperties(o,{default:null})})}B(Bs,k);Bs.$inject=["eventBus","modeling"];function $P(e,t){if(!h(e,"bpmn:SequenceFlow"))return!1;var n=j(t),r=j(e);return n.get("default")===r}var zP=500,GP=5e3;function Is(e,t){k.call(this,e);var n;function r(){return n=n||new VP,n.enter(),n}function i(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var s=n.leave();return s&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),s}var a=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(a,GP,function(s){r()}),this.postExecuted(a,zP,function(s){o()}),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],function(s){var c=s.context,u=c.shape,p=i();u.labelTarget||(h(u,"bpmn:Lane")&&p.addLane(u),h(u,"bpmn:FlowNode")&&p.addFlowNode(u))})}Is.$inject=["eventBus","modeling"];B(Is,k);function VP(){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}}function Ls(e,t){k.call(this,e),this.postExecuted("elements.create",function(n){let r=n.context,i=r.elements;for(let o of i)WP(o)&&!qP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}B(Ls,k);Ls.$inject=["eventBus","modeling"];function WP(e){let t=j(e);return t&&t.isForCompensation}function UP(e){return e&&h(e,"bpmn:BoundaryEvent")&&Er(e,"bpmn:CompensateEventDefinition")}function qP(e){return e.incoming.filter(n=>UP(n.source)).length>0}var _y={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","artifactBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","compensateBoundaryEventBehaviour","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","nonInterruptingBehavior","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","textAnnotationBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","unsetDefaultFlowBehavior","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",es],appendBehavior:["type",ts],associationBehavior:["type",rs],attachEventBehavior:["type",Fo],artifactBehavior:["type",ns],boundaryEventBehavior:["type",is],compensateBoundaryEventBehaviour:["type",as],createBehavior:["type",ss],createDataObjectBehavior:["type",cs],createParticipantBehavior:["type",us],dataInputAssociationBehavior:["type",ps],dataStoreBehavior:["type",ls],deleteLaneBehavior:["type",ds],detachEventBehavior:["type",Go],dropOnFlowBehavior:["type",ms],eventBasedGatewayBehavior:["type",hs],fixHoverBehavior:["type",rp],groupBehavior:["type",vs],importDockingFix:["type",ip],isHorizontalFix:["type",gs],labelBehavior:["type",_s],layoutConnectionBehavior:["type",bs],messageFlowBehavior:["type",xs],nonInterruptingBehavior:["type",Es],removeElementBehavior:["type",Ss],removeEmbeddedLabelBoundsBehavior:["type",ws],removeParticipantBehavior:["type",Cs],replaceConnectionBehavior:["type",Rs],replaceElementBehaviour:["type",Yo],resizeBehavior:["type",fp],resizeLaneBehavior:["type",dp],rootElementReferenceBehavior:["type",Ts],spaceToolBehavior:["type",mp],subProcessPlaneBehavior:["type",Vn],subProcessStartEventBehavior:["type",Ms],textAnnotationBehavior:["type",Ds],toggleCollapseConnectionBehaviour:["type",ks],toggleElementCollapseBehaviour:["type",Ns],unclaimIdBehavior:["type",Os],unsetDefaultFlowBehavior:["type",Bs],updateFlowNodeRefsBehavior:["type",Is],setCompensationActivityAfterPasteBehavior:["type",Ls]};N();function hp(e,t){var n=He(e,t,-15);return n!=="intersect"?n:null}function wt(e){Ot.call(this,e)}B(wt,Ot);wt.$inject=["eventBus"];wt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return KP(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,r=e.hints||{},i=r.targetParent,o=r.targetAttach;if(o)return!1;i&&(n.parent=i);try{return vp(t,n)}finally{i&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,r=e.target;return vp(n,r,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,r=e.direction;return Ny(t,n,r)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,r=e.target;return de(r)&&!gp(t,r,n)?!1:ln(t,function(i){return de(i)?vp(i.source,i.target,i):i.host?js(i,i.host,null,n):Gf(i,r,null,n)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,r=e.position,i=e.hints;return i!=null&&i.keyboardMove&&n.some(function(a){return Py(a)&&!n.includes(a.host)})?!1:js(n,t,null,r)||Dy(n,t,r)||ky(n,t,r)||gp(n,t,r)}),this.addRule("shape.create",function(e){return Gf(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return js(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return jy(n,t)})};wt.prototype.canConnectMessageFlow=Iy;wt.prototype.canConnectSequenceFlow=Ly;wt.prototype.canConnectDataAssociation=Wf;wt.prototype.canConnectAssociation=Oy;wt.prototype.canConnectCompensationAssociation=By;wt.prototype.canMove=ky;wt.prototype.canAttach=js;wt.prototype.canReplace=Dy;wt.prototype.canDrop=Qo;wt.prototype.canInsert=gp;wt.prototype.canCreate=Gf;wt.prototype.canConnect=vp;wt.prototype.canResize=Ny;wt.prototype.canCopy=jy;function KP(e){return $f(e)?null:te(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function $f(e){return!e||ee(e)}function by(e){do{if(h(e,"bpmn:Process"))return j(e);if(h(e,"bpmn:Participant"))return j(e).processRef||j(e)}while(e=e.parent)}function zf(e){return h(e,"bpmn:TextAnnotation")}function Vf(e){return h(e,"bpmn:Group")&&!e.labelTarget}function Sy(e){return h(e,"bpmn:BoundaryEvent")&&ur(e,"bpmn:CompensateEventDefinition")}function yp(e){return j(e).isForCompensation}function YP(e,t){var n=by(e),r=by(t);return n===r}function XP(e){return h(e,"bpmn:InteractionNode")&&!h(e,"bpmn:BoundaryEvent")&&(!h(e,"bpmn:Event")||h(e,"bpmn:ThrowEvent")&&Ry(e,"bpmn:MessageEventDefinition"))}function ZP(e){return h(e,"bpmn:InteractionNode")&&!yp(e)&&(!h(e,"bpmn:Event")||h(e,"bpmn:CatchEvent")&&Ry(e,"bpmn:MessageEventDefinition"))&&!(h(e,"bpmn:BoundaryEvent")&&!ur(e,"bpmn:MessageEventDefinition"))}function xy(e){for(var t=e;t=t.parent;){if(h(t,"bpmn:FlowElementsContainer"))return j(t);if(h(t,"bpmn:Participant"))return j(t).processRef}return null}function Cy(e,t){var n=xy(e),r=xy(t);return n===r}function ur(e,t){var n=j(e);return!!re(n.eventDefinitions||[],function(r){return h(r,t)})}function Ry(e,t){var n=j(e);return(n.eventDefinitions||[]).every(function(r){return h(r,t)})}function QP(e){return h(e,"bpmn:FlowNode")&&!h(e,"bpmn:EndEvent")&&!Qe(e)&&!(h(e,"bpmn:IntermediateThrowEvent")&&ur(e,"bpmn:LinkEventDefinition"))&&!Sy(e)&&!yp(e)}function JP(e){return h(e,"bpmn:FlowNode")&&!h(e,"bpmn:StartEvent")&&!h(e,"bpmn:BoundaryEvent")&&!Qe(e)&&!(h(e,"bpmn:IntermediateCatchEvent")&&ur(e,"bpmn:LinkEventDefinition"))&&!yp(e)}function eA(e){return h(e,"bpmn:ReceiveTask")||h(e,"bpmn:IntermediateCatchEvent")&&(ur(e,"bpmn:MessageEventDefinition")||ur(e,"bpmn:TimerEventDefinition")||ur(e,"bpmn:ConditionalEventDefinition")||ur(e,"bpmn:SignalEventDefinition"))}function tA(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Ey(e,t){var n=tA(t);return n.indexOf(e)!==-1}function vp(e,t,n){if($f(e)||$f(t))return null;if(!h(n,"bpmn:DataAssociation")){if(Iy(e,t))return{type:"bpmn:MessageFlow"};if(Ly(e,t))return{type:"bpmn:SequenceFlow"}}var r=Wf(e,t);return r||(By(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Oy(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Qo(e,t){return ee(e)||Vf(e)?!0:h(t,"bpmn:Participant")&&!ie(t)?!1:h(e,"bpmn:Participant")?h(t,"bpmn:Process")||h(t,"bpmn:Collaboration"):te(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:h(e,"bpmn:Lane")?h(t,"bpmn:Participant")||h(t,"bpmn:Lane"):h(e,"bpmn:BoundaryEvent")&&!nA(e)?!1:h(e,"bpmn:FlowElement")&&!h(e,"bpmn:DataStoreReference")?h(t,"bpmn:FlowElementsContainer")?ie(t):te(t,["bpmn:Participant","bpmn:Lane"]):h(e,"bpmn:DataStoreReference")&&h(t,"bpmn:Collaboration")?Lt(j(t).get("participants"),function(n){return!!n.get("processRef")}):te(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?te(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):h(e,"bpmn:MessageFlow")?h(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function nA(e){return j(e).cancelActivity&&(Ay(e)||Ty(e))}function Py(e){return!ee(e)&&h(e,"bpmn:BoundaryEvent")}function rA(e){return h(e,"bpmn:Lane")}function iA(e){return Py(e)||h(e,"bpmn:IntermediateThrowEvent")&&Ay(e)?!0:h(e,"bpmn:IntermediateCatchEvent")&&Ty(e)}function Ay(e){var t=j(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Ty(e){return My(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function My(e,t){return t.some(function(n){return ur(e,n)})}function oA(e){return h(e,"bpmn:ReceiveTask")&&re(e.incoming,function(t){return h(t.source,"bpmn:EventBasedGateway")})}function js(e,t,n,r){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var i=e[0];return ee(i)||!iA(i)||Qe(t)||!h(t,"bpmn:Activity")||yp(t)||r&&!hp(r,t)||oA(t)?!1:"attach"}function Dy(e,t,n){if(!t)return!1;var r={replacements:[]};return E(e,function(i){Qe(t)||h(i,"bpmn:StartEvent")&&i.type!=="label"&&Qo(i,t)&&(hh(i)||r.replacements.push({oldElementId:i.id,newElementType:"bpmn:StartEvent"}),(vh(i)||gh(i)||yh(i))&&r.replacements.push({oldElementId:i.id,newElementType:"bpmn:StartEvent"}),My(i,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&h(t,"bpmn:SubProcess")&&r.replacements.push({oldElementId:i.id,newElementType:"bpmn:StartEvent"})),h(t,"bpmn:Transaction")||ur(i,"bpmn:CancelEventDefinition")&&i.type!=="label"&&(h(i,"bpmn:EndEvent")&&Qo(i,t)&&r.replacements.push({oldElementId:i.id,newElementType:"bpmn:EndEvent"}),h(i,"bpmn:BoundaryEvent")&&js(i,t,null,n)&&r.replacements.push({oldElementId:i.id,newElementType:"bpmn:BoundaryEvent"}))}),r.replacements.length?r:!1}function ky(e,t){return Lt(e,rA)?!1:t?e.every(function(n){return Qo(n,t)}):!0}function Gf(e,t,n,r){return t?ee(e)||Vf(e)?!0:Qo(e,t,r)||gp(e,t,r):!1}function Ny(e,t,n){return h(e,"bpmn:SubProcess")?ie(e)&&(!t||t.width>=100&&t.height>=80):h(e,"bpmn:Lane")||h(e,"bpmn:Participant")?!0:zf(e)?n?n==="e"||n==="w":!0:Vf(e)?!0:ee(e)?n?n==="e"||n==="w":!0:!1}function aA(e,t){var n=zf(e),r=zf(t);return(n||r)&&n!==r}function Oy(e,t){return Ey(t,e)||Ey(e,t)?!1:aA(e,t)?!0:!!Wf(e,t)}function By(e,t){return Cy(e,t)&&Sy(e)&&h(t,"bpmn:Activity")&&!cA(t,e)&&!Qe(t)}function Iy(e,t){return wy(e)&&!wy(t)?!1:XP(e)&&ZP(t)&&!YP(e,t)}function Ly(e,t){return QP(e)&&JP(t)&&Cy(e,t)&&!(h(e,"bpmn:EventBasedGateway")&&!eA(t))}function Wf(e,t){return te(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&te(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:te(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&te(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function gp(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:te(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!ee(t)&&h(e,"bpmn:FlowNode")&&!h(e,"bpmn:BoundaryEvent")&&Qo(e,t.parent,n)}function sA(e,t){return e&&t&&e.indexOf(t)!==-1}function jy(e,t){return ee(t)?!0:!(h(t,"bpmn:Lane")&&!sA(e,t.parent))}function wy(e){return kr(e,"bpmn:Process")||kr(e,"bpmn:Collaboration")}function cA(e,t){return e.attachers.includes(t)}var Fy={__depends__:[Et],__init__:["bpmnRules"],bpmnRules:["type",wt]};N();var uA=2e3;function _p(e,t){e.on("saveXML.start",uA,n);function n(){var r=t.getRootElements();E(r,function(i){var o=ce(i),a,s;a=Zn([i],!1),a=Q(a,function(c){return c!==i&&!c.labelTarget}),s=je(a,ce),o.set("planeElement",s)})}}_p.$inject=["eventBus","canvas"];var Hy={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",_p]};function Jo(e){k.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var r=n.context,i=r.shape||r.connection,o=r.parent,a=t.getOrdering(i,o);a&&(a.parent!==void 0&&(r.parent=a.parent),r.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var r=n.context,i=r.shape||r.connection,o=r.newParent||i.parent,a=t.getOrdering(i,o);a&&(a.parent!==void 0&&(r.newParent=a.parent),r.newParentIndex=a.index)})}Jo.prototype.getOrdering=function(e,t){return null};B(Jo,k);N();function Fs(e,t){Jo.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function r(a){if(a.labelTarget)return{level:10};var s=re(n,function(c){return te(a,[c.type])});return s&&s.order||{level:1}}function i(a){var s=a.order;if(s||(a.order=s=r(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var u=s;u&&!te(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||h(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=i(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),p=Sa(s.children,function(l){return!a.labelTarget&&l.labelTarget?!1:c.level<i(l).level});return p!==-1&&u!==-1&&u<p&&(p-=1),{index:p,parent:s}}}Fs.$inject=["eventBus","canvas"];B(Fs,Jo);var $y={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Fs]};function $i(){}$i.prototype.get=function(){return this._data};$i.prototype.set=function(e){this._data=e};$i.prototype.clear=function(){var e=this._data;return delete this._data,e};$i.prototype.isEmpty=function(){return!this._data};var zy={clipboard:["type",$i]};N();var pA="drop-ok",Gy="drop-not-ok",Vy="attach-ok",Wy="new-parent",Uy="create",lA=2e3;function bp(e,t,n,r,i){function o(c,u,p,l,f){if(!u)return!1;c=Q(c,function(S){var x=S.labelTarget;return!S.parent&&!(ee(S)&&c.indexOf(x)!==-1)});var d=re(c,function(S){return!de(S)}),m=!1,g=!1,v=!1;Ky(c)&&(m=i.allowed("shape.attach",{position:p,shape:d,target:u})),m||(Ky(c)?v=i.allowed("shape.create",{position:p,shape:d,source:l,target:u}):v=i.allowed("elements.create",{elements:c,position:p,target:u}));var w=f.connectionTarget;return v||m?(d&&l&&(g=i.allowed("connection.create",{source:w===l?d:l,target:w===l?l:d,hints:{targetParent:u,targetAttach:m}})),{attach:m,connect:g}):v===null||m===null?null:!1}function a(c,u){[Vy,pA,Gy,Wy].forEach(function(p){p===u?e.addMarker(c,p):e.removeMarker(c,p)})}n.on(["create.move","create.hover"],function(c){var u=c.context,p=u.elements,l=c.hover,f=u.source,d=u.hints||{};if(!l){u.canExecute=!1,u.target=null;return}qy(c);var m={x:c.x,y:c.y},g=u.canExecute=l&&o(p,l,m,f,d);l&&g!==null&&(u.target=l,g&&g.attach?a(l,Vy):a(l,g?Wy:Gy))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,p=u.source,l=u.shape,f=u.elements,d=u.target,m=u.canExecute,g=m&&m.attach,v=m&&m.connect,w=u.hints||{};if(m===!1||!d)return!1;qy(c);var S={x:c.x,y:c.y};v?l=r.appendShape(p,l,S,d,{attach:g,connection:v===!0?{}:v,connectionTarget:w.connectionTarget}):(f=r.createElements(f,S,d,C({},w,{attach:g})),l=re(f,function(x){return!de(x)})),C(u,{elements:f,shape:l}),C(c,{elements:f,shape:l})});function s(){var c=t.context();c&&c.prefix===Uy&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],lA,function(){n.off("elements.changed",s)})}),this.start=function(c,u,p){q(u)||(u=[u]);var l=re(u,function(m){return!de(m)});if(l){p=C({elements:u,hints:{},shape:l},p||{}),E(u,function(m){ne(m.x)||(m.x=0),ne(m.y)||(m.y=0)});var f=Q(u,function(m){return!m.hidden}),d=Ce(f);E(u,function(m){de(m)&&(m.waypoints=je(m.waypoints,function(g){return{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2}})),C(m,{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2})}),t.init(c,Uy,{cursor:"grabbing",autoActivate:!0,data:{shape:l,elements:u,context:p}})}}}bp.$inject=["canvas","dragging","eventBus","modeling","rules"];function qy(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 Ky(e){return e&&e.length===1&&!de(e[0])}var fA=750;function xp(e,t,n,r,i){function o(a){var s=U("g");$(s,i.cls("djs-drag-group",["no-events"]));var c=U("g");return a.forEach(function(u){var p;u.hidden||(u.waypoints?(p=n._createContainer("connection",c),n.drawConnection(Ln(p),u)):(p=n._createContainer("shape",c),n.drawShape(Ln(p),u),Fe(p,u.x,u.y)),r.addDragger(u,s,p))}),s}t.on("create.move",fA,function(a){var s=a.hover,c=a.context,u=c.elements,p=c.dragGroup;p||(p=c.dragGroup=o(u));var l;s?(p.parentNode||(l=e.getActiveLayer(),J(l,p)),Fe(p,a.x,a.y)):Pe(p)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Pe(c)})}xp.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var li={__depends__:[kt,Dn,Et,rt],__init__:["create","createPreview"],create:["type",bp],createPreview:["type",xp]};function Hs(e){var t=this;this._lastMoveEvent=null;function n(r){t._lastMoveEvent=r}e.on("canvas.init",function(r){var i=t._svg=r.svg;i.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}Hs.$inject=["eventBus"];Hs.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||dA(0,0)};function dA(e,t){var n=document.createEvent("MouseEvent"),r=e,i=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,r,i,o,a,!1,!1,!1,!1,0,null),n}var pr={__init__:["mouse"],mouse:["type",Hs]};N();var Yy=2e3;function Ht(e,t,n,r,i,o,a,s){this._canvas=e,this._create=t,this._elementFactory=r,this._eventBus=i,this._modeling=o,this._mouse=a,this._rules=s,i.on("copyPaste.copyElement",function(c){var u=c.descriptor,p=c.element,l=c.elements;u.priority=1,u.id=p.id;var f=re(l,function(d){return d===p.parent});f&&(u.parent=p.parent.id),mA(p)&&(u.priority=2,u.host=p.host.id),de(p)&&(u.priority=3,u.source=p.source.id,u.target=p.target.id,u.waypoints=hA(p)),ee(p)&&(u.priority=4,u.labelTarget=p.labelTarget.id),E(["x","y","width","height"],function(d){ne(p[d])&&(u[d]=p[d])}),u.hidden=p.hidden,u.collapsed=p.collapsed}),i.on("copyPaste.elementsCopied",Yy,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),i.on("copyPaste.pasteElements",Yy,function(c){c.tree||(c.tree=n.get())}),i.on("copyPaste.pasteElements",function(c){var u=c.hints;C(u,{createElementsBehavior:!1})})}Ht.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"];Ht.prototype.copy=function(e,t={}){var n,r;return q(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?r={}:r=this.createTree(q(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:r,hints:t}),r};Ht.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var r=t.tree;if(r){var i=t.hints,o=this._createElements(r);if(t.element&&t.point)return this._paste(o,t.element,t.point,i);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:i})}}};Ht.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})};Ht.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),r=e.filter(function(i){return n[i.id]});return r.length>0&&this._modeling.removeElements(r),t};Ht.prototype._getElementIdsFromTree=function(e){var t={};return E(e,function(n){E(n,function(r){r.id&&(t[r.id]=!0)})}),t};Ht.prototype._paste=function(e,t,n,r){E(e,function(o){ne(o.x)||(o.x=0),ne(o.y)||(o.y=0)});var i=Ce(e);return E(e,function(o){de(o)&&(o.waypoints=je(o.waypoints,function(a){return{x:a.x-i.x-i.width/2,y:a.y-i.y-i.height/2}})),C(o,{x:o.x-i.x-i.width/2,y:o.y-i.y-i.height/2})}),this._modeling.createElements(e,n,t,C({},r))};Ht.prototype._createElements=function(e){var t=this,n=this._eventBus,r={},i=[];return E(e,function(o,a){a=parseInt(a,10),o=At(o,"priority"),E(o,function(s){var c=C({},Nt(s,["priority"]));r[s.parent]?c.parent=r[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:r,descriptor:c});var u;if(de(c)){c.source=r[s.source],c.target=r[s.target],u=r[s.id]=t.createConnection(c),i.push(u);return}if(ee(c)){c.labelTarget=r[c.labelTarget],u=r[s.id]=t.createLabel(c),i.push(u);return}c.host&&(c.host=r[c.host]),u=r[s.id]=t.createShape(c),i.push(u)})}),i};Ht.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Nt(e,["id"]));return t};Ht.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Nt(e,["id"]));return t};Ht.prototype.createShape=function(e){var t=this._elementFactory.createShape(Nt(e,["id"]));return t};Ht.prototype.hasRelations=function(e,t){var n,r,i;return!(de(e)&&(r=re(t,Ct({id:e.source.id})),i=re(t,Ct({id:e.target.id})),!r||!i)||ee(e)&&(n=re(t,Ct({id:e.labelTarget.id})),!n))};Ht.prototype.createTree=function(e){var t=this._rules,n=this,r={},i=[],o=zr(e);function a(u,p){return t.allowed("element.copy",{element:u,elements:p})}function s(u,p){var l=re(i,function(f){return u===f.element});if(!l){i.push({element:u,depth:p});return}l.depth<p&&(i=c(l,i),i.push({element:l.element,depth:p}))}function c(u,p){var l=p.indexOf(u);return l!==-1&&p.splice(l,1),p}return In(o,function(u,p,l){if(ee(u))return;E(u.labels,function(m){s(m,l)});function f(m){m&&m.length&&E(m,function(g){E(g.labels,function(v){s(v,l)}),s(g,l)})}E([u.attachers,u.incoming,u.outgoing],f),s(u,l);var d=[];return u.children&&(d=u.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:u,children:d}),d}),e=je(i,function(u){return u.element}),i=je(i,function(u){return u.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:u.descriptor,element:u.element,elements:e}),u}),i=At(i,function(u){return u.descriptor.priority}),e=je(i,function(u){return u.element}),E(i,function(u){var p=u.depth;if(!n.hasRelations(u.element,e)){Zy(u.element,e);return}if(!a(u.element,e)){Zy(u.element,e);return}r[p]||(r[p]=[]),r[p].push(u.descriptor)}),r};function mA(e){return!!e.host}function hA(e){return je(e.waypoints,function(t){return t=Xy(t),t.original&&(t.original=Xy(t.original)),t})}function Xy(e){return C({},e)}function Zy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}var Qy={__depends__:[zy,li,pr,Et],__init__:["copyPaste"],copyPaste:["type",Ht]};N();function Uf(e,t,n){q(n)||(n=[n]),E(n,function(r){wn(e[r])||(t[r]=e[r])})}var qf=750;function Ep(e,t,n){function r(c,u){var p=e.create(c.$type);return n.copyElement(c,p,null,u)}t.on("copyPaste.copyElement",qf,function(c){var u=c.descriptor,p=c.element,l=j(p);if(ee(p))return u;var f=u.businessObject=r(l,!0),d=u.di=r(ce(p),!0);d.bpmnElement=f,Uf(f,u,"name"),Uf(d,u,"isExpanded"),l.default&&(u.default=l.default.id)});var i="-bpmn-js-refs";function o(c){return c[i]=c[i]||{}}function a(c,u){c[i]=u}function s(c,u,p){var l=j(c);return c.default&&(p[c.default]={element:l,property:"default"}),c.host&&(j(c).attachedToRef=j(u[c.host])),Nt(p,Ge(p,function(f,d,m){var g=d.element,v=d.property;return m===c.id&&(g.set(v,l),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,p=c.descriptor,l=p.businessObject,f=p.di;if(ee(p)){p.businessObject=j(u[p.labelTarget]),p.di=ce(u[p.labelTarget]);return}l=p.businessObject=r(l),f=p.di=r(f),f.bpmnElement=l,Uf(p,l,["isExpanded","name"]),p.type=l.$type}),t.on("copyPaste.copyElement",qf,function(c){var u=c.descriptor,p=c.element;if(h(p,"bpmn:Participant")){var l=j(p);l.processRef&&(u.processRef=r(l.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,p=u.processRef;p&&(u.processRef=r(p))}),t.on("copyPaste.createTree",function(c){var u=c.element,p=c.children;h(u,"bpmn:SubProcess")&&E(Ti(p),l=>{p.push(l.annotation)})}),t.on("copyPaste.pasteElement",qf,function(c){var u=c.cache,p=c.descriptor;a(u,s(p,u,o(u)))})}Ep.$inject=["bpmnFactory","eventBus","moddleCopy"];N();var vA=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],gA=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function zi(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",r=>{let{propertyNames:i}=r;if(!(!i||!i.length))return At(i,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",r=>{let{parent:i,property:o,propertyName:a}=r,s=Se(i)&&i.$descriptor;if(a&&gA.includes(a))return o;if(a&&vA.includes(a)||a&&s&&!re(s.properties,Ct({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",r=>{let{property:i}=r;if(h(i,"bpmn:ExtensionElements")&&(!i.values||!i.values.length))return!1})}zi.$inject=["eventBus","bpmnFactory","moddle"];zi.prototype.copyElement=function(e,t,n,r=!1){n&&!q(n)&&(n=[n]),n=n||wp(e.$descriptor);let i=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:r});return i===!1||(q(i)&&(n=i),E(n,o=>{let a;dt(e,o)&&(a=e.get(o));let s=this.copyProperty(a,t,o,r);!Ue(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t};zi.prototype.copyProperty=function(e,t,n,r=!1){let i=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:r});if(i===!1)return;if(i)return Se(i)&&i.$type&&!i.$parent&&(i.$parent=t),i;let o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,r):q(e)?Ge(e,(a,s)=>{let c=this.copyProperty(s,t,n,r);return c?a.concat(c):a},[]):Se(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(i=this._bpmnFactory.create(e.$type),i.$parent=t,i=this.copyElement(e,i,null,r),i):e};zi.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 wp(e,t){return Ge(e.properties,(n,r)=>t&&r.default?n:n.concat(r.name),[])}var Sp={__depends__:[Qy],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Ep],moddleCopy:["type",zi]};N();var Jy=Math.round;function $s(e,t){this._modeling=e,this._eventBus=t}$s.$inject=["modeling","eventBus"];$s.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var r=this._modeling,i=this._eventBus;i.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,u=Jy(s+o/2),p=Jy(c+a/2),l=r.replaceShape(e,C({},t,{x:u,y:p,width:o,height:a}),n);return i.fire("replace.end",{element:e,newElement:l,hints:n}),l};function Cp(e,t){t.on("replace.end",500,function(n){let{newElement:r,hints:i={}}=n;i.select!==!1&&e.select(r)})}Cp.$inject=["selection","eventBus"];var e_={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Cp],replace:["type",$s]};N();function yA(e,t,n){q(n)||(n=[n]),E(n,function(r){wn(e[r])||(t[r]=e[r])})}var _A=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function bA(e,t){var n=e&&dt(e,"collapsed")?e.collapsed:!ie(e),r;return t&&(dt(t,"collapsed")||dt(t,"isExpanded"))?r=dt(t,"collapsed")?t.collapsed:!t.isExpanded:r=n,n!==r}function Pp(e,t,n,r,i,o){function a(s,c,u){u=u||{};var p=c.type,l=s.businessObject;if(Rp(l)&&(p==="bpmn:SubProcess"||p==="bpmn:AdHocSubProcess")&&bA(s,c))return r.toggleCollapse(s),s;var f=e.create(p),d={type:p,businessObject:f};d.di={},p==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),yA(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var m=wp(l.$descriptor),g=wp(f.$descriptor,!0),v=xA(m,g);C(f,mt(c,_A));var w=Q(v,function(b){return b==="eventDefinitions"?t_(s,c.eventDefinitionType):b==="loopCharacteristics"?!Qe(f):dt(f,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!Qe(f):!0});if(f=n.copyElement(l,f,w),c.eventDefinitionType&&(t_(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),h(l,"bpmn:Activity")){if(Rp(l))d.isExpanded=ie(s);else if(c&&dt(c,"isExpanded")){d.isExpanded=c.isExpanded;var S=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=S.width,d.height=S.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}ie(s)&&!h(l,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Rp(l)&&!Rp(f)&&(u.moveChildren=!1),h(l,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=Me(s);ce(s).isHorizontal||(ce(d).isHorizontal=x),d.width=x?s.width:t.getDefaultSize(d).width,d.height=x?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=l.name,te(l,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&te(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=l.default),c.host&&!h(l,"bpmn:BoundaryEvent")&&h(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),i.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}Pp.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Rp(e){return h(e,"bpmn:SubProcess")}function t_(e,t){var n=j(e);return t&&n.get("eventDefinitions").some(function(r){return h(r,t)})}function xA(e,t){return e.filter(function(n){return t.includes(n)})}var Ap={__depends__:[Sp,e_,rt],bpmnReplace:["type",Pp]};N();var EA=250;function Nr(e){this._eventBus=e,this._tools=[],this._active=null}Nr.$inject=["eventBus"];Nr.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)};Nr.prototype.isActive=function(e){return e&&this._active===e};Nr.prototype.length=function(e){return this._tools.length};Nr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))};Nr.prototype.bindEvents=function(e,t){var n=this._eventBus,r=[];n.on(t.tool+".init",function(i){var o=i.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),E(t,function(i){r.push(i+".ended"),r.push(i+".canceled")}),n.on(r,EA,function(i){this._active&&(wA(i)||this.setActive(null))},this)};function wA(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Bn(t,'.group[data-group="tools"]')}var fi={__depends__:[kt],__init__:["toolManager"],toolManager:["type",Nr]};N();N();function n_(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 r_(e,t){var n=[];return E(e.concat(t),function(r){var i=r.incoming,o=r.outgoing;E(i.concat(o),function(a){var s=a.source,c=a.target;(zs(e,s)||zs(e,c)||zs(t,s)||zs(t,c))&&(zs(n,a)||n.push(a))})}),n}function zs(e,t){return e.indexOf(t)!==-1}function i_(e,t,n){var r=e.x,i=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:r,y:i+c,width:o,height:a-c};case"s":return{x:r,y:i,width:o,height:a+c};case"w":return{x:r+s,y:i,width:o-s,height:a};case"e":return{x:r,y:i,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var Kf=Math.abs,SA=Math.round,Or={x:"width",y:"height"},s_="crosshair",di={n:"top",w:"left",s:"bottom",e:"right"},CA=1500,Tp={n:"s",w:"e",s:"n",e:"w"},Mp=20;function Xt(e,t,n,r,i,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=r,this._rules=i,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",CA,function(c){var u=c.context,p=u.initialized;p||(p=u.initialized=s.init(c,u)),p&&a_(c)}),n.on("spaceTool.end",function(c){var u=c.context,p=u.axis,l=u.direction,f=u.movingShapes,d=u.resizingShapes,m=u.start;if(u.initialized){a_(c);var g={x:0,y:0};g[p]=SA(c["d"+p]),s.makeSpace(f,d,g,l,m),n.once("spaceTool.ended",function(v){s.activateSelection(v.originalEvent,!0,!0)})}})}Xt.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"];Xt.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:s_,data:{context:{reactivate:n}},trapClick:!1})};Xt.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:s_,data:{context:{}}})};Xt.prototype.makeSpace=function(e,t,n,r,i){return this._modeling.createSpace(e,t,n,r,i)};Xt.prototype.init=function(e,t){var n=Kf(e.dx)>Kf(e.dy)?"x":"y",r=e["d"+n],i=e[n]-r;if(Kf(r)<5)return!1;r<0&&(r*=-1),Tr(e)&&(r*=-1);var o=n_(n,r),a=this._canvas.getRootElement();!Mi(e)&&e.hover&&(a=e.hover);var s=[...Zn(a,!0),...a.attachers||[]],c=this.calculateAdjustments(s,n,r,i),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:i}),p=RA(c,n,o,i,u);return C(t,c,{axis:n,direction:o,spaceToolConstraints:p,start:i}),Di("resize-"+(n==="x"?"ew":"ns")),!0};Xt.prototype.calculateAdjustments=function(e,t,n,r){var i=this._rules,o=[],a=[],s=[],c=[];function u(f){o.includes(f)||o.push(f);var d=f.label;d&&!o.includes(d)&&o.push(d)}function p(f){a.includes(f)||a.push(f)}E(e,function(f){if(!(!f.parent||ee(f))){if(de(f)){c.push(f);return}var d=f[t],m=d+f[Or[t]];if(PA(f)&&(n>0&&X(f)[t]>r||n<0&&X(f)[t]<r)){s.push(f);return}if(n>0&&d>r||n<0&&m<r){u(f);return}if(d<r&&m>r&&i.allowed("shape.resize",{shape:f})){p(f);return}}}),E(o,function(f){var d=f.attachers;d&&E(d,function(m){u(m)})});var l=o.concat(a);return E(s,function(f){var d=f.host;Gi(l,d)&&u(f)}),l=o.concat(a),E(c,function(f){var d=f.source,m=f.target,g=f.label;Gi(l,d)&&Gi(l,m)&&g&&u(g)}),{movingShapes:o,resizingShapes:a}};Xt.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)};Xt.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function o_(e){return{top:e.top-Mp,right:e.right+Mp,bottom:e.bottom+Mp,left:e.left-Mp}}function a_(e){var t=e.context,n=t.spaceToolConstraints;if(n){var r,i;ne(n.left)&&(r=Math.max(e.x,n.left),e.dx=e.dx+r-e.x,e.x=r),ne(n.right)&&(r=Math.min(e.x,n.right),e.dx=e.dx+r-e.x,e.x=r),ne(n.top)&&(i=Math.max(e.y,n.top),e.dy=e.dy+i-e.y,e.y=i),ne(n.bottom)&&(i=Math.min(e.y,n.bottom),e.dy=e.dy+i-e.y,e.y=i)}}function RA(e,t,n,r,i){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u;return E(a,function(p){var l=p.attachers,f=p.children,d=Z(p),m=Q(f,function(L){return!de(L)&&!ee(L)&&!Gi(o,L)&&!Gi(a,L)}),g=Q(f,function(L){return!de(L)&&!ee(L)&&Gi(o,L)}),v,w,S,x=[],b=[],R,A,O,T;m.length&&(w=o_(Z(Ce(m))),v=r-d[di[n]]+w[di[n]],n==="n"?s.bottom=u=ne(u)?Math.min(u,v):v:n==="w"?s.right=u=ne(u)?Math.min(u,v):v:n==="s"?s.top=c=ne(c)?Math.max(c,v):v:n==="e"&&(s.left=c=ne(c)?Math.max(c,v):v)),g.length&&(S=o_(Z(Ce(g))),v=r-S[di[Tp[n]]]+d[di[Tp[n]]],n==="n"?s.bottom=u=ne(u)?Math.min(u,v):v:n==="w"?s.right=u=ne(u)?Math.min(u,v):v:n==="s"?s.top=c=ne(c)?Math.max(c,v):v:n==="e"&&(s.left=c=ne(c)?Math.max(c,v):v)),l&&l.length&&(l.forEach(function(L){Gi(o,L)?x.push(L):b.push(L)}),x.length&&(R=Z(Ce(x.map(X))),A=d[di[Tp[n]]]-(R[di[Tp[n]]]-r)),b.length&&(O=Z(Ce(b.map(X))),T=O[di[n]]-(d[di[n]]-r)),n==="n"?(v=Math.min(A||1/0,T||1/0),s.bottom=u=ne(u)?Math.min(u,v):v):n==="w"?(v=Math.min(A||1/0,T||1/0),s.right=u=ne(u)?Math.min(u,v):v):n==="s"?(v=Math.max(A||-1/0,T||-1/0),s.top=c=ne(c)?Math.max(c,v):v):n==="e"&&(v=Math.max(A||-1/0,T||-1/0),s.left=c=ne(c)?Math.max(c,v):v));var I=i&&i[p.id];I&&(n==="n"?(v=r+p[Or[t]]-I[Or[t]],s.bottom=u=ne(u)?Math.min(u,v):v):n==="w"?(v=r+p[Or[t]]-I[Or[t]],s.right=u=ne(u)?Math.min(u,v):v):n==="s"?(v=r-p[Or[t]]+I[Or[t]],s.top=c=ne(c)?Math.max(c,v):v):n==="e"&&(v=r-p[Or[t]]+I[Or[t]],s.left=c=ne(c)?Math.max(c,v):v))}),s}}function Gi(e,t){return e.indexOf(t)!==-1}function PA(e){return!!e.host}N();var Yf="djs-dragging",c_="djs-resizing",AA=250,Dp=Math.max;function kp(e,t,n,r,i){function o(a,s){E(a,function(c){i.addDragger(c,s),n.addMarker(c,Yf)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},p=U("g");$(p,r.cls("djs-crosshair-group",["no-events"])),J(s,p);var l=U("path");$(l,"d",u.x),pe(l).add("djs-crosshair"),J(p,l);var f=U("path");$(f,"d",u.y),pe(f).add("djs-crosshair"),J(p,f),c.crosshairGroup=p}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Fe(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Pe(c)}),e.on("spaceTool.move",AA,function(a){var s=a.context,c=s.line,u=s.axis,p=s.movingShapes,l=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=U("path"),$(c,"d","M0,0 L0,0"),pe(c).add("djs-crosshair"),J(f,c),s.line=c;var d=U("g");$(d,r.cls("djs-drag-group",["no-events"])),J(n.getActiveLayer(),d),o(p,d);var m=s.movingConnections=t.filter(function(b){var R=!1;E(p,function(I){E(I.outgoing,function(L){b===L&&(R=!0)})});var A=!1;E(p,function(I){E(I.incoming,function(L){b===L&&(A=!0)})});var O=!1;E(l,function(I){E(I.outgoing,function(L){b===L&&(O=!0)})});var T=!1;return E(l,function(I){E(I.incoming,function(L){b===L&&(T=!0)})}),de(b)&&(R||O)&&(A||T)});o(m,d),s.dragGroup=d}if(!s.frameGroup){var g=U("g");$(g,r.cls("djs-frame-group",["no-events"])),J(n.getActiveLayer(),g);var v=[];E(l,function(b){var R=i.addFrame(b,g),A=R.getBBox();v.push({element:R,initialBounds:A}),n.addMarker(b,c_)}),s.frameGroup=g,s.frames=v}var w={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};$(c,{d:w[u]});var S={x:"y",y:"x"},x={x:a.dx,y:a.dy};x[S[s.axis]]=0,Fe(s.dragGroup,x.x,x.y),E(s.frames,function(b){var R=b.element,A=b.initialBounds,O,T;s.direction==="e"?$(R,{width:Dp(A.width+x.x,5)}):(O=Dp(A.width-x.x,5),$(R,{width:O,x:A.x+A.width-O})),s.direction==="s"?$(R,{height:Dp(A.height+x.y,5)}):(T=Dp(A.height-x.y,5),$(R,{height:T,y:A.y+A.height-T}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,p=s.resizingShapes,l=s.line,f=s.dragGroup,d=s.frameGroup;E(c,function(m){n.removeMarker(m,Yf)}),E(u,function(m){n.removeMarker(m,Yf)}),f&&(Pe(l),Pe(f)),E(p,function(m){n.removeMarker(m,c_)}),d&&Pe(d)})}kp.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var u_={__init__:["spaceToolPreview"],__depends__:[kt,Et,fi,Dn,pr],spaceTool:["type",Xt],spaceToolPreview:["type",kp]};N();function ea(e,t){e.invoke(Xt,this),this._canvas=t}ea.$inject=["injector","canvas"];B(ea,Xt);ea.prototype.calculateAdjustments=function(e,t,n,r){var i=this._canvas.getRootElement(),o=e[0]===i?null:e[0],a=[];o&&(a=Sn(wi(i.children.filter(u=>h(u,"bpmn:Artifact")),Ce(o))));let s=[...e,...a];var c=Xt.prototype.calculateAdjustments.call(this,s,t,n,r);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(h(u,"bpmn:TextAnnotation")||TA(u)&&(t==="y"&&Me(u)||t==="x"&&!Me(u)))}),c};function TA(e){return h(e,"bpmn:Participant")&&!j(e).processRef}var Np={__depends__:[u_],spaceTool:["type",ea]};N();function We(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)}We.$inject=["eventBus","injector"];We.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";let n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()};We.prototype.canExecute=function(e,t){let n={command:e,context:t},r=this._getHandler(e),i=this._fire(e,"canExecute",n);if(i===void 0){if(!r)return!1;r.canExecute&&(i=r.canExecute(t))}return i};We.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})};We.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()}};We.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()}};We.prototype.register=function(e,t){this._setHandler(e,t)};We.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");let n=this._injector.instantiate(t);this.register(e,n)};We.prototype.canUndo=function(){return!!this._getUndoAction()};We.prototype.canRedo=function(){return!!this._getRedoAction()};We.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]};We.prototype._getUndoAction=function(){return this._stack[this._stackIdx]};We.prototype._internalUndo=function(e){let t=e.command,n=e.context,r=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),r.revert&&this._markDirty(r.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})};We.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);let r=t?[e+"."+t,t]:[e],i;n=this._eventBus.createEvent(n);for(let o of r)if(i=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return i};We.prototype._createId=function(){return this._uid++};We.prototype._atomicDo=function(e){let t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}};We.prototype._internalExecute=function(e,t){let n=e.command,r=e.context,i=this._getHandler(n);if(!i)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),i.preExecute&&i.preExecute(r),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),i.execute&&this._markDirty(i.execute(r)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),i.postExecute&&i.postExecute(r),this._fire(n,"postExecuted",e)),this._popAction()};We.prototype._pushAction=function(e){let t=this._currentExecution,n=t.actions,r=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=r&&r.id||this._createId()),n.push(e)};We.prototype._popAction=function(){let e=this._currentExecution,t=e.trigger,n=e.actions,r=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:mc("id",r.reverse())}),r.length=0,this._fire("changed",{trigger:t}),e.trigger=null)};We.prototype._markDirty=function(e){let t=this._currentExecution;e&&(e=q(e)?e:[e],t.dirty=t.dirty.concat(e))};We.prototype._executedAction=function(e,t){let n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)};We.prototype._revertedAction=function(e){this._stackIdx--};We.prototype._getHandler=function(e){return this._handlerMap[e]};We.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};var p_={commandStack:["type",We]};N();function kn(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var MA=250,l_=1400;function Gs(e,t,n){k.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",l_,function(i){var o=i.context,a=o.shapes,s=o.validatedShapes;o.shapes=f_(a),o.validatedShapes=f_(s)}),r&&t.on("shape.move.start",MA,function(i){var o=i.context,a=o.shapes,s=[];E(a,function(c){E(c.labels,function(u){!u.hidden&&o.shapes.indexOf(u)===-1&&s.push(u),c.labelTarget&&s.push(c)})}),E(s,function(c){r.makeDraggable(o,c,!0)})}),this.preExecuted("elements.move",l_,function(i){var o=i.context,a=o.closure,s=a.enclosedElements,c=[];E(s,function(u){E(u.labels,function(p){s[p.id]||c.push(p)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(i){var o=i.context,a=o.connection||o.shape;kn(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(i){var o=i.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=co(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(i){var o=i.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(Ae(s.labels,a,c),a.labelTarget=s)})}B(Gs,k);Gs.$inject=["injector","eventBus","modeling"];function f_(e){return Q(e,function(t){return e.indexOf(t.labelTarget)===-1})}var d_={__init__:["labelSupport"],labelSupport:["type",Gs]};N();var DA=251,m_=1401,h_="attach-ok";function Vs(e,t,n,r,i){k.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",m_,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=kA(c),s.validatedShapes=NA(u)}),o&&t.on("shape.move.start",DA,function(a){var s=a.context,c=s.shapes,u=Xf(c);E(u,function(p){o.makeDraggable(s,p,!0),E(p.labels,function(l){o.makeDraggable(s,l,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],p=u.host;p&&(n.addMarker(p,h_),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(p,h_)}))}}),this.preExecuted("elements.move",m_,function(a){var s=a.context,c=s.closure,u=s.shapes,p=Xf(u);E(p,function(l){c.add(l,c.topLevel[l.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,p;u&&c.length!==1||(u?p=c:p=Q(c,function(l){var f=l.host;return OA(l)&&!BA(c,f)}),E(p,function(l){i.updateAttachment(l,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;E(s,function(c){E(c.attachers,function(u){E(u.outgoing.slice(),function(p){var l=r.allowed("connection.reconnect",{connection:p,source:p.source,target:p.target});l||i.removeConnection(p)}),E(u.incoming.slice(),function(p){var l=r.allowed("connection.reconnect",{connection:p,source:p.source,target:p.target});l||i.removeConnection(p)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&i.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;kn(c.attachers,function(p){var l=r.allowed("elements.move",{target:u,shapes:[p]});l==="attach"?i.updateAttachment(p,u):i.removeShape(p)}),u.attachers.length&&E(u.attachers,function(p){var l=If(p,c,u);i.moveShape(p,l,p.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,p=s.newBounds,l=c.attachers,f=s.hints||{};f.attachSupport!==!1&&E(l,function(d){var m=If(d,u,p);i.moveShape(d,m,d.parent),E(d.labels,function(g){i.moveShape(g,m,g.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;kn(s.attachers,function(c){i.removeShape(c)}),s.host&&i.updateAttachment(s,null)})}B(Vs,k);Vs.$inject=["injector","eventBus","canvas","rules","modeling"];function Xf(e){return _i(je(e,function(t){return t.attachers||[]}))}function kA(e){var t=Xf(e);return gl("id",e,t)}function NA(e){var t=Vt(e,"id");return Q(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function OA(e){return!!e.host}function BA(e,t){return e.indexOf(t)!==-1}var v_={__depends__:[Et],__init__:["attachSupport"],attachSupport:["type",Vs]};N();function an(e){this._model=e}an.$inject=["moddle"];an.prototype._needsId=function(e){return te(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"])};an.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;h(e,"bpmn:Activity")?t="Activity":h(e,"bpmn:Event")?t="Event":h(e,"bpmn:Gateway")?t="Gateway":te(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))};an.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n};an.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})};an.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",C({bpmnElement:e,bounds:this.createDiBounds()},t))};an.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)};an.prototype.createDiWaypoints=function(e){var t=this;return je(e,function(n){return t.createDiWaypoint(n)})};an.prototype.createDiWaypoint=function(e){return this.create("dc:Point",mt(e,["x","y"]))};an.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",C({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))};an.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",C({bpmnElement:e},t))};N();function $t(e,t,n){k.call(this,e),this._bpmnFactory=t;var r=this;function i(d){var m=d.context,g=m.hints||{},v;!m.cropped&&g.createElementsBehavior!==!1&&(v=m.connection,v.waypoints=n.getCroppedWaypoints(v),m.cropped=!0)}this.executed(["connection.layout","connection.create"],i),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var m=d.context;r.updateParent(m.shape||m.connection,m.oldParent)}function a(d){var m=d.context,g=m.shape||m.connection,v=m.parent||m.newParent;r.updateParent(g,v)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],sn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],sn(a));function s(d){var m=d.context,g=m.oldRoot,v=g.children;E(v,function(w){h(w,"bpmn:BaseElement")&&r.updateParent(w)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var m=d.context.shape;h(m,"bpmn:BaseElement")&&r.updateBounds(m)}this.executed(["shape.move","shape.create","shape.resize"],sn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],sn(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function u(d){r.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],sn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],sn(u));function p(d){r.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],sn(p)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],sn(p)),this.executed("connection.reconnect",sn(function(d){var m=d.context,g=m.connection,v=m.oldSource,w=m.newSource,S=j(g),x=j(v),b=j(w);S.conditionExpression&&!te(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=S.conditionExpression,delete S.conditionExpression),v!==w&&x.default===S&&(m.oldDefault=x.default,delete x.default)})),this.reverted("connection.reconnect",sn(function(d){var m=d.context,g=m.connection,v=m.oldSource,w=m.newSource,S=j(g),x=j(v),b=j(w);m.oldConditionExpression&&(S.conditionExpression=m.oldConditionExpression),m.oldDefault&&(x.default=m.oldDefault,delete b.default)}));function l(d){r.updateAttachment(d.context)}this.executed(["element.updateAttachment"],sn(l)),this.reverted(["element.updateAttachment"],sn(l)),this.executed("element.updateLabel",sn(f)),this.reverted("element.updateLabel",sn(f));function f(d){let{element:m}=d.context,g=gt(m),v=ce(m),w=v&&v.get("label");mn(m)||Eo(m)||(g&&!w?v.set("label",t.create("bpmndi:BPMNLabel")):!g&&w&&v.set("label",void 0))}}B($t,k);$t.$inject=["eventBus","bpmnFactory","connectionDocking"];$t.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,r=t.host;n.attachedToRef=r&&r.businessObject};$t.prototype.updateParent=function(e,t){if(!ee(e)&&!(h(e,"bpmn:DataStoreReference")&&e.parent&&h(e.parent,"bpmn:Collaboration"))){var n=e.parent,r=e.businessObject,i=ce(e),o=n&&n.businessObject,a=ce(n);h(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(r,o,t&&t.businessObject),h(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),h(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(r,o),h(e,"bpmn:DataObjectReference")&&r.dataObjectRef&&this.updateSemanticParent(r.dataObjectRef,o),this.updateDiParent(i,a)}};$t.prototype.updateBounds=function(e){var t=ce(e),n=LA(e);if(n){var r=Dt(n,t.get("bounds"));C(n,{x:e.x+r.x,y:e.y+r.y})}var i=ee(e)?this._getLabel(t):t,o=i.bounds;o||(o=this._bpmnFactory.createDiBounds(),i.set("bounds",o)),C(o,{x:e.x,y:e.y,width:e.width,height:e.height})};$t.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var r,i;h(n,"bpmn:Lane")&&(r=n.get("flowNodeRef"),Oe(r,e)),h(t,"bpmn:Lane")&&(i=t.get("flowNodeRef"),Ae(i,e))}};$t.prototype.updateDiConnection=function(e,t,n){var r=ce(e),i=ce(t),o=ce(n);r.sourceElement&&r.sourceElement.bpmnElement!==j(t)&&(r.sourceElement=t&&i),r.targetElement&&r.targetElement.bpmnElement!==j(n)&&(r.targetElement=n&&o)};$t.prototype.updateDiParent=function(e,t){if(t&&!h(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Oe(n,e),e.$parent=null)}};function IA(e){for(;e&&!h(e,"bpmn:Definitions");)e=e.$parent;return e}$t.prototype.getLaneSet=function(e){var t,n;return h(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(h(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)};$t.prototype.updateSemanticParent=function(e,t,n){var r;if(e.$parent!==t&&!((h(e,"bpmn:DataInput")||h(e,"bpmn:DataOutput"))&&(h(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(h(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),r="lanes";else if(h(e,"bpmn:FlowElement")){if(t){if(h(t,"bpmn:Participant"))t=t.processRef;else if(h(t,"bpmn:Lane"))do t=t.$parent.$parent;while(h(t,"bpmn:Lane"))}r="flowElements"}else if(h(e,"bpmn:Artifact")){for(;t&&!h(t,"bpmn:Process")&&!h(t,"bpmn:SubProcess")&&!h(t,"bpmn:Collaboration");)if(h(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;r="artifacts"}else if(h(e,"bpmn:MessageFlow"))r="messageFlows";else if(h(e,"bpmn:Participant")){r="participants";var i=e.processRef,o;i&&(o=IA(e.$parent||t),e.$parent&&(Oe(o.get("rootElements"),i),i.$parent=null),t&&(Ae(o.get("rootElements"),i),i.$parent=o))}else h(e,"bpmn:DataOutputAssociation")?r="dataOutputAssociations":h(e,"bpmn:DataInputAssociation")&&(r="dataInputAssociations");if(!r)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(r),Oe(a,e)),t?(a=t.get(r),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(r);Oe(a,e),t&&(s||(s=[],t.set(r,s)),s.push(e))}}};$t.prototype.updateConnectionWaypoints=function(e){var t=ce(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))};$t.prototype.updateConnection=function(e){var t=e.connection,n=j(t),r=t.source,i=j(r),o=t.target,a=j(t.target),s;if(h(n,"bpmn:DataAssociation"))h(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=i,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):h(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||i,this.updateSemanticParent(n,i,s),n.targetRef=a);else{var c=h(n,"bpmn:SequenceFlow");n.sourceRef!==i&&(c&&(Oe(n.sourceRef&&n.sourceRef.get("outgoing"),n),i&&i.get("outgoing")&&i.get("outgoing").push(n)),n.sourceRef=i),n.targetRef!==a&&(c&&(Oe(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,r,o)};$t.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function sn(e){return function(t){var n=t.context,r=n.shape||n.connection||n.element;h(r,"bpmn:BaseElement")&&e(t)}}function LA(e){if(h(e,"bpmn:Activity")){var t=ce(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}N();function lr(e,t){Pn.call(this),this._bpmnFactory=e,this._moddle=t}B(lr,Pn);lr.$inject=["bpmnFactory","moddle"];lr.prototype._baseCreate=Pn.prototype.create;lr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,C({type:"label",di:n},ir,t))}return this.createElement(e,t)};lr.prototype.createElement=function(e,t){t=C({},t||{});var n,r=t.businessObject,i=t.di;if(!r){if(!t.type)throw new Error("no shape type specified");r=this._bpmnFactory.create(t.type)}if(!FA(i)){var o=C({},i||{},{id:r.id+"_di"});e==="root"?i=this._bpmnFactory.createDiPlane(r,o):e==="connection"?i=this._bpmnFactory.createDiEdge(r,o):i=this._bpmnFactory.createDiShape(r,o)}h(r,"bpmn:Group")&&(t=C({isFrame:!0},t)),t=jA(r,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Zf(i,t,"isExpanded")),te(r,["bpmn:Lane","bpmn:Participant"])&&(t=Zf(i,t,"isHorizontal")),h(r,"bpmn:SubProcess")&&(t.collapsed=!ie(r,i)),h(r,"bpmn:ExclusiveGateway")&&(dt(i,"isMarkerVisible")?i.isMarkerVisible===void 0&&(i.isMarkerVisible=!1):i.isMarkerVisible=!0),Ue(t.triggeredByEvent)&&(r.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Ue(t.cancelActivity)&&(r.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=r.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=r,r.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(r,i),t=C({id:r.id},n,t,{businessObject:r,di:i}),this._baseCreate(e,t)};lr.prototype.getDefaultSize=function(e,t){var n=j(e);if(t=t||ce(e),h(n,"bpmn:SubProcess"))return ie(n,t)?{width:350,height:200}:{width:100,height:80};if(h(n,"bpmn:Task"))return{width:100,height:80};if(h(n,"bpmn:Gateway"))return{width:50,height:50};if(h(n,"bpmn:Event"))return{width:36,height:36};if(h(n,"bpmn:Participant")){var r=t.isHorizontal===void 0||t.isHorizontal===!0;return ie(n,t)?r?{width:600,height:250}:{width:250,height:600}:r?{width:400,height:60}:{width:60,height:400}}return h(n,"bpmn:Lane")?{width:400,height:100}:h(n,"bpmn:DataObjectReference")?{width:36,height:50}:h(n,"bpmn:DataStoreReference")?{width:50,height:50}:h(n,"bpmn:TextAnnotation")?{width:100,height:40}:h(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}};lr.prototype.createParticipantShape=function(e){return Se(e)||(e={isExpanded:e}),e=C({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function jA(e,t,n){return E(n,function(r){t=Zf(e,t,r)}),t}function Zf(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Nt(t,[n]))}function FA(e){return te(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}N();N();function ta(e,t){this._modeling=e,this._canvas=t}ta.$inject=["modeling","canvas"];ta.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,r=e.alignment;E(n,function(i){var o={x:0,y:0};Ue(r.left)?o.x=r.left-i.x:Ue(r.right)?o.x=r.right-i.width-i.x:Ue(r.center)?o.x=r.center-Math.round(i.width/2)-i.x:Ue(r.top)?o.y=r.top-i.y:Ue(r.bottom)?o.y=r.bottom-i.height-i.y:Ue(r.middle)&&(o.y=r.middle-Math.round(i.height/2)-i.y),t.moveElements([i],o,i.parent)})};ta.prototype.postExecute=function(e){};N();function na(e){this._modeling=e}na.$inject=["modeling"];na.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,r=e.shape,i=e.hints||{};r=e.shape=this._modeling.createShape(r,e.position,n,{attach:i.attach}),e.shape=r};na.prototype.postExecute=function(e){var t=e.hints||{};HA(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 HA(e,t){return Lt(e.outgoing,function(n){return n.target===t})}function ra(e,t){this._canvas=e,this._layouter=t}ra.$inject=["canvas","layouter"];ra.prototype.execute=function(e){var t=e.connection,n=e.source,r=e.target,i=e.parent,o=e.parentIndex,a=e.hints;if(!n||!r)throw new Error("source and target required");if(!i)throw new Error("parent required");return t.source=n,t.target=r,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,i,o),t};ra.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};N();var Op=Math.round;function Ws(e){this._modeling=e}Ws.$inject=["modeling"];Ws.prototype.preExecute=function(e){var t=e.elements,n=e.parent,r=e.parentIndex,i=e.position,o=e.hints,a=this._modeling;E(t,function(l){ne(l.x)||(l.x=0),ne(l.y)||(l.y=0)});var s=Q(t,function(l){return!l.hidden}),c=Ce(s);E(t,function(l){de(l)&&(l.waypoints=je(l.waypoints,function(f){return{x:Op(f.x-c.x-c.width/2+i.x),y:Op(f.y-c.y-c.height/2+i.y)}})),C(l,{x:Op(l.x-c.x-c.width/2+i.x),y:Op(l.y-c.y-c.height/2+i.y)})});var u=zr(t),p={};E(t,function(l){if(de(l)){p[l.id]=ne(r)?a.createConnection(p[l.source.id],p[l.target.id],r,l,l.parent||n,o):a.createConnection(p[l.source.id],p[l.target.id],l,l.parent||n,o);return}var f=C({},o);u.indexOf(l)===-1&&(f.autoResize=!1),ee(l)&&(f=Nt(f,["attach"])),p[l.id]=ne(r)?a.createShape(l,mt(l,["x","y","width","height"]),l.parent||n,r,f):a.createShape(l,mt(l,["x","y","width","height"]),l.parent||n,f)}),e.elements=Sn(p)};N();var g_=Math.round;function Wn(e){this._canvas=e}Wn.$inject=["canvas"];Wn.prototype.execute=function(e){var t=e.shape,n=e.position,r=e.parent,i=e.parentIndex;if(!r)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?C(t,n):C(t,{x:n.x-g_(t.width/2),y:n.y-g_(t.height/2)}),this._canvas.addShape(t,r,i),t};Wn.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Vi(e){Wn.call(this,e)}B(Vi,Wn);Vi.$inject=["canvas"];var $A=Wn.prototype.execute;Vi.prototype.execute=function(e){var t=e.shape;return GA(t),t.labelTarget=e.labelTarget,$A.call(this,e)};var zA=Wn.prototype.revert;Vi.prototype.revert=function(e){return e.shape.labelTarget=null,zA.call(this,e)};function GA(e){["width","height"].forEach(function(t){typeof e[t]=="undefined"&&(e[t]=0)})}function Wi(e,t){this._canvas=e,this._modeling=t}Wi.$inject=["canvas","modeling"];Wi.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;kn(n.incoming,function(r){t.removeConnection(r,{nested:!0})}),kn(n.outgoing,function(r){t.removeConnection(r,{nested:!0})})};Wi.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=co(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t};Wi.prototype.revert=function(e){var t=e.connection,n=e.parent,r=e.parentIndex;return t.source=e.source,t.target=e.target,Ae(n.children,t,r),this._canvas.addConnection(t,n),t};N();function Us(e,t){this._modeling=e,this._elementRegistry=t}Us.$inject=["modeling","elementRegistry"];Us.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,r=e.elements;E(r,function(i){n.get(i.id)&&(i.waypoints?t.removeConnection(i):t.removeShape(i))})};function Ui(e,t){this._canvas=e,this._modeling=t}Ui.$inject=["canvas","modeling"];Ui.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;kn(n.incoming,function(r){t.removeConnection(r,{nested:!0})}),kn(n.outgoing,function(r){t.removeConnection(r,{nested:!0})}),kn(n.children,function(r){de(r)?t.removeConnection(r,{nested:!0}):t.removeShape(r,{nested:!0})})};Ui.prototype.execute=function(e){var t=this._canvas,n=e.shape,r=n.parent;return e.oldParent=r,e.oldParentIndex=co(r.children,n),t.removeShape(n),n};Ui.prototype.revert=function(e){var t=this._canvas,n=e.shape,r=e.oldParent,i=e.oldParentIndex;return Ae(r.children,n,i),t.addShape(n,r),n};N();function ia(e){this._modeling=e}ia.$inject=["modeling"];var y_={x:"y",y:"x"};ia.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,r=e.axis,i=e.dimension;function o(v,w){v.range.min=Math.min(w[r],v.range.min),v.range.max=Math.max(w[r]+w[i],v.range.max)}function a(v){return v[r]+v[i]/2}function s(v){return v.length-1}function c(v){return v.max-v.min}function u(v,w){var S={y:0};S[r]=v-a(w),S[r]&&(S[y_[r]]=0,t.moveElements([w],S,w.parent))}var p=n[0],l=s(n),f=n[l],d,m,g=0;E(n,function(v,w){var S,x,b;if(v.elements.length<2){w&&w!==n.length-1&&(o(v,v.elements[0]),g+=c(v.range));return}S=At(v.elements,r),x=S[0],w===l&&(x=S[s(S)]),b=a(x),v.range=null,E(S,function(R){if(u(b,R),v.range===null){v.range={min:R[r],max:R[r]+R[i]};return}o(v,R)}),w&&w!==n.length-1&&(g+=c(v.range))}),m=Math.abs(f.range.min-p.range.max),d=Math.round((m-g)/(n.length-1)),!(d<n.length-1)&&E(n,function(v,w){var S={},x;v===p||v===f||(x=n[w-1],v.range.max=0,E(v.elements,function(b,R){S[y_[r]]=0,S[r]=x.range.max-b[r]+d,v.range.min!==b[r]&&(S[r]+=b[r]-v.range.min),S[r]&&t.moveElements([b],S,b.parent),v.range.max=Math.max(b[r]+b[i],R?v.range.max:0)}))})};ia.prototype.postExecute=function(e){};N();function oa(e,t){this._layouter=e,this._canvas=t}oa.$inject=["layouter","canvas"];oa.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return C(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t};oa.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};N();function qs(){}qs.prototype.execute=function(e){var t=e.connection,n=e.delta,r=e.newParent||t.parent,i=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=Oe(o.children,t),Ae(r.children,t,i),t.parent=r,E(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};qs.prototype.revert=function(e){var t=e.connection,n=t.parent,r=e.oldParent,i=e.oldParentIndex,o=e.delta;return Oe(n.children,t),Ae(r.children,t,i),t.parent=r,E(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};N();N();function Ks(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Ks.prototype.add=function(e,t){return this.addAll([e],t)};Ks.prototype.addAll=function(e,t){var n=hm(e,!!t,this);return C(this,n),this};function mi(e){this._modeling=e}mi.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]};mi.prototype.moveClosure=function(e,t,n,r,i){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,p=!1;i&&i.parent===n&&(p=!0),E(a,function(l){o.moveShape(l,t,u[l.id]&&!p&&n,{recurse:!1,layout:!1})}),E(s,function(l){var f=!!a[l.source.id],d=!!a[l.target.id];c[l.id]&&f&&d?o.moveConnection(l,t,u[l.id]&&!p&&n):o.layoutConnection(l,{connectionStart:f&&Uo(l,l.source,t),connectionEnd:d&&qo(l,l.target,t)})})};mi.prototype.getClosure=function(e){return new Ks().addAll(e,!0)};function aa(e){this._helper=new mi(e)}aa.$inject=["modeling"];aa.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)};aa.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)};N();function Br(e){this._modeling=e,this._helper=new mi(e)}Br.$inject=["modeling"];Br.prototype.execute=function(e){var t=e.shape,n=e.delta,r=e.newParent||t.parent,i=e.newParentIndex,o=t.parent;return e.oldBounds=mt(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Oe(o.children,t),Ae(r.children,t,i),C(t,{parent:r,x:t.x+n.x,y:t.y+n.y}),t};Br.prototype.postExecute=function(e){var t=e.shape,n=e.delta,r=e.hints,i=this._modeling;r.layout!==!1&&(E(t.incoming,function(o){i.layoutConnection(o,{connectionEnd:qo(o,t,n)})}),E(t.outgoing,function(o){i.layoutConnection(o,{connectionStart:Uo(o,t,n)})})),r.recurse!==!1&&this.moveChildren(e)};Br.prototype.revert=function(e){var t=e.shape,n=e.oldParent,r=e.oldParentIndex,i=e.delta;return Ae(n.children,t,r),C(t,{parent:n,x:t.x-i.x,y:t.y-i.y}),t};Br.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)};Br.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};N();function qi(e){this._modeling=e}qi.$inject=["modeling"];qi.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,r=e.connection,i=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return q(i)&&(e.oldWaypoints=r.waypoints,r.waypoints=i),t&&(e.oldSource=r.source,r.source=t),n&&(e.oldTarget=r.target,r.target=n),r};qi.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,r=e.newTarget,i=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!r||o.docking==="source")&&(a.connectionStart=a.connectionStart||__(q(i)?i[0]:i)),r&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||__(q(i)?i[i.length-1]:i)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))};qi.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,r=e.oldWaypoints,i=e.connection;return t&&(i.source=t),n&&(i.target=n),r&&(i.waypoints=r),i};function __(e){return e.original||e}N();function Un(e,t){this._modeling=e,this._rules=t}Un.$inject=["modeling","rules"];Un.prototype.preExecute=function(e){var t=this,n=this._modeling,r=this._rules,i=e.oldShape,o=e.newData,a=e.hints||{},s;function c(m,g,v){return r.allowed("connection.reconnect",{connection:v,source:m,target:g})}var u={x:o.x,y:o.y},p={x:i.x,y:i.y,width:i.width,height:i.height};s=e.newShape=e.newShape||t.createShape(o,u,i.parent,a),i.host&&n.updateAttachment(s,i.host);var l;a.moveChildren!==!1&&(l=i.children.slice(),n.moveElements(l,{x:0,y:0},s,a));var f=i.incoming.slice(),d=i.outgoing.slice();E(f,function(m){var g=m.source,v=c(g,s,m);v&&t.reconnectEnd(m,s,ui(m,s,p),a)}),E(d,function(m){var g=m.target,v=c(s,g,m);v&&t.reconnectStart(m,s,ci(m,s,p),a)})};Un.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)};Un.prototype.execute=function(e){};Un.prototype.revert=function(e){};Un.prototype.createShape=function(e,t,n,r){return this._modeling.createShape(e,t,n,r)};Un.prototype.reconnectStart=function(e,t,n,r){this._modeling.reconnectStart(e,t,n,r)};Un.prototype.reconnectEnd=function(e,t,n,r){this._modeling.reconnectEnd(e,t,n,r)};N();function Ki(e){this._modeling=e}Ki.$inject=["modeling"];Ki.prototype.execute=function(e){var t=e.shape,n=e.newBounds,r=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(r&&(n.width<r.width||n.height<r.height))throw new Error("width and height cannot be less than minimum height and width");if(!r&&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},C(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};Ki.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,r=e.oldBounds,i=e.hints||{};i.layout!==!1&&(E(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:ui(o,n,r)})}),E(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:ci(o,n,r)})}))};Ki.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return C(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};N();function fr(e){this._modeling=e}fr.$inject=["modeling"];fr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,r=e.movingShapes,i=e.resizingShapes,o=e.start,a={};this.moveShapes(r,t),E(i,function(s){a[s.id]=WA(s)}),this.resizeShapes(i,t,n),this.updateConnectionWaypoints(r_(r,i),t,n,o,r,i,a)};fr.prototype.execute=function(){};fr.prototype.revert=function(){};fr.prototype.moveShapes=function(e,t){var n=this;E(e,function(r){n._modeling.moveShape(r,t,null,{autoResize:!1,layout:!1,recurse:!1})})};fr.prototype.resizeShapes=function(e,t,n){var r=this;E(e,function(i){var o=i_(i,n,t);r._modeling.resizeShape(i,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})};fr.prototype.updateConnectionWaypoints=function(e,t,n,r,i,o,a){var s=this,c=i.concat(o);E(e,function(u){var p=u.source,l=u.target,f=VA(u),d=E_(n),m={};hi(c,p)&&hi(c,l)?(f=je(f,function(g){return x_(g,r,n)&&(g[d]=g[d]+t[d]),g.original&&x_(g.original,r,n)&&(g.original[d]=g.original[d]+t[d]),g}),s._modeling.updateWaypoints(u,f,{labelBehavior:!1})):(hi(c,p)||hi(c,l))&&(hi(i,p)?m.connectionStart=Uo(u,p,t):hi(i,l)?m.connectionEnd=qo(u,l,t):hi(o,p)?m.connectionStart=ci(u,p,a[p.id]):hi(o,l)&&(m.connectionEnd=ui(u,l,a[l.id])),s._modeling.layoutConnection(u,m))})};function b_(e){return C({},e)}function VA(e){return je(e.waypoints,function(t){return t=b_(t),t.original&&(t.original=b_(t.original)),t})}function E_(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function x_(e,t,n){var r=E_(n);if(/e|s/.test(n))return e[r]>t;if(/n|w/.test(n))return e[r]<t}function hi(e,t){return e.indexOf(t)!==-1}function WA(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}N();function sa(e){this._modeling=e}sa.$inject=["modeling"];sa.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=w_(n),t.collapsed=!t.collapsed;var r=S_(n,t.collapsed);return[t].concat(r)};sa.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,r=t.children,i=C_(r,n);return t.collapsed=!t.collapsed,[t].concat(i)};function w_(e){var t={};return E(e,function(n){t[n.id]=n.hidden,n.children&&(t=C({},t,w_(n.children)))}),t}function S_(e,t){var n=[];return E(e,function(r){r.hidden=t,n=n.concat(r),r.children&&(n=n.concat(S_(r.children,r.collapsed||t)))}),n}function C_(e,t){var n=[];return E(e,function(r){r.hidden=t[r.id],n=n.concat(r),r.children&&(n=n.concat(C_(r.children,t)))}),n}function ca(e){this._modeling=e}ca.$inject=["modeling"];ca.prototype.execute=function(e){var t=e.shape,n=e.newHost,r=t.host;return e.oldHost=r,e.attacherIdx=R_(r,t),P_(n,t),t.host=n,t};ca.prototype.revert=function(e){var t=e.shape,n=e.newHost,r=e.oldHost,i=e.attacherIdx;return t.host=r,R_(n,t),P_(r,t,i),t};function R_(e,t){return Oe(e&&e.attachers,t)}function P_(e,t,n){if(e){var r=e.attachers;r||(e.attachers=r=[]),Ae(r,t,n)}}function Ys(){}Ys.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t};Ys.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function De(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var r=this;e.on("diagram.init",function(){r.registerHandlers(n)})}De.$inject=["eventBus","elementFactory","commandStack"];De.prototype.getHandlers=function(){return{"shape.append":na,"shape.create":Wn,"shape.delete":Ui,"shape.move":Br,"shape.resize":Ki,"shape.replace":Un,"shape.toggleCollapse":sa,spaceTool:fr,"label.create":Vi,"connection.create":ra,"connection.delete":Wi,"connection.move":qs,"connection.layout":oa,"connection.updateWaypoints":Ys,"connection.reconnect":qi,"elements.create":Ws,"elements.move":aa,"elements.delete":Us,"elements.distribute":ia,"elements.align":ta,"element.updateAttachment":ca}};De.prototype.registerHandlers=function(e){E(this.getHandlers(),function(t,n){e.registerHandler(n,t)})};De.prototype.moveShape=function(e,t,n,r,i){typeof r=="object"&&(i=r,r=null);var o={shape:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute("shape.move",o)};De.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)};De.prototype.moveElements=function(e,t,n,r){r=r||{};var i=r.attach,o=n,a;i===!0?(a=n,o=n.parent):i===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:r};this._commandStack.execute("elements.move",s)};De.prototype.moveConnection=function(e,t,n,r,i){typeof r=="object"&&(i=r,r=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute("connection.move",o)};De.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)};De.prototype.createConnection=function(e,t,n,r,i,o){typeof n=="object"&&(o=i,i=r,r=n,n=void 0),r=this._create("connection",r);var a={source:e,target:t,parent:i,parentIndex:n,connection:r,hints:o};return this._commandStack.execute("connection.create",a),a.connection};De.prototype.createShape=function(e,t,n,r,i){typeof r!="number"&&(i=r,r=void 0),i=i||{};var o=i.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:r,host:s,hints:i};return this._commandStack.execute("shape.create",c),c.shape};De.prototype.createElements=function(e,t,n,r,i){q(e)||(e=[e]),typeof r!="number"&&(i=r,r=void 0),i=i||{};var o={position:t,elements:e,parent:n,parentIndex:r,hints:i};return this._commandStack.execute("elements.create",o),o.elements};De.prototype.createLabel=function(e,t,n,r){n=this._create("label",n);var i={labelTarget:e,position:t,parent:r||e.parent,shape:n};return this._commandStack.execute("label.create",i),i.shape};De.prototype.appendShape=function(e,t,n,r,i){i=i||{},t=this._create("shape",t);var o={source:e,position:n,target:r,shape:t,connection:i.connection,connectionParent:i.connectionParent,hints:i};return this._commandStack.execute("shape.append",o),o.shape};De.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)};De.prototype.distributeElements=function(e,t,n){var r={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",r)};De.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)};De.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)};De.prototype.replaceShape=function(e,t,n){var r={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",r),r.newShape};De.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)};De.prototype.resizeShape=function(e,t,n,r){var i={shape:e,newBounds:t,minBounds:n,hints:r};this._commandStack.execute("shape.resize",i)};De.prototype.createSpace=function(e,t,n,r,i){var o={delta:n,direction:r,movingShapes:e,resizingShapes:t,start:i};this._commandStack.execute("spaceTool",o)};De.prototype.updateWaypoints=function(e,t,n){var r={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",r)};De.prototype.reconnect=function(e,t,n,r,i){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:r,hints:i||{}};this._commandStack.execute("connection.reconnect",o)};De.prototype.reconnectStart=function(e,t,n,r){r||(r={}),this.reconnect(e,t,e.target,n,C(r,{docking:"source"}))};De.prototype.reconnectEnd=function(e,t,n,r){r||(r={}),this.reconnect(e,e.source,t,n,C(r,{docking:"target"}))};De.prototype.connect=function(e,t,n,r){return this.createConnection(e,t,n||{},e.parent,r)};De.prototype._create=function(e,t){return zm(t)?t:this._elementFactory.create(e,t)};De.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};N();function Yi(e){this._elementRegistry=e}Yi.$inject=["elementRegistry"];Yi.prototype.execute=function(e){var t=e.element,n=e.moddleElement,r=e.properties;if(!n)throw new Error("<moddleElement> required");var i=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||UA(n,bi(r));return A_(n,r),e.oldProperties=o,e.changed=i,i};Yi.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,r=e.changed;return A_(n,t),r};Yi.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return h(e,"bpmn:DataObject")?qA(e,t):[]};function UA(e,t){return Ge(t,function(n,r){return n[r]=e.get(r),n},{})}function A_(e,t){E(t,function(n,r){e.set(r,n)})}function qA(e,t){return t.filter(function(n){return h(n,"bpmn:DataObjectReference")&&j(n).dataObjectRef===e})}N();var Xs="default",Ir="id",T_="di",KA={width:0,height:0};function Xi(e,t,n,r){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=r}Xi.$inject=["elementRegistry","moddle","modeling","textRenderer"];Xi.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var r=this._elementRegistry,i=this._moddle.ids,o=t.businessObject,a=JA(e.properties),s=e.oldProperties||YA(t,a);return M_(a,o)&&(i.unclaim(o[Ir]),r.updateId(t,a[Ir]),i.claim(a[Ir],o)),Xs in a&&(a[Xs]&&n.push(r.get(a[Xs].id)),o[Xs]&&n.push(r.get(o[Xs].id))),D_(t,a),e.oldProperties=s,e.changed=n,n};Xi.prototype.postExecute=function(e){var t=e.element,n=t.label,r=n&&j(n).name;if(r){var i=this._textRenderer.getExternalLabelBounds(n,r);this._modeling.resizeShape(n,i,KA)}};Xi.prototype.revert=function(e){var t=e.element,n=e.properties,r=e.oldProperties,i=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return D_(t,r),M_(n,i)&&(a.unclaim(n[Ir]),o.updateId(t,r[Ir]),a.claim(r[Ir],i)),e.changed};function M_(e,t){return Ir in e&&e[Ir]!==t[Ir]}function YA(e,t){var n=bi(t),r=e.businessObject,i=ce(e);return Ge(n,function(o,a){return a!==T_?o[a]=r.get(a):o[a]=XA(i,bi(t.di)),o},{})}function XA(e,t){return Ge(t,function(n,r){return n[r]=e&&e.get(r),n},{})}function D_(e,t){var n=e.businessObject,r=ce(e);E(t,function(i,o){o!==T_?n.set(o,i):r&&ZA(r,i)})}function ZA(e,t){E(t,function(n,r){e.set(r,n)})}var QA=["default"];function JA(e){var t=C({},e);return QA.forEach(function(n){n in e&&(t[n]=j(t[n]))}),t}function ua(e,t){this._canvas=e,this._modeling=t}ua.$inject=["canvas","modeling"];ua.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=t.getRootElement(),o=i.businessObject,a=o.$parent,s=ce(i);return t.setRootElement(n),t.removeRootElement(i),Ae(a.rootElements,r),r.$parent=a,Oe(a.rootElements,o),o.$parent=null,i.di=null,s.bpmnElement=r,n.di=s,e.oldRoot=i,[]};ua.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=e.oldRoot,o=i.businessObject,a=r.$parent,s=ce(n);return t.setRootElement(i),t.removeRootElement(n),Oe(a.rootElements,r),r.$parent=null,Ae(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,i.di=s,[]};N();function Zs(e,t){this._modeling=e,this._spaceTool=t}Zs.$inject=["modeling","spaceTool"];Zs.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,r=e.shape,i=e.location,o=Bt(r),a=o===r,s=a?r:r.parent,c=yn(s),u=Me(r);if(u?i==="left"?i="top":i==="right"&&(i="bottom"):i==="top"?i="left":i==="bottom"&&(i="right"),!c.length){var p=u?{x:r.x+on,y:r.y,width:r.width-on,height:r.height}:{x:r.x,y:r.y+on,width:r.width,height:r.height-on};n.createShape({type:"bpmn:Lane",isHorizontal:u},p,s)}var l=[];In(o,function(b){return l.push(b),b.label&&l.push(b.label),b===r?[]:Q(b.children,function(R){return R!==r})});var f,d,m,g,v;i==="top"?(f=-120,d=r.y,m=d+10,g="n",v="y"):i==="left"?(f=-120,d=r.x,m=d+10,g="w",v="x"):i==="bottom"?(f=120,d=r.y+r.height,m=d-10,g="s",v="y"):i==="right"&&(f=120,d=r.x+r.width,m=d-10,g="e",v="x");var w=t.calculateAdjustments(l,v,f,m),S=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(w.movingShapes,w.resizingShapes,S,g,m);var x=u?{x:r.x+(a?on:0),y:d-(i==="top"?120:0),width:r.width-(a?on:0),height:120}:{x:d-(i==="left"?120:0),y:r.y+(a?on:0),width:120,height:r.height-(a?on:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,s)};function Qs(e){this._modeling=e}Qs.$inject=["modeling"];Qs.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,r=e.count,i=yn(n),o=i.length;if(o>r)throw new Error(`more than <${r}> child lanes`);var a=Me(n),s=a?n.height:n.width,c=Math.round(s/r),u,p,l,f;for(f=0;f<r;f++)f===r-1?u=s-c*f:u=c,p=a?{x:n.x+on,y:n.y+f*c,width:n.width-on,height:u}:{x:n.x+f*c,y:n.y+on,width:u,height:n.height-on},f<o?t.resizeShape(i[f],p):(l={type:"bpmn:Lane",isHorizontal:a},t.createShape(l,p,n))};function Zi(e,t){this._modeling=e,this._spaceTool=t}Zi.$inject=["modeling","spaceTool"];Zi.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,r=e.balanced;r!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)};Zi.prototype.resizeBalanced=function(e,t){var n=this._modeling,r=Lg(e,t);n.resizeShape(e,t),r.forEach(function(i){n.resizeShape(i.shape,i.newBounds)})};Zi.prototype.resizeSpace=function(e,t){var n=this._spaceTool,r=Z(e),i=Z(t),o=ep(i,r),a=Bt(e),s=[],c=[];In(a,function(m){return s.push(m),(h(m,"bpmn:Lane")||h(m,"bpmn:Participant"))&&c.push(m),m.children});var u,p,l,f,d;(o.bottom||o.top)&&(u=o.bottom||o.top,p=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),l=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",f,p),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},l)),(o.left||o.right)&&(u=o.right||o.left,p=e.x+(o.right?e.width:0)+(o.right?-10:100),l=o.right?"e":"w",f=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",f,p),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},l))};var Js="flowNodeRef",Qf="lanes";function Qi(e){this._elementRegistry=e}Qi.$inject=["elementRegistry"];Qi.prototype._computeUpdates=function(e,t){var n=[],r=[],i={},o=[];function a(p,l){var f=Z(l),d={x:p.x+p.width/2,y:p.y+p.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(p){n.indexOf(p)===-1&&(o.push(p),n.push(p))}function c(p){var l=Bt(p);return i[l.id]||(i[l.id]=zo(l)),i[l.id]}function u(p){if(!p.parent)return[];var l=c(p);return l.filter(function(f){return a(p,f)}).map(function(f){return f.businessObject})}return t.forEach(function(p){var l=Bt(p);if(!(!l||n.indexOf(l)!==-1)){var f=l.children.filter(function(d){return h(d,"bpmn:FlowNode")});f.forEach(s),n.push(l)}}),e.forEach(s),o.forEach(function(p){var l=p.businessObject,f=l.get(Qf),d=f.slice(),m=u(p);r.push({flowNode:l,remove:d,add:m})}),t.forEach(function(p){var l=p.businessObject;p.parent||l.get(Js).forEach(function(f){r.push({flowNode:f,remove:[l],add:[]})})}),r};Qi.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var r=n.flowNode,i=r.get(Qf);n.remove.forEach(function(o){Oe(i,o),Oe(o.get(Js),r)}),n.add.forEach(function(o){Ae(i,o),Ae(o.get(Js),r)})}),[]};Qi.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var r=n.flowNode,i=r.get(Qf);n.add.forEach(function(o){Oe(i,o),Oe(o.get(Js),r)}),n.remove.forEach(function(o){Ae(i,o),Ae(o.get(Js),r)})}),[]};function pa(e){this._moddle=e}pa.$inject=["moddle"];pa.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,r=e.element,i=e.claiming;return i?t.claim(n,r):t.unclaim(n),[]};pa.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,r=e.element,i=e.claiming;return i?t.unclaim(n):t.claim(n,r),[]};N();var eT={fill:void 0,stroke:void 0};function ec(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(st(t)){var n=tT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}ec.$inject=["commandStack"];ec.prototype.postExecute=function(e){var t=e.elements,n=e.colors||eT,r=this,i={};"fill"in n&&C(i,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&C(i,{"border-color":this._normalizeColor(n.stroke)}),E(t,function(o){var a=de(o)?mt(i,["border-color"]):i,s=ce(o);if(nT(a),ee(o)){if(!s||!h(s.label,"bpmndi:BPMNLabel"))return;r._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:i["border-color"]}})}else{if(!te(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;r._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function tT(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 nT(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var rT={width:0,height:0};function Bp(e,t,n){function r(c,u){var p=c.label||c,l=c.labelTarget||c;return Eh(p,u,l!==p),[p,l]}function i(c){var u=c.element,p=u.businessObject,l=c.newLabel;if(!ee(u)&&mn(u)&&!Xr(u)&&!k_(l)){var f=7,d=La(u);d={x:d.x,y:d.y+f},e.createLabel(u,d,{id:p.id+"_label",businessObject:p,di:u.di})}}function o(c){return c.oldLabel=gt(c.element),r(c.element,c.newLabel)}function a(c){return r(c.element,c.oldLabel)}function s(c){var u=c.element,p=u.label||u,l=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!ee(p)&&!h(p,"bpmn:TextAnnotation"))){if(ee(p)&&k_(l)){d.removeShape!==!1&&e.removeShape(p,{unsetLabel:!1});return}var m=gt(u);typeof f=="undefined"&&(f=t.getExternalLabelBounds(p,m)),f&&e.resizeShape(p,f,rT)}}this.preExecute=i,this.execute=o,this.revert=a,this.postExecute=s}Bp.$inject=["modeling","textRenderer","bpmnFactory"];function k_(e){return!e||!e.trim()}function Pt(e,t,n,r){De.call(this,e,t,n),this._bpmnRules=r}B(Pt,De);Pt.$inject=["eventBus","elementFactory","commandStack","bpmnRules"];Pt.prototype.getHandlers=function(){var e=De.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Yi,e["element.updateProperties"]=Xi,e["canvas.updateRoot"]=ua,e["lane.add"]=Zs,e["lane.resize"]=Zi,e["lane.split"]=Qs,e["lane.updateRefs"]=Qi,e["id.updateClaim"]=pa,e["element.setColor"]=ec,e["element.updateLabel"]=Bp,e};Pt.prototype.updateLabel=function(e,t,n,r){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:r||{}})};Pt.prototype.connect=function(e,t,n,r){var i=this._bpmnRules;if(n||(n=i.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,r)};Pt.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})};Pt.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})};Pt.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})};Pt.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane};Pt.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})};Pt.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e};Pt.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e};Pt.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})};Pt.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})};Pt.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})};Pt.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};N();function Ip(){}Ip.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||X(t.source||e.source),t.connectionEnd||X(t.target||e.target)]};N();var Lp=20,iT=5,jp=Math.round,N_=20,oT={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function aT(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function sT(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function L_(e,t,n){var r=He(t,e,iT),i=n.split(":")[0],o=jp((t.x-e.x)/2+e.x),a=jp((t.y-e.y)/2+e.y),s,c,u=sT(i,r),p=/h|r|l/.test(i),l=!1,f=!1;return u?(s=p?{x:o,y:e.y}:{x:e.x,y:a},c=p?"h:h":"v:v"):(l=aT(r,i),c=p?"h:v":"v:h",l?p?(f=a===e.y,s={x:e.x+Lp*(/l/.test(i)?-1:1),y:f?a+Lp:a}):(f=o===e.x,s={x:f?o+Lp:o,y:e.y+Lp*(/t/.test(i)?-1:1)}):s={x:o,y:a}),{waypoints:Jf(e,s,c).concat(s),directions:c,turnNextDirections:f}}function cT(e,t,n){return L_(e,t,n)}function uT(e,t,n){var r=L_(t,e,O_(n));return{waypoints:r.waypoints.slice().reverse(),directions:O_(r.directions),turnNextDirections:r.turnNextDirections}}function pT(e,t){var n=e.directions.split(":")[1],r=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(r=r=="h"?"v":"h");var i=n+":"+r,o=Jf(e.waypoints[e.waypoints.length-1],t.waypoints[0],i);return{waypoints:o,directions:i}}function O_(e){return e.split(":").reverse().join(":")}function lT(e,t,n){var r=jp((t.x-e.x)/2+e.x),i=jp((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:r,y:e.y},{x:r,y:t.y}];if(n==="v:v")return[{x:e.x,y:i},{x:t.x,y:i}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Jf(e,t,n){if(n=n||"h:h",!_T(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(F_(n)){var r=cT(e,t,n),i=uT(e,t,n),o=pT(r,i);return[].concat(r.waypoints,o.waypoints,i.waypoints)}return lT(e,t,n)}function fT(e,t,n){var r=Jf(e,t,n);return r.unshift(e),r.push(t),td(r)}function dT(e,t,n,r,i){var o=i&&i.preferredLayouts||[],a=hl(o,"straight")[0]||"h:h",s=oT[a]||0,c=He(e,t,s),u=yT(c,a);n=n||X(e),r=r||X(t);var p=u.split(":"),l=I_(n,e,p[0],bT(c)),f=I_(r,t,p[1],c);return fT(l,f,u)}function j_(e,t,n,r,i,o){q(n)&&(i=n,o=r,n=X(e),r=X(t)),o=C({preferredLayouts:[]},o),i=i||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&hT(e,t,n,r,o),c||(c=o.connectionEnd&&gT(t,e,r,i),c)||(c=o.connectionStart&&vT(e,t,n,i),c)?c:!o.connectionStart&&!o.connectionEnd&&i&&i.length?i:dT(e,t,n,r,o)}function mT(e,t,n){return e>=t&&e<=n}function B_(e,t,n){var r={x:"width",y:"height"};return mT(t[e],n[e],n[e]+n[r[e]])}function hT(e,t,n,r,i){var o={},a,s;return s=He(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),i.preserveDocking==="target"?B_(a,r,e)?(o[a]=r[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:r.x,y:r.y}]):null:B_(a,n,t)?(o[a]=n[a],[{x:n.x,y:n.y},{x:o.x!==void 0?o.x:r.x,y:o.y!==void 0?o.y:r.y,original:{x:o.x!==void 0?o.x:r.x,y:o.y!==void 0?o.y:r.y}}]):null):null}function vT(e,t,n,r){return ed(e,t,n,r)}function gT(e,t,n,r){var i=r.slice().reverse();return i=ed(e,t,n,i),i?i.reverse():null}function ed(e,t,n,r){function i(p){return p.length<3?!0:p.length>4?!1:!!re(p,function(l,f){var d=p[f-1];return d&&Gr(l,d)<3})}function o(p,l,f){var d=en(l,p);switch(d){case"v":return{x:f.x,y:p.y};case"h":return{x:p.x,y:f.y}}return{x:p.x,y:p.y}}function a(p,l,f){var d;for(d=p.length-2;d!==0;d--)if(Nl(p[d],l,N_)||Nl(p[d],f,N_))return p.slice(d);return p}if(i(r))return null;var s=r[0],c=r.slice(),u;return c[0]=n,c[1]=o(c[1],s,n),u=a(c,e,t),u!==c&&(c=ed(e,t,n,u)),c&&en(c)?null:c}function yT(e,t){if(F_(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 _T(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function F_(e){return e&&/t|r|b|l/.test(e)}function bT(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 I_(e,t,n,r){if(n==="h"&&(n=/left/.test(r)?"l":"r"),n==="v"&&(n=/top/.test(r)?"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 td(e){return e.reduce(function(t,n,r){var i=t[t.length-1],o=e[r+1];return uo(i,o,n,0)||t.push(n),t},[])}var xT=-10,ET=40,wT={default:["h:h"],fromGateway:["v:h"],toGateway:["h:v"],loop:{fromTop:["t:r"],fromRight:["r:b"],fromLeft:["l:t"],fromBottom:["b:l"]},boundaryLoop:{alternateHorizontalSide:"b",alternateVerticalSide:"l",default:"v"},messageFlow:["straight","v:v"],subProcess:["straight","h:h"],isHorizontal:!0},ST={default:["v:v"],fromGateway:["h:v"],toGateway:["v:h"],loop:{fromTop:["t:l"],fromRight:["r:t"],fromLeft:["l:b"],fromBottom:["b:r"]},boundaryLoop:{alternateHorizontalSide:"t",alternateVerticalSide:"r",default:"h"},messageFlow:["straight","h:h"],subProcess:["straight","v:v"],isHorizontal:!1},rd={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},tc={top:"t",right:"r",bottom:"b",left:"l"};function da(e){this._elementRegistry=e}B(da,Ip);da.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,r=t.target||e.target,i=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,u;if(o||(o=H_(i&&i[0],n)),a||(a=H_(i&&i[i.length-1],r)),(h(e,"bpmn:Association")||h(e,"bpmn:DataAssociation"))&&i&&!$_(n,r))return[].concat([o],i.slice(1,-1),[a]);var p=Pu(n,s)?wT:ST;return h(e,"bpmn:MessageFlow")?c=RT(n,r,p):(h(e,"bpmn:SequenceFlow")||$_(n,r))&&(n===r?c={preferredLayouts:kT(n,e,p)}:h(n,"bpmn:BoundaryEvent")?c={preferredLayouts:NT(n,r,a,p)}:nc(n)||nc(r)?c={preferredLayouts:p.subProcess,preserveDocking:AT(n)}:h(n,"bpmn:Gateway")?c={preferredLayouts:p.fromGateway}:h(r,"bpmn:Gateway")?c={preferredLayouts:p.toGateway}:c={preferredLayouts:p.default}),c&&(c=C(c,t),u=td(j_(n,r,o,a,i,c))),u||[o,a]};function CT(e){var t=e.host;return He(X(e),t,xT)}function RT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:PT(e,t)}}function PT(e,t){return h(t,"bpmn:Participant")?"source":h(e,"bpmn:Participant")?"target":nc(t)?"source":nc(e)||h(t,"bpmn:Event")?"target":h(e,"bpmn:Event")?"source":null}function AT(e){return nc(e)?"target":"source"}function H_(e,t){return e?e.original||e:X(t)}function $_(e,t){return h(t,"bpmn:Activity")&&h(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function nc(e){return h(e,"bpmn:SubProcess")&&ie(e)}function Ji(e,t){return e===t}function TT(e,t){return t.indexOf(e)!==-1}function la(e){var t=/right|left/.exec(e);return t&&t[0]}function fa(e){var t=/top|bottom/.exec(e);return t&&t[0]}function z_(e,t){return rd[e]===t}function MT(e,t){var n=la(e),r=rd[n];return t.indexOf(r)!==-1}function DT(e,t){var n=fa(e),r=rd[n];return t.indexOf(r)!==-1}function V_(e){return e==="right"||e==="left"}function kT(e,t,n){var r=t.waypoints,i=r&&r.length&&He(r[0],e);return i==="top"?n.loop.fromTop:i==="right"?n.loop.fromRight:i==="left"?n.loop.fromLeft:n.loop.fromBottom}function NT(e,t,n,r){var i=X(e),o=X(t),a=CT(e),s,c,u=Ji(e.host,t),p=TT(a,["top","right","bottom","left"]),l=He(o,i,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?OT(a,p,e,t,n,r):(s=BT(a,l,p,r.isHorizontal),c=IT(a,l,p,r.isHorizontal),[s+":"+c])}function OT(e,t,n,r,i,o){var a=t?e:o.isHorizontal?fa(e):la(e),s=tc[a],c;return t?V_(e)?c=G_("y",n,r,i)?"h":o.boundaryLoop.alternateHorizontalSide:c=G_("x",n,r,i)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function G_(e,t,n,r){var i=ET;return!(nd(e,r,n,i)||nd(e,r,{x:n.x+n.width,y:n.y+n.height},i)||nd(e,r,X(t),i))}function nd(e,t,n,r){return Math.abs(t[e]-n[e])<r}function BT(e,t,n,r){if(n)return tc[e];var i=fa(e),o=la(e),a=fa(t),s=la(t);if(r){if(Ji(i,a)||z_(o,s))return tc[i]}else if(Ji(o,s)||z_(i,a))return tc[o];return tc[r?o:i]}function IT(e,t,n,r){if(n)return V_(e)?MT(e,t)||Ji(e,t)?"h":"v":DT(e,t)||Ji(e,t)?"v":"h";var i=fa(e),o=la(e),a=fa(t),s=la(t);return a&&!s?"v":s&&!a?"h":r?Ji(i,a)?"h":"v":Ji(o,s)?"v":"h"}da.$inject=["elementRegistry"];N();function W_(e){return C({original:e.point.original||e.point},e.actual)}function dr(e,t){this._elementRegistry=e,this._graphicsFactory=t}dr.$inject=["elementRegistry","graphicsFactory"];dr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var r=this.getDockingPoint(e,t,!0),i=this.getDockingPoint(e,n),o=e.waypoints.slice(r.idx+1,i.idx);return o.unshift(W_(r)),o.push(W_(i)),o};dr.prototype.getDockingPoint=function(e,t,n){var r=e.waypoints,i,o,a;return i=n?0:r.length-1,o=r[i],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:i}};dr.prototype._getIntersection=function(e,t,n){var r=this._getShapePath(e),i=this._getConnectionPath(t);return qr(r,i,n)};dr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)};dr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)};dr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var Fp={__init__:["modeling","bpmnUpdater"],__depends__:[_y,Fy,Hy,$y,Ap,p_,d_,v_,rt,xo,Np],bpmnFactory:["type",an],bpmnUpdater:["type",$t],elementFactory:["type",lr],modeling:["type",Pt],layouter:["type",da],connectionDocking:["type",dr]};N();var U_=Math.round;function ma(e,t,n,r,i,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=r,this._layouter=i,this._rules=o}ma.prototype.create=function(e,t,n){let r=this._complexPreview,i=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(C({type:t},n)),p=a.fire("autoPlace",{source:e,shape:u});if(!p)return;C(u,{x:p.x-U_(u.width/2),y:p.y-U_(u.height/2)});let l=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}}),f=null;l&&(f=o.createConnection(l),f.waypoints=s.layoutConnection(f,{source:e,target:u}),f.waypoints=i.getCroppedWaypoints(f,e,u)),r.create({created:[u,f].filter(d=>!Yn(d))})};ma.prototype.cleanUp=function(){this._complexPreview.cleanUp()};ma.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var q_={__depends__:[No,Rg,Fp],__init__:["appendPreview"],appendPreview:["type",ma]};N();N();var K_=Math.min,Y_=Math.max;function id(e){e.preventDefault()}function rc(e){e.stopPropagation()}function LT(e){return e.nodeType===Node.TEXT_NODE}function jT(e){return[].slice.call(e)}function _n(e){this.container=e.container,this.parent=ue('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=_e("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=tt(this.autoResize,this),this.handlePaste=tt(this.handlePaste,this)}_n.prototype.create=function(e,t,n,r){var i=this,o=this.parent,a=this.content,s=this.container;r=this.options=r||{},t=this.style=t||{};var c=mt(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);C(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 u=mt(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return C(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),r.centerVertically&&C(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,se.bind(a,"keydown",this.keyHandler),se.bind(a,"mousedown",rc),se.bind(a,"paste",i.handlePaste),r.autoResize&&se.bind(a,"input",this.autoResize),r.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o};_n.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var r;if(e.clipboardData?r=e.clipboardData.getData("text/plain"):r=window.clipboardData.getData("Text"),this.insertText(r),t.autoResize){var i=this.autoResize(n);i&&this.resizeHandler(i)}};_n.prototype.insertText=function(e){e=FT(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)};_n.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,r=t.endContainer,i=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=jT(a.childNodes),c,u;if(LT(a)){var p=n.textContent;n.textContent=p.substring(0,i)+e+p.substring(o),c=n,u=i+e.length}else if(n===this.content&&r===this.content){var l=document.createTextNode(e);this.content.insertBefore(l,s[i]),c=l,u=l.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(r);s.forEach(function(m,g){g===f?m.textContent=n.textContent.substring(0,i)+e+r.textContent.substring(o):g>f&&g<=d&&Wt(m)}),c=n,u=i+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})};_n.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 r=e.getBoundingClientRect(),i=t.scrollHeight;e.style.height=i+"px",this.resizeHandler({width:r.width,height:r.height,dx:0,dy:i-r.height})}};_n.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,r=parseInt(this.style.minWidth)||0,i=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=ue('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,p,l=function(m){id(m),rc(m),s=m.clientX,c=m.clientY;var g=t.getBoundingClientRect();u=g.width,p=g.height,se.bind(document,"mousemove",f),se.bind(document,"mouseup",d)},f=function(m){id(m),rc(m);var g=K_(Y_(u+m.clientX-s,r),o),v=K_(Y_(p+m.clientY-c,i),a);t.style.width=g+"px",t.style.height=v+"px",e.resizeHandler({width:u,height:p,dx:m.clientX-s,dy:m.clientY-c})},d=function(m){id(m),rc(m),se.unbind(document,"mousemove",f,!1),se.unbind(document,"mouseup",d,!1)};se.bind(n,"mousedown",l)}C(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)};_n.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),se.unbind(t,"keydown",this.keyHandler),se.unbind(t,"mousedown",rc),se.unbind(t,"input",this.autoResize),se.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),Wt(n)),Wt(e)};_n.prototype.getValue=function(){return this.content.innerText.trim()};_n.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t};_n.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var r=window.getSelection();r.removeAllRanges(),r.addRange(n)};function FT(e){return e.replace(/\r\n|\r|\n/g,`
211 </svg>`},sp=ES;var wS=900;function Yr(e,t,n,r){e.registerProvider(wS,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=r}Yr.$inject=["contextPad" global() method in Dt
/plugin/dirtylittlehelper/mermaid/editor/docs/
Dbundle.js.map1_paste(source, args.text || '', args.pasteOnNewLine || false, args.multicursorText || null, args.m…