You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

357 lines
513 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

var d_=Object.defineProperty,h_=Object.defineProperties;var m_=Object.getOwnPropertyDescriptors;var na=Object.getOwnPropertySymbols;var Qp=Object.prototype.hasOwnProperty,ef=Object.prototype.propertyIsEnumerable;var tf=Math.pow,yc=(e,t,n)=>t in e?d_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,te=(e,t)=>{for(var n in t||(t={}))Qp.call(t,n)&&yc(e,n,t[n]);if(na)for(var n of na(t))ef.call(t,n)&&yc(e,n,t[n]);return e},Pe=(e,t)=>h_(e,m_(t));var _c=(e,t)=>{var n={};for(var i in e)Qp.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&na)for(var i of na(e))t.indexOf(i)<0&&ef.call(e,i)&&(n[i]=e[i]);return n};var Ke=(e,t,n)=>yc(e,typeof t!="symbol"?t+"":t,n);var rt=(e,t,n)=>new Promise((i,r)=>{var o=c=>{try{s(n.next(c))}catch(l){r(l)}},a=c=>{try{s(n.throw(c))}catch(l){r(l)}},s=c=>c.done?i(c.value):Promise.resolve(c.value).then(o,a);s((n=n.apply(e,t)).next())});import{_ as Ol,b as v_,k as ia,a as g_,h as y_}from"./entry/index-CruxN-Hs-1723019140439.js";import{B as Nl,e as q,I as qh,i as me,c as ro,a as ne,b as zt,m as es,d as N,V as oo,M as Kh,Z as Xh,f as D,s as hn,g as pe,h as et,j as lt,q as De,k as Oi,l as Le,n as Qt,o as ao,p as Ce,r as Ll,O as Zh,t as It,u as or,v as Rn,C as H,w as ts,x as Me,y as ft,z as ni,A as Q,D as re,E as ns,F as ce,G as gt,H as g,J as Bl,K as $l,L as is,N as Cn,P as Mt,Q as Fl,R as mn,S as be,T as qr,U as Tn,W as bc,X as __,Y as Jh,_ as Qh,$ as b_,a0 as An,a1 as em,a2 as E_,a3 as ve,a4 as Re,a5 as ge,a6 as ae,a7 as Uc,a8 as Sn,a9 as mt,aa as x_,ab as ut,ac as jl,ad as nf,ae as w_,af as tm,ag as Wc,ah as vn,ai as rs,aj as Yc,ak as S_,al as Hl,am as Mi,an as nm,ao as os,ap as z,aq as im,ar as vt,as as Ze,at as We,au as we,av as ue,aw as as,ax as Kr,ay as Vr,az as ar,aA as Jn,aB as Pt,aC as ye,aD as so,aE as Xr,aF as rm,aG as Li,aH as tr,aI as Ia,aJ as bi,aK as rf,aL as C_,aM as T_,aN as P_,aO as R_,aP as A_,aQ as om,aR as qn,aS as qc,aT as I_,aU as Gl,aV as M_,aW as zl,aX as D_,aY as k_,aZ as O_,a_ as N_,a$ as Kc,b0 as am,b1 as L_,b2 as B_,b3 as of,b4 as sm,b5 as sr,b6 as $_,b7 as ss,b8 as F_,b9 as j_,ba as cm,bb as H_,bc as lm,bd as G_,be as Xc,bf as z_}from"./index-DeqOXDrL.js";import{V as V_,f as Ee,d as Rt,_ as xe,a8 as Je,a9 as $,u as O,ac as bt,a0 as pt,$ as Ot,ad as Zr,c as pn,k as L,G as ct,aa as fn,r as U_,J as Vt,o as co,a1 as cs,ab as W_,F as Y_,D as Zc,w as q_,m as K_,A as X_,aj as Z_,a2 as um,y as ra,af as J_,ap as Q_}from"./vue-aEZWZQSa.js";import{R as af,b as Vl,c as eb,U as tb,V as Jc,z as Qe,o as nb,f as ib,W as pm,X as rb,Y as ob,Z as gn,N as sf,$ as Ne,a0 as ab,a1 as cf,a2 as lo,a3 as sb,D as lf,v as uf,a4 as oa,T as Ei,a5 as fm}from"./antd-BY-1PcYE.js";import{d as pf}from"./download-BageIVpd.js";import{a as Ul,B as Wl,u as ir}from"./index-B6biQger.js";import{C as cb,M as lb}from"./index-VnRLIvr7.js";import{w as ub}from"./index-Cjnyb4BC.js";import{c as pb}from"./index-BIRFvyhx.js";import ff from"./index-DiOT3jDz.js";import{u as fb,_ as db}from"./useForm-CdUGloRq.js";import"./BasicForm.vue_vue_type_style_index_0_lang-C-Cj0P69.js";import"./componentMap-uxp1OCze.js";import{V as hb}from"./index-BAuys4Ip.js";import{u as dm,_ as hm}from"./useTable-Bbyr2JHM.js";import{_ as mm}from"./index-BYFe0x3M.js";import{f as mb,a as vb}from"./index-DrHC5gQt.js";import"./useLoading-C0EEZ3ab.js";import"./useWindowSizeFn--jCT5E3A.js";import"./index-CKN9oMgI.js";import"./index-B12iIcai.js";import"./dictEnum-DeC8h6ZR.js";import"./useRender-CuBarcLn.js";import"./dict-B_9qLt7l.js";import"./FormItem.vue_vue_type_script_lang-B_ueKfdL.js";import"./helper-CuUont7-.js";import"./RadioButtonGroup.vue_vue_type_script_setup_true_lang-D6-xDLMZ.js";import"./copyTextToClipboard-BBFF3Y3I.js";import"./onMountedOrActivated-BIJ0U1R1.js";import"./style-Bwlk8Loa.js";import"./sortable.esm-CnNXHMH-.js";import"./useSortable-CSRkxIlp.js";function uo(e){Nl.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}q(uo,Nl);uo.prototype._createModdle=function(e){var t=Nl.prototype._createModdle.call(this,e);return t.ids=new qh([32,36,1]),t};uo.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};var gb=["c","C"],yb=["v","V"],_b=["y","Y"],vm=["z","Z"];function bb(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function kt(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Xe(e,t){return e=me(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Yl(e){return e.shiftKey}function Eb(e){return kt(e)&&Xe(gb,e)}function xb(e){return kt(e)&&Xe(yb,e)}function wb(e){return kt(e)&&!Yl(e)&&Xe(vm,e)}function Sb(e){return kt(e)&&(Xe(_b,e)||Xe(vm,e)&&Yl(e))}var ls="keyboard.keydown",Cb="keyboard.keyup",df="input-handle-modified-keys",Tb=1e3;function ot(e,t){var n=this;this._config=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),t.on("diagram.init",function(){n._fire("init")}),t.on("attach",function(){e&&e.bindTo&&n.bind(e.bindTo)}),t.on("detach",function(){n.unbind()})}ot.$inject=["config.keyboard","eventBus"];ot.prototype._keydownHandler=function(e){this._keyHandler(e,ls)};ot.prototype._keyupHandler=function(e){this._keyHandler(e,Cb)};ot.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||ls,i),n&&e.preventDefault()}};ot.prototype._isEventIgnored=function(e){return e.defaultPrevented?!0:(Pb(e.target)||Rb(e.target)&&Xe([" ","Enter"],e))&&this._isModifiedKeyIgnored(e)};ot.prototype._isModifiedKeyIgnored=function(e){if(!kt(e))return!0;var t=this._getAllowedModifiers(e.target);return t.indexOf(e.key)===-1};ot.prototype._getAllowedModifiers=function(e){var t=ro(e,"["+df+"]",!0);return!t||this._node&&!this._node.contains(t)?[]:t.getAttribute(df).split(",")};ot.prototype.bind=function(e){this.unbind(),this._node=e,ne.bind(e,"keydown",this._keydownHandler),ne.bind(e,"keyup",this._keyupHandler),this._fire("bind")};ot.prototype.getBinding=function(){return this._node};ot.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),ne.unbind(e,"keydown",this._keydownHandler),ne.unbind(e,"keyup",this._keyupHandler)),this._node=null};ot.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})};ot.prototype.addListener=function(e,t,n){zt(e)&&(n=t,t=e,e=Tb),this._eventBus.on(n||ls,e,t)};ot.prototype.removeListener=function(e,t){this._eventBus.off(t||ls,e)};ot.prototype.hasModifier=bb;ot.prototype.isCmd=kt;ot.prototype.isShift=Yl;ot.prototype.isKey=Xe;function Pb(e){return e&&(es(e,"input, textarea")||e.contentEditable==="true")}function Rb(e){return e&&es(e,"button, input[type=submit], input[type=button], a[href], [aria-role=button]")}var Ab=500;function mr(e,t){var n=this;e.on("editorActions.init",Ab,function(i){var r=i.editorActions;n.registerBindings(t,r)})}mr.$inject=["eventBus","keyboard"];mr.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(wb(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(Sb(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(Eb(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(xb(r))return t.trigger("paste"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Xe(["+","Add","="],r)&&kt(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Xe(["-","Subtract"],r)&&kt(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Xe("0",r)&&kt(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Xe(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const ql={__init__:["keyboard","keyboardBindings"],keyboard:["type",ot],keyboardBindings:["type",mr]};var Ib={moveSpeed:50,moveSpeedAccelerated:200};function gm(e,t,n){var i=this;this._config=N({},Ib,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,l;switch(a.key){case"ArrowLeft":case"Left":l="left";break;case"ArrowUp":case"Up":l="up";break;case"ArrowRight":case"Right":l="right";break;case"ArrowDown":case"Down":l="down";break}return i.moveCanvas({speed:c,direction:l}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=l;break;case"up":s=l;break;case"right":a=-l;break;case"down":s=-l;break}n.scroll({dx:a,dy:s})}}gm.$inject=["config.keyboardMove","keyboard","canvas"];const ym={__depends__:[ql],__init__:["keyboardMove"],keyboardMove:["type",gm]};function Jr(e){oo.call(this,e)}q(Jr,oo);Jr.prototype._navigationModules=[ym,Kh,Xh];Jr.prototype._modules=[].concat(oo.prototype._modules,Jr.prototype._navigationModules);function Ec(e){return e&&e[e.length-1]}function hf(e){return e.y}function mf(e){return e.x}var Mb={left:mf,center:mf,right:function(e){return e.x+e.width},top:hf,middle:hf,bottom:function(e){return e.y+e.height}};function vr(e,t){this._modeling=e,this._rules=t}vr.$inject=["modeling","rules"];vr.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",i="width";return t.indexOf(e)!==-1&&(n="y",i="height"),{axis:n,dimension:i}};vr.prototype._isType=function(e,t){return t.indexOf(e)!==-1};vr.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,l,u;function p(f,d){return Math.round((f[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=Ec(t),o[e]=u[i]+u[r];else if(this._isType(e,["center","middle"])){if(D(t,function(f){var d=f[i]+Math.round(f[r]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=hn(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Ec(c).center,o;l=t[0],t=hn(t,function(f){return f[i]+f[r]}),u=Ec(t),o[e]=p(l,u)}return o};vr.prototype.trigger=function(e,t){var n=this._modeling,i,r=pe(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),me(i)&&(r=i),!(r.length<2||!i)){var o=Mb[t],a=hn(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const Db={__init__:["alignElements"],alignElements:["type",vr]};var kb="djs-element-hidden",aa=".entry",Ob=1e3,vf=8,Nb=300;function ze(e,t,n){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._current=null,this._init()}ze.$inject=["canvas","elementRegistry","eventBus"];ze.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var{target:r}=i,o=me(r)?r:[r],a=o.filter(function(c){return _m(n,c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",()=>{this._updatePosition()}),this._eventBus.on("element.marker.update",function(t){e._updateVisibility()}),this._container=this._createContainer()};ze.prototype._createContainer=function(){const e=et('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e};ze.prototype.registerProvider=function(e,t){t||(t=e,e=Ob),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})};ze.prototype.getEntries=function(e){var t=this._getProviders(),n=me(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return D(t,function(r){if(zt(r[n])){var o=r[n](e);zt(o)?i=o(i):D(o,function(a,s){i[s]=a})}}),i};ze.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;if(!o)return t.preventDefault();if(i=lt(o,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(()=>{this._mouseout=this.triggerEntry(i,"hover",r,n)},Nb);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(i,e,r,n)};ze.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(zt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}};ze.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))};ze.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers};ze.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;D(t,function(r,o){var a=r.group||"default",s=et(r.html||'<div class="entry" draggable="true"></div>'),c;lt(s,"data-action",o),c=De("[data-group="+Oi(a)+"]",n),c||(c=et('<div class="group"></div>'),lt(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&Lb(s,r.className),r.title&&lt(s,"title",r.title),r.imageUrl&&(i=et("<img>"),lt(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Le(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})};ze.prototype._createHtml=function(e){var t=this,n=et('<div class="djs-context-pad"></div>');return Qt.bind(n,aa,"click",function(i){t.trigger("click",i)}),Qt.bind(n,aa,"dragstart",function(i){t.trigger("dragstart",i)}),Qt.bind(n,aa,"mouseover",function(i){t.trigger("mouseover",i)}),Qt.bind(n,aa,"mouseout",function(i){t.trigger("mouseout",i)}),ne.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n};ze.prototype.getPad=function(e){let t;return this.isOpen()&&$b(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}};ze.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)};ze.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return me(e)!==me(n)?!1:me(e)?e.length===n.length&&ao(e,function(i){return _m(n,i)}):n===e};ze.prototype.isShown=function(){return this.isOpen()&&Le(this._current.html).has("open")};ze.prototype.show=function(){this.isOpen()&&(Le(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))};ze.prototype.hide=function(){this.isOpen()&&(Le(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))};ze.prototype._getPosition=function(e){if(!me(e)&&Ce(e)){const r=this._canvas.viewbox(),o=Bb(e),a=o.x*r.scale-r.x*r.scale,s=o.y*r.scale-r.y*r.scale;return{left:a+vf*this._canvas.zoom(),top:s}}var t=this._canvas.getContainer(),n=t.getBoundingClientRect(),i=this._getTargetBounds(e);return{left:i.right-n.left+vf*this._canvas.zoom(),top:i.top-n.top}};ze.prototype._updatePosition=function(){if(this.isOpen()){var e=this._current.html,t=this._getPosition(this._current.target);"x"in t&&"y"in t?(e.style.left=t.x+"px",e.style.top=t.y+"px"):["top","right","bottom","left"].forEach(function(n){n in t&&(e.style[n]=t[n]+"px")})}};ze.prototype._updateVisibility=function(){if(this.isOpen()){var e=this,t=this._current.target,n=me(t)?t:[t],i=n.some(function(r){return e._canvas.hasMarker(r,kb)});i?e.hide():e.show()}};ze.prototype._getTargetBounds=function(e){var t=me(e)?e:[e],n=t.map(i=>this._canvas.getGraphics(i));return n.reduce((i,r)=>{const o=r.getBoundingClientRect();return i.top=Math.min(i.top,o.top),i.right=Math.max(i.right,o.right),i.bottom=Math.max(i.bottom,o.bottom),i.left=Math.min(i.left,o.left),i.x=i.left,i.y=i.top,i.width=i.right-i.left,i.height=i.bottom-i.top,i},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function Lb(e,t){var n=Le(e);t=me(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function _m(e,t){return e.indexOf(t)!==-1}function Bb(e){return e.waypoints[e.waypoints.length-1]}function $b(e,t){return e=me(e)?e:[e],t=me(t)?t:[t],e.length===t.length&&ao(e,function(n){return t.includes(n)})}const bm={__depends__:[Ll,Zh],contextPad:["type",ze]};var us,Fe,Em,Ri,gf,xm,Qc,Kl,el,tl,Qr={},wm=[],Fb=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Xl=Array.isArray;function Kn(e,t){for(var n in t)e[n]=t[n];return e}function Sm(e){var t=e.parentNode;t&&t.removeChild(e)}function Cm(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?us.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return Ma(e,a,i,r,null)}function Ma(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:r==null?++Em:r,__i:-1,__u:0};return r==null&&Fe.vnode!=null&&Fe.vnode(o),o}function ps(e){return e.children}function Da(e,t){this.props=e,this.context=t}function Ni(e,t){if(t==null)return e.__?Ni(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Ni(e):null}function Tm(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return Tm(e)}}function yf(e){(!e.__d&&(e.__d=!0)&&Ri.push(e)&&!Ha.__r++||gf!==Fe.debounceRendering)&&((gf=Fe.debounceRendering)||xm)(Ha)}function Ha(){var e,t,n,i,r,o,a,s;for(Ri.sort(Qc);e=Ri.shift();)e.__d&&(t=Ri.length,i=void 0,o=(r=(n=e).__v).__e,a=[],s=[],n.__P&&((i=Kn({},r)).__v=r.__v+1,Fe.vnode&&Fe.vnode(i),Zl(n.__P,i,r,n.__n,n.__P.namespaceURI,32&r.__u?[o]:null,a,o==null?Ni(r):o,!!(32&r.__u),s),i.__v=r.__v,i.__.__k[i.__i]=i,Am(a,i,s),i.__e!=o&&Tm(i)),Ri.length>t&&Ri.sort(Qc));Ha.__r=0}function Pm(e,t,n,i,r,o,a,s,c,l,u){var p,f,d,h,m,v=i&&i.__k||wm,E=t.length;for(n.__d=c,jb(n,t,v),c=n.__d,p=0;p<E;p++)(d=n.__k[p])!=null&&typeof d!="boolean"&&typeof d!="function"&&(f=d.__i===-1?Qr:v[d.__i]||Qr,d.__i=p,Zl(e,d,f,r,o,a,s,c,l,u),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Jl(f.ref,null,d),u.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),65536&d.__u||f.__k===d.__k?(c&&!c.isConnected&&(c=Ni(f)),c=Rm(d,c,e)):typeof d.type=="function"&&d.__d!==void 0?c=d.__d:h&&(c=h.nextSibling),d.__d=void 0,d.__u&=-196609);n.__d=c,n.__e=m}function jb(e,t,n){var i,r,o,a,s,c=t.length,l=n.length,u=l,p=0;for(e.__k=[],i=0;i<c;i++)a=i+p,(r=e.__k[i]=(r=t[i])==null||typeof r=="boolean"||typeof r=="function"?null:typeof r=="string"||typeof r=="number"||typeof r=="bigint"||r.constructor==String?Ma(null,r,null,null,null):Xl(r)?Ma(ps,{children:r},null,null,null):r.constructor===void 0&&r.__b>0?Ma(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)!=null?(r.__=e,r.__b=e.__b+1,s=Hb(r,n,a,u),r.__i=s,o=null,s!==-1&&(u--,(o=n[s])&&(o.__u|=131072)),o==null||o.__v===null?(s==-1&&p--,typeof r.type!="function"&&(r.__u|=65536)):s!==a&&(s===a+1?p++:s>a?u>c-a?p+=s-a:p--:s<a?s==a-1&&(p=s-a):p=0,s!==i+p&&(r.__u|=65536))):(o=n[a])&&o.key==null&&o.__e&&!(131072&o.__u)&&(o.__e==e.__d&&(e.__d=Ni(o)),nl(o,o,!1),n[a]=null,u--);if(u)for(i=0;i<l;i++)(o=n[i])!=null&&!(131072&o.__u)&&(o.__e==e.__d&&(e.__d=Ni(o)),nl(o,o))}function Rm(e,t,n){var i,r;if(typeof e.type=="function"){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=Rm(i[r],t,n));return t}e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType===8);return t}function Hb(e,t,n,i){var r=e.key,o=e.type,a=n-1,s=n+1,c=t[n];if(c===null||c&&r==c.key&&o===c.type&&!(131072&c.__u))return n;if(i>(c!=null&&!(131072&c.__u)?1:0))for(;a>=0||s<t.length;){if(a>=0){if((c=t[a])&&!(131072&c.__u)&&r==c.key&&o===c.type)return a;a--}if(s<t.length){if((c=t[s])&&!(131072&c.__u)&&r==c.key&&o===c.type)return s;s++}}return-1}function _f(e,t,n){t[0]==="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||Fb.test(t)?n:n+"px"}function sa(e,t,n,i,r){var o;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||_f(e.style,t,"");if(n)for(t in n)i&&n[t]===i[t]||_f(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")o=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||t==="onFocusOut"||t==="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n.u=i.u:(n.u=Kl,e.addEventListener(t,o?tl:el,o)):e.removeEventListener(t,o?tl:el,o);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t in e)try{e[t]=n==null?"":n;break e}catch(a){}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function bf(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=Kl++;else if(t.t<n.u)return;return n(Fe.event?Fe.event(t):t)}}}function Zl(e,t,n,i,r,o,a,s,c,l){var u,p,f,d,h,m,v,E,w,_,x,P,A,C,I,T=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=Fe.__b)&&u(t);e:if(typeof T=="function")try{if(E=t.props,w=(u=T.contextType)&&i[u.__c],_=u?w?w.props.value:u.__:i,n.__c?v=(p=t.__c=n.__c).__=p.__E:("prototype"in T&&T.prototype.render?t.__c=p=new T(E,_):(t.__c=p=new Da(E,_),p.constructor=T,p.render=zb),w&&w.sub(p),p.props=E,p.state||(p.state={}),p.context=_,p.__n=i,f=p.__d=!0,p.__h=[],p._sb=[]),p.__s==null&&(p.__s=p.state),T.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=Kn({},p.__s)),Kn(p.__s,T.getDerivedStateFromProps(E,p.__s))),d=p.props,h=p.state,p.__v=t,f)T.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(T.getDerivedStateFromProps==null&&E!==d&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(E,_),!p.__e&&(p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(E,p.__s,_)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(p.props=E,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(k){k&&(k.__=t)}),x=0;x<p._sb.length;x++)p.__h.push(p._sb[x]);p._sb=[],p.__h.length&&a.push(p);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(E,p.__s,_),p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(d,h,m)})}if(p.context=_,p.props=E,p.__P=e,p.__e=!1,P=Fe.__r,A=0,"prototype"in T&&T.prototype.render){for(p.state=p.__s,p.__d=!1,P&&P(t),u=p.render(p.props,p.state,p.context),C=0;C<p._sb.length;C++)p.__h.push(p._sb[C]);p._sb=[]}else do p.__d=!1,P&&P(t),u=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++A<25);p.state=p.__s,p.getChildContext!=null&&(i=Kn(Kn({},i),p.getChildContext())),f||p.getSnapshotBeforeUpdate==null||(m=p.getSnapshotBeforeUpdate(d,h)),Pm(e,Xl(I=u!=null&&u.type===ps&&u.key==null?u.props.children:u)?I:[I],t,n,i,r,o,a,s,c,l),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),v&&(p.__E=p.__=null)}catch(k){t.__v=null,c||o!=null?(t.__e=s,t.__u|=c?160:32,o[o.indexOf(s)]=null):(t.__e=n.__e,t.__k=n.__k),Fe.__e(k,t,n)}else o==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Gb(n.__e,t,n,i,r,o,a,c,l);(u=Fe.diffed)&&u(t)}function Am(e,t,n){t.__d=void 0;for(var i=0;i<n.length;i++)Jl(n[i],n[++i],n[++i]);Fe.__c&&Fe.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Fe.__e(o,r.__v)}})}function Gb(e,t,n,i,r,o,a,s,c){var l,u,p,f,d,h,m,v=n.props,E=t.props,w=t.type;if(w==="svg"?r="http://www.w3.org/2000/svg":w==="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l<o.length;l++)if((d=o[l])&&"setAttribute"in d==!!w&&(w?d.localName===w:d.nodeType===3)){e=d,o[l]=null;break}}if(e==null){if(w===null)return document.createTextNode(E);e=document.createElementNS(r,w,E.is&&E),o=null,s=!1}if(w===null)v===E||s&&e.data===E||(e.data=E);else{if(o=o&&us.call(e.childNodes),v=n.props||Qr,!s&&o!=null)for(v={},l=0;l<e.attributes.length;l++)v[(d=e.attributes[l]).name]=d.value;for(l in v)if(d=v[l],l!="children"){if(l=="dangerouslySetInnerHTML")p=d;else if(l!=="key"&&!(l in E)){if(l=="value"&&"defaultValue"in E||l=="checked"&&"defaultChecked"in E)continue;sa(e,l,null,d,r)}}for(l in E)d=E[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?h=d:l=="checked"?m=d:l==="key"||s&&typeof d!="function"||v[l]===d||sa(e,l,d,v[l],r);if(u)s||p&&(u.__html===p.__html||u.__html===e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(p&&(e.innerHTML=""),Pm(e,Xl(f)?f:[f],t,n,i,w==="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Ni(n,0),s,c),o!=null)for(l=o.length;l--;)o[l]!=null&&Sm(o[l]);s||(l="value",h!==void 0&&(h!==e[l]||w==="progress"&&!h||w==="option"&&h!==v[l])&&sa(e,l,h,v[l],r),l="checked",m!==void 0&&m!==e[l]&&sa(e,l,m,v[l],r))}return e}function Jl(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(i){Fe.__e(i,n)}}function nl(e,t,n){var i,r;if(Fe.unmount&&Fe.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||Jl(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Fe.__e(o,t)}i.base=i.__P=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&nl(i[r],t,n||typeof e.type!="function");n||e.__e==null||Sm(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function zb(e,t,n){return this.constructor(e,n)}function Im(e,t,n){var i,r,o,a;Fe.__&&Fe.__(e,t),r=(i=typeof n=="function")?null:t.__k,o=[],a=[],Zl(t,e=(!i&&n||t).__k=Cm(ps,null,[e]),r||Qr,Qr,t.namespaceURI,!i&&n?[n]:r?null:t.firstChild?us.call(t.childNodes):null,o,!i&&n?n:r?r.__e:t.firstChild,i,a),Am(o,e,a)}us=wm.slice,Fe={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},Em=0,Da.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Kn({},this.state),typeof e=="function"&&(e=e(Kn({},n),this.props)),e&&Kn(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),yf(this))},Da.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),yf(this))},Da.prototype.render=ps,Ri=[],xm=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Qc=function(e,t){return e.__v.__b-t.__v.__b},Ha.__r=0,Kl=0,el=bf(!1),tl=bf(!0);var Mm=function(e,t,n,i){var r;t[0]=0;for(var o=1;o<t.length;o++){var a=t[o++],s=t[o]?(t[0]|=a?1:2,n[t[o++]]):t[++o];a===3?i[0]=s:a===4?i[1]=Object.assign(i[1]||{},s):a===5?(i[1]=i[1]||{})[t[++o]]=s:a===6?i[1][t[++o]]+=s+"":a?(r=e.apply(s,Mm(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Ef=new Map;function Vb(e){var t=Ef.get(this);return t||(t=new Map,Ef.set(this,t)),(t=Mm(this,t.get(e)||(t.set(e,t=function(n){for(var i,r,o=1,a="",s="",c=[0],l=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},u=0;u<n.length;u++){u&&(o===1&&l(),l(u));for(var p=0;p<n[u].length;p++)i=n[u][p],o===1?i==="<"?(l(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[u][p+1]===">")?(l(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
`||i==="\r"?(l(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return l(),c}(e)),t),arguments,[])).length>1?t:t[0]}var $e=Vb.bind(Cm),cr,je,xc,xf,eo=0,Dm=[],ka=[],Ve=Fe,wf=Ve.__b,Sf=Ve.__r,Cf=Ve.diffed,Tf=Ve.__c,Pf=Ve.unmount,Rf=Ve.__;function fs(e,t){Ve.__h&&Ve.__h(je,e,eo||t),eo=0;var n=je.__H||(je.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:ka}),n.__[e]}function wc(e){return eo=1,Ub(Om,e)}function Ub(e,t,n){var i=fs(cr++,2);if(i.t=e,!i.__c&&(i.__=[Om(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],l=i.t(c,s);c!==l&&(i.__N=[l,i.__[1]],i.__c.setState({}))}],i.__c=je,!je.u)){var r=function(s,c,l){if(!i.__c.__H)return!0;var u=i.__c.__H.__.filter(function(f){return!!f.__c});if(u.every(function(f){return!f.__N}))return!o||o.call(this,s,c,l);var p=!1;return u.forEach(function(f){if(f.__N){var d=f.__[0];f.__=f.__N,f.__N=void 0,d!==f.__[0]&&(p=!0)}}),!(!p&&i.__c.props===s)&&(!o||o.call(this,s,c,l))};je.u=!0;var o=je.shouldComponentUpdate,a=je.componentWillUpdate;je.componentWillUpdate=function(s,c,l){if(this.__e){var u=o;o=void 0,r(s,c,l),o=u}a&&a.call(this,s,c,l)},je.shouldComponentUpdate=r}return i.__N||i.__}function il(e,t){var n=fs(cr++,3);!Ve.__s&&Ql(n.__H,t)&&(n.__=e,n.i=t,je.__H.__h.push(n))}function rl(e,t){var n=fs(cr++,4);!Ve.__s&&Ql(n.__H,t)&&(n.__=e,n.i=t,je.__h.push(n))}function km(e){return eo=5,lr(function(){return{current:e}},[])}function lr(e,t){var n=fs(cr++,7);return Ql(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function kr(e,t){return eo=8,lr(function(){return e},t)}function Wb(){for(var e;e=Dm.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Oa),e.__H.__h.forEach(ol),e.__H.__h=[]}catch(t){e.__H.__h=[],Ve.__e(t,e.__v)}}Ve.__b=function(e){je=null,wf&&wf(e)},Ve.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Rf&&Rf(e,t)},Ve.__r=function(e){Sf&&Sf(e),cr=0;var t=(je=e.__c).__H;t&&(xc===je?(t.__h=[],je.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=ka,n.__N=n.i=void 0})):(t.__h.forEach(Oa),t.__h.forEach(ol),t.__h=[],cr=0)),xc=je},Ve.diffed=function(e){Cf&&Cf(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Dm.push(t)!==1&&xf===Ve.requestAnimationFrame||((xf=Ve.requestAnimationFrame)||Yb)(Wb)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==ka&&(n.__=n.__V),n.i=void 0,n.__V=ka})),xc=je=null},Ve.__c=function(e,t){t.some(function(n){try{n.__h.forEach(Oa),n.__h=n.__h.filter(function(i){return!i.__||ol(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Ve.__e(i,n.__v)}}),Tf&&Tf(e,t)},Ve.unmount=function(e){Pf&&Pf(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(i){try{Oa(i)}catch(r){t=r}}),n.__H=void 0,t&&Ve.__e(t,n.__v))};var Af=typeof requestAnimationFrame=="function";function Yb(e){var t,n=function(){clearTimeout(i),Af&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);Af&&(t=requestAnimationFrame(n))}function Oa(e){var t=je,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),je=t}function ol(e){var t=je;e.__c=e.__(),je=t}function Ql(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Om(e,t){return typeof t=="function"?t(e):t}function Nm(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Nm(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Ga(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Nm(e))&&(i&&(i+=" "),i+=t);return i}function qb(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=lr(()=>Kb(t),[t]);return $e`
<div class="djs-popup-header">
<h3 class="djs-popup-title" title=${o}>${o}</h3>
${a.map(s=>$e`
<ul key=${s.id} class="djs-popup-header-group" data-header-group=${s.id}>
${s.entries.map(c=>$e`
<li key=${c.id}>
<${c.action?"button":"span"}
class=${Xb(c,c===i)}
onClick=${l=>c.action&&n(l,c)}
title=${c.title||c.label}
data-id=${c.id}
onMouseEnter=${()=>c.action&&r(c)}
onMouseLeave=${()=>c.action&&r(null)}
onFocus=${()=>c.action&&r(c)}
onBlur=${()=>c.action&&r(null)}
>
${c.imageUrl&&$e`<img class="djs-popup-entry-icon" src=${c.imageUrl} alt="" />`||c.imageHtml&&$e`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:c.imageHtml}} />`}
${c.label?$e`
<span class="djs-popup-label">${c.label}</span>
`:null}
</${c.action?"button":"span"}>
</li>
`)}
</ul>
`)}
</div>
`}function Kb(e){return e.reduce((t,n)=>{const i=n.group||"default",r=t.find(o=>o.id===i);return r?r.entries.push(n):t.push({id:i,entries:[n]}),t},[])}function Xb(e,t){return Ga("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Zb(e){const{entry:t,selected:n,onMouseEnter:i,onMouseLeave:r,onAction:o}=e;return $e`
<li
class=${Ga("entry",{selected:n})}
data-id=${t.id}
title=${t.title||t.label}
tabIndex="0"
onClick=${o}
onFocus=${i}
onBlur=${r}
onMouseEnter=${i}
onMouseLeave=${r}
onDragStart=${a=>o(a,t,"dragstart")}
aria-role="button"
draggable=${!0}
>
<div class="djs-popup-entry-content">
<span
class=${Ga("djs-popup-entry-name",t.className)}
>
${t.imageUrl&&$e`<img class="djs-popup-entry-icon" src=${t.imageUrl} alt="" />`||t.imageHtml&&$e`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:t.imageHtml}} />`}
${t.label?$e`
<span class="djs-popup-label">
${t.label}
</span>
`:null}
</span>
${t.description&&$e`
<span
class="djs-popup-entry-description"
title=${t.description}
>
${t.description}
</span>
`}
</div>
${t.documentationRef&&$e`
<div class="djs-popup-entry-docs">
<a
href="${t.documentationRef}"
onClick=${a=>a.stopPropagation()}
title="Open element documentation"
target="_blank"
rel="noopener"
>
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.6368 10.6375V5.91761H11.9995V10.6382C11.9995 10.9973 11.8623 11.3141 11.5878 11.5885C11.3134 11.863 10.9966 12.0002 10.6375 12.0002H1.36266C0.982345 12.0002 0.660159 11.8681 0.396102 11.6041C0.132044 11.34 1.52588e-05 11.0178 1.52588e-05 10.6375V1.36267C1.52588e-05 0.98236 0.132044 0.660173 0.396102 0.396116C0.660159 0.132058 0.982345 2.95639e-05 1.36266 2.95639e-05H5.91624V1.36267H1.36266V10.6375H10.6368ZM12 0H7.2794L7.27873 1.36197H9.68701L3.06507 7.98391L4.01541 8.93425L10.6373 2.31231V4.72059H12V0Z" fill="#818798"/>
</svg>
</a>
</div>
`}
</li>
`}function Jb(e){const s=e,{selectedEntry:t,setSelectedEntry:n,entries:i}=s,r=_c(s,["selectedEntry","setSelectedEntry","entries"]),o=km(),a=lr(()=>Qb(i),[i]);return rl(()=>{const c=o.current;if(!c)return;const l=c.querySelector(".selected");l&&eE(l)},[t]),$e`
<div class="djs-popup-results" ref=${o}>
${a.map(c=>$e`
${c.name&&$e`
<div key=${c.id} class="entry-header" title=${c.name}>
${c.name}
</div>
`}
<ul class="djs-popup-group" data-group=${c.id}>
${c.entries.map(l=>$e`
<${Zb}
key=${l.id}
entry=${l}
selected=${l===t}
onMouseEnter=${()=>n(l)}
onMouseLeave=${()=>n(null)}
...${r}
/>
`)}
</ul>
`)}
</div>
`}function Qb(e){const t=[],n=o=>t.find(a=>o.id===a.id),i=o=>!!n(o),r=o=>typeof o=="string"?{id:o}:o;return e.forEach(o=>{const a=o.group?r(o.group):{id:"default"};i(a)?n(a).entries.push(o):t.push(Pe(te({},a),{entries:[o]}))}),t}function eE(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}function tE(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:l,emptyPlaceholder:u,entries:p,onOpened:f,onClosed:d}=e,h=lr(()=>It(l)?p.length>5:!1,[l,p]),[m,v]=wc(""),E=kr((B,K)=>{if(!h)return B;const Z=Ae=>{if(!K)return(Ae.rank||0)>=0;if(Ae.searchable===!1)return!1;const Ye=[Ae.description||"",Ae.label||"",Ae.search||""].map(Ie=>Ie.toLowerCase());return K.toLowerCase().split(/\s/g).every(Ie=>Ye.some(U=>U.includes(Ie)))};return B.filter(Z)},[h]),[w,_]=wc(E(p,m)),[x,P]=wc(w[0]),A=kr(B=>{(!x||!B.includes(x))&&P(B[0]),_(B)},[x,_,P]);il(()=>{A(E(p,m))},[m,p]);const C=kr(B=>{let Z=w.indexOf(x)+B;Z<0&&(Z=w.length-1),Z>=w.length&&(Z=0),P(w[Z])},[w,x,P]),I=kr(B=>{if(B.key==="Enter"&&x)return n(B,x);if(B.key==="ArrowUp")return C(-1),B.preventDefault();if(B.key==="ArrowDown")return C(1),B.preventDefault()},[n,x,C]),T=kr(B=>{es(B.target,"input")&&v(()=>B.target.value)},[v]);il(()=>(f(),()=>{d()}),[]);const k=lr(()=>a||r.length>0,[a,r]);return $e`
<${If}
onClose=${t}
onKeyup=${T}
onKeydown=${I}
className=${i}
position=${o}
width=${s}
scale=${c}
>
${k&&$e`
<${qb}
headerEntries=${r}
onSelect=${n}
selectedEntry=${x}
setSelectedEntry=${P}
title=${a}
/>
`}
${p.length>0&&$e`
<div class="djs-popup-body">
${h&&$e`
<div class="djs-popup-search">
<svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
</svg>
<input type="text" aria-label="${a}" />
</div>
`}
<${Jb}
entries=${w}
selectedEntry=${x}
setSelectedEntry=${P}
onAction=${n}
/>
</div>
`}
${u&&w.length===0&&$e`
<div class="djs-popup-no-results">${zt(u)?u(m):u}</div>
`}
</${If}>
`}function If(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,position:a}=e,s=km();return rl(()=>{if(typeof a!="function")return;const c=s.current,l=a(c);c.style.left=`${l.x}px`,c.style.top=`${l.y}px`},[s.current,a]),rl(()=>{const c=s.current;if(!c)return;(c.querySelector("input")||c).focus()},[]),il(()=>{const c=u=>{if(u.key==="Escape")return u.preventDefault(),t()},l=u=>{if(!ro(u.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",c),document.body.addEventListener("click",l),()=>{document.documentElement.removeEventListener("keydown",c),document.body.removeEventListener("click",l)}},[]),$e`
<div
class=${Ga("djs-popup",r)}
style=${nE(e)}
onKeydown=${n}
onKeyup=${i}
ref=${s}
tabIndex="-1"
>
${o}
</div>
`}function nE(e){return{transform:`scale(${e.scale})`,width:`${e.width}px`,"transform-origin":"top left"}}var iE="data-id",Lm=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],rE=1e3;function ke(e,t,n){this._eventBus=t,this._canvas=n,this._current=null;var i=It(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:i},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",r=>{const o=this.isOpen()&&this._current.target;r.element===o&&this.refresh()})}ke.$inject=["config.popupMenu","eventBus","canvas"];ke.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=Object.entries(n).map(([f,d])=>te({id:f},d)),s=Object.entries(i).map(([f,d])=>te({id:f},d)),c=e&&(f=>this._ensureVisible(f,e)),l=this._updateScale(this._current.container);Im($e`
<${tE}
onClose=${f=>this.close(f)}
onSelect=${(f,d,h)=>this.trigger(f,d,h)}
position=${c}
className=${t}
entries=${a}
headerEntries=${s}
emptyPlaceholder=${r}
scale=${l}
onOpened=${this._onOpened.bind(this)}
onClosed=${this._onClosed.bind(this)}
...${te({},o)}
/>
`,this._current.container)};ke.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");this.isOpen()&&this.close();const{entries:r,headerEntries:o,emptyPlaceholder:a}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:r,headerEntries:o,emptyPlaceholder:a,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()};ke.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:r}=this._getContext(e,t);this._current=Pe(te({},this._current),{entries:n,headerEntries:i,emptyPlaceholder:r}),this._emit("refresh"),this._render()};ke.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),r=this._getHeaderEntries(e,n),o=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:r,emptyPlaceholder:o,empty:!(Object.keys(i).length||Object.keys(r).length)}};ke.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._current=null)};ke.prototype.reset=function(){const e=this._current.container;Im(null,e),or(e)};ke.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)};ke.prototype._onOpened=function(){this._emit("opened")};ke.prototype._onClosed=function(){this._emit("closed")};ke.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=et(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i};ke.prototype._bindAutoClose=function(){this._eventBus.once(Lm,this.close,this)};ke.prototype._unbindAutoClose=function(){this._eventBus.off(Lm,this.close,this)};ke.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,r=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),It(n)&&e<n&&(r=n),It(i)&&e>i&&(r=i)),r};ke.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),r={},o=t.x,a=t.y;return t.x+i.width>n.width&&(r.x=!0),t.y+i.height>n.height&&(r.y=!0),r.x&&r.y?(o=t.x-i.width,a=t.y-i.height):r.x?(o=t.x-i.width,a=t.y):r.y&&t.y<i.height?(o=t.x,a=10):r.y&&(o=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:o,y:a}};ke.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length?!0:this._getContext(e,t).empty};ke.prototype.registerProvider=function(e,t,n){n||(n=t,t=rE),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})};ke.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers};ke.prototype._getEntries=function(e,t){var n={};return D(t,function(i){if(!i.getPopupMenuEntries){D(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Rn(o,["id"])});return}var r=i.getPopupMenuEntries(e);zt(r)?n=r(n):D(r,function(o,a){n[a]=o})}),n};ke.prototype._getHeaderEntries=function(e,t){var n={};return D(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;D(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Rn(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);zt(r)?n=r(n):D(r,function(o,a){n[a]=o})}),n};ke.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>zt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()};ke.prototype.isOpen=function(){return!!this._current};ke.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=ro(e.delegateTarget||e.target,".entry",!0),o=lt(r,iE);t=te({id:o},this._getEntry(o))}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(zt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}};ke.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};const eu={__init__:["popupMenu"],popupMenu:["type",ke]};var Bm={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
<line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
<rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
<rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
</svg>`,bottom:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
<line x1="150" y1="1650" x2="1650" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
<rect x="150" y="350" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
<rect x="1050" y="850" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
</svg>`,center:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
<line x1="900" y1="150" x2="900" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
<rect x="250" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
<rect x="500" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
</svg>`,left:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
<line x1="100" y1="150" x2="100" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
<rect x="100" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
<rect x="100" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
</svg>`,right:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
<line x1="1650" y1="150" x2="1650" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
<rect x="350" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
<rect x="850" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
</svg>`,top:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
<line x1="150" y1="150" x2="1650" y2="150" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
<rect x="150" y="150" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
<rect x="1050" y="150" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
</svg>`,middle:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
<line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
<rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
<rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
</svg>`},oE=900;function gr(e,t,n,i){e.registerProvider(oE,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}gr.$inject=["contextPad","popupMenu","translate","canvas"];gr.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&N(t,this._getEntries(e)),t};gr.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")};gr.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Bm.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);N(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}};gr.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var aE=["left","center","right","top","middle","bottom"];function po(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}po.$inject=["popupMenu","alignElements","translate","rules"];po.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&N(t,this._getEntries(e)),t};po.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})};po.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return D(aE,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Bm[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Ut(e){H.call(this,e),this.init()}Ut.$inject=["eventBus"];q(Ut,H);Ut.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){i.canExecute(r,t,function(o,a,s){return n(o)},!0)})};Ut.prototype.init=function(){};function ds(e){Ut.call(this,e)}ds.$inject=["eventBus"];q(ds,Ut);ds.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=pe(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=ts(n),n.length<2?!1:n})};const sE={__depends__:[Db,bm,eu],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",gr],alignElementsMenuProvider:["type",po],bpmnAlignElements:["type",ds]};var cE=10,$m=50,lE=250;function tu(e,t,n,i){for(var r;r=uE(e,n,t);)n=i(t,n,r);return n}function nu(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,l=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-l+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+l+c)}}),r}}function uE(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=fE(e);return Me(r,function(o){if(o===n)return!1;var a=ft(o,i,cE);return a==="intersect"})}function pE(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||$m,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||lE,c=t.reference||"start";o||(o=mE);function l(h,m){return r==="n"?c==="start"?Q(h).top-Q(m).bottom:c==="center"?Q(h).top-re(m).y:Q(h).top-Q(m).top:r==="w"?c==="start"?Q(h).left-Q(m).right:c==="center"?Q(h).left-re(m).x:Q(h).left-Q(m).left:r==="s"?c==="start"?Q(m).top-Q(h).bottom:c==="center"?re(m).y-Q(h).bottom:Q(m).bottom-Q(h).bottom:c==="start"?Q(m).left-Q(h).right:c==="center"?re(m).x-Q(h).right:Q(m).right-Q(h).right}var u=e.incoming.filter(o).map(function(h){var m=a(h),v=m<0?l(h.source,e):l(e,h.source);return{id:h.source.id,distance:v,weight:m}}),p=e.outgoing.filter(o).map(function(h){var m=a(h),v=m>0?l(e,h.target):l(h.target,e);return{id:h.target.id,distance:v,weight:m}}),f=u.concat(p).reduce(function(h,m){return h[m.id+"__weight_"+m.weight]=m,h},{}),d=ni(f,function(h,m){var v=m.distance,E=m.weight;return v<0||v>s||(h[String(v)]||(h[String(v)]=0),h[String(v)]+=1*E,(!h.distance||h[h.distance]<h[String(v)])&&(h.distance=v)),h},{});return d.distance||i}function fE(e){var t=Sc(e);return e.host&&(t=t.concat(Sc(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Sc(i))},[]))),t}function Sc(e){return hE(e).concat(dE(e))}function dE(e){return e.incoming.map(function(t){return t.source})}function hE(e){return e.outgoing.map(function(t){return t.target})}function mE(){return!0}var vE=100;function Fm(e,t,n){e.on("autoPlace",vE,function(i){var r=i.shape,o=i.source;return gE(o,r)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,r,o){e.fire("autoPlace.start",{source:i,shape:r});var a=e.fire("autoPlace",{source:i,shape:r}),s=t.appendShape(i,r,a,i.parent,o);return e.fire("autoPlace.end",{source:i,shape:s}),s}}Fm.$inject=["eventBus","modeling","canvas"];function gE(e,t,n){n||(n={});var i=n.defaultDistance||$m,r=re(e),o=Q(e);return{x:o.right+i+t.width/2,y:r.y}}function jm(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}jm.$inject=["eventBus","selection"];const yE={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Fm],autoPlaceSelectionBehavior:["type",jm]};function to(e,t){for(ns(t)&&(t=[t]);e=e.parent;)if(ce(e,t))return e;return null}function hs(e){var t=["bpmn:Participant","bpmn:Lane"],n=to(e,t);return n?gt(n):ce(e,t)?gt(e):!0}function Hm(e,t){if(g(t,"bpmn:TextAnnotation"))return bE(e,t);if(ce(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return EE(e,t);if(g(t,"bpmn:FlowNode"))return _E(e,t)}function _E(e,t){var n=Q(e),i=re(e),r=hs(e),o=r?{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=pE(e,{filter:function(d){return g(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,l=o.baseOrientation;g(e,"bpmn:BoundaryEvent")&&(l=ft(e,e.host,-25),l.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var u=r?{x:n.right+a+t.width/2,y:i.y+Mf(l,c,o)}:{x:i.x+Mf(l,c,o),y:n.bottom+a+t.height/2},p={margin:s,minDistance:c},f=r?{y:p}:{x:p};return tu(e,t,u,nu(f))}function Mf(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function bE(e,t){var n=Q(e),i=hs(e),r=i?{x:n.right+t.width/2,y:n.top-50-t.height/2}:{x:n.right+50+t.width/2,y:n.bottom+t.height/2};Ce(e)&&(r=re(e),i?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:i?-30:30,minDistance:20},a=i?{y:o}:{x:o};return tu(e,t,r,nu(a))}function EE(e,t){var n=Q(e),i=hs(e),r=i?{x:n.right-10+t.width/2,y:n.bottom+40+t.width/2}:{x:n.left-40-t.width/2,y:n.bottom-10+t.height/2},o={margin:30,minDistance:30},a=i?{x:o}:{y:o};return tu(e,t,r,nu(a))}function Gm(e){e.on("autoPlace",function(t){var n=t.shape,i=t.source;return Hm(i,n)})}Gm.$inject=["eventBus"];const iu={__depends__:[yE],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Gm]};function In(e,t,n,i){H.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,l=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],l)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=Bl($l(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=is(s,function(p){return p.parent.id});D(u,function(p,f){me(l)&&(p=p.filter(function(d){return Me(l,Cn({id:d.id}))})),r._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,l=c.parent;s&&s.autoResize===!1||l&&r._expand([c],l)})}In.$inject=["eventBus","elementRegistry","modeling","rules"];q(In,H);In.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Q(Mt(e)),o=Q(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),Fl(N({},o,a))};In.prototype._expand=function(e,t){typeof t=="string"&&(t=this._elementRegistry.get(t));var n=this._rules.allowed("element.autoResize",{elements:e,target:t});if(n){var i=this._getOptimalBounds(e,t);if(xE(i,t)){var r=wE(mn(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}};In.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}};In.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}};In.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function xE(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function wE(e,t){var n="";return e=Q(e),t=Q(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 ms(e){e.invoke(In,this)}ms.$inject=["injector"];q(ms,In);ms.prototype.resize=function(e,t,n){g(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function fo(e){Ut.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}fo.$inject=["eventBus"];q(fo,Ut);fo.prototype.canResize=function(e,t){return!1};function vs(e,t){fo.call(this,e),this._modeling=t}q(vs,fo);vs.$inject=["eventBus","modeling"];vs.prototype.canResize=function(e,t){if(g(t.di,"bpmndi:BPMNPlane")||!g(t,"bpmn:Participant")&&!g(t,"bpmn:Lane")&&!g(t,"bpmn:SubProcess"))return!1;var n=!0;return D(e,function(i){if(g(i,"bpmn:Lane")||be(i)){n=!1;return}}),n};const SE={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",ms],bpmnAutoResizeProvider:["type",vs]};var Df=1500;function zm(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),l=c&&e.get(c);c&&l&&(a.stopPropagation(),r.hover({element:l,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",Df,function(s){o(s)})}),function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Df,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=qr(a),c=document.elementFromPoint(s.x,s.y),CE(c)}}zm.$inject=["elementRegistry","eventBus","injector"];function CE(e){return ro(e,"svg, .djs-element",!0)}const TE={__init__:["hoverFix"],hoverFix:["type",zm]};var Ki=Math.round,kf="djs-drag-active";function xi(e){e.preventDefault()}function PE(e){return typeof TouchEvent!="undefined"&&e instanceof TouchEvent}function RE(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Vm(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(_){var x=t.viewbox(),P=t._container.getBoundingClientRect();return{x:x.x+(_.x-P.left)/x.scale,y:x.y+(_.y-P.top)/x.scale}}function s(_,x){x=x||o;var P=e.createEvent(N({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+_,P)===!1?!1:e.fire(x.prefix+"."+_,P)}function c(_){var x=_.filter(function(P){return i.get(P.id)});x.length&&n.select(x)}function l(_,x){var P=o.payload,A=o.displacement,C=o.globalStart,I=qr(_),T=Tn(I,C),k=o.localStart,B=a(I),K=Tn(B,k);if(!o.active&&(x||RE(T)>o.threshold)){if(N(P,{x:Ki(k.x+A.x),y:Ki(k.y+A.y),dx:0,dy:0},{originalEvent:_}),s("start")===!1)return v();o.active=!0,o.keepSelection||(P.previousSelection=n.get(),n.select(null)),o.cursor&&Qh(o.cursor),t.addMarker(t.getRootElement(),kf)}bc(_),o.active&&(N(P,{x:Ki(B.x+A.x),y:Ki(B.y+A.y),dx:Ki(K.x),dy:Ki(K.y)},{originalEvent:_}),s("move"))}function u(_){var x,P=!0;o.active&&(_&&(o.payload.originalEvent=_,bc(_)),P=s("end")),P===!1&&s("rejected"),x=E(P!==!0),s("ended",x)}function p(_){Xe("Escape",_)&&(xi(_),v())}function f(_){var x;o.active&&(x=b_(e),setTimeout(x,400),xi(_)),u(_)}function d(_){l(_)}function h(_){var x=o.payload;x.hoverGfx=_.gfx,x.hover=_.element,s("hover")}function m(_){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function v(_){var x;if(o){var P=o.active;P&&s("cancel"),x=E(_),P&&s("canceled",x)}}function E(_){var x,P;s("cleanup"),__(),o.trapClick?P=f:P=u,ne.unbind(document,"mousemove",l),ne.unbind(document,"dragstart",xi),ne.unbind(document,"selectstart",xi),ne.unbind(document,"mousedown",P,!0),ne.unbind(document,"mouseup",P,!0),ne.unbind(document,"keyup",p),ne.unbind(document,"touchstart",d,!0),ne.unbind(document,"touchcancel",v,!0),ne.unbind(document,"touchmove",l,!0),ne.unbind(document,"touchend",u,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),kf);var A=o.payload.previousSelection;return _!==!1&&A&&!n.get().length&&c(A),x=o,o=null,x}function w(_,x,P,A){o&&v(!1),typeof x=="string"&&(A=P,P=x,x=null),A=N({},r,A||{});var C=A.data||{},I,T,k,B,K;A.trapClick?B=f:B=u,_?(I=Jh(_)||_,T=qr(_),bc(_),I.type==="dragstart"&&xi(I)):(I=null,T={x:0,y:0}),k=a(T),x||(x=k),K=PE(I),o=N({prefix:P,data:C,payload:{},globalStart:T,displacement:Tn(x,k),localStart:k,isTouch:K},A),A.manual||(K?(ne.bind(document,"touchstart",d,!0),ne.bind(document,"touchcancel",v,!0),ne.bind(document,"touchmove",l,!0),ne.bind(document,"touchend",u,!0)):(ne.bind(document,"mousemove",l),ne.bind(document,"dragstart",xi),ne.bind(document,"selectstart",xi),ne.bind(document,"mousedown",B,!0),ne.bind(document,"mouseup",B,!0)),ne.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",m)),s("init"),A.autoActivate&&l(_,!0)}e.on("diagram.destroy",v),this.init=w,this.move=l,this.hover=h,this.out=m,this.end=u,this.cancel=v,this.context=function(){return o},this.setOptions=function(_){N(r,_)}}Vm.$inject=["eventBus","canvas","selection","elementRegistry"];const Mn={__depends__:[TE,An],dragging:["type",Vm]};function yr(e,t,n){this._canvas=n,this._opts=N({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}yr.$inject=["config.autoScroll","eventBus","canvas"];yr.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)AE(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(c===0?a=n.scrollStep:c==1?s=n.scrollStep:c==2?a=-n.scrollStep:c==3&&(s=-n.scrollStep));(a!==0||s!==0)&&(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))};function AE(e,t,n){return t<e&&e<n}yr.prototype.stopScroll=function(){clearTimeout(this._scrolling)};yr.prototype.setOptions=function(e){this._opts=N({},this._opts,e)};yr.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=qr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const IE={__depends__:[Mn],__init__:["autoScroll"],autoScroll:["type",yr]};function ru(e){this._commandStack=e.get("commandStack",!1)}ru.$inject=["injector"];ru.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const yn={__init__:["rules"],rules:["type",ru]};var ca=Math.round,ME=Math.max;function DE(e,t){var n=e.x,i=e.y;return[["M",n,i],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function kE(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Um=10;function OE(e,t){var n,i;for(n=0;i=e[n];n++)if(em(i,t)<=Um)return{point:e[n],bendpoint:!0,index:n};return null}function NE(e,t){var n=E_(DE(t,Um),kE(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=ME(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:ca(i.x+r.x)/2,y:ca(i.y+r.y)/2},index:i.segment2}:{point:{x:ca(i.x),y:ca(i.y)},index:i.segment2}:null}function al(e,t){return OE(e,t)||NE(e,t)}function Wm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Of(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function LE(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 BE(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],r=i[0].n*t[0]+i[1].n*t[1],o=i[0].lambda*t[0]+i[1].lambda*t[1];return-r/o}function ou(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=BE([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function Ym(e,t){var n=ou(e,t),i={x:n.x-e.x,y:n.y-e.y};return Wm(i)}function za(e,t){return Wm({x:e.x-t.x,y:e.y-t.y})}var qm="djs-bendpoint",Km="djs-segment-dragger";function $E(e,t){var n=qr(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function sl(e,t,n){var i=$E(e,n),r=al(t,i);return r}function cl(e,t){var n=ve("g");Re(n).add(qm),ge(e,n);var i=ve("circle");ae(i,{cx:0,cy:0,r:4}),Re(i).add("djs-visual"),ge(n,i);var r=ve("circle");return ae(r,{cx:0,cy:0,r:10}),Re(r).add("djs-hit"),ge(n,r),t&&Re(n).add(t),n}function FE(e,t,n,i){var r=ve("g");ge(e,r);var o=18,a=6,s=11,c=HE(t,n,i),l=a+s,u=ve("rect");ae(u,{x:-o/2,y:-a/2,width:o,height:a}),Re(u).add("djs-visual"),ge(r,u);var p=ve("rect");return ae(p,{x:-c/2,y:-l/2,width:c,height:l}),Re(p).add("djs-hit"),ge(r,p),x_(r,i==="v"?90:0),r}function Xm(e,t,n){var i=ve("g"),r=Uc(t,n),o=Sn(t,n);return ge(e,i),FE(i,t,n,o),Re(i).add(Km),Re(i).add(o==="h"?"horizontal":"vertical"),mt(i,r.x,r.y),i}function ll(e){return Math.abs(Math.round(e*2/3))}function jE(e,t){var n=GE(e,t);return ou(e,n)}function HE(e,t,n){var i=t.x-e.x,r=t.y-e.y;return ll(n==="h"?i:r)}function GE(e,t){for(var n=t.waypoints,i=1/0,r,o=0;o<n.length-1;o++){var a=n[o],s=n[o+1],c=Ym(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function Zm(e,t,n,i,r){function o(_,x,P){var A=_.index,C=_.point,I,T,k,B,K,Z;return A<=0||_.bendpoint?!1:(I=x[A-1],T=x[A],k=Uc(I,T),B=Sn(I,T),K=Math.abs(C.x-k.x),Z=Math.abs(C.y-k.y),B&&K<=P&&Z<=P)}function a(_,x){var P=_.waypoints,A,C,I,T;return x.index<=0||x.bendpoint||(A={start:P[x.index-1],end:P[x.index]},C=Sn(A.start,A.end),!C)?null:(C==="h"?I=A.end.x-A.start.x:I=A.end.y-A.start.y,T=ll(I)/2,T)}function s(_,x){var P=x.waypoints,A=sl(t,P,_),C;if(A)return C=a(x,A),o(A,P,C)?r.start(_,x,A.index):i.start(_,x,A.index,!A.bendpoint),!0}function c(_,x,P){ne.bind(_,x,function(A){n.triggerMouseEvent(x,A,P),A.stopPropagation()})}function l(_,x){var P=t.getLayer("overlays"),A=De('.djs-bendpoints[data-element-id="'+Oi(_.id)+'"]',P);return!A&&x&&(A=ve("g"),ae(A,{"data-element-id":_.id}),Re(A).add("djs-bendpoints"),ge(P,A),c(A,"mousedown",_),c(A,"click",_),c(A,"dblclick",_)),A}function u(_,x){return De('.djs-segment-dragger[data-segment-idx="'+_+'"]',x)}function p(_,x){x.waypoints.forEach(function(P,A){var C=cl(_);ge(_,C),mt(C,P.x,P.y)}),cl(_,"floating")}function f(_,x){for(var P=x.waypoints,A,C,I,T=1;T<P.length;T++)A=P[T-1],C=P[T],Sn(A,C)&&(I=Xm(_,A,C),ae(I,{"data-segment-idx":T}),c(I,"mousemove",x))}function d(_){D(nf("."+qm,_),function(x){ut(x)})}function h(_){D(nf("."+Km,_),function(x){ut(x)})}function m(_){var x=l(_);return x||(x=l(_,!0),p(x,_),f(x,_)),x}function v(_){var x=l(_);x&&(h(x),d(x),f(x,_),p(x,_))}function E(_,x){var P=De(".floating",_),A=x.point;P&&mt(P,A.x,A.y)}function w(_,x,P){var A=u(x.index,_),C=P[x.index-1],I=P[x.index],T=x.point,k=Uc(C,I),B=Sn(C,I),K,Z;A&&(K=zE(A),Z={x:T.x-k.x,y:T.y-k.y},B==="v"&&(Z={x:Z.y,y:Z.x}),mt(K,Z.x,Z.y))}e.on("connection.changed",function(_){v(_.element)}),e.on("connection.remove",function(_){var x=l(_.element);x&&ut(x)}),e.on("element.marker.update",function(_){var x=_.element,P;x.waypoints&&(P=m(x),_.add?Re(P).add(_.marker):Re(P).remove(_.marker))}),e.on("element.mousemove",function(_){var x=_.element,P=x.waypoints,A,C;if(P){if(A=l(x,!0),C=sl(t,P,_.originalEvent),!C)return;E(A,C),C.bendpoint||w(A,C,P)}}),e.on("element.mousedown",function(_){if(jl(_)){var x=_.originalEvent,P=_.element;if(P.waypoints)return s(x,P)}}),e.on("selection.changed",function(_){var x=_.newSelection,P=x[0];P&&P.waypoints&&m(P)}),e.on("element.hover",function(_){var x=_.element;x.waypoints&&(m(x),n.registerEvent(_.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(_){n.unregisterEvent(_.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(_){var x=_.element,P=_.newId;if(x.waypoints){var A=l(x);A&&ae(A,{"data-element-id":P})}}),this.addHandles=m,this.updateHandles=v,this.getBendpointsContainer=l,this.getSegmentDragger=u}Zm.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function zE(e){return De(".djs-visual",e)}var Nf=Math.round,Ti="reconnectStart",Pi="reconnectEnd",Or="updateWaypoints";function au(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,h;!l&&c===0?h=Ti:!l&&c===d.length-1?h=Pi:h=Or;var m=h===Or?"connection.updateWaypoints":"connection.reconnect",v=r.allowed(m,{connection:s,source:p,target:f});v===!1&&(v=r.allowed(m,{connection:s,source:f,target:p})),v!==!1&&i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:v,bendpointIndex:c,connection:s,source:p,target:f,insert:l,type:h}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var h=f===Or?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===Ti?p:l,target:f===Pi?p:u}),d){s.source=f===Ti?p:l,s.target=f===Pi?p:u;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===Pi?p:u,target:f===Ti?p:l})),d&&(s.source=f===Pi?p:u,s.target=f===Ti?p:l)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==Or&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,p=s.insert,f=u.waypoints.slice(),d=s.source,h=s.target,m=s.type,v=s.hints||{},E={x:Nf(a.x),y:Nf(a.y)};if(!c)return!1;m===Or?(p?f.splice(l,0,E):f[l]=E,v.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),o.updateWaypoints(u,w_(f),v)):(m===Ti?(v.docking="source",Va(s)&&(v.docking="target",v.newWaypoints=f.reverse())):m===Pi&&(v.docking="target",Va(s)&&(v.docking="source",v.newWaypoints=f.reverse())),o.reconnect(u,d,h,E,v))},this)}au.$inject=["injector","eventBus","canvas","dragging","rules","modeling"];au.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};function Va(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Ti)return t&&i&&t===i&&n!==i;if(r===Pi)return t&&n&&t===n&&n!==i}var VE="reconnectStart",UE="reconnectEnd",Lf="updateWaypoints",Nr="connect-ok",la="connect-not-ok",Bf="connect-hover",$f="djs-updating",Ff="djs-dragging",jf=1100;function Jm(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,l=a.insert,u=c.waypoints,p=u.slice();a.waypoints=u,l&&p.splice(s,0,{x:o.x,y:o.y}),c.waypoints=p;var f=a.draggerGfx=cl(i.getLayer("overlays"));Re(f).add("djs-dragging"),i.addMarker(c,Ff),i.addMarker(c,$f)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,l=a.type;if(c){if(i.addMarker(c,Bf),l===Lf)return;s?(i.removeMarker(c,la),i.addMarker(c,Nr)):s===!1&&(i.removeMarker(c,Nr),i.addMarker(c,la))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],jf,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,Bf),i.removeMarker(s,c?Nr:la))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,f=a.connection,d=f.source,h=f.target,m=f.waypoints.slice(),v={x:o.x,y:o.y},E=a.hints||{},w={};r&&(E.connectionStart&&(w.connectionStart=E.connectionStart),E.connectionEnd&&(w.connectionEnd=E.connectionEnd),p===VE?Va(a)?(w.connectionEnd=w.connectionEnd||v,w.source=h,w.target=u||d,m=m.reverse()):(w.connectionStart=w.connectionStart||v,w.source=u||d,w.target=h):p===UE?Va(a)?(w.connectionStart=w.connectionStart||v,w.source=u||h,w.target=d,m=m.reverse()):(w.connectionEnd=w.connectionEnd||v,w.source=d,w.target=u||h):(w.noCropping=!0,w.noLayout=!0,m[c]=v),p===Lf&&(m=e.cropWaypoints(f,m)),w.waypoints=m,r.drawPreview(a,s,w)),mt(l,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],jf,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,ut(c),i.removeMarker(s,$f),i.removeMarker(s,Ff),l&&(i.removeMarker(l,Nr),i.removeMarker(l,u?Nr:la)),r&&r.cleanUp(a)})}Jm.$inject=["bendpointMove","injector","eventBus","canvas"];var Hf="connect-hover",Gf="djs-updating";function zf(e,t,n){return su(e,t,e[t]+n)}function su(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function WE(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(o+a,e[i]),r-a);return su(t,i,s)}function Qm(e){return e==="x"?"y":"x"}function Vf(e,t,n){var i,r;return e.original?e.original:(i=re(t),r=Qm(n),su(e,r,i[r]))}function ev(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var h,m=n.getGraphics(f),v=d-1,E=d,w=f.waypoints,_=w[v],x=w[E],P=sl(n,w,p),A,C,I;A=Sn(_,x),A&&(C=A==="v"?"x":"y",v===0&&(_=Vf(_,f.source,C)),E===w.length-1&&(x=Vf(x,f.target,C)),P?I=P.point:I={x:(_.x+x.x)/2,y:(_.y+x.y)/2},h={connection:f,segmentStartIndex:v,segmentEndIndex:E,segmentStart:_,segmentEnd:x,axis:C,dragPosition:I},i.init(p,I,"connectionSegment.move",{cursor:C==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:m,context:h}}))};function s(p,f){if(!a)return f;var d=p.waypoints,h;return p.waypoints=f,h=a.getCroppedWaypoints(p),p.waypoints=d,h}function c(p){r.update("connection",p.connection,p.connectionGfx)}function l(p,f,d){var h=p.newWaypoints,m=p.segmentStartIndex+f,v=h[m],E=p.segmentEndIndex+f,w=h[E],_=Qm(p.axis),x=WE(d,v,w,_);mt(p.draggerGfx,x.x,x.y)}function u(p,f){var d=0,h=p.filter(function(m,v){return tm(p[v-1],p[v+1],m)?(d=v<=f?d-1:d,!1):!0});return{waypoints:h,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,h=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=Xm(h,f.segmentStart,f.segmentEnd),Re(f.draggerGfx).add("djs-dragging"),n.addMarker(d,Gf)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,m=f.segmentEndIndex,v=f.segmentStart,E=f.segmentEnd,w=f.axis,_=f.originalWaypoints.slice(),x=zf(v,w,p["d"+w]),P=zf(E,w,p["d"+w]),A=_.length,C=0;_[h]=x,_[m]=P;var I,T;h<2&&(I=ft(d.source,x),h===1?I==="intersect"&&(_.shift(),_[0]=x,C--):I!=="intersect"&&(_.unshift(v),C++)),m>A-3&&(T=ft(d.target,P),m===A-2?T==="intersect"&&(_.pop(),_[_.length-1]=P):T!=="intersect"&&_.push(E)),f.newWaypoints=d.waypoints=s(d,_),l(f,C,p),f.newSegmentStartIndex=h+C,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,Hf)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,Hf)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&ut(f.draggerGfx),n.removeMarker(d,Gf)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,h=f.newWaypoints,m=f.newSegmentStartIndex;h=h.map(function(P){return{original:P.original,x:Math.round(P.x),y:Math.round(P.y)}});var v=u(h,m),E=v.waypoints,w=s(d,E),_=v.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+_}};o.updateWaypoints(d,w,x)})}ev.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var YE=Math.abs,Uf=Math.round;function qE(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],YE(r-e)<=n)return r}function tv(e){return{x:e.x,y:e.y}}function nv(e){return{x:e.x+e.width,y:e.y+e.height}}function Gt(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Uf(e.x+e.width/2),y:Uf(e.y+e.height/2)}}function ur(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function He(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return n===!1?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function iv(e){return e.children||[]}var KE=Math.abs,Wf=Math.round,Cc=10;function rv(e){function t(o,a){if(me(o)){for(var s=o.length;s--;)if(KE(o[s]-a)<=Cc)return o[s]}else{o=+o;var c=a%o;if(c<Cc)return a-c;if(c>o-Cc)return a-c+o}return a}function n(o,a){if(o.waypoints)return jE(a,o);if(o.width)return{x:Wf(o.width/2+o.x),y:Wf(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(s)return s;var m=[l[p-1],u,f,l[d+1]];return p<2&&m.unshift(n(c.source,o)),d>l.length-3&&m.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},D(m,function(v){v&&(v=v.original||v,h==="y"&&s.horizontal.push(v.y),h==="x"&&s.vertical.push(v.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var p=s-l,f=c-u;N(o,{dx:o.dx-p,dy:o.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&He(o,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&He(o,"y",u)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},D(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!Ce(s)||!c||!c.x||!c.y||(He(o,"x",c.x),He(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,l=c&&n(c,o),u=o.x,p=o.y,f,d;if(s){f=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var h=u-f,m=p-d;N(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(u)!==-1)&&He(o,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&He(o,"y",d)}})}rv.$inject=["eventBus"];const XE={__depends__:[Mn,yn],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Zm],bendpointMove:["type",au],bendpointMovePreview:["type",Jm],connectionSegmentMove:["type",ev],bendpointSnapping:["type",rv]};function ov(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,l=a.hover,u;if(s.hover=l,u=s.canExecute=r(c,l),!Wc(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=o(c,l),!Wc(u)&&u!==!1&&(s.source=l,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,l=s.connectionStart,u={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,h={connectionStart:ul(s)?u:l,connectionEnd:ul(s)?l:u};vn(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,l){vn(c)||(l=c,c=re(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}ov.$inject=["eventBus","dragging","modeling","rules"];function ul(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var ZE=1100,JE=900,Yf="connect-ok",qf="connect-not-ok";function av(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,l=o.start,u=o.startPosition,p=o.target,f=o.connectionStart||u,d=o.connectionEnd||{x:r.x,y:r.y},h=f,m=d;ul(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||l,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",JE,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?Yf:qf)}),t.on(["connect.out","connect.cleanup"],ZE,function(r){var o=r.hover;o&&(n.removeMarker(o,Yf),n.removeMarker(o,qf))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}av.$inject=["injector","eventBus","canvas"];const cu={__depends__:[An,yn,Mn],__init__:["connectPreview"],connect:["type",ov],connectPreview:["type",av]};var QE="djs-dragger";function Dn(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Dn.$inject=["injector","canvas","graphicsFactory","elementFactory"];Dn.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,l=n.connectionEnd,u=n.noLayout,p=n.noCropping,f=n.noNoop,d,h=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),rs(i),r||(r=e.getConnection=ex(function(m,v,E){return h.getConnection(m,v,E)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?re(o):c,a?re(a):l]),this._connectionDocking&&(o||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})};Dn.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||re(n),o=t.connectionEnd||re(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);ge(e,s)};Dn.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return e=n&&Yc(o,s,!0)||e,t=i&&Yc(a,s,!1)||t,[e,t]};Dn.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&ut(e.connectionPreviewGfx)};Dn.prototype.getConnection=function(e){var t=tx(e);return this._elementFactory.createConnection(t)};Dn.prototype.createConnectionPreviewGfx=function(){var e=ve("g");return ae(e,{pointerEvents:"none"}),Re(e).add(QE),ge(this._canvas.getActiveLayer(),e),e};Dn.prototype.createNoopConnection=function(e,t){return S_([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function ex(e){var t={};return function(n){var i=JSON.stringify(n),r=t[i];return r||(r=t[i]=e.apply(null,arguments)),r}}function tx(e){return vn(e)?e:{}}const nx={__init__:["connectionPreview"],connectionPreview:["type",Dn]},ix=new nm("ps");var rx=["marker-start","marker-mid","marker-end"],ox=["circle","ellipse","line","path","polygon","polyline","path","rect"];function ii(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}ii.$inject=["elementRegistry","eventBus","canvas","styles"];ii.prototype.cleanUp=function(){};ii.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)};ii.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Hl(n),o=n.getBoundingClientRect();return this._cloneMarkers(Mi(r),i),ae(r,this._styles.cls(i,[],{x:o.top,y:o.left})),ge(t,r),ae(r,"data-preview-support-element-id",e.id),r};ii.prototype.addFrame=function(e,t){var n=ve("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ge(t,n),ae(n,"data-preview-support-element-id",e.id),n};ii.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;if(e.childNodes)for(var r=0;r<e.childNodes.length;r++)i._cloneMarkers(e.childNodes[r],t,n);lx(e)&&rx.forEach(function(o){if(ae(e,o)){var a=ax(e,o,i._canvas.getContainer());a&&i._cloneMarker(n,e,a,o,t)}})};ii.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,ix.next()].join("-"),a=De("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Hl(n);s.id=o,Re(s).add(r);var c=De(":scope > defs",e);c||(c=ve("defs"),ge(e,c)),ge(c,s);var l=cx(s.id);ae(t,i,l)};function ax(e,t,n){var i=sx(ae(e,t));return De("marker#"+i,n||document)}function sx(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function cx(e){return"url(#"+e+")"}function lx(e){return ox.indexOf(e.nodeName)!==-1}const _r={__init__:["previewSupport"],previewSupport:["type",ii]},ua="complex-preview";class sv{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer(ua);n.filter(s=>!ux(s)).forEach(s=>{let c;Ce(s)?(c=this._graphicsFactory._createContainer("connection",ve("g")),this._graphicsFactory.drawConnection(Mi(c),s)):(c=this._graphicsFactory._createContainer("shape",ve("g")),this._graphicsFactory.drawShape(Mi(c),s),mt(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const l=this._previewSupport.addDragger(s,a);Ce(s)?mt(l,c.x,c.y):mt(l,s.x+c.x,s.y+c.y)}),r.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");const l=this._graphicsFactory._createContainer("shape",ve("g"));this._graphicsFactory.drawShape(Mi(l),s,{width:c.width,height:c.height}),mt(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){rs(this._canvas.getLayer(ua)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(ua)}hide(){this._canvas.hideLayer(ua)}}sv.$inject=["canvas","graphicsFactory","previewSupport"];function ux(e){return e.hidden}const px={__depends__:[_r],__init__:["complexPreview"],complexPreview:["type",sv]};var lu=["top","bottom","left","right"],pa=10;function uu(e,t){H.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,l=o.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(os(r)){var o=hx(r);o&&i(r,o)}}function i(r,o){var a=re(r),s=r.label,c=re(s);if(s.parent){var l=Q(r),u;switch(o){case"top":u={x:a.x,y:l.top-pa-s.height/2};break;case"left":u={x:l.left-pa-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+pa+s.height/2};break;case"right":u={x:l.right+pa+s.width/2,y:a.y};break}var p=Tn(u,c);t.moveShape(s,p)}}}q(uu,H);uu.$inject=["eventBus","modeling"];function fx(e){var t=e.host,n=re(e),i=ft(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=lu.filter(function(a){return r.indexOf(a)===-1});return o}function dx(e){var t=re(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return cv(t,i)});return n}function hx(e){var t=re(e.label),n=re(e),i=cv(n,t);if(mx(i)){var r=dx(e);if(e.host){var o=fx(e);r=r.concat(o)}var a=lu.filter(function(s){return r.indexOf(s)===-1});if(a.indexOf(i)===-1)return a[0]}}function cv(e,t){return ft(t,e,5)}function mx(e){return lu.indexOf(e)!==-1}function pu(e){H.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(g(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}q(pu,H);pu.$inject=["eventBus"];function fu(e,t){e.invoke(H,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=pe(r.incoming.concat(r.outgoing),function(a){return g(a,"bpmn:Association")});D(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}q(fu,H);fu.$inject=["injector","modeling"];var Kf=500;function gs(e,t){t.invoke(H,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Kf,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Xf(o,a)}),r.length===1&&r.map(function(o){return r.indexOf(o)}).forEach(function(o){var a=r[o];i.elements[o]=n._replaceShape(r[o],a)})},!0),this.preExecute("elements.move",Kf,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Xf(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}gs.$inject=["bpmnReplace","injector"];q(gs,H);gs.prototype._replaceShape=function(e,t){var n=vx(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function vx(e){var t=z(e),n=t.eventDefinitions;return n&&n[0]}function Xf(e,t){return!be(e)&&ce(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function du(e,t){H.call(this,e);function n(i){return pe(i.attachers,function(r){return g(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);g(r,"bpmn:EventBasedGateway")&&g(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;g(r,"bpmn:Gateway")&&g(o,"bpmn:EventBasedGateway")&&D(o.outgoing,function(a){var s=a.target,c=n(s);g(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}du.$inject=["eventBus","modeling"];q(du,H);function hu(e,t,n){H.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(v){const E=v.source,w=v.target;Xi(E)&&Lr(w)&&u(w)}function r(v){const E=v.connection,w=v.source,_=v.target;Xi(w)&&fa(_)&&(l(_),f(w,[E]))}function o(v){const E=v.newTarget,w=v.oldSource,_=v.oldTarget;if(_!==E){const x=w;Lr(_)&&u(_),Xi(x)&&fa(E)&&l(E)}}function a(v){const{element:E}=v;Lr(E)?(p(E),d(E)):fa(E)&&h(E)}function s(v){const{newData:E,oldShape:w}=v;if(Xi(v.oldShape)&&E.eventDefinitionType!=="bpmn:CompensateEventDefinition"||E.type!=="bpmn:BoundaryEvent"){const _=w.outgoing.find(({target:x})=>Lr(x));_&&_.target&&(v._connectionTarget=_.target)}else if(!Xi(v.oldShape)&&E.eventDefinitionType==="bpmn:CompensateEventDefinition"&&E.type==="bpmn:BoundaryEvent"){const _=w.outgoing.find(({target:x})=>fa(x));_&&_.target&&(v._connectionTarget=_.target),m(w)}}function c(v){const{_connectionTarget:E,newShape:w}=v;E&&t.connect(w,E)}function l(v){t.updateProperties(v,{isForCompensation:!0})}function u(v){t.updateProperties(v,{isForCompensation:void 0})}function p(v){for(const E of v.incoming)n.canConnect(E.source,v)||t.removeConnection(E);for(const E of v.outgoing)n.canConnect(v,E.target)||t.removeConnection(E)}function f(v,E){v.outgoing.filter(x=>g(x,"bpmn:Association")).filter(x=>Lr(x.target)&&!E.includes(x)).forEach(x=>t.removeConnection(x))}function d(v){const E=v.attachers.slice();E.length&&t.removeElements(E)}function h(v){const E=v.incoming.filter(w=>Xi(w.source));t.removeElements(E)}function m(v){const E=v.outgoing.filter(w=>g(w,"bpmn:SequenceFlow"));t.removeElements(E)}}q(hu,H);hu.$inject=["eventBus","modeling","bpmnRules"];function Lr(e){const t=z(e);return t&&t.get("isForCompensation")}function Xi(e){return e&&g(e,"bpmn:BoundaryEvent")&&im(e,"bpmn:CompensateEventDefinition")}function fa(e){return e&&g(e,"bpmn:Activity")&&!vt(e)}function mu(e){e.invoke(H,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;g(i,"bpmn:Lane")&&!g(r,"bpmn:Lane")&&(n.parent=to(i,"bpmn:Participant"))})}mu.$inject=["injector"];q(mu,H);function vu(e,t){H.call(this,e),this.preExecute("shape.create",function(n){var i=n.context,r=i.shape;if(g(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");r.businessObject.dataObjectRef=o}})}vu.$inject=["eventBus","bpmnFactory"];q(vu,H);var pl=20,fl=20,lv=30,da=2e3;function gu(e,t,n){H.call(this,t),t.on(["create.start","shape.move.start"],da,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!g(a,"bpmn:Participant")||!g(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!g(p,"bpmn:Group")&&!be(p)&&!Ce(p)});if(c.length){var l=Mt(c),u=gx(a,l);N(a,u),o.createConstraints=yx(a,l)}}}),t.on("create.start",da,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}g(a,"bpmn:Participant")&&g(s,"bpmn:Process")&&(t.on("element.hover",da,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var r=e.getRootElement();return g(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",da,function(r){var o=r.elements,a=r.parent,s=_x(o),c;s&&g(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=z(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;g(a,"bpmn:Participant")&&g(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=z(a).get("processRef"))},!0),this.execute("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.shape,c=o.participant;a&&(!c||s===c)&&z(s).set("processRef",z(a))},!0),this.revert("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.processRef||o.processRef,c=r.shape,l=o.participant;a&&(!l||c===l)&&z(c).set("processRef",s)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,s=r.shape,c=o.participant;if(a){var l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}gu.$inject=["canvas","eventBus","modeling"];q(gu,H);function gx(e,t){t={width:t.width+pl*2+lv,height:t.height+fl*2};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}function yx(e,t){return t=Q(t),{bottom:t.top+e.height/2-fl,left:t.right-e.width/2+pl,top:t.bottom-e.height/2+fl,right:t.left+e.width/2-pl-lv}}function _x(e){return Me(e,function(t){return g(t,"bpmn:Participant")})}var Zf="__targetRef_placeholder";function yu(e,t){H.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Jf(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Jf(o));function n(a,s,c){var l=a.get("dataInputAssociations");return Me(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Me(c,function(u){return u.name===Zf});return!l&&s&&(l=t.create("bpmn:Property",{name:Zf}),Ze(c,l)),l}function r(a,s){var c=i(a);c&&(n(a,c,s)||We(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,f=s.newTarget,d=f&&f.businessObject,h=s.oldTarget||s.target,m=h&&h.businessObject,v=c.businessObject,E;m&&m!==p&&r(m,l),d&&d!==p&&r(d,l),p?(E=i(p,!0),v.targetRef=E):v.targetRef=null}}yu.$inject=["eventBus","bpmnFactory"];q(yu,H);function Jf(e){return function(t){var n=t.context,i=n.connection;if(g(i,"bpmn:DataInputAssociation"))return e(t)}}function ys(e){this._bpmnUpdater=e}ys.$inject=["bpmnUpdater"];ys.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]};ys.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]};function _u(e,t,n,i){H.call(this,i),t.registerHandler("dataStore.updateContainment",ys);function r(){return n.filter(function(s){return g(s,"bpmn:Participant")&&z(s).processRef})[0]}function o(s){return s.children.filter(function(c){return g(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||r(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:we(s),newSemanticParent:u.processRef||u,newDiParent:we(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;g(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(p){return g(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!g(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;g(l,"bpmn:DataStoreReference")&&l.type!=="label"&&g(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,p=l.parent;if(!g(u,"bpmn:Collaboration")&&g(l,"bpmn:DataStoreReference")&&l.type!=="label"&&g(p,"bpmn:Collaboration")){var f=g(u,"bpmn:Participant")?u:Ex(u,"bpmn:Participant");a(l,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();ce(l,["bpmn:Participant","bpmn:SubProcess"])&&g(u,"bpmn:Collaboration")&&o(u).filter(function(p){return bx(p,l)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,p=o(l);p.forEach(function(f){g(u,"bpmn:Process")&&a(f,u)})})}_u.$inject=["canvas","commandStack","elementRegistry","eventBus"];q(_u,H);function bx(e,t){for(var n=e.businessObject||e,i=t.businessObject||t;n.$parent;){if(n.$parent===i.processRef||i)return!0;n=n.$parent}return!1}function Ex(e,t){for(;e.parent;){if(g(e.parent,t))return e.parent;e=e.parent}}var Ua=Math.max,Wa=Math.min,xx=20;function uv(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function wx(e,t,n){var i=n.x,r=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(o.y=e.y+r,o.height=e.height-r):t.indexOf("s")!==-1&&(o.height=e.height+r),t.indexOf("e")!==-1?o.width=e.width+i:t.indexOf("w")!==-1&&(o.x=e.x+i,o.width=e.width-i),o}function Sx(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 ha(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return ue(r)&&(i=(/top|left/.test(e)?Wa:Ua)(i,r)),ue(o)&&(i=(/top|left/.test(e)?Ua:Wa)(i,o)),i}function Cx(e,t){if(!t)return e;var n=Q(e);return Fl({top:ha("top",n,t),right:ha("right",n,t),bottom:ha("bottom",n,t),left:ha("left",n,t)})}function Tx(e,t,n,i){var r=Q(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?Q(i):o,s={top:Wa(o.top,a.top),left:Wa(o.left,a.left),bottom:Ua(o.bottom,a.bottom),right:Ua(o.right,a.right)};return Fl(s)}function Br(e,t){return typeof e!="undefined"?e:xx}function Px(e,t){var n,i,r,o;return typeof t=="object"?(n=Br(t.left),i=Br(t.right),r=Br(t.top),o=Br(t.bottom)):n=i=r=o=Br(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function Rx(e){return!(e.waypoints||e.type==="label")}function pv(e,t){var n;if(e.length===void 0?n=pe(e.children,Rx):n=e,n.length)return Px(Mt(n),t)}var zn=Math.abs;function Ax(e,t){return uv(Q(t),Q(e))}var Ix=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],jt=30;function _s(e,t){return t=t||[],e.children.filter(function(n){g(n,"bpmn:Lane")&&(_s(n,t),t.push(n))}),t}function ri(e){return e.children.filter(function(t){return g(t,"bpmn:Lane")})}function Ht(e){return to(e,Ix)||e}function Mx(e,t){var n=Ht(e),i=g(n,"bpmn:Process")?[]:[n],r=_s(n,i),o=Q(e),a=Q(t),s=Ax(e,t),c=[],l=gt(e);return r.forEach(function(u){if(u!==e){var p=l?0:s.top,f=l?s.right:0,d=l?0:s.bottom,h=l?s.left:0,m=Q(u);s.top&&(zn(m.bottom-o.top)<10&&(d=a.top-m.bottom),zn(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(zn(m.right-o.left)<10&&(f=a.left-m.right),zn(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(zn(m.top-o.bottom)<10&&(p=a.bottom-m.top),zn(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(zn(m.left-o.right)<10&&(h=a.right-m.left),zn(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:u,newBounds:Sx(u,{top:p,right:f,bottom:d,left:h})})}}),c}var Dx=500;function bu(e,t){H.call(this,e);function n(i,r){var o=gt(i),a=ri(r),s=[],c=[],l=[],u=[];if(as(a,function(v){return o?v.y>i.y?c.push(v):s.push(v):v.x>i.x?u.push(v):l.push(v),v.children}),!!a.length){var p;o?c.length&&s.length?p=i.height/2:p=i.height:u.length&&l.length?p=i.width/2:p=i.width;var f,d,h,m;s.length&&(f=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),l.length&&(h=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:p,y:0},"e")),u.length&&(m=t.calculateAdjustments(u,"x",-p,i.x+i.width+10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",Dx,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;g(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}bu.$inject=["eventBus","spaceTool"];q(bu,H);var Qf=500;function bs(e,t){t.invoke(H,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Qf,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return ed(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Qf,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;ed(a,Ox(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}bs.$inject=["bpmnReplace","injector"];q(bs,H);bs.prototype._replaceShape=function(e){var t=kx(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function kx(e){var t=z(e),n=t.eventDefinitions;return n&&n[0]}function ed(e,t){return!be(e)&&g(e,"bpmn:BoundaryEvent")&&!t}function Ox(e,t){return e.indexOf(t)!==-1}function Eu(e,t,n){H.call(this,e);function i(r,o,a){var s=o.waypoints,c,l,u,p,f,d,h,m=r.outgoing.slice(),v=r.incoming.slice(),E;ue(a.width)?E=re(a):E=a;var w=al(s,E);if(w){if(c=s.slice(0,w.index),l=s.slice(w.index+(w.bendpoint?1:0)),!c.length||!l.length)return;u=w.bendpoint?s[w.index]:E,(c.length===1||!td(r,c[c.length-1]))&&c.push(nd(u)),(l.length===1||!td(r,l[0]))&&l.unshift(nd(u))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||E),d=o),t.canConnect(r,f,o)&&(d?h=n.connect(r,f,{type:o.type,waypoints:l}):(n.reconnectStart(o,r,l||E),h=o));var _=[].concat(d&&pe(v,function(x){return x.source===d.source})||[],h&&pe(m,function(x){return x.target===h.target})||[]);_.length&&n.removeElements(_)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var l=re(c),u={x:l.x+s.x,y:l.y+s.y},p=Me(o.children,function(f){var d=t.canInsert(a,f);return d&&al(f.waypoints,u)});p&&(r.targetFlow=p,r.position=u)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}q(Eu,H);Eu.$inject=["eventBus","bpmnRules","modeling"];function td(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function nd(e){return N({},e)}function xu(e,t){H.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&Zi(r)){var c=[];g(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==r&&Zi(l)):c=a.incoming.filter(l=>l!==r&&Zi(l)&&g(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(g(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(Zi).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Zi).forEach(function(s){const c=a.incoming.filter(Zi).filter(function(l){return l.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}xu.$inject=["eventBus","modeling"];q(xu,H);function Zi(e){return g(e,"bpmn:SequenceFlow")}var ma=1500,id=2e3;function fv(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"],ma,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;g(a,"bpmn:Lane")&&!ce(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Ht(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a!==s&&(o.labelTarget||ce(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],ma,function(i){var r=i.hover;g(r,"bpmn:Lane")&&(i.hover=Ht(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],ma,function(i){var r=i.context,o=i.hover,a=r.type;g(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Ht(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],ma,function(i){var r=i.context,o=r.start;g(o,"bpmn:Lane")&&(r.start=Ht(o)||o)}),t.on("shape.move.start",id,function(i){var r=i.shape;g(r,"bpmn:Lane")&&(i.shape=Ht(r)||r)}),t.on("spaceTool.move",id,function(i){var r=i.hover;r&&g(r,"bpmn:Lane")&&(i.hover=Ht(r))})}fv.$inject=["elementRegistry","eventBus","canvas"];function Nx(e){return e.create("bpmn:Category")}function Lx(e){return e.create("bpmn:CategoryValue")}function Bx(e,t,n){return Ze(t.get("categoryValue"),e),e.$parent=t,Ze(n.get("rootElements"),t),t.$parent=n,e}function $x(e){var t=e.$parent;return t&&(We(t.get("categoryValue"),e),e.$parent=null),e}function Fx(e){var t=e.$parent;return t&&(We(t.get("rootElements"),e),e.$parent=null),e}var rd=770;function wu(e,t,n,i,r,o){r.invoke(H,this);function a(){return n.filter(function(h){return g(h,"bpmn:Group")})}function s(h,m){return h.some(function(v){var E=z(v),w=E.categoryValueRef&&E.categoryValueRef.$parent;return w===m})}function c(h,m){return h.some(function(v){var E=z(v);return E.categoryValueRef===m})}function l(h,m,v){var E=a().filter(function(w){return w.businessObject!==v});m&&!s(E,m)&&Fx(m),h&&!c(E,h)&&$x(h)}function u(h,m){return Bx(h,m,t.getDefinitions())}function p(h,m){var v=z(h),E=v.categoryValueRef;E||(E=v.categoryValueRef=m.categoryValue=m.categoryValue||Lx(e));var w=E.$parent;w||(w=E.$parent=m.category=m.category||Nx(e)),u(E,w,t.getDefinitions())}function f(h,m){var v=m.category,E=m.categoryValue,w=z(h);E?(w.categoryValueRef=null,l(E,v,w)):l(null,w.categoryValueRef.$parent,w)}this.execute("label.create",function(h){var m=h.context,v=m.labelTarget;g(v,"bpmn:Group")&&p(v,m)}),this.revert("label.create",function(h){var m=h.context,v=m.labelTarget;g(v,"bpmn:Group")&&f(v,m)}),this.execute("shape.delete",function(h){var m=h.context,v=m.shape,E=z(v);if(!(!g(v,"bpmn:Group")||v.labelTarget)){var w=m.categoryValue=E.categoryValueRef,_;w&&(_=m.category=w.$parent,l(w,_,E),E.categoryValueRef=null)}}),this.reverted("shape.delete",function(h){var m=h.context,v=m.shape;if(!(!g(v,"bpmn:Group")||v.labelTarget)){var E=m.category,w=m.categoryValue,_=z(v);w&&(_.categoryValueRef=w,u(w,E))}}),this.execute("shape.create",function(h){var m=h.context,v=m.shape;!g(v,"bpmn:Group")||v.labelTarget||z(v).categoryValueRef&&p(v,m)}),this.reverted("shape.create",function(h){var m=h.context,v=m.shape;!g(v,"bpmn:Group")||v.labelTarget||z(v).categoryValueRef&&f(v,m)});function d(h,m){var v=e.create(h.$type);return o.copyElement(h,v,null,m)}i.on("copyPaste.copyElement",rd,function(h){var m=h.descriptor,v=h.element;if(!(!g(v,"bpmn:Group")||v.labelTarget)){var E=z(v);if(E.categoryValueRef){var w=E.categoryValueRef;m.categoryValue=d(w,!0),w.$parent&&(m.category=d(w.$parent,!0))}}}),i.on("copyPaste.pasteElement",rd,function(h){var m=h.descriptor,v=m.businessObject,E=m.categoryValue,w=m.category;E&&(E=v.categoryValueRef=d(E)),w&&(E.$parent=d(w)),delete m.category,delete m.categoryValue})}wu.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"];q(wu,H);function dl(e,t,n,i){var r,o,a,s,c;return r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),r==0?null:(o=e.y-n.y,a=e.x-n.x,c=(i.x-n.x)*o-(i.y-n.y)*a,s=c/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function dv(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=dl(i,r,o,a),l=dl(i,r,o,s),u;c&&l?od(c,o)>od(l,o)?u=l:u=c:u=c||l,i.original=u}function n(i){var r=i.waypoints;t(r[0],r[1],re(i.source)),t(r[r.length-1],r[r.length-2],re(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}dv.$inject=["eventBus"];function od(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Su(e){H.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,r=z(i),o=we(i);if(ce(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Su.$inject=["eventBus"];q(Su,H);var hv=Math.sqrt,mv=Math.min,jx=Math.max,ad=Math.abs;function sd(e){return Math.pow(e,2)}function $r(e,t){return hv(sd(e.x-t.x)+sd(e.y-t.y))}function Hx(e,t){var n=0,i,r,o,a,s,c,l,u,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],ld(i,r)?l=[i]:(o=$r(e,i),a=$r(e,r),c=mv(o,a),l=Gx(i,r,e,c)),l.length<1)throw new Error("expected between [1, 2] circle -> line intersections");l.length===1&&(u={type:"bendpoint",position:l[0],segmentIndex:n,bendpointIndex:ld(i,l[0])?n:n+1}),l.length===2&&(s=Vx(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:$r(i,s)/$r(i,r)}),p=$r(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function Gx(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,l=r*a+o*s,u=a*a+s*s-i*i,p=l/c,f=u/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=hv(d),m=-p+h,v=-p-h,E={x:e.x-r*m,y:e.y-o*m};if(d===0)return[E];var w={x:e.x-r*v,y:e.y-o*v};return[E,w].filter(function(_){return zx(_,e,t)})}function zx(e,t,n){return cd(e.x,t.x,n.x)&&cd(e.y,t.y,n.y)}function cd(e,t,n){return e>=mv(t,n)-Ya&&e<=jx(t,n)+Ya}function Vx(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Ya=.1;function ld(e,t){return ad(e.x-t.x)<=Ya&&ad(e.y-t.y)<=Ya}function Ux(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex,u;if(o===0)return r;if(r>=l&&(u=c?r+1:r-1),r<l&&(u=r,c&&n.type!=="bendpoint"&&l-1===r)){var p=gv(t,l);p<n.relativeLocation&&u++}return u}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function vv(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=Hx(e,n),c=s.segmentIndex,l=Ux(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=ud(n,c),p=ud(t,l),f=s.position,d=Yx(u,f),h=Wx(u,p);if(s.type==="bendpoint"){var m=t.length-n.length,v=s.bendpointIndex,E=n[v];if(t.indexOf(E)!==-1)return a;if(m===0){var w=t[v];return r=w.x-s.position.x,o=w.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}m<0&&v!==0&&v<n.length-1&&(d=gv(n,v))}var _={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},x=LE({x:e.x-f.x,y:e.y-f.y},h);return r=_.x+x.x-e.x,o=_.y+x.y-e.y,{point:Kr(_),delta:Kr({x:r,y:o})}}function gv(e,t){var n=za(e[t-1],e[t]),i=za(e[t],e[t+1]),r=n/(n+i);return r}function Wx(e,t){var n=Of(e),i=Of(t);return i-n}function ud(e,t){return[e[t],e[t+1]]}function Yx(e,t){var n=za(e[0],e[1]),i=za(e[0],t);return n===0?0:i/n}function qx(e,t,n,i){var r=re(e);return vv(r,t,n,i).delta}function ho(e,t,n){var i=Vr(t),r=Vr(n),o=Tn(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Kr({x:r.x+a.x,y:r.y+a.y})}function pd(e,t,n){var i=Vr(e),r=Vr(t),o=Vr(n),a=Tn(e,i),s=Tn(i,r),c=Kx(i,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:o.x+l.x,y:o.y+l.y};return Kr({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function Kx(e,t,n){var i=Q(t),r=Q(n);if(Xx(i,r))return null;var o=ft(t,e),a,s,c;if(o==="top")a={x:0,y:r.bottom-i.bottom};else if(o==="bottom")a={x:0,y:r.top-i.top};else if(o==="right")a={x:r.left-i.left,y:0};else if(o==="left")a={x:r.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=ft(n,s),c!==o?null:a}function Xx(e,t){return Zx(e,t)||Jx(e,t)}function Zx(e,t){return e.right!==t.right&&e.left!==t.left}function Jx(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var fd="name",dd="text";function Cu(e,t,n,i){H.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{z(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,l=s.properties;if(fd in l&&t.updateLabel(c,l[fd]),dd in l&&g(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[dd]||"");t.updateLabel(c,l.text,u)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var l=s.shape||s.connection;be(l)||!ar(l)||Jn(l)&&t.updateLabel(l,Jn(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,l=c.label,u=N({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof u.startChanged=="undefined"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged=="undefined"&&(u.endChanged=!!u.connectionEnd),qx(l,p,f,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,p;!u||!u.parent||(p=o(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=z(c);u&&ar(u)&&l.label&&c.label&&(c.label.x=l.label.x,c.label.y=l.label.y)}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(os(c)){var p=c.label,f=re(p),d=tw(u),h=ew(f,d),m=Qx(h,u,l);t.moveShape(p,m)}})}q(Cu,H);Cu.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function Qx(e,t,n){var i=ho(e,t,n);return Kr(Tn(i,e))}function ew(e,t){if(t.length){var n=nw(e,t);return ou(e,n)}}function tw(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 nw(e,t){var n=t.map(function(r){return{line:r,distance:Ym(e,r)}}),i=hn(n,"distance");return i[0].line}function iw(e,t,n,i){return vv(e,t,n,i).point}function Tu(e,t){H.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=N({},o.hints),c=o.newWaypoints||a.waypoints,l=o.oldWaypoints;return typeof s.startChanged=="undefined"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged=="undefined"&&(s.endChanged=!!s.connectionEnd),iw(r,c,l,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var l=c.waypoints[c.waypoints.length-1],u=n(i,l),p=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,p)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),p=[].concat([u],c.waypoints.slice(1));t.updateWaypoints(c,p)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(l){var u=l.waypoints[l.waypoints.length-1],p={x:u.x+c.x,y:u.y+c.y},f=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,f)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},f=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,f)})})}q(Tu,H);Tu.$inject=["eventBus","modeling"];function Es(e,t,n){var i=ws(e),r=_v(i,t),o=i[0];return r.length?r[r.length-1]:ho(o.original||o,n,t)}function xs(e,t,n){var i=ws(e),r=_v(i,t),o=i[i.length-1];return r.length?r[0]:ho(o.original||o,n,t)}function Pu(e,t,n){var i=ws(e),r=yv(t,n),o=i[0];return ho(o.original||o,r,t)}function Ru(e,t,n){var i=ws(e),r=yv(t,n),o=i[i.length-1];return ho(o.original||o,r,t)}function yv(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function ws(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function _v(e,t){var n=Pt(e,ow);return pe(n,function(i){return rw(i,t)})}function rw(e,t){return ft(t,e,1)==="intersect"}function ow(e){return e.original||e}function Au(e,t){H.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(aw(i,r)){var o=sw(i);o.incoming.forEach(function(a){var s=xs(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Es(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Au.$inject=["eventBus","modeling"];q(Au,H);function aw(e,t){return g(e,"bpmn:Participant")&&ye(e)&&g(t,"bpmn:Participant")&&!ye(t)}function sw(e){var t=so([e],!1),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){g(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){g(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const cw=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function bv(e){const t=z(e);if(!g(t,"bpmn:BoundaryEvent")&&!(g(t,"bpmn:StartEvent")&&vt(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:cw.some(i=>g(n[0],i))}function Ev(e){return g(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Iu(e,t){e.invoke(H,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!bv(r))return;const a=Ev(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=z(i).get(a),l=z(r).get(a);c!==l&&t.updateProperties(r,{[a]:c})})}Iu.$inject=["injector","modeling"];q(Iu,H);function Mu(e,t){H.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=we(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}q(Mu,H);Mu.$inject=["eventBus","modeling"];function Du(e,t,n){H.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!g(o,"bpmn:SequenceFlow")||!g(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=lw(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}q(Du,H);Du.$inject=["eventBus","bpmnRules","modeling"];function Ji(e){return e.original||e}function lw(e,t){var n=dl(Ji(e[e.length-2]),Ji(e[e.length-1]),Ji(t[1]),Ji(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Ji(e[0]),Ji(t[t.length-1])]}function ku(e,t){H.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;g(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;i&&!i.businessObject.participants.length&&t.makeProcess()},!0)}ku.$inject=["eventBus","modeling"];q(ku,H);function Ou(e,t,n,i){H.call(this,e);var r=i.get("dragging",!1);function o(c){var l=c.source,u=c.target,p=c.parent;if(p){var f,d;g(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(f="bpmn:MessageFlow")),g(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(l,u,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,f=l.newTarget||u.target,d,h;d=n.canConnect(p,f),!(!d||d.type===u.type)&&(h=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=h,r&&s(u,h))}function s(c,l){var u=r.context(),p=u&&u.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;D(u,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,f=p.businessObject,d;u.default&&(d=Me(p.outgoing,Cn({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}q(Ou,H);Ou.$inject=["eventBus","modeling","bpmnRules","injector"];function Ss(e,t,n,i,r,o){i.invoke(H,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=ni(l,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];D(s.closure.topLevel,function(f){vt(f)?u=u.concat(f.children):u=u.concat(f)}),u.length===1&&l&&(c=l);var p=t.canReplace(u,c);p&&this._replaceElements(u,p.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,p;u&&u.length&&(p=t.canReplace(u,l),this._replaceElements(u,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(l,{id:c.id})})}q(Ss,H);Ss.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;D(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)};Ss.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var uw=1500,pw={width:140,height:120},Nu={width:300,height:60},Lu={width:60,height:300},Na={width:300,height:150},La={width:150,height:300},xv={width:140,height:120},wv={width:50,height:30};function Sv(e){e.on("resize.start",uw,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(g(i,"bpmn:Lane")||g(i,"bpmn:Participant"))&&(n.resizeConstraints=vw(i,r,o)),g(i,"bpmn:SubProcess")&&ye(i)&&(n.minDimensions=xv),g(i,"bpmn:TextAnnotation")&&(n.minDimensions=wv)})}Sv.$inject=["eventBus"];var Vn=Math.abs,fw=Math.min,dw=Math.max;function Cv(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function Qi(e,t,n){return Cv(e,t,n,fw)}function er(e,t,n){return Cv(e,t,n,dw)}var hw={top:20,left:50,right:20,bottom:20},mw={top:50,left:20,right:20,bottom:20};function vw(e,t,n){var i=Ht(e),r=!0,o=!0,a=_s(i,[i]),s=Q(e),c={},l={},u=gt(e),p=u?Nu:Lu;/n/.test(t)?l.top=s.bottom-p.height:/e/.test(t)?l.right=s.left+p.width:/s/.test(t)?l.bottom=s.top+p.height:/w/.test(t)&&(l.left=s.right-p.width),a.forEach(function(h){var m=Q(h);/n/.test(t)&&(u&&m.top<s.top-10&&(r=!1),n&&Vn(s.top-m.bottom)<10&&er(c,"top",m.top+p.height),Vn(s.top-m.top)<5&&Qi(l,"top",m.bottom-p.height)),/e/.test(t)&&(!u&&m.right>s.right+10&&(o=!1),n&&Vn(s.right-m.left)<10&&Qi(c,"right",m.right-p.width),Vn(s.right-m.right)<5&&er(l,"right",m.left+p.width)),/s/.test(t)&&(u&&m.bottom>s.bottom+10&&(o=!1),n&&Vn(s.bottom-m.top)<10&&Qi(c,"bottom",m.bottom-p.height),Vn(s.bottom-m.bottom)<5&&er(l,"bottom",m.top+p.height)),/w/.test(t)&&(!u&&m.left<s.left-10&&(r=!1),n&&Vn(s.left-m.right)<10&&er(c,"left",m.left+p.width),Vn(s.left-m.left)<5&&Qi(l,"left",m.right-p.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(g(h,"bpmn:FlowElement")||g(h,"bpmn:Artifact"))}),d=u?hw:mw;return f.forEach(function(h){var m=Q(h);r&&/n/.test(t)&&Qi(l,"top",m.top-d.top),o&&/e/.test(t)&&er(l,"right",m.right+d.right),o&&/s/.test(t)&&er(l,"bottom",m.bottom+d.bottom),r&&/w/.test(t)&&Qi(l,"left",m.left-d.left)}),{min:l,max:c}}var hd=1001;function Tv(e,t){e.on("resize.start",hd+500,function(n){var i=n.context,r=i.shape;(g(r,"bpmn:Lane")||g(r,"bpmn:Participant"))&&(i.balanced=!Xr(n))}),e.on("resize.end",hd,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(g(r,"bpmn:Lane")||g(r,"bpmn:Participant"))return o&&(a=rm(a),t.resizeLane(r,a,i.balanced)),!1})}Tv.$inject=["eventBus","modeling"];var gw=500;function Bu(e,t,n,i,r){n.invoke(H,this);function o(u){return ce(u,["bpmn:ReceiveTask","bpmn:SendTask"])||yw(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!Me(f,Cn({id:u.id}))}function s(u){if(g(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(g(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(g(u,"bpmn:MessageEventDefinition"))return"messageRef";if(g(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(ce(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),f=p[0];return f.get(s(f))}function l(u,p){if(ce(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var f=u.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(o(p)){var f=z(p),d=c(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),Ze(h,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");We(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!o(f))){var d=z(f),h=c(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",gw,function(u){var p=u.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),l(f,d),delete p.referencedRootElement)})}Bu.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"];q(Bu,H);function yw(e,t){return me(t)||(t=[t]),Li(t,function(n){return im(e,n)})}var Pv=Math.max;function Rv(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return D(n,function(a){var s=a.id;g(a,"bpmn:Participant")&&(o[s]=bw(a,i,r)),g(a,"bpmn:Lane")&&(o[s]=gt(a)?Nu:Lu),g(a,"bpmn:SubProcess")&&ye(a)&&(o[s]=xv),g(a,"bpmn:TextAnnotation")&&(o[s]=wv),g(a,"bpmn:Group")&&(o[s]=pw)}),o})}Rv.$inject=["eventBus"];function _w(e){return e==="x"}function bw(e,t,n){var i=gt(e);if(!ww(e))return i?Na:La;var r=_w(t),o={};return r?i?o=Na:o={width:xw(e,n,r),height:La.height}:i?o={width:Na.width,height:Ew(e,n,r)}:o=La,o}function Ew(e,t,n){var i;return i=Sw(e,t,n),Pv(Na.height,i)}function xw(e,t,n){var i;return i=Cw(e,t,n),Pv(La.width,i)}function ww(e){return!!ri(e).length}function Sw(e,t,n){var i=ri(e),r;return r=$u(i,t,n),e.height-r.height+Nu.height}function Cw(e,t,n){var i=ri(e),r;return r=$u(i,t,n),e.width-r.width+Lu.width}function $u(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=ri(r),o.length?$u(o,t,n):r}var md=400,Tw=600,vd={x:180,y:160};function oi(e,t,n,i,r,o,a){H.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(p){return g(p,"bpmn:SubProcess")&&!ye(p)}function l(p){var f=p.shape,d=p.newRootElement,h=z(f);d=s._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=z(f);s._removeDiagram(d);var h=p.newRootElement=a.get(tr(d));e.removeRootElement(h)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.postExecuted("shape.create",function(p){var f=p.shape,d=p.newRootElement;!d||!f.children||(s._showRecursively(f.children),s._moveChildrenToShape(f,d))},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(tr(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(tr(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(tr(f));if(!(!d||!h)){var m=d.children;n.moveElements(m,{x:0,y:0},h)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(g(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,v=d.id;if(m!==v){if(Ia(f)){a.updateId(f,bi(v)),a.updateId(m,v);return}var E=a.get(bi(m));E&&a.updateId(bi(m),bi(v))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(g(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,v=d.id;if(m!==v){if(Ia(f)){a.updateId(f,bi(m)),a.updateId(v,m);return}var E=a.get(bi(v));E&&a.updateId(E,bi(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Ia(f)){var d=f,h=a.get(rf(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",md,function(p){var f=p.shape;g(f,"bpmn:SubProcess")&&(ye(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",md,function(p){var f=p.shape;g(f,"bpmn:SubProcess")&&(ye(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",Tw,function(p){var f=p.shape;if(g(f,"bpmn:SubProcess")){var d=p.newRootElement;d&&(ye(f)?s._moveChildrenToShape(d,f):s._moveChildrenToShape(f,d))}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=tr(f),m=a.get(h);m&&d.push.apply(d,m.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,h=p.elements,m=d.parent,v=g(we(m),"bpmndi:BPMNPlane");if(v){var E=rf(m),w=Me(h,function(_){return _.id===E});w&&(f.parent=w.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}q(oi,H);oi.prototype._moveChildrenToShape=function(e,t){var n=this._modeling,i=e.children,r;if(i){i=i.concat(i.reduce(function(l,u){return u.label&&u.label.parent!==e?l.concat(u.label):l},[]));var o=i.filter(function(l){return!l.hidden});if(!o.length){n.moveElements(i,{x:0,y:0},t,{autoResize:!1});return}var a=Mt(o);if(!t.x)r={x:vd.x-a.x,y:vd.y-a.y};else{var s=re(t),c=re(a);r={x:s.x-c.x,y:s.y-c.y}}n.moveElements(i,r,t,{autoResize:!1})}};oi.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(r){r.hidden=!!t,i=i.concat(r),r.children&&(i=i.concat(n._showRecursively(r.children,r.collapsed||t)))}),i};oi.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};oi.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:tr(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o};oi.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Me(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i};oi.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function Fu(e,t){e.invoke(H,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!g(r,"bpmn:SubProcess")||!(g(i,"bpmn:Task")||g(i,"bpmn:CallActivity"))||!ye(r))){var o=Pw(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Fu.$inject=["injector","modeling"];q(Fu,H);function Pw(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function ju(e){H.call(this,e),this.preExecute("connection.create",function(t){const{target:n}=t;g(n,"bpmn:TextAnnotation")&&(t.parent=n.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(t){const n=t.shapes||[t.shape];n.length===1&&g(n[0],"bpmn:TextAnnotation")&&(t.hints=t.hints||{},t.hints.autoResize=!1)},!0)}q(ju,H);ju.$inject=["eventBus"];function Hu(e,t){H.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(ye(i))return;var r=so(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();D(s,function(l){o(l,!0)}),D(c,function(l){o(l,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||(s?t.reconnectEnd(a,i,re(i)):t.reconnectStart(a,i,re(i)))}},!0)}q(Hu,H);Hu.$inject=["eventBus","modeling"];var Tc=500;function Gu(e,t,n){H.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,l=s,u,p;return u=Rw(c).concat([a]),p=pv(u),p?(l.width=Math.max(p.width,l.width),l.height=Math.max(p.height,l.height),l.x=p.x+(p.width-l.width)/2,l.y=p.y+(p.height-l.height)/2):(l.x=a.x+(a.width-l.width)/2,l.y=a.y+(a.height-l.height)/2),l}function 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"],Tc,function(a){var s=a.context,c=s.shape;g(c,"bpmn:SubProcess")&&(c.collapsed?we(c).isExpanded=!1:(i(c.children),we(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Tc,function(a){var s=a.context,c=s.shape;c.collapsed?we(c).isExpanded=!1:we(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Tc,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=o(s,c):l=r(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}q(Gu,H);Gu.$inject=["eventBus","elementFactory","modeling"];function Rw(e){return e.filter(function(t){return!t.hidden})}function zu(e,t,n,i){t.invoke(H,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;be(a)||(g(a,"bpmn:Participant")&&ye(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;g(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}q(zu,H);zu.$inject=["canvas","injector","moddle","modeling"];function Vu(e,t){H.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;Aw(r,o)&&t.updateProperties(o,{default:null})})}q(Vu,H);Vu.$inject=["eventBus","modeling"];function Aw(e,t){if(!g(e,"bpmn:SequenceFlow"))return!1;var n=z(t),i=z(e);return n.get("default")===i}var Iw=500,Mw=5e3;function Uu(e,t){H.call(this,e);var n;function i(){return n=n||new Dw,n.enter(),n}function r(){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,Mw,function(s){i()}),this.postExecuted(a,Iw,function(s){o()}),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],function(s){var c=s.context,l=c.shape,u=r();l.labelTarget||(g(l,"bpmn:Lane")&&u.addLane(l),g(l,"bpmn:FlowNode")&&u.addFlowNode(l))})}Uu.$inject=["eventBus","modeling"];q(Uu,H);function Dw(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(e){this.lanes.push(e)},this.addFlowNode=function(e){this.flowNodes.push(e)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}const kw={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","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"],adaptiveLabelPositioningBehavior:["type",uu],appendBehavior:["type",pu],associationBehavior:["type",fu],attachEventBehavior:["type",gs],boundaryEventBehavior:["type",du],compensateBoundaryEventBehaviour:["type",hu],createBehavior:["type",mu],createDataObjectBehavior:["type",vu],createParticipantBehavior:["type",gu],dataInputAssociationBehavior:["type",yu],dataStoreBehavior:["type",_u],deleteLaneBehavior:["type",bu],detachEventBehavior:["type",bs],dropOnFlowBehavior:["type",Eu],eventBasedGatewayBehavior:["type",xu],fixHoverBehavior:["type",fv],groupBehavior:["type",wu],importDockingFix:["type",dv],isHorizontalFix:["type",Su],labelBehavior:["type",Cu],layoutConnectionBehavior:["type",Tu],messageFlowBehavior:["type",Au],nonInterruptingBehavior:["type",Iu],removeElementBehavior:["type",Du],removeEmbeddedLabelBoundsBehavior:["type",Mu],removeParticipantBehavior:["type",ku],replaceConnectionBehavior:["type",Ou],replaceElementBehaviour:["type",Ss],resizeBehavior:["type",Sv],resizeLaneBehavior:["type",Tv],rootElementReferenceBehavior:["type",Bu],spaceToolBehavior:["type",Rv],subProcessPlaneBehavior:["type",oi],subProcessStartEventBehavior:["type",Fu],textAnnotationBehavior:["type",ju],toggleCollapseConnectionBehaviour:["type",Hu],toggleElementCollapseBehaviour:["type",Gu],unclaimIdBehavior:["type",zu],unsetDefaultFlowBehavior:["type",Vu],updateFlowNodeRefsBehavior:["type",Uu]};function Av(e,t){var n=ft(e,t,-15);return n!=="intersect"?n:null}function at(e){Ut.call(this,e)}q(at,Ut);at.$inject=["eventBus"];at.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return Ow(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return Ba(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Ba(n,i,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){var t=e.shape,n=e.newBounds;return $v(t,n)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Ce(i)&&!qa(t,i)?!1:ao(t,function(r){return Ce(r)?Ba(r.source,r.target,r):r.host?Ur(r,r.host,null,n):gl(r,i,null)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position;return Ur(n,t,null,i)||Lv(n,t,i)||Bv(n,t)||qa(n,t)}),this.addRule("shape.create",function(e){return gl(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Ur(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return zv(n,t)})};at.prototype.canConnectMessageFlow=Hv;at.prototype.canConnectSequenceFlow=Gv;at.prototype.canConnectDataAssociation=Yu;at.prototype.canConnectAssociation=Fv;at.prototype.canConnectCompensationAssociation=jv;at.prototype.canMove=Bv;at.prototype.canAttach=Ur;at.prototype.canReplace=Lv;at.prototype.canDrop=pr;at.prototype.canInsert=qa;at.prototype.canCreate=gl;at.prototype.canConnect=Ba;at.prototype.canResize=$v;at.prototype.canCopy=zv;function Ow(e){return hl(e)?null:ce(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function hl(e){return!e||be(e)}function Nw(e,t){return e===t}function gd(e){do{if(g(e,"bpmn:Process"))return z(e);if(g(e,"bpmn:Participant"))return z(e).processRef||z(e)}while(e=e.parent)}function ml(e){return g(e,"bpmn:TextAnnotation")}function Wu(e){return g(e,"bpmn:Group")&&!e.labelTarget}function Iv(e){return g(e,"bpmn:BoundaryEvent")&&un(e,"bpmn:CompensateEventDefinition")}function Cs(e){return z(e).isForCompensation}function Lw(e,t){var n=gd(e),i=gd(t);return n===i}function Bw(e){return g(e,"bpmn:InteractionNode")&&!g(e,"bpmn:BoundaryEvent")&&(!g(e,"bpmn:Event")||g(e,"bpmn:ThrowEvent")&&Dv(e,"bpmn:MessageEventDefinition"))}function $w(e){return g(e,"bpmn:InteractionNode")&&!Cs(e)&&(!g(e,"bpmn:Event")||g(e,"bpmn:CatchEvent")&&Dv(e,"bpmn:MessageEventDefinition"))&&!(g(e,"bpmn:BoundaryEvent")&&!un(e,"bpmn:MessageEventDefinition"))}function yd(e){for(var t=e;t=t.parent;){if(g(t,"bpmn:FlowElementsContainer"))return z(t);if(g(t,"bpmn:Participant"))return z(t).processRef}return null}function Mv(e,t){var n=yd(e),i=yd(t);return n===i}function un(e,t){var n=z(e);return!!Me(n.eventDefinitions||[],function(i){return g(i,t)})}function Dv(e,t){var n=z(e);return(n.eventDefinitions||[]).every(function(i){return g(i,t)})}function Fw(e){return g(e,"bpmn:FlowNode")&&!g(e,"bpmn:EndEvent")&&!vt(e)&&!(g(e,"bpmn:IntermediateThrowEvent")&&un(e,"bpmn:LinkEventDefinition"))&&!Iv(e)&&!Cs(e)}function jw(e){return g(e,"bpmn:FlowNode")&&!g(e,"bpmn:StartEvent")&&!g(e,"bpmn:BoundaryEvent")&&!vt(e)&&!(g(e,"bpmn:IntermediateCatchEvent")&&un(e,"bpmn:LinkEventDefinition"))&&!Cs(e)}function Hw(e){return g(e,"bpmn:ReceiveTask")||g(e,"bpmn:IntermediateCatchEvent")&&(un(e,"bpmn:MessageEventDefinition")||un(e,"bpmn:TimerEventDefinition")||un(e,"bpmn:ConditionalEventDefinition")||un(e,"bpmn:SignalEventDefinition"))}function Gw(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function vl(e,t){var n=Gw(t);return n.indexOf(e)!==-1}function Ba(e,t,n){if(hl(e)||hl(t))return null;if(!g(n,"bpmn:DataAssociation")){if(Hv(e,t))return{type:"bpmn:MessageFlow"};if(Gv(e,t))return{type:"bpmn:SequenceFlow"}}var i=Yu(e,t);return i||(jv(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Fv(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function pr(e,t){return be(e)||Wu(e)?!0:g(t,"bpmn:Participant")&&!ye(t)?!1:g(e,"bpmn:Participant")?g(t,"bpmn:Process")||g(t,"bpmn:Collaboration"):ce(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:g(e,"bpmn:Lane")?g(t,"bpmn:Participant")||g(t,"bpmn:Lane"):g(e,"bpmn:BoundaryEvent")&&!zw(e)?!1:g(e,"bpmn:FlowElement")&&!g(e,"bpmn:DataStoreReference")?g(t,"bpmn:FlowElementsContainer")?ye(t):ce(t,["bpmn:Participant","bpmn:Lane"]):g(e,"bpmn:DataStoreReference")&&g(t,"bpmn:Collaboration")?Li(z(t).get("participants"),function(n){return!!n.get("processRef")}):ce(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ce(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):g(e,"bpmn:MessageFlow")?g(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function zw(e){return z(e).cancelActivity&&(kv(e)||Ov(e))}function Vw(e){return!be(e)&&g(e,"bpmn:BoundaryEvent")}function Uw(e){return g(e,"bpmn:Lane")}function Ww(e){return Vw(e)||g(e,"bpmn:IntermediateThrowEvent")&&kv(e)?!0:g(e,"bpmn:IntermediateCatchEvent")&&Ov(e)}function kv(e){var t=z(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Ov(e){return Nv(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Nv(e,t){return t.some(function(n){return un(e,n)})}function Yw(e){return g(e,"bpmn:ReceiveTask")&&Me(e.incoming,function(t){return g(t.source,"bpmn:EventBasedGateway")})}function Ur(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return be(r)||!Ww(r)||vt(t)||!g(t,"bpmn:Activity")||Cs(t)||i&&!Av(i,t)||Yw(t)?!1:"attach"}function Lv(e,t,n){if(!t)return!1;var i={replacements:[]};return D(e,function(r){vt(t)||g(r,"bpmn:StartEvent")&&r.type!=="label"&&pr(r,t)&&(C_(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(T_(r)||P_(r)||R_(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Nv(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&g(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),g(t,"bpmn:Transaction")||un(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(g(r,"bpmn:EndEvent")&&pr(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),g(r,"bpmn:BoundaryEvent")&&Ur(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Bv(e,t){return Li(e,Uw)?!1:t?e.every(function(n){return pr(n,t)}):!0}function gl(e,t,n,i){return t?be(e)||Wu(e)?!0:Nw(n,t)||n&&vl(n,t)?!1:pr(e,t)||qa(e,t):!1}function $v(e,t){return g(e,"bpmn:SubProcess")?ye(e)&&(!t||t.width>=100&&t.height>=80):!!(g(e,"bpmn:Lane")||g(e,"bpmn:Participant")||ml(e)||Wu(e))}function qw(e,t){var n=ml(e),i=ml(t);return(n||i)&&n!==i}function Fv(e,t){return vl(t,e)||vl(e,t)?!1:qw(e,t)?!0:!!Yu(e,t)}function jv(e,t){return Mv(e,t)&&Iv(e)&&g(t,"bpmn:Activity")&&!Xw(t,e)&&!vt(t)}function Hv(e,t){return _d(e)&&!_d(t)?!1:Bw(e)&&$w(t)&&!Lw(e,t)}function Gv(e,t){return Fw(e)&&jw(t)&&Mv(e,t)&&!(g(e,"bpmn:EventBasedGateway")&&!Hw(t))}function Yu(e,t){return ce(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ce(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:ce(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ce(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function qa(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:ce(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!be(t)&&g(e,"bpmn:FlowNode")&&!g(e,"bpmn:BoundaryEvent")&&pr(e,t.parent)}function Kw(e,t){return e&&t&&e.indexOf(t)!==-1}function zv(e,t){return be(t)?!0:!(g(t,"bpmn:Lane")&&!Kw(e,t.parent))}function _d(e){return to(e,"bpmn:Process")||to(e,"bpmn:Collaboration")}function Xw(e,t){return e.attachers.includes(t)}const Zw={__depends__:[yn],__init__:["bpmnRules"],bpmnRules:["type",at]};var Jw=2e3;function Vv(e,t){e.on("saveXML.start",Jw,n);function n(){var i=t.getRootElements();D(i,function(r){var o=we(r),a,s;a=so([r],!1),a=pe(a,function(c){return c!==r&&!c.labelTarget}),s=Pt(a,we),o.set("planeElement",s)})}}Vv.$inject=["eventBus","canvas"];const Qw={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Vv]};function Ts(e){H.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,r=i.shape||i.connection,o=i.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,r=i.shape||i.connection,o=i.newParent||r.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}Ts.prototype.getOrdering=function(e,t){return null};q(Ts,H);function qu(e,t){Ts.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=Me(n,function(c){return ce(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error("no order for <"+a.id+">");return s}function o(a,s,c){for(var l=s;l&&!ce(l,c);)l=l.parent;if(!l)throw new Error("no parent for <"+a.id+"> in <"+(s&&s.id)+">");return l}this.getOrdering=function(a,s){if(a.labelTarget||g(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var l=s.children.indexOf(a),u=A_(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<r(p).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}qu.$inject=["eventBus","canvas"];q(qu,Ts);const e0={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",qu]};function mo(){}mo.prototype.get=function(){return this._data};mo.prototype.set=function(e){this._data=e};mo.prototype.clear=function(){var e=this._data;return delete this._data,e};mo.prototype.isEmpty=function(){return!this._data};const t0={clipboard:["type",mo]};var n0="drop-ok",bd="drop-not-ok",Ed="attach-ok",xd="new-parent",wd="create",i0=2e3;function Uv(e,t,n,i,r){function o(c,l,u,p,f){if(!l)return!1;c=pe(c,function(w){var _=w.labelTarget;return!w.parent&&!(be(w)&&c.indexOf(_)!==-1)});var d=Me(c,function(w){return!Ce(w)}),h=!1,m=!1,v=!1;Cd(c)&&(h=r.allowed("shape.attach",{position:u,shape:d,target:l})),h||(Cd(c)?v=r.allowed("shape.create",{position:u,shape:d,source:p,target:l}):v=r.allowed("elements.create",{elements:c,position:u,target:l}));var E=f.connectionTarget;return v||h?(d&&p&&(m=r.allowed("connection.create",{source:E===p?d:p,target:E===p?p:d,hints:{targetParent:l,targetAttach:h}})),{attach:h,connect:m}):v===null||h===null?null:!1}function a(c,l){[Ed,n0,bd,xd].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,p=c.hover,f=l.source,d=l.hints||{};if(!p){l.canExecute=!1,l.target=null;return}Sd(c);var h={x:c.x,y:c.y},m=l.canExecute=p&&o(u,p,h,f,d);p&&m!==null&&(l.target=p,m&&m.attach?a(p,Ed):a(p,m?xd:bd))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,p=l.shape,f=l.elements,d=l.target,h=l.canExecute,m=h&&h.attach,v=h&&h.connect,E=l.hints||{};if(h===!1||!d)return!1;Sd(c);var w={x:c.x,y:c.y};v?p=i.appendShape(u,p,w,d,{attach:m,connection:v===!0?{}:v,connectionTarget:E.connectionTarget}):(f=i.createElements(f,w,d,N({},E,{attach:m})),p=Me(f,function(_){return!Ce(_)})),N(l,{elements:f,shape:p}),N(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===wd&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],i0,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){me(l)||(l=[l]);var p=Me(l,function(h){return!Ce(h)});if(p){u=N({elements:l,hints:{},shape:p},u||{}),D(l,function(h){ue(h.x)||(h.x=0),ue(h.y)||(h.y=0)});var f=pe(l,function(h){return!h.hidden}),d=Mt(f);D(l,function(h){Ce(h)&&(h.waypoints=Pt(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),N(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,wd,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}Uv.$inject=["canvas","dragging","eventBus","modeling","rules"];function Sd(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 Cd(e){return e&&e.length===1&&!Ce(e[0])}var r0=750;function Wv(e,t,n,i,r){function o(a){var s=ve("g");ae(s,r.cls("djs-drag-group",["no-events"]));var c=ve("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(Mi(u),l)):(u=n._createContainer("shape",c),n.drawShape(Mi(u),l),mt(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",r0,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=o(l));var p;s?(u.parentNode||(p=e.getActiveLayer(),ge(p,u)),mt(u,a.x,a.y)):ut(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&ut(c)})}Wv.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Ps={__depends__:[Mn,_r,yn,An],__init__:["create","createPreview"],create:["type",Uv],createPreview:["type",Wv]};function Ku(e){var t=this;this._lastMoveEvent=null;function n(i){t._lastMoveEvent=i}e.on("canvas.init",function(i){var r=t._svg=i.svg;r.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}Ku.$inject=["eventBus"];Ku.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||o0(0,0)};function o0(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const vo={__init__:["mouse"],mouse:["type",Ku]};function en(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._clipboard=n,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var l=c.descriptor,u=c.element,p=c.elements;l.priority=1,l.id=u.id;var f=Me(p,function(d){return d===u.parent});f&&(l.parent=u.parent.id),a0(u)&&(l.priority=2,l.host=u.host.id),Ce(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=s0(u)),be(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),D(["x","y","width","height"],function(d){ue(u[d])&&(l[d]=u[d])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),r.on("copyPaste.pasteElements",function(c){var l=c.hints;N(l,{createElementsBehavior:!1})})}en.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"];en.prototype.copy=function(e){var t,n;return me(e)||(e=e?[e]:[]),t=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),t===!1?n={}:n=this.createTree(me(t)?t:e),this._clipboard.set(n),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:n}),n};en.prototype.paste=function(e){var t=this._clipboard.get();if(!this._clipboard.isEmpty()){var n=e&&e.hints||{};this._eventBus.fire("copyPaste.pasteElements",{hints:n});var i=this._createElements(t);if(e&&e.element&&e.point)return this._paste(i,e.element,e.point,n);this._create.start(this._mouse.getLastMoveEvent(),i,{hints:n||{}})}};en.prototype._paste=function(e,t,n,i){D(e,function(o){ue(o.x)||(o.x=0),ue(o.y)||(o.y=0)});var r=Mt(e);return D(e,function(o){Ce(o)&&(o.waypoints=Pt(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),N(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,N({},i))};en.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return D(e,function(o,a){o=hn(o,"priority"),D(o,function(s){var c=N({},Rn(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(Ce(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),r.push(l);return}if(be(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),r.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),r.push(l)})}),r};en.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Rn(e,["id"]));return t};en.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Rn(e,["id"]));return t};en.prototype.createShape=function(e){var t=this._elementFactory.createShape(Rn(e,["id"]));return t};en.prototype.hasRelations=function(e,t){var n,i,r;return!(Ce(e)&&(i=Me(t,Cn({id:e.source.id})),r=Me(t,Cn({id:e.target.id})),!i||!r)||be(e)&&(n=Me(t,Cn({id:e.labelTarget.id})),!n))};en.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=ts(e);function a(l,u){return t.allowed("element.copy",{element:l,elements:u})}function s(l,u){var p=Me(r,function(f){return l===f.element});if(!p){r.push({element:l,depth:u});return}p.depth<u&&(r=c(p,r),r.push({element:p.element,depth:u}))}function c(l,u){var p=u.indexOf(l);return p!==-1&&u.splice(p,1),u}return as(o,function(l,u,p){if(be(l))return;D(l.labels,function(h){s(h,p)});function f(h){h&&h.length&&D(h,function(m){D(m.labels,function(v){s(v,p)}),s(m,p)})}D([l.attachers,l.incoming,l.outgoing],f),s(l,p);var d=[];return l.children&&(d=l.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:l,children:d}),d}),e=Pt(r,function(l){return l.element}),r=Pt(r,function(l){return l.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:l.descriptor,element:l.element,elements:e}),l}),r=hn(r,function(l){return l.descriptor.priority}),e=Pt(r,function(l){return l.element}),D(r,function(l){var u=l.depth;if(!n.hasRelations(l.element,e)){Pd(l.element,e);return}if(!a(l.element,e)){Pd(l.element,e);return}i[u]||(i[u]=[]),i[u].push(l.descriptor)}),i};function a0(e){return!!e.host}function s0(e){return Pt(e.waypoints,function(t){return t=Td(t),t.original&&(t.original=Td(t.original)),t})}function Td(e){return N({},e)}function Pd(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const c0={__depends__:[t0,Ps,vo,yn],__init__:["copyPaste"],copyPaste:["type",en]};function Pc(e,t,n){me(n)||(n=[n]),D(n,function(i){om(e[i])||(t[i]=e[i])})}var Rc=750;function Yv(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",Rc,function(c){var l=c.descriptor,u=c.element,p=z(u);if(be(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(we(u),!0);d.bpmnElement=f,Pc(f,l,"name"),Pc(d,l,"isExpanded"),p.default&&(l.default=p.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,l){c[r]=l}function s(c,l,u){var p=z(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(z(c).attachedToRef=z(l[c.host])),Rn(u,ni(u,function(f,d,h){var m=d.element,v=d.property;return h===c.id&&(m.set(v,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,f=u.di;if(be(u)){u.businessObject=z(l[u.labelTarget]),u.di=we(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,Pc(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",Rc,function(c){var l=c.descriptor,u=c.element;if(g(u,"bpmn:Participant")){var p=z(u);p.processRef&&(l.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.pasteElement",Rc,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,o(l)))})}Yv.$inject=["bpmnFactory","eventBus","moddleCopy"];var l0=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"];function go(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",function(i){var r=i.propertyNames;if(!(!r||!r.length))return hn(r,function(o){return o==="extensionElements"})}),e.on("moddleCopy.canCopyProperty",function(i){var r=i.parent,o=vn(r)&&r.$descriptor,a=i.propertyName;if(a&&l0.indexOf(a)!==-1||a&&o&&!Me(o.properties,Cn({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",function(i){var r=i.property;if(u0(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}go.$inject=["eventBus","bpmnFactory","moddle"];go.prototype.copyElement=function(e,t,n,i=!1){var r=this;n&&!me(n)&&(n=[n]),n=n||yl(e.$descriptor);var o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||(me(o)&&(n=o),D(n,function(a){var s;qn(e,a)&&(s=e.get(a));var c=r.copyProperty(s,t,a,i);if(It(c)){var l=r._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:c,propertyName:a});l!==!1&&t.set(a,c)}})),t};go.prototype.copyProperty=function(e,t,n,i=!1){var r=this,o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(o!==!1){if(o)return vn(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;var a=this._moddle.getPropertyDescriptor(t,n);if(!a.isReference)return a.isId?e&&this._copyId(e,t,i):me(e)?ni(e,function(s,c){return o=r.copyProperty(c,t,n,i),o?s.concat(o):s},[]):vn(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(o=r._bpmnFactory.create(e.$type),o.$parent=t,o=r.copyElement(e,o,null,i),o):e}};go.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 yl(e,t){return ni(e.properties,function(n,i){return t&&i.default?n:n.concat(i.name)},[])}function u0(e,t){return e&&zt(e.$instanceOf)&&e.$instanceOf(t)}const qv={__depends__:[c0],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Yv],moddleCopy:["type",go]};var Rd=Math.round;function Xu(e,t){this._modeling=e,this._eventBus=t}Xu.$inject=["modeling","eventBus"];Xu.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,l=Rd(s+o/2),u=Rd(c+a/2),p=i.replaceShape(e,N({},t,{x:l,y:u,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Kv(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Kv.$inject=["selection","eventBus"];const p0={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Kv],replace:["type",Xu]};function f0(e,t,n){me(n)||(n=[n]),D(n,function(i){om(e[i])||(t[i]=e[i])})}var d0=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function h0(e,t){var n=e&&qn(e,"collapsed")?e.collapsed:!ye(e),i;return t&&(qn(t,"collapsed")||qn(t,"isExpanded"))?i=qn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Xv(e,t,n,i,r,o){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(va(p)&&u==="bpmn:SubProcess"&&h0(s,c))return i.toggleCollapse(s),s;var f=e.create(u),d={type:u,businessObject:f};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),f0(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=yl(p.$descriptor),m=yl(f.$descriptor,!0),v=m0(h,m);N(f,mn(c,d0));var E=pe(v,function(_){return _==="eventDefinitions"?Ad(s,c.eventDefinitionType):_==="loopCharacteristics"?!vt(f):qn(f,_)||_==="processRef"&&c.isExpanded===!1||_==="triggeredByEvent"?!1:_==="isForCompensation"?!vt(f):!0});if(f=n.copyElement(p,f,E),c.eventDefinitionType&&(Ad(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),g(p,"bpmn:Activity")){if(va(p))d.isExpanded=ye(s);else if(c&&qn(c,"isExpanded")){d.isExpanded=c.isExpanded;var w=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=w.width,d.height=w.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}ye(s)&&!g(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}return va(p)&&!va(f)&&(l.moveChildren=!1),g(p,"bpmn:Participant")&&(c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1,d.width=s.width,d.height=t.getDefaultSize(d).height),o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,ce(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ce(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!g(p,"bpmn:BoundaryEvent")&&g(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,Pe(te({},l),{targetElement:c}))}this.replaceElement=a}Xv.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function va(e){return g(e,"bpmn:SubProcess")}function Ad(e,t){var n=z(e);return t&&n.get("eventDefinitions").some(function(i){return g(i,t)})}function m0(e,t){return e.filter(function(n){return t.includes(n)})}const Zv={__depends__:[qv,p0,An],bpmnReplace:["type",Xv]};var v0=250;function Bi(e){this._eventBus=e,this._tools=[],this._active=null}Bi.$inject=["eventBus"];Bi.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)};Bi.prototype.isActive=function(e){return e&&this._active===e};Bi.prototype.length=function(e){return this._tools.length};Bi.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))};Bi.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),D(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,v0,function(r){this._active&&(g0(r)||this.setActive(null))},this)};function g0(e){var t=e.originalEvent&&e.originalEvent.target;return t&&ro(t,'.group[data-group="tools"]')}const Rs={__depends__:[Mn],__init__:["toolManager"],toolManager:["type",Bi]};function y0(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 _0(e,t){var n=[];return D(e.concat(t),function(i){var r=i.incoming,o=i.outgoing;D(r.concat(o),function(a){var s=a.source,c=a.target;(Fr(e,s)||Fr(e,c)||Fr(t,s)||Fr(t,c))&&(Fr(n,a)||n.push(a))})}),n}function Fr(e,t){return e.indexOf(t)!==-1}function b0(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:r+c,width:o,height:a-c};case"s":return{x:i,y:r,width:o,height:a+c};case"w":return{x:i+s,y:r,width:o-s,height:a};case"e":return{x:i,y:r,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var Ac=Math.abs,E0=Math.round,wn={x:"width",y:"height"},Jv="crosshair",Un={n:"top",w:"left",s:"bottom",e:"right"},x0=1500,ga={n:"s",w:"e",s:"n",e:"w"},ya=20;function Wt(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",x0,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&Md(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,f=l.movingShapes,d=l.resizingShapes,h=l.start;if(l.initialized){Md(c);var m={x:0,y:0};m[u]=E0(c["d"+u]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(v){s.activateSelection(v.originalEvent,!0,!0)})}})}Wt.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"];Wt.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Jv,data:{context:{reactivate:n}},trapClick:!1})};Wt.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Jv,data:{context:{}}})};Wt.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)};Wt.prototype.init=function(e,t){var n=Ac(e.dx)>Ac(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Ac(i)<5)return!1;i<0&&(i*=-1),Xr(e)&&(i*=-1);var o=y0(n,i),a=this._canvas.getRootElement();!qc(e)&&e.hover&&(a=e.hover);var s=[...so(a,!0),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),u=w0(c,n,o,r,l);return N(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:r}),Qh("resize-"+(n==="x"?"ew":"ns")),!0};Wt.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=[],c=[];function l(f){o.includes(f)||o.push(f);var d=f.label;d&&!o.includes(d)&&o.push(d)}function u(f){a.includes(f)||a.push(f)}D(e,function(f){if(!(!f.parent||be(f))){if(Ce(f)){c.push(f);return}var d=f[t],h=d+f[wn[t]];if(S0(f)&&(n>0&&re(f)[t]>i||n<0&&re(f)[t]<i)){s.push(f);return}if(n>0&&d>i||n<0&&h<i){l(f);return}if(d<i&&h>i&&r.allowed("shape.resize",{shape:f})){u(f);return}}}),D(o,function(f){var d=f.attachers;d&&D(d,function(h){l(h)})});var p=o.concat(a);return D(s,function(f){var d=f.host;Ai(p,d)&&l(f)}),p=o.concat(a),D(c,function(f){var d=f.source,h=f.target,m=f.label;Ai(p,d)&&Ai(p,h)&&m&&l(m)}),{movingShapes:o,resizingShapes:a}};Wt.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)};Wt.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Id(e){return{top:e.top-ya,right:e.right+ya,bottom:e.bottom+ya,left:e.left-ya}}function Md(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;ue(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),ue(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),ue(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),ue(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function w0(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l;return D(a,function(u){var p=u.attachers,f=u.children,d=Q(u),h=pe(f,function(k){return!Ce(k)&&!be(k)&&!Ai(o,k)&&!Ai(a,k)}),m=pe(f,function(k){return!Ce(k)&&!be(k)&&Ai(o,k)}),v,E,w,_=[],x=[],P,A,C,I;h.length&&(E=Id(Q(Mt(h))),v=i-d[Un[n]]+E[Un[n]],n==="n"?s.bottom=l=ue(l)?Math.min(l,v):v:n==="w"?s.right=l=ue(l)?Math.min(l,v):v:n==="s"?s.top=c=ue(c)?Math.max(c,v):v:n==="e"&&(s.left=c=ue(c)?Math.max(c,v):v)),m.length&&(w=Id(Q(Mt(m))),v=i-w[Un[ga[n]]]+d[Un[ga[n]]],n==="n"?s.bottom=l=ue(l)?Math.min(l,v):v:n==="w"?s.right=l=ue(l)?Math.min(l,v):v:n==="s"?s.top=c=ue(c)?Math.max(c,v):v:n==="e"&&(s.left=c=ue(c)?Math.max(c,v):v)),p&&p.length&&(p.forEach(function(k){Ai(o,k)?_.push(k):x.push(k)}),_.length&&(P=Q(Mt(_.map(re))),A=d[Un[ga[n]]]-(P[Un[ga[n]]]-i)),x.length&&(C=Q(Mt(x.map(re))),I=C[Un[n]]-(d[Un[n]]-i)),n==="n"?(v=Math.min(A||1/0,I||1/0),s.bottom=l=ue(l)?Math.min(l,v):v):n==="w"?(v=Math.min(A||1/0,I||1/0),s.right=l=ue(l)?Math.min(l,v):v):n==="s"?(v=Math.max(A||-1/0,I||-1/0),s.top=c=ue(c)?Math.max(c,v):v):n==="e"&&(v=Math.max(A||-1/0,I||-1/0),s.left=c=ue(c)?Math.max(c,v):v));var T=r&&r[u.id];T&&(n==="n"?(v=i+u[wn[t]]-T[wn[t]],s.bottom=l=ue(l)?Math.min(l,v):v):n==="w"?(v=i+u[wn[t]]-T[wn[t]],s.right=l=ue(l)?Math.min(l,v):v):n==="s"?(v=i-u[wn[t]]+T[wn[t]],s.top=c=ue(c)?Math.max(c,v):v):n==="e"&&(v=i-u[wn[t]]+T[wn[t]],s.left=c=ue(c)?Math.max(c,v):v))}),s}}function Ai(e,t){return e.indexOf(t)!==-1}function S0(e){return!!e.host}var Ic="djs-dragging",Dd="djs-resizing",C0=250,_a=Math.max;function Qv(e,t,n,i,r){function o(a,s){D(a,function(c){r.addDragger(c,s),n.addMarker(c,Ic)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=ve("g");ae(u,i.cls("djs-crosshair-group",["no-events"])),ge(s,u);var p=ve("path");ae(p,"d",l.x),Re(p).add("djs-crosshair"),ge(u,p);var f=ve("path");ae(f,"d",l.y),Re(f).add("djs-crosshair"),ge(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;mt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&ut(c)}),e.on("spaceTool.move",C0,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=ve("path"),ae(c,"d","M0,0 L0,0"),Re(c).add("djs-crosshair"),ge(f,c),s.line=c;var d=ve("g");ae(d,i.cls("djs-drag-group",["no-events"])),ge(n.getActiveLayer(),d),o(u,d);var h=s.movingConnections=t.filter(function(x){var P=!1;D(u,function(T){D(T.outgoing,function(k){x===k&&(P=!0)})});var A=!1;D(u,function(T){D(T.incoming,function(k){x===k&&(A=!0)})});var C=!1;D(p,function(T){D(T.outgoing,function(k){x===k&&(C=!0)})});var I=!1;return D(p,function(T){D(T.incoming,function(k){x===k&&(I=!0)})}),Ce(x)&&(P||C)&&(A||I)});o(h,d),s.dragGroup=d}if(!s.frameGroup){var m=ve("g");ae(m,i.cls("djs-frame-group",["no-events"])),ge(n.getActiveLayer(),m);var v=[];D(p,function(x){var P=r.addFrame(x,m),A=P.getBBox();v.push({element:P,initialBounds:A}),n.addMarker(x,Dd)}),s.frameGroup=m,s.frames=v}var E={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};ae(c,{d:E[l]});var w={x:"y",y:"x"},_={x:a.dx,y:a.dy};_[w[s.axis]]=0,mt(s.dragGroup,_.x,_.y),D(s.frames,function(x){var P=x.element,A=x.initialBounds,C,I;s.direction==="e"?ae(P,{width:_a(A.width+_.x,5)}):(C=_a(A.width-_.x,5),ae(P,{width:C,x:A.x+A.width-C})),s.direction==="s"?ae(P,{height:_a(A.height+_.y,5)}):(I=_a(A.height-_.y,5),ae(P,{height:I,y:A.y+A.height-I}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;D(c,function(h){n.removeMarker(h,Ic)}),D(l,function(h){n.removeMarker(h,Ic)}),f&&(ut(p),ut(f)),D(u,function(h){n.removeMarker(h,Dd)}),d&&ut(d)})}Qv.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const T0={__init__:["spaceToolPreview"],__depends__:[Mn,yn,Rs,_r,vo],spaceTool:["type",Wt],spaceToolPreview:["type",Qv]};function As(e){e.invoke(Wt,this)}As.$inject=["injector"];q(As,Wt);As.prototype.calculateAdjustments=function(e,t,n,i){var r=Wt.prototype.calculateAdjustments.call(this,e,t,n,i);return r.resizingShapes=r.resizingShapes.filter(function(o){return!(g(o,"bpmn:TextAnnotation")||P0(o)&&(t==="y"&&gt(o)||t==="x"&&!gt(o)))}),r};function P0(e){return g(e,"bpmn:Participant")&&!z(e).processRef}const eg={__depends__:[T0],spaceTool:["type",As]};function Oe(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Oe.$inject=["eventBus","injector"];Oe.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()};Oe.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r};Oe.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})};Oe.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}};Oe.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}};Oe.prototype.register=function(e,t){this._setHandler(e,t)};Oe.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)};Oe.prototype.canUndo=function(){return!!this._getUndoAction()};Oe.prototype.canRedo=function(){return!!this._getRedoAction()};Oe.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]};Oe.prototype._getUndoAction=function(){return this._stack[this._stackIdx]};Oe.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})};Oe.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r};Oe.prototype._createId=function(){return this._uid++};Oe.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}};Oe.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()};Oe.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)};Oe.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:I_("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)};Oe.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=me(e)?e:[e],t.dirty=t.dirty.concat(e))};Oe.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)};Oe.prototype._revertedAction=function(e){this._stackIdx--};Oe.prototype._getHandler=function(e){return this._handlerMap[e]};Oe.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const R0={commandStack:["type",Oe]};function Zn(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(e){for(var n;n=e[0];)t(n);return e}}var A0=250,kd=1400;function Zu(e,t,n){H.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",kd,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Od(a),o.validatedShapes=Od(s)}),i&&t.on("shape.move.start",A0,function(r){var o=r.context,a=o.shapes,s=[];D(a,function(c){D(c.labels,function(l){!l.hidden&&o.shapes.indexOf(l)===-1&&s.push(l),c.labelTarget&&s.push(c)})}),D(s,function(c){i.makeDraggable(o,c,!0)})}),this.preExecuted("elements.move",kd,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];D(s,function(l){D(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;Zn(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=Gl(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(Ze(s.labels,a,c),a.labelTarget=s)})}q(Zu,H);Zu.$inject=["injector","eventBus","modeling"];function Od(e){return pe(e,function(t){return e.indexOf(t.labelTarget)===-1})}const I0={__init__:["labelSupport"],labelSupport:["type",Zu]};var M0=251,Nd=1401,Ld="attach-ok";function Ju(e,t,n,i,r){H.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Nd,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=D0(c),s.validatedShapes=k0(l)}),o&&t.on("shape.move.start",M0,function(a){var s=a.context,c=s.shapes,l=_l(c);D(l,function(u){o.makeDraggable(s,u,!0),D(u.labels,function(p){o.makeDraggable(s,p,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var l=c[0],u=l.host;u&&(n.addMarker(u,Ld),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,Ld)}))}}),this.preExecuted("elements.move",Nd,function(a){var s=a.context,c=s.closure,l=s.shapes,u=_l(l);D(u,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=pe(c,function(p){var f=p.host;return O0(p)&&!N0(c,f)}),D(u,function(p){r.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;D(s,function(c){D(c.attachers,function(l){D(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||r.removeConnection(u)}),D(l.incoming.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||r.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&r.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;Zn(c.attachers,function(u){var p=i.allowed("elements.move",{target:l,shapes:[u]});p==="attach"?r.updateAttachment(u,l):r.removeShape(u)}),l.attachers.length&&D(l.attachers,function(u){var p=pd(u,c,l);r.moveShape(u,p,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&D(p,function(d){var h=pd(d,l,u);r.moveShape(d,h,d.parent),D(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;Zn(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}q(Ju,H);Ju.$inject=["injector","eventBus","canvas","rules","modeling"];function _l(e){return Bl(Pt(e,function(t){return t.attachers||[]}))}function D0(e){var t=_l(e);return M_("id",e,t)}function k0(e){var t=is(e,"id");return pe(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function O0(e){return!!e.host}function N0(e,t){return e.indexOf(t)!==-1}const L0={__depends__:[yn],__init__:["attachSupport"],attachSupport:["type",Ju]};function Yt(e){this._model=e}Yt.$inject=["moddle"];Yt.prototype._needsId=function(e){return ce(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"])};Yt.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;g(e,"bpmn:Activity")?t="Activity":g(e,"bpmn:Event")?t="Event":g(e,"bpmn:Gateway")?t="Gateway":ce(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))};Yt.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n};Yt.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})};Yt.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",N({bpmnElement:e,bounds:this.createDiBounds()},t))};Yt.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)};Yt.prototype.createDiWaypoints=function(e){var t=this;return Pt(e,function(n){return t.createDiWaypoint(n)})};Yt.prototype.createDiWaypoint=function(e){return this.create("dc:Point",mn(e,["x","y"]))};Yt.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",N({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))};Yt.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",N({bpmnElement:e},t))};function At(e,t,n){H.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var h=d.context,m=h.hints||{},v;!h.cropped&&m.createElementsBehavior!==!1&&(v=h.connection,v.waypoints=n.getCroppedWaypoints(v),h.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var h=d.context;i.updateParent(h.shape||h.connection,h.oldParent)}function a(d){var h=d.context,m=h.shape||h.connection,v=h.parent||h.newParent;i.updateParent(m,v)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Tt(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Tt(a));function s(d){var h=d.context,m=h.oldRoot,v=m.children;D(v,function(E){g(E,"bpmn:BaseElement")&&i.updateParent(E)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;g(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],Tt(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Tt(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function l(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],Tt(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Tt(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Tt(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Tt(u)),this.executed("connection.reconnect",Tt(function(d){var h=d.context,m=h.connection,v=h.oldSource,E=h.newSource,w=z(m),_=z(v),x=z(E);w.conditionExpression&&!ce(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=w.conditionExpression,delete w.conditionExpression),v!==E&&_.default===w&&(h.oldDefault=_.default,delete _.default)})),this.reverted("connection.reconnect",Tt(function(d){var h=d.context,m=h.connection,v=h.oldSource,E=h.newSource,w=z(m),_=z(v),x=z(E);h.oldConditionExpression&&(w.conditionExpression=h.oldConditionExpression),h.oldDefault&&(_.default=h.oldDefault,delete x.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Tt(p)),this.reverted(["element.updateAttachment"],Tt(p)),this.executed("element.updateLabel",Tt(f)),this.reverted("element.updateLabel",Tt(f));function f(d){const{element:h}=d.context,m=Jn(h),v=we(h),E=v&&v.get("label");ar(h)||Ia(h)||(m&&!E?v.set("label",t.create("bpmndi:BPMNLabel")):!m&&E&&v.set("label",void 0))}}q(At,H);At.$inject=["eventBus","bpmnFactory","connectionDocking"];At.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject};At.prototype.updateParent=function(e,t){if(!be(e)&&!(g(e,"bpmn:DataStoreReference")&&e.parent&&g(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=we(e),o=n&&n.businessObject,a=we(n);g(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),g(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),g(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),g(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}};At.prototype.updateBounds=function(e){var t=we(e),n=$0(e);if(n){var i=Tn(n,t.get("bounds"));N(n,{x:e.x+i.x,y:e.y+i.y})}var r=be(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),N(o,{x:e.x,y:e.y,width:e.width,height:e.height})};At.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;g(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),We(i,e)),g(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Ze(r,e))}};At.prototype.updateDiConnection=function(e,t,n){var i=we(e),r=we(t),o=we(n);i.sourceElement&&i.sourceElement.bpmnElement!==z(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==z(n)&&(i.targetElement=n&&o)};At.prototype.updateDiParent=function(e,t){if(t&&!g(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(We(n,e),e.$parent=null)}};function B0(e){for(;e&&!g(e,"bpmn:Definitions");)e=e.$parent;return e}At.prototype.getLaneSet=function(e){var t,n;return g(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(g(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)};At.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((g(e,"bpmn:DataInput")||g(e,"bpmn:DataOutput"))&&(g(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(g(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(g(e,"bpmn:FlowElement")){if(t){if(g(t,"bpmn:Participant"))t=t.processRef;else if(g(t,"bpmn:Lane"))do t=t.$parent.$parent;while(g(t,"bpmn:Lane"))}i="flowElements"}else if(g(e,"bpmn:Artifact")){for(;t&&!g(t,"bpmn:Process")&&!g(t,"bpmn:SubProcess")&&!g(t,"bpmn:Collaboration");)if(g(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(g(e,"bpmn:MessageFlow"))i="messageFlows";else if(g(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=B0(e.$parent||t),e.$parent&&(We(o.get("rootElements"),r),r.$parent=null),t&&(Ze(o.get("rootElements"),r),r.$parent=o))}else g(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":g(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),We(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);We(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}};At.prototype.updateConnectionWaypoints=function(e){var t=we(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))};At.prototype.updateConnection=function(e){var t=e.connection,n=z(t),i=t.source,r=z(i),o=t.target,a=z(t.target),s;if(g(n,"bpmn:DataAssociation"))g(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):g(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=g(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(We(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(We(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)};At.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Tt(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;g(i,"bpmn:BaseElement")&&e(t)}}function $0(e){if(g(e,"bpmn:Activity")){var t=we(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function ai(e,t){zl.call(this),this._bpmnFactory=e,this._moddle=t}q(ai,zl);ai.$inject=["bpmnFactory","moddle"];ai.prototype._baseCreate=zl.prototype.create;ai.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,N({type:"label",di:n},D_,t))}return this.createElement(e,t)};ai.prototype.createElement=function(e,t){t=N({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type),k_(i)}if(!j0(r)){var o=N({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}g(i,"bpmn:Group")&&(t=N({isFrame:!0},t)),t=F0(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=bl(r,t,"isExpanded")),ce(i,["bpmn:Lane","bpmn:Participant"])&&(t=bl(r,t,"isHorizontal")),g(i,"bpmn:SubProcess")&&(t.collapsed=!ye(i,r)),g(i,"bpmn:ExclusiveGateway")&&(qn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),It(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),It(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=N({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)};ai.prototype.getDefaultSize=function(e,t){var n=z(e);return t=t||we(e),g(n,"bpmn:SubProcess")?ye(n,t)?{width:350,height:200}:{width:100,height:80}:g(n,"bpmn:Task")?{width:100,height:80}:g(n,"bpmn:Gateway")?{width:50,height:50}:g(n,"bpmn:Event")?{width:36,height:36}:g(n,"bpmn:Participant")?ye(n,t)?{width:600,height:250}:{width:400,height:60}:g(n,"bpmn:Lane")?{width:400,height:100}:g(n,"bpmn:DataObjectReference")?{width:36,height:50}:g(n,"bpmn:DataStoreReference")?{width:50,height:50}:g(n,"bpmn:TextAnnotation")?{width:100,height:30}:g(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}};ai.prototype.createParticipantShape=function(e){return vn(e)||(e={isExpanded:e}),e=N({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function F0(e,t,n){return D(n,function(i){t=bl(e,t,i)}),t}function bl(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Rn(t,[n]))}function j0(e){return ce(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Is(e,t){this._modeling=e,this._canvas=t}Is.$inject=["modeling","canvas"];Is.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;D(n,function(r){var o={x:0,y:0};It(i.left)?o.x=i.left-r.x:It(i.right)?o.x=i.right-r.width-r.x:It(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:It(i.top)?o.y=i.top-r.y:It(i.bottom)?o.y=i.bottom-r.height-r.y:It(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})};Is.prototype.postExecute=function(e){};function Ms(e){this._modeling=e}Ms.$inject=["modeling"];Ms.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i};Ms.prototype.postExecute=function(e){var t=e.hints||{};H0(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 H0(e,t){return Li(e.outgoing,function(n){return n.target===t})}function Ds(e,t){this._canvas=e,this._layouter=t}Ds.$inject=["canvas","layouter"];Ds.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t};Ds.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var ba=Math.round;function Qu(e){this._modeling=e}Qu.$inject=["modeling"];Qu.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;D(t,function(p){ue(p.x)||(p.x=0),ue(p.y)||(p.y=0)});var s=pe(t,function(p){return!p.hidden}),c=Mt(s);D(t,function(p){Ce(p)&&(p.waypoints=Pt(p.waypoints,function(f){return{x:ba(f.x-c.x-c.width/2+r.x),y:ba(f.y-c.y-c.height/2+r.y)}})),N(p,{x:ba(p.x-c.x-c.width/2+r.x),y:ba(p.y-c.y-c.height/2+r.y)})});var l=ts(t),u={};D(t,function(p){if(Ce(p)){u[p.id]=ue(i)?a.createConnection(u[p.source.id],u[p.target.id],i,p,p.parent||n,o):a.createConnection(u[p.source.id],u[p.target.id],p,p.parent||n,o);return}var f=N({},o);l.indexOf(p)===-1&&(f.autoResize=!1),be(p)&&(f=Rn(f,["attach"])),u[p.id]=ue(i)?a.createShape(p,mn(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,mn(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=$l(u)};var Bd=Math.round;function si(e){this._canvas=e}si.$inject=["canvas"];si.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?N(t,n):N(t,{x:n.x-Bd(t.width/2),y:n.y-Bd(t.height/2)}),this._canvas.addShape(t,i,r),t};si.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function yo(e){si.call(this,e)}q(yo,si);yo.$inject=["canvas"];var G0=si.prototype.execute;yo.prototype.execute=function(e){var t=e.shape;return V0(t),t.labelTarget=e.labelTarget,G0.call(this,e)};var z0=si.prototype.revert;yo.prototype.revert=function(e){return e.shape.labelTarget=null,z0.call(this,e)};function V0(e){["width","height"].forEach(function(t){typeof e[t]=="undefined"&&(e[t]=0)})}function _o(e,t){this._canvas=e,this._modeling=t}_o.$inject=["canvas","modeling"];_o.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Zn(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Zn(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})};_o.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Gl(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t};_o.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Ze(n.children,t,i),this._canvas.addConnection(t,n),t};function ep(e,t){this._modeling=e,this._elementRegistry=t}ep.$inject=["modeling","elementRegistry"];ep.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;D(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function bo(e,t){this._canvas=e,this._modeling=t}bo.$inject=["canvas","modeling"];bo.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Zn(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Zn(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),Zn(n.children,function(i){Ce(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})};bo.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Gl(i.children,n),t.removeShape(n),n};bo.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Ze(i.children,n,r),t.addShape(n,i),n};function ks(e){this._modeling=e}ks.$inject=["modeling"];var $d={x:"y",y:"x"};ks.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(v,E){v.range.min=Math.min(E[i],v.range.min),v.range.max=Math.max(E[i]+E[r],v.range.max)}function a(v){return v[i]+v[r]/2}function s(v){return v.length-1}function c(v){return v.max-v.min}function l(v,E){var w={y:0};w[i]=v-a(E),w[i]&&(w[$d[i]]=0,t.moveElements([E],w,E.parent))}var u=n[0],p=s(n),f=n[p],d,h,m=0;D(n,function(v,E){var w,_,x;if(v.elements.length<2){E&&E!==n.length-1&&(o(v,v.elements[0]),m+=c(v.range));return}w=hn(v.elements,i),_=w[0],E===p&&(_=w[s(w)]),x=a(_),v.range=null,D(w,function(P){if(l(x,P),v.range===null){v.range={min:P[i],max:P[i]+P[r]};return}o(v,P)}),E&&E!==n.length-1&&(m+=c(v.range))}),h=Math.abs(f.range.min-u.range.max),d=Math.round((h-m)/(n.length-1)),!(d<n.length-1)&&D(n,function(v,E){var w={},_;v===u||v===f||(_=n[E-1],v.range.max=0,D(v.elements,function(x,P){w[$d[i]]=0,w[i]=_.range.max-x[i]+d,v.range.min!==x[i]&&(w[i]+=x[i]-v.range.min),w[i]&&t.moveElements([x],w,x.parent),v.range.max=Math.max(x[i]+x[r],P?v.range.max:0)}))})};ks.prototype.postExecute=function(e){};function Os(e,t){this._layouter=e,this._canvas=t}Os.$inject=["layouter","canvas"];Os.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return N(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t};Os.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function tp(){}tp.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=We(o.children,t),Ze(i.children,t,r),t.parent=i,D(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};tp.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return We(n.children,t),Ze(i.children,t,r),t.parent=i,D(t.waypoints,function(a){a.x-=o.x,a.y-=o.y,a.original&&(a.original.x-=o.x,a.original.y-=o.y)}),t};function np(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}np.prototype.add=function(e,t){return this.addAll([e],t)};np.prototype.addAll=function(e,t){var n=O_(e,!!t,this);return N(this,n),this};function Eo(e){this._modeling=e}Eo.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]};Eo.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;r&&r.parent===n&&(u=!0),D(a,function(p){o.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),D(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?o.moveConnection(p,t,l[p.id]&&!u&&n):o.layoutConnection(p,{connectionStart:f&&Pu(p,p.source,t),connectionEnd:d&&Ru(p,p.target,t)})})};Eo.prototype.getClosure=function(e){return new np().addAll(e,!0)};function Ns(e){this._helper=new Eo(e)}Ns.$inject=["modeling"];Ns.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)};Ns.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function $i(e){this._modeling=e,this._helper=new Eo(e)}$i.$inject=["modeling"];$i.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=mn(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=We(o.children,t),Ze(i.children,t,r),N(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t};$i.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(D(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Ru(o,t,n)})}),D(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Pu(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)};$i.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Ze(n.children,t,i),N(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t};$i.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)};$i.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function xo(e){this._modeling=e}xo.$inject=["modeling"];xo.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return me(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i};xo.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||Fd(me(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Fd(me(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))};xo.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function Fd(e){return e.original||e}function kn(e,t){this._modeling=e,this._rules=t}kn.$inject=["modeling","rules"];kn.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(h,m,v){return i.allowed("connection.reconnect",{connection:v,source:h,target:m})}var l={x:o.x,y:o.y},u={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,l,r.parent,a),r.host&&n.updateAttachment(s,r.host);var p;a.moveChildren!==!1&&(p=r.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=r.incoming.slice(),d=r.outgoing.slice();D(f,function(h){var m=h.source,v=c(m,s,h);v&&t.reconnectEnd(h,s,xs(h,s,u),a)}),D(d,function(h){var m=h.target,v=c(s,m,h);v&&t.reconnectStart(h,s,Es(h,s,u),a)})};kn.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)};kn.prototype.execute=function(e){};kn.prototype.revert=function(e){};kn.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)};kn.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)};kn.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function wo(e){this._modeling=e}wo.$inject=["modeling"];wo.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},N(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};wo.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(D(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:xs(o,n,i)})}),D(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Es(o,n,i)})}))};wo.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return N(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function ci(e){this._modeling=e}ci.$inject=["modeling"];ci.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),D(r,function(s){a[s.id]=W0(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(_0(i,r),t,n,o,i,r,a)};ci.prototype.execute=function(){};ci.prototype.revert=function(){};ci.prototype.moveShapes=function(e,t){var n=this;D(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})};ci.prototype.resizeShapes=function(e,t,n){var i=this;D(e,function(r){var o=b0(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})};ci.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=r.concat(o);D(e,function(l){var u=l.source,p=l.target,f=U0(l),d=tg(n),h={};Wn(c,u)&&Wn(c,p)?(f=Pt(f,function(m){return Hd(m,i,n)&&(m[d]=m[d]+t[d]),m.original&&Hd(m.original,i,n)&&(m.original[d]=m.original[d]+t[d]),m}),s._modeling.updateWaypoints(l,f,{labelBehavior:!1})):(Wn(c,u)||Wn(c,p))&&(Wn(r,u)?h.connectionStart=Pu(l,u,t):Wn(r,p)?h.connectionEnd=Ru(l,p,t):Wn(o,u)?h.connectionStart=Es(l,u,a[u.id]):Wn(o,p)&&(h.connectionEnd=xs(l,p,a[p.id])),s._modeling.layoutConnection(l,h))})};function jd(e){return N({},e)}function U0(e){return Pt(e.waypoints,function(t){return t=jd(t),t.original&&(t.original=jd(t.original)),t})}function tg(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Hd(e,t,n){var i=tg(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function Wn(e,t){return e.indexOf(t)!==-1}function W0(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ls(e){this._modeling=e}Ls.$inject=["modeling"];Ls.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=ng(n),t.collapsed=!t.collapsed;var i=ig(n,t.collapsed);return[t].concat(i)};Ls.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=rg(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function ng(e){var t={};return D(e,function(n){t[n.id]=n.hidden,n.children&&(t=N({},t,ng(n.children)))}),t}function ig(e,t){var n=[];return D(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(ig(i.children,i.collapsed||t)))}),n}function rg(e,t){var n=[];return D(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(rg(i.children,t)))}),n}function Bs(e){this._modeling=e}Bs.$inject=["modeling"];Bs.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=og(i,t),ag(n,t),t.host=n,t};Bs.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,og(n,t),ag(i,t,r),t};function og(e,t){return We(e&&e.attachers,t)}function ag(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Ze(i,t,n)}}function ip(){}ip.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t};ip.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Se(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Se.$inject=["eventBus","elementFactory","commandStack"];Se.prototype.getHandlers=function(){return{"shape.append":Ms,"shape.create":si,"shape.delete":bo,"shape.move":$i,"shape.resize":wo,"shape.replace":kn,"shape.toggleCollapse":Ls,spaceTool:ci,"label.create":yo,"connection.create":Ds,"connection.delete":_o,"connection.move":tp,"connection.layout":Os,"connection.updateWaypoints":ip,"connection.reconnect":xo,"elements.create":Qu,"elements.move":Ns,"elements.delete":ep,"elements.distribute":ks,"elements.align":Is,"element.updateAttachment":Bs}};Se.prototype.registerHandlers=function(e){D(this.getHandlers(),function(t,n){e.registerHandler(n,t)})};Se.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)};Se.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)};Se.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)};Se.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)};Se.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)};Se.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection};Se.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape};Se.prototype.createElements=function(e,t,n,i,r){me(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements};Se.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape};Se.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape};Se.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)};Se.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)};Se.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)};Se.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)};Se.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape};Se.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)};Se.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)};Se.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)};Se.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)};Se.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)};Se.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,N(i,{docking:"source"}))};Se.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,N(i,{docking:"target"}))};Se.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)};Se.prototype._create=function(e,t){return N_(t)?t:this._elementFactory.create(e,t)};Se.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function So(e){this._elementRegistry=e}So.$inject=["elementRegistry"];So.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||Y0(n,Kc(i));return sg(n,i),e.oldProperties=o,e.changed=r,r};So.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return sg(n,t),i};So.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return g(e,"bpmn:DataObject")?q0(e,t):[]};function Y0(e,t){return ni(t,function(n,i){return n[i]=e.get(i),n},{})}function sg(e,t){D(t,function(n,i){e.set(i,n)})}function q0(e,t){return t.filter(function(n){return g(n,"bpmn:DataObjectReference")&&z(n).dataObjectRef===e})}var jr="default",Pn="id",cg="di",K0={width:0,height:0};function Co(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Co.$inject=["elementRegistry","moddle","modeling","textRenderer"];Co.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=eS(e.properties),s=e.oldProperties||X0(t,a);return lg(a,o)&&(r.unclaim(o[Pn]),i.updateId(t,a[Pn]),r.claim(a[Pn],o)),jr in a&&(a[jr]&&n.push(i.get(a[jr].id)),o[jr]&&n.push(i.get(o[jr].id))),ug(t,a),e.oldProperties=s,e.changed=n,n};Co.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&z(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,K0)}};Co.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return ug(t,i),lg(n,r)&&(a.unclaim(n[Pn]),o.updateId(t,i[Pn]),a.claim(i[Pn],r)),e.changed};function lg(e,t){return Pn in e&&e[Pn]!==t[Pn]}function X0(e,t){var n=Kc(t),i=e.businessObject,r=we(e);return ni(n,function(o,a){return a!==cg?o[a]=i.get(a):o[a]=Z0(r,Kc(t.di)),o},{})}function Z0(e,t){return ni(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function ug(e,t){var n=e.businessObject,i=we(e);D(t,function(r,o){o!==cg?n.set(o,r):i&&J0(i,r)})}function J0(e,t){D(t,function(n,i){e.set(i,n)})}var Q0=["default"];function eS(e){var t=N({},e);return Q0.forEach(function(n){n in e&&(t[n]=z(t[n]))}),t}function $s(e,t){this._canvas=e,this._modeling=t}$s.$inject=["canvas","modeling"];$s.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=we(r);return t.setRootElement(n),t.removeRootElement(r),Ze(a.rootElements,i),i.$parent=a,We(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]};$s.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=we(n);return t.setRootElement(r),t.removeRootElement(n),We(a.rootElements,i),i.$parent=null,Ze(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function rp(e,t){this._modeling=e,this._spaceTool=t}rp.$inject=["modeling","spaceTool"];rp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Ht(i),a=o===i,s=a?i:i.parent,c=ri(s),l=gt(i);if(l?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var u=l?{x:i.x+jt,y:i.y,width:i.width-jt,height:i.height}:{x:i.x,y:i.y+jt,width:i.width,height:i.height-jt};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];as(o,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:pe(x.children,function(P){return P!==i})});var f,d,h,m,v;r==="top"?(f=-120,d=i.y,h=d+10,m="n",v="y"):r==="left"?(f=-120,d=i.x,h=d+10,m="w",v="x"):r==="bottom"?(f=120,d=i.y+i.height,h=d-10,m="s",v="y"):r==="right"&&(f=120,d=i.x+i.width,h=d-10,m="e",v="x");var E=t.calculateAdjustments(p,v,f,h),w=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(E.movingShapes,E.resizingShapes,w,m,h);var _=l?{x:i.x+(a?jt:0),y:d-(r==="top"?120:0),width:i.width-(a?jt:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?jt:0),width:120,height:i.height-(a?jt:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},_,s)};function op(e){this._modeling=e}op.$inject=["modeling"];op.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=ri(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=gt(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,f;for(f=0;f<i;f++)f===i-1?l=s-c*f:l=c,u=a?{x:n.x+jt,y:n.y+f*c,width:n.width-jt,height:l}:{x:n.x+f*c,y:n.y+jt,width:l,height:n.height-jt},f<o?t.resizeShape(r[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function To(e,t){this._modeling=e,this._spaceTool=t}To.$inject=["modeling","spaceTool"];To.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)};To.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=Mx(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})};To.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Q(e),r=Q(t),o=uv(r,i),a=Ht(e),s=[],c=[];as(a,function(h){return s.push(h),(g(h,"bpmn:Lane")||g(h,"bpmn:Participant"))&&c.push(h),h.children});var l,u,p,f,d;(o.bottom||o.top)&&(l=o.bottom||o.top,u=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:l},p)),(o.left||o.right)&&(l=o.right||o.left,u=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-l:l,d=n.calculateAdjustments(c,"x",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},p))};var no="flowNodeRef",ap="lanes";function Po(e){this._elementRegistry=e}Po.$inject=["elementRegistry"];Po.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(u,p){var f=Q(p),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(u){n.indexOf(u)===-1&&(o.push(u),n.push(u))}function c(u){var p=Ht(u);return r[p.id]||(r[p.id]=_s(p)),r[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(f){return a(u,f)}).map(function(f){return f.businessObject})}return t.forEach(function(u){var p=Ht(u);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return g(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(u){var p=u.businessObject,f=p.get(ap),d=f.slice(),h=l(u);i.push({flowNode:p,remove:d,add:h})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(no).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i};Po.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,r=i.get(ap);n.remove.forEach(function(o){We(r,o),We(o.get(no),i)}),n.add.forEach(function(o){Ze(r,o),Ze(o.get(no),i)})}),[]};Po.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(ap);n.add.forEach(function(o){We(r,o),We(o.get(no),i)}),n.remove.forEach(function(o){Ze(r,o),Ze(o.get(no),i)})}),[]};function Fs(e){this._moddle=e}Fs.$inject=["moddle"];Fs.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.claim(n,i):t.unclaim(n),[]};Fs.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var tS={fill:void 0,stroke:void 0};function sp(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(ns(t)){var n=nS(t);if(n)return n}throw new Error("invalid color value: "+t)}}}sp.$inject=["commandStack"];sp.prototype.postExecute=function(e){var t=e.elements,n=e.colors||tS,i=this,r={};"fill"in n&&N(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&N(r,{"border-color":this._normalizeColor(n.stroke)}),D(t,function(o){var a=Ce(o)?mn(r,["border-color"]):r,s=we(o);if(iS(a),be(o))i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}});else{if(!ce(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function nS(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 iS(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var rS={width:0,height:0};function pg(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return L_(u,l),[u,p]}function r(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!be(l)&&ar(l)&&!os(l)&&!Gd(p)){var f=7,d=am(l);d={x:d.x,y:d.y+f},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function o(c){return c.oldLabel=Jn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!be(u)&&!g(u,"bpmn:TextAnnotation"))){if(be(u)&&Gd(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var h=Jn(l);typeof f=="undefined"&&(f=t.getExternalLabelBounds(u,h)),f&&e.resizeShape(u,f,rS)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}pg.$inject=["modeling","textRenderer","bpmnFactory"];function Gd(e){return!e||!e.trim()}function dt(e,t,n,i){Se.call(this,e,t,n),this._bpmnRules=i}q(dt,Se);dt.$inject=["eventBus","elementFactory","commandStack","bpmnRules"];dt.prototype.getHandlers=function(){var e=Se.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=So,e["element.updateProperties"]=Co,e["canvas.updateRoot"]=$s,e["lane.add"]=rp,e["lane.resize"]=To,e["lane.split"]=op,e["lane.updateRefs"]=Po,e["id.updateClaim"]=Fs,e["element.setColor"]=sp,e["element.updateLabel"]=pg,e};dt.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})};dt.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)};dt.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})};dt.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})};dt.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})};dt.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane};dt.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})};dt.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e};dt.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};this._commandStack.execute("canvas.updateRoot",t)};dt.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})};dt.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})};dt.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})};dt.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function fg(){}fg.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||re(t.source||e.source),t.connectionEnd||re(t.target||e.target)]};var Ea=20,oS=5,Ka=Math.round,zd=20,aS={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function sS(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function cS(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function dg(e,t,n){var i=ft(t,e,oS),r=n.split(":")[0],o=Ka((t.x-e.x)/2+e.x),a=Ka((t.y-e.y)/2+e.y),s,c,l=cS(r,i),u=/h|r|l/.test(r),p=!1,f=!1;return l?(s=u?{x:o,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=sS(i,r),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+Ea*(/l/.test(r)?-1:1),y:f?a+Ea:a}):(f=o===e.x,s={x:f?o+Ea:o,y:e.y+Ea*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:cp(e,s,c).concat(s),directions:c,turnNextDirections:f}}function lS(e,t,n){return dg(e,t,n)}function uS(e,t,n){var i=dg(t,e,Vd(n));return{waypoints:i.waypoints.slice().reverse(),directions:Vd(i.directions),turnNextDirections:i.turnNextDirections}}function pS(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var r=n+":"+i,o=cp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Vd(e){return e.split(":").reverse().join(":")}function fS(e,t,n){var i=Ka((t.x-e.x)/2+e.x),r=Ka((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function cp(e,t,n){if(n=n||"h:h",!ES(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(hg(n)){var i=lS(e,t,n),r=uS(e,t,n),o=pS(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return fS(e,t,n)}function dS(e,t,n){var i=cp(e,t,n);return i.unshift(e),i.push(t),mg(i)}function hS(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=B_(o,"straight")[0]||"h:h",s=aS[a]||0,c=ft(e,t,s),l=bS(c,a);n=n||re(e),i=i||re(t);var u=l.split(":"),p=Wd(n,e,u[0],xS(c)),f=Wd(i,t,u[1],c);return dS(p,f,l)}function mS(e,t,n,i,r,o){me(n)&&(r=n,o=i,n=re(e),i=re(t)),o=N({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&gS(e,t,n,i,o),c||(c=o.connectionEnd&&_S(t,e,i,r),c)||(c=o.connectionStart&&yS(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:hS(e,t,n,i,o)}function vS(e,t,n){return e>=t&&e<=n}function Ud(e,t,n){var i={x:"width",y:"height"};return vS(t[e],n[e],n[e]+n[i[e]])}function gS(e,t,n,i,r){var o={},a,s;return s=ft(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Ud(a,i,e)?(o[a]=i[a],[{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y,original:{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y}},{x:i.x,y:i.y}]):null:Ud(a,n,t)?(o[a]=n[a],[{x:n.x,y:n.y},{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y,original:{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y}}]):null):null}function yS(e,t,n,i){return lp(e,t,n,i)}function _S(e,t,n,i){var r=i.slice().reverse();return r=lp(e,t,n,r),r?r.reverse():null}function lp(e,t,n,i){function r(u){return u.length<3?!0:u.length>4?!1:!!Me(u,function(p,f){var d=u[f-1];return d&&em(p,d)<3})}function o(u,p,f){var d=Sn(p,u);switch(d){case"v":return{x:f.x,y:u.y};case"h":return{x:u.x,y:f.y}}return{x:u.x,y:u.y}}function a(u,p,f){var d;for(d=u.length-2;d!==0;d--)if(of(u[d],p,zd)||of(u[d],f,zd))return u.slice(d);return u}if(r(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=o(c[1],s,n),l=a(c,e,t),l!==c&&(c=lp(e,t,n,l)),c&&Sn(c)?null:c}function bS(e,t){if(hg(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 ES(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function hg(e){return e&&/t|r|b|l/.test(e)}function xS(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 Wd(e,t,n,i){if(n==="h"&&(n=/left/.test(i)?"l":"r"),n==="v"&&(n=/top/.test(i)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function mg(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return tm(r,o,n,0)||t.push(n),t},[])}var wS=-10,SS=40,CS={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},TS={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},up={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Gr={top:"t",right:"r",bottom:"b",left:"l"};function pp(){}q(pp,fg);pp.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s,c;if(o||(o=Yd(r&&r[0],n)),a||(a=Yd(r&&r[r.length-1],i)),(g(e,"bpmn:Association")||g(e,"bpmn:DataAssociation"))&&r&&!qd(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=hs(n)?CS:TS;return g(e,"bpmn:MessageFlow")?s=RS(n,i,l):(g(e,"bpmn:SequenceFlow")||qd(n,i))&&(n===i?s={preferredLayouts:OS(n,e,l)}:g(n,"bpmn:BoundaryEvent")?s={preferredLayouts:NS(n,i,a,l)}:io(n)||io(i)?s={preferredLayouts:l.subProcess,preserveDocking:IS(n)}:g(n,"bpmn:Gateway")?s={preferredLayouts:l.fromGateway}:g(i,"bpmn:Gateway")?s={preferredLayouts:l.toGateway}:s={preferredLayouts:l.default}),s&&(s=N(s,t),c=mg(mS(n,i,o,a,r,s))),c||[o,a]};function PS(e){var t=e.host;return ft(re(e),t,wS)}function RS(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:AS(e,t)}}function AS(e,t){return g(t,"bpmn:Participant")?"source":g(e,"bpmn:Participant")?"target":io(t)?"source":io(e)||g(t,"bpmn:Event")?"target":g(e,"bpmn:Event")?"source":null}function IS(e){return io(e)?"target":"source"}function Yd(e,t){return e?e.original||e:re(t)}function qd(e,t){return g(t,"bpmn:Activity")&&g(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function io(e){return g(e,"bpmn:SubProcess")&&ye(e)}function Ii(e,t){return e===t}function MS(e,t){return t.indexOf(e)!==-1}function fr(e){var t=/right|left/.exec(e);return t&&t[0]}function dr(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Kd(e,t){return up[e]===t}function DS(e,t){var n=fr(e),i=up[n];return t.indexOf(i)!==-1}function kS(e,t){var n=dr(e),i=up[n];return t.indexOf(i)!==-1}function vg(e){return e==="right"||e==="left"}function OS(e,t,n){var i=t.waypoints,r=i&&i.length&&ft(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function NS(e,t,n,i){var r=re(e),o=re(t),a=PS(e),s,c,l=Ii(e.host,t),u=MS(a,["top","right","bottom","left"]),p=ft(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?LS(a,u,e,t,n,i):(s=BS(a,p,u,i.isHorizontal),c=$S(a,p,u,i.isHorizontal),[s+":"+c])}function LS(e,t,n,i,r,o){var a=t?e:o.isHorizontal?dr(e):fr(e),s=Gr[a],c;return t?vg(e)?c=Xd("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Xd("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Xd(e,t,n,i){var r=SS;return!(Mc(e,i,n,r)||Mc(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Mc(e,i,re(t),r))}function Mc(e,t,n,i){return Math.abs(t[e]-n[e])<i}function BS(e,t,n,i){if(n)return Gr[e];var r=dr(e),o=fr(e),a=dr(t),s=fr(t);if(i){if(Ii(r,a)||Kd(o,s))return Gr[r]}else if(Ii(o,s)||Kd(r,a))return Gr[o];return Gr[i?o:r]}function $S(e,t,n,i){return n?vg(e)?DS(e,t)||Ii(e,t)?"h":"v":kS(e,t)||Ii(e,t)?"v":"h":i?Ii(dr(e),dr(t))?"h":"v":Ii(fr(e),fr(t))?"v":"h"}function Zd(e){return N({original:e.point.original||e.point},e.actual)}function li(e,t){this._elementRegistry=e,this._graphicsFactory=t}li.$inject=["elementRegistry","graphicsFactory"];li.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(Zd(i)),o.push(Zd(r)),o};li.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}};li.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Yc(i,r,n)};li.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)};li.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)};li.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const gg={__init__:["modeling","bpmnUpdater"],__depends__:[kw,Zw,Qw,e0,Zv,R0,I0,L0,An,sm,eg],bpmnFactory:["type",Yt],bpmnUpdater:["type",At],elementFactory:["type",ai],modeling:["type",dt],layouter:["type",pp],connectionDocking:["type",li]},Jd=Math.round;function js(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}js.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,l=o.createShape(N({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;N(l,{x:u.x-Jd(l.width/2),y:u.y-Jd(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:l}),f.waypoints=r.getCroppedWaypoints(f,e,l)),i.create({created:[l,f].filter(d=>!Wc(d))})};js.prototype.cleanUp=function(){this._complexPreview.cleanUp()};js.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const FS={__depends__:[iu,px,gg],__init__:["appendPreview"],appendPreview:["type",js]};var Qd=Math.min,eh=Math.max;function Dc(e){e.preventDefault()}function Wr(e){e.stopPropagation()}function jS(e){return e.nodeType===Node.TEXT_NODE}function HS(e){return[].slice.call(e)}function tn(e){this.container=e.container,this.parent=et('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=De("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=sr(this.autoResize,this),this.handlePaste=sr(this.handlePaste,this)}tn.prototype.create=function(e,t,n,i){var r=this,o=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=mn(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);N(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var l=mn(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return N(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&N(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,ne.bind(a,"keydown",this.keyHandler),ne.bind(a,"mousedown",Wr),ne.bind(a,"paste",r.handlePaste),i.autoResize&&ne.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o};tn.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var i;if(e.clipboardData?i=e.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),t.autoResize){var r=this.autoResize(n);r&&this.resizeHandler(r)}};tn.prototype.insertText=function(e){e=GS(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)};tn.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=HS(a.childNodes),c,l;if(jS(a)){var u=n.textContent;n.textContent=u.substring(0,r)+e+u.substring(o),c=n,l=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,l=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(h,m){m===f?h.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):m>f&&m<=d&&or(h)}),c=n,l=r+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})};tn.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}};tn.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=et('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(h){Dc(h),Wr(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();l=m.width,u=m.height,ne.bind(document,"mousemove",f),ne.bind(document,"mouseup",d)},f=function(h){Dc(h),Wr(h);var m=Qd(eh(l+h.clientX-s,i),o),v=Qd(eh(u+h.clientY-c,r),a);t.style.width=m+"px",t.style.height=v+"px",e.resizeHandler({width:l,height:u,dx:h.clientX-s,dy:h.clientY-c})},d=function(h){Dc(h),Wr(h),ne.unbind(document,"mousemove",f,!1),ne.unbind(document,"mouseup",d,!1)};ne.bind(n,"mousedown",p)}N(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)};tn.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),ne.unbind(t,"keydown",this.keyHandler),ne.unbind(t,"mousedown",Wr),ne.unbind(t,"input",this.autoResize),ne.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),or(n)),or(e)};tn.prototype.getValue=function(){return this.content.innerText.trim()};tn.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t};tn.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};function GS(e){return e.replace(/\r\n|\r|\n/g,`
`)}function qt(e,t){this._eventBus=e,this._providers=[],this._textbox=new tn({container:t.getContainer(),keyHandler:sr(this._handleKey,this),resizeHandler:sr(this._handleResize,this)})}qt.$inject=["eventBus","canvas"];qt.prototype.registerProvider=function(e){this._providers.push(e)};qt.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))};qt.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())};qt.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})};qt.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0};qt.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue(),o=e.context.text;(r!==o||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}};qt.prototype.getValue=function(){return this._textbox.getValue()};qt.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;if(t===27)return e.preventDefault(),this.cancel();if(t===13&&!e.shiftKey)return e.preventDefault(),this.complete()};qt.prototype._handleResize=function(e){this._fire("resize",e)};qt.prototype.activate=function(e){this.isActive()&&this.cancel();var t,n=Me(this._providers,function(i){return(t=i.activate(e))?i:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};const yg={__depends__:[Ll],__init__:["directEditing"],directEditing:["type",qt]};function th(e){return function(t){var n=t.target,i=z(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===ye(e);return!o||!a||!s||!c}}var zS=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throwing",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],VS=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throwing",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}}],US=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message intermediate catch event",actionName:"replace-with-message-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Message intermediate throw event",actionName:"replace-with-message-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer intermediate catch event",actionName:"replace-with-timer-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation intermediate throw event",actionName:"replace-with-escalation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional intermediate catch event",actionName:"replace-with-conditional-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Link intermediate catch event",actionName:"replace-with-link-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},{label:"Link intermediate throw event",actionName:"replace-with-link-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},{label:"Compensation intermediate throw event",actionName:"replace-with-compensation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal intermediate catch event",actionName:"replace-with-signal-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Signal intermediate throw event",actionName:"replace-with-signal-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],WS=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message end event",actionName:"replace-with-message-end",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Escalation end event",actionName:"replace-with-escalation-end",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Error end event",actionName:"replace-with-error-end",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel end event",actionName:"replace-with-cancel-end",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Compensation end event",actionName:"replace-with-compensation-end",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal end event",actionName:"replace-with-signal-end",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Terminate end event",actionName:"replace-with-terminate-end",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}],YS=[{label:"Exclusive gateway",actionName:"replace-with-exclusive-gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},{label:"Parallel gateway",actionName:"replace-with-parallel-gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},{label:"Inclusive gateway",actionName:"replace-with-inclusive-gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},{label:"Complex gateway",actionName:"replace-with-complex-gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},{label:"Event-based gateway",actionName:"replace-with-event-based-gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}}],qS=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Event sub-process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Sub-process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}}],_g=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Sub-process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Event sub-process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}}],KS=_g,nh=[{label:"Task",actionName:"replace-with-task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},{label:"User task",actionName:"replace-with-user-task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},{label:"Service task",actionName:"replace-with-service-task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},{label:"Send task",actionName:"replace-with-send-task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},{label:"Receive task",actionName:"replace-with-receive-task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},{label:"Manual task",actionName:"replace-with-manual-task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},{label:"Business rule task",actionName:"replace-with-rule-task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},{label:"Script task",actionName:"replace-with-script-task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},{label:"Call activity",actionName:"replace-with-call-activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},{label:"Sub-process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},{label:"Sub-process (expanded)",actionName:"replace-with-expanded-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}}],XS=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],ZS=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],JS=[{label:"Message boundary event",actionName:"replace-with-message-boundary",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},{label:"Timer boundary event",actionName:"replace-with-timer-boundary",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},{label:"Escalation boundary event",actionName:"replace-with-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},{label:"Conditional boundary event",actionName:"replace-with-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},{label:"Error boundary event",actionName:"replace-with-error-boundary",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},{label:"Cancel boundary event",actionName:"replace-with-cancel-boundary",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},{label:"Signal boundary event",actionName:"replace-with-signal-boundary",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},{label:"Compensation boundary event",actionName:"replace-with-compensation-boundary",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},{label:"Message boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-message-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},{label:"Timer boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},{label:"Escalation boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},{label:"Conditional boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},{label:"Signal boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}}],QS=[{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},{label:"Error start event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},{label:"Escalation start event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},{label:"Compensation start event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},{label:"Message start event (non-interrupting)",actionName:"replace-with-non-interrupting-message-start",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},{label:"Timer start event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-start",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},{label:"Conditional start event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-start",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},{label:"Signal start event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-start",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},{label:"Escalation start event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-start",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}}],e1=[{label:"Sequence flow",actionName:"replace-with-sequence-flow",className:"bpmn-icon-connection"},{label:"Default flow",actionName:"replace-with-default-flow",className:"bpmn-icon-default-flow"},{label:"Conditional flow",actionName:"replace-with-conditional-flow",className:"bpmn-icon-conditional-flow"}],t1=[{label:"Expanded pool/participant",actionName:"replace-with-expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t},actionName:"replace-with-collapsed-pool",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}}];const ih={"start-event-non-interrupting":`
<svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 995.64)">
<path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>
</g>
</svg>`,"intermediate-event-non-interrupting":`
<svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 995.64)" fill="none" stroke="currentColor" stroke-linecap="round">
<circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
<circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
</g>
</svg>`};function Nt(e,t,n,i,r,o,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=a,this._moddleCopy=s,this._register()}Nt.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"];Nt.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)};Nt.prototype.getPopupMenuEntries=function(e){var t=e.businessObject,n=this._rules,i=[];if(me(e)||!n.allowed("shape.replace",{element:e}))return{};var r=th(e);return g(t,"bpmn:DataObjectReference")?this._createEntries(e,XS):g(t,"bpmn:DataStoreReference")&&!g(e.parent,"bpmn:Collaboration")?this._createEntries(e,ZS):g(t,"bpmn:StartEvent")&&!g(t.$parent,"bpmn:SubProcess")?(i=pe(zS,r),this._createEntries(e,i)):g(t,"bpmn:Participant")?(i=pe(t1,function(o){return ye(e)!==o.target.isExpanded}),this._createEntries(e,i)):g(t,"bpmn:StartEvent")&&vt(t.$parent)?(i=pe(QS,function(o){var a=o.target,s=a.isInterrupting!==!1,c=t.isInterrupting===s;return r(o)||!r(o)&&!c}),this._createEntries(e,i)):g(t,"bpmn:StartEvent")&&!vt(t.$parent)&&g(t.$parent,"bpmn:SubProcess")?(i=pe(VS,r),this._createEntries(e,i)):g(t,"bpmn:EndEvent")?(i=pe(WS,function(o){var a=o.target;return a.eventDefinitionType=="bpmn:CancelEventDefinition"&&!g(t.$parent,"bpmn:Transaction")?!1:r(o)}),this._createEntries(e,i)):g(t,"bpmn:BoundaryEvent")?(i=pe(JS,function(o){var a=o.target;if(a.eventDefinitionType=="bpmn:CancelEventDefinition"&&!g(t.attachedToRef,"bpmn:Transaction"))return!1;var s=a.cancelActivity!==!1,c=t.cancelActivity==s;return r(o)||!r(o)&&!c}),this._createEntries(e,i)):g(t,"bpmn:IntermediateCatchEvent")||g(t,"bpmn:IntermediateThrowEvent")?(i=pe(US,r),this._createEntries(e,i)):g(t,"bpmn:Gateway")?(i=pe(YS,r),this._createEntries(e,i)):g(t,"bpmn:Transaction")?(i=pe(_g,r),this._createEntries(e,i)):vt(t)&&ye(e)?(i=pe(KS,r),this._createEntries(e,i)):g(t,"bpmn:SubProcess")&&ye(e)?(i=pe(qS,r),this._createEntries(e,i)):g(t,"bpmn:AdHocSubProcess")&&!ye(e)?(i=pe(nh,function(o){var a=o.target,s=a.type==="bpmn:SubProcess",c=a.isExpanded===!0;return th(a)&&(!s||c)}),this._createEntries(e,i)):g(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,e1):g(t,"bpmn:FlowNode")?(i=pe(nh,r),g(t,"bpmn:SubProcess")&&!ye(e)&&(i=pe(i,function(o){return o.label!=="Sub-process (collapsed)"})),this._createEntries(e,i)):{}};Nt.prototype.getPopupMenuHeaderEntries=function(e){var t={};return g(e,"bpmn:Activity")&&!vt(e)&&(t=te(te({},t),this._getLoopCharacteristicsHeaderEntries(e))),g(e,"bpmn:DataObjectReference")&&(t=te(te({},t),this._getCollectionHeaderEntries(e))),g(e,"bpmn:Participant")&&(t=te(te({},t),this._getParticipantMultiplicityHeaderEntries(e))),g(e,"bpmn:SubProcess")&&!g(e,"bpmn:Transaction")&&!vt(e)&&(t=te(te({},t),this._getAdHocHeaderEntries(e))),bv(e)&&(t=te(te({},t),this._getNonInterruptingHeaderEntries(e))),t};Nt.prototype._createEntries=function(e,t){var n={},i=this;return D(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n};Nt.prototype._createSequenceFlowEntries=function(e,t){var n=z(e),i={},r=this._modeling,o=this._moddle,a=this;return D(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(g(n.sourceRef,"bpmn:ExclusiveGateway")||g(n.sourceRef,"bpmn:InclusiveGateway")||g(n.sourceRef,"bpmn:ComplexGateway")||g(n.sourceRef,"bpmn:Activity"))&&(i=Pe(te({},i),{[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:n})})}));break;case"replace-with-conditional-flow":!n.conditionExpression&&g(n.sourceRef,"bpmn:Activity")&&(i=Pe(te({},i),{[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:c})})}));break;default:g(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i=Pe(te({},i),{[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})})),(g(n.sourceRef,"bpmn:ExclusiveGateway")||g(n.sourceRef,"bpmn:InclusiveGateway")||g(n.sourceRef,"bpmn:ComplexGateway")||g(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i=Pe(te({},i),{[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})}))}}),i};Nt.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=function(){return r(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||o,{label:i(a),className:e.className,action:n}};Nt.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}const p=e.businessObject.get("loopCharacteristics"),f=t._moddle.create(u.options.loopCharacteristics);p&&t._moddleCopy.copyElement(p,f),f.set("isSequential",u.options.isSequential),t._modeling.updateProperties(e,{loopCharacteristics:f})}var r=z(e),o=r.loopCharacteristics,a,s,c;return o&&(a=o.isSequential,s=o.isSequential===void 0,c=o.isSequential!==void 0&&!o.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}};Nt.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function r(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var o=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:o,action:r}}};Nt.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,l;c||(l=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:l})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}};Nt.prototype._getAdHocHeaderEntries=function(e){var t=this._translate,n=z(e),i=g(n,"bpmn:AdHocSubProcess"),r=this._bpmnReplace.replaceElement;return{"toggle-adhoc":{className:"bpmn-icon-ad-hoc-marker",title:t("Ad-hoc"),active:i,action:function(o,a){return i?r(e,{type:"bpmn:SubProcess"},{autoResize:!1,layoutConnection:!1}):r(e,{type:"bpmn:AdHocSubProcess"},{autoResize:!1,layoutConnection:!1})}}}};Nt.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=z(e),i=this,r=Ev(e),o=g(e,"bpmn:BoundaryEvent")?ih["intermediate-event-non-interrupting"]:ih["start-event-non-interrupting"],a=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[r]:!!a})}}}};const n1={__depends__:[eu,Zv,iu],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Nt]};function br(e,t,n,i,r,o,a,s,c,l,u,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=l,this._rules=u,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var h=d.context,m=h.shape;if(!(!Xr(d)||!i.isOpen(m))){var v=i.getEntries(m);v.replace&&v.replace.action.click(d,m)}})}br.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"];br.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&N(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n};br.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return me(t)?ao(t,function(n){return i1(t,n)}):t};br.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._rules,c=this._autoPlace,l=this._translate,u=this._appendPreview,p={};if(e.type==="label")return p;var f=e.businessObject;function d(x,P){r.start(x,P)}function h(x,P){n.removeElements([P])}function m(x){var P=5,A=t.getPad(x).html,C=A.getBoundingClientRect(),I={x:C.left,y:C.bottom+P};return I}function v(x,P,A,C){function I(B,K){var Z=i.createShape(N({type:x},C));o.start(B,Z,{source:K}),u.cleanUp()}var T=c?function(B,K){var Z=i.createShape(N({type:x},C));c.append(K,Z),u.cleanUp()}:I,k=c?function(B,K){return u.create(K,x,C),()=>{u.cleanUp()}}:null;return{group:"model",className:P,title:A,action:{dragstart:I,click:T,hover:k}}}function E(x){return function(P,A){n.splitLane(A,x),t.open(A,!0)}}if(ce(f,["bpmn:Lane","bpmn:Participant"])&&ye(e)){var w=ri(e);N(p,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:l("Add lane above"),action:{click:function(x,P){n.addLane(P,"top")}}}}),w.length<2&&((gt(e)?e.height>=120:e.width>=120)&&N(p,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:l("Divide into two lanes"),action:{click:E(2)}}}),(gt(e)?e.height>=180:e.width>=180)&&N(p,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:l("Divide into three lanes"),action:{click:E(3)}}})),N(p,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:l("Add lane below"),action:{click:function(x,P){n.addLane(P,"bottom")}}}})}g(f,"bpmn:FlowNode")&&(g(f,"bpmn:EventBasedGateway")?N(p,{"append.receive-task":v("bpmn:ReceiveTask","bpmn-icon-receive-task",l("Append receive task")),"append.message-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",l("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",l("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",l("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",l("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):rh(f,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?N(p,{"append.compensation-activity":v("bpmn:Task","bpmn-icon-task",l("Append compensation activity"),{isForCompensation:!0})}):!g(f,"bpmn:EndEvent")&&!f.isForCompensation&&!rh(f,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!vt(f)&&N(p,{"append.end-event":v("bpmn:EndEvent","bpmn-icon-end-event-none",l("Append end event")),"append.gateway":v("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",l("Append gateway")),"append.append-task":v("bpmn:Task","bpmn-icon-task",l("Append task")),"append.intermediate-event":v("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",l("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||N(p,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:l("Change element"),action:{click:function(x,P){var A=N(m(P),{cursor:{x:x.x,y:x.y}});a.open(P,"bpmn-replace",A,{title:l("Change element"),width:300,search:!0})}}}}),g(f,"bpmn:SequenceFlow")&&N(p,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation"))}),ce(f,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&N(p,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect to other element"),action:{click:d,dragstart:d}}}),g(f,"bpmn:TextAnnotation")&&N(p,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using association"),action:{click:d,dragstart:d}}}),ce(f,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&N(p,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using data input association"),action:{click:d,dragstart:d}}}),g(f,"bpmn:Group")&&N(p,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation"))});var _=s.allowed("elements.delete",{elements:[e]});return me(_)&&(_=_[0]===e),_&&N(p,{delete:{group:"edit",className:"bpmn-icon-trash",title:l("Delete"),action:{click:h}}}),p};function rh(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return D(o,function(a){a.$type===n&&(r=!0)}),i&&r}function i1(e,t){return e.indexOf(t)!==-1}const r1={__depends__:[FS,yg,bm,An,cu,Ps,n1],__init__:["contextPadProvider"],contextPadProvider:["type",br]};var o1={horizontal:["x","width"],vertical:["y","height"]},oh=5;function On(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return me(i)?i:i?n:[]})}On.$inject=["modeling","rules"];On.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)};On.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i};On.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(D(t,function(o){r=o(r,n,i)}),r):e};On.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=hn(e,i);return D(o,function(a,s){var c=n._findRange(a,i,r),l,u=t[t.length-1];u&&n._hasIntersection(u.range,c)?t[t.length-1].elements.push(a):(l={range:c,elements:[a]},t.push(l))}),t};On.prototype._setOrientation=function(e){var t=o1[e];this._axis=t[0],this._dimension=t[1]};On.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)};On.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+oh,max:t+n-oh}};const a1={__init__:["distributeElements"],distributeElements:["type",On]};function Hs(e){Ut.call(this,e)}Hs.$inject=["eventBus"];q(Hs,Ut);Hs.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=pe(t,function(n){var i=ce(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=ts(t),t.length<3?!1:t})};var ah={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
<polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
<rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
<rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
</svg>`,vertical:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
<polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
<rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
<rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
</svg>`},s1=900;function Ro(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",s1,this)}Ro.$inject=["popupMenu","distributeElements","translate","rules"];Ro.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&N(t,this._getEntries(e)),t};Ro.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})};Ro.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:ah.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:ah.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const c1={__depends__:[eu,a1],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Hs],distributeElementsMenuProvider:["type",Ro]};var bg="is not a registered action",l1="is already registered";function Kt(e,t){this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Kt.$inject=["eventBus","injector"];Kt.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var u=i.get();if(u.length)return o.copy(u)}),o&&this.register("paste",function(){o.paste()}),r&&this.register("stepZoom",function(u){r.stepZoom(u.value)}),a&&this.register("zoom",function(u){a.zoom(u.value)}),n&&i&&s&&this.register("removeSelection",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u}),f;p!==!1&&(me(p)?f=p:f=u,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})};Kt.prototype.trigger=function(e,t){if(!this._actions[e])throw fp(e,bg);return this._actions[e](t)};Kt.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);D(e,function(i,r){n._registerAction(r,i)})};Kt.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw fp(e,l1);this._actions[e]=t};Kt.prototype.unregister=function(e){if(!this.isRegistered(e))throw fp(e,bg);this._actions[e]=void 0};Kt.prototype.getActions=function(){return Object.keys(this._actions)};Kt.prototype.isRegistered=function(e){return!!this._actions[e]};function fp(e,t){return new Error(e+" "+t)}const u1={__init__:["editorActions"],editorActions:["type",Kt]};function Gs(e){e.invoke(Kt,this)}q(Gs,Kt);Gs.$inject=["injector"];Gs.prototype._registerDefaultActions=function(e){Kt.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),l=e.get("alignElements",!1),u=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var h=t.getRootElement(),m=n.filter(function(v){return v!==h});return i.select(m),m}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(h){var m=i.get(),v=h.type;m.length&&c.trigger(m,v)}),i&&l&&this._registerAction("alignElements",function(h){var m=i.get(),v=[],E=h.type;m.length&&(v=pe(m,function(w){return!g(w,"bpmn:Lane")}),l.trigger(v,E))}),i&&f&&this._registerAction("setColor",function(h){var m=i.get();m.length&&f.setColor(m,h)}),i&&u&&this._registerAction("directEditing",function(){var h=i.get();h.length&&u.activate(h[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var h=t.getRootElement(),m,v;g(h,"bpmn:Collaboration")?v=n.filter(function(E){return g(E.parent,"bpmn:Collaboration")}):v=n.filter(function(E){return E!==h&&!g(E.parent,"bpmn:SubProcess")}),m=Mt(v),f.moveElements(v,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const p1={__depends__:[u1],editorActions:["type",Gs]};function Eg(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;ce(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}Eg.$inject=["eventBus"];var $a=10;function kc(e,t,n){return n||(n="round"),Math[n](e/t)*t}var f1=1200,d1=800;function ui(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",d1,function(){r.setActive(i)}),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],f1,function(o){var a=o.originalEvent;if(!(!r.active||a&&kt(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=m1(o,l,e);p&&(u.offset=p);var f=h1(o,l);f&&N(u,f),ur(o,l)||r.snapEvent(o,l,u)})}})}ui.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);He(e,t,i)};ui.prototype.getGridSpacing=function(){return $a};ui.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=kc(e,$a);var i,r;return t&&t.min&&(i=t.min,ue(i)&&(i=kc(i+n,$a,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,ue(r)&&(r=kc(r+n,$a,"floor"),e=Math.min(e,r))),e-=n,e};ui.prototype.isActive=function(){return this.active};ui.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})};ui.prototype.toggleActive=function(){this.setActive(!this.active)};ui.$inject=["elementRegistry","eventBus","config.gridSnapping"];function h1(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(Fa(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,l=r.max;return c&&(Fa(t)?ch(s)?a.x.max=c.left:a.x.min=c.right:sh(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(Fa(t)?ch(s)?a.x.min=l.left:a.x.max=l.right:sh(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function m1(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&ue(s[t])||(s||(s=o.snapOffset={}),ue(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Fa(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2)),s[t]}function Fa(e){return e==="x"}function sh(e){return e.indexOf("n")!==-1}function ch(e){return e.indexOf("w")!==-1}function Fi(e,t){H.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},a=o.autoResize;if(a){var s=r.shape,c=r.newBounds;ns(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Fi.$inject=["eventBus","gridSnapping","modeling"];q(Fi,H);Fi.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t};Fi.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e};Fi.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),N(e,o),e};Fi.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),N(e,o),e};var v1=2e3;function xg(e,t){e.on(["spaceTool.move","spaceTool.end"],v1,function(n){var i=n.context;if(i.initialized){var r=i.axis,o;r==="x"?(o=t.snapValue(n.dx),n.x=n.x+o-n.dx,n.dx=o):(o=t.snapValue(n.dy),n.y=n.y+o-n.dy,n.dy=o)}})}xg.$inject=["eventBus","gridSnapping"];const g1={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Fi],gridSnappingSpaceToolBehavior:["type",xg]},y1={__depends__:[g1],__init__:["gridSnapping"],gridSnapping:["type",ui]};var _1=2e3;function wg(e,t){e.on("autoPlace",_1,function(n){var i=n.source,r=re(i),o=n.shape,a=Hm(i,o);return["x","y"].forEach(function(s){var c={};a[s]!==r[s]&&(a[s]>r[s]?c.min=a[s]:c.max=a[s],g(o,"bpmn:TextAnnotation")&&(b1(s)?c.offset=-o.width/2:c.offset=-o.height/2),a[s]=t.snapValue(a[s],c))}),a})}wg.$inject=["eventBus","gridSnapping"];function b1(e){return e==="x"}var E1=1750;function Sg(e,t,n){t.on(["create.start","shape.move.start"],E1,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!g(o,"bpmn:Participant")||!g(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}Sg.$inject=["canvas","eventBus","gridSnapping"];var x1=3e3;function zs(e,t,n){H.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],x1,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||w1(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}zs.$inject=["eventBus","gridSnapping","modeling"];q(zs,H);zs.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=T1(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function w1(e){return e.length>3}function S1(e){return e==="h"}function C1(e){return e==="v"}function T1(e,t,n){var i=Sn(t,n),r={};return S1(i)&&(r.y=e.snapValue(t.y)),C1(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=N({},t,r),n=N({},n,r)),[t,n]}const P1={__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",wg],gridSnappingParticipantBehavior:["type",Sg],gridSnappingLayoutConnectionBehavior:["type",zs]},R1={__depends__:[y1,P1],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Eg]};var A1=30,Cg=30;function Ao(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(g(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(g(r,"bpmn:Participant"))return ye(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(g(r,"bpmn:SubProcess"))return ye(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Ao.$inject=["eventBus","interactionEvents"];Ao.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0};Ao.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=gt(e)?{width:A1,height:e.height}:{width:e.width,height:Cg};return this._interactionEvents.createBoxHit(t,"all",n),!0};Ao.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:Cg}),!0};const I1={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ao]};function Vs(e){e.invoke(mr,this)}q(Vs,mr);Vs.$inject=["injector"];Vs.prototype.registerBindings=function(e,t){mr.prototype.registerBindings.call(this,e,t);function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("selectElements",function(i){var r=i.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0}),n("find",function(i){var r=i.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0}),n("spaceTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["s","S"],r))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["l","L"],r))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["h","H"],r))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["c","C"],r))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["e","E"],r))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["r","R"],r))return t.trigger("replaceElement",r),!0})};const M1={__depends__:[ql],__init__:["keyboardBindings"],keyboardBindings:["type",Vs]};var D1={moveSpeed:1,moveSpeedAccelerated:10},k1=1500,lh="left",uh="up",ph="right",fh="down",O1={ArrowLeft:lh,Left:lh,ArrowUp:uh,Up:uh,ArrowRight:ph,Right:ph,ArrowDown:fh,Down:fh},N1={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function Tg(e,t,n,i,r){var o=this;this._config=N({},D1,e||{}),t.addListener(k1,function(a){var s=a.keyEvent,c=O1[s.key];if(c&&!t.isCmd(s)){var l=t.isShift(s);return o.moveSelection(c,l),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var l=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=N1[a](l),p=i.allowed("elements.move",{shapes:c});p&&n.moveElements(c,u)}}}Tg.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const L1={__depends__:[ql,An],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Tg]};var dh=10;function Io(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,l){var u=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=l,d=wx(u,p,l),c.newBounds=Cx(d,f),c.canExecute=r.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=r.computeMinResizeBox(c)),c.resizeConstraints={min:Q(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=rm(p),!B1(l,p))return;n.resizeShape(l,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var l={x:c.dx,y:c.dy};o(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}Io.prototype.canResize=function(e){var t=this._rules,n=mn(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)};Io.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=N({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,Pg(t,o),"resize",{autoActivate:!0,cursor:$1(o),data:{shape:t,context:r}})};Io.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:dh,height:dh},r=pv(t,e.childrenBoxPadding),Tx(n,t,i,r)};Io.$inject=["eventBus","rules","modeling","dragging"];function B1(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Pg(e,t){var n=re(e),i=Q(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function $1(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var hh="djs-resizing",mh="resize-not-ok",F1=500;function Rg(e,t,n){function i(o){var a=o.shape,s=o.newBounds,c=o.frame;c||(c=o.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,hh)),s.width>5&&ae(c,{x:s.x,width:s.width}),s.height>5&&ae(c,{y:s.y,height:s.height}),o.canExecute?Re(c).remove(mh):Re(c).add(mh)}function r(o){var a=o.shape,s=o.frame;s&&ut(o.frame),t.removeMarker(a,hh)}e.on("resize.move",F1,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Rg.$inject=["eventBus","canvas","previewSupport"];var xa=-6,wa=8,Sa=20,Hr="djs-resizer",j1=["n","w","s","e","nw","ne","se","sw"];function pi(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&D(a,sr(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}pi.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){jl(o)&&i.activate(o,e,n)}ne.bind(t,"mousedown",r),ne.bind(t,"touchstart",r)};pi.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=H1(i),a=ve("g");Re(a).add(Hr),Re(a).add(Hr+"-"+e.id),Re(a).add(Hr+"-"+i),ge(r,a);var s=ve("rect");ae(s,{x:-wa/2+o.x,y:-wa/2+o.y,width:wa,height:wa}),Re(s).add(Hr+"-visual"),ge(a,s);var c=ve("rect");return ae(c,{x:-Sa/2+o.x,y:-Sa/2+o.y,width:Sa,height:Sa}),Re(c).add(Hr+"-hit"),ge(a,c),$_(a,t,n),a};pi.prototype.createResizer=function(e,t){var n=Pg(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)};pi.prototype.addResizer=function(e){var t=this;Ce(e)||!this._resize.canResize({shape:e})||D(j1,function(n){t.createResizer(e,n)})};pi.prototype.removeResizers=function(){var e=this._getResizersParent();rs(e)};pi.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")};pi.$inject=["eventBus","canvas","selection","resize"];function H1(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-xa:e.indexOf("w")!==-1&&(t.x=xa),e.indexOf("s")!==-1?t.y=-xa:e.indexOf("n")!==-1&&(t.y=xa),t}const Ag={__depends__:[yn,Mn,_r],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Io],resizePreview:["type",Rg],resizeHandles:["type",pi]};var G1=2e3;function Mo(e,t,n,i,r,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],G1,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var l=c.context,u=l.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||ce(c,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||dp(c))&&i.activate(c)}}Mo.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"];Mo.prototype.activate=function(e){var t=Jn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);N(n,i);var r={},o=n.style||{};return N(o,{backgroundColor:null,border:null}),(ce(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||dp(e))&&N(r,{centerVertically:!0}),ar(e)&&(N(r,{autoResize:!0}),N(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),g(e,"bpmn:TextAnnotation")&&(N(r,{resizable:!0,autoResize:!0}),N(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),N(n,{options:r,style:o}),n}};Mo.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),l=c.fontSize*a,u=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(g(e,"bpmn:Lane")||U1(e)){var h=gt(e),m=h?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};N(o,m),N(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(V1(e)){var v=gt(e),E=v?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};N(o,E),N(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:v?null:"rotate(-90deg)"})}(ce(e,["bpmn:Task","bpmn:CallActivity"])||dp(e))&&(N(o,{width:i.width,height:i.height}),N(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),z1(e)&&(N(o,{width:i.width,x:i.x}),N(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var w=90*a,_=7*a,x=4*a;if(n.labelTarget&&(N(o,{width:w,height:i.height+_+x,x:r.x-w/2,y:i.y-_}),N(d,{fontSize:l+"px",lineHeight:u,paddingTop:_+"px",paddingBottom:x+"px"})),ar(n)&&!os(n)&&!be(n)){var P=am(e),A=t.getAbsoluteBBox({x:P.x,y:P.y,width:0,height:0}),C=l+_+x;N(o,{width:w,height:C,x:A.x-w/2,y:A.y-C/2}),N(d,{fontSize:l+"px",lineHeight:u,paddingTop:_+"px",paddingBottom:x+"px"})}return g(e,"bpmn:TextAnnotation")&&(N(o,{width:i.width,height:i.height,minWidth:30*a,minHeight:10*a}),N(d,{textAlign:"left",paddingTop:5*a+"px",paddingBottom:7*a+"px",paddingLeft:7*a+"px",paddingRight:5*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}};Mo.prototype.update=function(e,t,n,i){var r,o;g(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),W1(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function dp(e){return g(e,"bpmn:SubProcess")&&!ye(e)}function z1(e){return g(e,"bpmn:SubProcess")&&ye(e)}function V1(e){return g(e,"bpmn:Participant")&&!ye(e)}function U1(e){return g(e,"bpmn:Participant")&&ye(e)}function W1(e){return!e||!e.trim()}var vh="djs-element-hidden",gh="djs-label-hidden";function Ig(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(o=l.element.label||l.element,g(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=ve("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=ve("path");ae(p,{d:u,strokeWidth:2,stroke:Y1(o)}),ge(s,p),ge(r,s),mt(s,o.x,o.y)}g(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,vh):(g(o,"bpmn:Task")||g(o,"bpmn:CallActivity")||g(o,"bpmn:SubProcess")||g(o,"bpmn:Participant"))&&t.addMarker(o,gh)}),e.on("directEditing.resize",function(c){if(g(o,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(o.height/a.height*(l+u),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});ae(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,vh),t.removeMarker(o,gh)),o=void 0,a=void 0,s&&(ut(s),s=void 0)})}Ig.$inject=["eventBus","canvas","pathMap"];function Y1(e,t){var n=we(e);return n.get("stroke")||t||"black"}const q1={__depends__:[sm,Ag,yg],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Mo],labelEditingPreview:["type",Ig]};var K1=new nm("tt");function X1(e){var t=et('<div class="djs-tooltip-container" />');return ss(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function Z1(e,t,n){ss(e,{left:t+"px",top:n+"px"})}function hp(e,t){e.style.display=t===!1?"none":""}var Mg="djs-tooltip",Oc="."+Mg;function Et(e,t){this._eventBus=e,this._canvas=t,this._ids=K1,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=X1(t.getContainer());var n=this;Qt.bind(this._tooltipRoot,Oc,"mousedown",function(i){i.stopPropagation()}),Qt.bind(this._tooltipRoot,Oc,"mouseover",function(i){n.trigger("mouseover",i)}),Qt.bind(this._tooltipRoot,Oc,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Et.$inject=["eventBus","canvas"];Et.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=N({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t};Et.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(lt(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))};Et.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]};Et.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}};Et.prototype.setTimeout=function(e){if(e=this.get(e),!!e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}};Et.prototype.remove=function(e){var t=this.get(e);t&&(or(t.html),or(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])};Et.prototype.show=function(){hp(this._tooltipRoot)};Et.prototype.hide=function(){hp(this._tooltipRoot,!1)};Et.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i};Et.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),ns(n)&&(n=et(n)),i=et('<div data-tooltip-id="'+t+'" class="'+Mg+'">'),ss(i,{position:"absolute"}),i.appendChild(n),e.type&&Le(i).add("djs-tooltip-"+e.type),e.className&&Le(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)};Et.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;Z1(n,t.x,t.y)};Et.prototype._updateTooltipVisibilty=function(e){D(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),hp(i,r))})};Et.prototype._init=function(){var e=this;function t(n){e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}this._eventBus.on("canvas.viewbox.changing",function(n){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(n){t(n.viewbox)})};const J1={__init__:["tooltips"],tooltips:["type",Et]};var Q1="flow elements must be children of pools/participants";function Dg(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;g(s,"bpmn:Collaboration")&&g(a,"bpmn:FlowNode")&&i(r,n(Q1))})}Dg.$inject=["eventBus","tooltips","translate"];const eC={__depends__:[J1],__init__:["modelingFeedback"],modelingFeedback:["type",Dg]};var tC=500,nC=1250,iC=1500,Xa=Math.round;function rC(e){return{x:e.x+Xa(e.width/2),y:e.y+Xa(e.height/2)}}function kg(e,t,n,i,r){function o(s,c,l,u){return r.allowed("elements.move",{shapes:s,delta:c,position:l,target:u})}e.on("shape.move.start",iC,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=oC(u),N(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",nC,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=o(l),!u)return!1}),e.on("shape.move.move",tC,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(l,p,f,u),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,l=c.delta,u=c.canExecute,p=u==="attach",f=c.shapes;if(u===!1)return!1;l.x=Xa(l.x),l.y=Xa(l.y),!(l.x===0&&l.y===0)&&n.moveElements(f,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(jl(s)){var c=Jh(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(vn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!Re(s.target).has("djs-hit-no-move")){var p=rC(c);return t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}}),!0}}this.start=a}kg.$inject=["eventBus","dragging","modeling","selection","rules"];function oC(e){var t=is(e,"id");return pe(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var yh=499,Nc="djs-dragging",_h="drop-ok",bh="drop-not-ok",Eh="new-parent",xh="attach-ok";function Og(e,t,n,i){function r(c){var l=o(c),u=aC(l);return u}function o(c){var l=so(c,!0),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[xh,_h,bh,Eh].forEach(function(u){u===l?t.addMarker(c,u):t.removeMarker(c,u)})}function s(c,l,u){i.addDragger(l,c.dragGroup),u&&t.addMarker(l,Nc),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",yh,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,f=r(u);if(!l.dragGroup){var d=ve("g");ae(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();ge(h,d),l.dragGroup=d}f.forEach(function(m){i.addDragger(m,l.dragGroup)}),p?p=Bl([p,o(u)]):p=o(u),D(p,function(m){t.addMarker(m,Nc)}),l.allDraggedElements=p,l.differentParents=sC(u)}),e.on("shape.move.move",yh,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,xh):l.canExecute&&f&&p.id!==f.id?a(p,Eh):a(p,l.canExecute?_h:bh)),mt(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var l=c.context,u=l.target;u&&a(u,null)}),e.on("shape.move.cleanup",function(c){var l=c.context,u=l.allDraggedElements,p=l.dragGroup;D(u,function(f){t.removeMarker(f,Nc)}),p&&ut(p)}),this.makeDraggable=s}Og.$inject=["eventBus","canvas","styles","previewSupport"];function aC(e){var t=pe(e,function(n){return Ce(n)?Me(e,Cn({id:n.source.id}))&&Me(e,Cn({id:n.target.id})):!0});return t}function sC(e){return F_(is(e,function(t){return t.parent&&t.parent.id}))!==1}const cC={__depends__:[Ll,An,j_,yn,Mn,_r],__init__:["move","movePreview"],move:["type",kg],movePreview:["type",Og]};var Ng=".djs-palette-toggle",Lg=".entry",lC=Ng+", "+Lg,El="djs-palette-",uC="shown",xl="open",wh="two-column",pC=1e3;function Ge(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var r=i.tool;n.updateToolHighlight(r)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}Ge.$inject=["eventBus","canvas"];Ge.prototype.registerProvider=function(e,t){t||(t=e,e=pC),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()};Ge.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(dC,{})};Ge.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}};Ge.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=et(Ge.HTML_MARKUP);n.appendChild(i),Le(n).add(El+uC),Qt.bind(i,lC,"click",function(r){var o=r.delegateTarget;if(es(o,Ng))return e.toggle();e.trigger("click",r)}),ne.bind(i,"mousedown",function(r){r.stopPropagation()}),Qt.bind(i,Lg,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})};Ge.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers};Ge.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=Le(n),a=Le(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(wh,r),a.toggle(El+wh,r),"open"in e&&(o.toggle(xl,e.open),a.toggle(El+xl,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})};Ge.prototype._update=function(){var e=De(".djs-palette-entries",this._container),t=this._entries=this.getEntries();cm(e),D(t,function(n,i){var r=n.group||"default",o=De("[data-group="+Oi(r)+"]",e);o||(o=et('<div class="group"></div>'),lt(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=et(a);if(o.appendChild(s),!n.separator&&(lt(s,"data-action",i),n.title&&lt(s,"title",n.title),n.className&&fC(s,n.className),n.imageUrl)){var c=et("<img>");lt(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()};Ge.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=lt(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()};Ge.prototype.triggerEntry=function(e,t,n,i){var r=this._entries,o,a;if(o=r[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(zt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}};Ge.prototype._layoutChanged=function(){this._toggleState({})};Ge.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n};Ge.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})};Ge.prototype.open=function(){this._toggleState({open:!0})};Ge.prototype.toggle=function(){this.isOpen()?this.close():this.open()};Ge.prototype.isActiveTool=function(e){return e&&this._activeTool===e};Ge.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=De(".djs-palette-entries",this._container),this._toolsContainer=De("[data-group=tools]",t)),n=this._toolsContainer,D(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=Le(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})};Ge.prototype.isOpen=function(){return Le(this._container).has(xl)};Ge.prototype._getParentContainer=function(){return this._canvas.getContainer()};Ge.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function fC(e,t){var n=Le(e),i=me(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function dC(e,t){var n=t.getPaletteEntries();return zt(n)?n(e):(D(n,function(i,r){e[r]=i}),e)}const hC={__init__:["palette"],palette:["type",Ge]};var Bg="crosshair";function ji(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(l){var u=t.getActiveLayer(),p;p=l.frame=ve("rect"),ae(p,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ge(u,p)},update:function(l){var u=l.frame,p=l.bbox;ae(u,{x:p.x,y:p.y,width:p.width,height:p.height})},remove:function(l){l.frame&&ut(l.frame)}};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(l){var u=l.originalEvent.target;!l.hover&&!(u instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(l.originalEvent,!0)})}),e.on("lasso.end",0,function(l){var u=l.context,p=Lc(l),f=i.filter(function(h){return h}),d=qc(l);s.select(f,p,d?u.selection:[])}),e.on("lasso.start",function(l){var u=l.context;u.bbox=Lc(l),c.create(u),u.selection=r.get()}),e.on("lasso.move",function(l){var u=l.context;u.bbox=Lc(l),c.update(u)}),e.on("lasso.cleanup",function(l){var u=l.context;c.remove(u)}),e.on("element.mousedown",1500,function(l){if(qc(l))return s.activateLasso(l.originalEvent),!0})}ji.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"];ji.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Bg,data:{context:{}}})};ji.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Bg,data:{context:{}},keepSelection:!0})};ji.prototype.select=function(e,t,n=[]){var i=H_(e,t);this._selection.select([...n,...$l(i)])};ji.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)};ji.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Lc(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y},i;return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?i={x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?i={x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?i={x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?i={x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:i={x:n.x,y:n.y,width:0,height:0},i}const mC={__depends__:[Rs,vo],__init__:["lassoTool"],lassoTool:["type",ji]};var Bc=1500,$g="grab";function Er(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var a=this,s=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Bc,function(c){if(Xr(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Bc,function(c){if(!(!Sh(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(Bc,function(c){!Sh(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var l=c.originalEvent.target;if(!c.hover&&!(l instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var l=t.viewbox().scale;t.scroll({dx:c.dx*l,dy:c.dy*l})}),e.on("hand.move.end",function(c){var l=c.context,u=l.reactivate;return!Xr(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Er.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"];Er.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:$g,data:{context:n||{}}})};Er.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:$g,data:{context:{reactivate:n}}})};Er.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)};Er.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Sh(e){return Xe("Space",e)}const vC={__depends__:[Rs,vo],__init__:["handTool"],handTool:["type",Er]};var Ch="connect-ok",Th="connect-not-ok";function xr(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var l=c.context,u=c.hover,p=l.canStartConnect=s.canStartConnect(u);p!==null&&(l.startTarget=u,i.addMarker(u,p?Ch:Th))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?Ch:Th)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(u);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,p)}),!1})}xr.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"];xr.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})};xr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)};xr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)};xr.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const gC={__depends__:[cu,yn,Mn,Rs,vo],globalConnect:["type",xr]};function Us(e,t,n,i,r,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}Us.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"];Us.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,h,m){function v(E){var w=n.createShape(N({type:p},m));t.start(E,w)}return{group:f,className:d,title:h,action:{dragstart:v,click:v}}}function l(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function u(p){t.start(p,n.createParticipantShape())}return N(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){o.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){r.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:l,click:l}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:u,click:u}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const yC={__depends__:[hC,Ps,eg,mC,vC,gC,lm],__init__:["paletteProvider"],paletteProvider:["type",Us]};var _C=250;function mp(e,t,n,i,r){H.call(this,e);function o(s){var c=s.canExecute.replacements;D(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);N(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=De('[data-element-id="'+Oi(f.id)+'"]',s.dragGroup);h&&ae(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[u]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;D(c,function(l,u){var p=De('[data-element-id="'+Oi(u)+'"]',s.dragGroup);p&&ae(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",_C,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?o(c):a(c)})}mp.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"];q(mp,H);const bC={__depends__:[_r],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",mp]};var EC=1250,$c=40,xC=20,wC=10,Ph=20,Fg=["x","y"],SC=Math.abs;function jg(e){e.on(["connect.hover","connect.move","connect.end"],EC,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&kt(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&CC(t,o,AC(o)),o&&RC(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Gt(r),ce(o,["bpmn:Event","bpmn:Gateway"])&&Rh(t,Gt(o)),ce(o,["bpmn:Task","bpmn:SubProcess"])&&TC(t,o),g(a,"bpmn:BoundaryEvent")&&s===a.host&&PC(t)):Hg(i,"bpmn:MessageFlow")?(g(r,"bpmn:Event")&&(n.connectionStart=Gt(r)),g(o,"bpmn:Event")&&Rh(t,Gt(o))):n.connectionStart=n.initialConnectionStart)})}jg.$inject=["eventBus"];function CC(e,t,n){Fg.forEach(function(i){var r=Gg(i,t);e[i]<t[i]+n?He(e,i,t[i]+n):e[i]>t[i]+r-n&&He(e,i,t[i]+r-n)})}function TC(e,t){var n=Gt(t);Fg.forEach(function(i){IC(e,t,i)&&He(e,i,n[i])})}function PC(e){var t=e.context,n=t.source,i=t.target;if(!MC(t)){var r=Gt(n),o=ft(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(s){var c=e[s],l;SC(c-r[s])<$c&&(c>r[s]?l=r[s]+$c:l=r[s]-$c,He(e,s,l))})}}function Rh(e,t){He(e,"x",t.x),He(e,"y",t.y)}function Hg(e,t){return e&&e.type===t}function RC(e,t){return Li(t,function(n){return Hg(e,n)})}function Gg(e,t){return e==="x"?t.width:t.height}function AC(e){return g(e,"bpmn:Task")?wC:xC}function IC(e,t,n){return e[n]>t[n]+Ph&&e[n]<t[n]+Gg(n,t)-Ph}function MC(e){var t=e.hover,n=e.source;return t&&n&&t===n}function fi(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}fi.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]};fi.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)};fi.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)};fi.prototype.getSnapLocations=function(){return this._snapLocations};fi.prototype.setSnapLocations=function(e){this._snapLocations=e};fi.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Ws,n.initDefaults(this._defaultSnaps)),n};function Ws(){this._snapValues={}}Ws.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)};Ws.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&qE(e[n],r[n],i)};Ws.prototype.initDefaults=function(e){var t=this;D(e||{},function(n,i){D(n,function(r){t.add(i,r)})})};var DC=1250;function _n(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],DC,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&kt(r.originalEvent))&&!(ur(r)||!c)){var l=s.pointsForTarget(c);l.initialized||(l=i.addSnapTargetPoints(l,a,c),l.initialized=!0),n.snap(r,l)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}_n.$inject=["elementRegistry","eventBus","snapping"];_n.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new fi);var o;t.get(i.id)?o=Gt(i,e):o={x:e.x+Gt(i).x,y:e.y+Gt(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),be(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r};_n.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return D(i,function(r){if(be(r)){be(t)&&e.add("mid",Gt(r));return}if(Ce(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);D(o,function(a){e.add("mid",a)});return}e.add("mid",Gt(r))}),!ue(t.x)||!ue(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Gt(t)),e};_n.prototype.getSnapTargets=function(e,t){return iv(t).filter(function(n){return!kC(n)})};function kC(e){return!!e.hidden}var Ah=1500;function wr(e,t){t.invoke(_n,this),e.on(["create.move","create.end"],Ah,BC),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Ah,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!ur(n)&&OC(n,o)})}q(wr,_n);wr.$inject=["eventBus","injector"];wr.prototype.initSnap=function(e){var t=_n.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return D(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Mh(o,i,e))}),D(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Mh(o,i,e))}),g(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t};wr.prototype.addSnapTargetPoints=function(e,t,n){_n.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);D(i,function(o){(LC(o)||NC([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",tv(o)),e.add("bottom-right",nv(o)))});var r=this._elementRegistry;return D(t.incoming,function(o){if(r.get(t.id)){Ih(i,o.source)||e.add("mid",re(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),D(t.outgoing,function(o){if(r.get(t.id)){Ih(i,o.target)||e.add("mid",re(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),g(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e};wr.prototype.getSnapTargets=function(e,t){return _n.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!g(n,"bpmn:Lane")})};function OC(e,t){var n=Q(t),i=Av(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=re(o),/top/.test(i)?He(e,"y",n.top-a.y):/bottom/.test(i)&&He(e,"y",n.bottom-a.y),/left/.test(i)?He(e,"x",n.left-a.x):/right/.test(i)&&He(e,"x",n.right-a.x)}function NC(e,t){return e.every(function(n){return g(n,t)})}function LC(e){return g(e,"bpmn:SubProcess")&&ye(e)?!0:g(e,"bpmn:Participant")}function BC(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,r=n.right,o=n.bottom,a=n.left;(a&&a>=e.x||r&&r<=e.x)&&He(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&He(e,"y",e.y)}}function Ih(e,t){return e.indexOf(t)!==-1}function Mh(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var $C=1250;function Do(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],$C,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&kt(i.originalEvent))&&!ur(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,o,a,s),l.initialized=!0),HC(s)&&He(i,"x",i.x),GC(s)&&He(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}Do.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new fi);var o=zg(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r};Do.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return D(r,function(o){e.add("corner",nv(o)),e.add("corner",tv(o))}),e.add("corner",zg(t,i)),e};Do.$inject=["eventBus","snapping"];Do.prototype.getSnapTargets=function(e,t){return iv(t).filter(function(n){return!FC(n,e)&&!Ce(n)&&!jC(n)&&!be(n)})};function zg(e,t){var n=re(e),i=Q(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function FC(e,t){return e.host===t}function jC(e){return!!e.hidden}function HC(e){return e==="n"||e==="s"}function GC(e){return e==="e"||e==="w"}var zC=7,VC=1e3;function di(e){this._canvas=e,this._asyncHide=G_(sr(this.hide,this),VC)}di.$inject=["canvas"];di.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:ur(e,"x"),y:ur(e,"y")};D(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(D(["x","y"],function(l){var u;o[l]||(u=t.snap(c,a,l,zC),u!==void 0&&(o[l]={value:u,originValue:u-s[l]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),D(["x","y"],function(a){var s=o[a];vn(s)&&He(e,a,s.originValue)})};di.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=ve("path");return ae(n,{d:"M0,0 L0,0"}),Re(n).add("djs-snap-line"),ge(t,n),{update:function(i){ue(i)?e==="horizontal"?ae(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):ae(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):ae(n,{display:"none"})}}};di.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}};di.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()};di.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]};di.prototype.hide=function(){D(this._snapLines,function(e){e.update()})};const UC={__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",_n],resizeSnapping:["type",Do],snapping:["type",di]},WC={__depends__:[UC],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",jg],createMoveSnapping:["type",wr]};function ee(e,t,n,i,r){this._open=!1,this._results=[],this._eventMaps=[],this._canvas=e,this._eventBus=t,this._overlays=n,this._selection=i,this._translate=r,this._container=this._getBoxHtml(),this._searchInput=De(ee.INPUT_SELECTOR,this._container),this._resultsContainer=De(ee.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}ee.$inject=["canvas","eventBus","overlays","selection","translate"];ee.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Qt.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close()}),t(this._container,ee.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,ee.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,ee.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,ee.INPUT_SELECTOR,"keydown",function(n){Xe("ArrowUp",n)&&n.preventDefault(),Xe("ArrowDown",n)&&n.preventDefault()}),t(this._container,ee.INPUT_SELECTOR,"keyup",function(n){if(Xe("Escape",n))return e.close();if(Xe("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close()}if(Xe("ArrowUp",n))return e._scrollToDirection(!0);if(Xe("ArrowDown",n))return e._scrollToDirection();Xe(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})};ee.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Qt.unbind(e.el,e.type,e.listener)})};ee.prototype._search=function(e){var t=this;if(this._clearResults(),!(!e||e==="")){var n=this._searchProvider.find(e);if(n.length){n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=De(ee.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}}};ee.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}};ee.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}};ee.prototype._clearResults=function(){cm(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")};ee.prototype._getCurrentResult=function(){return De(ee.RESULT_SELECTED_SELECTOR,this._resultsContainer)};ee.prototype._createResultNode=function(e,t){var n=et(ee.RESULT_HTML);return e.primaryTokens.length>0&&Dh(n,e.primaryTokens,ee.RESULT_PRIMARY_HTML),Dh(n,e.secondaryTokens,ee.RESULT_SECONDARY_HTML),lt(n,ee.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n};ee.prototype.registerProvider=function(e){this._searchProvider=e};ee.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,Le(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))};ee.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,Le(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))};ee.prototype.toggle=function(){this.isOpen()?this.close():this.open()};ee.prototype.isOpen=function(){return this._open};ee.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Le(t).remove(ee.RESULT_SELECTED_CLASS);var n=lt(e,ee.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Le(e).add(ee.RESULT_SELECTED_CLASS),this._resetOverlay(i),this._canvas.scrollToElement(i,{top:400}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}};ee.prototype._select=function(e){var t=lt(e,ee.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this.close(),this._resetOverlay(),this._canvas.scrollToElement(n,{top:400}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)};ee.prototype._resetOverlay=function(e){if(this._overlayId&&this._overlays.remove(this._overlayId),e){var t=Mt(e),n=YC(t);this._overlayId=this._overlays.add(e,n)}};ee.prototype._getBoxHtml=function(){const e=et(ee.BOX_HTML),t=De(ee.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function YC(e){var t=6,n=e.width+t*2,i=e.height+t*2,r={width:n+"px",height:i+"px"},o=et('<div class="'+ee.OVERLAY_CLASS+'"></div>');return ss(o,r),{position:{bottom:i-t,right:n-t},show:!0,html:o}}function Dh(e,t,n){var i=qC(t),r=et(n);r.innerHTML=i,e.appendChild(r)}function qC(e){var t="";return e.forEach(function(n){n.matched?t+='<strong class="'+ee.RESULT_HIGHLIGHT_CLASS+'">'+Xc(n.matched)+"</strong>":t+=Xc(n.normal)}),t!==""?t:null}ee.CONTAINER_SELECTOR=".djs-search-container";ee.INPUT_SELECTOR=".djs-search-input input";ee.RESULTS_CONTAINER_SELECTOR=".djs-search-results";ee.RESULT_SELECTOR=".djs-search-result";ee.RESULT_SELECTED_CLASS="djs-search-result-selected";ee.RESULT_SELECTED_SELECTOR="."+ee.RESULT_SELECTED_CLASS;ee.RESULT_ID_ATTRIBUTE="data-result-id";ee.RESULT_HIGHLIGHT_CLASS="djs-search-highlight";ee.OVERLAY_CLASS="djs-search-overlay";ee.BOX_HTML='<div class="djs-search-container djs-draggable djs-scrollable"><div class="djs-search-input"><input type="text"/></div><div class="djs-search-results"></div></div>';ee.RESULT_HTML='<div class="djs-search-result"></div>';ee.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>';ee.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const KC={__depends__:[lm,Zh,An],searchPad:["type",ee]};function vp(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}vp.$inject=["elementRegistry","searchPad","canvas"];vp.prototype.find=function(e){var t=this._canvas.getRootElement(),n=this._elementRegistry.filter(function(i){return!i.labelTarget});return n=pe(n,function(i){return i!==t}),n=Pt(n,function(i){return{primaryTokens:Oh(Jn(i),e),secondaryTokens:Oh(i.id,e),element:i}}),n=pe(n,function(i){return kh(i.primaryTokens)||kh(i.secondaryTokens)}),n=hn(n,function(i){return Jn(i.element)+i.element.id}),n};function kh(e){var t=pe(e,function(n){return!!n.matched});return t.length>0}function Oh(e,t){var n=[],i=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();var r=e.indexOf(t);return r>-1?(r!==0&&n.push({normal:i.substr(0,r)}),n.push({matched:i.substr(r,t.length)}),t.length+r<e.length&&n.push({normal:i.substr(t.length+r,e.length)})):n.push({normal:i}),n}const XC={__depends__:[KC],__init__:["bpmnSearch"],bpmnSearch:["type",vp]};var ZC='<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>';function dn(e){uo.call(this,e)}q(dn,uo);dn.Viewer=oo;dn.NavigatedViewer=Jr;dn.prototype.createDiagram=function(){return this.importXML(ZC)};dn.prototype._interactionModules=[ym,Kh,Xh];dn.prototype._modelingModules=[sE,iu,IE,SE,XE,cu,nx,r1,qv,Ps,c1,p1,R1,I1,M1,L1,q1,gg,eC,cC,yC,bC,Ag,WC,XC];dn.prototype._modules=[].concat(oo.prototype._modules,dn.prototype._interactionModules,dn.prototype._modelingModules);const JC={"bpmn:Process":"流程","bpmn:StartEvent":"开始事件","bpmn:IntermediateThrowEvent":"中间事件","bpmn:Task":"任务","bpmn:SendTask":"发送任务","bpmn:ReceiveTask":"接收任务","bpmn:UserTask":"用户任务","bpmn:ManualTask":"手工任务","bpmn:BusinessRuleTask":"业务规则任务","bpmn:ServiceTask":"服务任务","bpmn:ScriptTask":"脚本任务","bpmn:EndEvent":"结束事件","bpmn:SequenceFlow":"流程线","bpmn:ExclusiveGateway":"互斥网关","bpmn:ParallelGateway":"并行网关","bpmn:InclusiveGateway":"相容网关","bpmn:ComplexGateway":"复杂网关","bpmn:EventBasedGateway":"事件网关"},QC={"Activate hand tool":"启动手动工具","Activate lasso tool":"启动 Lasso 工具","Activate create/remove space tool":"启动创建/删除空间工具","Activate global connect tool":"启动全局连接工具","Ad-hoc":"Ad-hoc","Add lane above":"在上方添加泳道","Add lane below":"在下方添加泳道","Business rule task":"规则任务","Call activity":"引用流程","Compensation end event":"结束补偿事件","Compensation intermediate throw event":"中间补偿抛出事件","Complex gateway":"复杂网关","Conditional intermediate catch event":"中间条件捕获事件","Conditional start event (non-interrupting)":"条件启动事件 (非中断)","Conditional start event":"条件启动事件","Connect using association":"文本关联","Connect using sequence/message flow or association":"消息关联","Change element":"更改元素","Change type":"更改类型","Create data object reference":"创建数据对象引用","Create data store reference":"创建数据存储引用","Create expanded sub-process":"创建可折叠子流程","Create pool/participant":"创建池/参与者",Collection:"集合","Connect using data input association":"数据输入关联","Data store reference":"数据存储引用","Data object reference":"数据对象引用","Divide into two lanes":"分成两个泳道","Divide into three lanes":"分成三个泳道","End event":"结束事件","Error end event":"结束错误事件","Escalation end event":"结束升级事件","Escalation intermediate throw event":"中间升级抛出事件","Event sub-process":"事件子流程","Event-based gateway":"事件网关","Exclusive gateway":"互斥网关","Empty pool/participant (removes content)":"清空池/参与者 (删除内容)","Inclusive gateway":"相容网关","Intermediate throw event":"中间抛出事件",Loop:"循环","Link intermediate catch event":"中间链接捕获事件","Link intermediate throw event":"中间链接抛出事件","Manual task":"手动任务","Message end event":"结束消息事件","Message intermediate catch event":"中间消息捕获事件","Message intermediate throw event":"中间消息抛出事件","Message start event":"消息启动事件","Parallel gateway":"并行网关","Parallel multi-instance":"并行多实例","Participant multiplicity":"参与者多重性","Receive task":"接受任务",Remove:"移除","Script task":"脚本任务","Send task":"发送任务","Sequential multi-instance":"串行多实例","Service task":"服务任务","Signal end event":"结束信号事件","Signal intermediate catch event":"中间信号捕获事件","Signal intermediate throw event":"中间信号抛出事件","Signal start event (non-interrupting)":"信号启动事件 (非中断)","Signal start event":"信号启动事件","Start event":"开始事件","Sub-process (collapsed)":"可折叠子流程","Sub-process (expanded)":"可展开子流程","Sub rocess":"子流程",Task:"任务",Transaction:"事务","Terminate end event":"终止边界事件","Timer intermediate catch event":"中间定时捕获事件","Timer start event (non-interrupting)":"定时启动事件 (非中断)","Timer start event":"定时启动事件","User task":"用户任务","Create start event":"创建开始事件","Create gateway":"创建网关","Create intermediate/boundary event":"创建中间/边界事件","Create end event":"创建结束事件","Create group":"创建组","Create startEvent":"开始节点","Create endEvent":"结束节点","Create exclusiveGateway":"互斥网关","Create parallelGateway":"并行网关","Create task":"任务节点","Create userTask":"用户任务节点","Condition type":"条件类型","Append end event":"追加结束事件节点","Append gateway":"追加网关节点","Append task":"追加任务","Append user task":"追加用户任务节点","Append text annotation":"追加文本注释","Append intermediate/boundary event":"追加中间或边界事件","Append receive task":"追加接收任务节点","Append message intermediate catch event":"追加中间消息捕获事件","Append timer intermediate catch event":"追加中间定时捕获事件","Append conditional intermediate catch event":"追加中间条件捕获事件","Append signal intermediate catch event":"追加中间信号捕获事件","Open minimap":"打开小地图","Close minimap":"关闭小地图","Token Simulation ":"模拟"};function eT(e,t){return t=t||{},e=QC[e]||e,e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const tT={translate:["value",eT]},Yn={modeler:void 0,moddle:void 0,modeling:void 0,canvas:void 0,elementRegistry:void 0,bpmnFactory:void 0,procDefId:void 0,procDefName:void 0},nT=V_("modeler",()=>{let e=Yn.modeler,t=Yn.moddle,n=Yn.modeling,i=Yn.canvas,r=Yn.elementRegistry,o=Yn.bpmnFactory;const a=Ee(Yn.procDefId),s=Ee(Yn.procDefName);return{getModeler:()=>e,getModdle:()=>t,getModeling:()=>n,getCanvas:()=>i,getElRegistry:()=>r,getBpmnFactory:()=>o,getProcDefId:()=>a.value,getProcDefName:()=>s.value,setModeler:w=>{w?(e=w,n=w.get("modeling"),t=w.get("moddle"),i=w.get("canvas"),o=w.get("bpmnFactory"),r=w.get("elementRegistry")):n=t=i=r=o=void 0},setProcDef:w=>{a.value=w==null?void 0:w.get("canvas").getRootElement().businessObject.get("id"),s.value=w==null?void 0:w.get("canvas").getRootElement().businessObject.get("name")}}}),Qn=nT;class Vg extends Us{constructor(n,i,r,o,a,s,c,l){super(n,i,r,o,a,s,c,l);Ke(this,"_palette");Ke(this,"_create");Ke(this,"_elementFactory");Ke(this,"_spaceTool");Ke(this,"_lassoTool");Ke(this,"_handTool");Ke(this,"_globalConnect");Ke(this,"_translate");this._palette=n,this._create=i,this._elementFactory=r,this._spaceTool=o,this._lassoTool=a,this._handTool=s,this._globalConnect=c,this._translate=l}getPaletteEntries(){const n={},i=this._create,r=this._elementFactory,o=this._translate;function a(c,l,u,p,f){function d(m){const v=r.createShape(af({type:c},f));i.start(m,v,null)}const h=c.replace(/^bpmn:/,"");return{group:l,className:u,title:p||o("Create {type}",{type:h}),action:{dragstart:d,click:d}}}function s(c){const l=Qn().getBpmnFactory(),u=l==null?void 0:l.create("bpmn:UserTask",{isForCompensation:!1});u.loopCharacteristics=l==null?void 0:l.create("bpmn:MultiInstanceLoopCharacteristics");const p=r.createShape({type:"bpmn:UserTask",businessObject:u});i.start(c,p,{})}return af(n,{"create.parallel-gateway":a("bpmn:ParallelGateway","gateway","bpmn-icon-gateway-parallel","并行网关"),"create.event-base-gateway":a("bpmn:EventBasedGateway","gateway","bpmn-icon-gateway-eventbased","事件网关"),"gateway-separator":{group:"gateway",separator:!0},"create.user-task":a("bpmn:UserTask","activity","bpmn-icon-user-task","创建用户任务"),"create.multi-instance-user-task":{group:"activity",type:"bpmn:UserTask",className:"bpmn-icon-user task-multi-instance",title:"创建多实例用户任务",action:{click:s,dragstart:s}},"task-separator":{group:"activity",separator:!0}}),n}}Vg.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"];function iT(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch(n){}return e}function Ug(e,t){return t.appendChild(iT(e,t))}var wl=2,Wg={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":wl,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":wl,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function rT(e,t){return Wg[t]?e.style[t]:e.getAttributeNS(null,t)}function Yg(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Wg[i];r?(r===wl&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function oT(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Yg(e,r,t[r])}function rr(e,t,n){if(typeof t=="string")if(n!==void 0)Yg(e,t,n);else return rT(e,t);else oT(e,t);return e}var gp={svg:"http://www.w3.org/2000/svg"},Nh='<svg xmlns="'+gp.svg+'"';function aT(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(gp.svg)===-1&&(e=Nh+e.substring(4)):(e=Nh+">"+e+"</svg>",t=!0);var n=sT(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function sT(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function yp(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=aT(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(gp.svg,e),n}function cT(e){var t=e.parentNode;return t&&t.removeChild(e),e}const lT=1500;class qg extends z_{constructor(n,i,r){super(n,lT);Ke(this,"bpmnRenderer");Ke(this,"modeling");this.bpmnRenderer=i,this.modeling=r}canRender(n){return!n.labelTarget}drawShape(n,i){const r=this.bpmnRenderer.drawShape(n,i),{type:o}=i;return o==="bpmn:StartEvent"?(rr(r,{fill:"#77DF6D"}),r):o==="bpmn:EndEvent"?(rr(r,{fill:"#EE7B77"}),r):(o==="bpmn:UserTask"&&rr(r,{fill:"#A9C4F8"}),r)}getShapePath(n){return this.bpmnRenderer.getShapePath(n)}}qg.$inject=["eventBus","bpmnRenderer"];class uT extends br{constructor(n,i,r,o,a,s,c,l,u,p,f,d){super(n,i,r,o,a,s,c,l,u,p,f,d);Ke(this,"_contextPad");Ke(this,"_modeling");Ke(this,"_elementFactory");Ke(this,"_autoPlace");Ke(this,"_connect");Ke(this,"_create");Ke(this,"_popupMenu");Ke(this,"_canvas");Ke(this,"_rules");this._contextPad=o,this._modeling=a,this._elementFactory=s,this._connect=c,this._create=l,this._popupMenu=u,this._canvas=p,this._rules=f,this._autoPlace=i.get("autoPlace",!1)}getContextPadEntries(n){const i={},r=(c,l)=>{const u=this._elementFactory.createShape({type:"bpmn:UserTask"});this._create.start(c,u,{source:l})},o=(c,l)=>{var h;const p=(h=Qn().getModeler())==null?void 0:h.get("bpmnFactory"),f=p.create("bpmn:UserTask",{isForCompensation:!1});f.loopCharacteristics=p.create("bpmn:MultiInstanceLoopCharacteristics");const d=this._elementFactory.createShape({type:"bpmn:UserTask",businessObject:f});this._create.start(c,d,{source:l})},a=this._autoPlace?(c,l)=>{var d;const u=(d=Qn().getModeler())==null?void 0:d.get("bpmnFactory"),p=u==null?void 0:u.create("bpmn:UserTask",{isForCompensation:!1});p.loopCharacteristics=u==null?void 0:u.create("bpmn:MultiInstanceLoopCharacteristics");const f=this._elementFactory.createShape({type:"bpmn:UserTask",businessObject:p});this._autoPlace.append(l,f)}:o,s=this._autoPlace?(c,l)=>{const u=this._elementFactory.createShape({type:"bpmn:UserTask"});this._autoPlace.append(l,u)}:r;return i["append.append-user-task"]={group:"model",className:"bpmn-icon-user-task",title:"用户任务",action:{dragstart:r,click:s}},i["append.append-multi-instance-user-task"]={group:"model",className:"bpmn-icon-user",title:"多实例用户任务",action:{dragstart:o,click:a}},i}}const _p=1,Kg=2,Xg=4,Zg=8,pT=16,fT=32,dT=64,hT=128,mT=256,vT=512,gT=_p|Kg|Xg,yT=_p|Zg,de=Object.freeze({ACTIVATED:_p,RUNNING:Kg,ENDING:Xg,ENDED:Zg,DESTROYED:pT,FAILED:fT,TERMINATED:dT,CANCELED:hT,COMPLETED:mT,COMPENSABLE:vT,ACTIVE:gT,NOT_DEAD:yT}),Sr={};function wi(e,t){throw new Error(`illegal transition: ${e.name} -> ${t}`)}function Si(e,t){return e===Sr?t:e}class Lt{constructor(t,n,{start:i,cancel:r,complete:o,destroy:a,fail:s,terminate:c,compensable:l}={}){this.name=t,this.traits=n,this._start=Si(i,this),this._compensable=Si(l,this),this._cancel=Si(r,this),this._complete=Si(o,this),this._destroy=Si(a,this),this._fail=Si(s,this),this._terminate=Si(c,this)}hasTrait(t){return(this.traits&t)!==0}complete(){return this._complete||wi(this,"complete")}destroy(){return this._destroy||wi(this,"destroy")}cancel(){return this._cancel||wi(this,"cancel")}fail(){return this._fail||wi(this,"fail")}terminate(){return this._terminate||wi(this,"terminate")}compensable(){return this._compensable||wi(this,"compensable")}start(){return this._start||wi(this,"start")}}const Ys=new Lt("failed",de.DESTROYED|de.FAILED),qs=new Lt("terminated",de.DESTROYED|de.TERMINATED),bp=new Lt("completed",de.DESTROYED|de.COMPLETED),hi=new Lt("terminating",de.ENDING|de.TERMINATED,{destroy:qs}),Cr=new Lt("canceling",de.ENDING|de.FAILED|de.CANCELED,{destroy:Ys,complete:Sr,terminate:hi}),Ep=new Lt("completing",de.ENDING|de.COMPLETED,{destroy:bp,cancel:Cr,terminate:hi}),xp=new Lt("failing",de.ENDING|de.FAILED,{cancel:Cr,complete:Ep,destroy:Ys,terminate:hi}),_T=new Lt("compensable:failing",de.ENDING|de.FAILED,{complete:Sr,terminate:hi,destroy:Ys}),Jg=new Lt("compensable:completed",de.ENDED|de.COMPLETED,{cancel:Cr,fail:_T,destroy:bp,compensable:Sr}),bT=new Lt("compensable:completing",de.ENDING|de.COMPLETED,{destroy:Jg,terminate:hi,compensable:Sr}),ET=new Lt("compensable:running",de.RUNNING|de.COMPENSABLE,{cancel:Cr,complete:bT,compensable:Sr,destroy:Jg,fail:xp,terminate:hi}),Qg=new Lt("running",de.RUNNING,{cancel:Cr,complete:Ep,compensable:ET,destroy:qs,fail:xp,terminate:hi}),xT=new Lt("activated",de.ACTIVATED,{start:Qg,destroy:qs}),wT=Object.freeze({ACTIVATED:xT,RUNNING:Qg,CANCELING:Cr,COMPLETING:Ep,COMPLETED:bp,FAILING:xp,FAILED:Ys,TERMINATING:hi,TERMINATED:qs});class ST{constructor(t,n,i=null,r=null){this.id=t,this.element=n,this.parent=i,this.initiator=r,this.subscriptions=new Set,this.children=[],this.state=wT.ACTIVATED}get running(){return this.hasTrait(de.RUNNING)}get destroyed(){return this.hasTrait(de.DESTROYED)}get completed(){return this.hasTrait(de.COMPLETED)}get canceled(){return this.hasTrait(de.CANCELED)}get failed(){return this.hasTrait(de.FAILED)}hasTrait(t){return this.state.hasTrait(t)}start(){return this.state=this.state.start(),this}compensable(){return this.state=this.state.compensable(),this}fail(t){return this.failed||(this.state=this.state.fail(),this.failInitiator=t),this}cancel(t){return this.canceled||(this.state=this.state.cancel(),this.cancelInitiator=t),this}terminate(t){return this.state=this.state.terminate(),this.terminateInitiator=t,this}complete(){return this.state=this.state.complete(),this}destroy(t){return this.state=this.state.destroy(),this.destroyInitiator=t,this}getTokens(){return this.children.filter(t=>!t.destroyed).length}getTokensByElement(t){return this.children.filter(n=>!n.destroyed&&n.element===t).length}}function zr(e,t){const n=[];for(const i of e)t(i)&&n.push(i);return n}function Lh(e,t){for(const n of e)if(t(n))return n;return null}function Sl(e,t){return["type","name","ref","iref"].every(n=>!(n in e)||e[n]===t[n])}function Ks(e){return e.filter(t=>g(t,"bpmn:SequenceFlow"))}function Cl(e){return g(e,"bpmn:MessageFlow")}function mi(e){return g(e,"bpmn:SequenceFlow")}function ey(e){return wp(e)&&Cp(e,"bpmn:LinkEventDefinition")}function Za(e){return wp(e)&&Cp(e,"bpmn:CompensateEventDefinition")}function ty(e){return g(e,"bpmn:Activity")&&e.businessObject.isForCompensation}function wp(e){return(g(e,"bpmn:CatchEvent")||g(e,"bpmn:ReceiveTask"))&&!Xs(e)}function ja(e){return g(e,"bpmn:BoundaryEvent")&&!Xs(e)}function ny(e){return Di(e)&&!Cp(e)}function Sp(e){return!(Xs(e)||!ko(e,["bpmn:Activity","bpmn:IntermediateCatchEvent","bpmn:IntermediateThrowEvent","bpmn:Gateway","bpmn:EndEvent"])||ey(e)||e.incoming.find(mi)||ty(e)||ei(e))}function Di(e){return g(e,"bpmn:StartEvent")&&!Xs(e)}function Xs(e){return!!e.labelTarget}function ei(e){return z(e).triggeredByEvent}function iy(e){return g(e,"bpmn:StartEvent")&&z(e).isInterrupting||g(e,"bpmn:BoundaryEvent")&&z(e).cancelActivity}function ko(e,t){return t.some(n=>g(e,n))}function Cp(e,t){return Li(z(e).eventDefinitions,n=>t?g(n,t):!0)}function ry(e,t,n){const i=e.get("scopeIds",!1)||new qh([32,36]),r={},o={},a=new CT,s=new Set,c=[],l=new Set,u=new Set;fe("tick",function(){for(const R of s)ie("elementChanged",{element:R});s.clear()});function p(R,G){if(c.push([G,R]),c.length!==1)return;let V;for(;V=c[0];){const[se,X]=V;X.destroyed||se(),c.shift()}ie("tick")}function f(R){return o[R.type]||a}function d(R){const{element:G,parentScope:V,initiator:se=null,scope:X=bn({element:G,parent:V,initiator:se})}=R;return p(X,function(){X.running||X.start(),Ye("signal",Pe(te({},R),{scope:X})),f(G).signal(Pe(te({},R),{scope:X})),X.parent&&U(X.parent)}),X}function h(R){const{element:G,scope:V,initiator:se=V}=R,X=bn({element:G,parent:V,initiator:se});return p(X,function(){X.running||X.start(),Ye("enter",R),f(G).enter(Pe(te({},R),{initiator:se,scope:X})),X.parent&&U(X.parent)}),X}function m(R){const{element:G,scope:V,initiator:se=V}=R;p(V,function(){Ye("exit",R),f(G).exit(Pe(te({},R),{initiator:se})),V.running&&V.complete(),Ae(V,se),V.parent&&U(V.parent)})}function v(R){const{event:G,initiator:V,scope:se}=R,X=P(G),J=se.subscriptions,Te=zr(J,qe=>Sl(X,qe.event)),Be=Te.filter(qe=>!qe.event.interrupting),ht=Te.filter(qe=>qe.event.interrupting);if(!ht.length)return Be.map(qe=>qe.triggerFn(V)).flat();const on=ht.find(qe=>!qe.event.boundary)||ht[0],Wo=zr(J,qe=>qe.event.persistent||TT(qe.event,on.event));return J.forEach(qe=>{Wo.includes(qe)||qe.remove()}),[on.triggerFn(V)].flat().filter(qe=>qe)}function E(R,G,V){G=P(G);const se=G.element,X={scope:R,event:G,element:se,triggerFn:V,remove(){w(X)}};return u.add(X),R.subscriptions.add(X),se&&Ie(se),X}function w(R){const{scope:G,event:V}=R;u.delete(R),G.subscriptions.delete(R),V.element&&Ie(V.element)}function _(R){return g(R,"bpmn:StartEvent")||g(R,"bpmn:IntermediateCatchEvent")||g(R,"bpmn:ReceiveTask")||RT(R)?z(R).name||R.id:null}function x(R){return{element:R,interrupting:!1,boundary:!1,iref:R.id,type:"none"}}function P(R){if(!R.businessObject)return R;const G=iy(R),V=ja(R),se=_(R),X=te({element:R,interrupting:G,boundary:V},se?{iref:se}:{}),J=oy(R)[0];if(!J)return Pe(te({},X),{type:PT(R)?"message":"none"});if(g(J,"bpmn:LinkEventDefinition"))return Pe(te({},X),{type:"link",name:J.name});if(g(J,"bpmn:SignalEventDefinition"))return Pe(te({},X),{type:"signal",ref:J.signalRef});if(g(J,"bpmn:TimerEventDefinition"))return Pe(te({},X),{type:"timer"});if(g(J,"bpmn:ConditionalEventDefinition"))return Pe(te({},X),{type:"condition"});if(g(J,"bpmn:EscalationEventDefinition"))return Pe(te({},X),{type:"escalation",ref:J.escalationRef});if(g(J,"bpmn:CancelEventDefinition"))return Pe(te({},X),{type:"cancel"});if(g(J,"bpmn:ErrorEventDefinition"))return Pe(te({},X),{type:"error",ref:J.errorRef});if(g(J,"bpmn:MessageEventDefinition"))return Pe(te({},X),{type:"message",ref:J.messageRef});if(g(J,"bpmn:CompensateEventDefinition")){let Te=J.activityRef&&n.get(J.activityRef.id);return Te||(Di(R)&&ei(R.parent)?Te=R.parent.parent:ja(R)?Te=R.host:Te=R.parent),Pe(te({},X),{type:"compensate",ref:Te,persistent:!0})}throw new Error("unknown event definition",J)}function A(R,G=!0){const{element:V,parent:se,initiator:X}=R;G&&Ye("createScope",{element:V,scope:se});const J=new ST(i.next(),V,se,X);return se&&se.children.push(J),l.add(J),G&&ie("createScope",{scope:J}),Ie(V),se&&Ie(se.element),J}function C(R){if(typeof R=="function")return R;const{event:G,element:V,scope:se}=R,X=R.elements||V&&[V],J=G&&P(G);return Te=>(!J||Sl(J,Te.event))&&(!X||X.includes(Te.element))&&(!se||se===Te.scope)}function I(R){const G=R==="function"?R:C(R);return V=>Array.from(V.subscriptions).some(G)}function T(R){if(typeof R=="function")return R;const{element:G,waitsOnElement:V,parent:se,trait:X=de.RUNNING,subscribedTo:J}=R,Te=J?I(J):()=>!0;return Be=>(!G||Be.element===G)&&(!se||Be.parent===se)&&(!V||Be.getTokensByElement(V)>0)&&Be.hasTrait(X)&&Te(Be)}function k(R){return zr(u,C(R))}function B(R){return Lh(u,C(R))}function K(R){return zr(l,T(R))}function Z(R){return Lh(l,T(R))}function Ae(R,G=null){if(!R.destroyed){R.destroy(G);for(const V of R.subscriptions){const se=V.event.traits||de.ACTIVE;R.hasTrait(se)||w(V)}if(R.destroyed){for(const V of R.children)V.destroyed||Ae(V,G);Ye("destroyScope",{element:R.element,scope:R}),l.delete(R),ie("destroyScope",{scope:R})}Ie(R.element),R.parent&&Ie(R.parent.element)}}function Ye(R,G){ie("trace",Pe(te({},G),{action:R}))}function Ie(R){s.add(R),c.length||ie("tick")}function U(R){ie("scopeChanged",{scope:R})}function ie(R,G={}){return t.fire(`tokenSimulation.simulator.${R}`,G)}function fe(R,G){t.on("tokenSimulation.simulator."+R,G)}function nt(R,G){t.off("tokenSimulation.simulator."+R,G)}function St(R,G){const V=jn(R);r[R.id||R]=te(te({},V),G),Ie(R)}function Ct(){const R=[];return n.forEach(G=>{if(!ko(G,["bpmn:Process","bpmn:Participant"]))return;const V=A({element:G},!1);R.push(V);const se=G.children.filter(Di),X=G.children.filter(Sp);for(const J of se){const Te=Pe(te({},P(J)),{interrupting:!1});E(V,Te,Be=>d({element:G,startEvent:J,initiator:Be}))}if(!se.length)for(const J of X){const Te=x(J);E(V,Te,Be=>d({element:G,initiator:Be}))}}),R}function bn(R){const{element:G}=R,V=A(R),{children:se=[],attachers:X=[]}=G;for(const J of se)if(ei(J)){const Te=J.children.filter(Be=>Di(Be)&&!Za(Be));for(const Be of Te)E(V,Be,ht=>d({element:J,parentScope:V,startEvent:Be,initiator:ht}))}for(const J of X)ja(J)&&!Za(J)&&E(V,J,Te=>d({element:J,parentScope:V.parent,hostScope:V,initiator:Te}));return V}function jn(R){return r[R.id||R]||{}}function oe(R,G){if(!G.length)return;const V={type:"all-completed",persistent:!1},se=new Set(G),X=J=>{se.delete(J.scope),se.size===0&&(nt("destroyScope",X),v({scope:R,event:V}))};return fe("destroyScope",X),V}function F(R,G=!0){St(R,{wait:G})}function Y(){for(const R of l)Ae(R);for(const R of Ct())l.add(R);ie("tick"),ie("reset")}this.createScope=A,this.destroyScope=Ae,this.findScope=Z,this.findScopes=K,this.findSubscription=B,this.findSubscriptions=k,this.waitAtElement=F,this.waitForScopes=oe,this.setConfig=St,this.getConfig=jn,this.signal=d,this.enter=h,this.exit=m,this.subscribe=E,this.trigger=v,this.reset=Y,this.on=fe,this.off=nt,this.registerBehavior=function(R,G){o[R]=G}}ry.$inject=["injector","eventBus","elementRegistry"];function CT(){this.signal=function(e){},this.exit=function(e){},this.enter=function(e){}}function TT(e,t){return e.type===t.type&&e.boundary&&!t.boundary}function PT(e){return g(e,"bpmn:ReceiveTask")||e.incoming.some(t=>g(t,"bpmn:MessageFlow"))}function RT(e){if(!ja(e))return!1;const t=oy(e);return!t[0]||ko(t[0],["bpmn:ConditionalEventDefinition","bpmn:TimerEventDefinition"])}function oy(e){return e.businessObject.get("eventDefinitions")||[]}function Zs(e,t){this._simulator=e,this._activityBehavior=t,e.registerBehavior("bpmn:StartEvent",this)}Zs.prototype.signal=function(e){this._simulator.exit(e)};Zs.prototype.exit=function(e){this._activityBehavior.exit(e)};Zs.$inject=["simulator","activityBehavior"];function Oo(e,t,n){this._intermediateThrowEventBehavior=n,this._scopeBehavior=t,e.registerBehavior("bpmn:EndEvent",this)}Oo.$inject=["simulator","scopeBehavior","intermediateThrowEventBehavior"];Oo.prototype.enter=function(e){this._intermediateThrowEventBehavior.enter(e)};Oo.prototype.signal=function(e){this._intermediateThrowEventBehavior.signal(e)};Oo.prototype.exit=function(e){const{scope:t}=e;this._scopeBehavior.tryExit(t.parent,t)};function Js(e,t,n){this._simulator=e,this._activityBehavior=t,this._scopeBehavior=n,e.registerBehavior("bpmn:BoundaryEvent",this)}Js.prototype.signal=function(e){const{element:t,scope:n,hostScope:i=this._simulator.findScope({parent:n.parent,element:t.host})}=e;if(!i)throw new Error("host scope not found");if(z(t).cancelActivity){this._scopeBehavior.interrupt(i,n);const o=this._scopeBehavior.tryExit(i,n);if(o){const a=this._simulator.subscribe(i,o,s=>(a.remove(),this._simulator.exit(e)));return}}this._simulator.exit(e)};Js.prototype.exit=function(e){this._activityBehavior.exit(e)};Js.$inject=["simulator","activityBehavior","scopeBehavior"];function No(e,t){this._activityBehavior=t,this._simulator=e,e.registerBehavior("bpmn:IntermediateCatchEvent",this),e.registerBehavior("bpmn:ReceiveTask",this)}No.$inject=["simulator","activityBehavior"];No.prototype.signal=function(e){return this._simulator.exit(e)};No.prototype.enter=function(e){const{element:t}=e;return this._activityBehavior.signalOnEvent(e,t)};No.prototype.exit=function(e){this._activityBehavior.exit(e)};function Lo(e,t,n){this._simulator=e,this._activityBehavior=t,this._eventBehaviors=n,e.registerBehavior("bpmn:IntermediateThrowEvent",this),e.registerBehavior("bpmn:SendTask",this)}Lo.prototype.enter=function(e){const{element:t}=e,n=this._eventBehaviors.get(t);if(n){const i=n(e);if(i)return this._activityBehavior.signalOnEvent(e,i)}this._activityBehavior.enter(e)};Lo.prototype.signal=function(e){this._activityBehavior.signal(e)};Lo.prototype.exit=function(e){this._activityBehavior.exit(e)};Lo.$inject=["simulator","activityBehavior","eventBehaviors"];function Qs(e,t){this._scopeBehavior=t,this._simulator=e,e.registerBehavior("bpmn:ExclusiveGateway",this)}Qs.prototype.enter=function(e){this._simulator.exit(e)};Qs.prototype.exit=function(e){const{element:t,scope:n}=e,i=Ks(t.outgoing);if(i.length===1)return this._simulator.enter({element:i[0],scope:n.parent});const{activeOutgoing:r}=this._simulator.getConfig(t),o=i.find(a=>a===r);return o?this._simulator.enter({element:o,scope:n.parent}):this._scopeBehavior.tryExit(n.parent,n)};Qs.$inject=["simulator","scopeBehavior"];function ec(e,t){this._simulator=e,this._activityBehavior=t,e.registerBehavior("bpmn:ParallelGateway",this)}ec.prototype.enter=function(e){const{scope:t,element:n}=e,i=Ks(n.incoming),{parent:r}=t,o=this._simulator.findScopes({parent:r,element:n});if(o.length===i.length){for(const a of o)a!==t&&this._simulator.destroyScope(a.complete(),t);this._simulator.exit(e)}};ec.prototype.exit=function(e){this._activityBehavior.exit(e)};ec.$inject=["simulator","activityBehavior"];function Tp(e){this._simulator=e,e.registerBehavior("bpmn:EventBasedGateway",this)}Tp.$inject=["simulator"];Tp.prototype.enter=function(e){const{element:t,scope:n}=e,i=n.parent,o=AT(t).map(a=>this._simulator.subscribe(i,a,s=>(o.forEach(c=>c.remove()),this._simulator.destroyScope(n,s),this._simulator.signal({element:a,parentScope:i,initiator:s}))))};function AT(e){return e.outgoing.map(t=>t.target).filter(t=>ko(t,["bpmn:IntermediateCatchEvent","bpmn:ReceiveTask"]))}function Nn(e,t){this._simulator=e,this._activityBehavior=t,e.registerBehavior("bpmn:InclusiveGateway",this)}Nn.prototype.enter=function(e){this._tryJoin(e)};Nn.prototype.exit=function(e){const{element:t,scope:n}=e;if(Ks(t.outgoing).length>1){const{activeOutgoing:r=[]}=this._simulator.getConfig(t);if(!r.length)throw new Error("no outgoing configured");for(const o of r)this._simulator.enter({element:o,scope:n.parent})}else this._activityBehavior.exit(e)};Nn.prototype._tryJoin=function(e){const t=this._getRemainingScopes(e),n=t.map(s=>s.element);if(!this._canReachAnyElement(n,e.element))return this._join(e);const i=this._getElementScopes(e),{scope:r}=e;if(i[0]!==r)return;const o=this._simulator.waitForScopes(r,t),a=this._simulator.subscribe(r,o,()=>{a.remove(),this._tryJoin(e)})};Nn.prototype._getRemainingScopes=function(e){const{scope:t,element:n}=e,{parent:i}=t;return this._simulator.findScopes(r=>r.parent===i&&r.element!==n)};Nn.prototype._join=function(e){const t=this._getElementScopes(e);for(const n of t)n!==e.scope&&this._simulator.destroyScope(n.complete(),e.scope);this._simulator.exit(e)};Nn.prototype._getElementScopes=function(e){const{element:t,scope:n}=e;return this._simulator.findScopes({parent:n.parent,element:t})};Nn.prototype._canReachAnyElement=function(e,t,n=new Set){if(!e.length||n.has(t))return!1;if(n.add(t),e.some(r=>r===t))return!0;if(mi(t))return this._canReachAnyElement(e,t.source,n);const i=Ks(t.incoming);for(const r of i)if(this._canReachAnyElement(e,r,n))return!0;return!1};Nn.$inject=["simulator","activityBehavior"];function Ln(e,t,n){this._simulator=e,this._scopeBehavior=t,this._transactionBehavior=n;const i=["bpmn:BusinessRuleTask","bpmn:CallActivity","bpmn:ManualTask","bpmn:ScriptTask","bpmn:ServiceTask","bpmn:Task","bpmn:UserTask"];for(const r of i)e.registerBehavior(r,this)}Ln.$inject=["simulator","scopeBehavior","transactionBehavior"];Ln.prototype.signal=function(e){const t=this._triggerMessages(e);if(t)return this.signalOnEvent(e,t);this._simulator.exit(e)};Ln.prototype.enter=function(e){const{element:t}=e,n=this.waitAtElement(t);if(n)return this.signalOnEvent(e,n);const i=this._triggerMessages(e);if(i)return this.signalOnEvent(e,i);this._simulator.exit(e)};Ln.prototype.exit=function(e){const{element:t,scope:n}=e,i=n.parent,r=!n.failed;r&&!ei(t)&&this._transactionBehavior.registerCompensation(n);const o=r?t.outgoing.filter(mi):[];o.forEach(a=>this._simulator.enter({element:a,scope:i})),o.length===0&&this._scopeBehavior.tryExit(i,n)};Ln.prototype.signalOnEvent=function(e,t){const{scope:n,element:i}=e,r=this._simulator.subscribe(n,t,o=>(r.remove(),this._simulator.signal({scope:n,element:i,initiator:o})))};Ln.prototype.waitAtElement=function(e){return this._simulator.getConfig(e).wait&&{element:e,type:"continue",interrupting:!1,boundary:!1}};Ln.prototype._getMessageContexts=function(e,t=null){const n=t?r=>r.referencePoint.x>t.x:()=>!0,i=(r,o)=>r.referencePoint.x-o.referencePoint.x;return[...e.incoming.filter(Cl).map(r=>({incoming:r,referencePoint:MT(r.waypoints)})),...e.outgoing.filter(Cl).map(r=>({outgoing:r,referencePoint:IT(r.waypoints)}))].sort(i).filter(n)};Ln.prototype._triggerMessages=function(e){const{element:t,initiator:n,scope:i}=e;let r=i.messageContexts;r||(r=i.messageContexts=this._getMessageContexts(t));const o=n&&n.element;if(!(Cl(o)&&i.expectedIncoming!==o))for(;r.length;){const{incoming:a,outgoing:s}=r.shift();if(a){if(!n)continue;return i.expectedIncoming=a,{element:t,type:"message",name:a.id,interrupting:!1,boundary:!1}}this._simulator.signal({element:s})}};function IT(e){return e&&e[0]}function MT(e){return e&&e[e.length-1]}function Hi(e,t,n,i,r){this._simulator=e,this._activityBehavior=t,this._scopeBehavior=n,this._transactionBehavior=i,this._elementRegistry=r,e.registerBehavior("bpmn:SubProcess",this),e.registerBehavior("bpmn:Transaction",this),e.registerBehavior("bpmn:AdHocSubProcess",this)}Hi.$inject=["simulator","activityBehavior","scopeBehavior","transactionBehavior","elementRegistry"];Hi.prototype.signal=function(e){this._start(e)};Hi.prototype.enter=function(e){const{element:t}=e,n=this._activityBehavior.waitAtElement(t);if(n)return this._activityBehavior.signalOnEvent(e,n);this._start(e)};Hi.prototype.exit=function(e){const{scope:t}=e,n=t.parent;n.failInitiator===t&&n.complete(),this._activityBehavior.exit(e)};Hi.prototype._start=function(e){const{element:t,startEvent:n,scope:i}=e,r=i.parent;if(ei(t)){if(!n)throw new Error("missing <startEvent>: required for event sub-process")}else if(n)throw new Error("unexpected <startEvent>: not allowed for sub-process");if(r.destroyed)throw new Error(`target scope <${r.id}> destroyed`);DT(t)&&this._transactionBehavior.setup(e),n&&iy(n)&&this._scopeBehavior.interrupt(r,i);const o=this._findStarts(t,n);for(const a of o)Di(a)?this._simulator.signal({element:a,parentScope:i,initiator:i}):this._simulator.enter({element:a,scope:i,initiator:i})};Hi.prototype._findStarts=function(e,t){e=this._elementRegistry.get(e.id+"_plane")||e;const n=t?i=>t===i:i=>ny(i);return e.children.filter(i=>n(i)||Sp(i))};function DT(e){return g(e,"bpmn:Transaction")}const Tl={type:"cancel",interrupting:!0,boundary:!1,persistent:!0};function vi(e,t){this._simulator=e,this._scopeBehavior=t}vi.$inject=["simulator","scopeBehavior"];vi.prototype.setup=function(e){const{scope:t}=e,n=this._simulator.subscribe(t,Tl,o=>(n.remove(),this.cancel({scope:t,initiator:o}))),i={type:"compensate",ref:t.element,persistent:!0,traits:de.NOT_DEAD},r=this._simulator.subscribe(t,i,o=>t.canceled?(r.remove(),this.compensate({scope:t,element:t.element,initiator:o})):this._simulator.trigger({event:Tl,scope:t}))};vi.prototype.cancel=function(e){const{scope:t,initiator:n}=e;if(!t.destroyed)return t.cancel(n),this._simulator.trigger({event:{type:"compensate",ref:t.element},initiator:n,scope:t}),this._simulator.trigger({scope:t,initiator:n,event:Tl})};vi.prototype.registerCompensation=function(e){const{element:t}=e,n=t.children.filter(ei).map(o=>o.children.find(a=>Di(a)&&Za(a))).filter(o=>o),i=t.attachers.filter(Za);if(!n.length&&!i.length)return;const r=this.findTransactionScope(e.parent);g(r.element,"bpmn:Transaction")||this.makeCompensable(r);for(const o of n){const a={element:o,type:"compensate",persistent:!0,interrupting:!0,ref:t,traits:de.NOT_DEAD},s=o.parent,c=this._simulator.subscribe(e,a,l=>(c.remove(),this._simulator.signal({initiator:l,element:s,startEvent:o,parentScope:e})))}for(const o of i){const a={element:o,type:"compensate",persistent:!0,ref:t,traits:de.NOT_DEAD},s=o.outgoing.map(l=>l.target).find(ty);if(!s)continue;const c=this._simulator.subscribe(r,a,l=>(c.remove(),this._simulator.enter({initiator:l,element:s,scope:r})))}};vi.prototype.makeCompensable=function(e){if(e.hasTrait(de.COMPENSABLE)||!e.parent)return;const t={type:"compensate",ref:e.element,interrupting:!0,persistent:!0,traits:de.NOT_DEAD};e.compensable();const n=this._simulator.subscribe(e,t,o=>(n.remove(),e.fail(o),this.compensate({scope:e,element:e.element,initiator:o}),this._scopeBehavior.tryExit(e,o),e)),i=e.parent;if(!i)return;const r=this._simulator.subscribe(i,t,o=>(r.remove(),this._simulator.trigger({scope:e,event:t,initiator:o})));this.makeCompensable(i)};vi.prototype.findTransactionScope=function(e){let t=e;for(;t;){const n=t.element;if(g(n,"bpmn:SubProcess")&&!ei(n)||ko(n,["bpmn:Transaction","bpmn:Process","bpmn:Participant"]))return t;t=t.parent}throw kT(e)};vi.prototype.compensate=function(e){const{scope:t,element:n}=e,i=zr(t.subscriptions,a=>Sl({type:"compensate"},a.event)),r=i.filter(a=>a.event.ref===n),o=i.filter(a=>a.event.ref!==n);for(const a of r)this._scopeBehavior.preExit(t,s=>this._simulator.trigger(a));for(const a of o.reverse())this._scopeBehavior.preExit(t,s=>this._simulator.trigger(a))};function kT(e){throw new Error(`no transaction context for <${e.id}>`)}function Gi(e,t){this._simulator=e,this._scopeBehavior=t,e.registerBehavior("bpmn:SequenceFlow",this)}Gi.prototype.enter=function(e){this._simulator.exit(e)};Gi.prototype.exit=function(e){const{element:t,scope:n}=e;this._simulator.enter({element:t.target,scope:n.parent})};Gi.$inject=["simulator","scopeBehavior"];function zi(e){this._simulator=e,e.registerBehavior("bpmn:MessageFlow",this)}zi.$inject=["simulator"];zi.prototype.signal=function(e){this._simulator.exit(e)};zi.prototype.exit=function(e){const{element:t,scope:n}=e,i=t.target,r=wp(i)?i:{type:"message",element:t,name:t.id},o=this._simulator.findSubscription({event:r,elements:[i,i.parent]});o&&this._simulator.trigger({event:r,initiator:n,scope:o.scope})};function le(e,t){return e.type==="label"?!1:(Array.isArray(t)||(t=[t]),t.some(function(n){return g(e,n)}))}function OT(e,t){return Me(z(e).eventDefinitions,n=>le(n,t))}function NT(e,t){return Li(z(e).eventDefinitions,n=>le(n,t))}function Pp(e,t,n){this._simulator=e,this._elementRegistry=t,this._scopeBehavior=n}Pp.$inject=["simulator","elementRegistry","scopeBehavior"];Pp.prototype.get=function(e){const n=Object.entries({"bpmn:LinkEventDefinition":i=>{const{element:r,scope:o}=i,a=Bh(r),s=o.parent,l=s.element.children.filter(u=>ey(u)&&Bh(u).name===a.name);for(const u of l)this._simulator.signal({element:u,parentScope:s,initiator:o})},"bpmn:SignalEventDefinition":i=>{const{element:r,scope:o}=i,a=this._simulator.findSubscriptions({event:r}),s=new Set;for(const c of a){const l=c.scope;s.has(l)||(s.add(l),this._simulator.trigger({event:r,scope:l,initiator:o}))}},"bpmn:EscalationEventDefinition":i=>{const{element:r,scope:o}=i,a=this._simulator.findScopes({subscribedTo:{event:r},trait:de.ACTIVE});let s=o;for(;s=s.parent;)if(a.includes(s)){this._simulator.trigger({event:r,scope:s,initiator:o});break}},"bpmn:ErrorEventDefinition":i=>{const{element:r,scope:o}=i;this._simulator.trigger({event:r,initiator:o,scope:Fc(o)})},"bpmn:TerminateEventDefinition":i=>{const{scope:r}=i;this._scopeBehavior.terminate(r.parent,r)},"bpmn:CancelEventDefinition":i=>{const{scope:r,element:o}=i;this._simulator.trigger({event:o,initiator:r,scope:Fc(r)})},"bpmn:CompensateEventDefinition":i=>{const{scope:r,element:o}=i;return this._simulator.waitForScopes(r,this._simulator.trigger({event:o,scope:Fc(r)}))}}).find(i=>NT(e,i[0]));return n&&n[1]};function Bh(e){return OT(e,"bpmn:LinkEventDefinition")}function Fc(e){for(;ei(e.parent.element);)e=e.parent;return e.parent}const ay={type:"pre-exit",persistent:!0,interrupting:!0,boundary:!1},jc={type:"exit",interrupting:!0,boundary:!1,persistent:!0};function Bn(e){this._simulator=e}Bn.$inject=["simulator"];Bn.prototype.isFinished=function(e,t=null){return t=sy(t),e.children.every(n=>n.destroyed||n.completed||t(n))};Bn.prototype.destroyChildren=function(e,t,n=null){n=sy(n),e.children.filter(i=>!i.destroyed&&!n(i)).map(i=>{this._simulator.destroyScope(i,t)})};Bn.prototype.terminate=function(e,t){this.destroyChildren(e,t),e.terminate(t),this.tryExit(e,t)};Bn.prototype.interrupt=function(e,t){this.destroyChildren(e,t,t),e.fail(t)};Bn.prototype.tryExit=function(e,t){if(!e)throw new Error("missing <scope>");if(t||(t=e),!this.isFinished(e,t))return jc;const n=this._simulator.findSubscriptions({event:ay,scope:e});for(const i of n){const{event:r,scope:o}=i;if(this._simulator.trigger({event:r,scope:o,initiator:t}).length)return jc}this._simulator.trigger({event:jc,scope:e,initiator:t}),this.exit({scope:e,initiator:t})};Bn.prototype.exit=function(e){const{scope:t,initiator:n}=e;if(!n)throw new Error("missing <initiator>");this._simulator.exit({element:t.element,scope:t,initiator:n})};Bn.prototype.preExit=function(e,t){const n=this._simulator.subscribe(e,ay,i=>(n.remove(),t(i)));return n};function sy(e){return typeof e=="function"?e:t=>t===e}function Bo(e,t){this._simulator=e,this._scopeBehavior=t,e.registerBehavior("bpmn:Process",this),e.registerBehavior("bpmn:Participant",this)}Bo.prototype.signal=function(e){const{element:t,startEvent:n,startNodes:i=this._findStarts(t,n),scope:r}=e;if(!i.length)throw new Error("missing <startNodes> or <startEvent>");for(const o of i)Di(o)?this._simulator.signal({element:o,parentScope:r}):this._simulator.enter({element:o,scope:r})};Bo.prototype.exit=function(e){const{scope:t,initiator:n}=e;this._scopeBehavior.destroyChildren(t,n)};Bo.prototype._findStarts=function(e,t){const n=t?i=>t===i:i=>ny(i);return e.children.filter(i=>n(i)||Sp(i))};Bo.$inject=["simulator","scopeBehavior"];const LT={__init__:["startEventBehavior","endEventBehavior","boundaryEventBehavior","intermediateCatchEventBehavior","intermediateThrowEventBehavior","exclusiveGatewayBehavior","parallelGatewayBehavior","eventBasedGatewayBehavior","inclusiveGatewayBehavior","subProcessBehavior","sequenceFlowBehavior","messageFlowBehavior","processBehavior"],startEventBehavior:["type",Zs],endEventBehavior:["type",Oo],boundaryEventBehavior:["type",Js],intermediateCatchEventBehavior:["type",No],intermediateThrowEventBehavior:["type",Lo],exclusiveGatewayBehavior:["type",Qs],parallelGatewayBehavior:["type",ec],eventBasedGatewayBehavior:["type",Tp],inclusiveGatewayBehavior:["type",Nn],activityBehavior:["type",Ln],subProcessBehavior:["type",Hi],sequenceFlowBehavior:["type",Gi],messageFlowBehavior:["type",zi],eventBehaviors:["type",Pp],scopeBehavior:["type",Bn],processBehavior:["type",Bo],transactionBehavior:["type",vi]},BT=5e3,cy={__depends__:[LT],__init__:[["eventBus","simulator",function(e,t){e.on(["tokenSimulation.toggleMode","tokenSimulation.resetSimulation"],BT,n=>{t.reset()})}]],simulator:["type",ry]};function tc(e,t){e.invoke(zi,this),this._animation=t}q(tc,zi);tc.$inject=["injector","animation"];tc.prototype.signal=function(e){const{element:t,scope:n}=e;this._animation.animate(t,n,()=>{zi.prototype.signal.call(this,e)})};function nc(e,t){e.invoke(Gi,this),this._animation=t}q(nc,Gi);nc.$inject=["injector","animation"];nc.prototype.enter=function(e){const{element:t,scope:n}=e;this._animation.animate(t,n,()=>{Gi.prototype.enter.call(this,e)})};const $T={sequenceFlowBehavior:["type",nc],messageFlowBehavior:["type",tc]},tt="tokenSimulation.toggleMode",ly="tokenSimulation.playSimulation",uy="tokenSimulation.pauseSimulation",$n="tokenSimulation.resetSimulation",FT="tokenSimulation.animationCreated",py="tokenSimulation.animationSpeedChanged",fy="tokenSimulation.simulator.elementChanged",$o="tokenSimulation.simulator.destroyScope",jT="tokenSimulation.simulator.scopeChanged",Vi="tokenSimulation.simulator.createScope",Tr="tokenSimulation.scopeFilterChanged",dy="tokenSimulation.simulator.trace",$h=e=>!0;function Fo(e,t){this._eventBus=e,this._simulator=t,this._filter=$h,e.on([tt,$n],()=>{this._filter=$h}),e.on($o,n=>{const{scope:i}=n;this._scope===i&&i.parent&&this.toggle(i.parent)}),e.on(Vi,n=>{const{scope:i}=n;!i.parent&&this._scope&&!hy(this._scope,i)&&this.toggle(null)})}Fo.prototype.toggle=function(e){const t=this._scope!==e;this._scope=t?e:null,this._filter=this._scope?n=>hy(this._scope,n):n=>!0,this._eventBus.fire(Tr,{filter:this._filter,scope:this._scope})};Fo.prototype.isShown=function(e){return typeof e=="string"&&(e=this._simulator.findScope(t=>t.id===e)),e&&this._filter(e)};Fo.prototype.findScope=function(e){return this._simulator.findScopes(e).filter(t=>this.isShown(t))[0]};Fo.$inject=["eventBus","simulator"];function hy(e,t){do if(e===t)return!0;while(t=t.parent);return!1}const Pr={scopeFilter:["type",Fo]},Ue={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Ue.td=Ue.th=[3,"<table><tbody><tr>","</tr></tbody></table>"];Ue.option=Ue.optgroup=[1,'<select multiple="multiple">',"</select>"];Ue.thead=Ue.tbody=Ue.colgroup=Ue.caption=Ue.tfoot=[1,"<table>","</table>"];Ue.polyline=Ue.ellipse=Ue.polygon=Ue.circle=Ue.text=Ue.line=Ue.path=Ue.rect=Ue.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function HT(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=new RegExp("^<!--(.*?)-->$","s").exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:p}=u;return p.remove(),p}let[r,o,a]=Object.hasOwn(Ue,i)?Ue[i]:Ue._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}var GT=HT;const yt=Vl(GT);function zT(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}const VT=Object.prototype.toString;function _e(e){return new ti(e)}function ti(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}ti.prototype.add=function(e){return this.list.add(e),this};ti.prototype.remove=function(e){return VT.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)};ti.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this};ti.prototype.toggle=function(e,t){return typeof t!="undefined"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this};ti.prototype.array=function(){return Array.from(this.list)};ti.prototype.has=ti.prototype.contains=function(e){return this.list.contains(e)};function UT(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function WT(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}var Ja={},Qa,Pl,Rp;function my(){Qa=window.addEventListener?"addEventListener":"attachEvent",Pl=window.removeEventListener?"removeEventListener":"detachEvent",Rp=Qa!=="addEventListener"?"on":""}var YT=Ja.bind=function(e,t,n,i){return Qa||my(),e[Qa](Rp+t,n,i||!1),n},qT=Ja.unbind=function(e,t,n,i){return Pl||my(),e[Pl](Rp+t,n,i||!1),n},Dt=zT({__proto__:null,bind:YT,default:Ja,unbind:qT},[Ja]),vy=["focus","blur"];function KT(e,t,n,i,r){return vy.indexOf(n)!==-1&&(r=!0),Dt.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=WT(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function XT(e,t,n,i){return vy.indexOf(t)!==-1&&(i=!0),Dt.unbind(e,t,n,i)}var gy={bind:KT,unbind:XT};function Xn(e,t){return t=t||document,t.querySelector(e)}function hr(e,t){return t=t||document,t.querySelectorAll(e)}const yy=getComputedStyle(document.documentElement),ZT=yy.getPropertyValue("--token-simulation-green-base-44"),JT=yy.getPropertyValue("--token-simulation-white");function QT(){}function eP(e,t){return t.length===2?rP:e===1?nP:e===t.length-1?iP:tP}const tP=function(e){return e},nP=function(e){return-Math.cos(e*Math.PI/2)+1},iP=function(e){return Math.sin(e*Math.PI/2)},rP=function(e){return-Math.cos(e*Math.PI)/2+.5},Yr=20;function Bt(e,t,n,i){this._eventBus=n,this._scopeFilter=i,this._canvas=t,this._randomize=e&&e.randomize!==!1,this._animations=new Set,this._speed=1,n.on($n,()=>{this.clearAnimations()}),n.on(uy,()=>{this.pause()}),n.on(ly,()=>{this.play()}),n.on(Tr,r=>{this.each(o=>{this._scopeFilter.isShown(o.scope)?o.show():o.hide()})}),n.on($o,r=>{const{scope:o}=r;this.clearAnimations(o)})}Bt.prototype.animate=function(e,t,n){this.createAnimation(e,t,n)};Bt.prototype.pause=function(){this.each(e=>e.pause())};Bt.prototype.play=function(){this.each(e=>e.play())};Bt.prototype.each=function(e){this._animations.forEach(e)};Bt.prototype.createAnimation=function(e,t,n=QT){const i=this._getGroup(t);if(!i)return;const r=this._createTokenGfx(i,t),o=new nn(r,e.waypoints,this._randomize,()=>{this._animations.delete(o),n()});return o.setSpeed(this.getAnimationSpeed()),this._scopeFilter.isShown(t)||o.hide(),o.scope=t,o.element=e,this._animations.add(o),this._eventBus.fire(FT,{animation:o}),o.play(),o};Bt.prototype.setAnimationSpeed=function(e){this._speed=e,this.each(t=>t.setSpeed(e)),this._eventBus.fire(py,{speed:e})};Bt.prototype.getAnimationSpeed=function(){return this._speed};Bt.prototype.clearAnimations=function(e){this.each(t=>{(!e||t.scope===e)&&t.remove()})};Bt.prototype._createTokenGfx=function(e,t){const n=yp(this._getTokenSVG(t).trim());return Ug(n,e)};Bt.prototype._getTokenSVG=function(e){const t=e.colors||{primary:ZT,auxiliary:JT};return`
<g class="bts-token">
<circle
class="bts-circle"
r="${Yr/2}"
cx="${Yr/2}"
cy="${Yr/2}"
fill="${t.primary}"
/>
<text
class="bts-text"
transform="translate(10, 14)"
text-anchor="middle"
fill="${t.auxiliary}"
>1</text>
</g>
`};Bt.prototype._getGroup=function(e){var t=this._canvas,n,i;"findRoot"in t?(i=t.findRoot(e.element),n=t._findPlaneForRoot(i).layer):n=Xn(".viewport",t._svg);var r=Xn(".bts-animation-tokens",n);return r||(r=yp('<g class="bts-animation-tokens" />'),Ug(r,n)),r};Bt.$inject=["config.animation","canvas","eventBus","scopeFilter"];function nn(e,t,n,i){this.gfx=e,this.waypoints=t,this.done=i,this.randomize=n,this._paused=!0,this._t=0,this._parts=[],this.create()}nn.prototype.pause=function(){this._paused=!0};nn.prototype.play=function(){this._paused&&(this._paused=!1,this.tick(0)),this.schedule()};nn.prototype.schedule=function(){if(this._paused||this._scheduled)return;const e=Date.now();this._scheduled=!0,requestAnimationFrame(()=>{this._scheduled=!1,!this._paused&&(this.tick((Date.now()-e)*this._speed),this.schedule())})};nn.prototype.tick=function(e){const t=this._t=this._t+e,n=this._parts.find(s=>s.startTime<=t&&s.endTime>t);if(!n)return this.remove();const i=t-n.startTime,r=n.length*n.easing(i/n.duration),o=n.startLength+r,a=this._path.getPointAtLength(o);this.move(a.x,a.y)};nn.prototype.move=function(e,t){rr(this.gfx,"transform",`translate(${e}, ${t})`)};nn.prototype.create=function(){const e=this.waypoints,t=e.reduce((o,a,s)=>{const c=e[s-1];if(c){const l=o[o.length-1],u=l&&l.endLength||0,p=sP(c,a);o.push({startLength:u,endLength:u+p,length:p,easing:eP(s,e)})}return o},[]),n=t.reduce(function(o,a){return o+a.length},0),i=e.reduce((o,a,s)=>{const c=a.x-Yr/2,l=a.y-Yr/2;return o.push([s>0?"L":"M",c,l]),o},[]).flat().join(" "),r=oP(n,this._randomize);this._parts=t.reduce((o,a,s)=>{const c=r/n*a.length,l=s>0?o[s-1].endTime:0,u=l+c;return[...o,Pe(te({},a),{startTime:l,endTime:u,duration:c})]},[]),this._path=yp(`<path d="${i}" />`),this._t=0};nn.prototype.show=function(){rr(this.gfx,"display","")};nn.prototype.hide=function(){rr(this.gfx,"display","none")};nn.prototype.remove=function(){this.pause(),cT(this.gfx),this.done()};nn.prototype.setSpeed=function(e){this._speed=e};function oP(e,t=!1){return Math.log(e)*(t?aP(250,300):250)}function aP(e,t){return e+Math.floor(Math.random()*(t-e))}function sP(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}const cP={__depends__:[cy,$T,Pr],animation:["type",Bt]};var Rl={exports:{}};(function(e,t){(function(n,i){{var r=i();e&&e.exports&&(t=e.exports=r),t.randomColor=r}})(eb,function(){var n=null,i={};E();var r=[],o=function(C){if(C=C||{},C.seed!==void 0&&C.seed!==null&&C.seed===parseInt(C.seed,10))n=C.seed;else if(typeof C.seed=="string")n=P(C.seed);else{if(C.seed!==void 0&&C.seed!==null)throw new TypeError("The seed value must be an integer or string");n=null}var I,T,k;if(C.count!==null&&C.count!==void 0){for(var B=C.count,K=[],Z=0;Z<C.count;Z++)r.push(!1);for(C.count=null;B>K.length;){var Ae=o(C);n!==null&&(C.seed=n),K.push(Ae)}return C.count=B,K}return I=a(C),T=s(I,C),k=c(I,T,C),l([I,T,k],C)};function a(C){if(r.length>0){var I=A(C.hue),T=h(I),k=(I[1]-I[0])/r.length,B=parseInt((T-I[0])/k);r[B]===!0?B=(B+2)%r.length:r[B]=!0;var K=(I[0]+B*k)%359,Z=(I[0]+(B+1)*k)%359;return I=[K,Z],T=h(I),T<0&&(T=360+T),T}else{var I=p(C.hue);return T=h(I),T<0&&(T=360+T),T}}function s(C,I){if(I.hue==="monochrome")return 0;if(I.luminosity==="random")return h([0,100]);var T=f(C),k=T[0],B=T[1];switch(I.luminosity){case"bright":k=55;break;case"dark":k=B-10;break;case"light":B=55;break}return h([k,B])}function c(C,I,T){var k=u(C,I),B=100;switch(T.luminosity){case"dark":B=k+20;break;case"light":k=(B+k)/2;break;case"random":k=0,B=100;break}return h([k,B])}function l(C,I){switch(I.format){case"hsvArray":return C;case"hslArray":return x(C);case"hsl":var T=x(C);return"hsl("+T[0]+", "+T[1]+"%, "+T[2]+"%)";case"hsla":var k=x(C),Z=I.alpha||Math.random();return"hsla("+k[0]+", "+k[1]+"%, "+k[2]+"%, "+Z+")";case"rgbArray":return w(C);case"rgb":var B=w(C);return"rgb("+B.join(", ")+")";case"rgba":var K=w(C),Z=I.alpha||Math.random();return"rgba("+K.join(", ")+", "+Z+")";default:return m(C)}}function u(C,I){for(var T=d(C).lowerBounds,k=0;k<T.length-1;k++){var B=T[k][0],K=T[k][1],Z=T[k+1][0],Ae=T[k+1][1];if(I>=B&&I<=Z){var Ye=(Ae-K)/(Z-B),Ie=K-Ye*B;return Ye*I+Ie}}return 0}function p(C){if(typeof parseInt(C)=="number"){var I=parseInt(C);if(I<360&&I>0)return[I,I]}if(typeof C=="string"){if(i[C]){var T=i[C];if(T.hueRange)return T.hueRange}else if(C.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i)){var k=_(C)[0];return[k,k]}}return[0,360]}function f(C){return d(C).saturationRange}function d(C){C>=334&&C<=360&&(C-=360);for(var I in i){var T=i[I];if(T.hueRange&&C>=T.hueRange[0]&&C<=T.hueRange[1])return i[I]}return"Color not found"}function h(C){if(n===null){var I=.618033988749895,T=Math.random();return T+=I,T%=1,Math.floor(C[0]+T*(C[1]+1-C[0]))}else{var k=C[1]||1,B=C[0]||0;n=(n*9301+49297)%233280;var K=n/233280;return Math.floor(B+K*(k-B))}}function m(C){var I=w(C);function T(B){var K=B.toString(16);return K.length==1?"0"+K:K}var k="#"+T(I[0])+T(I[1])+T(I[2]);return k}function v(C,I,T){var k=T[0][0],B=T[T.length-1][0],K=T[T.length-1][1],Z=T[0][1];i[C]={hueRange:I,lowerBounds:T,saturationRange:[k,B],brightnessRange:[K,Z]}}function E(){v("monochrome",null,[[0,0],[100,0]]),v("red",[-26,18],[[20,100],[30,92],[40,89],[50,85],[60,78],[70,70],[80,60],[90,55],[100,50]]),v("orange",[18,46],[[20,100],[30,93],[40,88],[50,86],[60,85],[70,70],[100,70]]),v("yellow",[46,62],[[25,100],[40,94],[50,89],[60,86],[70,84],[80,82],[90,80],[100,75]]),v("green",[62,178],[[30,100],[40,90],[50,85],[60,81],[70,74],[80,64],[90,50],[100,40]]),v("blue",[178,257],[[20,100],[30,86],[40,80],[50,74],[60,60],[70,52],[80,44],[90,39],[100,35]]),v("purple",[257,282],[[20,100],[30,87],[40,79],[50,70],[60,65],[70,59],[80,52],[90,45],[100,42]]),v("pink",[282,334],[[20,100],[30,90],[40,86],[60,84],[80,80],[90,75],[100,73]])}function w(C){var I=C[0];I===0&&(I=1),I===360&&(I=359),I=I/360;var T=C[1]/100,k=C[2]/100,B=Math.floor(I*6),K=I*6-B,Z=k*(1-T),Ae=k*(1-K*T),Ye=k*(1-(1-K)*T),Ie=256,U=256,ie=256;switch(B){case 0:Ie=k,U=Ye,ie=Z;break;case 1:Ie=Ae,U=k,ie=Z;break;case 2:Ie=Z,U=k,ie=Ye;break;case 3:Ie=Z,U=Ae,ie=k;break;case 4:Ie=Ye,U=Z,ie=k;break;case 5:Ie=k,U=Z,ie=Ae;break}var fe=[Math.floor(Ie*255),Math.floor(U*255),Math.floor(ie*255)];return fe}function _(C){C=C.replace(/^#/,""),C=C.length===3?C.replace(/(.)/g,"$1$1"):C;var I=parseInt(C.substr(0,2),16)/255,T=parseInt(C.substr(2,2),16)/255,k=parseInt(C.substr(4,2),16)/255,B=Math.max(I,T,k),K=B-Math.min(I,T,k),Z=B?K/B:0;switch(B){case I:return[60*((T-k)/K%6)||0,Z,B];case T:return[60*((k-I)/K+2)||0,Z,B];case k:return[60*((I-T)/K+4)||0,Z,B]}}function x(C){var I=C[0],T=C[1]/100,k=C[2]/100,B=(2-T)*k;return[I,Math.round(T*k/(B<1?B:2-B)*1e4)/100,B/2*100]}function P(C){for(var I=0,T=0;T!==C.length&&!(I>=Number.MAX_SAFE_INTEGER);T++)I+=C.charCodeAt(T);return I}function A(C){if(isNaN(C)){if(typeof C=="string"){if(i[C]){var T=i[C];if(T.hueRange)return T.hueRange}else if(C.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i)){var k=_(C)[0];return d(k).hueRange}}}else{var I=parseInt(C);if(I<360&&I>0)return d(C).hueRange}return[0,360]}return o})})(Rl,Rl.exports);var lP=Rl.exports;const uP=Vl(lP),pP=1500;function _y(e){const t=uP({count:60}).filter(o=>n(o.substring(1))<200);function n(o){var a=parseInt(o.substr(0,2),16),s=parseInt(o.substr(2,2),16),c=parseInt(o.substr(4,2),16),l=(a*299+s*587+c*114)/1e3;return l}let i=0;function r(o){const{element:a}=o;if(a&&a.type==="bpmn:MessageFlow")return{primary:"#999",auxiliary:"#FFF"};if(o.parent)return o.parent.colors;const s=t[i++%t.length];return{primary:s,auxiliary:n(s)>=128?"#111":"#fff"}}e.on(Vi,pP,o=>{const{scope:a}=o;a.colors=r(a)})}_y.$inject=["eventBus"];const fP={__init__:["coloredScopes"],coloredScopes:["type",_y]};var dP='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="currentColor" d="M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"/></svg>',hP='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="currentColor" d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"/></svg>',mP='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="currentColor" d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"/></svg>',vP='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="currentColor" d="M384 144c0-44.2-35.8-80-80-80s-80 35.8-80 80c0 36.4 24.3 67.1 57.5 76.8-.6 16.1-4.2 28.5-11 36.9-15.4 19.2-49.3 22.4-85.2 25.7-28.2 2.6-57.4 5.4-81.3 16.9v-144c32.5-10.2 56-40.5 56-76.3 0-44.2-35.8-80-80-80S0 35.8 0 80c0 35.8 23.5 66.1 56 76.3v199.3C23.5 365.9 0 396.2 0 432c0 44.2 35.8 80 80 80s80-35.8 80-80c0-34-21.2-63.1-51.2-74.6 3.1-5.2 7.8-9.8 14.9-13.4 16.2-8.2 40.4-10.4 66.1-12.8 42.2-3.9 90-8.4 118.2-43.4 14-17.4 21.1-39.8 21.6-67.9 31.6-10.8 54.4-40.7 54.4-75.9zM80 64c8.8 0 16 7.2 16 16s-7.2 16-16 16-16-7.2-16-16 7.2-16 16-16zm0 384c-8.8 0-16-7.2-16-16s7.2-16 16-16 16 7.2 16 16-7.2 16-16 16zm224-320c8.8 0 16 7.2 16 16s-7.2 16-16 16-16-7.2-16-16 7.2-16 16-16z"/></svg>',gP='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="currentColor" d="M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"/></svg>',yP='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="currentColor" d="M20 424.229h20V279.771H20c-11.046 0-20-8.954-20-20V212c0-11.046 8.954-20 20-20h112c11.046 0 20 8.954 20 20v212.229h20c11.046 0 20 8.954 20 20V492c0 11.046-8.954 20-20 20H20c-11.046 0-20-8.954-20-20v-47.771c0-11.046 8.954-20 20-20zM96 0C56.235 0 24 32.235 24 72s32.235 72 72 72 72-32.235 72-72S135.764 0 96 0z"/></svg>',_P='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="currentColor" d="M144 479H48c-26.5 0-48-21.5-48-48V79c0-26.5 21.5-48 48-48h96c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48zm304-48V79c0-26.5-21.5-48-48-48h-96c-26.5 0-48 21.5-48 48v352c0 26.5 21.5 48 48 48h96c26.5 0 48-21.5 48-48z"/></svg>',bP=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 580.5 448">
<path fill="currentColor" d="M112 0C85 0 64 22 64 48v196l192-89V48c0-26-22-48-48-48zm256 0c-27 0-48 22-48 48v77l190-89c-5-21-24-36-46-36Zm144 105-192 89v70l192-89zM256 224 64 314v70l192-90zm256 21-192 89v66c0 27 21 48 48 48h96c26 0 48-21 48-48zM256 364 89 442c7 4 14 6 23 6h96c26 0 48-21 48-48z"/>
<rect fill="currentColor" width="63.3" height="618.2" x="311.5" y="-469.4" transform="rotate(65)" rx="10"/>
</svg>
`,EP='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Adapted from Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="currentColor" d="M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"/></svg>',xP='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="currentColor" d="M440.65 12.57l4 82.77A247.16 247.16 0 0 0 255.83 8C134.73 8 33.91 94.92 12.29 209.82A12 12 0 0 0 24.09 224h49.05a12 12 0 0 0 11.67-9.26 175.91 175.91 0 0 1 317-56.94l-101.46-4.86a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12H500a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12h-47.37a12 12 0 0 0-11.98 12.57zM255.83 432a175.61 175.61 0 0 1-146-77.8l101.8 4.87a12 12 0 0 0 12.57-12v-47.4a12 12 0 0 0-12-12H12a12 12 0 0 0-12 12V500a12 12 0 0 0 12 12h47.35a12 12 0 0 0 12-12.6l-4.15-82.57A247.17 247.17 0 0 0 255.83 504c121.11 0 221.93-86.92 243.55-201.82a12 12 0 0 0-11.8-14.18h-49.05a12 12 0 0 0-11.67 9.26A175.86 175.86 0 0 1 255.83 432z"/></svg>',wP='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="currentColor" d="M288 32C128.94 32 0 160.94 0 320c0 52.8 14.25 102.26 39.06 144.8 5.61 9.62 16.3 15.2 27.44 15.2h443c11.14 0 21.83-5.58 27.44-15.2C561.75 422.26 576 372.8 576 320c0-159.06-128.94-288-288-288zm0 64c14.71 0 26.58 10.13 30.32 23.65-1.11 2.26-2.64 4.23-3.45 6.67l-9.22 27.67c-5.13 3.49-10.97 6.01-17.64 6.01-17.67 0-32-14.33-32-32S270.33 96 288 96zM96 384c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32zm48-160c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32zm246.77-72.41l-61.33 184C343.13 347.33 352 364.54 352 384c0 11.72-3.38 22.55-8.88 32H232.88c-5.5-9.45-8.88-20.28-8.88-32 0-33.94 26.5-61.43 59.9-63.59l61.34-184.01c4.17-12.56 17.73-19.45 30.36-15.17 12.57 4.19 19.35 17.79 15.17 30.36zm14.66 57.2l15.52-46.55c3.47-1.29 7.13-2.23 11.05-2.23 17.67 0 32 14.33 32 32s-14.33 32-32 32c-11.38-.01-20.89-6.28-26.57-15.22zM480 384c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32z"/></svg>',SP='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="currentColor" d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z"/></svg>',CP='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"/></svg>',TP='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="currentColor" d="M384 64H192C85.961 64 0 149.961 0 256s85.961 192 192 192h192c106.039 0 192-85.961 192-192S490.039 64 384 64zM64 256c0-70.741 57.249-128 128-128 70.741 0 128 57.249 128 128 0 70.741-57.249 128-128 128-70.741 0-128-57.249-128-128zm320 128h-48.905c65.217-72.858 65.236-183.12 0-256H384c70.741 0 128 57.249 128 128 0 70.74-57.249 128-128 128z"/></svg>',PP='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="currentColor" d="M384 64H192C86 64 0 150 0 256s86 192 192 192h192c106 0 192-86 192-192S490 64 384 64zm0 320c-70.8 0-128-57.3-128-128 0-70.8 57.3-128 128-128 70.8 0 128 57.3 128 128 0 70.8-57.3 128-128 128z"/></svg>';function xt(e){return function(n=""){return`<span class="bts-icon ${n}">${e}</span>`}}const Fh=xt(dP),RP=xt(hP),Al=xt(mP),AP=xt(bP),by=xt(vP),Ey=xt(gP),xy=xt(yP),Il=xt(_P),wy=xt(EP),IP=xt(xP),MP=xt(wP),DP=xt(SP),kP=xt(CP),Sy=xt(TP),OP=xt(PP);function Ap(e){this._exclusiveGatewaySettings=e}Ap.prototype.createContextPads=function(e){if(e.outgoing.filter(function(r){return le(r,"bpmn:SequenceFlow")}).length<2)return;const n=`
<div class="bts-context-pad" title="Set Sequence Flow">
${by()}
</div>
`;return[{action:()=>{this._exclusiveGatewaySettings.setSequenceFlow(e)},element:e,html:n}]};Ap.$inject=["exclusiveGatewaySettings"];function Ip(e){this._inclusiveGatewaySettings=e}Ip.prototype.createContextPads=function(e){const t=e.outgoing.filter(mi);if(t.length<2)return;const n=t.filter(r=>{const o=z(r);return z(e).default!==o}),i=`
<div class="bts-context-pad" title="Set Sequence Flow">
${by()}
</div>
`;return n.map(r=>({action:()=>{this._inclusiveGatewaySettings.toggleSequenceFlow(e,r)},element:r,html:i}))};Ip.$inject=["inclusiveGatewaySettings"];function Ui(e){this._simulator=e}Ui.prototype.createContextPads=function(e){return le(e,"bpmn:ReceiveTask")||le(e,"bpmn:SubProcess")&&z(e).triggeredByEvent?[]:[this.createPauseContextPad(e)]};Ui.prototype.createPauseContextPad=function(e){const t=()=>this._findSubscriptions({element:e}),n=this._isPaused(e),i=`
<div class="bts-context-pad ${n?"":"show-hover"}" title="${n?"Remove":"Add"} pause point">
${(n?AP:Il)("show-hover")}
${Il("hide-hover")}
</div>
`;return{action:()=>{this._togglePaused(e)},element:e,hideContexts:t,html:i}};Ui.prototype._isPaused=function(e){const{wait:t}=this._simulator.getConfig(e);return t};Ui.prototype._togglePaused=function(e){const t=!this._isPaused(e);this._simulator.waitAtElement(e,t)};Ui.prototype._findSubscriptions=function(e){return this._simulator.findSubscriptions(e)};Ui.$inject=["simulator"];function ki(e){this._simulator=e}ki.$inject=["simulator"];ki.prototype.createContextPads=function(e){return[this.createTriggerContextPad(e)]};ki.prototype.createTriggerContextPad=function(e){const t=()=>this._findSubscriptions({element:e}).slice().sort((a,s)=>a.event.type==="none"?1:-1),n=`
<div class="bts-context-pad" title="Trigger Event">
${wy()}
</div>
`;return{action:r=>{const{event:o,scope:a}=r[0];return this._simulator.trigger({event:o,scope:a})},element:e,html:n,contexts:t}};ki.prototype._findSubscriptions=function(e){return this._simulator.findSubscriptions(e)};const Hc=500,NP=-15,LP=-15;function Xt(e,t,n,i,r,o){this._elementRegistry=t,this._overlays=n,this._injector=i,this._canvas=r,this._scopeFilter=o,this._overlayCache=new Map,this._handlerIdx=0,this._handlers=[],this.registerHandler("bpmn:ExclusiveGateway",Ap),this.registerHandler("bpmn:InclusiveGateway",Ip),this.registerHandler("bpmn:Activity",Ui),this.registerHandler("bpmn:Event",ki),this.registerHandler("bpmn:Gateway",ki),this.registerHandler("bpmn:Activity",ki),e.on(tt,Hc,a=>{a.active?this.openContextPads():this.closeContextPads()}),e.on($n,Hc,()=>{this.closeContextPads(),this.openContextPads()}),e.on(Tr,a=>{const s=hr(".djs-overlay-ts-context-menu [data-scope-ids]",n._overlayRoot);for(const l of s){const p=l.dataset.scopeIds.split(",").some(f=>o.isShown(f));_e(l).toggle("hidden",!p)}const c=hr(".djs-overlay-ts-context-menu [data-hide-scope-ids]",n._overlayRoot);for(const l of c){const p=l.dataset.hideScopeIds.split(",").some(f=>o.isShown(f));_e(l).toggle("hidden",p)}}),e.on(fy,Hc,a=>{const{element:s}=a;this.updateElementContextPads(s)})}Xt.prototype.registerHandler=function(e,t){const n=this._injector.instantiate(t);n.hash=String(this._handlerIdx++),this._handlers.push({handler:n,type:e})};Xt.prototype.getHandlers=function(e){return this._handlers.filter(({type:t})=>le(e,t)).map(({handler:t})=>t)};Xt.prototype.openContextPads=function(e){e||(e=this._canvas.getRootElement()),this._elementRegistry.forEach(t=>{BP(e,t)&&this.updateElementContextPads(t)})};Xt.prototype._getOverlays=function(e){return this._overlayCache.get(e)||[]};Xt.prototype._addOverlay=function(e,t){const{handlerHash:n}=t;if(!n)throw new Error("<handlerHash> required");const i=this._overlays.add(e,"bts-context-menu",Pe(te({},t),{position:{top:NP,left:LP},show:{minZoom:.5}})),r=this._overlays.get(i),o=this._overlayCache;o.has(n)||o.set(n,[]),o.get(n).push(r)};Xt.prototype._removeOverlay=function(e){const{id:t,handlerHash:n}=e;this._overlays.remove(t);const i=this._overlayCache.get(n)||[],r=i.indexOf(e);r!==-1&&i.splice(r,1)};Xt.prototype.updateElementContextPads=function(e){for(const t of this.getHandlers(e))this._updateElementContextPads(e,t)};Xt.prototype._updateElementContextPads=function(e,t){const n=(t.createContextPads(e)||[]).filter(a=>a),i=`${e.id}------${t.hash}`,r=this._getOverlays(i),o=[];for(const a of n){const{element:s,contexts:c,hideContexts:l,action:u,html:p}=a,f=`${a.element.id}-------${p}`;let d=r.find(m=>m.hash===f);const h=d&&d.html||yt(p);if(c){const m=c();h.dataset.scopeIds=m.map(E=>E.scope.id).join(",");const v=m.filter(E=>this._scopeFilter.isShown(E.scope));_e(h).toggle("hidden",v.length===0)}if(l){const m=l();h.dataset.hideScopeIds=m.map(E=>E.scope.id).join(",");const v=m.filter(E=>this._scopeFilter.isShown(E.scope));_e(h).toggle("hidden",v.length>0)}if(d){o.push(d);continue}u&&Dt.bind(h,"click",m=>{m.preventDefault();const v=c?c().filter(E=>this._scopeFilter.isShown(E.scope)):null;u(v)}),this._addOverlay(s,{hash:f,handlerHash:i,html:h})}for(const a of r)o.includes(a)||this._removeOverlay(a)};Xt.prototype.closeContextPads=function(){for(const e of this._overlayCache.values())for(const t of e)this._closeOverlay(t);this._overlayCache.clear()};Xt.prototype._closeOverlay=function(e){this._overlays.remove(e.id)};Xt.$inject=["eventBus","elementRegistry","overlays","injector","canvas","scopeFilter"];function BP(e,t){do{if(e===t)return!0;t=t.parent}while(t);return!1}const $P={__depends__:[Pr],__init__:["contextPads"],contextPads:["type",Xt]};function Cy(e,t,n){e.on($o,i=>{const{scope:r}=i,{destroyInitiator:o,element:a}=r;!r.completed||!o||!["bpmn:Process","bpmn:Participant"].includes(a.type)||n.addElementNotification(o.element,{type:"success",icon:Al(),text:"Finished",scope:r})})}Cy.$inject=["eventBus","simulator","elementNotifications"];const FP=-15,jP=15;function jo(e,t){this._overlays=e,t.on([$n,Vi,tt],()=>{this.clear()})}jo.prototype.addElementNotification=function(e,t){const n={top:FP,right:jP},{type:i,icon:r,text:o,scope:a={}}=t,s=a.colors,c=s?`style="color: ${s.auxiliary}; background: ${s.primary}"`:"",l=yt(`
<div class="bts-element-notification ${i||""}" ${c}>
${r||""}
<span class="bts-text">${o}</span>
</div>
`);this._overlays.add(e,"bts-element-notification",{position:n,html:l,show:{minZoom:.5}})};jo.prototype.clear=function(){this._overlays.remove({type:"bts-element-notification"})};jo.prototype.removeElementNotification=function(e){this._overlays.remove({element:e})};jo.$inject=["overlays","eventBus"];const Ty={elementNotifications:["type",jo]},HP=2e3,GP=xy();function Ho(e,t,n){this._eventBus=e,this._canvas=t,this._scopeFilter=n,this._init(),e.on([tt,$n],i=>{this.clear()})}Ho.prototype._init=function(){this.container=yt('<div class="bts-notifications"></div>'),this._canvas.getContainer().appendChild(this.container)};Ho.prototype.showNotification=function(e){const{text:t,type:n="info",icon:i=GP,scope:r,ttl:o=HP}=e;if(r&&!this._scopeFilter.isShown(r))return;const a=i.startsWith("<")?i:`<i class="${i}"></i>`,s=r&&r.colors,c=s?`style="color: ${s.auxiliary}; background: ${s.primary}"`:"",l=yt(`
<div class="bts-notification ${n}">
<span class="bts-icon">${a}</span>
<span class="bts-text" title="${t}">${t}</span>
${r?`<span class="bts-scope" ${c}>${r.id}</span>`:""}
</div>
`);for(this.container.appendChild(l);this.container.children.length>5;)this.container.children[0].remove();setTimeout(function(){l.remove()},o)};Ho.prototype.clear=function(){for(;this.container.children.length;)this.container.children[0].remove()};Ho.$inject=["eventBus","canvas","scopeFilter"];const Go={__depends__:[Pr],notifications:["type",Ho]},zP={__depends__:[Ty,Go],__init__:["simulationState"],simulationState:["type",Cy]},VP="--token-simulation-silver-base-97",UP="--token-simulation-green-base-44",Py="show-scopes",WP=3e3;function Zt(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._scopeFilter=n,this._elementColors=i,this._simulationStyles=r,this._highlight=null,this._init(),e.on(tt,o=>{o.active?_e(this._container).remove("hidden"):(_e(this._container).add("hidden"),UT(this._container),this.unhighlightScope())}),e.on(Tr,o=>{const a=this.getScopeElements();for(const s of a){const c=s.dataset.scopeId;_e(s).toggle("inactive",!this._scopeFilter.isShown(c))}}),e.on(Vi,o=>{this.addScope(o.scope)}),e.on($o,o=>{this.removeScope(o.scope)}),e.on(jT,o=>{this.updateScope(o.scope)}),e.on($n,()=>{this.removeAllInstances()})}Zt.prototype._init=function(){this._container=yt('<div class="bts-scopes hidden"></div>'),this._canvas.getContainer().appendChild(this._container)};Zt.prototype.addScope=function(e){const t=["bpmn:Process","bpmn:SubProcess","bpmn:Participant"],{element:n}=e;if(!t.includes(n.type))return;const i=e.colors,r=i?`style="color: ${i.auxiliary}; background: ${i.primary}"`:"",o=yt(`
<div data-scope-id="${e.id}" class="bts-scope"
title="View Process Instance ${e.id}" ${r}>
${e.getTokens()}
</div>
`);Dt.bind(o,"click",()=>{this._scopeFilter.toggle(e)}),Dt.bind(o,"mouseenter",()=>{this.highlightScope(n)}),Dt.bind(o,"mouseleave",()=>{this.unhighlightScope()}),this._scopeFilter.isShown(e)||_e(o).add("inactive"),this._container.appendChild(o)};Zt.prototype.getScopeElements=function(){return hr("[data-scope-id]",this._container)};Zt.prototype.getScopeElement=function(e){return Xn(`[data-scope-id="${e.id}"]`,this._container)};Zt.prototype.updateScope=function(e){const t=this.getScopeElement(e);t&&(t.textContent=e.getTokens())};Zt.prototype.removeScope=function(e){const t=this.getScopeElement(e);t&&t.remove()};Zt.prototype.removeAllInstances=function(){this._container.innerHTML=""};Zt.prototype.highlightScope=function(e){this.unhighlightScope(),this._highlight=e,this._elementColors.add(e,Py,this._getHighlightColors(),WP),e.parent||_e(this._canvas.getContainer()).add("highlight")};Zt.prototype.unhighlightScope=function(){if(!this._highlight)return;const e=this._highlight;this._elementColors.remove(e,Py),e.parent||_e(this._canvas.getContainer()).remove("highlight"),this._highlight=null};Zt.prototype._getHighlightColors=function(){return{fill:this._simulationStyles.get(VP),stroke:this._simulationStyles.get(UP)}};Zt.$inject=["eventBus","canvas","scopeFilter","elementColors","simulationStyles"];function ic(){this._cache={}}ic.$inject=[];ic.prototype.get=function(e){const t=this._cache[e];return t||(this._computedStyle||(this._computedStyle=this._getComputedStyle()),this._cache[e]=this._computedStyle.getPropertyValue(e).trim())};ic.prototype._getComputedStyle=function(){const e=typeof getComputedStyle=="function"?getComputedStyle:YP,t=typeof document!="undefined"?document.documentElement:{};return e(t)};function YP(){return{getPropertyValue(){return""}}}const rc={simulationStyles:["type",ic]},qP={__depends__:[Pr,rc],__init__:["showScopes"],showScopes:["type",Zt]},KP=xy();function Gc(e){const t=e&&e.businessObject.name;return t&&Xc(t)}function zc(e,t){const n=Ml(e);return n==="none"?"bpmn-icon-intermediate-event-none":`bpmn-icon-intermediate-event-${t}-${n}`}function Ml(e){const t=z(e);if(t.get("eventDefinitions").length===0)return"none";const n=t.eventDefinitions[0];return le(n,"bpmn:MessageEventDefinition")?"message":le(n,"bpmn:TimerEventDefinition")?"timer":le(n,"bpmn:SignalEventDefinition")?"signal":le(n,"bpmn:ErrorEventDefinition")?"error":le(n,"bpmn:EscalationEventDefinition")?"escalation":le(n,"bpmn:CompensateEventDefinition")?"compensation":le(n,"bpmn:ConditionalEventDefinition")?"condition":le(n,"bpmn:LinkEventDefinition")?"link":le(n,"bpmn:CancelEventDefinition")?"cancel":le(n,"bpmn:TerminateEventDefinition")?"terminate":"none"}function Wi(e,t,n,i,r,o){this._notifications=t,this._tokenSimulationPalette=n,this._canvas=i,this._scopeFilter=r,this._init(),e.on(Tr,a=>{const s=hr(".bts-entry[data-scope-id]",this._container);for(const c of s){const l=c.dataset.scopeId;_e(c).toggle("inactive",!this._scopeFilter.isShown(l))}}),e.on($o,a=>{const{scope:s}=a,{element:c}=s,l=s.completed;if(!["bpmn:Process","bpmn:Participant","bpmn:SubProcess"].includes(c.type))return;const f=`${le(c,"bpmn:SubProcess")?Gc(c)||"SubProcess":"Process"} ${l?"finished":"canceled"}`;this.log({text:f,icon:l?Al():DP(),scope:s})}),e.on(Vi,a=>{const{scope:s}=a,{element:c}=s;if(!["bpmn:Process","bpmn:Participant","bpmn:SubProcess"].includes(c.type))return;const p=`${le(c,"bpmn:SubProcess")?Gc(c)||"SubProcess":"Process"} started`;this.log({text:p,icon:Al(),scope:s})}),e.on(dy,a=>{const{action:s,scope:c,element:l}=a;if(s!=="exit")return;const u=c.parent,p=Gc(l);if(le(l,"bpmn:ServiceTask"))return this.log({text:p||"Service Task",icon:"bpmn-icon-service",scope:u});if(le(l,"bpmn:UserTask"))return this.log({text:p||"User Task",icon:"bpmn-icon-user",scope:u});if(le(l,"bpmn:CallActivity"))return this.log({text:p||"Call Activity",icon:"bpmn-icon-call-activity",scope:u});if(le(l,"bpmn:ScriptTask"))return this.log({text:p||"Script Task",icon:"bpmn-icon-script",scope:u});if(le(l,"bpmn:BusinessRuleTask"))return this.log({text:p||"Business Rule Task",icon:"bpmn-icon-business-rule",scope:u});if(le(l,"bpmn:ManualTask"))return this.log({text:p||"Manual Task",icon:"bpmn-icon-manual-task",scope:u});if(le(l,"bpmn:ReceiveTask"))return this.log({text:p||"Receive Task",icon:"bpmn-icon-receive",scope:u});if(le(l,"bpmn:SendTask"))return this.log({text:p||"Send Task",icon:"bpmn-icon-send",scope:u});if(le(l,"bpmn:Task"))return this.log({text:p||"Task",icon:"bpmn-icon-task",scope:u});if(le(l,"bpmn:ExclusiveGateway"))return this.log({text:p||"Exclusive Gateway",icon:"bpmn-icon-gateway-xor",scope:u});if(le(l,"bpmn:ParallelGateway"))return this.log({text:p||"Parallel Gateway",icon:"bpmn-icon-gateway-parallel",scope:u});if(le(l,"bpmn:InclusiveGateway"))return this.log({text:p||"Inclusive Gateway",icon:"bpmn-icon-gateway-or",scope:u});if(le(l,"bpmn:StartEvent"))return this.log({text:p||"Start Event",icon:`bpmn-icon-start-event-${Ml(l)}`,scope:u});if(le(l,"bpmn:IntermediateCatchEvent"))return this.log({text:p||"Intermediate Event",icon:zc(l,"catch"),scope:u});if(le(l,"bpmn:IntermediateThrowEvent"))return this.log({text:p||"Intermediate Event",icon:zc(l,"throw"),scope:u});if(le(l,"bpmn:BoundaryEvent"))return this.log({text:p||"Boundary Event",icon:zc(l,"catch"),scope:u});if(le(l,"bpmn:EndEvent"))return this.log({text:p||"End Event",icon:`bpmn-icon-end-event-${Ml(l)}`,scope:u})}),e.on([tt,$n],a=>{this.clear(),this.toggle(!1)})}Wi.prototype._init=function(){this._container=yt(`
<div class="bts-log hidden djs-scrollable">
<div class="bts-header">
${Fh("bts-log-icon")}
Simulation Log
<button class="bts-close" aria-label="Close">
${kP()}
</button>
</div>
<div class="bts-content">
<p class="bts-entry placeholder">No Entries</p>
</div>
</div>
`),this._placeholder=Xn(".bts-placeholder",this._container),this._content=Xn(".bts-content",this._container),Dt.bind(this._content,"mousedown",e=>{e.stopPropagation()}),this._close=Xn(".bts-close",this._container),Dt.bind(this._close,"click",()=>{this.toggle(!1)}),this._icon=Xn(".bts-log-icon",this._container),Dt.bind(this._icon,"click",()=>{this.toggle()}),this._canvas.getContainer().appendChild(this._container),this.paletteEntry=yt(`
<div class="bts-entry" title="Toggle Simulation Log">
${Fh()}
</div>
`),Dt.bind(this.paletteEntry,"click",()=>{this.toggle()}),this._tokenSimulationPalette.addEntry(this.paletteEntry,3)};Wi.prototype.isShown=function(){const e=this._container;return!_e(e).has("hidden")};Wi.prototype.toggle=function(e=!this.isShown()){const t=this._container;e?_e(t).remove("hidden"):_e(t).add("hidden")};Wi.prototype.log=function(e){const{text:t,type:n="info",icon:i=KP,scope:r}=e,o=this._content;_e(this._placeholder).add("hidden"),this.isShown()||this._notifications.showNotification(e);const a=i.startsWith("<")?i:`<i class="${i}"></i>`,s=r&&r.colors,c=s?`style="background: ${s.primary}; color: ${s.auxiliary}"`:"",l=yt(`
<p class="bts-entry ${n} ${r&&this._scopeFilter.isShown(r)?"":"inactive"}" ${r?`data-scope-id="${r.id}"`:""}>
<span class="bts-icon">${a}</span>
<span class="bts-text" title="${t}">${t}</span>
${r?`<span class="bts-scope" data-scope-id="${r.id}" ${c}>${r.id}</span>`:""}
</p>
`);gy.bind(l,".bts-scope[data-scope-id]","click",p=>{this._scopeFilter.toggle(r)});const u=Math.abs(o.clientHeight+o.scrollTop-o.scrollHeight)<2;o.appendChild(l),u&&(o.scrollTop=o.scrollHeight)};Wi.prototype.clear=function(){for(;this._content.firstChild;)this._content.removeChild(this._content.firstChild);this._placeholder=yt('<p class="bts-entry placeholder">No Entries</p>'),this._content.appendChild(this._placeholder)};Wi.$inject=["eventBus","notifications","tokenSimulationPalette","canvas","scopeFilter","simulator"];const XP={__depends__:[Go,Pr],__init__:["log"],log:["type",Wi]},ZP=["bpmn:ComplexGateway"];function JP(e){return e.labelTarget}function Rr(e,t,n,i,r){this._eventBus=e,this._elementRegistry=t,this._elementNotifications=r,this._notifications=i,this._canvasParent=n.getContainer().parentNode,e.on(tt,o=>{o.active?this.enable():this.clear()})}Rr.prototype.getUnsupportedElements=function(){return this._unsupportedElements};Rr.prototype.enable=function(){const e=[];this._elementRegistry.forEach(t=>{JP(t)||le(t,ZP)&&(this.showWarning(t),e.push(t))}),e.length&&this._notifications.showNotification({text:"Found unsupported elements",icon:Ey(),type:"warning",ttl:5e3}),this._unsupportedElements=e};Rr.prototype.clear=function(){_e(this._canvasParent).remove("warning")};Rr.prototype.showWarning=function(e){this._elementNotifications.addElementNotification(e,{type:"warning",icon:Ey(),text:"Not supported"})};Rr.$inject=["eventBus","elementRegistry","canvas","notifications","elementNotifications"];const QP={__depends__:[Ty,Go],__init__:["elementSupport"],elementSupport:["type",Rr]},Ry=wy(),eR=Il(),jh=1500;function gi(e,t,n,i){this._eventBus=e,this._tokenSimulationPalette=t,this._notifications=n,this.canvasParent=i.getContainer().parentNode,this.isActive=!1,this.isPaused=!0,this._init(),e.on(Vi,jh,r=>{this.activate(),this.unpause()}),e.on([$n,tt],()=>{this.deactivate(),this.pause()}),e.on(dy,jh,r=>{this.unpause()})}gi.prototype._init=function(){this.paletteEntry=yt(`
<div class="bts-entry disabled" title="Play/Pause Simulation">
${Ry}
</div>
`),Dt.bind(this.paletteEntry,"click",this.toggle.bind(this)),this._tokenSimulationPalette.addEntry(this.paletteEntry,1)};gi.prototype.toggle=function(){this.isPaused?this.unpause():this.pause()};gi.prototype.pause=function(){this.isActive&&(_e(this.paletteEntry).remove("active"),_e(this.canvasParent).add("paused"),this.paletteEntry.innerHTML=Ry,this._eventBus.fire(uy),this._notifications.showNotification({text:"Pause Simulation"}),this.isPaused=!0)};gi.prototype.unpause=function(){!this.isActive||!this.isPaused||(_e(this.paletteEntry).add("active"),_e(this.canvasParent).remove("paused"),this.paletteEntry.innerHTML=eR,this._eventBus.fire(ly),this._notifications.showNotification({text:"Play Simulation"}),this.isPaused=!1)};gi.prototype.activate=function(){this.isActive=!0,_e(this.paletteEntry).remove("disabled")};gi.prototype.deactivate=function(){this.isActive=!1,_e(this.paletteEntry).remove("active"),_e(this.paletteEntry).add("disabled")};gi.$inject=["eventBus","tokenSimulationPalette","notifications","canvas"];const tR={__depends__:[Go],__init__:["pauseSimulation"],pauseSimulation:["type",gi]};function oc(e,t,n){this._eventBus=e,this._tokenSimulationPalette=t,this._notifications=n,this._init(),e.on(Vi,()=>{_e(this._paletteEntry).remove("disabled")}),e.on(tt,i=>{(this._active=i.active)||this.resetSimulation()})}oc.prototype._init=function(){this._paletteEntry=yt(`
<div class="bts-entry disabled" title="Reset Simulation">
${IP()}
</div>
`),Dt.bind(this._paletteEntry,"click",()=>{this.resetSimulation(),this._notifications.showNotification({text:"Reset Simulation",type:"info"})}),this._tokenSimulationPalette.addEntry(this._paletteEntry,2)};oc.prototype.resetSimulation=function(){_e(this._paletteEntry).add("disabled"),this._eventBus.fire($n)};oc.$inject=["eventBus","tokenSimulationPalette","notifications"];const nR={__depends__:[Go],__init__:["resetSimulation"],resetSimulation:["type",oc]},iR=10,rR=-15,oR=500,aR="--token-simulation-green-base-44",sR="--token-simulation-white";function yi(e,t,n,i,r){this._overlays=t,this._scopeFilter=i,this._simulator=n,this._simulationStyles=r,this.overlayIds={},e.on(fy,oR,o=>{const{element:a}=o;this.removeTokenCounts(a),this.addTokenCounts(a)}),e.on(Tr,o=>{const a=hr(".bts-token-count[data-scope-id]",t._overlayRoot);for(const s of a){const c=s.dataset.scopeId;_e(s).toggle("inactive",!this._scopeFilter.isShown(c))}})}yi.prototype.addTokenCounts=function(e){if(le(e,"bpmn:MessageFlow")||le(e,"bpmn:SequenceFlow"))return;const t=this._simulator.findScopes(n=>!n.destroyed&&n.children.some(i=>!i.destroyed&&i.element===e&&!i.children.length));this.addTokenCount(e,t)};yi.prototype.addTokenCount=function(e,t){if(!t.length)return;const n=t.map(a=>this._getTokenHTML(e,a)).join(""),i=yt(`
<div class="bts-token-count-parent">
${n}
</div>
`),r={bottom:iR,left:rR},o=this._overlays.add(e,"bts-token-count",{position:r,html:i,show:{minZoom:.5}});this.overlayIds[e.id]=o};yi.prototype.removeTokenCounts=function(e){this.removeTokenCount(e)};yi.prototype.removeTokenCount=function(e){const t=this.overlayIds[e.id];t&&(this._overlays.remove(t),delete this.overlayIds[e.id])};yi.prototype._getTokenHTML=function(e,t){const n=t.colors||this._getDefaultColors();return`
<div data-scope-id="${t.id}" class="bts-token-count waiting ${this._scopeFilter.isShown(t)?"":"inactive"}"
style="color: ${n.auxiliary}; background: ${n.primary}">
${t.getTokensByElement(e)}
</div>
`};yi.prototype._getDefaultColors=function(){return{primary:this._simulationStyles.get(aR),auxiliary:this._simuationStyles.get(sR)}};yi.$inject=["eventBus","overlays","simulator","scopeFilter","simulationStyles"];const cR={__depends__:[Pr,rc],__init__:["tokenCount"],tokenCount:["type",yi]},lR=[["Slow",.5],["Normal",1],["Fast",2]];function zo(e,t,n){this._canvas=e,this._animation=t,this._eventBus=n,this._init(t.getAnimationSpeed()),n.on(tt,i=>{i.active?_e(this._container).remove("hidden"):_e(this._container).add("hidden")}),n.on(py,i=>{this.setActive(i.speed)})}zo.prototype.getToggleSpeed=function(e){return parseFloat(e.dataset.speed)};zo.prototype._init=function(e){this._container=yt(`
<div class="bts-set-animation-speed hidden">
${MP()}
<div class="bts-animation-speed-buttons">
${lR.map(([t,n],i)=>`
<button title="Set animation speed = ${t}" data-speed="${n}" class="bts-animation-speed-button ${n===e?"active":""}">
${Array.from({length:i+1}).map(()=>RP()).join("")}
</button>
`).join("")}
</div>
</div>
`),gy.bind(this._container,"[data-speed]","click",t=>{const n=t.delegateTarget,i=this.getToggleSpeed(n);this._animation.setAnimationSpeed(i)}),this._canvas.getContainer().appendChild(this._container)};zo.prototype.setActive=function(e){hr("[data-speed]",this._container).forEach(t=>{const n=this.getToggleSpeed(t)===e;_e(t)[n?"add":"remove"]("active")})};zo.$inject=["canvas","animation","eventBus"];const uR={__init__:["setAnimationSpeed"],setAnimationSpeed:["type",zo]},pR="--token-simulation-grey-darken-30",fR="--token-simulation-grey-lighten-56";function dR(e,t){var n=e.outgoing.filter(Mp),i=n.indexOf(t||e.sequenceFlow);return n[i+1]?n[i+1]:n[0]}function Mp(e){return le(e,"bpmn:SequenceFlow")}const hR="exclusive-gateway-settings",mR=2e3;function Ar(e,t,n,i,r){this._elementRegistry=t,this._elementColors=n,this._simulator=i,this._simulationStyles=r,e.on(tt,o=>{o.active?this.setSequenceFlowsDefault():this.resetSequenceFlows()})}Ar.prototype.setSequenceFlowsDefault=function(){const e=this._elementRegistry.filter(t=>le(t,"bpmn:ExclusiveGateway"));for(const t of e)this.setSequenceFlow(t)};Ar.prototype.resetSequenceFlows=function(){this._elementRegistry.filter(t=>le(t,"bpmn:ExclusiveGateway")).forEach(t=>{t.outgoing.filter(Mp).length&&this.resetSequenceFlow(t)})};Ar.prototype.resetSequenceFlow=function(e){this._simulator.setConfig(e,{activeOutgoing:void 0})};Ar.prototype.setSequenceFlow=function(e){const t=e.outgoing.filter(Mp);if(t.length<2)return;const{activeOutgoing:n}=this._simulator.getConfig(e);let i;n?i=dR(e,n):i=t[0],this._simulator.setConfig(e,{activeOutgoing:i}),e.outgoing.forEach(r=>{const o=r===i?pR:fR,a=this._simulationStyles.get(o);this._elementColors.add(r,hR,{stroke:a},mR)})};Ar.$inject=["eventBus","elementRegistry","elementColors","simulator","simulationStyles"];const Hh=5e4;function rn(e,t,n){this._elementRegistry=e,this._eventBus=t,this._graphicsFactory=n,this._originalColors={},this._customColors={},t.on(tt,Hh,i=>{i.active?this._saveOriginalColors():(this._applyOriginalColors(),this._originalColors={},this._customColors={})}),t.on("saveXML.start",Hh,()=>{this._applyOriginalColors(),t.once("saveXML.done",()=>this._applyCustomColors())})}rn.$inject=["elementRegistry","eventBus","graphicsFactory"];rn.prototype.add=function(e,t,n,i=1e3){let r=this._customColors[e.id];r||(r=this._customColors[e.id]={}),r[t]=Pe(te({},n),{priority:i}),this._applyHighestPriorityColor(e)};rn.prototype.remove=function(e,t){const n=this._customColors[e.id];n&&(delete n[t],Object.keys(n)||delete this._customColors[e.id]),this._applyHighestPriorityColor(e)};rn.prototype._get=function(e){const t=we(e);if(t){if(Ay(e))return{stroke:t.label&&t.label.get("color")};if(ce(t,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return{fill:t.get("background-color"),stroke:t.get("border-color")}}};rn.prototype._set=function(e,t={}){const{fill:n,stroke:i}=t,r=we(e);r&&(Ay(e)?r.label&&r.label.set("color",i):ce(r,["bpmndi:BPMNEdge","bpmndi:BPMNShape"])&&(r.set("background-color",n),r.set("border-color",i)),this._forceRedraw(e))};rn.prototype._saveOriginalColors=function(){this._originalColors={},this._elementRegistry.forEach(e=>{this._originalColors[e.id]=this._get(e)})};rn.prototype._applyOriginalColors=function(){this._elementRegistry.forEach(e=>{const t=this._originalColors[e.id];t&&this._set(e,t)})};rn.prototype._applyCustomColors=function(){this._elementRegistry.forEach(e=>{const t=this._customColors[e.id];t&&this._set(e,Iy(t))})};rn.prototype._applyHighestPriorityColor=function(e){const t=this._customColors[e.id];if(!t){this._set(e,this._originalColors[e.id]);return}this._set(e,Iy(t))};rn.prototype._forceRedraw=function(e){const t=this._elementRegistry.getGraphics(e),n=e.waypoints?"connection":"shape";this._graphicsFactory.update(n,e,t)};function Ay(e){return"labelTarget"in e}function Iy(e={}){const t=Object.values(e).reduce((i,r)=>{const{priority:o=1e3}=r;return!i||o>i.priority?r:i},void 0);if(t){const n=t,{priority:i}=n;return _c(n,["priority"])}}const Dp={elementColors:["type",rn]},vR={__depends__:[Dp,rc],exclusiveGatewaySettings:["type",Ar]},gR="neutral-element-colors";function kp(e,t,n){this._elementRegistry=t,this._elementColors=n,e.on(tt,i=>{const{active:r}=i;r&&this._setNeutralColors()})}kp.prototype._setNeutralColors=function(){this._elementRegistry.forEach(e=>{this._elementColors.add(e,gR,{stroke:"#212121",fill:"#fff"})})};kp.$inject=["eventBus","elementRegistry","elementColors"];const yR={__depends__:[Dp],__init__:["neutralElementColors"],neutralElementColors:["type",kp]},_R="--token-simulation-grey-darken-30",bR="--token-simulation-grey-lighten-56",ER="inclusive-gateway-settings";function Fn(e,t,n,i,r){this._elementRegistry=t,this._elementColors=n,this._simulator=i,this._simulationStyles=r,e.on(tt,o=>{o.active?this.setDefaults():this.reset()})}Fn.prototype.setDefaults=function(){this._elementRegistry.filter(t=>g(t,"bpmn:InclusiveGateway")).forEach(t=>{t.outgoing.filter(mi).length>1&&this._setGatewayDefaults(t)})};Fn.prototype.reset=function(){this._elementRegistry.filter(t=>g(t,"bpmn:InclusiveGateway")).forEach(t=>{t.outgoing.filter(mi).length>1&&this._resetGateway(t)})};Fn.prototype.toggleSequenceFlow=function(e,t){const n=this._getActiveOutgoing(e),i=Op(e),r=xR(e);let o;n.includes(t)?o=Dl(n,t):o=Dl(n,i).concat(t),o.length||(i?o=[i]:o=[r.find(a=>a!==t)]),this._setActiveOutgoing(e,o)};Fn.prototype._getActiveOutgoing=function(e){const{activeOutgoing:t}=this._simulator.getConfig(e);return t};Fn.prototype._setActiveOutgoing=function(e,t){this._simulator.setConfig(e,{activeOutgoing:t}),e.outgoing.filter(mi).forEach(i=>{const r=!t||t.includes(i)?_R:bR,o=this._simulationStyles.get(r);this._elementColors.add(i,ER,{stroke:o})})};Fn.prototype._setGatewayDefaults=function(e){const t=e.outgoing.filter(mi),n=Op(e),i=Dl(t,n);this._setActiveOutgoing(e,i)};Fn.prototype._resetGateway=function(e){this._setActiveOutgoing(e,void 0)};Fn.$inject=["eventBus","elementRegistry","elementColors","simulator","simulationStyles"];function Op(e){const t=z(e).default;if(t)return e.outgoing.find(n=>z(n)===t)}function xR(e){const t=Op(e);return e.outgoing.filter(n=>z(n)!==t)}function Dl(e,t){return e.filter(n=>n!==t)}const wR={__depends__:[Dp,rc],inclusiveGatewaySettings:["type",Fn]};function ac(e,t){var n=this;this._canvas=t,this.entries=[],this._init(),e.on(tt,function(i){var r=i.active;r?_e(n.container).remove("hidden"):_e(n.container).add("hidden")})}ac.prototype._init=function(){this.container=yt('<div class="bts-palette hidden"></div>'),this._canvas.getContainer().appendChild(this.container)};ac.prototype.addEntry=function(e,t){var n=0;this.entries.forEach(function(i){t>=i.index&&n++}),this.container.insertBefore(e,this.container.childNodes[n]),this.entries.push({entry:e,index:t})};ac.$inject=["eventBus","canvas"];const SR={__init__:["tokenSimulationPalette"],tokenSimulationPalette:["type",ac]},CR={__depends__:[cy,cP,fP,$P,zP,qP,XP,QP,tR,nR,cR,uR,vR,yR,wR,SR]},TR=10001;function My(e,t,n,i,r,o,a){let s=!1;e.on(tt,TR,p=>{s=p.active,s&&(i.cancel(),n.cancel()),a._update()});function c(p,f,d){const h=p[f];p[f]=function(){return d.call(this,h,arguments)}}function l(p,f){c(p,f,function(d,h){if(!s)return d.apply(this,h)})}function u(p,f){c(p,f,function(d,h){if(s)throw new Error("model is read-only");return d.apply(this,h)})}l(n,"init"),l(i,"activate"),l(n,"init"),l(i,"activate"),u(o,"moveShape"),u(o,"updateAttachment"),u(o,"moveElements"),u(o,"moveConnection"),u(o,"layoutConnection"),u(o,"createConnection"),u(o,"createShape"),u(o,"createLabel"),u(o,"appendShape"),u(o,"removeElements"),u(o,"distributeElements"),u(o,"removeShape"),u(o,"removeConnection"),u(o,"replaceShape"),u(o,"pasteElements"),u(o,"alignElements"),u(o,"resizeShape"),u(o,"createSpace"),u(o,"updateWaypoints"),u(o,"reconnectStart"),u(o,"reconnectEnd"),c(r,"trigger",function(p,f){const d=f[0];if(!(s&&PR(["undo","redo","copy","paste","removeSelection","spaceTool","lassoTool","globalConnectTool","distributeElements","alignElements","directEditing"],d)))return p.apply(this,f)})}My.$inject=["eventBus","contextPad","dragging","directEditing","editorActions","modeling","palette"];function PR(e,t){return e.indexOf(t)>-1}const RR={__init__:["disableModeling"],disableModeling:["type",My]};function sc(e,t,n,i){this._eventBus=e,this._canvas=t,this._selection=n,this._contextPad=i,this._active=!1,e.on("import.parse.start",()=>{this._active&&(this.toggleMode(!1),e.once("import.done",()=>{this.toggleMode(!0)}))}),e.on("diagram.init",()=>{this._canvasParent=this._canvas.getContainer().parentNode,this._palette=Xn(".djs-palette",this._canvas.getContainer()),this._init()})}sc.prototype._init=function(){this._container=yt(`
<div class="bts-toggle-mode">
Token Simulation <span class="bts-toggle">${Sy()}</span>
</div>
`),Dt.bind(this._container,"click",()=>this.toggleMode()),this._canvas.getContainer().appendChild(this._container)};sc.prototype.toggleMode=function(e=!this._active){if(e!==this._active){if(e)this._container.innerHTML=`Token Simulation <span class="bts-toggle">${OP()}</span>`,_e(this._canvasParent).add("simulation"),_e(this._palette).add("hidden");else{this._container.innerHTML=`Token Simulation <span class="bts-toggle">${Sy()}</span>`,_e(this._canvasParent).remove("simulation"),_e(this._palette).remove("hidden");const t=this._selection.get();t.length===1&&this._contextPad.open(t[0])}this._eventBus.fire(tt,{active:e}),this._active=e}};sc.$inject=["eventBus","canvas","selection","contextPad"];const AR={__init__:["toggleMode"],toggleMode:["type",sc]};function Dy(e,t,n,i,r,o){var a=!1;r.register({toggleTokenSimulation:function(){t.toggleMode()}}),r.register({togglePauseTokenSimulation:function(){a&&n.toggle()}}),r.register({resetTokenSimulation:function(){a&&i.resetSimulation()}});const s=o.get("log",!1);s&&r.register({toggleTokenSimulationLog:function(){s.toggle()}}),e.on(tt,c=>{a=c.active})}Dy.$inject=["eventBus","toggleMode","pauseSimulation","resetSimulation","editorActions","injector"];const IR={__init__:["tokenSimulationEditorActions"],tokenSimulationEditorActions:["type",Dy]},MR=1e4;function ky(e,t){var n=t.get("editorActions",!1),i=t.get("keyboard",!1);if(!i||!n)return;var r=!1;function o(a){if(Ca(["t","T"],a))return n.trigger("toggleTokenSimulation"),!0;if(r){if(Ca(["l","L"],a))return n.trigger("toggleTokenSimulationLog"),!0;if(Ca([" ","Spacebar"],a))return n.trigger("togglePauseTokenSimulation"),!0;if(Ca(["r","R"],a))return n.trigger("resetTokenSimulation"),!0}}e.on("keyboard.init",function(){i.addListener(MR,function(a){var s=a.keyEvent;o(s)})}),e.on(tt,function(a){var s=a.active;s?r=!0:r=!1})}ky.$inject=["eventBus","injector"];function Ca(e,t){return e.indexOf(t.key)>-1}const DR={__init__:["tokenSimulationKeyboardBindings"],tokenSimulationKeyboardBindings:["type",ky]},kR={__depends__:[CR,RR,AR,IR,DR]};var Oy={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22
* http://hammerjs.github.io/
*
* Copyright (c) 2016 Jorik Tangelder;
* Licensed under the MIT license */(function(e){(function(t,n,i,r){var o=["","webkit","Moz","MS","ms","o"],a=n.createElement("div"),s="function",c=Math.round,l=Math.abs,u=Date.now;function p(y,b,S){return setTimeout(_(y,S),b)}function f(y,b,S){return Array.isArray(y)?(d(y,S[b],S),!0):!1}function d(y,b,S){var M;if(y)if(y.forEach)y.forEach(b,S);else if(y.length!==r)for(M=0;M<y.length;)b.call(S,y[M],M,y),M++;else for(M in y)y.hasOwnProperty(M)&&b.call(S,y[M],M,y)}function h(y,b,S){var M="DEPRECATED METHOD: "+b+`
`+S+` AT
`;return function(){var j=new Error("get-stack-trace"),W=j&&j.stack?j.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",he=t.console&&(t.console.warn||t.console.log);return he&&he.call(t.console,M,W),y.apply(this,arguments)}}var m;typeof Object.assign!="function"?m=function(b){if(b===r||b===null)throw new TypeError("Cannot convert undefined or null to object");for(var S=Object(b),M=1;M<arguments.length;M++){var j=arguments[M];if(j!==r&&j!==null)for(var W in j)j.hasOwnProperty(W)&&(S[W]=j[W])}return S}:m=Object.assign;var v=h(function(b,S,M){for(var j=Object.keys(S),W=0;W<j.length;)(!M||M&&b[j[W]]===r)&&(b[j[W]]=S[j[W]]),W++;return b},"extend","Use `assign`."),E=h(function(b,S){return v(b,S,!0)},"merge","Use `assign`.");function w(y,b,S){var M=b.prototype,j;j=y.prototype=Object.create(M),j.constructor=y,j._super=M,S&&m(j,S)}function _(y,b){return function(){return y.apply(b,arguments)}}function x(y,b){return typeof y==s?y.apply(b&&b[0]||r,b):y}function P(y,b){return y===r?b:y}function A(y,b,S){d(k(b),function(M){y.addEventListener(M,S,!1)})}function C(y,b,S){d(k(b),function(M){y.removeEventListener(M,S,!1)})}function I(y,b){for(;y;){if(y==b)return!0;y=y.parentNode}return!1}function T(y,b){return y.indexOf(b)>-1}function k(y){return y.trim().split(/\s+/g)}function B(y,b,S){if(y.indexOf&&!S)return y.indexOf(b);for(var M=0;M<y.length;){if(S&&y[M][S]==b||!S&&y[M]===b)return M;M++}return-1}function K(y){return Array.prototype.slice.call(y,0)}function Z(y,b,S){for(var M=[],j=[],W=0;W<y.length;){var he=y[W][b];B(j,he)<0&&M.push(y[W]),j[W]=he,W++}return M=M.sort(function(st,_t){return st[b]>_t[b]}),M}function Ae(y,b){for(var S,M,j=b[0].toUpperCase()+b.slice(1),W=0;W<o.length;){if(S=o[W],M=S?S+j:b,M in y)return M;W++}return r}var Ye=1;function Ie(){return Ye++}function U(y){var b=y.ownerDocument||y;return b.defaultView||b.parentWindow||t}var ie=/mobile|tablet|ip(ad|hone|od)|android/i,fe="ontouchstart"in t,nt=Ae(t,"PointerEvent")!==r,St=fe&&ie.test(navigator.userAgent),Ct="touch",bn="pen",jn="mouse",oe="kinect",F=25,Y=1,R=2,G=4,V=8,se=1,X=2,J=4,Te=8,Be=16,ht=X|J,on=Te|Be,Wo=ht|on,qe=["x","y"],Yo=["clientX","clientY"];function $t(y,b){var S=this;this.manager=y,this.callback=b,this.element=y.element,this.target=y.options.inputTarget,this.domHandler=function(M){x(y.options.enable,[y])&&S.handler(M)},this.init()}$t.prototype={handler:function(){},init:function(){this.evEl&&A(this.element,this.evEl,this.domHandler),this.evTarget&&A(this.target,this.evTarget,this.domHandler),this.evWin&&A(U(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&C(this.element,this.evEl,this.domHandler),this.evTarget&&C(this.target,this.evTarget,this.domHandler),this.evWin&&C(U(this.element),this.evWin,this.domHandler)}};function jy(y){var b,S=y.options.inputClass;return S?b=S:nt?b=lc:St?b=Xo:fe?b=uc:b=Ko,new b(y,Hy)}function Hy(y,b,S){var M=S.pointers.length,j=S.changedPointers.length,W=b&Y&&M-j===0,he=b&(G|V)&&M-j===0;S.isFirst=!!W,S.isFinal=!!he,W&&(y.session={}),S.eventType=b,Gy(y,S),y.emit("hammer.input",S),y.recognize(S),y.session.prevInput=S}function Gy(y,b){var S=y.session,M=b.pointers,j=M.length;S.firstInput||(S.firstInput=Lp(b)),j>1&&!S.firstMultiple?S.firstMultiple=Lp(b):j===1&&(S.firstMultiple=!1);var W=S.firstInput,he=S.firstMultiple,it=he?he.center:W.center,st=b.center=Bp(M);b.timeStamp=u(),b.deltaTime=b.timeStamp-W.timeStamp,b.angle=cc(it,st),b.distance=qo(it,st),zy(S,b),b.offsetDirection=Fp(b.deltaX,b.deltaY);var _t=$p(b.deltaTime,b.deltaX,b.deltaY);b.overallVelocityX=_t.x,b.overallVelocityY=_t.y,b.overallVelocity=l(_t.x)>l(_t.y)?_t.x:_t.y,b.scale=he?Wy(he.pointers,M):1,b.rotation=he?Uy(he.pointers,M):0,b.maxPointers=S.prevInput?b.pointers.length>S.prevInput.maxPointers?b.pointers.length:S.prevInput.maxPointers:b.pointers.length,Vy(S,b);var sn=y.element;I(b.srcEvent.target,sn)&&(sn=b.srcEvent.target),b.target=sn}function zy(y,b){var S=b.center,M=y.offsetDelta||{},j=y.prevDelta||{},W=y.prevInput||{};(b.eventType===Y||W.eventType===G)&&(j=y.prevDelta={x:W.deltaX||0,y:W.deltaY||0},M=y.offsetDelta={x:S.x,y:S.y}),b.deltaX=j.x+(S.x-M.x),b.deltaY=j.y+(S.y-M.y)}function Vy(y,b){var S=y.lastInterval||b,M=b.timeStamp-S.timeStamp,j,W,he,it;if(b.eventType!=V&&(M>F||S.velocity===r)){var st=b.deltaX-S.deltaX,_t=b.deltaY-S.deltaY,sn=$p(M,st,_t);W=sn.x,he=sn.y,j=l(sn.x)>l(sn.y)?sn.x:sn.y,it=Fp(st,_t),y.lastInterval=b}else j=S.velocity,W=S.velocityX,he=S.velocityY,it=S.direction;b.velocity=j,b.velocityX=W,b.velocityY=he,b.direction=it}function Lp(y){for(var b=[],S=0;S<y.pointers.length;)b[S]={clientX:c(y.pointers[S].clientX),clientY:c(y.pointers[S].clientY)},S++;return{timeStamp:u(),pointers:b,center:Bp(b),deltaX:y.deltaX,deltaY:y.deltaY}}function Bp(y){var b=y.length;if(b===1)return{x:c(y[0].clientX),y:c(y[0].clientY)};for(var S=0,M=0,j=0;j<b;)S+=y[j].clientX,M+=y[j].clientY,j++;return{x:c(S/b),y:c(M/b)}}function $p(y,b,S){return{x:b/y||0,y:S/y||0}}function Fp(y,b){return y===b?se:l(y)>=l(b)?y<0?X:J:b<0?Te:Be}function qo(y,b,S){S||(S=qe);var M=b[S[0]]-y[S[0]],j=b[S[1]]-y[S[1]];return Math.sqrt(M*M+j*j)}function cc(y,b,S){S||(S=qe);var M=b[S[0]]-y[S[0]],j=b[S[1]]-y[S[1]];return Math.atan2(j,M)*180/Math.PI}function Uy(y,b){return cc(b[1],b[0],Yo)+cc(y[1],y[0],Yo)}function Wy(y,b){return qo(b[0],b[1],Yo)/qo(y[0],y[1],Yo)}var Yy={mousedown:Y,mousemove:R,mouseup:G},qy="mousedown",Ky="mousemove mouseup";function Ko(){this.evEl=qy,this.evWin=Ky,this.pressed=!1,$t.apply(this,arguments)}w(Ko,$t,{handler:function(b){var S=Yy[b.type];S&Y&&b.button===0&&(this.pressed=!0),S&R&&b.which!==1&&(S=G),this.pressed&&(S&G&&(this.pressed=!1),this.callback(this.manager,S,{pointers:[b],changedPointers:[b],pointerType:jn,srcEvent:b}))}});var Xy={pointerdown:Y,pointermove:R,pointerup:G,pointercancel:V,pointerout:V},Zy={2:Ct,3:bn,4:jn,5:oe},jp="pointerdown",Hp="pointermove pointerup pointercancel";t.MSPointerEvent&&!t.PointerEvent&&(jp="MSPointerDown",Hp="MSPointerMove MSPointerUp MSPointerCancel");function lc(){this.evEl=jp,this.evWin=Hp,$t.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}w(lc,$t,{handler:function(b){var S=this.store,M=!1,j=b.type.toLowerCase().replace("ms",""),W=Xy[j],he=Zy[b.pointerType]||b.pointerType,it=he==Ct,st=B(S,b.pointerId,"pointerId");W&Y&&(b.button===0||it)?st<0&&(S.push(b),st=S.length-1):W&(G|V)&&(M=!0),!(st<0)&&(S[st]=b,this.callback(this.manager,W,{pointers:S,changedPointers:[b],pointerType:he,srcEvent:b}),M&&S.splice(st,1))}});var Jy={touchstart:Y,touchmove:R,touchend:G,touchcancel:V},Qy="touchstart",e_="touchstart touchmove touchend touchcancel";function Gp(){this.evTarget=Qy,this.evWin=e_,this.started=!1,$t.apply(this,arguments)}w(Gp,$t,{handler:function(b){var S=Jy[b.type];if(S===Y&&(this.started=!0),!!this.started){var M=t_.call(this,b,S);S&(G|V)&&M[0].length-M[1].length===0&&(this.started=!1),this.callback(this.manager,S,{pointers:M[0],changedPointers:M[1],pointerType:Ct,srcEvent:b})}}});function t_(y,b){var S=K(y.touches),M=K(y.changedTouches);return b&(G|V)&&(S=Z(S.concat(M),"identifier")),[S,M]}var n_={touchstart:Y,touchmove:R,touchend:G,touchcancel:V},i_="touchstart touchmove touchend touchcancel";function Xo(){this.evTarget=i_,this.targetIds={},$t.apply(this,arguments)}w(Xo,$t,{handler:function(b){var S=n_[b.type],M=r_.call(this,b,S);M&&this.callback(this.manager,S,{pointers:M[0],changedPointers:M[1],pointerType:Ct,srcEvent:b})}});function r_(y,b){var S=K(y.touches),M=this.targetIds;if(b&(Y|R)&&S.length===1)return M[S[0].identifier]=!0,[S,S];var j,W,he=K(y.changedTouches),it=[],st=this.target;if(W=S.filter(function(_t){return I(_t.target,st)}),b===Y)for(j=0;j<W.length;)M[W[j].identifier]=!0,j++;for(j=0;j<he.length;)M[he[j].identifier]&&it.push(he[j]),b&(G|V)&&delete M[he[j].identifier],j++;if(it.length)return[Z(W.concat(it),"identifier"),it]}var o_=2500,zp=25;function uc(){$t.apply(this,arguments);var y=_(this.handler,this);this.touch=new Xo(this.manager,y),this.mouse=new Ko(this.manager,y),this.primaryTouch=null,this.lastTouches=[]}w(uc,$t,{handler:function(b,S,M){var j=M.pointerType==Ct,W=M.pointerType==jn;if(!(W&&M.sourceCapabilities&&M.sourceCapabilities.firesTouchEvents)){if(j)a_.call(this,S,M);else if(W&&s_.call(this,M))return;this.callback(b,S,M)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function a_(y,b){y&Y?(this.primaryTouch=b.changedPointers[0].identifier,Vp.call(this,b)):y&(G|V)&&Vp.call(this,b)}function Vp(y){var b=y.changedPointers[0];if(b.identifier===this.primaryTouch){var S={x:b.clientX,y:b.clientY};this.lastTouches.push(S);var M=this.lastTouches,j=function(){var W=M.indexOf(S);W>-1&&M.splice(W,1)};setTimeout(j,o_)}}function s_(y){for(var b=y.srcEvent.clientX,S=y.srcEvent.clientY,M=0;M<this.lastTouches.length;M++){var j=this.lastTouches[M],W=Math.abs(b-j.x),he=Math.abs(S-j.y);if(W<=zp&&he<=zp)return!0}return!1}var Up=Ae(a.style,"touchAction"),Wp=Up!==r,Yp="compute",qp="auto",pc="manipulation",_i="none",Ir="pan-x",Mr="pan-y",Zo=l_();function fc(y,b){this.manager=y,this.set(b)}fc.prototype={set:function(y){y==Yp&&(y=this.compute()),Wp&&this.manager.element.style&&Zo[y]&&(this.manager.element.style[Up]=y),this.actions=y.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var y=[];return d(this.manager.recognizers,function(b){x(b.options.enable,[b])&&(y=y.concat(b.getTouchAction()))}),c_(y.join(" "))},preventDefaults:function(y){var b=y.srcEvent,S=y.offsetDirection;if(this.manager.session.prevented){b.preventDefault();return}var M=this.actions,j=T(M,_i)&&!Zo[_i],W=T(M,Mr)&&!Zo[Mr],he=T(M,Ir)&&!Zo[Ir];if(j){var it=y.pointers.length===1,st=y.distance<2,_t=y.deltaTime<250;if(it&&st&&_t)return}if(!(he&&W)&&(j||W&&S&ht||he&&S&on))return this.preventSrc(b)},preventSrc:function(y){this.manager.session.prevented=!0,y.preventDefault()}};function c_(y){if(T(y,_i))return _i;var b=T(y,Ir),S=T(y,Mr);return b&&S?_i:b||S?b?Ir:Mr:T(y,pc)?pc:qp}function l_(){if(!Wp)return!1;var y={},b=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(S){y[S]=b?t.CSS.supports("touch-action",S):!0}),y}var Jo=1,Ft=2,qi=4,Hn=8,En=Hn,Dr=16,an=32;function xn(y){this.options=m({},this.defaults,y||{}),this.id=Ie(),this.manager=null,this.options.enable=P(this.options.enable,!0),this.state=Jo,this.simultaneous={},this.requireFail=[]}xn.prototype={defaults:{},set:function(y){return m(this.options,y),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(y){if(f(y,"recognizeWith",this))return this;var b=this.simultaneous;return y=Qo(y,this),b[y.id]||(b[y.id]=y,y.recognizeWith(this)),this},dropRecognizeWith:function(y){return f(y,"dropRecognizeWith",this)?this:(y=Qo(y,this),delete this.simultaneous[y.id],this)},requireFailure:function(y){if(f(y,"requireFailure",this))return this;var b=this.requireFail;return y=Qo(y,this),B(b,y)===-1&&(b.push(y),y.requireFailure(this)),this},dropRequireFailure:function(y){if(f(y,"dropRequireFailure",this))return this;y=Qo(y,this);var b=B(this.requireFail,y);return b>-1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(y){return!!this.simultaneous[y.id]},emit:function(y){var b=this,S=this.state;function M(j){b.manager.emit(j,y)}S<Hn&&M(b.options.event+Kp(S)),M(b.options.event),y.additionalEvent&&M(y.additionalEvent),S>=Hn&&M(b.options.event+Kp(S))},tryEmit:function(y){if(this.canEmit())return this.emit(y);this.state=an},canEmit:function(){for(var y=0;y<this.requireFail.length;){if(!(this.requireFail[y].state&(an|Jo)))return!1;y++}return!0},recognize:function(y){var b=m({},y);if(!x(this.options.enable,[this,b])){this.reset(),this.state=an;return}this.state&(En|Dr|an)&&(this.state=Jo),this.state=this.process(b),this.state&(Ft|qi|Hn|Dr)&&this.tryEmit(b)},process:function(y){},getTouchAction:function(){},reset:function(){}};function Kp(y){return y&Dr?"cancel":y&Hn?"end":y&qi?"move":y&Ft?"start":""}function Xp(y){return y==Be?"down":y==Te?"up":y==X?"left":y==J?"right":""}function Qo(y,b){var S=b.manager;return S?S.get(y):y}function Jt(){xn.apply(this,arguments)}w(Jt,xn,{defaults:{pointers:1},attrTest:function(y){var b=this.options.pointers;return b===0||y.pointers.length===b},process:function(y){var b=this.state,S=y.eventType,M=b&(Ft|qi),j=this.attrTest(y);return M&&(S&V||!j)?b|Dr:M||j?S&G?b|Hn:b&Ft?b|qi:Ft:an}});function ea(){Jt.apply(this,arguments),this.pX=null,this.pY=null}w(ea,Jt,{defaults:{event:"pan",threshold:10,pointers:1,direction:Wo},getTouchAction:function(){var y=this.options.direction,b=[];return y&ht&&b.push(Mr),y&on&&b.push(Ir),b},directionTest:function(y){var b=this.options,S=!0,M=y.distance,j=y.direction,W=y.deltaX,he=y.deltaY;return j&b.direction||(b.direction&ht?(j=W===0?se:W<0?X:J,S=W!=this.pX,M=Math.abs(y.deltaX)):(j=he===0?se:he<0?Te:Be,S=he!=this.pY,M=Math.abs(y.deltaY))),y.direction=j,S&&M>b.threshold&&j&b.direction},attrTest:function(y){return Jt.prototype.attrTest.call(this,y)&&(this.state&Ft||!(this.state&Ft)&&this.directionTest(y))},emit:function(y){this.pX=y.deltaX,this.pY=y.deltaY;var b=Xp(y.direction);b&&(y.additionalEvent=this.options.event+b),this._super.emit.call(this,y)}});function dc(){Jt.apply(this,arguments)}w(dc,Jt,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[_i]},attrTest:function(y){return this._super.attrTest.call(this,y)&&(Math.abs(y.scale-1)>this.options.threshold||this.state&Ft)},emit:function(y){if(y.scale!==1){var b=y.scale<1?"in":"out";y.additionalEvent=this.options.event+b}this._super.emit.call(this,y)}});function hc(){xn.apply(this,arguments),this._timer=null,this._input=null}w(hc,xn,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[qp]},process:function(y){var b=this.options,S=y.pointers.length===b.pointers,M=y.distance<b.threshold,j=y.deltaTime>b.time;if(this._input=y,!M||!S||y.eventType&(G|V)&&!j)this.reset();else if(y.eventType&Y)this.reset(),this._timer=p(function(){this.state=En,this.tryEmit()},b.time,this);else if(y.eventType&G)return En;return an},reset:function(){clearTimeout(this._timer)},emit:function(y){this.state===En&&(y&&y.eventType&G?this.manager.emit(this.options.event+"up",y):(this._input.timeStamp=u(),this.manager.emit(this.options.event,this._input)))}});function mc(){Jt.apply(this,arguments)}w(mc,Jt,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[_i]},attrTest:function(y){return this._super.attrTest.call(this,y)&&(Math.abs(y.rotation)>this.options.threshold||this.state&Ft)}});function vc(){Jt.apply(this,arguments)}w(vc,Jt,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:ht|on,pointers:1},getTouchAction:function(){return ea.prototype.getTouchAction.call(this)},attrTest:function(y){var b=this.options.direction,S;return b&(ht|on)?S=y.overallVelocity:b&ht?S=y.overallVelocityX:b&on&&(S=y.overallVelocityY),this._super.attrTest.call(this,y)&&b&y.offsetDirection&&y.distance>this.options.threshold&&y.maxPointers==this.options.pointers&&l(S)>this.options.velocity&&y.eventType&G},emit:function(y){var b=Xp(y.offsetDirection);b&&this.manager.emit(this.options.event+b,y),this.manager.emit(this.options.event,y)}});function ta(){xn.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}w(ta,xn,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[pc]},process:function(y){var b=this.options,S=y.pointers.length===b.pointers,M=y.distance<b.threshold,j=y.deltaTime<b.time;if(this.reset(),y.eventType&Y&&this.count===0)return this.failTimeout();if(M&&j&&S){if(y.eventType!=G)return this.failTimeout();var W=this.pTime?y.timeStamp-this.pTime<b.interval:!0,he=!this.pCenter||qo(this.pCenter,y.center)<b.posThreshold;this.pTime=y.timeStamp,this.pCenter=y.center,!he||!W?this.count=1:this.count+=1,this._input=y;var it=this.count%b.taps;if(it===0)return this.hasRequireFailures()?(this._timer=p(function(){this.state=En,this.tryEmit()},b.interval,this),Ft):En}return an},failTimeout:function(){return this._timer=p(function(){this.state=an},this.options.interval,this),an},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==En&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Gn(y,b){return b=b||{},b.recognizers=P(b.recognizers,Gn.defaults.preset),new gc(y,b)}Gn.VERSION="2.0.7",Gn.defaults={domEvents:!1,touchAction:Yp,enable:!0,inputTarget:null,inputClass:null,preset:[[mc,{enable:!1}],[dc,{enable:!1},["rotate"]],[vc,{direction:ht}],[ea,{direction:ht},["swipe"]],[ta],[ta,{event:"doubletap",taps:2},["tap"]],[hc]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var u_=1,Zp=2;function gc(y,b){this.options=m({},Gn.defaults,b||{}),this.options.inputTarget=this.options.inputTarget||y,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=y,this.input=jy(this),this.touchAction=new fc(this,this.options.touchAction),Jp(this,!0),d(this.options.recognizers,function(S){var M=this.add(new S[0](S[1]));S[2]&&M.recognizeWith(S[2]),S[3]&&M.requireFailure(S[3])},this)}gc.prototype={set:function(y){return m(this.options,y),y.touchAction&&this.touchAction.update(),y.inputTarget&&(this.input.destroy(),this.input.target=y.inputTarget,this.input.init()),this},stop:function(y){this.session.stopped=y?Zp:u_},recognize:function(y){var b=this.session;if(!b.stopped){this.touchAction.preventDefaults(y);var S,M=this.recognizers,j=b.curRecognizer;(!j||j&&j.state&En)&&(j=b.curRecognizer=null);for(var W=0;W<M.length;)S=M[W],b.stopped!==Zp&&(!j||S==j||S.canRecognizeWith(j))?S.recognize(y):S.reset(),!j&&S.state&(Ft|qi|Hn)&&(j=b.curRecognizer=S),W++}},get:function(y){if(y instanceof xn)return y;for(var b=this.recognizers,S=0;S<b.length;S++)if(b[S].options.event==y)return b[S];return null},add:function(y){if(f(y,"add",this))return this;var b=this.get(y.options.event);return b&&this.remove(b),this.recognizers.push(y),y.manager=this,this.touchAction.update(),y},remove:function(y){if(f(y,"remove",this))return this;if(y=this.get(y),y){var b=this.recognizers,S=B(b,y);S!==-1&&(b.splice(S,1),this.touchAction.update())}return this},on:function(y,b){if(y!==r&&b!==r){var S=this.handlers;return d(k(y),function(M){S[M]=S[M]||[],S[M].push(b)}),this}},off:function(y,b){if(y!==r){var S=this.handlers;return d(k(y),function(M){b?S[M]&&S[M].splice(B(S[M],b),1):delete S[M]}),this}},emit:function(y,b){this.options.domEvents&&p_(y,b);var S=this.handlers[y]&&this.handlers[y].slice();if(!(!S||!S.length)){b.type=y,b.preventDefault=function(){b.srcEvent.preventDefault()};for(var M=0;M<S.length;)S[M](b),M++}},destroy:function(){this.element&&Jp(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Jp(y,b){var S=y.element;if(S.style){var M;d(y.options.cssProps,function(j,W){M=Ae(S.style,W),b?(y.oldCssProps[M]=S.style[M],S.style[M]=j):S.style[M]=y.oldCssProps[M]||""}),b||(y.oldCssProps={})}}function p_(y,b){var S=n.createEvent("Event");S.initEvent(y,!0,!0),S.gesture=b,b.target.dispatchEvent(S)}m(Gn,{INPUT_START:Y,INPUT_MOVE:R,INPUT_END:G,INPUT_CANCEL:V,STATE_POSSIBLE:Jo,STATE_BEGAN:Ft,STATE_CHANGED:qi,STATE_ENDED:Hn,STATE_RECOGNIZED:En,STATE_CANCELLED:Dr,STATE_FAILED:an,DIRECTION_NONE:se,DIRECTION_LEFT:X,DIRECTION_RIGHT:J,DIRECTION_UP:Te,DIRECTION_DOWN:Be,DIRECTION_HORIZONTAL:ht,DIRECTION_VERTICAL:on,DIRECTION_ALL:Wo,Manager:gc,Input:$t,TouchAction:fc,TouchInput:Xo,MouseInput:Ko,PointerEventInput:lc,TouchMouseInput:uc,SingleTouchInput:Gp,Recognizer:xn,AttrRecognizer:Jt,Tap:ta,Pan:ea,Swipe:vc,Pinch:dc,Rotate:mc,Press:hc,on:A,off:C,each:d,merge:E,extend:v,assign:m,inherit:w,bindFn:_,prefixed:Ae});var f_=typeof t!="undefined"?t:typeof self!="undefined"?self:{};f_.Hammer=Gn,e.exports?e.exports=Gn:t[i]=Gn})(window,document,"Hammer")})(Oy);var OR=Oy.exports;const Ci=Vl(OR);var Ta=50,Gh={min:.2,max:4},NR=10,LR=.1,BR=250;function wt(e,t,n,i,r){var o=this;this._canvas=i,this._elementRegistry=r,this._eventBus=n,this._injector=t,this._state={isOpen:void 0,isDragging:!1,initialDragPosition:null,offsetViewport:null,cachedViewbox:null,dragger:null,svgClientRect:null,parentClientRect:null,zoomDelta:0},this._init();var a=new Ci.Manager(document);a.add(new Ci.Pan),a.on("panmove",p),a.on("panend",f);var s=new Ci.Manager(this._svg);s.add(new Ci.Pan),s.on("panstart",u(!0)),s.add(new Ci.Tap),s.on("tap",function(d){l(Aa(d))});var c=new Ci.Manager(this._viewportDom);c.add(new Ci.Pan),c.on("panstart",u(!1)),this.toggle(e&&e.open||!1);function l(d){(!o._state._svgClientRect||Ra(o._state._svgClientRect))&&(o._state._svgClientRect=o._svg.getBoundingClientRect());var h=Pa({x:d.x-o._state._svgClientRect.left,y:d.y-o._state._svgClientRect.top},o._svg,o._lastViewbox);Vc(h,o._canvas),o._update()}function u(d){return function(m){var v=Aa(m);(!o._state._svgClientRect||Ra(o._state._svgClientRect))&&(o._state._svgClientRect=o._svg.getBoundingClientRect()),d&&l(v);var E=Pa({x:v.x-o._state._svgClientRect.left,y:v.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),w=i.viewbox(),_=FR(E,w),x=o._viewportDom.getBoundingClientRect(),P={x:v.x-x.left+1,y:v.y-x.top+1};N(o._state,{cachedViewbox:w,initialDragPosition:{x:v.x,y:v.y},isDragging:!0,offsetViewport:_,offsetViewportDom:P,viewportClientRect:o._viewport.getBoundingClientRect(),parentClientRect:o._parent.getBoundingClientRect()}),ne.bind(document,"mousemove",p),ne.bind(document,"mouseup",f)}}function p(d){var h=Aa(d);if(o._state.isDragging){(!o._state._svgClientRect||Ra(o._state._svgClientRect))&&(o._state._svgClientRect=o._svg.getBoundingClientRect());var m=o._state.offsetViewportDom,v=o._state.viewportClientRect,E=o._state.parentClientRect;N(o._viewportDom.style,{top:h.y-m.y-E.top+"px",left:h.x-m.x-E.left+"px"});var w=Ny(E,{top:h.y-m.y-E.top,left:h.x-m.x-E.left,width:v.width,height:v.height});N(o._overlay.style,{clipPath:w});var _=Pa({x:h.x-o._state._svgClientRect.left,y:h.y-o._state._svgClientRect.top},o._svg,o._lastViewbox);Vc({x:_.x-o._state.offsetViewport.x,y:_.y-o._state.offsetViewport.y},o._canvas)}}function f(d){var h=Aa(d);o._state.isDragging&&(o._state.initialDragPosition.x===h.x&&o._state.initialDragPosition.y===h.y&&l(d),o._update(),N(o._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),ne.unbind(document,"mousemove",p),ne.unbind(document,"mouseup",f))}ne.bind(this._viewportDom,"mousedown",u(!1)),ne.bind(this._svg,"mousedown",u(!0)),ne.bind(this._parent,"wheel",function(d){if(d.preventDefault(),d.stopPropagation(),!!d.ctrlKey&&((!o._state._svgClientRect||Ra(o._state._svgClientRect))&&(o._state._svgClientRect=o._svg.getBoundingClientRect()),!!zR(d,o._state._svgClientRect))){var h=d.deltaMode===0?.02:.32,m=Math.sqrt(Math.pow(d.deltaY,2)+Math.pow(d.deltaX,2))*VR(d.deltaY)*-h;if(o._state.zoomDelta+=m,Math.abs(o._state.zoomDelta)>LR){var v=m>0?1:-1,E=Math.log(i.zoom())/Math.log(10),w=UR(Gh,NR*2),_=Math.round(E/w)*w;_+=w*v;var x=Math.pow(10,_);i.zoom(WR(Gh,x),P),o._state.zoomDelta=0;var P=Pa({x:d.clientX-o._state._svgClientRect.left,y:d.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox);Vc(P,o._canvas),o._update()}}}),ne.bind(this._toggle,"click",function(d){d.preventDefault(),d.stopPropagation(),o.toggle()}),n.on(["shape.added","connection.added"],function(d){var h=d.element;o._addElement(h),o._update()}),n.on(["shape.removed","connection.removed"],function(d){var h=d.element;o._removeElement(h),o._update()}),n.on("elements.changed",BR,function(d){var h=d.elements;h.forEach(function(m){o._updateElement(m)}),o._update()}),n.on("element.updateId",function(d){var h=d.element,m=d.newId;o._updateElementId(h,m)}),n.on("canvas.viewbox.changed",function(){o._state.isDragging||o._update()}),n.on("canvas.resized",function(){document.body.contains(o._parent)&&(o._state.isDragging||o._update(),o._state._svgClientRect=o._svg.getBoundingClientRect())}),n.on(["root.set","plane.set"],function(d){o._clear();var h=d.element||d.plane.rootElement;h.children.forEach(function(m){o._addElement(m)}),o._update()})}wt.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"];wt.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");Le(n).add("djs-minimap"),t.appendChild(n);var i=this._toggle=document.createElement("div");Le(i).add("toggle"),n.appendChild(i);var r=this._map=document.createElement("div");Le(r).add("map"),n.appendChild(r);var o=this._svg=ve("svg");ae(o,{width:"100%",height:"100%"}),ge(r,o);var a=this._elementsGroup=ve("g");ge(o,a);var s=this._viewportGroup=ve("g");ge(o,s);var c=this._viewport=ve("rect");Re(c).add("viewport"),ge(s,c),ne.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");Le(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");Le(u).add("overlay"),this._parent.appendChild(u)};wt.prototype._update=function(){var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(Ly(e)){var i,r,o,a,s=n.width-t.width,c=n.height-t.height;t.width<n.width?(i=t.x-s/2,o=n.width,t.x+t.width<n.width&&(i=Math.min(0,t.x))):(i=t.x,o=t.width),t.height<n.height?(r=t.y-c/2,a=n.height,t.y+t.height<n.height&&(r=Math.min(0,t.y))):(r=t.y,a=t.height),i=i-Ta,r=r-Ta,o=o+Ta*2,a=a+Ta*2,this._lastViewbox={x:i,y:r,width:o,height:a},ae(this._svg,{viewBox:i+", "+r+", "+o+", "+a}),ae(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var l=this._state._parentClientRect=this._parent.getBoundingClientRect(),u=this._viewport.getBoundingClientRect(),p={top:u.top-l.top,left:u.left-l.left,width:u.width,height:u.height};N(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var f=Ny(l,p);N(this._overlay.style,{clipPath:f})}};wt.prototype.open=function(){N(this._state,{isOpen:!0}),Le(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};lt(this._toggle,"title",e("Close minimap")),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})};wt.prototype.close=function(){N(this._state,{isOpen:!1}),Le(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};lt(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})};wt.prototype.toggle=function(e){var t=this.isOpen();typeof e=="undefined"&&(e=!t),e!=t&&(e?this.open():this.close())};wt.prototype.isOpen=function(){return this._state.isOpen};wt.prototype._updateElement=function(e){try{e.parent!==void 0&&e.parent!==null&&(this._removeElement(e),this._addElement(e))}catch(t){}};wt.prototype._updateElementId=function(e,t){try{var n=De("#"+Oi(e.id),this._elementsGroup);n&&(n.id=t)}catch(i){}};wt.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0};wt.prototype._addElement=function(e){var t=this;if(this._removeElement(e),!!this.isOnActivePlane(e)){var n,i,r,o=this._createElement(e),a=De("#"+Oi(e.parent.id),this._elementsGroup);if(o){var s=this._elementRegistry.getGraphics(e),c=this._elementRegistry.getGraphics(e.parent),l=HR(s,c);return l!=="undefined"?a?a.childNodes.length>l?Vh(o,a,l):Vh(o,a,a.childNodes.length-1):this._elementsGroup.appendChild(o):this._elementsGroup.appendChild(o),$R(e)?(n=e.parent,i=0,r=0,typeof n.x!="undefined"&&typeof n.y!="undefined"&&(i=-n.x,r=-n.y),ae(o,{transform:"translate("+i+" "+r+")"})):(i=e.x,r=e.y,a&&(n=e.parent,i-=n.x,r-=n.y),ae(o,{transform:"translate("+i+" "+r+")"})),e.children&&e.children.length&&e.children.forEach(function(u){t._addElement(u)}),o}}};wt.prototype._removeElement=function(e){var t=this._svg.getElementById(e.id);t&&ut(t)};wt.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=Mi(t),n)){var i=Hl(n);return ae(i,{id:e.id}),i}};wt.prototype._clear=function(){rs(this._elementsGroup)};function $R(e){return e.waypoints}function FR(e,t){var n={x:t.x+t.width/2,y:t.y+t.height/2};return{x:e.x-n.x,y:e.y-n.y}}function Pa(e,t,n){var i=t.getBoundingClientRect(),r=jR(n,i.width/i.height),o=zh(e.x,0,i.width,r.x,r.x+r.width),a=zh(e.y,0,i.height,r.y,r.y+r.height);return{x:o,y:a}}function Vc(e,t){var n=t.viewbox(),i=n.width,r=n.height;t.viewbox({x:e.x-i/2,y:e.y-r/2,width:i,height:r})}function jR(e,t){var n=e.width/e.height,i=N({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var r=i.width*(1/t),o=i.y-(r-i.height)/2;N(i,{y:o,height:r})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;N(i,{x:s,width:a})}return i}function zh(e,t,n,i,r){var o=n-t,a=r-i;return(e-t)*a/o+i}function HR(e,t){var n=De(".djs-children",t.parentNode);if(n){var i=[].slice.call(n.childNodes),r=-1;return i.forEach(function(o,a){De(".djs-element",o)===e&&(r=a)}),r}}function Vh(e,t,n){var i=GR(t),r=[].slice.call(i.childNodes),o=r[n];o?t.insertBefore(e,o.nextSibling):t.appendChild(e)}function GR(e){var t=De(".children",e);return t||(t=ve("g",{class:"children"}),ge(e,t)),t}function Ra(e){return e.width===0&&e.height===0}function zR(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var VR=Math.sign||function(e){return e>=0?1:-1};function UR(e,t){var n=Math.log(e.min)/Math.log(10),i=Math.log(e.max)/Math.log(10),r=Math.abs(n)+Math.abs(i);return r/t}function WR(e,t){return Math.max(e.min,Math.min(e.max,t))}function Ny(e,t){var n=[cn(t.left,t.top),cn(t.left+t.width,t.top),cn(t.left+t.width,t.top+t.height),cn(t.left,t.top+t.height),cn(t.left,e.height),cn(e.width,e.height),cn(e.width,0),cn(0,0),cn(0,e.height),cn(t.left,e.height)].join(", ");return"polygon("+n+")"}function cn(e,t){return e+"px "+t+"px"}function Ly(e){return ao(e,function(t){return vn(t)?Ly(t):ue(t)&&isFinite(t)})}function Aa(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}var YR={__init__:["minimap"],minimap:["type",wt]};const qR=[{__init__:["customPaletteProvider","customContextPadProvider","customRenderer"],customPaletteProvider:["type",Vg],customRenderer:["type",qg],customContextPadProvider:["type",uT]},tT,kR,YR],KR=qR,XR={name:"Flowable",uri:"http://flowable.org/bpmn",prefix:"flowable",xml:{tagAlias:"lowerCase"},associations:[],types:[{name:"flowable:extCandidateUsers",isAbstract:!0,extends:[],superClass:["Element"],meta:{allowedIn:["*"]},properties:[{name:"body",type:"String",isBody:!0}]},{name:"flowable:extAssignee",isAbstract:!0,extends:[],superClass:["Element"],meta:{allowedIn:["*"]},properties:[{name:"body",type:"String",isBody:!0}]},{name:"flowable:property",superClass:["Element"],properties:[{name:"id",isAttr:!0,type:"String"},{name:"name",isAttr:!0,type:"String"},{name:"value",isAttr:!0,type:"String"}]},{name:"flowable:properties",isAbstract:!0,extends:[],superClass:["Element"],meta:{allowedIn:["*"]},properties:[{name:"values",type:"flowable:property",isMany:!0}]},{name:"InOutBinding",superClass:["Element"],isAbstract:!0,properties:[{name:"source",isAttr:!0,type:"String"},{name:"sourceExpression",isAttr:!0,type:"String"},{name:"target",isAttr:!0,type:"String"},{name:"businessKey",isAttr:!0,type:"String"},{name:"local",isAttr:!0,type:"Boolean",default:!1},{name:"variables",isAttr:!0,type:"String"}]},{name:"In",superClass:["InOutBinding"],meta:{allowedIn:["bpmn:CallActivity"]}},{name:"Out",superClass:["InOutBinding"],meta:{allowedIn:["bpmn:CallActivity"]}},{name:"AsyncCapable",isAbstract:!0,extends:["bpmn:Activity","bpmn:Gateway","bpmn:Event"],properties:[{name:"async",isAttr:!0,type:"Boolean",default:!1},{name:"asyncBefore",isAttr:!0,type:"Boolean",default:!1},{name:"asyncAfter",isAttr:!0,type:"Boolean",default:!1},{name:"exclusive",isAttr:!0,type:"Boolean",default:!0}]},{name:"flowable:in",superClass:["Element"],properties:[{name:"source",type:"string",isAttr:!0},{name:"target",type:"string",isAttr:!0}]},{name:"flowable:out",superClass:["Element"],properties:[{name:"source",type:"string",isAttr:!0},{name:"target",type:"string",isAttr:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"JobPriorized",isAbstract:!0,extends:["bpmn:Process","flowable:AsyncCapable"],properties:[{name:"jobPriority",isAttr:!0,type:"String"}]},{name:"SignalEventDefinition",isAbstract:!0,extends:["bpmn:SignalEventDefinition"],properties:[{name:"async",isAttr:!0,type:"Boolean",default:!1}]},{name:"ErrorEventDefinition",isAbstract:!0,extends:["bpmn:ErrorEventDefinition"],properties:[{name:"errorCodeVariable",isAttr:!0,type:"String"},{name:"errorMessageVariable",isAttr:!0,type:"String"}]},{name:"Error",isAbstract:!0,extends:["bpmn:Error"],properties:[{name:"flowable:errorMessage",isAttr:!0,type:"String"}]},{name:"PotentialStarter",superClass:["Element"],properties:[{name:"resourceAssignmentExpression",type:"bpmn:ResourceAssignmentExpression"}]},{name:"UserTask",isAbstract:!0,extends:["bpmn:UserTask"],properties:[{name:"timerEventDefinition",type:"Expression"},{name:"multiInstanceLoopCharacteristics",type:"MultiInstanceLoopCharacteristics"}]},{name:"StartEvent",isAbstract:!0,extends:["bpmn:StartEvent"],properties:[{name:"timerEventDefinition",type:"Expression"}]},{name:"FormSupported",isAbstract:!0,extends:["bpmn:StartEvent","bpmn:UserTask"],properties:[{name:"formHandlerClass",isAttr:!0,type:"String"},{name:"formKey",isAttr:!0,type:"String"}]},{name:"TemplateSupported",isAbstract:!0,extends:["bpmn:Process","bpmn:FlowElement"],properties:[{name:"modelerTemplate",isAttr:!0,type:"String"}]},{name:"Initiator",isAbstract:!0,extends:["bpmn:StartEvent"],properties:[{name:"initiator",isAttr:!0,type:"String"}]},{name:"ScriptTask",isAbstract:!0,extends:["bpmn:ScriptTask"],properties:[{name:"resultVariable",isAttr:!0,type:"String"},{name:"resource",isAttr:!0,type:"String"}]},{name:"Process",isAbstract:!0,extends:["bpmn:Process"],properties:[{name:"candidateStarterGroups",isAttr:!0,type:"String"},{name:"candidateStarterUsers",isAttr:!0,type:"String"},{name:"versionTag",isAttr:!0,type:"String"},{name:"historyTimeToLive",isAttr:!0,type:"String"},{name:"isStartableInTasklist",isAttr:!0,type:"Boolean",default:!0}]},{name:"EscalationEventDefinition",isAbstract:!0,extends:["bpmn:EscalationEventDefinition"],properties:[{name:"escalationCodeVariable",isAttr:!0,type:"String"}]},{name:"FormalExpression",isAbstract:!0,extends:["bpmn:FormalExpression"],properties:[{name:"resource",isAttr:!0,type:"String"}]},{name:"Assignable",extends:["bpmn:UserTask"],properties:[{name:"candidateGroups",isAttr:!0,type:"String"},{name:"dueDate",isAttr:!0,type:"String"},{name:"followUpDate",isAttr:!0,type:"String"},{name:"priority",isAttr:!0,type:"String"}]},{name:"CallActivity",extends:["bpmn:CallActivity"],properties:[{name:"calledElementBinding",isAttr:!0,type:"String",default:"latest"},{name:"calledElementVersion",isAttr:!0,type:"String"},{name:"calledElementVersionTag",isAttr:!0,type:"String"},{name:"calledElementTenantId",isAttr:!0,type:"String"},{name:"caseRef",isAttr:!0,type:"String"},{name:"caseBinding",isAttr:!0,type:"String",default:"latest"},{name:"caseVersion",isAttr:!0,type:"String"},{name:"caseTenantId",isAttr:!0,type:"String"},{name:"variableMappingClass",isAttr:!0,type:"String"},{name:"variableMappingDelegateExpression",isAttr:!0,type:"String"}]},{name:"ServiceTaskLike",extends:["bpmn:ServiceTask","bpmn:BusinessRuleTask","bpmn:SendTask","bpmn:MessageEventDefinition"],properties:[{name:"expression",isAttr:!0,type:"String"},{name:"class",isAttr:!0,type:"String"},{name:"delegateExpression",isAttr:!0,type:"String"},{name:"resultVariable",isAttr:!0,type:"String"}]},{name:"ExclusiveGateway",isAbstract:!0,extends:["bpmn:ExclusiveGateway"],properties:[{name:"serviceClass",isAttr:!0,type:"String"}]},{name:"DmnCapable",extends:["bpmn:BusinessRuleTask"],properties:[{name:"decisionRef",isAttr:!0,type:"String"},{name:"decisionRefBinding",isAttr:!0,type:"String",default:"latest"},{name:"decisionRefVersion",isAttr:!0,type:"String"},{name:"mapDecisionResult",isAttr:!0,type:"String",default:"resultList"},{name:"decisionRefTenantId",isAttr:!0,type:"String"}]},{name:"ExternalCapable",extends:["flowable:ServiceTaskLike"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"topic",isAttr:!0,type:"String"}]},{name:"TaskPriorized",extends:["bpmn:Process","flowable:ExternalCapable"],properties:[{name:"taskPriority",isAttr:!0,type:"String"}]},{name:"Properties",superClass:["Element"],meta:{allowedIn:["*"]},properties:[{name:"values",type:"Property",isMany:!0}]},{name:"Property",superClass:["Element"],properties:[{name:"id",type:"String",isAttr:!0},{name:"name",type:"String",isAttr:!0},{name:"value",type:"String",isAttr:!0}]},{name:"Connector",superClass:["Element"],meta:{allowedIn:["flowable:ServiceTaskLike"]},properties:[{name:"inputOutput",type:"InputOutput"},{name:"connectorId",type:"String"}]},{name:"InputOutput",superClass:["Element"],meta:{allowedIn:["bpmn:FlowNode","flowable:Connector"]},properties:[{name:"inputOutput",type:"InputOutput"},{name:"connectorId",type:"String"},{name:"inputParameters",isMany:!0,type:"InputParameter"},{name:"outputParameters",isMany:!0,type:"OutputParameter"}]},{name:"InputOutputParameter",properties:[{name:"name",isAttr:!0,type:"String"},{name:"value",isBody:!0,type:"String"},{name:"definition",type:"InputOutputParameterDefinition"}]},{name:"InputOutputParameterDefinition",isAbstract:!0},{name:"List",superClass:["InputOutputParameterDefinition"],properties:[{name:"items",isMany:!0,type:"InputOutputParameterDefinition"}]},{name:"Map",superClass:["InputOutputParameterDefinition"],properties:[{name:"entries",isMany:!0,type:"Entry"}]},{name:"Entry",properties:[{name:"key",isAttr:!0,type:"String"},{name:"value",isBody:!0,type:"String"},{name:"definition",type:"InputOutputParameterDefinition"}]},{name:"Value",superClass:["InputOutputParameterDefinition"],properties:[{name:"id",isAttr:!0,type:"String"},{name:"name",isAttr:!0,type:"String"},{name:"value",isBody:!0,type:"String"}]},{name:"Script",superClass:["InputOutputParameterDefinition"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"resource",isAttr:!0,type:"String"},{name:"value",isBody:!0,type:"String"}]},{name:"Field",superClass:["Element"],meta:{allowedIn:["flowable:ServiceTaskLike","flowable:ExecutionListener","flowable:TaskListener"]},properties:[{name:"name",isAttr:!0,type:"String"},{name:"expression",isAttr:!0,type:"expression"},{name:"string",type:"string"},{name:"stringValue",isAttr:!0,type:"String"}]},{name:"string",superClass:["Element"],meta:{allowedIn:["flowable:Field"]},properties:[{name:"body",isBody:!0,type:"String"}]},{name:"expression",superClass:["Element"],meta:{allowedIn:["flowable:Field"]},properties:[{name:"body",isBody:!0,type:"String"}]},{name:"InputParameter",superClass:["InputOutputParameter"]},{name:"OutputParameter",superClass:["InputOutputParameter"]},{name:"Collectable",isAbstract:!0,extends:["bpmn:MultiInstanceLoopCharacteristics"],superClass:["flowable:AsyncCapable"],properties:[{name:"collection",isAttr:!0,type:"String"},{name:"elementVariable",isAttr:!0,type:"String"}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression"},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"FailedJobRetryTimeCycle",superClass:["Element"],meta:{allowedIn:["flowable:AsyncCapable","bpmn:MultiInstanceLoopCharacteristics"]},properties:[{name:"body",isBody:!0,type:"String"}]},{name:"ExecutionListener",superClass:["Element"],meta:{allowedIn:["bpmn:Task","bpmn:ServiceTask","bpmn:UserTask","bpmn:BusinessRuleTask","bpmn:ScriptTask","bpmn:ReceiveTask","bpmn:ManualTask","bpmn:ExclusiveGateway","bpmn:SequenceFlow","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:StartEvent","bpmn:IntermediateCatchEvent","bpmn:IntermediateThrowEvent","bpmn:EndEvent","bpmn:BoundaryEvent","bpmn:CallActivity","bpmn:SubProcess","bpmn:Process"]},properties:[{name:"expression",isAttr:!0,type:"String"},{name:"class",isAttr:!0,type:"String"},{name:"delegateExpression",isAttr:!0,type:"String"},{name:"event",isAttr:!0,type:"String"},{name:"script",type:"Script"},{name:"fields",type:"Field",isMany:!0}]},{name:"TaskListener",superClass:["Element"],meta:{allowedIn:["bpmn:UserTask"]},properties:[{name:"expression",isAttr:!0,type:"String"},{name:"class",isAttr:!0,type:"String"},{name:"delegateExpression",isAttr:!0,type:"String"},{name:"event",isAttr:!0,type:"String"},{name:"script",type:"Script"},{name:"fields",type:"Field",isMany:!0}]},{name:"FormProperty",superClass:["Element"],meta:{allowedIn:["bpmn:StartEvent","bpmn:UserTask"]},properties:[{name:"id",type:"String",isAttr:!0},{name:"name",type:"String",isAttr:!0},{name:"type",type:"String",isAttr:!0},{name:"required",type:"String",isAttr:!0},{name:"readable",type:"String",isAttr:!0},{name:"writable",type:"String",isAttr:!0},{name:"variable",type:"String",isAttr:!0},{name:"expression",type:"String",isAttr:!0},{name:"datePattern",type:"String",isAttr:!0},{name:"default",type:"String",isAttr:!0},{name:"values",type:"Value",isMany:!0}]},{name:"FormData",superClass:["Element"],meta:{allowedIn:["bpmn:StartEvent","bpmn:UserTask"]},properties:[{name:"fields",type:"FormField",isMany:!0},{name:"businessKey",type:"String",isAttr:!0}]},{name:"FormField",superClass:["Element"],properties:[{name:"id",type:"String",isAttr:!0},{name:"label",type:"String",isAttr:!0},{name:"type",type:"String",isAttr:!0},{name:"datePattern",type:"String",isAttr:!0},{name:"defaultValue",type:"String",isAttr:!0},{name:"properties",type:"Properties"},{name:"validation",type:"Validation"},{name:"values",type:"Value",isMany:!0}]},{name:"Validation",superClass:["Element"],properties:[{name:"constraints",type:"Constraint",isMany:!0}]},{name:"Constraint",superClass:["Element"],properties:[{name:"name",type:"String",isAttr:!0},{name:"config",type:"String",isAttr:!0}]},{name:"ConditionalEventDefinition",isAbstract:!0,extends:["bpmn:ConditionalEventDefinition"],properties:[{name:"variableName",isAttr:!0,type:"String"},{name:"variableEvent",isAttr:!0,type:"String"}]}],emumerations:[]};function Uh(){return`Process_${Math.random().toString(36).slice(2,12)}`}const Wh=`<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" targetNamespace="http://www.flowable.org/processdef">
<process id="process_${Uh()}" name="name_${Uh()}">
<startEvent id="startNode1" name="开始" />
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_flow">
<bpmndi:BPMNPlane id="BPMNPlane_flow" bpmnElement="T-2d89e7a3-ba79-4abd-9f64-ea59621c258c">
<bpmndi:BPMNShape id="BPMNShape_startNode1" bpmnElement="startNode1" bioc:stroke="">
<omgdc:Bounds x="240" y="200" width="30" height="30" />
<bpmndi:BPMNLabel>
<omgdc:Bounds x="242" y="237" width="23" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>`,ZR=["innerHTML"],JR=Rt({__name:"PreviewModal",setup(e){const t=Ee("xml"),n=Ee(""),[i,{closeModal:r}]=Ul(a=>{t.value=a.type,n.value=a.content});function o(){t.value="xml",n.value="",r()}return(a,s)=>(xe(),Je(O(Wl),Zr(a.$attrs,{title:"预览",width:800,showCancelBtn:!1,showOkBtn:!1,onRegister:O(i),onCancel:o}),{default:$(()=>[t.value==="xml"?(xe(),Je(O(cb),{key:0,value:n.value,"read-only":"",mode:O(lb).XML},null,8,["value","mode"])):bt("",!0),pt("div",null,[t.value==="svg"?(xe(),Ot("svg",{key:0,class:"w-full h-100vh",innerHTML:n.value},null,8,ZR)):bt("",!0)])]),_:1},16,["onRegister"]))}}),QR=Ol(JR,[["__scopeId","data-v-fa8fc2c0"]]);var nr=(e=>(e.USER="user",e.CANDIDATE="candidate",e.YOURSELF="yourself",e.SPECIFY="specify",e))(nr||{}),By=(e=>(e.SPECIFY_MULTIPLE="specifyMultiple",e.SPECIFY_SINGLE="specifySingle",e))(By||{}),ln=(e=>(e.SERIAL="serial",e.PARALLEL="parallel",e.NONE="none",e))(ln||{});const e2={"bpmn:EndEvent":{},"bpmn:StartEvent":{initiator:!0,formKey:!0},"bpmn:UserTask":{allocationType:!0,specifyDesc:!0,multipleUserAuditType:!0,async:!0,priority:!0,skipExpression:!0,dueDate:!0,taskListener:!0,executionListener:!0},"bpmn:ServiceTask":{async:!0,skipExpression:!0,isForCompensation:!0,triggerable:!0,class:!0},"bpmn:ScriptTask":{async:!0,isForCompensation:!0,autoStoreVariables:!0},"bpmn:ManualTask":{async:!0,isForCompensation:!0},"bpmn:ReceiveTask":{async:!0,isForCompensation:!0},"bpmn:SendTask":{async:!0,isForCompensation:!0},"bpmn:BusinessRuleTask":{async:!0,isForCompensation:!0,ruleVariablesInput:!0,rules:!0,resultVariable:!0,exclude:!0}},Yi=e=>{const{element:t}=e,{getModeling:n,getModdle:i}=Qn(),r=n(),o=i(),a=pn(()=>{const E=t.businessObject;return E.eventDefinitions?E.eventDefinitions[0].$type:E.$type}),s=pn(()=>e2[a.value]||{}),c=(E,w,_)=>{const x=o==null?void 0:o.create(E,w);return _&&x&&(x.$parent=_),x},l=(E=!0)=>{let w=t.businessObject.get("extensionElements");return!w&&E&&(w=c("bpmn:ExtensionElements",{values:[]},t.businessObject),r==null||r.updateModdleProperties(t,t.businessObject,{extensionElements:w})),w},u=E=>{E||(E=l());let w=E.values.find(_=>_.$type==="flowable:properties");return w||(w=c("flowable:properties",{values:[]},E),r==null||r.updateModdleProperties(t,E,{values:[...E.get("values"),w]})),w},p=E=>{r==null||r.updateProperties(t,E)};return{elementType:a,showConfig:s,updateProperties:p,updateProperty:(E,w)=>{const _=u();let x=_.values.find(P=>P.name===E);return x?(x.name=E,x.value=w):(x=c("flowable:property",{name:E,value:w},_),r==null||r.updateModdleProperties(t,_,{values:[..._.get("values"),x]})),x},updateModdleProperties:(E,w)=>{r==null||r.updateModdleProperties(t,E,w)},createModdleElement:c,idChange:E=>{var _;const w=(_=E.target)==null?void 0:_.value;w&&p({id:w})},nameChange:E=>{var _;const w=(_=E.target)==null?void 0:_.value;w&&p({name:w})},formKeyChange:E=>{p({formKey:E})},getExtensionElements:l,getPropertiesElements:u}},Vo=e=>{const{element:t}=e;return{parseData:()=>{const i=te(te({},t.businessObject),t.businessObject.$attrs);for(const r in i)if(r.indexOf("flowable:")===0){const o=r.replace("flowable:","");i[o]=i[r],delete i[r]}return te({},i)}}},t2=Rt({name:"RoleSelectModal",__name:"RoleSelectModal",emits:["register","selectDone"],setup(e,{emit:t}){const n=t,i=Ee(),r=Ee([]),o=Ee([]),a=Ee({width:"250px",height:"300px"}),[s,{modalLoading:c,closeModal:l}]=Ul(u);function u(d){return rt(this,arguments,function*({roleIds:f}){if(c(!0),f){const m=f.split(",").map(String);o.value=m}const h=yield pb();i.value=h.map(m=>({key:String(m.roleId),title:m.roleName})),c(!1)})}function p(){n("selectDone",o.value),l()}return(f,d)=>(xe(),Je(O(Wl),Zr(f.$attrs,{title:"选择组",canFullscreen:!1,width:600,onOk:p,onRegister:O(s)}),{default:$(()=>[L(O(tb),{"target-keys":o.value,"onUpdate:targetKeys":d[0]||(d[0]=h=>o.value=h),"selected-keys":r.value,"onUpdate:selectedKeys":d[1]||(d[1]=h=>r.value=h),titles:["列表","已选中"],operations:["选中","取消"],"data-source":i.value,render:h=>h.title,"list-style":a.value,"show-search":""},null,8,["target-keys","selected-keys","data-source","render","list-style"])]),_:1},16,["onRegister"]))}}),kl=[{label:"Java类",value:"class",placeholder:"填写全限定Java类名, 如: com.a.Test",rules:[{required:!0,message:"输入正确的Java类名",trigger:["change","blur"],pattern:/^([a-zA-Z_$][a-zA-Z\d_$]*\.)*[a-zA-Z_$][a-zA-Z\d_$]*$/}]},{label:"表达式",value:"expression",placeholder:"如: ${beanClass.doSomething(execution)}",rules:[{required:!0,message:"输入正确的表达式",trigger:["change","blur"],pattern:/\$\{\S+\.\S+(\(\S+\))?}/}]},{label:"委托表达式",value:"delegateExpression",placeholder:"如: ${beanClass}",rules:[{required:!0,message:"输入正确的委托表达式",trigger:["change","blur"],pattern:/\$\{\S+\}/}]}],Np=[{label:"开始事件",value:"start"},{label:"结束事件",value:"end"},{label:"启用事件",value:"take"}],n2=[{label:"创建",value:"create"},{label:"指派",value:"assignment"},{label:"完成",value:"complete"},{label:"删除",value:"delete"}],Yh=[{label:"字符串",value:"stringValue"},{label:"表达式",value:"expression"}],i2=[{label:"事件",field:"event",component:"Select",required:!0,componentProps:{allowClear:!1,options:Np}},{label:"类型",field:"type",required:!0,component:"Select",componentProps({formActionType:e}){const{updateSchema:t,clearValidate:n}=e;return{allowClear:!1,options:kl,onSelect:i=>rt(this,null,function*(){const r=kl.find(o=>o.value===i);r&&(yield n(),yield t({field:"className",label:r.label,rules:r.rules,componentProps:{placeholder:r.placeholder}}))})}}},{label:"表达式",field:"className",component:"Input",show({model:e}){return!!e.type}}],r2={type:[{required:!0,message:"请选择"}],name:[{required:!0,message:"请输入"}],value:[{required:!0,message:"请输入"}]},o2=[{type:"checkbox",align:"center",width:60},{title:"类型",field:"type",align:"center",slots:{default:({row:e})=>{const t=Yh.find(n=>n.value===e.type);return t?t.label:e.type},edit:({row:e})=>L(Jc,{value:e.type,"onUpdate:value":t=>e.type=t,options:Yh,placeholder:"选择类型"},null)},editRender:{}},{title:"名称",field:"name",align:"center",slots:{edit:({row:e})=>L(Qe,{value:e.name,"onUpdate:value":t=>e.name=t,placeholder:"输入名称"},null)},editRender:{}},{title:"值",field:"value",align:"center",slots:{edit:({row:e})=>L(Qe,{value:e.value,"onUpdate:value":t=>e.value=t,placeholder:"输入值"},null)},editRender:{}},{title:"操作",align:"center",slots:{default:({$table:e,row:t})=>{function n(){e.remove(t)}return L(fn("a-button"),{danger:!0,size:"small",onClick:n},{default:()=>[ct("删除")]})}}}],a2={class:"w-full px-6 mb-16px flex gap-8px"},s2=Rt({name:"ListenerModal",__name:"ListenerModal",props:{type:{type:String,default:"executionListener"}},emits:["register","add","edit"],setup(e,{emit:t}){const n=e,i=t,r=Ee(""),[o,{closeModal:a}]=Ul(_=>rt(this,null,function*(){s();const{isEdit:x,record:P}=_;if(x&&P){const A=nb(P,["params","key"]);yield l(A);const C=P.params;d.value&&(h.data=C),r.value=P.key}f({field:"event",componentProps:{options:n.type==="executionListener"?Np:n2}})}));function s(){return rt(this,null,function*(){yield p(),r.value="",h.data=[]})}const[c,{setFieldsValue:l,validate:u,resetForm:p,updateSchema:f}]=fb({name:"listener_form",labelWidth:100,showActionButtonGroup:!1,baseColProps:{span:24},schemas:i2}),d=Ee(),h=U_({id:"VxeTable",keepSource:!0,border:!0,editConfig:{trigger:"click",mode:"row",showStatus:!0},columns:o2,toolbarConfig:{enabled:!1},columnConfig:{resizable:!0},data:[],proxyConfig:{enabled:!1},editRules:r2});function m(){return rt(this,null,function*(){const _=d.value;if(_){const x={type:"",name:"",value:""},{row:P}=yield _.insertAt(x,-1);yield _.setEditCell(P,"name")}})}function v(){const _=d.value;_&&_.removeCheckboxRow()}function E(){return rt(this,null,function*(){const _=d.value;if(!_)return;if(yield _.validate())return Promise.reject(new Error("编辑表格校验失败"));const P=_.getTableData();return Promise.resolve(ib(P.fullData))})}function w(){return rt(this,null,function*(){try{const _=yield u(),x=yield E(),P=Pe(te({},_),{params:x});O(r)?i("edit",P,O(r)):i("add",P),a()}catch(_){}})}return(_,x)=>{const P=fn("a-button");return xe(),Je(O(Wl),Zr(_.$attrs,{title:"监听器",width:700,onRegister:O(o),onOk:w}),{default:$(()=>[L(O(db),{onRegister:O(c)},null,8,["onRegister"]),pt("div",a2,[L(P,{onClick:m},{default:$(()=>[ct("新增")]),_:1}),L(P,{onClick:v},{default:$(()=>[ct("选中删除")]),_:1})]),L(O(hb),Zr({ref_key:"tableRef",ref:d},h),null,16)]),_:1},16,["onRegister"])}}}),$y=Ol(s2,[["__scopeId","data-v-a064e3f4"]]),Fy=[{dataIndex:"event",title:"事件",width:80,customRender({value:e}){const t=Np.find(n=>n.value===e);return t?t.label:e}},{dataIndex:"type",title:"类型",width:100,customRender({value:e}){const t=kl.find(n=>n.value===e);return t?t.label:e}},{dataIndex:"className",ifShow:!1,title:"表达式",width:120}],c2=Rt({name:"TaskListener",__name:"TaskListener",props:{element:{}},setup(e){const t=e,[n,{openModal:i}]=ir();function r(){i(!0,{isEdit:!1})}function o(E){const w=p();w.push(E),m(w)}function a(E){i(!0,{isEdit:!0,record:E})}function s(E,w){const _=p(),x=_.findIndex(P=>P.key===w);x!==-1&&(_[x]=E,m(_))}function c(E){const w=p(),{key:_=""}=E,x=w.findIndex(P=>P.key===_);x!==-1&&(w.splice(x,1),m(w))}const[l,{setTableData:u,getDataSource:p}]=dm({clickToRowSelect:!1,size:"small",showIndexColumn:!1,showTableSetting:!1,inset:!0,bordered:!0,columns:Fy,pagination:!1,scroll:{y:300},actionColumn:{title:"操作",dataIndex:"action",width:100}}),{updateProperties:f}=Yi({element:Vt(t.element)}),{getModdle:d}=Qn(),h=d();function m(E){var w,_,x,P;if(E.length){let A=t.element.businessObject.get("extensionElements");A||(A=h==null?void 0:h.create("bpmn:ExtensionElements")),A.values=(_=(w=A.values)==null?void 0:w.filter(C=>C.$type!=="flowable:TaskListener"))!=null?_:[],E.forEach(C=>{const I=h==null?void 0:h.create("flowable:TaskListener");I.event=C.event,I[C.type]=C.className,C.params&&C.params.length&&C.params.forEach(T=>{const k=h==null?void 0:h.create("flowable:Field");k&&(k.name=T.name,k[T.type]=T.value,I.get("fields").push(k))}),A.get("values").push(I)}),f({extensionElements:A})}else{const A=t.element.businessObject.extensionElements;A&&(A.values=(P=(x=A.values)==null?void 0:x.filter(C=>C.$type!=="flowable:TaskListener"))!=null?P:[])}}function v(){var _,x,P;if(!((_=t.element.businessObject.extensionElements)==null?void 0:_.values))return;const w=(P=(x=t.element.businessObject.extensionElements)==null?void 0:x.values.filter(A=>A.$type==="flowable:TaskListener").map(A=>{var I,T;let C;return"class"in A&&(C="class"),"expression"in A&&(C="expression"),"delegateExpression"in A&&(C="delegateExpression"),{event:A.event,type:C,className:A[C],params:(T=(I=A.fields)==null?void 0:I.map(k=>{let B;return"stringValue"in k&&(B="stringValue"),"expression"in k&&(B="expression"),{name:k.name,type:B,value:k[B]}}))!=null?T:[]}}))!=null?P:[];u(w)}return co(()=>{v()}),(E,w)=>{const _=fn("a-button");return xe(),Ot("div",null,[L(O(hm),{"expand-column-width":30,onRegister:O(l)},{bodyCell:$(({record:x,column:P})=>[P.key==="action"?(xe(),Je(O(mm),{key:0,actions:[{label:"编辑",onClick:a.bind(null,x)},{label:"删除",danger:!0,popConfirm:{placement:"left",title:"是否确认删除",confirm:c.bind(null,x)}}]},null,8,["actions"])):bt("",!0)]),expandedRowRender:$(({record:x})=>[pt("p",null,"表达式/类名: "+cs(x.className),1)]),_:1},8,["onRegister"]),L(_,{class:"mt-8px",onClick:r,block:""},{default:$(()=>[ct("新增监听器")]),_:1}),L($y,{type:"taskListener",onRegister:O(n),onAdd:o,onEdit:s},null,8,["onRegister"])])}}}),Uo=Rt({name:"ExecutionListener",__name:"ExecutionListener",props:{element:{}},setup(e){const t=e,[n,{openModal:i}]=ir();function r(){i(!0,{isEdit:!1})}function o(E){const w=p();w.push(E),m(w)}function a(E){i(!0,{isEdit:!0,record:E})}function s(E,w){const _=p(),x=_.findIndex(P=>P.key===w);x!==-1&&(_[x]=E,m(_))}function c(E){const w=p(),{key:_=""}=E,x=w.findIndex(P=>P.key===_);x!==-1&&(w.splice(x,1),m(w))}const[l,{setTableData:u,getDataSource:p}]=dm({clickToRowSelect:!1,size:"small",showIndexColumn:!1,showTableSetting:!1,inset:!0,bordered:!0,columns:Fy,pagination:!1,scroll:{y:300},actionColumn:{title:"操作",dataIndex:"action",width:100}}),{updateProperties:f}=Yi({element:Vt(t.element)}),{getModdle:d}=Qn(),h=d();function m(E){var w,_,x,P;if(E.length){let A=t.element.businessObject.get("extensionElements");A||(A=h==null?void 0:h.create("bpmn:ExtensionElements")),A.values=(_=(w=A.values)==null?void 0:w.filter(C=>C.$type!=="flowable:ExecutionListener"))!=null?_:[],E.forEach(C=>{const I=h==null?void 0:h.create("flowable:ExecutionListener");I&&(I.event=C.event,I[C.type]=C.className,C.params&&C.params.length&&C.params.forEach(T=>{const k=h==null?void 0:h.create("flowable:Field");k&&(k.name=T.name,k[T.type]=T.value,I.get("fields").push(k))}),A.get("values").push(I))}),f({extensionElements:A})}else{const A=t.element.businessObject.extensionElements;A&&(A.values=(P=(x=A.values)==null?void 0:x.filter(C=>C.$type!=="flowable:ExecutionListener"))!=null?P:[])}}function v(){var _,x,P;if(!((_=t.element.businessObject.extensionElements)==null?void 0:_.values))return;const w=(P=(x=t.element.businessObject.extensionElements)==null?void 0:x.values.filter(A=>A.$type==="flowable:ExecutionListener").map(A=>{var I,T;let C;return"class"in A&&(C="class"),"expression"in A&&(C="expression"),"delegateExpression"in A&&(C="delegateExpression"),{event:A.event,type:C,className:A[C],params:(T=(I=A.fields)==null?void 0:I.map(k=>{let B;return"stringValue"in k&&(B="stringValue"),"expression"in k&&(B="expression"),{name:k.name,type:B,value:k[B]}}))!=null?T:[]}}))!=null?P:[];u(w)}return co(()=>{v()}),(E,w)=>{const _=fn("a-button");return xe(),Ot("div",null,[L(O(hm),{"expand-column-width":30,onRegister:O(l)},{bodyCell:$(({record:x,column:P})=>[P.key==="action"?(xe(),Je(O(mm),{key:0,actions:[{label:"编辑",onClick:a.bind(null,x)},{label:"删除",danger:!0,popConfirm:{placement:"left",title:"是否确认删除",confirm:c.bind(null,x)}}]},null,8,["actions"])):bt("",!0)]),expandedRowRender:$(({record:x})=>[pt("p",null,"表达式/类名: "+cs(x.className),1)]),_:1},8,["onRegister"]),L(_,{class:"mt-8px",onClick:r,block:""},{default:$(()=>[ct("新增监听器")]),_:1}),L($y,{onRegister:O(n),onAdd:o,onEdit:s},null,8,["onRegister"])])}}}),l2=Rt({name:"DueDateInput",components:{InputNumber:pm,RadioButton:rb,RadioGroup:ob},props:{value:{type:String,required:!0}},emits:["change"],setup(e,{emit:t}){function n(){const c=/\d+/,l=e.value.match(c);if(l)return Number(l[0])}function i(){if(e.value){if(e.value.endsWith("H"))return"PT{v}H";if(e.value.endsWith("D"))return"P{v}D";if(e.value.endsWith("W"))return"P{v}W";if(e.value.endsWith("M"))return"P{v}M"}return"PT{v}H"}const r=[{label:"小时",value:"PT{v}H"},{label:"天",value:"P{v}D"},{label:"周",value:"P{v}W"},{label:"月",value:"P{v}M"}],o=Ee(i()),a=Ee(n());function s(){const c=a.value,l=o.value,u={target:{value:""}};if(c){const p=l.replace("{v}",String(c));u.target.value=p}t("change",u)}return{options:r,currentSelect:o,currentNumber:a,handleOnChange:s}}});function u2(e,t,n,i,r,o){const a=fn("RadioButton"),s=fn("RadioGroup"),c=fn("InputNumber");return xe(),Je(c,Zr(e.$attrs,{min:1,value:e.currentNumber,"onUpdate:value":t[2]||(t[2]=l=>e.currentNumber=l),onChange:t[3]||(t[3]=l=>e.handleOnChange())}),{addonAfter:$(()=>[L(s,{value:e.currentSelect,"onUpdate:value":t[0]||(t[0]=l=>e.currentSelect=l),"button-style":"solid",onChange:t[1]||(t[1]=l=>e.handleOnChange())},{default:$(()=>[(xe(!0),Ot(Y_,null,W_(e.options,l=>(xe(),Je(a,{key:l.value,value:l.value},{default:$(()=>[ct(cs(l.label),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"])]),_:1},16,["value"])}const p2=Ol(l2,[["render",u2],["__scopeId","data-v-42bb51ec"]]),f2={class:"h-[calc(100vh-180px)] overflow-scroll"},d2={key:0},h2=Rt({__name:"TaskPanel",props:{element:{}},setup(e){const t=gn.Panel,n=sf.TabPane,[i,{openModal:r}]=ir(),[o,{openModal:a}]=ir(),[s,{openModal:c}]=ir();function l(oe){return Number(oe)>tf(2,53)?oe:Number(oe)}function u(oe){if(oe){const F=[];T.value.candidateUsers&&T.value.candidateUsers.split(",").forEach(R=>{const G=l(R);return F.push(G)}),c(!0,F)}else{if(!T.value.assignee){a(!0);return}const F=T.value.assignee,Y=l(F);a(!0,[Y])}}function p(oe){let F=x();if(F.values=F.values.filter(Y=>Y.$type!=="flowable:extCandidateUsers"),oe.length===0)T.value.candidateUsers=void 0,_({"flowable:candidateUsers":void 0});else{const Y=oe.map(V=>V.userId).join(",");T.value.candidateUsers=Y,_({"flowable:candidateUsers":Y});const R=P("flowable:extCandidateUsers",{body:""},F);F.values.push(R);const G=oe.map(V=>({userId:V.userId,userName:V.userName}));R.body=JSON.stringify(G)}F.values.length===0&&(F=void 0),_({extensionElements:F})}function f(oe){const F=oe.length!==0?oe[0]:void 0;_({"flowable:assignee":F==null?void 0:F.userId}),k.value=F||{userName:""},T.value.assignee=String(F==null?void 0:F.userId);let Y=x();if(Y.values=Y.get("values").filter(R=>R.$type!=="flowable:extAssignee"),F){const R=P("flowable:extAssignee",{body:""},Y);Y.get("values").push(R),R.body=JSON.stringify({userName:F.userName,userId:F.userId})}Y.values.length===0&&(Y=void 0),_({extensionElements:Y})}function d(){const oe=T.value.candidateGroups||"";r(!0,{roleIds:oe})}function h(oe){if(oe.length===0)T.value.candidateGroups="",_({"flowable:candidateGroups":void 0});else{const F=oe.join(",");T.value.candidateGroups=F,_({"flowable:candidateGroups":F})}}const m=e,{showConfig:v,nameChange:E,idChange:w,updateProperties:_,getExtensionElements:x,createModdleElement:P,formKeyChange:A}=Yi({element:Vt(m.element)}),{parseData:C}=Vo({element:Vt(m.element)}),I={id:"",name:"",dueDate:"",multiInstanceType:ln.NONE,allocationType:nr.USER,specifyDesc:By.SPECIFY_SINGLE},T=Ee(te(te({},I),C())),k=Ee({userName:""}),B=Ee([]);Zc(()=>rt(this,null,function*(){const F=(yield ub()).map(Y=>({label:Y.formName+" - "+Y.router,value:Y.formType+":"+Y.id}));B.value=F}));const K=Ee(["1"]);nr.USER,nr.CANDIDATE,nr.YOURSELF,nr.SPECIFY;const Z=[{label:"无",value:ln.NONE},{label:"串行(顺序收到审批)",value:ln.SERIAL},{label:"并行(同时收到审批)",value:ln.PARALLEL}],Ae=oe=>{const F=oe.target.value;_({"flowable:skipExpression":F&&F.length>0?F:void 0})},Ye=oe=>{_({"flowable:async":oe})},Ie=oe=>{_({"flowable:priority":oe})},U=oe=>{const F=oe.target.value;_({"flowable:assignee":F&&F.length>0?F:void 0})},ie=oe=>{if(oe!==ln.NONE){let F=m.element.businessObject.get("loopCharacteristics");F||(F=P("bpmn:MultiInstanceLoopCharacteristics",{},m.element.businessObject)),F.isSequential=oe===ln.SERIAL,_({loopCharacteristics:F})}else _({loopCharacteristics:void 0})},fe=oe=>{const F=oe.target.value;let Y=m.element.businessObject.get("loopCharacteristics");Y||(Y=P("bpmn:MultiInstanceLoopCharacteristics",{},m.element.businessObject)),Y.collection=F&&F.length>0?F:void 0,_({loopCharacteristics:Y})},nt=oe=>{const F=oe.target.value;let Y=m.element.businessObject.get("loopCharacteristics");Y||(Y=P("bpmn:MultiInstanceLoopCharacteristics",{},m.element.businessObject)),Y.elementVariable=F&&F.length>0?F:void 0,_({loopCharacteristics:Y})},St=oe=>{let F=m.element.businessObject.get("loopCharacteristics");F||(F=P("bpmn:MultiInstanceLoopCharacteristics",{},m.element.businessObject));const Y=oe.target.value;Y&&Y.length>0?F.completionCondition?F.completionCondition.body=Y:F.completionCondition=P("bpmn:Expression",{body:Y},F):F.completionCondition=void 0,_({loopCharacteristics:F})},Ct=oe=>{const F=oe.target.value;_({"flowable:dueDate":F&&F.length>0?F:void 0})},bn=pn(()=>T.value.candidateUsers?T.value.candidateUsers.split(",").length:0),jn=pn(()=>T.value.candidateGroups?T.value.candidateGroups.split(",").length:0);return Zc(()=>{var F;const oe=x(!1);if(oe&&oe.get("values")){let Y=oe.get("values").find(R=>R.$type==="flowable:extAssignee");Y&&(k.value=JSON.parse(Y.body))}if(T.value.loopCharacteristics){const Y=T.value.loopCharacteristics;T.value.collection=Y.collection||"",T.value.elementVariable=Y.elementVariable||"",T.value.completionCondition=((F=Y.completionCondition)==null?void 0:F.body)||"",T.value.multiInstanceType=Y.isSequential?ln.SERIAL:ln.PARALLEL}T.value.assignee&&(T.value.fixedAssignee=T.value.assignee)}),(oe,F)=>{const Y=fn("a-button");return xe(),Ot("div",f2,[L(O(lo),{model:T.value,colon:!1,name:"basic","label-align":"left","label-col":{span:6},autocomplete:"off"},{default:$(()=>[L(O(gn),{activeKey:K.value,"onUpdate:activeKey":F[13]||(F[13]=R=>K.value=R),accordion:""},{default:$(()=>[L(O(t),{key:"1",header:"常规"},{default:$(()=>[L(O(Ne),{label:"节点id",name:"id",rules:[{required:!0,message:"输入节点ID"}]},{default:$(()=>[L(O(Qe),{value:T.value.id,"onUpdate:value":F[0]||(F[0]=R=>T.value.id=R),placeholder:"输入节点ID",onChange:O(w)},null,8,["value","onChange"])]),_:1}),L(O(Ne),{label:"节点名称",name:"name",rules:[{required:!1}]},{default:$(()=>[L(O(Qe),{value:T.value.name,"onUpdate:value":F[1]||(F[1]=R=>T.value.name=R),placeholder:"输入节点名称",onChange:O(E)},null,8,["value","onChange"])]),_:1}),O(v).skipExpression?(xe(),Je(O(Ne),{key:0,label:"跳过表达式",name:"skipExpression",rules:[{required:!1}]},{default:$(()=>[L(O(Qe),{value:T.value.skipExpression,"onUpdate:value":F[2]||(F[2]=R=>T.value.skipExpression=R),placeholder:"输入跳过表达式",onChange:Ae},null,8,["value"])]),_:1})):bt("",!0),O(v).skipExpression?(xe(),Je(O(Ne),{key:1,label:"关联表单",name:"formKey",rules:[{required:!1}]},{default:$(()=>[L(O(Jc),{value:T.value.formKey,"onUpdate:value":F[3]||(F[3]=R=>T.value.formKey=R),options:B.value,placeholder:"请选择表单","allow-clear":"",onSelect:O(A)},null,8,["value","options","onSelect"])]),_:1})):bt("",!0)]),_:1}),L(O(t),{key:"2",header:"任务"},{default:$(()=>[O(v).async?(xe(),Je(O(Ne),{key:0,label:"是否异步",name:"async"},{default:$(()=>[L(O(ab),{checked:T.value.async,"onUpdate:checked":F[4]||(F[4]=R=>T.value.async=R),checkedChildren:"是",unCheckedChildren:"否",onChange:Ye},null,8,["checked"])]),_:1})):bt("",!0),L(O(sf),{class:"h-200px mb-24px","tab-position":"left"},{default:$(()=>[L(O(n),{key:"save",tab:"身份存储"},{default:$(()=>[L(O(Ne),{label:"分配人员"},{default:$(()=>[L(O(Qe),{value:T.value.assignee,"onUpdate:value":F[5]||(F[5]=R=>T.value.assignee=R),readonly:"",onClick:F[6]||(F[6]=R=>u(!1)),placeholder:"点击选择人员(单选)",onChange:U},null,8,["value"])]),_:1}),L(O(Ne),{label:"候选人员"},{default:$(()=>[L(O(cf),{count:bn.value},{default:$(()=>[L(Y,{type:"primary",size:"small",onClick:F[7]||(F[7]=R=>u(!0))},{default:$(()=>[ct("选择人员")]),_:1})]),_:1},8,["count"])]),_:1}),L(O(Ne),{label:"候选组"},{default:$(()=>[L(O(cf),{count:jn.value},{default:$(()=>[L(Y,{type:"primary",size:"small",onClick:d},{default:$(()=>[ct("选择组")]),_:1})]),_:1},8,["count"])]),_:1})]),_:1})]),_:1}),O(v).dueDate?(xe(),Je(O(Ne),{key:1,label:"到期时间",name:"dueDate"},{default:$(()=>[L(p2,{value:T.value.dueDate,placeholder:"选择到期时间",onChange:Ct},null,8,["value"])]),_:1})):bt("",!0),O(v).priority?(xe(),Je(O(Ne),{key:2,label:"优先级",name:"priority"},{default:$(()=>[L(O(pm),{modelValue:T.value.priority,"onUpdate:modelValue":F[8]||(F[8]=R=>T.value.priority=R),placeholder:"请输入",onChange:Ie},null,8,["modelValue"])]),_:1})):bt("",!0)]),_:1}),L(O(t),{key:"3",header:"多实例"},{default:$(()=>[L(O(Ne),{label:"多实例类型"},{default:$(()=>[L(O(Jc),{value:T.value.multiInstanceType,"onUpdate:value":F[9]||(F[9]=R=>T.value.multiInstanceType=R),options:Z,onChange:ie},null,8,["value"])]),_:1}),T.value.multiInstanceType!==O(ln).NONE?(xe(),Ot("div",d2,[L(O(Ne),{label:"集合",tooltip:`属性会作为表达式进行解析。如果表达式解析为字符串而不是一个集合
不论是因为本身配置的就是静态字符串值,还是表达式计算结果为字符串
这个字符串都会被当做变量名,并从流程变量中用于获取实际的集合。`},{default:$(()=>[L(O(Qe),{value:T.value.collection,"onUpdate:value":F[10]||(F[10]=R=>T.value.collection=R),placeholder:"请输入",onChange:fe},null,8,["value"])]),_:1}),L(O(Ne),{label:"元素变量",tooltip:`每创建一个用户任务前先以该元素变量为label集合中的一项为value
创建(局部)流程变量,该局部流程变量被用于指派用户任务。
一般来说,该字符串应与指定人员变量相同。`},{default:$(()=>[L(O(Qe),{value:T.value.elementVariable,"onUpdate:value":F[11]||(F[11]=R=>T.value.elementVariable=R),placeholder:"请输入",onChange:nt},null,8,["value"])]),_:1}),L(O(Ne),{label:"完成条件",tooltip:`多实例活动在所有实例都完成时结束,然而也可以指定一个表达式,在每个实例
结束时进行计算。当表达式计算为true时将销毁所有剩余的实例并结束多实例
活动,继续执行流程。例如 \${nrOfCompletedInstances/nrOfInstances >= 0.6 }
表示当任务完成60%时,该节点就算完成`},{default:$(()=>[L(O(Qe),{value:T.value.completionCondition,"onUpdate:value":F[12]||(F[12]=R=>T.value.completionCondition=R),placeholder:"请输入",onChange:St},null,8,["value"])]),_:1})])):bt("",!0)]),_:1}),L(O(t),{key:"4",header:"任务监听器"},{default:$(()=>[O(v).taskListener?(xe(),Je(c2,{key:0,element:oe.element},null,8,["element"])):bt("",!0)]),_:1}),L(O(t),{key:"5",header:"执行监听器"},{default:$(()=>[O(v).executionListener?(xe(),Je(Uo,{key:0,element:oe.element},null,8,["element"])):bt("",!0)]),_:1})]),_:1},8,["activeKey"])]),_:1},8,["model"]),L(ff,{multiple:!0,onRegister:O(s),onSelectDone:p},null,8,["onRegister"]),L(ff,{multiple:!1,onRegister:O(o),onSelectDone:f},null,8,["onRegister"]),L(t2,{onRegister:O(i),onSelectDone:h},null,8,["onRegister"])])}}}),m2=Rt({__name:"ProcessPanel",props:{element:{}},setup(e){const t=gn.Panel,n=e,{parseData:i}=Vo({element:Vt(n.element)}),{idChange:r,nameChange:o}=Yi({element:Vt(n.element)}),a=Ee(["1","2"]),s=Ee(i());return(c,l)=>(xe(),Ot("div",null,[L(O(gn),{activeKey:a.value,"onUpdate:activeKey":l[2]||(l[2]=u=>a.value=u)},{default:$(()=>[L(O(t),{key:"1",header:"常规"},{default:$(()=>[L(O(lo),{model:s.value,colon:!1,name:"basic","label-align":"left","label-col":{span:6},"wrapper-col":{span:16},autocomplete:"off"},{default:$(()=>[L(O(Ne),{label:"流程标识",name:"id",rules:[{required:!0,message:"请输入流程标识"}]},{default:$(()=>[L(O(Qe),{value:s.value.id,"onUpdate:value":l[0]||(l[0]=u=>s.value.id=u),placeholder:"输入ID",onChange:O(r)},null,8,["value","onChange"])]),_:1}),L(O(Ne),{label:"流程名称",name:"name",rules:[{required:!0,message:"请输入节点名称"}]},{default:$(()=>[L(O(Qe),{value:s.value.name,"onUpdate:value":l[1]||(l[1]=u=>s.value.name=u),placeholder:"输入节点名称",onChange:O(o)},null,8,["value","onChange"])]),_:1})]),_:1},8,["model"])]),_:1}),L(O(t),{key:"2",header:"执行监听器"},{default:$(()=>[L(Uo,{element:c.element},null,8,["element"])]),_:1})]),_:1},8,["activeKey"])]))}}),v2=Rt({__name:"StartEndPanel",props:{element:{}},setup(e){const t=gn.Panel,n=e,{nameChange:i,idChange:r}=Yi({element:Vt(n.element)}),{parseData:o}=Vo({element:Vt(n.element)}),a=Ee(o()),s=Ee(["1","2"]);return(c,l)=>(xe(),Ot("div",null,[L(O(gn),{activeKey:s.value,"onUpdate:activeKey":l[2]||(l[2]=u=>s.value=u)},{default:$(()=>[L(O(t),{key:"1",header:"常规"},{default:$(()=>[L(O(lo),{model:a.value,colon:!1,name:"basic","label-align":"left","label-col":{span:6},"wrapper-col":{span:16},autocomplete:"off"},{default:$(()=>[L(O(Ne),{label:"节点ID",name:"id",rules:[{required:!0,message:"请输入节点ID"}]},{default:$(()=>[L(O(Qe),{value:a.value.id,"onUpdate:value":l[0]||(l[0]=u=>a.value.id=u),placeholder:"输入节点ID",onChange:O(r)},null,8,["value","onChange"])]),_:1}),L(O(Ne),{label:"节点名称",name:"name"},{default:$(()=>[L(O(Qe),{value:a.value.name,"onUpdate:value":l[1]||(l[1]=u=>a.value.name=u),placeholder:"输入节点名称",onChange:O(i)},null,8,["value","onChange"])]),_:1})]),_:1},8,["model"])]),_:1}),L(O(t),{key:"2",header:"执行监听器"},{default:$(()=>[L(Uo,{element:c.element},null,8,["element"])]),_:1})]),_:1},8,["activeKey"])]))}}),g2=Rt({__name:"GatewayPanel",props:{element:{}},setup(e){const t=gn.Panel,n=e,{nameChange:i,idChange:r}=Yi({element:Vt(n.element)}),{parseData:o}=Vo({element:Vt(n.element)}),a=Ee(["1","2"]),s=Ee(o());return(c,l)=>(xe(),Ot("div",null,[L(O(gn),{activeKey:a.value,"onUpdate:activeKey":l[2]||(l[2]=u=>a.value=u)},{default:$(()=>[L(O(t),{key:"1",header:"常规"},{default:$(()=>[L(O(lo),{model:s.value,colon:!1,name:"basic","label-align":"left","label-col":{span:6},"wrapper-col":{span:16},autocomplete:"off"},{default:$(()=>[L(O(Ne),{label:"节点标识",name:"id",rules:[{required:!0,message:"输入节点标识"}]},{default:$(()=>[L(O(Qe),{value:s.value.id,"onUpdate:value":l[0]||(l[0]=u=>s.value.id=u),placeholder:"请输入",onChange:O(r)},null,8,["value","onChange"])]),_:1}),L(O(Ne),{label:"节点名称",name:"name"},{default:$(()=>[L(O(Qe),{value:s.value.name,"onUpdate:value":l[1]||(l[1]=u=>s.value.name=u),placeholder:"请输入",onChange:O(i)},null,8,["value","onChange"])]),_:1})]),_:1},8,["model"])]),_:1}),L(O(t),{key:"2",header:"执行监听器"},{default:$(()=>[L(Uo,{element:c.element},null,8,["element"])]),_:1})]),_:1},8,["activeKey"])]))}}),y2=Rt({__name:"SequenceFlowPanel",props:{element:{}},setup(e){const t=gn.Panel,n=e,{nameChange:i,idChange:r,updateProperties:o}=Yi({element:Vt(n.element)}),{parseData:a}=Vo({element:Vt(n.element)}),s=Qn().getModdle(),c=Ee(["1","2"]),l=Ee(a()),u=f=>{const d=f.target.value;if(d){const h=s==null?void 0:s.create("bpmn:FormalExpression",{body:d});o({conditionExpression:h})}else o({conditionExpression:null})},p=f=>{const d=f.target.value;o({"flowable:skipExpression":d&&d.length>0?d:void 0})};return Zc(()=>{l.value.conditionExpression&&(l.value.conditionExpressionValue=l.value.conditionExpression.body)}),(f,d)=>(xe(),Ot("div",null,[L(O(gn),{activeKey:c.value,"onUpdate:activeKey":d[4]||(d[4]=h=>c.value=h)},{default:$(()=>[L(O(t),{key:"1",header:"常规"},{default:$(()=>[L(O(lo),{model:l.value,colon:!1,name:"basic","label-align":"left","label-col":{span:6},"wrapper-col":{span:16},autocomplete:"off"},{default:$(()=>[L(O(Ne),{label:"节点ID",name:"id",rules:[{required:!0,message:"输入节点ID"}]},{default:$(()=>[L(O(Qe),{value:l.value.id,"onUpdate:value":d[0]||(d[0]=h=>l.value.id=h),placeholder:"输入节点ID",onChange:O(r)},null,8,["value","onChange"])]),_:1}),L(O(Ne),{label:"节点名称",name:"name"},{default:$(()=>[L(O(Qe),{value:l.value.name,"onUpdate:value":d[1]||(d[1]=h=>l.value.name=h),placeholder:"输入节点名称",onChange:O(i)},null,8,["value","onChange"])]),_:1}),L(O(Ne),{label:"跳转条件",name:"conditionExpression"},{default:$(()=>[L(O(Qe),{value:l.value.conditionExpressionValue,"onUpdate:value":d[2]||(d[2]=h=>l.value.conditionExpressionValue=h),placeholder:"输入跳转条件",onChange:u},null,8,["value"])]),_:1}),l.value.skipExpression?(xe(),Je(O(Ne),{key:0,label:"跳过表达式",name:"skipExpression"},{default:$(()=>[L(O(Qe),{value:l.value.skipExpression,"onUpdate:value":d[3]||(d[3]=h=>l.value.skipExpression=h),placeholder:"输入跳过表达式",onChange:p},null,8,["value"])]),_:1})):bt("",!0)]),_:1},8,["model"])]),_:1}),L(O(t),{key:"2",header:"执行监听器"},{default:$(()=>[L(Uo,{element:f.element},null,8,["element"])]),_:1})]),_:1},8,["activeKey"])]))}}),_2=Rt({__name:"index",props:{modeler:{},panelVisible:{type:Boolean},enableTransition:{type:Boolean}},setup(e){const t=Ee({padding:0}),n=e,i=Ee(!0);q_(()=>n.panelVisible,m=>{n.enableTransition&&(m?setTimeout(()=>{i.value=m},200):i.value=m)},{immediate:!0});const r=pn(()=>n.enableTransition?"transition-width duration-200":""),o=Ee(),a=Ee(),s=["bpmn:IntermediateThrowEvent","bpmn:StartEvent","bpmn:EndEvent"],c=["bpmn:UserTask","bpmn:Task","bpmn:SendTask","bpmn:ReceiveTask","bpmn:ManualTask","bpmn:BusinessRuleTask","bpmn:ServiceTask","bpmn:ScriptTask"],l=["bpmn:SequenceFlow"],u=["bpmn:InclusiveGateway","bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"],p=["bpmn:Process"],f=pn(()=>{if(!o.value)return null;const m=o.value.type;return s.includes(m)?v2:c.includes(m)?h2:l.includes(m)?y2:u.includes(m)?g2:p.includes(m)?m2:null}),d=pn(()=>{if(o.value){const m=o.value.businessObject,v=m!=null&&m.eventDefinitions&&(m==null?void 0:m.eventDefinitions.length)>0?m.eventDefinitions[0].$type:m.$type;return JC[v]||v}return null}),h=()=>{n.modeler.on("root.added",m=>{o.value=null,m.element.type==="bpmn:Process"&&ra(()=>{o.value=m.element,a.value=m.element})}),n.modeler.on("element.click",m=>{m.element.type==="bpmn:Process"&&ra(()=>{o.value=m.element,a.value=m.element})}),n.modeler.on("selection.changed",m=>{o.value=null;const v=m.newSelection[0];v?ra(()=>{o.value=v}):ra(()=>{o.value=a.value})})};return co(()=>{h()}),(m,v)=>(xe(),Je(O(sb),{class:um(r.value),title:d.value,bodyStyle:t.value},{default:$(()=>[o.value?K_((xe(),Je(Z_(f.value),{key:0,element:o.value},null,8,["element"])),[[X_,i.value]]):bt("",!0)]),_:1},8,["class","title","bodyStyle"]))}}),b2={class:"bpmn-page"},E2={width:"0",height:"0",style:{position:"absolute"}},x2=pt("defs",null,[pt("marker",{id:"markerArrow-dark-mode",viewBox:"0 0 20 20",refX:"11",refY:"10",markerWidth:"10",markerHeight:"10",orient:"auto"},[pt("path",{d:"M 1 5 L 11 10 L 1 15 Z",class:"arrow-dark"})])],-1),w2=[x2],S2={class:"flex justify-between p-2"},C2=pt("span",null,"适应屏幕(居中)",-1),T2=pt("span",null,"缩小视图",-1),P2=pt("span",null,"放大视图",-1),R2=pt("span",null,"撤销",-1),A2=pt("span",null,"恢复",-1),I2=pt("span",null,"开启/关闭流程模拟",-1),M2=pt("span",null,"展开/收起小地图",-1),D2={class:"flex flex-row h-full w-full"},k2=Rt({name:"BpmnDesign",__name:"index",props:{xml:{type:String,default:Wh}},emits:["save"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=Ee(),a=Ee(),s=Ee(1),c=Qn(),l=v_("__bpmn_design_properties_panel_visible__",!0),u=pn(()=>l.value);function p(){l.value=!l.value}const f=pn(()=>l.value?"隐藏属性栏":"显示属性栏"),d=pn(()=>l.value?"w-460px h-full":"w-0");co(()=>{a.value=new dn({container:o.value,keyboard:{bindTo:window},additionalModules:KR,moddleExtensions:{flowable:XR}}),h(),m(i.xml)});function h(){var U;c.getModeler()&&((U=c.getModeler())==null||U.destroy(),c.setModeler(void 0)),c.setModeler(a.value)}function m(U){var ie;U||(U=Wh),(ie=a.value)==null||ie.importXML(U)}function v(){var nt,St,Ct,bn;s.value=((nt=a.value)==null?void 0:nt.get("canvas").zoom("fit-viewport"))||1;const U=(St=document.querySelector(".bpmn-page .viewport"))==null?void 0:St.getBBox();if(!U)return;const ie=(Ct=a.value)==null?void 0:Ct.get("canvas").viewbox(),fe={x:U.x+U.width/2-65,y:U.y+U.height/2};ie&&((bn=a.value)==null||bn.get("canvas").viewbox({x:fe.x-ie.width/2,y:fe.y-ie.height/2,width:ie.width,height:ie.height}),s.value=U.width/ie.width*1.8)}function E(U=!0){var ie,fe;s.value=((ie=a.value)==null?void 0:ie.get("canvas").zoom())||1,s.value+=U?.1:-.1,(fe=a.value)==null||fe.get("canvas").zoom(s.value)}function w(){var U;(U=a.value)==null||U.get("commandStack").undo()}function _(){var U;(U=a.value)==null||U.get("commandStack").redo()}function x(){var ie;const U=(ie=a.value)==null?void 0:ie.getDefinitions().rootElements;for(let fe=0;fe<U.length;fe++)if(U[fe].$type==="bpmn:Process")return U[fe]}function P(){return rt(this,null,function*(){var U;try{if(!a.value)return;const{xml:ie=""}=yield a.value.saveXML({format:!0}),nt=`${(U=x().name)!=null?U:"unknown"}.bpmn20.xml`,St="application/xml",Ct=new Blob([ie],{type:St});pf(Ct,nt,St)}catch(ie){}})}function A(){return rt(this,null,function*(){var U;try{if(!a.value)return;const{svg:ie}=yield a.value.saveSVG(),fe=(U=x().name)!=null?U:"unknown",nt="image/svg+xml",St=new Blob([ie],{type:nt});pf(St,fe,nt)}catch(ie){}})}function C(U){return rt(this,null,function*(){switch(U.key){case"exportXml":yield P();break;case"exportSvg":yield A();break}})}function I(){return rt(this,null,function*(){if(!a.value)return;const{xml:U=""}=yield a.value.saveXML({format:!0});B(!0,{type:"xml",content:U})})}function T(){return rt(this,null,function*(){if(!a.value)return;const{svg:U}=yield a.value.saveSVG();B(!0,{type:"svg",content:U})})}const[k,{openModal:B}]=ir();function K(U){return rt(this,null,function*(){switch(U.key){case"xml":yield I();break;case"svg":yield T();break}})}function Z(){a.value&&a.value.get("toggleMode").toggleMode()}function Ae(){var U;(U=a.value)==null||U.get("minimap").toggle()}function Ye(){const U=x();return{id:U.id,name:U.name}}function Ie(){return rt(this,null,function*(){if(!a.value)return;const{xml:U}=yield a.value.saveXML({format:!0}),{svg:ie}=yield a.value.saveSVG(),fe=Ye(),nt={xml:U,svg:ie,key:fe.id,name:fe.name};r("save",nt)})}return t({initDiagram:m}),(U,ie)=>{const fe=fn("a-button");return xe(),Ot("div",b2,[(xe(),Ot("svg",E2,w2)),pt("div",S2,[L(O(fm),null,{default:$(()=>[L(fe,{type:"primary",onClick:Ie},{default:$(()=>[ct(" 保存 ")]),_:1}),L(O(lf),null,{overlay:$(()=>[L(O(uf),{onClick:C},{default:$(()=>[L(O(oa),{key:"exportXml"},{default:$(()=>[L(ia,{icon:"carbon:xml",class:"mr-1"}),ct("导出xml")]),_:1}),L(O(oa),{key:"exportSvg"},{default:$(()=>[L(ia,{icon:"teenyicons:svg-outline",class:"mr-1"}),ct("导出svg")]),_:1})]),_:1})]),default:$(()=>[L(fe,{"pre-icon":"ph:export-light"},{default:$(()=>[ct(" 导出 ")]),_:1})]),_:1}),L(O(lf),null,{overlay:$(()=>[L(O(uf),{onClick:K},{default:$(()=>[L(O(oa),{key:"xml"},{default:$(()=>[L(ia,{icon:"carbon:xml",class:"mr-1"}),ct("预览xml")]),_:1}),L(O(oa),{key:"svg"},{default:$(()=>[L(ia,{icon:"carbon:json",class:"mr-1"}),ct("预览svg")]),_:1})]),_:1})]),default:$(()=>[L(fe,{"pre-icon":"mage:preview"},{default:$(()=>[ct(" 预览 ")]),_:1})]),_:1}),L(O(Ei),{placement:"bottom"},{title:$(()=>[C2]),default:$(()=>[L(fe,{"pre-icon":"material-symbols:center-focus-strong-outline",onClick:v})]),_:1}),L(O(Ei),{placement:"bottom"},{title:$(()=>[T2]),default:$(()=>[L(fe,{"pre-icon":"ooui:zoom-out",onClick:ie[0]||(ie[0]=nt=>E(!1))})]),_:1}),L(O(Ei),{placement:"bottom"},{title:$(()=>[P2]),default:$(()=>[L(fe,{"pre-icon":"ooui:zoom-in",onClick:ie[1]||(ie[1]=nt=>E(!0))})]),_:1}),L(O(Ei),{placement:"bottom"},{title:$(()=>[R2]),default:$(()=>[L(fe,{"pre-icon":"grommet-icons:link-previous",onClick:w})]),_:1}),L(O(Ei),{placement:"bottom"},{title:$(()=>[A2]),default:$(()=>[L(fe,{"pre-icon":"grommet-icons:link-next",onClick:_})]),_:1}),L(O(Ei),{placement:"bottom"},{title:$(()=>[I2]),default:$(()=>[L(fe,{"pre-icon":"fluent:desktop-flow-20-regular",onClick:Z})]),_:1}),L(O(Ei),{placement:"bottom"},{title:$(()=>[M2]),default:$(()=>[L(fe,{"pre-icon":"gis:map-rm",onClick:Ae})]),_:1}),L(fe,{"pre-icon":"akar-icons:panel-right",onClick:p},{default:$(()=>[ct(cs(f.value),1)]),_:1})]),_:1}),J_(U.$slots,"menuRight")]),pt("div",D2,[pt("div",{id:"container",ref_key:"containerRef",ref:o,class:"flex-1 h-[calc(100%-48px)]"},null,512),a.value?(xe(),Je(_2,{key:0,enableTransition:!0,panelVisible:u.value,modeler:a.value,class:um(d.value)},null,8,["panelVisible","modeler","class"])):bt("",!0)]),L(QR,{onRegister:O(k)},null,8,["onRegister"])])}}}),O2={class:"w-full h-full overflow-hidden"},hA=Rt({name:"BpmnDesignPage",__name:"index",setup(e){const n=Q_().params.id||"0",i=Ee(),r=Ee(),{setTitle:o,closeCurrent:a}=g_();co(()=>rt(this,null,function*(){var p;const u=yield mb(n);r.value=u,o("流程设计: "+u.name),(p=i.value)==null||p.initDiagram(u.xml)}));const{createConfirm:s}=y_();function c(u){if(!r.value)return;const p=te(te({},r.value),u),f=s({iconType:"warning",title:"提示",content:"是否确认保存",onOk(){return rt(this,null,function*(){try{yield vb(p),a()}catch(h){f.destroy()}})}})}function l(){s({iconType:"warning",title:"提示",content:"是否确认关闭当前页面",onOk(){a()}})}return(u,p)=>{const f=fn("a-button");return xe(),Ot("div",O2,[L(k2,{ref_key:"bpmnRef",ref:i,onSave:c},{menuRight:$(()=>[L(O(fm),null,{default:$(()=>[L(f,{onClick:l},{default:$(()=>[ct("关闭页面")]),_:1})]),_:1})]),_:1},512)])}}});export{hA as default};