22 lines
164 KiB
JavaScript
22 lines
164 KiB
JavaScript
/*! bpmn-js - bpmn-navigated-viewer v4.0.4 | Copyright (c) 2014-present, camunda Services GmbH | bpmn.io/license */
|
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).BpmnJS=t()}(this,function(){"use strict";var e,t=(function(e){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}(e={exports:{}},e.exports),e.exports),n=Object.prototype.toString,s=Object.prototype.hasOwnProperty;function l(e){return void 0!==e}function u(e){return"[object Array]"===n.call(e)}function M(e){return"[object Object]"===n.call(e)}function o(e){return"[object Number]"===n.call(e)}function h(e){var t=n.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function p(e){return"[object String]"===n.call(e)}function k(e,n){var t,i;return n=h(t=n)?t:function(e){return e===t},T(e,function(e,t){if(n(e,t))return i=e,!1}),i}function P(e,n){var i=[];return T(e,function(e,t){n(e,t)&&i.push(e)}),i}function T(e,t){var n;if(void 0!==e){var i,r,a=u(e)?m:c;for(var o in e)if(i=e,r=o,s.call(i,r)&&!1===t(n=e[o],a(o)))return n}}function b(e,n,i){return T(e,function(e,t){i=n(i,e,t)}),i}function a(e,i){return b(e,function(e,t,n){return e&&i(t,n)},!0)}function i(e){return function(n){return a(e,function(e,t){return n[t]===e})}}function c(e){return e}function m(e){return Number(e)}function f(e,t){return e.bind(t)}function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function N(e){for(var t=arguments.length,n=new Array(1<t?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return r.apply(void 0,[e].concat(n))}var d=[].indexOf,y=function(e,t){if(d)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1},g=/\s+/,v=Object.prototype.toString;function x(e){return new E(e)}function E(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function w(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e}E.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~y(t,e)||t.push(e),this.el.className=t.join(" "),this},E.prototype.remove=function(e){if("[object RegExp]"==v.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=y(t,e);return~n&&t.splice(n,1),this.el.className=t.join(" "),this},E.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},E.prototype.toggle=function(e,t){return this.list?void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e):void 0!==t?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this},E.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(g);return""===e[0]&&e.shift(),e},E.prototype.has=E.prototype.contains=function(e){return this.list?this.list.contains(e):!!~y(this.array(),e)};var _=Element.prototype,A=_.matchesSelector||_.webkitMatchesSelector||_.mozMatchesSelector||_.msMatchesSelector||_.oMatchesSelector,S=function(e,t){if(A)return A.call(e,t);for(var n=e.parentNode.querySelectorAll(t),i=0;i<n.length;++i)if(n[i]==e)return!0;return!1};var R,C=function(e,t,n){for(var i=n?e:e.parentNode;i&&i!==document;){if(S(i,t))return i;i=i.parentNode}},D=window.addEventListener?"addEventListener":"attachEvent",O=window.removeEventListener?"removeEventListener":"detachEvent",B="addEventListener"!==D?"on":"",L={bind:function(e,t,n,i){return e[D](B+t,n,i||!1),n},unbind:function(e,t,n,i){return e[O](B+t,n,i||!1),n}},I=["focus","blur"],F={bind:function(n,i,e,r,t){return-1!==I.indexOf(e)&&(t=!0),L.bind(n,e,function(e){var t=e.target||e.srcElement;e.delegateTarget=C(t,i,!0),e.delegateTarget&&r.call(n,e)},t)},unbind:function(e,t,n,i){-1!==I.indexOf(t)&&(i=!0),L.unbind(e,t,n,i)}},j=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var i=n[1];if("body"==i){var r=t.createElement("html");return r.innerHTML=e,r.removeChild(r.lastChild)}var a=W[i]||W._default,o=a[0],s=a[1],l=a[2];(r=t.createElement("div")).innerHTML=s+e+l;for(;o--;)r=r.lastChild;if(r.firstChild==r.lastChild)return r.removeChild(r.firstChild);var p=t.createDocumentFragment();for(;r.firstChild;)p.appendChild(r.removeChild(r.firstChild));return p},V=!1;"undefined"!=typeof document&&((R=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',V=!R.getElementsByTagName("link").length,R=void 0);var W={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:V?[1,"X<div>","</div>"]:[0,"",""]};W.td=W.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],W.option=W.optgroup=[1,'<select multiple="multiple">',"</select>"],W.thead=W.tbody=W.colgroup=W.caption=W.tfoot=[1,"<table>","</table>"],W.polyline=W.ellipse=W.polygon=W.circle=W.text=W.line=W.path=W.rect=W.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var z="undefined"!=typeof Element?Element.prototype:{},G=z.matches||z.matchesSelector||z.webkitMatchesSelector||z.mozMatchesSelector||z.msMatchesSelector||z.oMatchesSelector,$=function(e,t){if(!e||1!==e.nodeType)return!1;if(G)return G.call(e,t);for(var n=e.parentNode.querySelectorAll(t),i=0;i<n.length;i++)if(n[i]==e)return!0;return!1};function H(e,t){return(t=t||document).querySelector(e)}function K(e){e.parentNode&&e.parentNode.removeChild(e)}function U(e,t){return t.appendChild(function(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch(e){}return e}(e,t))}function q(e,t){return U(t,e),e}var Y=2,X={"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":Y,"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":Y,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function Z(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=X[i];r?(r===Y&&"number"==typeof n&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function J(e,t,n){if("string"==typeof t){if(void 0===n)return i=e,X[r=t]?i.style[r]:i.getAttributeNS(null,r);Z(e,t,n)}else!function(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)Z(e,i,t[i])}(e,t);var i,r;return e}function Q(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}var ee=/\s+/,te=Object.prototype.toString;function ne(e){return void 0!==e}function ie(e){return new re(e)}function re(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function ae(e){var t=e.parentNode;return t&&t.removeChild(e),e}re.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~Q(t,e)||t.push(e),ne(this.el.className.baseVal)?this.el.className.baseVal=t.join(" "):this.el.className=t.join(" "),this},re.prototype.remove=function(e){if("[object RegExp]"===te.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=Q(t,e);return~n&&t.splice(n,1),this.el.className.baseVal=t.join(" "),this},re.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},re.prototype.toggle=function(e,t){return this.list?ne(t)?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e):ne(t)?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this},re.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(ee);return""===e[0]&&e.shift(),e},re.prototype.has=re.prototype.contains=function(e){return this.list?this.list.contains(e):!!~Q(this.array(),e)};var oe={svg:"http://www.w3.org/2000/svg"},se='<svg xmlns="'+oe.svg+'"';function le(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(oe.svg)&&(e=se+e.substring(4)):(e=se+">"+e+"</svg>",t=!0);var n,i,r=(n=e,(i=new DOMParser).async=!1,i.parseFromString(n,"text/xml"));if(!t)return r;for(var a=document.createDocumentFragment(),o=r.firstChild;o.firstChild;)a.appendChild(o.firstChild);return a}function pe(e,t){var n;return n="<"===e.charAt(0)?(n=le(e).firstChild,document.importNode(n,!0)):document.createElementNS(oe.svg,e),t&&J(n,t),n}var ce=pe("svg");function ue(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function he(e){return e?ce.createSVGTransformFromMatrix(e):ce.createSVGTransform()}var me=/([&<>]{1})/g,fe=/([\n\r"]{1})/g,de={"&":"&","<":"<",">":">",'"':"'"};function ye(e,t){return e.replace(t,function(e,t){return de[t]||t})}function ge(e,t){var n,i,r,a,o;switch(e.nodeType){case 3:t.push(ye(e.textContent,me));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(n=0,i=(r=e.attributes).length;n<i;++n)a=r.item(n),t.push(" ",a.name,'="',ye(a.value,fe),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,i=(o=e.childNodes).length;n<i;++n)ge(o.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",ye(e.nodeValue,me),"--\x3e");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function ve(e,t){var n=le(t);if(function(e){for(var t;t=e.firstChild;)ae(t)}(e),t){"#document-fragment"!==n.nodeName&&(n=n.documentElement);for(var i,r=(i=n.childNodes,Array.prototype.slice.call(i)),a=0;a<r.length;a++)U(r[a],e)}}function xe(e,t){if(void 0===t)return function(e){for(var t=e.firstChild,n=[];t;)ge(t,n),t=t.nextSibling;return n.join("")}(e);try{ve(e,t)}catch(e){throw new Error("error parsing SVG: "+e.message)}return e}function be(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),function(e,t){var n,i,r,a;for(e.clear(),n=0;i=t[n];n++)e.appendItem((r=e,(a=i)instanceof SVGMatrix?r.createSVGTransformFromMatrix(a):a))}(n,t)),n.consolidate()}var Ee=/^class /;function we(e){return"[object Array]"===Object.prototype.toString.call(e)}function _e(){var e=Array.prototype.slice.call(arguments);1===e.length&&we(e[0])&&(e=e[0]);var t=e.pop();return t.$inject=e,t}var Ae=/constructor\s*[^(]*\(\s*([^)]*)\)/m,Se=/^function\s*[^(]*\(\s*([^)]*)\)/m,Re=/\/\*([^*]*)\*\//m;function Ce(e){if("function"!=typeof e)throw new Error('Cannot annotate "'+e+'". Expected a function!');var t,n=e.toString().match((t=e,Ee.test(t.toString())?Ae:Se));return n&&n[1]&&n[1].split(",").map(function(e){return(n=e.match(Re))?n[1].trim():e.trim()})||[]}var ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function Me(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function Pe(e,a){a=a||{get:function(e,t){if(o.push(e),!1===t)return null;throw l('No provider for "'+e+'"!')}};var o=[],h=this._providers=Object.create(a._providers||null),s=this._instances=Object.create(null),m=s.injector=this,l=function(e){var t=o.join(" -> ");return o.length=0,new Error(t?e+" (Resolving: "+t+")":e)},n=function e(t,n){if(!h[t]&&-1!==t.indexOf(".")){for(var i=t.split("."),r=e(i.shift());i.length;)r=r[i.shift()];return r}if(Te(s,t))return s[t];if(Te(h,t)){if(-1!==o.indexOf(t))throw o.push(t),l("Cannot resolve circular dependency!");return o.push(t),s[t]=h[t][0](h[t][1]),o.pop(),s[t]}return a.get(t,n)},p=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof e){if(!we(e))throw new Error('Cannot invoke "'+e+'". Expected a function!');e=_e(e.slice())}return{fn:e,dependencies:(e.$inject||Ce(e)).map(function(e){return Te(t,e)?t[e]:n(e)})}},t=function(e){var t=p(e),n=t.dependencies,i=t.fn;return new(Function.prototype.bind.apply(i,[null].concat(Me(n))))},i=function(e,t,n){var i=p(e,n),r=i.dependencies,a=i.fn;return a.call.apply(a,[t].concat(Me(r)))},f=function(t){return _e(function(e){return t.get(e)})},c={factory:i,type:t,value:function(e){return e}};e.forEach(function(i){function r(e,t){return"value"!==e&&we(t)&&(t=_e(t.slice())),t}if(i instanceof function(){var n=[];this.factory=function(e,t){return n.push([e,"factory",t]),this},this.value=function(e,t){return n.push([e,"value",t]),this},this.type=function(e,t){return n.push([e,"type",t]),this},this.forEach=function(e){n.forEach(e)}})i.forEach(function(e){var t=e[0],n=e[1],i=e[2];h[t]=[c[n],r(n,i),n]});else if("object"===(void 0===i?"undefined":ke(i)))if(i.__exports__){var e=Object.keys(i).reduce(function(e,t){return"__"!==t.substring(0,2)&&(e[t]=i[t]),e},Object.create(null)),t=new Pe((i.__modules__||[]).concat([e]),m),n=_e(function(e){return t.get(e)});i.__exports__.forEach(function(e){h[e]=[n,e,"private",t]})}else Object.keys(i).forEach(function(e){if("private"!==i[e][2]){var t=i[e][0],n=i[e][1];h[e]=[c[t],r(t,n),t]}else h[e]=i[e]})}),this.get=n,this.invoke=i,this.instantiate=t,this.createChild=function(e,t){if(t&&t.length){var n,i,r,a,o=Object.create(null),s=Object.create(null),l=[],p=[],c=[];for(var u in h)n=h[u],-1!==t.indexOf(u)&&("private"===n[2]?(i=l.indexOf(n[3]),o[u]=-1===i?(r=n[3].createChild([],t),a=f(r),l.push(n[3]),p.push(r),c.push(a),[a,u,"private",r]):[c[i],u,"private",p[i]]):o[u]=[n[2],n[1]],s[u]=!0),"factory"!==n[2]&&"type"!==n[2]||!n[1].$scope||t.forEach(function(e){-1!==n[1].$scope.indexOf(e)&&(o[u]=[n[2],n[1]],s[e]=!0)});t.forEach(function(e){if(!s[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')}),e.unshift(o)}return new Pe(e,m)}}function Te(e,t){return Object.hasOwnProperty.call(e,t)}var Ne=1e3;function De(e,t){var a=this;t=t||Ne,e.on(["render.shape","render.connection"],t,function(e,t){var n=e.type,i=t.element,r=t.gfx;if(a.canRender(i))return"render.shape"===n?a.drawShape(r,i):a.drawConnection(r,i)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(e,t){if(a.canRender(t))return"render.getShapePath"===e.type?a.getShapePath(t):a.getConnectionPath(t)})}function Oe(e){return e.join(",").replace(/,?([A-z]),?/g,"$1")}function Be(e){for(var t,n="",i=0;t=e[i];i++)n+=t.x+","+t.y+" ";return n}function Le(e,t){var n=pe("polyline");return J(n,{points:Be(e)}),t&&J(n,t),n}function Ie(e,o){var s,l,p,c;return o=!!o,u(e)||(e=[e]),T(e,function(e){var t=e;e.waypoints&&!o&&(t=Ie(e.waypoints,!0));var n=t.x,i=t.y,r=t.height||0,a=t.width||0;(n<s||void 0===s)&&(s=n),(i<l||void 0===l)&&(l=i),(p<n+a||void 0===p)&&(p=n+a),(c<i+r||void 0===c)&&(c=i+r)}),{x:s,y:l,height:c-l,width:p-s}}function Fe(e){return!(!e||!e.isFrame)}De.prototype.canRender=function(){},De.prototype.drawShape=function(){},De.prototype.drawConnection=function(){},De.prototype.getShapePath=function(){},De.prototype.getConnectionPath=function(){};function je(e,t){De.call(this,e,1),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}t(je,De),je.prototype.canRender=function(){return!0},je.prototype.drawShape=function(e,t){var n=pe("rect");return J(n,{x:0,y:0,width:t.width||0,height:t.height||0}),Fe(t)?J(n,this.FRAME_STYLE):J(n,this.SHAPE_STYLE),q(e,n),n},je.prototype.drawConnection=function(e,t){var n=Le(t.waypoints,this.CONNECTION_STYLE);return q(e,n),n},je.prototype.getShapePath=function(e){var t=e.x,n=e.y,i=e.width;return Oe([["M",t,n],["l",i,0],["l",0,e.height],["l",-i,0],["z"]])},je.prototype.getConnectionPath=function(e){var t,n,i=e.waypoints,r=[];for(t=0;n=i[t];t++)n=n.original||n,r.push([0===t?"M":"L",n.x,n.y]);return Oe(r)},je.$inject=["eventBus","styles"];var Ve={__init__:["defaultRenderer"],defaultRenderer:["type",je],styles:["type",function(){var i={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},r=this;this.cls=function(e,t,n){return N(this.style(t,n),{class:e})},this.style=function(e,t){u(e)||t||(t=e,e=[]);var n=b(e,function(e,t){return N(e,i[t]||{})},{});return t?N(n,t):n},this.computeStyle=function(e,t,n){return u(t)||(n=t,t=[]),r.style(t||[],N({},n,e||{}))}}]};function We(e,t){return Math.round(e*t)/t}function ze(e){return o(e)?e+"px":e}function Ge(e,t,n){var i=pe("g");ie(i).add(t);var r=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}var $e={shape:["x","y","width","height"],connection:["waypoints"]};function He(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._init(e||{})}function Ke(e,t){var n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}He.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],He.prototype._init=function(e){var t,n,i,r=this._eventBus,a=this._container=(n=(t=N({},{width:"100%",height:"100%"},t=e)).container||document.body,(i=document.createElement("div")).setAttribute("class","djs-container"),N(i.style,{position:"relative",overflow:"hidden",width:ze(t.width),height:ze(t.height)}),n.appendChild(i),i),o=this._svg=pe("svg");J(o,{width:"100%",height:"100%"}),q(a,o);var s=this._viewport=Ge(o,"viewport");!(this._layers={})!==e.deferUpdate&&(this._viewboxChanged=function(n,i){var r,a,o,s;function t(){var e=Date.now(),t=s+i-e;if(0<t)return l(t);n.apply(o,a),r=s=a=o=void 0}function l(e){r=setTimeout(t,e)}return function(){s=Date.now();for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];a=t,o=this,r||l(i)}}(f(this._viewboxChanged,this),300)),r.on("diagram.init",function(){r.fire("canvas.init",{svg:o,viewport:s})},this),r.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed"],function(){delete this._cachedViewbox},this),r.on("diagram.destroy",500,this._destroy,this),r.on("diagram.clear",500,this._clear,this)},He.prototype._destroy=function(e){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});var t=this._container.parentNode;t&&t.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._rootElement,delete this._viewport},He.prototype._clear=function(){var i=this;this._elementRegistry.getAll().forEach(function(e){var t,n="waypoints"in(t=e)?"connection":"x"in t?"shape":"root";"root"===n?i.setRootElement(null,!0):i._removeElement(e,n)}),delete this._cachedViewbox},He.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},He.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");var n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),void 0!==t&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},He.prototype._createLayer=function(e,n){n||(n=0);var t=b(this._layers,function(e,t){return n>=t.index&&e++,e},0);return{group:Ge(this._viewport,"layer-"+e,t),index:n}},He.prototype.getContainer=function(){return this._container},He.prototype._updateMarker=function(e,t,n){var i;e.id||(e=this._elementRegistry.get(e)),(i=this._elementRegistry._elements[e.id])&&(T([i.gfx,i.secondaryGfx],function(e){e&&(n?ie(e).add(t):ie(e).remove(t))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},He.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},He.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},He.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),ie(this.getGraphics(e)).has(t)},He.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},He.prototype.getRootElement=function(){return this._rootElement||this.setRootElement({id:"__implicitroot",children:[]}),this._rootElement},He.prototype.setRootElement=function(e,t){e&&this._ensureValid("root",e);var n=this._rootElement,i=this._elementRegistry,r=this._eventBus;if(n){if(!t)throw new Error("rootElement already set, need to specify override");r.fire("root.remove",{element:n}),r.fire("root.removed",{element:n}),i.remove(n)}if(e){var a=this.getDefaultLayer();r.fire("root.add",{element:e}),i.add(e,a,this._svg),r.fire("root.added",{element:e,gfx:a})}return this._rootElement=e},He.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element with id "+t.id+" already exists");var n=$e[e];if(!a(n,function(e){return void 0!==t[e]}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},He.prototype._setParent=function(e,t,n){!function(e,t,n){if(e&&t){"number"!=typeof n&&(n=-1);var i=e.indexOf(t);if(-1!==i){if(i===n)return;if(-1===n)return;e.splice(i,1)}-1!==n?e.splice(n,0,t):e.push(t)}}(t.children,e,n),e.parent=t},He.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();var r=this._eventBus,a=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);var o=a.create(e,t,i);return this._elementRegistry.add(t,o),a.update(e,t,o),r.fire(e+".added",{element:t,gfx:o}),t},He.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},He.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},He.prototype._removeElement=function(e,t){var n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e))return r.fire(t+".remove",{element:e}),i.remove(e),function(e,t){if(!e||!t)return;var n=e.indexOf(t);-1!==n&&e.splice(n,1)}(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},He.prototype.removeShape=function(e){return this._removeElement(e,"shape")},He.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},He.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},He.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},He.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},He.prototype.viewbox=function(t){if(void 0===t&&this._cachedViewbox)return this._cachedViewbox;var e,n,i,r,a,o,s=this._viewport,l=this.getSize();return t?(this._changeViewbox(function(){r=Math.min(l.width/t.width,l.height/t.height);var e=this._svg.createSVGMatrix().scale(r).translate(-t.x,-t.y);be(s,e)}),t):(e=this.getDefaultLayer().getBBox(),n=(i=be(s))?i.matrix:function(e,t,n,i,r,a){var o=ce.createSVGMatrix();switch(arguments.length){case 0:return o;case 1:return ue(o,e);case 6:return ue(o,{a:e,b:t,c:n,d:i,e:r,f:a})}}(),r=We(n.a,1e3),a=We(-n.e||0,1e3),o=We(-n.f||0,1e3),t=this._cachedViewbox={x:a?a/r:0,y:o?o/r:0,width:l.width/r,height:l.height/r,scale:r,inner:{width:e.width,height:e.height,x:e.x,y:e.y},outer:l})},He.prototype.scroll=function(e){var t=this._viewport,n=t.getCTM();return e&&this._changeViewbox(function(){e=N({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Ke(t,n)}),{x:n.e,y:n.f}},He.prototype.zoom=function(e,t){return e?"fit-viewport"===e?this._fitViewport(t):(this._changeViewbox(function(){"object"!=typeof t&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),We(i.a,1e3)):this.viewbox(e).scale;var n,i},He.prototype._fitViewport=function(e){var t,n,i=this.viewbox(),r=i.outer,a=i.inner;return n=0<=a.x&&0<=a.y&&a.x+a.width<=r.width&&a.y+a.height<=r.height&&!e?{x:0,y:0,width:Math.max(a.width+a.x,r.width),height:Math.max(a.height+a.y,r.height)}:(t=Math.min(1,r.width/a.width,r.height/a.height),{x:a.x+(e?a.width/2-r.width/t/2:0),y:a.y+(e?a.height/2-r.height/t/2:0),width:r.width/t,height:r.height/t}),this.viewbox(n),this.viewbox(!1).scale},He.prototype._setZoom=function(e,t){var n,i,r,a,o=this._svg,s=this._viewport,l=o.createSVGMatrix(),p=o.createSVGPoint(),c=(i=s.getCTM()).a;return a=t?(n=N(p,t).matrixTransform(i.inverse()),r=l.translate(n.x,n.y).scale(1/c*e).translate(-n.x,-n.y),i.multiply(r)):l.scale(e),Ke(this._viewport,a),a},He.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},He.prototype.getAbsoluteBBox=function(e){var t,n=this.viewbox();e.waypoints?t=this.getGraphics(e).getBBox():t=e;return{x:t.x*n.scale-n.x*n.scale,y:t.y*n.scale-n.y*n.scale,width:t.width*n.scale,height:t.height*n.scale}},He.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Ue="data-element-id";function qe(e){this._elements={},this._eventBus=e}qe.$inject=["eventBus"],qe.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),J(t,Ue,i),n&&J(n,Ue,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},qe.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(J(i.gfx,Ue,""),i.secondaryGfx&&J(i.secondaryGfx,Ue,""),delete t[n])},qe.prototype.updateId=function(e,t){this._validateId(t),"string"==typeof e&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},qe.prototype.get=function(e){var t;t="string"==typeof e?e:e&&J(e,Ue);var n=this._elements[t];return n&&n.element},qe.prototype.filter=function(n){var i=[];return this.forEach(function(e,t){n(e,t)&&i.push(e)}),i},qe.prototype.getAll=function(){return this.filter(function(e){return e})},qe.prototype.forEach=function(r){var a=this._elements;Object.keys(a).forEach(function(e){var t=a[e],n=t.element,i=t.gfx;return r(n,i)})},qe.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},qe.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};var Ye={extend:function(e,i,t,r){var a=t.inverse;return Object.defineProperty(e,"remove",{value:function(e){var t=this.indexOf(e);return-1!==t&&(this.splice(t,1),i.unset(e,a,r)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e,t){var n=this.indexOf(e);if(void 0===t){if(-1!==n)return;t=this.length}-1!==n&&this.splice(n,1),this.splice(t,0,e),-1===n&&i.set(e,a,r)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e},isExtended:function(e){return!0===e.__refs_collection}};function Xe(t,n,i){var e=Ye.extend(i[n.name]||[],t,n,i);Object.defineProperty(i,n.name,{enumerable:n.enumerable,value:e}),e.length&&e.forEach(function(e){t.set(e,n.inverse,i)})}function Ze(e,t){if(!(this instanceof Ze))return new Ze(e,t);(e.inverse=t).inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Ze.prototype.bind=function(e,t){if("string"==typeof t){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}var n,i,r,a,o;t.collection?Xe(this,t,e):(n=this,r=e,a=(i=t).inverse,o=r[i.name],Object.defineProperty(r,i.name,{configurable:i.configurable,enumerable:i.enumerable,get:function(){return o},set:function(e){if(e!==o){var t=o;o=null,t&&n.unset(t,a,r),o=e,n.set(o,a,r)}}}))},Ze.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return Ye.isExtended(n)||Xe(this,t,e),n},Ze.prototype.ensureBound=function(e,t){var n,i;n=e,i=t,Object.prototype.hasOwnProperty.call(n,i.name||i)||this.bind(e,t)},Ze.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Ze.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Je=Ze,Qe=Ye;Je.Collection=Qe;var et=new Je({name:"children",enumerable:!0,collection:!0},{name:"parent"}),tt=new Je({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),nt=new Je({name:"attachers",collection:!0},{name:"host"}),it=new Je({name:"outgoing",collection:!0},{name:"source"}),rt=new Je({name:"incoming",collection:!0},{name:"target"});function at(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),et.bind(this,"parent"),tt.bind(this,"labels"),it.bind(this,"outgoing"),rt.bind(this,"incoming")}function ot(){at.call(this),et.bind(this,"children"),nt.bind(this,"host"),nt.bind(this,"attachers")}function st(){ot.call(this)}function lt(){ot.call(this),tt.bind(this,"labelTarget")}function pt(){at.call(this),it.bind(this,"source"),rt.bind(this,"target")}t(ot,at),t(st,ot),t(lt,ot),t(pt,at);var ct={connection:pt,shape:ot,label:lt,root:st};function ut(){this._uid=12}ut.prototype.createRoot=function(e){return this.create("root",e)},ut.prototype.createLabel=function(e){return this.create("label",e)},ut.prototype.createShape=function(e){return this.create("shape",e)},ut.prototype.createConnection=function(e){return this.create("connection",e)},ut.prototype.create=function(e,t){return(t=N({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=ct[e];if(!n)throw new Error("unknown type: <"+e+">");return N(new n,t)}(e,t)};var ht="__fn",mt=Array.prototype.slice;function ft(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function dt(){}function yt(e,t,n){var i=he();i.setTranslate(t,n),be(e,i)}function gt(e,t){this._eventBus=e,this._elementRegistry=t}function vt(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}ft.prototype.on=function(e,t,n,i){if(e=u(e)?e:[e],h(t)&&(i=n,n=t,t=1e3),!o(t))throw new Error("priority must be a number");var r=n;i&&((r=f(n,i))[ht]=n[ht]||n);var a=this;e.forEach(function(e){a._addListener(e,{priority:t,callback:r,next:null})})},ft.prototype.once=function(t,e,n,i){var r=this;if(h(e)&&(i=n,n=e,e=1e3),!o(e))throw new Error("priority must be a number");function a(){var e=n.apply(i,arguments);return r.off(t,a),e}a[ht]=n,this.on(t,e,a)},ft.prototype.off=function(e,t){e=u(e)?e:[e];var n=this;e.forEach(function(e){n._removeListener(e,t)})},ft.prototype.createEvent=function(e){var t=new dt;return t.init(e),t},ft.prototype.fire=function(e,t){var n,i,r,a;if(a=mt.call(arguments),"object"==typeof e&&(e=(n=e).type),!e)throw new Error("no event type specified");if(i=this._listeners[e]){n=t instanceof dt?t:this.createEvent(t);var o=(a[0]=n).type;e!==o&&(n.type=e);try{r=this._invokeListeners(n,a,i)}finally{e!==o&&(n.type=o)}return void 0===r&&n.defaultPrevented&&(r=!1),r}},ft.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},ft.prototype._destroy=function(){this._listeners={}},ft.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},ft.prototype._invokeListener=function(e,t,n){var i,r,a;try{r=n.callback,a=t,void 0!==(i=r.apply(null,a))&&(e.returnValue=i,e.stopPropagation()),!1===i&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener"),console.error(e.stack),e}return i},ft.prototype._addListener=function(e,t){var n,i=this._getListeners(e);if(i){for(;i;){if(i.priority<t.priority)return t.next=i,void(n?n.next=t:this._setListeners(e,t));i=(n=i).next}n.next=t}else this._setListeners(e,t)},ft.prototype._getListeners=function(e){return this._listeners[e]},ft.prototype._setListeners=function(e,t){this._listeners[e]=t},ft.prototype._removeListener=function(e,t){var n,i,r,a=this._getListeners(e);if(t)for(;a;)n=a.next,(r=a.callback)!==t&&r[ht]!==t||(i?i.next=n:this._setListeners(e,n)),i=a,a=n;else this._setListeners(e,null)},dt.prototype.stopPropagation=function(){this.cancelBubble=!0},dt.prototype.preventDefault=function(){this.defaultPrevented=!0},dt.prototype.init=function(e){N(this,e||{})},gt.$inject=["eventBus","elementRegistry"],gt.prototype._getChildren=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=n.parentNode.childNodes[1])||(ie(t=pe("g")).add("djs-children"),q(n.parentNode,t)):t=n,t},gt.prototype._clear=function(e){var t=H(".djs-visual",e);return w(t),t},gt.prototype._createContainer=function(e,t,n,i){var r=pe("g");ie(r).add("djs-group"),void 0!==n?vt(r,t,t.childNodes[n]):q(t,r);var a=pe("g");ie(a).add("djs-element"),ie(a).add("djs-"+e),i&&ie(a).add("djs-frame"),q(r,a);var o=pe("g");return ie(o).add("djs-visual"),q(a,o),a},gt.prototype.create=function(e,t,n){var i=this._getChildren(t.parent);return this._createContainer(e,i,n,Fe(t))},gt.prototype.updateContainments=function(e){var i=this,r=this._elementRegistry;T(b(e,function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e},{}),function(e){var t=e.children;if(t){var n=i._getChildren(e);T(t.slice().reverse(),function(e){vt(r.getGraphics(e).parentNode,n)})}})},gt.prototype.drawShape=function(e,t){return this._eventBus.fire("render.shape",{gfx:e,element:t})},gt.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},gt.prototype.drawConnection=function(e,t){return this._eventBus.fire("render.connection",{gfx:e,element:t})},gt.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},gt.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if("shape"===e)this.drawShape(i,t),yt(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(i,t)}t.hidden?J(n,"display","none"):J(n,"display","block")}},gt.prototype.remove=function(e){ae(this._elementRegistry.getGraphics(e).parentNode)};var xt={__depends__:[Ve],__init__:["canvas"],canvas:["type",He],elementRegistry:["type",qe],elementFactory:["type",ut],eventBus:["type",ft],graphicsFactory:["type",gt]};function bt(e){var i=[],r=[];function a(e){return 0<=i.indexOf(e)}e.forEach(function e(t){var n;a(t)||((t.__depends__||[]).forEach(e),a(t)||(n=t,i.push(n),(t.__init__||[]).forEach(function(e){r.push(e)})))});var t=new Pe(i);return r.forEach(function(e){try{t["string"==typeof e?"get":"invoke"](e)}catch(e){throw console.error("Failed to instantiate component"),console.error(e.stack),e}}),t}function Et(e,t){var n;this.injector=t=t||bt([{config:["value",n=(n=e)||{}]},xt].concat(n.modules||[])),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}function wt(){}function _t(e,t){this.model=e,this.properties=t}Et.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Et.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")},wt.prototype.get=function(e){return this.$model.properties.get(this,e)},wt.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},_t.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(wt.prototype);T(e.properties,function(e){e.isMany||void 0===e.default||(i[e.name]=e.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function a(e){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),T(e,f(function(e,t){this.set(t,e)},this))}return a.prototype=i,a.hasType=i.$instanceOf=this.model.hasType,n.defineModel(a,t),n.defineDescriptor(a,e),a};var At={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},St={String:function(e){return e},Boolean:function(e){return"true"===e},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e,10)}};function Rt(e,t){var n=St[e];return n?n(t):t}function Ct(e){return!!At[e]}function kt(e){return!!St[e]}function Mt(e,t){var n,i,r=e.split(/:/);if(1===r.length)n=e,i=t;else{if(2!==r.length)throw new Error("expected <prefix:localName> or <localName>, got "+e);n=r[1],i=r[0]}return{name:e=(i?i+":":"")+n,prefix:i,localName:n}}function Pt(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function Tt(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,T(e,f(this.registerPackage,this))}function Nt(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Dt(e){this.model=e}function Ot(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Bt(e){this.properties=new Dt(this),this.factory=new _t(this,this.properties),this.registry=new Tt(e,this.properties),this.typeCache={}}Pt.prototype.build=function(){return t=this,e=["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"],n={},i=Object(t),T(e,function(e){e in i&&(n[e]=t[e])}),n;var t,e,n,i},Pt.prototype.addProperty=function(e,t,n){"boolean"==typeof t&&(n=t,t=void 0),this.addNamedProperty(e,!1!==n);var i=this.properties;void 0!==t?i.splice(t,0,e):i.push(e)},Pt.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,a=this.propertiesByName,o=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(-1===s)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,o),a[i.name]=a[i.localName]=t},Pt.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),a=Mt(r[0],i),o=Mt(r[1],a.prefix).name,s=this.propertiesByName[o];if(!s)throw new Error("refined property <"+o+"> not found");this.replaceProperty(s,e,n),delete e.redefines},Pt.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},Pt.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Pt.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},Pt.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},Pt.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},Pt.prototype.hasProperty=function(e){return this.propertiesByName[e]},Pt.prototype.addTrait=function(i,r){var e=this.allTypesByName,t=this.allTypes,n=i.name;n in e||(T(i.properties,f(function(e){e=N({},e,{name:e.ns.localName,inherited:r}),Object.defineProperty(e,"definedBy",{value:i});var t=e.replaces,n=e.redefines;t||n?this.redefineProperty(e,t||n,t):(e.isBody&&this.setBodyProperty(e),e.isId&&this.setIdProperty(e),this.addProperty(e))},this)),t.push(i),e[n]=i)},Tt.prototype.getPackage=function(e){return this.packageMap[e]},Tt.prototype.getPackages=function(){return this.packages},Tt.prototype.registerPackage=function(t){t=N({},t);var e=this.packageMap;Nt(e,t,"prefix"),Nt(e,t,"uri"),T(t.types,f(function(e){this.registerType(e,t)},this)),e[t.uri]=e[t.prefix]=t,this.packages.push(t)},Tt.prototype.registerType=function(e,t){var i=Mt((e=N({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:N(e.meta||{})})).name,t.prefix),n=i.name,r={};T(e.properties,f(function(e){var t=Mt(e.name,i.prefix),n=t.name;Ct(e.type)||(e.type=Mt(e.type,t.prefix).name),N(e,{ns:t,name:n}),r[n]=e},this)),N(e,{ns:i,name:n,propertiesByName:r}),T(e.extends,f(function(e){var t=this.typeMap[e];t.traits=t.traits||[],t.traits.push(n)},this)),this.definePackage(e,t),this.typeMap[n]=e},Tt.prototype.mapTypes=function(i,r,e){var t=Ct(i.name)?{name:i.name}:this.typeMap[i.name],a=this;function n(e){return o(e,!0)}function o(e,t){var n=Mt(e,Ct(e)?"":i.prefix);a.mapTypes(n,r,t)}if(!t)throw new Error("unknown type <"+i.name+">");T(t.superClass,e?n:o),r(t,!e),T(t.traits,n)},Tt.prototype.getEffectiveDescriptor=function(e){var t=Mt(e),n=new Pt(t);this.mapTypes(t,function(e,t){n.addTrait(e,t)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Tt.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},Dt.prototype.set=function(e,t,n){var i=this.model.getPropertyDescriptor(e,t),r=i&&i.name;void 0===n?i?delete e[r]:delete e.$attrs[t]:i?r in e?e[r]=n:Ot(e,i,n):e.$attrs[t]=n},Dt.prototype.get=function(e,t){var n=this.model.getPropertyDescriptor(e,t);if(!n)return e.$attrs[t];var i=n.name;return!e[i]&&n.isMany&&Ot(e,n,[]),e[i]},Dt.prototype.define=function(e,t,n){Object.defineProperty(e,t,n)},Dt.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Dt.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Bt.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Bt.prototype.getType=function(e){var t=this.typeCache,n=p(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Bt.prototype.createAny=function(e,t,n){var i=Mt(e),r={$type:e,$instanceOf:function(e){return e===this.$type}},a={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,a),this.properties.defineModel(r,this),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),T(n,function(e,t){M(e)&&void 0!==e.value?r[e.name]=e.value:r[t]=e}),r},Bt.prototype.getPackage=function(e){return this.registry.getPackage(e)},Bt.prototype.getPackages=function(){return this.registry.getPackages()},Bt.prototype.getElementDescriptor=function(e){return e.$descriptor},Bt.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},Bt.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Bt.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Lt=String.fromCharCode,It=Object.prototype.hasOwnProperty,Ft=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,jt={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function Vt(e,t,n,i){return i?It.call(jt,i)?jt[i]:"&"+i+";":Lt(t||parseInt(n,16))}function Wt(e){return 3<e.length&&-1!==e.indexOf("&")?e.replace(Ft,Vt):e}Object.keys(jt).forEach(function(e){jt[e.toUpperCase()]=jt[e]});var zt="http://www.w3.org/2001/XMLSchema-instance",Gt="xsi",$t="xsi:type",Ht="non-whitespace outside of root node";function Kt(e){return new Error(e)}function Ut(e){return"missing namespace for prefix <"+e+">"}function qt(e){return{get:e,enumerable:!0}}function Yt(e){var t,n={};for(t in e)n[t]=e[t];return n}function Xt(e){return e+"$uri"}function Zt(){return{line:0,column:0}}function Jt(e){throw e}function Qt(e){if(!this)return new Qt(e);var g,_,A,S,n,R,C,k,M,P=e&&e.proxy,i=Jt,T=Zt,N=!1,D=!1,t=null,O=!1;function B(e){e instanceof Error||(e=Kt(e)),i(t=e,T)}function L(e){n&&(e instanceof Error||(e=Kt(e)),n(e,T))}this.on=function(e,t){if("function"!=typeof t)throw Kt("required args <name, cb>");switch(e){case"openTag":_=t;break;case"text":g=t;break;case"closeTag":A=t;break;case"error":i=t;break;case"warn":n=t;break;case"cdata":S=t;break;case"attention":k=t;break;case"question":C=t;break;case"comment":R=t;break;default:throw Kt("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw Kt("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n[zt]=Gt,D=!0,M=n,this},this.parse=function(e){if("string"!=typeof e)throw Kt("required args <xml=string>");return t=null,function(o){var e,t,n,i,r,a,s,l,p,v,c=D?[]:null,x=D?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[Xt(n)]=t;return i}(M):null,u=[],b=0,h=!1,m=!1,f=0,d=0,E="",w=0;function y(){if(null!==v)return v;var e,t,n,i,r,a,o,s,l,p,c,u=D&&x.xmlns,h=D&&N?[]:null,m=w,f=E,d=f.length,y={},g={};e:for(;m<d;m++)if(l=!1,!(32===(p=f.charCodeAt(m))||p<14&&8<p)){for((p<65||122<p||90<p&&p<97)&&95!==p&&58!==p&&(L("illegal first char attribute name"),l=!0),c=m+1;c<d;c++)if(!(96<(p=f.charCodeAt(c))&&p<123||64<p&&p<91||47<p&&p<59||46===p||45===p||95===p)){if(32===p||p<14&&8<p){L("missing attribute value"),m=c;continue e}if(61===p)break;L("illegal attribute name char"),l=!0}if("xmlns:xmlns"===(s=f.substring(m,c))&&(L("illegal declaration of xmlns"),l=!0),34===(p=f.charCodeAt(c+1)))-1===(c=f.indexOf('"',m=c+2))&&-1!==(c=f.indexOf("'",m))&&(L("attribute value quote missmatch"),l=!0);else if(39===p)-1===(c=f.indexOf("'",m=c+2))&&-1!==(c=f.indexOf('"',m))&&(L("attribute value quote missmatch"),l=!0);else for(L("missing attribute value quotes"),l=!0,c+=1;c<d&&!(32===(p=f.charCodeAt(c+1))||p<14&&8<p);c++);for(-1===c&&(L("missing closing quotes"),c=d,l=!0),l||(a=f.substring(m,c)),m=c;c+1<d&&!(32===(p=f.charCodeAt(c+1))||p<14&&8<p);c++)m===c&&(L("illegal character after attribute end"),l=!0);if(m=c+1,!l)if(s in g)L("attribute <"+s+"> already defined");else if(g[s]=!0,D)if(N){if(null!==(r="xmlns"===s?"xmlns":120===s.charCodeAt(0)&&"xmlns:"===s.substr(0,6)?s.substr(6):null)){if(e=Wt(a),t=Xt(r),!(o=M[e])){if("xmlns"===r||t in x&&x[t]!==e)for(;o="ns"+b++,void 0!==x[o];);else o=r;M[e]=o}x[r]!==o&&(i||(x=Yt(x),i=!0),x[r]=o,"xmlns"===r&&(x[Xt(o)]=e,u=o),x[t]=e),y[s]=a;continue}h.push(s,a)}else-1!==(p=s.indexOf(":"))?(n=x[s.substring(0,p)])?((s=u===n?s.substr(p+1):n+s.substr(p))===$t&&(a=-1!==(p=a.indexOf(":"))?(n=a.substring(0,p),(n=x[n]||n)+a.substring(p)):u+":"+a),y[s]=a):L(Ut(s.substring(0,p))):y[s]=a;else y[s]=a}if(N)for(m=0,d=h.length;m<d;m++){if(s=h[m++],a=h[m],-1!==(p=s.indexOf(":"))){if(!(n=x[s.substring(0,p)])){L(Ut(s.substring(0,p)));continue}(s=u===n?s.substr(p+1):n+s.substr(p))===$t&&(a=-1!==(p=a.indexOf(":"))?(n=a.substring(0,p),(n=x[n]||n)+a.substring(p)):u+":"+a)}y[s]=a}return v=y}T=function(){for(var e,t=/(\r\n|\r|\n)/g,n=0,i=0,r=0,a=d;r<=f&&(e=t.exec(o))&&(a=e[0].length+e.index,!(f<a));)n+=1,r=a;return{data:-1==f?(i=a,o.substring(d)):0===d?(console.log(f-r),o.substring(d,f)):(i=f-r,-1==d?o.substring(f):o.substring(f,d+1)),line:n,column:i}},P&&(p=Object.create({},{name:qt(function(){return s}),originalName:qt(function(){return l}),attrs:qt(y),ns:qt(function(){return x})}));for(;-1!==d;){if(-1===(f=60===o.charCodeAt(d)?d:o.indexOf("<",d)))return u.length?B("unexpected end of file"):0===d?B("missing start tag"):d<o.length&&o.substring(d).trim()&&L(Ht);if(d!==f)if(u.length){if(g&&(g(o.substring(d,f),Wt,T),O))return}else if(o.substring(d,f).trim()&&(L(Ht),O))return;if(33!==(r=o.charCodeAt(f+1)))if(63!==r){if(-1==(d=o.indexOf(">",f+1)))return B("unclosed tag");if(v={},47===r){if(m=!(h=!1),!u.length)return B("missing open tag");if(t=s=u.pop(),i=f+2+t.length,o.substring(f+2,i)!==t)return B("closing tag mismatch");for(;i<d;i++)if(!(32===(r=o.charCodeAt(i))||8<r&&r<14))return B("close tag")}else{if(m=47===o.charCodeAt(d-1)?(t=s=o.substring(f+1,d-1),h=!0):(t=s=o.substring(f+1,d),!(h=!0)),!(96<r&&r<123||64<r&&r<91||95===r||58===r))return B("illegal first char nodeName");for(i=1,n=t.length;i<n;i++)if(!(96<(r=t.charCodeAt(i))&&r<123||64<r&&r<91||47<r&&r<59||45===r||95===r||46==r)){if(32===r||r<14&&8<r){s=t.substring(0,i),v=null;break}return B("invalid nodeName")}m||u.push(s)}if(D){if(e=x,h&&(m||c.push(e),null===v&&(N=-1!==t.indexOf("xmlns",i))&&(w=i,E=t,y(),N=!1)),-1!==(r=(l=s).indexOf(":"))){if(!(a=x[s.substring(0,r)]))return B("missing namespace on <"+l+">");s=s.substr(r+1)}else a=x.xmlns;a&&(s=a+":"+s)}if(h&&(w=i,E=t,_&&(P?_(p,Wt,m,T):_(s,y,Wt,m,T),O)))return;if(m){if(A&&(A(P?p:s,Wt,h,T),O))return;D&&(x=h?e:c.pop())}d+=1}else{if(-1===(d=o.indexOf("?>",f)))return B("unclosed question");if(C&&(C(o.substring(f,d+2),T),O))return;d+=2}else{if(91===(r=o.charCodeAt(f+2))&&"CDATA["===o.substr(f+3,6)){if(-1===(d=o.indexOf("]]>",f)))return B("unclosed cdata");if(S&&(S(o.substring(f+9,d),T),O))return;d+=3;continue}if(45===r&&45===o.charCodeAt(f+3)){if(-1===(d=o.indexOf("--\x3e",f)))return B("unclosed comment");if(R&&(R(o.substring(f+4,d),Wt,T),O))return;d+=3;continue}if(-1===(d=o.indexOf(">",f+1)))return B("unclosed tag");if(k&&(k(o.substring(f,d+1),Wt,T),O))return;d+=1}}}(e),T=Zt,O=!1,t},this.stop=function(){O=!0}}function en(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var tn={xsi:"http://www.w3.org/2001/XMLSchema-instance"},nn="xsi:type";function rn(e){return e.xml&&e.xml.serialize}function an(e){return rn(e)===nn}function on(e,t){return en(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function sn(e){return new Error(e)}function ln(e){return e.$descriptor}function pn(e){N(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw sn("expected element");var t,n=this.elementsById,i=ln(e).idProperty;if(i&&(t=e.get(i.name))){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(t))throw new Error("illegal ID <"+t+">");if(n[t])throw sn("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function cn(){}function un(){}function hn(){}function mn(e,t){this.property=e,this.context=t}function fn(e,t){this.element=t,this.propertyDesc=e}function dn(){}function yn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function gn(e,t,n){yn.call(this,e,t,n)}function vn(e,t,n){this.model=e,this.context=n}function xn(e){e instanceof Bt&&(e={model:e}),N(this,{lax:!1},e)}cn.prototype.handleEnd=function(){},cn.prototype.handleText=function(){},cn.prototype.handleNode=function(){},(un.prototype=Object.create(cn.prototype)).handleNode=function(){return this},(hn.prototype=Object.create(cn.prototype)).handleText=function(e){this.body=(this.body||"")+e},(mn.prototype=Object.create(hn.prototype)).handleNode=function(e){if(this.element)throw sn("expected no sub nodes");return this.element=this.createReference(e),this},mn.prototype.handleEnd=function(){this.element.id=this.body},mn.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},(fn.prototype=Object.create(hn.prototype)).handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Rt(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},(dn.prototype=Object.create(hn.prototype)).handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t},(yn.prototype=Object.create(dn.prototype)).addReference=function(e){this.context.addReference(e)},yn.prototype.handleText=function(e){if(!ln(this.element).bodyProperty)throw sn("unexpected body text <"+e+">");hn.prototype.handleText.call(this,e)},yn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=ln(t).bodyProperty;n&&void 0!==e&&(e=Rt(n.type,e),t.set(n.name,e))},yn.prototype.createElement=function(e){var i,t=e.attributes,n=this.type,r=ln(n),a=this.context,o=new n({}),s=this.model;return T(t,function(e,t){var n=r.propertiesByName[t];n&&n.isReference?n.isMany?T(e.split(" "),function(e){a.addReference({element:o,property:n.ns.name,id:e})}):a.addReference({element:o,property:n.ns.name,id:e}):(n?e=Rt(n.type,e):"xmlns"!==t&&(i=Mt(t,r.ns.prefix),s.getPackage(i.prefix)&&a.addWarning({message:"unknown attribute <"+t+">",element:o,property:t,value:e})),o.set(t,e))}),o},yn.prototype.getPropertyForNode=function(e){var t,n,i,r,a,o,s,l,p,c,u=Mt(e.name),h=this.type,m=this.model,f=ln(h),d=u.name,y=f.propertiesByName[d];if(y)return an(y)&&(t=e.attributes[nn])?(i=m,p=Mt(t),c=i.getPackage(p.prefix),a=c,o=(r=p).name,s=r.localName,t=(l=a.xml&&a.xml.typePrefix)&&0===s.indexOf(l)?r.prefix+":"+s.slice(l.length):o,N({},y,{effectiveType:ln(n=m.getType(t)).name})):y;var g=m.getPackage(u.prefix);if(g){if(t=on(u,g),n=m.getType(t),y=k(f.properties,function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)}))return N({},y,{effectiveType:ln(n).name})}else if(y=k(f.properties,function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type}))return y;throw sn("unrecognized element <"+u.name+">")},yn.prototype.toString=function(){return"ElementDescriptor["+ln(this.type).name+"]"},yn.prototype.valueHandler=function(e,t){return new fn(e,t)},yn.prototype.referenceHandler=function(e){return new mn(e,this.context)},yn.prototype.handler=function(e){return"Element"===e?new vn(this.model,e,this.context):new yn(this.model,e,this.context)},yn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,kt(n=t.effectiveType||t.type))return this.valueHandler(t,i);var a=(r=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e)).element;return void 0!==a&&(t.isMany?i.get(t.name).push(a):i.set(t.name,a),t.isReference?(N(a,{element:i}),this.context.addReference(a)):a.$parent=i),r},(gn.prototype=Object.create(yn.prototype)).createElement=function(e){var t=e.name,n=Mt(t),i=this.model,r=this.type,a=i.getPackage(n.prefix),o=a&&on(n,a)||t;if(!r.hasType(o))throw sn("unexpected element <"+e.originalName+">");return yn.prototype.createElement.call(this,e)},(vn.prototype=Object.create(dn.prototype)).createElement=function(e){var t=e.name,n=Mt(t).prefix,i=e.ns[n+"$uri"],r=e.attributes;return this.model.createAny(t,i,r)},vn.prototype.handleChild=function(e){var t=new vn(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element;return void 0!==i&&((n.$children=n.$children||[]).push(i),i.$parent=n),t},vn.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},xn.prototype.fromXML=function(n,e,i){var r=e.rootHandler;e instanceof yn?(r=e,e={}):"string"==typeof e?(r=this.handler(e),e={}):"string"==typeof r&&(r=this.handler(r));var t,a=this.model,o=this.lax,p=new pn(N({},e,{rootHandler:r})),s=new Qt({proxy:!0}),l=(t=[],Object.defineProperty(t,"peek",{value:function(){return this[this.length-1]}}),t);function c(e,t,n){var i=t(),r=i.line,a=i.column,o=i.data;"<"===o.charAt(0)&&-1!==o.indexOf(" ")&&(o=o.slice(0,o.indexOf(" "))+">");var s="unparsable content "+(o?o+" ":"")+"detected\n\tline: "+r+"\n\tcolumn: "+a+"\n\tnested error: "+e.message;if(n)return p.addWarning({message:s,error:e}),!0;throw sn(s)}function u(e,t){return c(e,t,!0)}r.context=p,l.push(r);var h=/^<\?xml /i,m=/ encoding="([^"]+)"/i,f=/^utf-8$/i;function d(e,t){try{l.peek().handleText(e)}catch(e){u(e,t)}}var y=a.getPackages().reduce(function(e,t){return e[t.uri]=t.prefix,e},{});s.ns(y).on("openTag",function(e,i,t,n){var r=e.attrs||{},a=Object.keys(r).reduce(function(e,t){var n=i(r[t]);return e[t]=n,e},{});!function(e,t){var n=l.peek();try{l.push(n.handleNode(e))}catch(e){c(e,t,o)&&l.push(new un)}}({name:e.name,originalName:e.originalName,attributes:a,ns:e.ns},n)}).on("question",function(e){if(h.test(e)){var t=m.exec(e),n=t&&t[1];n&&!f.test(n)&&p.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}}).on("closeTag",function(){l.pop().handleEnd()}).on("cdata",d).on("text",function(e,t,n){var i,r;i=t(e),r=n,(i=i.trim())&&d(i,r)}).on("error",c).on("warn",u),setTimeout(function(){var t;try{s.parse(n),function(){var e,t,n=p.elementsById,i=p.references;for(e=0;t=i[e];e++){var r=t.element,a=n[t.id],o=ln(r).propertiesByName[t.property];if(a||p.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),o.isMany){var s=r.get(o.name),l=s.indexOf(t);-1===l&&(l=s.length),a?s[l]=a:s.splice(l,1)}else r.set(o.name,a)}}()}catch(e){t=e}var e=r.element;t||e||(t=sn("failed to parse document as <"+r.type.$descriptor.name+">")),i(t,t?void 0:e,p)},0)},xn.prototype.handler=function(e){return new gn(this.model,e)};var bn=/<|>|'|"|&|\n\r|\n/g,En=/<|>|&/g;function wn(t){var n={},i={},r={},a=[],o=[];this.byUri=function(e){return i[e]||t&&t.byUri(e)},this.add=function(e,t){i[e.uri]=e,t?a.push(e):o.push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return n[e||"xmlns"]},this.mapPrefix=function(e,t){n[e||"xmlns"]=t},this.logUsed=function(e){var t=e.uri;r[t]=this.byUri(t)},this.getUsed=function(e){return[].concat(a,o).filter(function(e){return r[e.uri]})}}function _n(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function An(e){return p(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function Sn(e){return t=e.getUsed(),n=function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}},i=[],T(t,function(e,t){i.push(n(e,t))}),i;var t,n,i}function Rn(e,t){return t.isGeneric?N({localName:t.ns.localName},e):N({localName:(n=t.ns.localName,i=t.$pkg,en(i)?(r=n).charAt(0).toLowerCase()+r.slice(1):n)},e);var n,i,r}var Cn={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},kn={"<":"lt",">":"gt","&":"amp"};function Mn(e,t,n){return(e=p(e)?e:""+e).replace(t,function(e){return"&"+n[e]+";"})}function Pn(e){this.tagName=e}function Tn(){}function Nn(e){this.tagName=e}function Dn(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function On(e,t){Dn.call(this,e,t)}function Bn(){this.value="",this.write=function(e){this.value+=e}}function Ln(t,e){var n=[""];this.append=function(e){return t.write(e),this},this.appendNewLine=function(){return e&&t.write("\n"),this},this.appendIndent=function(){return e&&t.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function In(r){return r=N({format:!1,preamble:!0},r||{}),{toXML:function(e,t){var n=t||new Bn,i=new Ln(n,r.format);if(r.preamble&&i.append('<?xml version="1.0" encoding="UTF-8"?>\n'),(new Dn).build(e).serializeTo(i),!t)return n.value}}}function Fn(e,t){Bt.call(this,e,t)}Pn.prototype.build=function(e){return this.element=e,this},Pn.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},Tn.prototype.serializeValue=Tn.prototype.serializeTo=function(e){e.append(this.escape?Mn(this.value,En,kn):this.value)},Tn.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(En)&&(this.escape=!0),this},_n(Nn,Tn),Nn.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},Dn.prototype.build=function(e){var t,n,i,r=(this.element=e).$descriptor,a=this.propertyDescriptor,o=r.isGeneric;return t=o?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=a?this.nsPropertyTagName(a):this.nsTagName(r),this.tagName=this.addTagName(this.ns),o||(n=P((i=e).$descriptor.properties,function(e){var t=e.name;if(e.isVirtual)return!1;if(!i.hasOwnProperty(t))return!1;var n=i[t];return n!==e.default&&null!==n&&(!e.isMany||n.length)}),this.parseAttributes(P(n,function(e){return e.isAttr})),this.parseContainments(P(n,function(e){return!e.isAttr}))),this.parseGenericAttributes(e,t),this},Dn.prototype.nsTagName=function(e){return Rn(this.logNamespaceUsed(e.ns),e)},Dn.prototype.nsPropertyTagName=function(e){var t,n=this.logNamespaceUsed(e.ns);return t=n,N({localName:e.ns.localName},t)},Dn.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Dn.prototype.nsAttributeName=function(e){var t;if(t=p(e)?Mt(e):e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:N({localName:t.localName},n)},Dn.prototype.parseGeneric=function(n){var i=this,r=this.body,a=[];return T(n,function(e,t){"$body"===t?r.push((new Tn).build({type:"String"},e)):"$children"===t?T(e,function(e){r.push(new Dn(i).build(e))}):0!==t.indexOf("$")&&i.parseNsAttribute(n,t,e)&&a.push({name:t,value:e})}),a},Dn.prototype.parseNsAttribute=function(e,t,n){var i,r=e.$model,a=Mt(t);if("xmlns"===a.prefix&&(i={prefix:a.localName,uri:n}),a.prefix||"xmlns"!==a.localName||(i={uri:n}),!i)return{name:t,value:n};if(r&&r.getPackage(n))this.logNamespace(i,!0,!0);else{var o=this.logNamespaceUsed(i,!0);this.getNamespaces().logUsed(o)}},Dn.prototype.parseNsAttributes=function(i,e){var r=this,t=i.$attrs,a=[];return T(t,function(e,t){var n=r.parseNsAttribute(i,t,e);n&&a.push(n)}),a},Dn.prototype.parseGenericAttributes=function(n,e){var i=this;T(e,function(t){if(t.name!==nn)try{i.addAttribute(i.nsAttributeName(t.name),t.value)}catch(e){console.warn("missing namespace information for ",t.name,"=",t.value,"on",n,e)}})},Dn.prototype.parseContainments=function(e){var a=this,o=this.body,s=this.element;T(e,function(n){var e=s.get(n.name),t=n.isReference;if(n.isMany||(e=[e]),n.isBody)o.push((new Tn).build(n,e[0]));else if(kt(n.type))T(e,function(e){o.push(new Nn(a.addTagName(a.nsPropertyTagName(n))).build(n,e))});else if(t)T(e,function(e){o.push(new Pn(a.addTagName(a.nsPropertyTagName(n))).build(e))});else{var i=an(n),r="property"===rn(n);T(e,function(e){var t;t=i?new On(a,n):r?new Dn(a,n):new Dn(a),o.push(t.build(e))})}})},Dn.prototype.getNamespaces=function(e){var t,n=this.namespaces,i=this.parent;return n||(t=i&&i.getNamespaces(),e||!t?this.namespaces=n=new wn(t):n=t),n},Dn.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,a=e.prefix;return i.byUri(r)||i.add(e,t),i.mapPrefix(a,r),e},Dn.prototype.logNamespaceUsed=function(e,t){var n,i,r,a=this.element.$model,o=this.getNamespaces(t),s=e.prefix,l=e.uri;if(!s&&!l)return{localName:e.localName};if(r=tn[s]||a&&(a.getPackage(s)||{}).uri,!(l=l||r||o.uriByPrefix(s)))throw new Error("no namespace uri given for prefix <"+s+">");if(!(e=o.byUri(l))){for(n=s,i=1;o.uriByPrefix(n);)n=s+"_"+i++;e=this.logNamespace({prefix:n,uri:l},r===l)}return s&&o.mapPrefix(s,l),e},Dn.prototype.parseAttributes=function(e){var i=this,r=this.element;T(e,function(e){var t=r.get(e.name);if(e.isReference)if(e.isMany){var n=[];T(t,function(e){n.push(e.id)}),t=n.join(" ")}else t=t.id;i.addAttribute(i.nsAttributeName(e),t)})},Dn.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),An(e)},Dn.prototype.addAttribute=function(e,t){var n=this.attrs;p(t)&&(t=Mn(t,bn,Cn)),n.push({name:e,value:t})},Dn.prototype.serializeAttributes=function(t){var e=this.attrs,n=this.namespaces;n&&(e=Sn(n).concat(e)),T(e,function(e){t.append(" ").append(An(e.name)).append('="').append(e.value).append('"')})},Dn.prototype.serializeTo=function(t){var e=this.body[0],n=e&&e.constructor!==Tn;t.appendIndent().append("<"+this.tagName),this.serializeAttributes(t),t.append(e?">":" />"),e&&(n&&t.appendNewLine().indent(),T(this.body,function(e){e.serializeTo(t)}),n&&t.unindent().appendIndent(),t.append("</"+this.tagName+">")),t.appendNewLine()},_n(On,Dn),On.prototype.parseNsAttributes=function(e){var t=Dn.prototype.parseNsAttributes.call(this,e),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),a=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(nn),(i.prefix?i.prefix+":":"")+a+n.ns.localName),t},On.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},(Fn.prototype=Object.create(Bt.prototype)).fromXML=function(e,t,n,i){p(t)||(i=n,n=t,t="bpmn:Definitions"),h(n)&&(i=n,n={});var r=new xn(N({model:this,lax:!0},n)),a=r.handler(t);r.fromXML(e,a,i)};Fn.prototype.toXML=function(e,t,n){h(t)&&(n=t,t={});var i,r,a=new In(t);try{i=a.toXML(e)}catch(e){r=e}return n(r,i)};var jn={bpmn:{name:"BPMN20",uri:"http://www.omg.org/spec/BPMN/20100524/MODEL",associations:[],types:[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",type:"String",isAttr:!0}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",type:"String",isAttr:!0}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",type:"LaneSet",isMany:!0,replaces:"FlowElementsContainer#laneSets"},{name:"flowElements",type:"FlowElement",isMany:!0,replaces:"FlowElementsContainer#flowElements"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean",default:!0},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isAttr:!0,isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"assignment",type:"Assignment",isMany:!0},{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",type:"String",isBody:!0}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",type:"String",isAttr:!0},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isVirtual:!0,isMany:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}],superClass:["BaseElement"]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["Collaboration","FlowElementsContainer"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isVirtual:!0,isMany:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Integer",isAttr:!0}]},{name:"CallActivity",superClass:["Activity"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}],superClass:["BaseElement"]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],enumerations:[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],prefix:"bpmn",xml:{tagAlias:"lowerCase",typePrefix:"t"}},bpmndi:{name:"BPMNDI",uri:"http://www.omg.org/spec/BPMN/20100524/DI",types:[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],enumerations:[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],associations:[],prefix:"bpmndi"},dc:{name:"DC",uri:"http://www.omg.org/spec/DD/20100524/DC",types:[{name:"Boolean"},{name:"Integer"},{name:"Real"},{name:"String"},{name:"Font",properties:[{name:"name",type:"String",isAttr:!0},{name:"size",type:"Real",isAttr:!0},{name:"isBold",type:"Boolean",isAttr:!0},{name:"isItalic",type:"Boolean",isAttr:!0},{name:"isUnderline",type:"Boolean",isAttr:!0},{name:"isStrikeThrough",type:"Boolean",isAttr:!0}]},{name:"Point",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0}]},{name:"Bounds",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0},{name:"width",type:"Real",isAttr:!0},{name:"height",type:"Real",isAttr:!0}]}],prefix:"dc",associations:[]},di:{name:"DI",uri:"http://www.omg.org/spec/DD/20100524/DI",types:[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isMany:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isVirtual:!0,isMany:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isVirtual:!0,isMany:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isVirtual:!0,isMany:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0}]},{name:"Extension",properties:[{name:"values",type:"Element",isMany:!0}]}],associations:[],prefix:"di",xml:{tagAlias:"lowerCase"}},bioc:{name:"bpmn.io colors for BPMN",uri:"http://bpmn.io/schema/bpmn/biocolor/1.0",prefix:"bioc",types:[{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]}],enumerations:[],associations:[]}};function Vn(e,t){return new Fn(N({},jn,e),t)}function Wn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}var zn=new Je({name:"bpmnElement",enumerable:!0},{name:"di",configurable:!0});function Gn(e,t){return e.$instanceOf(t)}function $n(u,h){var m={},f=[];function d(t,n){return function(e){t(e,n)}}function i(e){m[e.id]=e}function a(t,e){try{var n=t.di&&function(e,t){if(e.gfx)throw new Error(h("already rendered {element}",{element:Wn(e)}));return u.element(e,t)}(t,e);return i(t),n}catch(e){y(e.message,{element:t,error:e}),console.error(h("failed to import {element}",{element:Wn(t)})),console.error(e)}}function y(e,t){u.error(e,t)}function g(e){var t=e.bpmnElement;t?t.di?y(h("multiple DI elements defined for {element}",{element:Wn(t)}),{element:t}):(zn.bind(t,"di"),t.di=e):y(h("no bpmnElement referenced in {element}",{element:Wn(e)}),{element:e})}function v(e){var t;g(t=e.plane),T(t.planeElement,n)}function n(e){g(e)}function x(){for(;f.length;)f.shift()()}function b(e,t){R(e,t),p(e.ioSpecification,t),w(e.artifacts,t),i(e)}function E(e,t){a(e,t)}function o(e,t){a(e,t)}function r(e,t){a(e,t)}function s(e,t){a(e,t)}function l(e,t){a(e,t)}function w(e,t){T(e,function(e){Gn(e,"bpmn:Association")?f.push(function(){l(e,t)}):l(e,t)})}function p(e,t){e&&(T(e.dataInputs,d(r,t)),T(e.dataOutputs,d(s,t)))}function c(e,t){R(e,t),w(e.artifacts,t)}function _(e,t){a(e,t)}function A(t,i){f.push(function(){var n,e=a(t,i);t.childLaneSet&&S(t.childLaneSet,e||i),T((n=t).flowNodeRef,function(e){var t=e.get("lanes");t&&t.push(n)})})}function S(e,t){T(e.lanes,d(A,t))}function R(e,t){var n,r;n=e.flowElements,r=t,T(n,function(e){var t,n,i;Gn(e,"bpmn:SequenceFlow")?f.push(function(){a(e,r)}):Gn(e,"bpmn:BoundaryEvent")?f.unshift(function(){a(e,r)}):Gn(e,"bpmn:FlowNode")?(i=a(t=e,n=r),Gn(t,"bpmn:SubProcess")&&c(t,i||n),Gn(t,"bpmn:Activity")&&p(t.ioSpecification,n),f.push(function(){T(t.dataInputAssociations,d(o,n)),T(t.dataOutputAssociations,d(o,n))})):Gn(e,"bpmn:DataObject")||(Gn(e,"bpmn:DataStoreReference")?_(e,r):Gn(e,"bpmn:DataObjectReference")?_(e,r):y(h("unrecognized flowElement {element} in context {context}",{element:Wn(e),context:r?Wn(r.businessObject):"null"}),{element:e,context:r}))}),e.laneSets&&T(e.laneSets,d(S,t))}function C(e,t){var n=a(e,t),i=e.processRef;i&&b(i,n||t)}return{handleDeferred:x,handleDefinitions:function(e,t){var n=e.diagrams;if(t&&-1===n.indexOf(t))throw new Error(h("diagram not part of bpmn:Definitions"));if(!t&&n&&n.length&&(t=n[0]),!t)throw new Error(h("no diagram to display"));v(t);var i=t.plane;if(!i)throw new Error(h("no plane for {element}",{element:Wn(t)}));var r=i.bpmnElement;if(!r){if(!(r=k(e.rootElements,function(e){return Gn(e,"bpmn:Process")||Gn(e,"bpmn:Collaboration")})))throw new Error(h("no process or collaboration to display"));y(h("correcting missing bpmnElement on {plane} to {rootElement}",{plane:Wn(i),rootElement:Wn(r)})),i.bpmnElement=r,g(i)}var a,o,s,l,p,c=(a=r,o=i,u.root(a,o));if(Gn(r,"bpmn:Process"))b(r,c);else{if(!Gn(r,"bpmn:Collaboration"))throw new Error(h("unsupported bpmnElement for {plane}: {rootElement}",{plane:Wn(i),rootElement:Wn(r)}));T((p=r).participants,d(C)),w(p.artifacts),f.push(function(){var e;T(p.messageFlows,d(E,e))}),s=e.rootElements,l=c,P(s,function(e){return!m[e.id]&&Gn(e,"bpmn:Process")&&e.laneSets}).forEach(d(b,l))}x()},handleSubProcess:c,registerDi:g}}function Hn(e,t){var n=Kn(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function Kn(e){return e&&e.businessObject||e}function Un(e){return!Hn(e,"bpmn:CallActivity")&&(Hn(e,"bpmn:SubProcess")?!!Kn(e).di.isExpanded:!Hn(e,"bpmn:Participant")||!!Kn(e).processRef)}function qn(e){var t,n,i=e.businessObject,r=Hn(t=i,"bpmn:FlowElement")||Hn(t,"bpmn:Participant")||Hn(t,"bpmn:Lane")||Hn(t,"bpmn:SequenceFlow")||Hn(t,"bpmn:MessageFlow")||Hn(t,"bpmn:DataInput")||Hn(t,"bpmn:DataOutput")?"name":Hn(t,"bpmn:TextAnnotation")?"text":Hn(t,"bpmn:Group")?"categoryValueRef":void 0;if(r)return"categoryValueRef"===r?(n=i.categoryValueRef)&&n.value||"":i[r]||""}function Yn(t,i,r){return!!k(t.eventDefinitions,function(e){return e.$type===i&&(n=t,a(r,function(e,t){return n[t]==e}));var n})}function Xn(e){return e.businessObject.di}function Zn(e){return e.businessObject}function Jn(e,t){return Xn(e).get("bioc:fill")||t||"white"}function Qn(e,t){return Xn(e).get("bioc:stroke")||t||"black"}var ei,ti=(function(e){var l=e.exports=function(e,t){if(t||(t=16),void 0===e&&(e=128),e<=0)return"0";for(var n=Math.log(Math.pow(2,e))/Math.log(t),i=2;n===1/0;i*=2)n=Math.log(Math.pow(2,e/i))/Math.log(t)*i;var r=n-Math.floor(n),a="";for(i=0;i<Math.floor(n);i++){a=Math.floor(Math.random()*t).toString(t)+a}if(r){var o=Math.pow(t,r);a=Math.floor(Math.random()*o).toString(t)+a}var s=parseInt(a,t);return s!==1/0&&s>=Math.pow(2,e)?l(e,t):a};l.rack=function(i,r,a){var n=function(e){var t=0;do{if(10<t++){if(!a)throw new Error("too many ID collisions, use more bits");i+=a}var n=l(i,r)}while(Object.hasOwnProperty.call(o,n));return o[n]=e,n},o=n.hats={};return n.get=function(e){return n.hats[e]},n.set=function(e,t){return n.hats[e]=t,n},n.bits=i||128,n.base=r||16,n}}(ei={exports:{}},ei.exports),ei.exports);function ni(e){if(!(this instanceof ni))return new ni(e);e=e||[128,36,1],this._seed=e.length?ti.rack(e[0],e[1],e[2]):e}ni.prototype.next=function(e){return this._seed(e||!0)},ni.prototype.nextPrefixed=function(e,t){for(var n;n=e+this.next(!0),this.assigned(n););return this.claim(n,t),n},ni.prototype.claim=function(e,t){this._seed.set(e,t||!0)},ni.prototype.assigned=function(e){return this._seed.get(e)||!1},ni.prototype.unclaim=function(e){delete this._seed.hats[e]},ni.prototype.clear=function(){var e,t=this._seed.hats;for(e in t)this.unclaim(e)};var ii=new ni;function ri(e,t,r,c,s,a,n){De.call(this,t,n);var u=e&&e.defaultFillColor,h=e&&e.defaultStrokeColor,o=ii.next(),l={},p=r.computeStyle;function m(e,t){var n=N({fill:"black",strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},t.attrs),i=t.ref||{x:0,y:0},r=t.scale||1;"none"===n.strokeDasharray&&(n.strokeDasharray=[1e4,1]);var a=pe("marker");J(t.element,n),q(a,t.element),J(a,{id:e,viewBox:"0 0 20 20",refX:i.x,refY:i.y,markerWidth:20*r,markerHeight:20*r,orient:"auto"});var o=H("defs",s._svg);o||(o=pe("defs"),q(s._svg,o)),q(o,a),l[e]=a}function f(e){return e.replace(/[()\s,#]+/g,"_")}function d(e,t,n){var i=e+"-"+f(t)+"-"+f(n)+"-"+o;return l[i]||function(e,t,n,i){if("sequenceflow-end"===t){var r=pe("path");J(r,{d:"M 1 5 L 11 10 L 1 15 Z"}),m(e,{element:r,ref:{x:11,y:10},scale:.5,attrs:{fill:i,stroke:i}})}if("messageflow-start"===t){var a=pe("circle");J(a,{cx:6,cy:6,r:3.5}),m(e,{element:a,attrs:{fill:n,stroke:i},ref:{x:6,y:6}})}if("messageflow-end"===t){var o=pe("path");J(o,{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z"}),m(e,{element:o,attrs:{fill:n,stroke:i,strokeLinecap:"butt"},ref:{x:8.5,y:5}})}if("association-start"===t){var s=pe("path");J(s,{d:"M 11 5 L 1 10 L 11 15"}),m(e,{element:s,attrs:{fill:"none",stroke:i,strokeWidth:1.5},ref:{x:1,y:10},scale:.5})}if("association-end"===t){var l=pe("path");J(l,{d:"M 1 5 L 11 10 L 1 15"}),m(e,{element:l,attrs:{fill:"none",stroke:i,strokeWidth:1.5},ref:{x:12,y:10},scale:.5})}if("conditional-flow-marker"===t){var p=pe("path");J(p,{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z"}),m(e,{element:p,attrs:{fill:n,stroke:i},ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===t){var c=pe("path");J(c,{d:"M 6 4 L 10 16"}),m(e,{element:c,attrs:{stroke:i},ref:{x:0,y:10},scale:.5})}}(i,e,t,n),"url(#"+i+")"}function y(e,t,n,i,r){M(i)&&(r=i,i=0),i=i||0,"none"===(r=p(r,{stroke:"black",strokeWidth:2,fill:"white"})).fill&&delete r.fillOpacity;var a=t/2,o=n/2,s=pe("circle");return J(s,{cx:a,cy:o,r:Math.round((t+n)/4-i)}),J(s,r),q(e,s),s}function g(e,t,n,i,r,a){M(r)&&(a=r,r=0),r=r||0,a=p(a,{stroke:"black",strokeWidth:2,fill:"white"});var o=pe("rect");return J(o,{x:r,y:r,width:t-2*r,height:n-2*r,rx:i,ry:i}),J(o,a),q(e,o),o}function v(e,t,n){var i=Le(t,n=p(n,["no-fill"],{stroke:"black",strokeWidth:2,fill:"none"}));return q(e,i),i}function x(e,t,n){n=p(n,["no-fill"],{strokeWidth:2,stroke:"black"});var i=pe("path");return J(i,{d:t}),J(i,n),q(e,i),i}function i(e,t,n,i){return x(t,n,N({"data-marker":e},i))}function b(n){return function(e,t){return C[n](e,t)}}function E(e){return C[e]}function w(e,t){var n,i=Zn(e),r="bpmn:IntermediateThrowEvent"===(n=i).$type||"bpmn:EndEvent"===n.$type;return i.eventDefinitions&&1<i.eventDefinitions.length?i.parallelMultiple?E("bpmn:ParallelMultipleEventDefinition")(t,e,r):E("bpmn:MultipleEventDefinition")(t,e,r):Yn(i,"bpmn:MessageEventDefinition")?E("bpmn:MessageEventDefinition")(t,e,r):Yn(i,"bpmn:TimerEventDefinition")?E("bpmn:TimerEventDefinition")(t,e,r):Yn(i,"bpmn:ConditionalEventDefinition")?E("bpmn:ConditionalEventDefinition")(t,e):Yn(i,"bpmn:SignalEventDefinition")?E("bpmn:SignalEventDefinition")(t,e,r):Yn(i,"bpmn:EscalationEventDefinition")?E("bpmn:EscalationEventDefinition")(t,e,r):Yn(i,"bpmn:LinkEventDefinition")?E("bpmn:LinkEventDefinition")(t,e,r):Yn(i,"bpmn:ErrorEventDefinition")?E("bpmn:ErrorEventDefinition")(t,e,r):Yn(i,"bpmn:CancelEventDefinition")?E("bpmn:CancelEventDefinition")(t,e,r):Yn(i,"bpmn:CompensateEventDefinition")?E("bpmn:CompensateEventDefinition")(t,e,r):Yn(i,"bpmn:TerminateEventDefinition")?E("bpmn:TerminateEventDefinition")(t,e,r):null}function _(e,t,n){n=N({size:{width:100}},n);var i=a.createText(t||"",n);return ie(i).add("djs-label"),q(e,i),i}function A(e,t,n){return _(e,Zn(t).name,{box:t,align:n,padding:5,style:{fill:Qn(t,h)}})}function S(e,t,n){!function(e,t,n,i,r){var a=he();a.setTranslate(t,n);var o=he();o.setRotate(i,0,0);var s=he();s.setScale(r||1,r||1),be(e,[a,o,s])}(_(e,t,{box:{height:30,width:n.height},align:"center-middle",style:{fill:Qn(n,h)}}),0,-(-1*n.height),270)}function R(e){for(var t=e.waypoints,n="m "+t[0].x+","+t[0].y,i=1;i<t.length;i++)n+="L"+t[i].x+","+t[i].y+" ";return n}var C=this.handlers={"bpmn:Event":function(e,t,n){return"fillOpacity"in n||(n.fillOpacity=.95),y(e,t.width,t.height,n)},"bpmn:StartEvent":function(e,t){var n={fill:Jn(t,u),stroke:Qn(t,h)};Zn(t).isInterrupting||(n={strokeDasharray:"6",strokeLinecap:"round",fill:Jn(t,u),stroke:Qn(t,h)});var i=E("bpmn:Event")(e,t,n);return w(t,e),i},"bpmn:MessageEventDefinition":function(e,t,n){return x(e,c.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.235,my:.315}}),{strokeWidth:1,fill:n?Qn(t,h):Jn(t,u),stroke:n?Jn(t,u):Qn(t,h)})},"bpmn:TimerEventDefinition":function(e,t){var n=y(e,t.width,t.height,.2*t.height,{strokeWidth:2,fill:Jn(t,u),stroke:Qn(t,h)});x(e,c.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),{strokeWidth:2,strokeLinecap:"square",stroke:Qn(t,h)});for(var i=0;i<12;i++){var r=c.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),a=t.width/2;x(e,r,{strokeWidth:1,strokeLinecap:"square",transform:"rotate("+30*i+","+t.height/2+","+a+")",stroke:Qn(t,h)})}return n},"bpmn:EscalationEventDefinition":function(e,t,n){return x(e,c.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?Qn(t,h):"none",stroke:Qn(t,h)})},"bpmn:ConditionalEventDefinition":function(e,t){return x(e,c.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.222}}),{strokeWidth:1,stroke:Qn(t,h)})},"bpmn:LinkEventDefinition":function(e,t,n){return x(e,c.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.57,my:.263}}),{strokeWidth:1,fill:n?Qn(t,h):"none",stroke:Qn(t,h)})},"bpmn:ErrorEventDefinition":function(e,t,n){return x(e,c.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.2,my:.722}}),{strokeWidth:1,fill:n?Qn(t,h):"none",stroke:Qn(t,h)})},"bpmn:CancelEventDefinition":function(e,t,n){var i,r,a,o=x(e,c.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.638,my:-.055}}),{strokeWidth:1,fill:n?Qn(t,h):"none",stroke:Qn(t,h)});return i=o,r=45,(a=he()).setRotate(r,0,0),be(i,a),o},"bpmn:CompensateEventDefinition":function(e,t,n){return x(e,c.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.22,my:.5}}),{strokeWidth:1,fill:n?Qn(t,h):"none",stroke:Qn(t,h)})},"bpmn:SignalEventDefinition":function(e,t,n){return x(e,c.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?Qn(t,h):"none",stroke:Qn(t,h)})},"bpmn:MultipleEventDefinition":function(e,t,n){return x(e,c.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.222,my:.36}}),{strokeWidth:1,fill:n?Qn(t,h):"none"})},"bpmn:ParallelMultipleEventDefinition":function(e,t){return x(e,c.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:t.width,containerHeight:t.height,position:{mx:.458,my:.194}}),{strokeWidth:1,fill:Qn(t,h),stroke:Qn(t,h)})},"bpmn:EndEvent":function(e,t){var n=E("bpmn:Event")(e,t,{strokeWidth:4,fill:Jn(t,u),stroke:Qn(t,h)});return w(t,e),n},"bpmn:TerminateEventDefinition":function(e,t){return y(e,t.width,t.height,8,{strokeWidth:4,fill:Qn(t,h),stroke:Qn(t,h)})},"bpmn:IntermediateEvent":function(e,t){var n=E("bpmn:Event")(e,t,{strokeWidth:1,fill:Jn(t,u),stroke:Qn(t,h)});return y(e,t.width,t.height,3,{strokeWidth:1,fill:Jn(t,"none"),stroke:Qn(t,h)}),w(t,e),n},"bpmn:IntermediateCatchEvent":b("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":b("bpmn:IntermediateEvent"),"bpmn:Activity":function(e,t,n){return"fillOpacity"in(n=n||{})||(n.fillOpacity=.95),g(e,t.width,t.height,10,n)},"bpmn:Task":function(e,t){var n={fill:Jn(t,u),stroke:Qn(t,h)},i=E("bpmn:Activity")(e,t,n);return A(e,t,"center-middle"),k(e,t),i},"bpmn:ServiceTask":function(e,t){var n=E("bpmn:Task")(e,t);return x(e,c.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}}),{strokeWidth:1,fill:Jn(t,u),stroke:Qn(t,h)}),x(e,c.getScaledPath("TASK_TYPE_SERVICE_FILL",{abspos:{x:17.2,y:18}}),{strokeWidth:0,fill:Jn(t,u)}),x(e,c.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{strokeWidth:1,fill:Jn(t,u),stroke:Qn(t,h)}),n},"bpmn:UserTask":function(e,t){var n=E("bpmn:Task")(e,t);return x(e,c.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Jn(t,u),stroke:Qn(t,h)}),x(e,c.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Jn(t,u),stroke:Qn(t,h)}),x(e,c.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Qn(t,h),stroke:Qn(t,h)}),n},"bpmn:ManualTask":function(e,t){var n=E("bpmn:Task")(e,t);return x(e,c.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}}),{strokeWidth:.5,fill:Jn(t,u),stroke:Qn(t,h)}),n},"bpmn:SendTask":function(e,t){var n=E("bpmn:Task")(e,t);return x(e,c.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}}),{strokeWidth:1,fill:Qn(t,h),stroke:Jn(t,u)}),n},"bpmn:ReceiveTask":function(e,t){var n=Zn(t),i=E("bpmn:Task")(e,t);return x(e,n.instantiate?(y(e,28,28,4.4,{strokeWidth:1}),c.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):c.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),{strokeWidth:1,fill:Jn(t,u),stroke:Qn(t,h)}),i},"bpmn:ScriptTask":function(e,t){var n=E("bpmn:Task")(e,t);return x(e,c.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:Qn(t,h)}),n},"bpmn:BusinessRuleTask":function(e,t){var n=E("bpmn:Task")(e,t);return J(x(e,c.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}})),{strokeWidth:1,fill:Jn(t,"#aaaaaa"),stroke:Qn(t,h)}),J(x(e,c.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}})),{strokeWidth:1,stroke:Qn(t,h)}),n},"bpmn:SubProcess":function(e,t,n){n=N({fill:Jn(t,u),stroke:Qn(t,h)},n);var i,r=E("bpmn:Activity")(e,t,n),a=Un(t);return(i=t)&&Kn(i).triggeredByEvent&&J(r,{strokeDasharray:"1,2"}),A(e,t,a?"center-top":"center-middle"),a?k(e,t):k(e,t,["SubProcessMarker"]),r},"bpmn:AdHocSubProcess":function(e,t){return E("bpmn:SubProcess")(e,t)},"bpmn:Transaction":function(e,t){var n=E("bpmn:SubProcess")(e,t),i=r.style(["no-fill","no-events"],{stroke:Qn(t,h)});return g(e,t.width,t.height,8,3,i),n},"bpmn:CallActivity":function(e,t){return E("bpmn:SubProcess")(e,t,{strokeWidth:5})},"bpmn:Participant":function(e,t){var n={fillOpacity:.95,fill:Jn(t,u),stroke:Qn(t,h)},i=E("bpmn:Lane")(e,t,n);Un(t)?(v(e,[{x:30,y:0},{x:30,y:t.height}],{stroke:Qn(t,h)}),S(e,Zn(t).name,t)):_(e,Zn(t).name,{box:t,align:"center-middle",style:{fill:Qn(t,h)}});return!!Zn(t).participantMultiplicity&&E("ParticipantMultiplicityMarker")(e,t),i},"bpmn:Lane":function(e,t,n){var i=g(e,t.width,t.height,0,N({fill:Jn(t,u),fillOpacity:.35,stroke:Qn(t,h)},n)),r=Zn(t);"bpmn:Lane"===r.$type&&S(e,r.name,t);return i},"bpmn:InclusiveGateway":function(e,t){var n=E("bpmn:Gateway")(e,t);return y(e,t.width,t.height,.24*t.height,{strokeWidth:2.5,fill:Jn(t,u),stroke:Qn(t,h)}),n},"bpmn:ExclusiveGateway":function(e,t){var n=E("bpmn:Gateway")(e,t),i=c.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return Xn(t).isMarkerVisible&&x(e,i,{strokeWidth:1,fill:Qn(t,h),stroke:Qn(t,h)}),n},"bpmn:ComplexGateway":function(e,t){var n=E("bpmn:Gateway")(e,t);return x(e,c.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}}),{strokeWidth:1,fill:Qn(t,h),stroke:Qn(t,h)}),n},"bpmn:ParallelGateway":function(e,t){var n=E("bpmn:Gateway")(e,t);return x(e,c.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}}),{strokeWidth:1,fill:Qn(t,h),stroke:Qn(t,h)}),n},"bpmn:EventBasedGateway":function(e,t){var n=Zn(t),i=E("bpmn:Gateway")(e,t);y(e,t.width,t.height,.2*t.height,{strokeWidth:1,fill:"none",stroke:Qn(t,h)});var r,a,o=n.eventGatewayType,s=!!n.instantiate;if("Parallel"===o){var l=c.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}});J(x(e,l),{strokeWidth:1,fill:"none"})}else if("Exclusive"===o){if(!s)J(y(e,t.width,t.height,.26*t.height),{strokeWidth:1,fill:"none",stroke:Qn(t,h)});r=c.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:t.width,containerHeight:t.height,position:{mx:.36,my:.44}}),a={strokeWidth:2,fill:Jn(t,"none"),stroke:Qn(t,h)},x(e,r,a)}return i},"bpmn:Gateway":function(e,t){var n={fill:Jn(t,u),fillOpacity:.95,stroke:Qn(t,h)};return function(e,t,n,i){var r=t/2,a=n/2,o=[{x:r,y:0},{x:t,y:a},{x:r,y:n},{x:0,y:a}].map(function(e){return e.x+","+e.y}).join(" ");i=p(i,{stroke:"black",strokeWidth:2,fill:"white"});var s=pe("polygon");return J(s,{points:o}),J(s,i),q(e,s),s}(e,t.width,t.height,n)},"bpmn:SequenceFlow":function(e,t){var n,i=R(t),r=Jn(t,u),a=Qn(t,h),o=x(e,i,{strokeLinejoin:"round",markerEnd:d("sequenceflow-end",r,a),stroke:Qn(t,h)}),s=Zn(t);return t.source&&(n=t.source.businessObject,s.conditionExpression&&n.$instanceOf("bpmn:Activity")&&J(o,{markerStart:d("conditional-flow-marker",r,a)}),n.default&&(n.$instanceOf("bpmn:Gateway")||n.$instanceOf("bpmn:Activity"))&&n.default===s&&J(o,{markerStart:d("conditional-default-flow-marker",r,a)})),o},"bpmn:Association":function(e,t,n){var i=Zn(t),r=Jn(t,u),a=Qn(t,h);return n=N({strokeDasharray:"0.5, 5",strokeLinecap:"round",strokeLinejoin:"round",stroke:Qn(t,h)},n||{}),"One"!==i.associationDirection&&"Both"!==i.associationDirection||(n.markerEnd=d("association-end",r,a)),"Both"===i.associationDirection&&(n.markerStart=d("association-start",r,a)),v(e,t.waypoints,n)},"bpmn:DataInputAssociation":function(e,t){var n=Jn(t,u),i=Qn(t,h);return E("bpmn:Association")(e,t,{markerEnd:d("association-end",n,i)})},"bpmn:DataOutputAssociation":function(e,t){var n=Jn(t,u),i=Qn(t,h);return E("bpmn:Association")(e,t,{markerEnd:d("association-end",n,i)})},"bpmn:MessageFlow":function(e,t){var n=Zn(t),i=Xn(t),r=Jn(t,u),a=Qn(t,h),o=x(e,R(t),{markerEnd:d("messageflow-end",r,a),markerStart:d("messageflow-start",r,a),strokeDasharray:"10, 12",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5px",stroke:Qn(t,h)});if(n.messageRef){var s=o.getPointAtLength(o.getTotalLength()/2),l=c.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:s.x,y:s.y}}),p={strokeWidth:1};"initiating"===i.messageVisibleKind?(p.fill="white",p.stroke="black"):(p.fill="#888",p.stroke="white"),x(e,l,p)}return o},"bpmn:DataObject":function(e,t){var n,i,r,a,o,s,l=x(e,c.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),{fill:Jn(t,u),fillOpacity:.95,stroke:Qn(t,h)}),p=Zn(t);return s=(o=p).dataObjectRef,(o.isCollection||s&&s.isCollection)&&(n=e,r=((i=t).height-16)/i.height,a=c.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:i.width,containerHeight:i.height,position:{mx:.451,my:r}}),x(n,a,{strokeWidth:2})),l},"bpmn:DataObjectReference":b("bpmn:DataObject"),"bpmn:DataInput":function(e,t){var n=c.getRawPath("DATA_ARROW"),i=E("bpmn:DataObject")(e,t);return x(e,n,{strokeWidth:1}),i},"bpmn:DataOutput":function(e,t){var n=c.getRawPath("DATA_ARROW"),i=E("bpmn:DataObject")(e,t);return x(e,n,{strokeWidth:1,fill:"black"}),i},"bpmn:DataStoreReference":function(e,t){return x(e,c.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),{strokeWidth:2,fill:Jn(t,u),fillOpacity:.95,stroke:Qn(t,h)})},"bpmn:BoundaryEvent":function(e,t){var n=Zn(t).cancelActivity,i={strokeWidth:1,fill:Jn(t,u),stroke:Qn(t,h)};n||(i.strokeDasharray="6",i.strokeLinecap="round");var r=N({},i,{fillOpacity:1}),a=N({},i,{fill:"none"}),o=E("bpmn:Event")(e,t,r);return y(e,t.width,t.height,3,a),w(t,e),o},"bpmn:Group":function(e,t){return g(e,t.width,t.height,10,{strokeWidth:1,strokeDasharray:"8,3,1,3",fill:"none",pointerEvents:"none"})},label:function(e,t){return n=e,r={width:90,height:30,x:(i=t).width/2+i.x,y:i.height/2+i.y},_(n,qn(i),{box:r,fitBox:!0,style:N({},a.getExternalStyle(),{fill:Qn(i,h)})});var n,i,r},"bpmn:TextAnnotation":function(e,t){var n=g(e,t.width,t.height,0,0,{fill:"none",stroke:"none"});return x(e,c.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:0}}),{stroke:Qn(t,h)}),_(e,Zn(t).text||"",{box:t,align:"left-top",padding:5,style:{fill:Qn(t,h)}}),n},ParticipantMultiplicityMarker:function(e,t){i("participant-multiplicity",e,c.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:t.width/2/t.width,my:(t.height-15)/t.height}}),{strokeWidth:1,fill:Jn(t,u),stroke:Qn(t,h)})},SubProcessMarker:function(e,t){yt(g(e,14,14,0,{strokeWidth:1,fill:Jn(t,u),stroke:Qn(t,h)}),t.width/2-7.5,t.height-20),i("sub-process",e,c.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2-7.5)/t.width,my:(t.height-20)/t.height}}),{fill:Jn(t,u),stroke:Qn(t,h)})},ParallelMarker:function(e,t,n){i("parallel",e,c.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.parallel)/t.width,my:(t.height-20)/t.height}}),{fill:Jn(t,u),stroke:Qn(t,h)})},SequentialMarker:function(e,t,n){i("sequential",e,c.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.seq)/t.width,my:(t.height-19)/t.height}}),{fill:Jn(t,u),stroke:Qn(t,h)})},CompensationMarker:function(e,t,n){i("compensation",e,c.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.compensation)/t.width,my:(t.height-13)/t.height}}),{strokeWidth:1,fill:Jn(t,u),stroke:Qn(t,h)})},LoopMarker:function(e,t,n){i("loop",e,c.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.loop)/t.width,my:(t.height-7)/t.height}}),{strokeWidth:1,fill:Jn(t,u),stroke:Qn(t,h),strokeLinecap:"round",strokeMiterlimit:.5})},AdhocMarker:function(e,t,n){i("adhoc",e,c.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.adhoc)/t.width,my:(t.height-15)/t.height}}),{strokeWidth:1,fill:Qn(t,h),stroke:Qn(t,h)})}};function k(t,n,e){var i,r=Zn(n),a=e&&-1!==e.indexOf("SubProcessMarker");i=a?{seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},T(e,function(e){E(e)(t,n,i)}),r.isForCompensation&&E("CompensationMarker")(t,n,i),"bpmn:AdHocSubProcess"===r.$type&&E("AdhocMarker")(t,n,i);var o=r.loopCharacteristics,s=o&&o.isSequential;o&&(void 0===s&&E("LoopMarker")(t,n,i),!1===s&&E("ParallelMarker")(t,n,i),!0===s&&E("SequentialMarker")(t,n,i))}this._drawPath=x}t(ri,De),ri.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],ri.prototype.canRender=function(e){return Hn(e,"bpmn:BaseElement")},ri.prototype.drawShape=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},ri.prototype.drawConnection=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},ri.prototype.getShapePath=function(e){return Hn(e,"bpmn:Event")?(n=(t=e).x+t.width/2,i=t.y+t.height/2,r=t.width/2,Oe([["M",n,i],["m",0,-r],["a",r,r,0,1,1,0,2*r],["a",r,r,0,1,1,0,-2*r],["z"]])):Hn(e,"bpmn:Activity")?(o=10,s=(a=e).x,l=a.y,p=a.width,c=a.height,Oe([["M",s+o,l],["l",p-2*o,0],["a",o,o,0,0,1,o,o],["l",0,c-2*o],["a",o,o,0,0,1,-o,o],["l",2*o-p,0],["a",o,o,0,0,1,-o,-o],["l",0,2*o-c],["a",o,o,0,0,1,o,-o],["z"]])):Hn(e,"bpmn:Gateway")?(h=(u=e).width/2,m=u.height/2,Oe([["M",u.x+h,u.y],["l",h,m],["l",-h,m],["l",-h,-m],["z"]])):(d=(f=e).x,y=f.y,g=f.width,Oe([["M",d,y],["l",g,0],["l",0,f.height],["l",-g,0],["z"]]));var t,n,i,r,a,o,s,l,p,c,u,h,m,f,d,y,g};var ai=0,oi={width:150,height:50};function si(e,t){var n;t.textContent=e;try{var i,r=""===e;return t.textContent=r?"dummy":e,i={width:(n=t.getBBox()).width+2*n.x,height:n.height},r&&(i.width=0),i}catch(e){return{width:0,height:0}}}function li(e,t,n){for(var i,r=e.shift(),a=r;;){if((i=si(a,n)).width=a?i.width:0," "===a||""===a||i.width<Math.round(t)||a.length<2)return pi(e,a,r,i);a=ci(a,i.width,t)}}function pi(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}function ci(e,t,n){var i=Math.max(e.length*(n/t),1),r=function(e,t){var n,i=e.split(/(\s|-)/g),r=[],a=0;if(1<i.length)for(;n=i.shift();){if(!(n.length+a<t)){"-"===n&&r.pop();break}r.push(n),a+=n.length}return r.join("")}(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function ui(e){this._config=N({},{size:oi,padding:ai,style:{},align:"center-top"},e||{})}ui.prototype.createText=function(e,t){return this.layoutText(e,t).element},ui.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},ui.prototype.layoutText=function(e,t){var n,i,r,a,o=N({},this._config.size,t.box),s=N({},this._config.style,t.style),l=(i=t.align||this._config.align,{horizontal:(r=i.split("-"))[0]||"center",vertical:r[1]||"top"}),p=M(n=void 0!==t.padding?t.padding:this._config.padding)?N({top:0,left:0,right:0,bottom:0},n):{top:n,left:n,right:n,bottom:n},c=t.fitBox||!1,u=function(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}(s),h=e.split(/\r?\n/g),m=[],f=o.width-p.left-p.right,d=pe("text");for(J(d,{x:0,y:0}),J(d,s),q(((a=document.getElementById("helper-svg"))||(J(a=pe("svg"),{id:"helper-svg",width:0,height:0,style:"visibility: hidden; position: fixed"}),document.body.appendChild(a)),a),d);h.length;)m.push(li(h,f,d));"middle"===l.vertical&&(p.top=p.bottom=0);var y=b(m,function(e,t,n){return e+(u||t.height)},0)+p.top+p.bottom,g=b(m,function(e,t,n){return t.width>e?t.width:e},0),v=p.top;"middle"===l.vertical&&(v+=(o.height-y)/2),v-=(u||m[0].height)/4;var x=pe("text");return J(x,s),T(m,function(e){var t;switch(v+=u||e.height,l.horizontal){case"left":t=p.left;break;case"right":t=(c?g:f)-p.right-e.width;break;default:t=Math.max(((c?g:f)-e.width)/2+p.left,0)}var n=pe("tspan");J(n,{x:t,y:v}),n.textContent=e.text,q(x,n)}),ae(d),{dimensions:{width:g,height:y},element:x}};function hi(e){var i=N({fontFamily:"Arial, sans-serif",fontSize:12,fontWeight:"normal",lineHeight:1.2},e&&e.defaultStyle||{}),t=parseInt(i.fontSize,10)-1,r=N({},i,{fontSize:t},e&&e.externalStyle||{}),a=new ui({style:i});this.getExternalLabelBounds=function(e,t){var n=a.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:r});return{x:Math.round(e.x+e.width/2-n.width/2),y:Math.round(e.y),width:Math.ceil(n.width),height:Math.ceil(n.height)}},this.getTextAnnotationBounds=function(e,t){var n=a.getDimensions(t,{box:e,style:i,align:"left-top",padding:5});return{x:e.x,y:e.y,width:e.width,height:Math.max(30,Math.round(n.height))}},this.createText=function(e,t){return a.createText(e,t||{})},this.getDefaultStyle=function(){return i},this.getExternalStyle=function(){return r}}hi.$inject=["config.textRenderer"];var mi=/\{([^}]+)\}/g,fi=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var di={__init__:["bpmnRenderer"],bpmnRenderer:["type",ri],textRenderer:["type",hi],pathMap:["type",function(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m {mx}, {my} m 0 15 l 0 -15 m 4 15 l 0 -15 m 4 15 l 0 -15 ",height:61,width:51,heightElements:[12],widthElements:[1,6,12,15]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(e){return this.pathMap[e].d},this.getScaledPath=function(e,t){var n,i,r=this.pathMap[e];i=t.abspos?(n=t.abspos.x,t.abspos.y):(n=t.containerWidth*t.position.mx,t.containerHeight*t.position.my);var a,o,s={};if(t.position){for(var l=t.containerHeight/r.height*t.yScaleFactor,p=t.containerWidth/r.width*t.xScaleFactor,c=0;c<r.heightElements.length;c++)s["y"+c]=r.heightElements[c]*l;for(var u=0;u<r.widthElements.length;u++)s["x"+u]=r.widthElements[u]*p}return a=r.d,o={mx:n,my:i,e:s},String(a).replace(mi,function(e,t){return n=e,a=i=o,t.replace(fi,function(e,t,n,i,r){t=t||i,a&&(t in a&&(a=a[t]),"function"==typeof a&&r&&(a=a()))}),a=(null==a||a==i?n:a)+"";var n,i,a})}}]};var yi={translate:["value",function(e,n){return n=n||{},e.replace(/{([^}]+)}/g,function(e,t){return n[t]||"{"+t+"}"})}]},gi={width:90,height:20},vi=15;function xi(e){var t,n,i,r,a=e.length/2-1,o=e[Math.floor(a)],s=e[Math.ceil(a+.01)],l=(n=(t=e).length/2-1,i=t[Math.floor(n)],r=t[Math.ceil(n+.01)],{x:i.x+(r.x-i.x)/2,y:i.y+(r.y-i.y)/2}),p=Math.atan((s.y-o.y)/(s.x-o.x)),c=l.x,u=l.y;return Math.abs(p)<Math.PI/2?u-=vi:c+=vi,{x:c,y:u}}function bi(e,t){var n,i,r,a,o=e.di.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(gi.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=(a=t).waypoints?xi(a.waypoints):Hn(a,"bpmn:Group")?{x:a.x+a.width/2,y:a.y+gi.height/2}:{x:a.x+a.width/2,y:a.y+a.height+gi.height/2},i=gi),N({x:n.x-i.width/2,y:n.y-i.height/2},i)}
|
|
/**
|
|
* This file contains portions that got extraced from Snap.svg (licensed Apache-2.0).
|
|
*
|
|
* @see https://github.com/adobe-webplatform/Snap.svg/blob/master/src/path.js
|
|
*/Math.PI;function Ei(e){return t={x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2},{x:Math.round(t.x),y:Math.round(t.y)};var t}function wi(e,t){return N({id:e.id,type:e.$type,businessObject:e},t)}function _i(e,t,n,i){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:Wn(n),referenced:Wn(t),property:i}))}function Ai(e,t,n,i,r,a){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._translate=r,this._textRenderer=a}Ai.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate","textRenderer"],Ai.prototype.add=function(e,t){var n,i,r,a,o,s,l,p,c,u,h,m,f=e.di,d=this._translate;if(Hn(f,"bpmndi:BPMNPlane"))n=this._elementFactory.createRoot(wi(e)),this._canvas.setRootElement(n);else if(Hn(f,"bpmndi:BPMNShape")){var y=!Un(e);i=t&&(t.hidden||t.collapsed);var g=e.di.bounds;n=this._elementFactory.createShape(wi(e,{collapsed:y,hidden:i,x:Math.round(g.x),y:Math.round(g.y),width:Math.round(g.width),height:Math.round(g.height)})),Hn(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,n),Hn(e,"bpmn:Lane")&&(r=0),Hn(e,"bpmn:DataStoreReference")&&(p=t,c=Ei(g),u=c.x,h=c.y,u>=p.x&&u<=p.x+p.width&&h>=p.y&&h<=p.y+p.height||(t=this._canvas.getRootElement())),this._canvas.addShape(n,t,r)}else{if(!Hn(f,"bpmndi:BPMNEdge"))throw new Error(d("unknown di {di} for element {semantic}",{di:Wn(f),semantic:Wn(e)}));var v=this._getSource(e),x=this._getTarget(e);i=t&&(t.hidden||t.collapsed),n=this._elementFactory.createConnection(wi(e,{hidden:i,source:v,target:x,waypoints:(a=e,o=v,s=x,l=a.di.waypoint,!l||l.length<2?[Ei(o),Ei(s)]:l.map(function(e){return{x:e.x,y:e.y}}))})),Hn(e,"bpmn:DataAssociation")&&(t=null),Hn(e,"bpmn:SequenceFlow")&&(r=0),this._canvas.addConnection(n,t,r)}return(Hn(m=e,"bpmn:Event")||Hn(m,"bpmn:Gateway")||Hn(m,"bpmn:DataStoreReference")||Hn(m,"bpmn:DataObjectReference")||Hn(m,"bpmn:DataInput")||Hn(m,"bpmn:DataOutput")||Hn(m,"bpmn:SequenceFlow")||Hn(m,"bpmn:MessageFlow")||Hn(m,"bpmn:Group"))&&qn(n)&&this.addLabel(e,n),this._eventBus.fire("bpmnElement.added",{element:n}),n},Ai.prototype._attachBoundary=function(e,t){var n=this._translate,i=e.attachedToRef;if(!i)throw new Error(n("missing {semantic}#attachedToRef",{semantic:Wn(e)}));var r=this._elementRegistry.get(i.id),a=r&&r.attachers;if(!r)throw _i(n,e,i,"attachedToRef");t.host=r,a||(r.attachers=a=[]),-1===a.indexOf(t)&&a.push(t)},Ai.prototype.addLabel=function(e,t){var n,i,r;return n=bi(e,t),(i=qn(t))&&(n=this._textRenderer.getExternalLabelBounds(n,i)),r=this._elementFactory.createLabel(wi(e,{id:e.id+"_label",labelTarget:t,type:"label",hidden:t.hidden||!qn(t),x:Math.round(n.x),y:Math.round(n.y),width:Math.round(n.width),height:Math.round(n.height)})),this._canvas.addShape(r,t.parent)},Ai.prototype._getEnd=function(e,t){var n,i,r=e.$type,a=this._translate;if(i=e[t+"Ref"],"source"===t&&"bpmn:DataInputAssociation"===r&&(i=i&&i[0]),("source"===t&&"bpmn:DataOutputAssociation"===r||"target"===t&&"bpmn:DataInputAssociation"===r)&&(i=e.$parent),n=i&&this._getElement(i))return n;throw i?_i(a,e,i,t+"Ref"):new Error(a("{semantic}#{side} Ref not specified",{semantic:Wn(e),side:t}))},Ai.prototype._getSource=function(e){return this._getEnd(e,"source")},Ai.prototype._getTarget=function(e){return this._getEnd(e,"target")},Ai.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var Si={__depends__:[di,{__depends__:[yi],bpmnImporter:["type",Ai]}]};function Ri(e){return e.originalEvent||e.srcEvent}function Ci(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function ki(e){return!(Ri(e)||e).button}function Mi(e){var t=Ri(e)||e;return!!ki(e)&&(/mac/i.test(navigator.platform)?t.metaKey:t.ctrlKey)}function Pi(e){return!0}function Ti(o,s,e){var r=e.cls("djs-hit",["no-fill","no-border"],{stroke:"white",strokeWidth:15});function a(e,t,n){var i,r,a;(i=t,(u[e]||ki)(i))&&(n?a=s.getGraphics(n):(r=t.delegateTarget||t.target)&&(a=r,n=s.get(a)),a&&n&&!1===o.fire(e,{element:n,gfx:a,originalEvent:t})&&(t.stopPropagation(),t.preventDefault()))}var l={};function p(e){return l[e]}var c={mouseover:"element.hover",mouseout:"element.out",click:"element.click",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseup:"element.mouseup",contextmenu:"element.contextmenu"},u={"element.contextmenu":Pi};var h="svg, .djs-element";function i(e,t,n,i){var r=l[n]=function(e){a(n,e)};i&&(u[n]=i),r.$delegate=F.bind(e,h,t,r)}function m(e,t,n){var i=p(n);i&&F.unbind(e,t,i.$delegate)}o.on("canvas.destroy",function(e){var n;n=e.svg,T(c,function(e,t){m(n,t,e)})}),o.on("canvas.init",function(e){var n;n=e.svg,T(c,function(e,t){i(n,t,e)})}),o.on(["shape.added","connection.added"],function(e){var t,n=e.element,i=e.gfx;n.waypoints?t=Le(n.waypoints):J(t=pe("rect"),{x:0,y:0,width:n.width,height:n.height}),J(t,r),q(i,t)}),o.on("shape.changed",500,function(e){var t=e.element;J(H(".djs-hit",e.gfx),{width:t.width,height:t.height})}),o.on("connection.changed",function(e){var t,n,i=e.element,r=H(".djs-hit",e.gfx);t=r,n=i.waypoints,J(t,{points:Be(n)})}),this.fire=a,this.triggerMouseEvent=function(e,t,n){var i=c[e];if(!i)throw new Error("unmapped DOM event name <"+e+">");return a(i,t,n)},this.mouseHandler=p,this.registerEvent=i,this.unregisterEvent=m}Ti.$inject=["eventBus","elementRegistry","styles"];var Ni={__init__:["interactionEvents"],interactionEvents:["type",Ti]};function Di(e,t,n){this.offset=6;var i=t.cls("djs-outline",["no-fill"]),r=this;function a(e,t){var n=pe("rect");return J(n,N({x:10,y:10,width:100,height:100},i)),q(e,n),n}e.on(["shape.added","shape.changed"],500,function(e){var t=e.element,n=e.gfx,i=H(".djs-outline",n);i||(i=a(n)),r.updateShapeOutline(i,t)}),e.on(["connection.added","connection.changed"],function(e){var t=e.element,n=e.gfx,i=H(".djs-outline",n);i||(i=a(n)),r.updateConnectionOutline(i,t)})}Di.prototype.updateShapeOutline=function(e,t){J(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},Di.prototype.updateConnectionOutline=function(e,t){var n=Ie(t);J(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},Di.$inject=["eventBus","styles","elementRegistry"];var Oi={__init__:["outline"],outline:["type",Di]};function Bi(e){this._eventBus=e,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],function(e){var t=e.element;n.deselect(t)}),e.on(["diagram.clear"],function(e){n.select(null)})}Bi.$inject=["eventBus"],Bi.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(-1!==n){var i=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:t})}},Bi.prototype.get=function(){return this._selectedElements},Bi.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},Bi.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();u(e)||(e=e?[e]:[]),t?T(e,function(e){-1===n.indexOf(e)&&n.push(e)}):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:n})};var Li="selected";function Ii(e,n,t,i){function r(e,t){n.addMarker(e,t)}function a(e,t){n.removeMarker(e,t)}this._multiSelectionBox=null,e.on("element.hover",function(e){r(e.element,"hover")}),e.on("element.out",function(e){a(e.element,"hover")}),e.on("selection.changed",function(e){var t=e.oldSelection,n=e.newSelection;T(t,function(e){-1===n.indexOf(e)&&a(e,Li)}),T(n,function(e){-1===t.indexOf(e)&&r(e,Li)})})}function Fi(e,a,o,i){e.on("create.end",500,function(e){e.context.canExecute&&a.select(e.context.shape)}),e.on("connect.end",500,function(e){e.context.canExecute&&e.context.target&&a.select(e.context.target)}),e.on("shape.move.end",500,function(e){var t=e.previousSelection||[],n=i.get(e.context.shape.id);k(t,function(e){return n.id===e.id})||a.select(n)}),e.on("element.click",function(e){var t=e.element;t===o.getRootElement()&&(t=null);var n=a.isSelected(t),i=1<a.get().length,r=Mi(e);if(n&&i)return r?a.deselect(t):a.select(t);n?a.deselect(t):a.select(t,r)})}Ii.$inject=["eventBus","canvas","selection","styles"],Fi.$inject=["eventBus","selection","canvas","elementRegistry"];var ji={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ni,Oi],selection:["type",Bi],selectionVisuals:["type",Ii],selectionBehavior:["type",Fi]};function Vi(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}Vi.prototype.next=function(){return this._prefix+ ++this._counter};var Wi=new Vi("ov");function zi(e,t,n,i){var r,a;this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=Wi,this._overlayDefaults=N({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=(r=n.getContainer(),a=j('<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />'),r.insertBefore(a,r.firstChild),a),this._init()}function Gi(e,t,n){N(e.style,{left:t+"px",top:n+"px"})}function $i(e,t){e.style.display=!1===t?"none":""}function Hi(t,n){t.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(e){t.style[e+"transform"]=n})}zi.$inject=["config.overlays","eventBus","canvas","elementRegistry"],zi.prototype.get=function(e){if(p(e)&&(e={id:e}),p(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?P(t.overlays,i({type:e.type})):t.overlays.slice():[]}return e.type?P(this._overlays,i({type:e.type})):e.id?this._overlays[e.id]:null},zi.prototype.add=function(e,t,n){if(M(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=N({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},zi.prototype.remove=function(e){var t=this.get(e)||[];u(t)||(t=[t]);var i=this;T(t,function(e){var t=i._getOverlayContainer(e.element,!0);if(e&&(K(e.html),K(e.htmlContainer),delete e.htmlContainer,delete e.element,delete i._overlays[e.id]),t){var n=t.overlays.indexOf(e);-1!==n&&t.overlays.splice(n,1)}})},zi.prototype.show=function(){$i(this._overlayRoot)},zi.prototype.hide=function(){$i(this._overlayRoot,!1)},zi.prototype.clear=function(){this._overlays={},this._overlayContainers=[],w(this._overlayRoot)},zi.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var a=Ie(t);i=a.x,r=a.y}Gi(n,i,r),function(e,t,n){2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):e.setAttribute(t,n)}(e.html,"data-container-id",t.id)},zi.prototype._updateOverlay=function(e){var t,n,i=e.position,r=e.htmlContainer,a=e.element,o=i.left,s=i.top;void 0!==i.right&&(t=a.waypoints?Ie(a).width:a.width,o=-1*i.right+t);void 0!==i.bottom&&(n=a.waypoints?Ie(a).height:a.height,s=-1*i.bottom+n);Gi(r,o||0,s||0)},zi.prototype._createOverlayContainer=function(e){var t=j('<div class="djs-overlays" style="position: absolute" />');this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},zi.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Hi(this._overlayRoot,n)},zi.prototype._getOverlayContainer=function(t,e){var n=k(this._overlayContainers,function(e){return e.element===t});return n||e?n:this._createOverlayContainer(t)},zi.prototype._addOverlay=function(e){var t,n,i=e.id,r=e.element,a=e.html;a.get&&a.constructor.prototype.jquery&&(a=a.get(0)),p(a)&&(a=j(a)),n=this._getOverlayContainer(r),(t=j('<div class="djs-overlay" data-overlay-id="'+i+'" style="position: absolute">')).appendChild(a),e.type&&x(t).add("djs-overlay-"+e.type),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[i]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},zi.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=n&&n.minZoom,r=n&&n.maxZoom,a=e.htmlContainer,o=!0;n&&((l(i)&&i>t.scale||l(r)&&r<t.scale)&&(o=!1),$i(a,o)),this._updateOverlayScale(e,t)},zi.prototype._updateOverlayScale=function(e,t){var n,i,r,a=e.scale,o=e.htmlContainer,s="";!0!==a&&(i=!1===a?n=1:(n=a.min,a.max),l(n)&&t.scale<n&&(r=(1/t.scale||1)*n),l(i)&&t.scale>i&&(r=(1/t.scale||1)*i)),l(r)&&(s="scale("+r+","+r+")"),Hi(o,s)},zi.prototype._updateOverlaysVisibilty=function(t){var n=this;T(this._overlays,function(e){n._updateOverlayVisibilty(e,t)})},zi.prototype._init=function(){var e=this._eventBus,r=this;e.on("canvas.viewbox.changing",function(e){r.hide()}),e.on("canvas.viewbox.changed",function(e){var t;t=e.viewbox,r._updateRoot(t),r._updateOverlaysVisibilty(t),r.show()}),e.on(["shape.remove","connection.remove"],function(e){var t=e.element;T(r.get({element:t}),function(e){r.remove(e.id)});var n=r._getOverlayContainer(t);if(n){K(n.html);var i=r._overlayContainers.indexOf(n);-1!==i&&r._overlayContainers.splice(i,1)}}),e.on("element.changed",500,function(e){var t=e.element,n=r._getOverlayContainer(t,!0);n&&(T(n.overlays,function(e){r._updateOverlay(e)}),r._updateOverlayContainer(n))}),e.on("element.marker.update",function(e){var t=r._getOverlayContainer(e.element,!0);t&&x(t.html)[e.add?"add":"remove"](e.marker)}),e.on("diagram.clear",this.clear,this)};var Ki={__init__:["overlays"],overlays:["type",zi]},Ui='<img width="52" height="52" src="'+("data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 960"><path fill="#fff" d="M960 60v839c0 33-27 61-60 61H60c-33 0-60-27-60-60V60C0 27 27 0 60 0h839c34 0 61 27 61 60z"/><path fill="#52b415" d="M217 548a205 205 0 0 0-144 58 202 202 0 0 0-4 286 202 202 0 0 0 285 3 200 200 0 0 0 48-219 203 203 0 0 0-185-128zM752 6a206 206 0 0 0-192 285 206 206 0 0 0 269 111 207 207 0 0 0 111-260A204 204 0 0 0 752 6zM62 0A62 62 0 0 0 0 62v398l60 46a259 259 0 0 1 89-36c5-28 10-57 14-85l99 2 12 85a246 246 0 0 1 88 38l70-52 69 71-52 68c17 30 29 58 35 90l86 14-2 100-86 12a240 240 0 0 1-38 89l43 58h413c37 0 60-27 60-61V407a220 220 0 0 1-44 40l21 85-93 39-45-76a258 258 0 0 1-98 1l-45 76-94-39 22-85a298 298 0 0 1-70-69l-86 22-38-94 76-45a258 258 0 0 1-1-98l-76-45 40-94 85 22a271 271 0 0 1 41-47z"/></svg>'))+'" />';
|
|
/**
|
|
* This file must not be changed or exchanged.
|
|
*
|
|
* @see http://bpmn.io/license for more information.
|
|
*/function qi(e){return e.join(";")}var Yi,Xi='<div class="bjs-powered-by-lightbox" style="'+qi(["z-index: 1001","position: fixed","top: 0","left: 0","right: 0","bottom: 0"])+'"><div class="backdrop" style="'+qi(["width: 100%","height: 100%","background: rgba(0,0,0,0.2)"])+'"></div><div class="notice" style="'+qi(["position: absolute","left: 50%","top: 40%","margin: 0 -130px","width: 260px","padding: 10px","background: white","border: solid 1px #AAA","border-radius: 3px","font-family: Helvetica, Arial, sans-serif","font-size: 14px","line-height: 1.2em"])+'"><a href="http://bpmn.io" target="_blank" style="float: left; margin-right: 10px">'+Ui+'</a>Web-based tooling for BPMN, DMN and CMMN diagrams powered by <a href="http://bpmn.io" target="_blank">bpmn.io</a>.</div></div>';var Zi={width:"100%",height:"100%",position:"relative"};function Ji(e){return e+(o(e)?"px":"")}function Qi(e){
|
|
/**
|
|
* Adds the project logo to the diagram container as
|
|
* required by the bpmn.io license.
|
|
*
|
|
* @see http://bpmn.io/license
|
|
*
|
|
* @param {Element} container
|
|
*/
|
|
var t,n;e=N({},Zi,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),t=this._container,n=j('<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" style="position: absolute; bottom: 15px; right: 15px; z-index: 100">'+Ui+"</a>"),t.appendChild(n),L.bind(n,"click",function(e){Yi||(Yi=j(Xi),F.bind(Yi,".backdrop","click",function(e){document.body.removeChild(Yi)})),document.body.appendChild(Yi),e.preventDefault()}),this._init(this._container,this._moddle,e)}function er(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function tr(e,t){return-1<(e=u(e)?e:[e]).indexOf(t.key)}function nr(e){return e.shiftKey}t(Qi,Et),Qi.prototype.importXML=function(e,o,s){h(o)&&(s=o,o=null),s=s||function(){};var l=this;e=this._emit("import.parse.start",{xml:e})||e,this._moddle.fromXML(e,"bpmn:Definitions",function(e,t,n){t=l._emit("import.parse.complete",{error:e,definitions:t,context:n})||t;var i,r,a=n.warnings;if(e)return(r=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec((i=e).message))&&(i.message="unparsable content <"+r[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+r[2]),e=i,l._emit("import.done",{error:e,warnings:a}),s(e,a);l.importDefinitions(t,o,function(e,t){var n=[].concat(a,t||[]);l._emit("import.done",{error:e,warnings:n}),s(e,n)})})},Qi.prototype.importDefinitions=function(e,t,n){return h(t)&&(n=t,t=null),n=n||function(){},this._setDefinitions(e),this.open(t,n)},Qi.prototype.open=function(e,t){h(e)&&(t=e,e=null);var n,i,r=this._definitions,a=e;if(t=t||function(){},!r)return t(new Error("no XML imported"));if("string"==typeof e&&(n=r,!(a=(i=e)&&k(n.diagrams,function(e){return e.id===i})||null)))return t(new Error("BPMNDiagram <"+e+"> not found"));try{this.clear()}catch(e){return t(e)}return function(e,t,n,i){var r,a,o;h(n)&&(i=n,n=null);var s,l,p,c=[];try{r=e.get("bpmnImporter"),a=e.get("eventBus"),o=e.get("translate"),a.fire("import.render.start",{definitions:t}),l=t,p=n,new $n({root:function(e){return r.add(e)},element:function(e,t){return r.add(e,t)},error:function(e,t){c.push({message:e,context:t})}},o).handleDefinitions(l,p),a.fire("import.render.complete",{error:s,warnings:c})}catch(e){s=e}i(s,c)}(this,r,a,t)},Qi.prototype.saveXML=function(e,n){n||(n=e,e={});var i=this,t=this._definitions;if(!t)return n(new Error("no definitions loaded"));t=this._emit("saveXML.start",{definitions:t})||t,this._moddle.toXML(t,e,function(e,t){try{t=i._emit("saveXML.serialized",{error:e,xml:t})||t,i._emit("saveXML.done",{error:e,xml:t})}catch(e){console.error("error in saveXML life-cycle listener",e)}n(e,t)})},Qi.prototype.saveSVG=function(e,t){var n,i;t||(t=e,e={}),this._emit("saveSVG.start");try{var r=this.get("canvas"),a=r.getDefaultLayer(),o=H("defs",r._svg),s=xe(a),l=o?"<defs>"+xe(o)+"</defs>":"",p=a.getBBox();n='<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- created with bpmn-js / http://bpmn.io --\x3e\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="'+p.width+'" height="'+p.height+'" viewBox="'+p.x+" "+p.y+" "+p.width+" "+p.height+'" version="1.1">'+l+s+"</svg>"}catch(e){i=e}this._emit("saveSVG.done",{error:i,svg:n}),t(i,n)},Qi.prototype._setDefinitions=function(e){this._definitions=e},Qi.prototype.getModules=function(){return this._modules},Qi.prototype.clear=function(){this.get("elementRegistry").forEach(function(e){var t=e.businessObject;t&&t.di&&delete t.di}),Et.prototype.clear.call(this)},Qi.prototype.destroy=function(){Et.prototype.destroy.call(this),K(this._container)},Qi.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Qi.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Qi.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),"string"==typeof e&&(e=H(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Qi.prototype.getDefinitions=function(){return this._definitions},Qi.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Qi.prototype._init=function(e,t,n){var i,r,a=n.modules||this.getModules(),o=n.additionalModules||[],s=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],a,o),l=N((i=["additionalModules"],r={},T(Object(n),function(e,t){-1===i.indexOf(t)&&(r[t]=e)}),r),{canvas:N({},n.canvas,{container:e}),modules:s});Et.call(this,l),n&&n.container&&this.attachTo(n.container)},Qi.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Qi.prototype._createContainer=function(e){var t=j('<div class="bjs-container"></div>');return N(t.style,{width:Ji(e.width),height:Ji(e.height),position:e.position}),t},Qi.prototype._createModdle=function(e){return new Vn(N({},this._moddleExtensions,e.moddleExtensions))},Qi.prototype._modules=[Si,yi,ji,Ki],Qi.prototype._moddleExtensions={};var ir="keyboard.keydown";function rr(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()})}rr.$inject=["config.keyboard","eventBus"],rr.prototype._keydownHandler=function(e){this._keyHandler(e,ir)},rr.prototype._keyupHandler=function(e){this._keyHandler(e,"keyboard.keyup")},rr.prototype._keyHandler=function(e,t){var n=e.target;if(!(i=n)||!$(i,"input, textarea")&&"true"!==i.contentEditable){var i,r={keyEvent:e};this._eventBus.fire(t||ir,r)&&e.preventDefault()}},rr.prototype.bind=function(e){this.unbind(),this._node=e,L.bind(e,"keydown",this._keydownHandler,!0),L.bind(e,"keyup",this._keyupHandler,!0),this._fire("bind")},rr.prototype.getBinding=function(){return this._node},rr.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),L.unbind(e,"keydown",this._keydownHandler,!0),L.unbind(e,"keyup",this._keyupHandler,!0)),this._node=null},rr.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},rr.prototype.addListener=function(e,t,n){h(e)&&(n=t,t=e,e=1e3),this._eventBus.on(n||ir,e,t)},rr.prototype.removeListener=function(e,t){this._eventBus.off(t||ir,e)},rr.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},rr.prototype.isCmd=er,rr.prototype.isShift=nr,rr.prototype.isKey=tr;function ar(e,n){var i=this;e.on("editorActions.init",500,function(e){var t=e.editorActions;i.registerBindings(n,t)})}ar.$inject=["eventBus","keyboard"],ar.prototype.registerBindings=function(n,i){function e(e,t){i.isRegistered(e)&&n.addListener(t)}e("undo",function(e){var t=e.keyEvent;if(er(t)&&!nr(t)&&tr(["z","Z"],t))return i.trigger("undo"),!0}),e("redo",function(e){var t=e.keyEvent;if(er(t)&&(tr(["y","Y"],t)||tr(["z","Z"],t)&&nr(t)))return i.trigger("redo"),!0}),e("copy",function(e){var t=e.keyEvent;if(er(t)&&tr(["c","C"],t))return i.trigger("copy"),!0}),e("paste",function(e){var t=e.keyEvent;if(er(t)&&tr(["v","V"],t))return i.trigger("paste"),!0}),e("stepZoom",function(e){var t=e.keyEvent;if(tr(["+","Add"],t)&&er(t))return i.trigger("stepZoom",{value:1}),!0}),e("stepZoom",function(e){var t=e.keyEvent;if(tr(["-","Subtract"],t)&&er(t))return i.trigger("stepZoom",{value:-1}),!0}),e("zoom",function(e){var t=e.keyEvent;if(tr("0",t)&&er(t))return i.trigger("zoom",{value:1}),!0}),e("removeSelection",function(e){if(tr(["Delete","Del"],e.keyEvent))return i.trigger("removeSelection"),!0})};var or={__init__:["keyboard","keyboardBindings"],keyboard:["type",rr],keyboardBindings:["type",ar]},sr={moveSpeed:50,moveSpeedAccelerated:200};function lr(e,a,r){var o=this;this._config=N({},sr,e||{}),a.addListener(function(e){var t=e.keyEvent,n=o._config;if(!a.isCmd(t))return;if(a.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],t)){var i,r=a.isShift(t)?n.moveSpeedAccelerated:n.moveSpeed;switch(t.key){case"ArrowLeft":case"Left":i="left";break;case"ArrowUp":case"Up":i="up";break;case"ArrowRight":case"Right":i="right";break;case"ArrowDown":case"Down":i="down"}return o.moveCanvas({speed:r,direction:i}),!0}}),this.moveCanvas=function(e){var t=0,n=0,i=e.speed/Math.min(Math.sqrt(r.viewbox().scale),1);switch(e.direction){case"left":t=i;break;case"up":n=i;break;case"right":t=-i;break;case"down":n=-i}r.scroll({dx:t,dy:n})}}lr.$inject=["config.keyboardMove","keyboard","canvas"];var pr={__depends__:[or],__init__:["keyboardMove"],keyboardMove:["type",lr]},cr=/^djs-cursor-.*$/;function ur(e){var t=x(document.body);t.removeMatching(cr),e&&t.add("djs-cursor-"+e)}var hr=5e3;function mr(e,t){return{x:e.x-t.x,y:e.y-t.y}}function fr(a,o){var s;function t(e){var t,n=s.start,i=Ci(e),r=mr(i,n);(!s.dragging&&(t=r,15<Math.sqrt(Math.pow(t.x,2)+Math.pow(t.y,2)))&&(s.dragging=!0,function(e,t){function n(){return!1}t=t||"element.click",e.once(t,hr,n)}(a),ur("grab")),s.dragging)&&(r=mr(i,s.last||s.start),o.scroll({dx:r.x,dy:r.y}),s.last=i);e.preventDefault()}function n(e){L.unbind(document,"mousemove",t),L.unbind(document,"mouseup",n),ur(s=null)}a.on("element.mousedown",500,function(e){return function(e){if(C(e.target,".djs-draggable"))return;if(e.button||e.ctrlKey||e.shiftKey||e.altKey)return;return s={start:Ci(e)},L.bind(document,"mousemove",t),L.bind(document,"mouseup",n),!0}(e.originalEvent)})}fr.$inject=["eventBus","canvas"];var dr={__init__:["moveCanvas"],moveCanvas:["type",fr]};function yr(e){return Math.log(e)/Math.log(10)}function gr(e,t){var n=yr(e.min),i=yr(e.max);return(Math.abs(n)+Math.abs(i))/t}var vr=Math.sign||function(e){return 0<=e?1:-1},xr={min:.2,max:4};function br(t,e,n){t=t||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=f(this._handleWheel,this),this._totalDelta=0,this._scale=t.scale||.75;var i=this;e.on("canvas.init",function(e){i._init(!1!==t.enabled)})}br.$inject=["config.zoomScroll","eventBus","canvas"],br.prototype.scroll=function(e){this._canvas.scroll(e)},br.prototype.reset=function(){this._canvas.zoom("fit-viewport")},br.prototype.zoom=function(e,t){var n=gr(xr,20);this._totalDelta+=e,.1<Math.abs(this._totalDelta)&&(this._zoom(e,t,n),this._totalDelta=0)},br.prototype._handleWheel=function(e){if(!C(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,i=e.ctrlKey,r=e.shiftKey,a=-1*this._scale;if(a*=i?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,i){var o=t.getBoundingClientRect(),s={x:e.clientX-o.left,y:e.clientY-o.top};n=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*vr(e.deltaY)*a,this.zoom(n,s)}else n=r?{dx:a*e.deltaY,dy:0}:{dx:a*e.deltaX,dy:a*e.deltaY},this.scroll(n)}},br.prototype.stepZoom=function(e,t){var n=gr(xr,10);this._zoom(e,t,n)},br.prototype._zoom=function(e,t,n){var i=this._canvas,r=0<e?1:-1,a=yr(i.zoom()),o=Math.round(a/n)*n;o+=n*r;var s,l,p=Math.pow(10,o);i.zoom((s=xr,l=p,Math.max(s.min,Math.min(s.max,l))),t)},br.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return void 0===e&&(e=!i),i!==e&&L[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e},br.prototype._init=function(e){this.toggle(e)};var Er={__init__:["zoomScroll"],zoomScroll:["type",br]};function wr(e){Qi.call(this,e)}return t(wr,Qi),wr.prototype._modules=[].concat(wr.prototype._modules,wr.prototype._navigationModules=[pr,dr,Er]),wr});
|