7){e[t].shift();for(var i=e[t];i.length;)s[t]="A",e.splice(t++,0,["C",...i.splice(0,6)]);e.splice(t,1),p=n.length}},s=[],a="",l="",c=0,p=n.length;c=r.right,a=i.top-n.y>=r.bottom,l=o?"top":a?"bottom":null,c=i.right+n.x<=r.left?"left":s?"right":null;return c&&l?l+"-"+c:c||l||"intersect"}function kn(e,t,n){var i=function(e,t){return pn(e,t)}(e,t);return 1===i.length||2===i.length&&Dt(i[0],i[1])<1?xn(i[0]):i.length>1?(i=R(i,(function(e){var t=Math.floor(100*e.t2)||1;return t=((t=100-t)<10?"0":"")+t,e.segment2+"#"+t})),xn(i[n?0:i.length-1])):null}function Sn(e,t){return Math.round(e*t)/t}function Cn(e){return m(e)?e+"px":e}function Tn(e,t,n){const i=Le("g");Me(i).add(t);const r=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const An={shape:["x","y","width","height"],connection:["waypoints"]};function Mn(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._init(e||{})}function Dn(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Mn.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Mn.prototype._init=function(e){const t=this._eventBus,n=this._container=function(e){const t=(e=z({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Z(n,{position:"relative",overflow:"hidden",width:Cn(e.width),height:Cn(e.height)}),t.appendChild(n),n}(e),i=this._svg=Le("svg");Te(i,{width:"100%",height:"100%"}),ke(n,i);const r=this._viewport=Tn(i,"viewport");e.deferUpdate&&(this._viewboxChanged=B(q(this._viewboxChanged,this),300)),t.on("diagram.init",(()=>{t.fire("canvas.init",{svg:i,viewport:r})})),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],(()=>{delete this._cachedViewbox})),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Mn.prototype._destroy=function(){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},Mn.prototype._clear=function(){this._elementRegistry.getAll().forEach((e=>{const t=Ot(e);"root"===t?this.removeRootElement(e):this._removeElement(e,t)})),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Mn.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},Mn.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),void 0!==t&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},Mn.prototype._getChildIndex=function(e){return O(this._layers,(function(t,n){return n.visible&&e>=n.index&&t++,t}),0)},Mn.prototype._createLayer=function(e,t){void 0===t&&(t=1);const n=this._getChildIndex(t);return{group:Tn(this._viewport,"layer-"+e,n),index:t,visible:!0}},Mn.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},Mn.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible?(Ke(n),t.visible=!1,n):n},Mn.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Ke(t.group))},Mn.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Mn.prototype.findRoot=function(e){if("string"==typeof e&&(e=this._elementRegistry.get(e)),!e)return;const t=this._findPlaneForRoot(function(e){for(;e.parent;)e=e.parent;return e}(e))||{};return t.rootElement},Mn.prototype.getRootElements=function(){return this._planes.map((function(e){return e.rootElement}))},Mn.prototype._findPlaneForRoot=function(e){return b(this._planes,(function(t){return t.rootElement===e}))},Mn.prototype.getContainer=function(){return this._container},Mn.prototype._updateMarker=function(e,t,n){let i;e.id||(e=this._elementRegistry.get(e)),i=this._elementRegistry._elements[e.id],i&&(_([i.gfx,i.secondaryGfx],(function(e){e&&(n?Me(e).add(t):Me(e).remove(t))})),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Mn.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Mn.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Mn.prototype.hasMarker=function(e,t){e.id||(e=this._elementRegistry.get(e));return Me(this.getGraphics(e)).has(t)},Mn.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Mn.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Mn.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,0);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Mn.prototype.removeRootElement=function(e){"string"==typeof e&&(e=this._elementRegistry.get(e));if(this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter((function(t){return t.rootElement!==e})),this._rootElement===e&&(this._rootElement=null),e},Mn.prototype.setRootElement=function(e){if(e===this._rootElement)return;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},Mn.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},Mn.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},Mn.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},Mn.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=An[e],i=P(n,(function(e){return void 0!==t[e]}));if(!i)throw new Error("must supply { "+n.join(", ")+" } with "+e)},Mn.prototype._setParent=function(e,t,n){At(t.children,e,n),e.parent=t},Mn.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const s=o.create(e,t,i);return this._elementRegistry.add(t,s),o.update(e,t,s),r.fire(e+".added",{element:t,gfx:s}),t},Mn.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Mn.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Mn.prototype._removeElement=function(e,t){const 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),Tt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Mn.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Mn.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Mn.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Mn.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Mn.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Mn.prototype.viewbox=function(e){if(void 0===e&&this._cachedViewbox)return this._cachedViewbox;const t=this._viewport,n=this.getSize();let i,r,o,s,a,l,c;return e?(this._changeViewbox((function(){a=Math.min(n.width/e.width,n.height/e.height);const i=this._svg.createSVGMatrix().scale(a).translate(-e.x,-e.y);Ze(t,i)})),e):(o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},s=Ze(t),r=s?s.matrix:function(e,t,n,i,r,o){var s=qe().createSVGMatrix();switch(arguments.length){case 0:return s;case 1:return ze(s,e);case 6:return ze(s,{a:e,b:t,c:n,d:i,e:r,f:o})}}(),a=Sn(r.a,1e3),l=Sn(-r.e||0,1e3),c=Sn(-r.f||0,1e3),e=this._cachedViewbox={x:l?l/a:0,y:c?c/a:0,width:n.width/a,height:n.height/a,scale:a,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n})},Mn.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox((function(){e=z({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Dn(t,n)})),{x:n.e,y:n.f}},Mn.prototype.scrollToElement=function(e,t){let n=100;"string"==typeof e&&(e=this._elementRegistry.get(e));const i=this.findRoot(e);if(i!==this.getRootElement()&&this.setRootElement(i),i===e)return;t||(t={}),"number"==typeof t&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const r=Et(e),o=wn(r),s=this.viewbox(),a=this.zoom();let l,c;s.y+=t.top/a,s.x+=t.left/a,s.width-=(t.right+t.left)/a,s.height-=(t.bottom+t.top)/a;const p=wn(s);if(r.width=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},Mn.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let s,a,l,c,p;l=i.getCTM();const u=l.a;return t?(s=z(o,t),a=s.matrixTransform(l.inverse()),c=r.translate(a.x,a.y).scale(1/u*e).translate(-a.x,-a.y),p=l.multiply(c)):p=r.scale(e),Dn(this._viewport,p),p},Mn.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Mn.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;if(e.waypoints){n=this.getGraphics(e).getBBox()}else n=e;return{x:n.x*t.scale-t.x*t.scale,y:n.y*t.scale-t.y*t.scale,width:n.width*t.scale,height:n.height*t.scale}},Mn.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Rn="data-element-id";function Nn(e){this._elements={},this._eventBus=e}function $n(e,t,n,i){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(e){var n=this.indexOf(e);return-1!==n&&(this.splice(n,1),t.unset(e,r,i)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e,n){var o=this.indexOf(e);if(void 0===n){if(-1!==o)return;n=this.length}-1!==o&&this.splice(o,1),this.splice(n,0,e),-1===o&&t.set(e,r,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function jn(e){return!0===e.__refs_collection}Nn.$inject=["eventBus"],Nn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Te(t,Rn,i),n&&Te(n,Rn,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Nn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Te(i.gfx,Rn,""),i.secondaryGfx&&Te(i.secondaryGfx,Rn,""),delete t[n])},Nn.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)},Nn.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Te(t,Rn,i),t},Nn.prototype.get=function(e){var t;t="string"==typeof e?e:e&&Te(e,Rn);var n=this._elements[t];return n&&n.element},Nn.prototype.filter=function(e){var t=[];return this.forEach((function(n,i){e(n,i)&&t.push(n)})),t},Nn.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i in ref");t=this.props[t]}t.collection?In(this,t,e):function(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(t){if(t!==r){var o=r;r=null,o&&e.unset(o,i,n),r=t,e.set(r,i,n)}}})}(this,t,e)},Ln.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return jn(n)||In(this,t,e),n},Ln.prototype.ensureBound=function(e,t){(function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)})(e,t)||this.bind(e,t)},Ln.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Ln.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Bn=new Ln({name:"children",enumerable:!0,collection:!0},{name:"parent"}),qn=new Ln({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),zn=new Ln({name:"attachers",collection:!0},{name:"host"}),Fn=new Ln({name:"outgoing",collection:!0},{name:"source"}),Vn=new Ln({name:"incoming",collection:!0},{name:"target"});function Hn(){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)}}),Bn.bind(this,"parent"),qn.bind(this,"labels"),Fn.bind(this,"outgoing"),Vn.bind(this,"incoming")}function Un(){Hn.call(this),Bn.bind(this,"children"),zn.bind(this,"host"),zn.bind(this,"attachers")}function Wn(){Hn.call(this),Bn.bind(this,"children")}function Gn(){Un.call(this),qn.bind(this,"labelTarget")}function Qn(){Hn.call(this),Fn.bind(this,"source"),Vn.bind(this,"target")}i(Un,Hn),i(Wn,Un),i(Gn,Un),i(Qn,Hn);var Xn={connection:Qn,shape:Un,label:Gn,root:Wn};function Kn(){this._uid=12}Kn.prototype.createRoot=function(e){return this.create("root",e)},Kn.prototype.createLabel=function(e){return this.create("label",e)},Kn.prototype.createShape=function(e){return this.create("shape",e)},Kn.prototype.createConnection=function(e){return this.create("connection",e)},Kn.prototype.create=function(e,t){return(t=z({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=Xn[e];if(!n)throw new Error("unknown type: <"+e+">");return z(new n,t)}(e,t)};var Yn="__fn",Zn=Array.prototype.slice;function Jn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function ei(){}function ti(e){return e.childNodes[0]}function ni(e,t,n,i,r){var o=Fe();o.setTranslate(t,n);var s=Fe();s.setRotate(i||0,0,0);var a=Fe();a.setScale(r||1,r||1),Ze(e,[o,s,a])}function ii(e,t,n){var i=Fe();i.setTranslate(t,n),Ze(e,i)}function ri(e,t){var n=Fe();n.setRotate(t,0,0),Ze(e,n)}function oi(e,t){this._eventBus=e,this._elementRegistry=t}function si(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}Jn.prototype.on=function(e,t,n,i){if(e=h(e)?e:[e],g(t)&&(i=n,n=t,t=1e3),!m(t))throw new Error("priority must be a number");var r=n;i&&((r=q(n,i))[Yn]=n[Yn]||n);var o=this;e.forEach((function(e){o._addListener(e,{priority:t,callback:r,next:null})}))},Jn.prototype.once=function(e,t,n,i){var r=this;if(g(t)&&(i=n,n=t,t=1e3),!m(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var t=n.apply(i,arguments);return r.off(e,o),t}o[Yn]=n,this.on(e,t,o)},Jn.prototype.off=function(e,t){e=h(e)?e:[e];var n=this;e.forEach((function(e){n._removeListener(e,t)}))},Jn.prototype.createEvent=function(e){var t=new ei;return t.init(e),t},Jn.prototype.fire=function(e,t){var n,i,r,o;if(o=Zn.call(arguments),"object"==typeof e&&(e=(t=e).type),!e)throw new Error("no event type specified");if(i=this._listeners[e]){n=t instanceof ei?t:this.createEvent(t),o[0]=n;var s=n.type;e!==s&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==s&&(n.type=s)}return void 0===r&&n.defaultPrevented&&(r=!1),r}},Jn.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},Jn.prototype._destroy=function(){this._listeners={}},Jn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Jn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=function(e,t){return e.apply(null,t)}(n.callback,t),void 0!==i&&(e.returnValue=i,e.stopPropagation()),!1===i&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener",e),e}return i},Jn.prototype._addListener=function(e,t){var n,i=this._getListeners(e);if(i){for(;i;){if(i.priority or , got "+e);n=r[1],i=r[0]}return{name:e=(i?i+":":"")+n,prefix:i,localName:n}}function vi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function bi(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,_(e,q(this.registerPackage,this))}function xi(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function wi(e){this.model=e}function _i(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Ei(e){return e.replace(/^:/,"")}function Oi(e,t={}){this.properties=new wi(this),this.factory=new ui(this,this.properties),this.registry=new bi(e,this.properties),this.typeCache={},this.config=t}vi.prototype.build=function(){return V(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},vi.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)},vi.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,s=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 a=r.indexOf(e);if(-1===a)throw new Error("property <"+i.name+"> not found in property list");r.splice(a,1),this.addProperty(t,n?void 0:a,s),o[i.name]=o[i.localName]=t},vi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=yi(r[0],i),s=yi(r[1],o.prefix).name,a=this.propertiesByName[s];if(!a)throw new Error("refined property <"+s+"> not found");this.replaceProperty(a,e,n),delete e.redefines},vi.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},vi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},vi.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},vi.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},vi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},vi.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")},vi.prototype.hasProperty=function(e){return this.propertiesByName[e]},vi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(_(e.properties,q((function(n){n=z({},n,{name:n.ns.localName,inherited:t}),Object.defineProperty(n,"definedBy",{value:e});var i=n.replaces,r=n.redefines;i||r?this.redefineProperty(n,i||r,i):(n.isBody&&this.setBodyProperty(n),n.isId&&this.setIdProperty(n),this.addProperty(n))}),this)),i.push(e),n[r]=e)},bi.prototype.getPackage=function(e){return this.packageMap[e]},bi.prototype.getPackages=function(){return this.packages},bi.prototype.registerPackage=function(e){e=z({},e);var t=this.packageMap;xi(t,e,"prefix"),xi(t,e,"uri"),_(e.types,q((function(t){this.registerType(t,e)}),this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},bi.prototype.registerType=function(e,t){var n=yi((e=z({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:z(e.meta||{})})).name,t.prefix),i=n.name,r={};_(e.properties,q((function(e){var t=yi(e.name,n.prefix),i=t.name;mi(e.type)||(e.type=yi(e.type,t.prefix).name),z(e,{ns:t,name:i}),r[i]=e}),this)),z(e,{ns:n,name:i,propertiesByName:r}),_(e.extends,q((function(e){var t=yi(e,n.prefix),r=this.typeMap[t.name];r.traits=r.traits||[],r.traits.push(i)}),this)),this.definePackage(e,t),this.typeMap[i]=e},bi.prototype.mapTypes=function(e,t,n){var i=mi(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(n,i){var o=yi(n,mi(n)?"":e.prefix);r.mapTypes(o,t,i)}function s(e){return o(e,!0)}if(!i)throw new Error("unknown type <"+e.name+">");_(i.superClass,n?s:function(e){return o(e,!1)}),t(i,!n),_(i.traits,s)},bi.prototype.getEffectiveDescriptor=function(e){var t=yi(e),n=new vi(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},bi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},wi.prototype.set=function(e,t,n){if(!y(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;void 0===n?i?delete e[r]:delete e.$attrs[Ei(t)]:i?r in e?e[r]=n:_i(e,i,n):e.$attrs[Ei(t)]=n},wi.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Ei(t)];var i=n.name;return!e[i]&&n.isMany&&_i(e,n,[]),e[i]},wi.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;delete(n=z({},n,{get:function(){return i}})).value}Object.defineProperty(e,t,n)},wi.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},wi.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},wi.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(void 0!==r){const n=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw n;"undefined"!=typeof console&&console.warn(n)}return null},Oi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Oi.prototype.getType=function(e){var t=this.typeCache,n=y(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Oi.prototype.createAny=function(e,t,n){var i=yi(e),r={$type:e,$instanceOf:function(e){return e===this.$type},get:function(e){return this[e]},set:function(e,t){F(this,[e],t)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),_(n,(function(e,t){f(e)&&void 0!==e.value?r[e.name]=e.value:r[t]=e})),r},Oi.prototype.getPackage=function(e){return this.registry.getPackage(e)},Oi.prototype.getPackages=function(){return this.registry.getPackages()},Oi.prototype.getElementDescriptor=function(e){return e.$descriptor},Oi.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},Oi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Oi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Pi=String.fromCharCode,ki=Object.prototype.hasOwnProperty,Si=/(\d+);|([0-9a-f]+);|&(\w+);/gi,Ci={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function Ti(e,t,n,i){return i?ki.call(Ci,i)?Ci[i]:"&"+i+";":Pi(t||parseInt(n,16))}function Ai(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(Si,Ti):e}Object.keys(Ci).forEach((function(e){Ci[e.toUpperCase()]=Ci[e]}));var Mi="xsi:type",Di="non-whitespace outside of root node";function Ri(e){return new Error(e)}function Ni(e){return"missing namespace for prefix <"+e+">"}function $i(e){return{get:e,enumerable:!0}}function ji(e){var t,n={};for(t in e)n[t]=e[t];return n}function Ii(e){return e+"$uri"}function Li(){return{line:0,column:0}}function Bi(e){throw e}function qi(e){if(!this)return new qi(e);var t,n,i,r,o,s,a,l,c,p=e&&e.proxy,u=Bi,d=Li,h=!1,f=!1,m=null,g=!1;function y(e){e instanceof Error||(e=Ri(e)),m=e,u(e,d)}function v(e){o&&(e instanceof Error||(e=Ri(e)),o(e,d))}this.on=function(e,c){if("function"!=typeof c)throw Ri("required args ");switch(e){case"openTag":n=c;break;case"text":t=c;break;case"closeTag":i=c;break;case"error":u=c;break;case"warn":o=c;break;case"cdata":r=c;break;case"attention":l=c;break;case"question":a=c;break;case"comment":s=c;break;default:throw Ri("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw Ri("required args ");var t,n={};for(t in e)n[t]=e[t];return n["http://www.w3.org/2001/XMLSchema-instance"]="xsi",f=!0,c=n,this},this.parse=function(e){if("string"!=typeof e)throw Ri("required args ");return m=null,function(e){var o,u,m,b,x,w,_,E,O,P,k,S=f?[]:null,C=f?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[Ii(n)]=t;return i}(c):null,T=[],A=0,M=!1,D=!1,R=0,N=0,$="",j=0;function I(){if(null!==k)return k;var e,t,n,i,r,o,s,a,l,p,u,d=f&&C.xmlns,m=f&&h?[]:null,g=j,y=$,b=y.length,x={},w={};e:for(;g8)){for((p<65||p>122||p>90&&p<97)&&95!==p&&58!==p&&(v("illegal first char attribute name"),l=!0),u=g+1;u96&&p<123||p>64&&p<91||p>47&&p<59||46===p||45===p||95===p)){if(32===p||p<14&&p>8){v("missing attribute value"),g=u;continue e}if(61===p)break;v("illegal attribute name char"),l=!0}if("xmlns:xmlns"===(a=y.substring(g,u))&&(v("illegal declaration of xmlns"),l=!0),34===(p=y.charCodeAt(u+1)))-1===(u=y.indexOf('"',g=u+2))&&-1!==(u=y.indexOf("'",g))&&(v("attribute value quote missmatch"),l=!0);else if(39===p)-1===(u=y.indexOf("'",g=u+2))&&-1!==(u=y.indexOf('"',g))&&(v("attribute value quote missmatch"),l=!0);else for(v("missing attribute value quotes"),l=!0,u+=1;u8);u++);for(-1===u&&(v("missing closing quotes"),u=b,l=!0),l||(o=y.substring(g,u)),g=u;u+18);u++)g===u&&(v("illegal character after attribute end"),l=!0);if(g=u+1,!l)if(a in w)v("attribute <"+a+"> already defined");else if(w[a]=!0,f)if(h){if(null!==(r="xmlns"===a?"xmlns":120===a.charCodeAt(0)&&"xmlns:"===a.substr(0,6)?a.substr(6):null)){if(e=Ai(o),t=Ii(r),!(s=c[e])){if("xmlns"===r||t in C&&C[t]!==e)do{s="ns"+A++}while(void 0!==C[s]);else s=r;c[e]=s}C[r]!==s&&(i||(C=ji(C),i=!0),C[r]=s,"xmlns"===r&&(C[Ii(s)]=e,d=s),C[t]=e),x[a]=o;continue}m.push(a,o)}else-1!==(p=a.indexOf(":"))?(n=C[a.substring(0,p)])?((a=d===n?a.substr(p+1):n+a.substr(p))===Mi&&(-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),o=(n=C[n]||n)+o.substring(p)):o=d+":"+o),x[a]=o):v(Ni(a.substring(0,p))):x[a]=o;else x[a]=o}if(h)for(g=0,b=m.length;g=s&&(t=i.exec(e))&&!((a=t[0].length+t.index)>R);)r+=1,s=a;return-1==R?(o=a,n=e.substring(N)):0===N?n=e.substring(N,R):(o=R-s,n=-1==N?e.substring(R):e.substring(R,N+1)),{data:n,line:r,column:o}}d=L,p&&(P=Object.create({},{name:$i((function(){return E})),originalName:$i((function(){return O})),attrs:$i(I),ns:$i((function(){return C}))}));for(;-1!==N;){if(-1===(R=60===e.charCodeAt(N)?N:e.indexOf("<",N)))return T.length?y("unexpected end of file"):0===N?y("missing start tag"):void(N",R)))return y("unclosed cdata");if(r&&(r(e.substring(R+9,N),d),g))return;N+=3;continue}if(45===b&&45===e.charCodeAt(R+3)){if(-1===(N=e.indexOf("--\x3e",R)))return y("unclosed comment");if(s&&(s(e.substring(R+4,N),Ai,d),g))return;N+=3;continue}}if(63!==x){for(u=R+1;;u++){if(w=e.charCodeAt(u),isNaN(w))return N=-1,y("unclosed tag");if(34===w)u=-1!==(b=e.indexOf('"',u+1))?b:u;else if(39===w)u=-1!==(b=e.indexOf("'",u+1))?b:u;else if(62===w){N=u;break}}if(33!==x){if(k={},47===x){if(M=!1,D=!0,!T.length)return y("missing open tag");if(u=E=T.pop(),b=R+2+u.length,e.substring(R+2,b)!==u)return y("closing tag mismatch");for(;b8&&x<14))return y("close tag")}else{if(47===e.charCodeAt(N-1)?(u=E=e.substring(R+1,N-1),M=!0,D=!0):(u=E=e.substring(R+1,N),M=!0,D=!1),!(x>96&&x<123||x>64&&x<91||95===x||58===x))return y("illegal first char nodeName");for(b=1,m=u.length;b96&&x<123||x>64&&x<91||x>47&&x<59||45===x||95===x||46==x)){if(32===x||x<14&&x>8){E=u.substring(0,b),k=null;break}return y("invalid nodeName")}D||T.push(E)}if(f){if(o=C,M&&(D||S.push(o),null===k&&(h=-1!==u.indexOf("xmlns",b))&&(j=b,$=u,I(),h=!1)),O=E,-1!==(x=E.indexOf(":"))){if(!(_=C[E.substring(0,x)]))return y("missing namespace on <"+O+">");E=E.substr(x+1)}else _=C.xmlns;_&&(E=_+":"+E)}if(M&&(j=b,$=u,n&&(p?n(P,Ai,D,d):n(E,I,Ai,D,d),g)))return;if(D){if(i&&(i(p?P:E,Ai,M,d),g))return;f&&(C=M?o:S.pop())}N+=1}else{if(l&&(l(e.substring(R,N+1),Ai,d),g))return;N+=1}}else{if(-1===(N=e.indexOf("?>",R)))return y("unclosed question");if(a&&(a(e.substring(R,N+2),d),g))return;N+=2}}}(e),d=Li,g=!1,m},this.stop=function(){g=!0}}function zi(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var Fi={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Vi="xsi:type";function Hi(e){return e.xml&&e.xml.serialize}function Ui(e){return Hi(e)===Vi}function Wi(e,t){return zi(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function Gi(e){return new Error(e)}function Qi(e){return e.$descriptor}function Xi(e){z(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw Gi("expected element");var t,n=this.elementsById,i=Qi(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 Gi("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function Ki(){}function Yi(){}function Zi(){}function Ji(e,t){this.property=e,this.context=t}function er(e,t){this.element=t,this.propertyDesc=e}function tr(){}function nr(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function ir(e,t,n){nr.call(this,e,t,n)}function rr(e,t,n){this.model=e,this.context=n}function or(e){e instanceof Oi&&(e={model:e}),z(this,{lax:!1},e)}Ki.prototype.handleEnd=function(){},Ki.prototype.handleText=function(){},Ki.prototype.handleNode=function(){},Yi.prototype=Object.create(Ki.prototype),Yi.prototype.handleNode=function(){return this},Zi.prototype=Object.create(Ki.prototype),Zi.prototype.handleText=function(e){this.body=(this.body||"")+e},Ji.prototype=Object.create(Zi.prototype),Ji.prototype.handleNode=function(e){if(this.element)throw Gi("expected no sub nodes");return this.element=this.createReference(e),this},Ji.prototype.handleEnd=function(){this.element.id=this.body},Ji.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},er.prototype=Object.create(Zi.prototype),er.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=fi(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},tr.prototype=Object.create(Zi.prototype),tr.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},nr.prototype=Object.create(tr.prototype),nr.prototype.addReference=function(e){this.context.addReference(e)},nr.prototype.handleText=function(e){if(!Qi(this.element).bodyProperty)throw Gi("unexpected body text <"+e+">");Zi.prototype.handleText.call(this,e)},nr.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Qi(t).bodyProperty;n&&void 0!==e&&(e=fi(n.type,e),t.set(n.name,e))},nr.prototype.createElement=function(e){var t,n=e.attributes,i=this.type,r=Qi(i),o=this.context,s=new i({}),a=this.model;return _(n,(function(e,n){var i=r.propertiesByName[n];i&&i.isReference?i.isMany?_(e.split(" "),(function(e){o.addReference({element:s,property:i.ns.name,id:e})})):o.addReference({element:s,property:i.ns.name,id:e}):(i?e=fi(i.type,e):"xmlns"!==n&&(t=yi(n,r.ns.prefix),a.getPackage(t.prefix)&&o.addWarning({message:"unknown attribute <"+n+">",element:s,property:n,value:e})),s.set(n,e))})),s},nr.prototype.getPropertyForNode=function(e){var t,n,i=yi(e.name),r=this.type,o=this.model,s=Qi(r),a=i.name,l=s.propertiesByName[a];if(l&&!l.isAttr)return Ui(l)&&(t=e.attributes[Vi])?(t=function(e,t){var n=yi(e);return function(e,t){var n=e.name,i=e.localName,r=t.xml&&t.xml.typePrefix;return r&&0===i.indexOf(r)?e.prefix+":"+i.slice(r.length):n}(n,t.getPackage(n.prefix))}(t,o),z({},l,{effectiveType:Qi(n=o.getType(t)).name})):l;var c=o.getPackage(i.prefix);if(c){if(t=Wi(i,c),n=o.getType(t),l=b(s.properties,(function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)})),l)return z({},l,{effectiveType:Qi(n).name})}else if(l=b(s.properties,(function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type})),l)return l;throw Gi("unrecognized element <"+i.name+">")},nr.prototype.toString=function(){return"ElementDescriptor["+Qi(this.type).name+"]"},nr.prototype.valueHandler=function(e,t){return new er(e,t)},nr.prototype.referenceHandler=function(e){return new Ji(e,this.context)},nr.prototype.handler=function(e){return"Element"===e?new rr(this.model,e,this.context):new nr(this.model,e,this.context)},nr.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,gi(n=t.effectiveType||t.type))return this.valueHandler(t,i);var o=(r=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e)).element;return void 0!==o&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(z(o,{element:i}),this.context.addReference(o)):o.$parent=i),r},ir.prototype=Object.create(nr.prototype),ir.prototype.createElement=function(e){var t=e.name,n=yi(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),s=o&&Wi(n,o)||t;if(!r.hasType(s))throw Gi("unexpected element <"+e.originalName+">");return nr.prototype.createElement.call(this,e)},rr.prototype=Object.create(tr.prototype),rr.prototype.createElement=function(e){var t=e.name,n=yi(t).prefix,i=e.ns[n+"$uri"],r=e.attributes;return this.model.createAny(t,i,r)},rr.prototype.handleChild=function(e){var t=new rr(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},rr.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},or.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof nr?(i=t,t={}):"string"==typeof t?(i=this.handler(t),t={}):"string"==typeof i&&(i=this.handler(i));var r=this.model,o=this.lax,s=new Xi(z({},t,{rootHandler:i})),a=new qi({proxy:!0}),l=function(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}();function c(e,t,n){var i=t(),r=i.line,o=i.column,a=i.data;"<"===a.charAt(0)&&-1!==a.indexOf(" ")&&(a=a.slice(0,a.indexOf(" "))+">");var l="unparsable content "+(a?a+" ":"")+"detected\n\tline: "+r+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return s.addWarning({message:l,error:e}),!0;throw Gi(l)}function p(e,t){return c(e,t,!0)}i.context=s,l.push(i);var u=/^<\?xml /i,d=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function f(e,t){try{l.peek().handleText(e)}catch(e){p(e,t)}}var m=r.getPackages().reduce((function(e,t){return e[t.uri]=t.prefix,e}),{"http://www.w3.org/XML/1998/namespace":"xml"});return a.ns(m).on("openTag",(function(e,t,n,i){var r=e.attrs||{},s=Object.keys(r).reduce((function(e,n){var i=t(r[n]);return e[n]=i,e}),{});!function(e,t){var n=l.peek();try{l.push(n.handleNode(e))}catch(e){c(e,t,o)&&l.push(new Yi)}}({name:e.name,originalName:e.originalName,attributes:s,ns:e.ns},i)})).on("question",(function(e){if(u.test(e)){var t=d.exec(e),n=t&&t[1];n&&!h.test(n)&&s.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}})).on("closeTag",(function(){l.pop().handleEnd()})).on("cdata",f).on("text",(function(e,t,n){!function(e,t){e.trim()&&f(e,t)}(t(e),n)})).on("error",c).on("warn",p),new Promise((function(t,n){var r;try{a.parse(e),function(){var e,t,n=s.elementsById,i=s.references;for(e=0;t=i[e];e++){var r=t.element,o=n[t.id],a=Qi(r).propertiesByName[t.property];if(o||s.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),a.isMany){var l=r.get(a.name),c=l.indexOf(t);-1===c&&(c=l.length),o?l[c]=o:l.splice(c,1)}else r.set(a.name,o)}}()}catch(e){r=e}var o=i.element;r||o||(r=Gi("failed to parse document as <"+i.type.$descriptor.name+">"));var l=s.warnings,c=s.references,p=s.elementsById;return r?(r.warnings=l,n(r)):t({rootElement:o,elementsById:p,references:c,warnings:l})}))},or.prototype.handler=function(e){return new ir(this.model,e)};var sr=/<|>|'|"|&|\n\r|\n/g,ar=/<|>|&/g;function lr(e){var t={},n={},i={},r=[],o=[];this.byUri=function(t){return n[t]||e&&e.byUri(t)},this.add=function(e,t){n[e.uri]=e,t?r.push(e):o.push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return t[e||"xmlns"]},this.mapPrefix=function(e,n){t[e||"xmlns"]=n},this.getNSKey=function(e){return void 0!==e.prefix?e.uri+"|"+e.prefix:e.uri},this.logUsed=function(t){var n=t.uri,r=this.getNSKey(t);i[r]=this.byUri(n),e&&e.logUsed(t)},this.getUsed=function(e){var t=this;return[].concat(r,o).filter((function(e){var n=t.getNSKey(e);return i[n]}))}}function cr(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function pr(e){return y(e)?e:(e.prefix?e.prefix+":":"")+e.localName}var ur={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},dr={"<":"lt",">":"gt","&":"amp"};function hr(e,t,n){return(e=y(e)?e:""+e).replace(t,(function(e){return"&"+n[e]+";"}))}function fr(e){this.tagName=e}function mr(){}function gr(e){this.tagName=e}function yr(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function vr(e,t){yr.call(this,e,t)}function br(){this.value="",this.write=function(e){this.value+=e}}function xr(e,t){var n=[""];this.append=function(t){return e.write(t),this},this.appendNewLine=function(){return t&&e.write("\n"),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function wr(e){return e=z({format:!1,preamble:!0},e||{}),{toXML:function(t,n){var i=n||new br,r=new xr(i,e.format);if(e.preamble&&r.append('\n'),(new yr).build(t).serializeTo(r),!n)return i.value}}}function _r(e,t){Oi.call(this,e,t)}fr.prototype.build=function(e){return this.element=e,this},fr.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+""+this.tagName+">").appendNewLine()},mr.prototype.serializeValue=mr.prototype.serializeTo=function(e){e.append(this.escape?hr(this.value,ar,dr):this.value)},mr.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(ar)&&(this.escape=!0),this},cr(gr,mr),gr.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append(""+this.tagName+">").appendNewLine()},yr.prototype.build=function(e){this.element=e;var t,n,i=e.$descriptor,r=this.propertyDescriptor,o=i.isGeneric;return t=o?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=r?this.nsPropertyTagName(r):this.nsTagName(i),this.tagName=this.addTagName(this.ns),o||(n=function(e){return w(e.$descriptor.properties,(function(t){var n=t.name;if(t.isVirtual)return!1;if(!v(e,n))return!1;var i=e[n];return i!==t.default&&null!==i&&(!t.isMany||i.length)}))}(e),this.parseAttributes(w(n,(function(e){return e.isAttr}))),this.parseContainments(function(e){return w(e,(function(e){return!e.isAttr}))}(n))),this.parseGenericAttributes(e,t),this},yr.prototype.nsTagName=function(e){return function(e,t){return t.isGeneric?z({localName:t.ns.localName},e):z({localName:(n=t.ns.localName,i=t.$pkg,zi(i)?function(e){return e.charAt(0).toLowerCase()+e.slice(1)}(n):n)},e);var n,i}(this.logNamespaceUsed(e.ns),e)},yr.prototype.nsPropertyTagName=function(e){return function(e,t){return z({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},yr.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},yr.prototype.nsAttributeName=function(e){var t;if(t=y(e)?yi(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}:z({localName:t.localName},n)},yr.prototype.parseGeneric=function(e){var t=this,n=this.body,i=[];return _(e,(function(r,o){"$body"===o?n.push((new mr).build({type:"String"},r)):"$children"===o?_(r,(function(e){n.push(new yr(t).build(e))})):0!==o.indexOf("$")&&t.parseNsAttribute(e,o,r)&&i.push({name:o,value:r})})),i},yr.prototype.parseNsAttribute=function(e,t,n){var i,r=e.$model,o=yi(t);if("xmlns"===o.prefix&&(i={prefix:o.localName,uri:n}),o.prefix||"xmlns"!==o.localName||(i={uri:n}),!i)return{name:t,value:n};if(r&&r.getPackage(n))this.logNamespace(i,!0,!0);else{var s=this.logNamespaceUsed(i,!0);this.getNamespaces().logUsed(s)}},yr.prototype.parseNsAttributes=function(e,t){var n=this,i=e.$attrs,r=[];return _(i,(function(t,i){var o=n.parseNsAttribute(e,i,t);o&&r.push(o)})),r},yr.prototype.parseGenericAttributes=function(e,t){var n=this;_(t,(function(t){if(t.name!==Vi)try{n.addAttribute(n.nsAttributeName(t.name),t.value)}catch(n){console.warn("missing namespace information for ",t.name,"=",t.value,"on",e,n)}}))},yr.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;_(e,(function(e){var r=i.get(e.name),o=e.isReference;if(e.isMany||(r=[r]),e.isBody)n.push((new mr).build(e,r[0]));else if(gi(e.type))_(r,(function(i){n.push(new gr(t.addTagName(t.nsPropertyTagName(e))).build(e,i))}));else if(o)_(r,(function(i){n.push(new fr(t.addTagName(t.nsPropertyTagName(e))).build(i))}));else{var s=Ui(e),a=function(e){return"property"===Hi(e)}(e);_(r,(function(i){var r;r=s?new vr(t,e):a?new yr(t,e):new yr(t),n.push(r.build(i))}))}}))},yr.prototype.getNamespaces=function(e){var t,n=this.namespaces,i=this.parent;return n||(t=i&&i.getNamespaces(),e||!t?this.namespaces=n=new lr(t):n=t),n},yr.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix;return i.byUri(r)&&!n||i.add(e,t),i.mapPrefix(o,r),e},yr.prototype.logNamespaceUsed=function(e,t){var n,i,r,o=this.element.$model,s=this.getNamespaces(t),a=e.prefix,l=e.uri;if(!a&&!l)return{localName:e.localName};if(r=Fi[a]||o&&(o.getPackage(a)||{}).uri,!(l=l||r||s.uriByPrefix(a)))throw new Error("no namespace uri given for prefix <"+a+">");if(!(e=s.byUri(l))){for(n=a,i=1;s.uriByPrefix(n);)n=a+"_"+i++;e=this.logNamespace({prefix:n,uri:l},r===l)}return a&&s.mapPrefix(a,l),e},yr.prototype.parseAttributes=function(e){var t=this,n=this.element;_(e,(function(e){var i=n.get(e.name);if(e.isReference)if(e.isMany){var r=[];_(i,(function(e){r.push(e.id)})),i=r.join(" ")}else i=i.id;t.addAttribute(t.nsAttributeName(e),i)}))},yr.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),pr(e)},yr.prototype.addAttribute=function(e,t){var n=this.attrs;y(t)&&(t=hr(t,sr,ur));var i=x(n,(function(t){return t.name.localName===e.localName&&t.name.uri===e.uri&&t.name.prefix===e.prefix})),r={name:e,value:t};-1!==i?n.splice(i,1,r):n.push(r)},yr.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=function(e){return e.getUsed().filter((function(e){return"xml"!==e.prefix})).map((function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}}))}(n).concat(t)),_(t,(function(t){e.append(" ").append(pr(t.name)).append('="').append(t.value).append('"')}))},yr.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==mr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),_(this.body,(function(t){t.serializeTo(e)})),n&&e.unindent().appendIndent(),e.append(""+this.tagName+">")),e.appendNewLine()},cr(vr,yr),vr.prototype.parseNsAttributes=function(e){var t=yr.prototype.parseNsAttributes.call(this,e),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(Vi),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},vr.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},_r.prototype=Object.create(Oi.prototype),_r.prototype.fromXML=function(e,t,n){y(t)||(n=t,t="bpmn:Definitions");var i=new or(z({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},_r.prototype.toXML=function(e,t){var n=new wr(t);return new Promise((function(t,i){try{return t({xml:n.toXML(e)})}catch(e){return i(e)}}))};var Er={bpmn:{name:"BPMN20",uri:"http://www.omg.org/spec/BPMN/20100524/MODEL",prefix:"bpmn",associations:[],types:[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",isMany:!0,replaces:"FlowElementsContainer#laneSets",type:"LaneSet"},{name:"flowElements",isMany:!0,replaces:"FlowElementsContainer#flowElements",type:"FlowElement"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean",default:!0},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}},{name:"assignment",type:"Assignment",isMany:!0}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",isBody:!0,type:"String"}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}],superClass:["BaseElement"]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["Collaboration","FlowElementsContainer"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isMany:!0,isVirtual:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Integer",isAttr:!0}]},{name:"CallActivity",superClass:["Activity","InteractionNode"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}],superClass:["BaseElement"]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],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"}]}],xml:{tagAlias:"lowerCase",typePrefix:"t"}},bpmndi:{name:"BPMNDI",uri:"http://www.omg.org/spec/BPMN/20100524/DI",prefix:"bpmndi",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:[]},dc:{name:"DC",uri:"http://www.omg.org/spec/DD/20100524/DC",prefix:"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}]}],associations:[]},di:{name:"DI",uri:"http://www.omg.org/spec/DD/20100524/DI",prefix:"di",types:[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"}]},{name:"Extension",properties:[{name:"values",isMany:!0,type:"Element"}]}],associations:[],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:[]},color:{name:"BPMN in Color",uri:"http://www.omg.org/spec/BPMN/non-normative/color/1.0",prefix:"color",types:[{name:"ColoredLabel",extends:["bpmndi:BPMNLabel"],properties:[{name:"color",isAttr:!0,type:"String"}]},{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"background-color",isAttr:!0,type:"String"},{name:"border-color",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"border-color",isAttr:!0,type:"String"}]}],enumerations:[],associations:[]}};function Or(e,t){return new _r(z({},Er,e),t)}function Pr(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':""}function kr(e){v(e,"di")||Object.defineProperty(e,"di",{enumerable:!1,get:function(){throw new Error("Tried to access di from the businessObject. The di is available through the diagram element only. For more information, see https://github.com/bpmn-io/bpmn-js/issues/1472")}})}function Sr(e,t){return e.$instanceOf(t)}function Cr(e,t){var n={},i=[],r={};function o(e,t){return function(n){e(n,t)}}function s(e){n[e.id]=e}function a(n,i){try{var o=r[n.id]&&function(n,i){if(n.gfx)throw new Error(t("already rendered {element}",{element:Pr(n)}));return e.element(n,r[n.id],i)}(n,i);return s(n),o}catch(e){l(e.message,{element:n,error:e}),console.error(t("failed to import {element}",{element:Pr(n)})),console.error(e)}}function l(t,n){e.error(t,n)}var c=this.registerDi=function(e){var n=e.bpmnElement;n?r[n.id]?l(t("multiple DI elements defined for {element}",{element:Pr(n)}),{element:n}):(r[n.id]=e,kr(n)):l(t("no bpmnElement referenced in {element}",{element:Pr(e)}),{element:e})};function p(e){var t;t=e.plane,c(t),_(t.planeElement,u)}function u(e){c(e)}this.handleDefinitions=function(s,a){var u=s.diagrams;if(a&&-1===u.indexOf(a))throw new Error(t("diagram not part of bpmn:Definitions"));if(!a&&u&&u.length&&(a=u[0]),!a)throw new Error(t("no diagram to display"));r={},p(a);var m=a.plane;if(!m)throw new Error(t("no plane for {element}",{element:Pr(a)}));var g=m.bpmnElement;if(!g){if(g=function(e){return b(e.rootElements,(function(e){return Sr(e,"bpmn:Process")||Sr(e,"bpmn:Collaboration")}))}(s),!g)throw new Error(t("no process or collaboration to display"));l(t("correcting missing bpmnElement on {plane} to {rootElement}",{plane:Pr(m),rootElement:Pr(g)})),m.bpmnElement=g,c(m)}var y,v,E=function(t,n){return e.root(t,r[t.id],n)}(g,m);if(Sr(g,"bpmn:Process")||Sr(g,"bpmn:SubProcess"))h(g,E);else{if(!Sr(g,"bpmn:Collaboration"))throw new Error(t("unsupported bpmnElement for {plane}: {rootElement}",{plane:Pr(m),rootElement:Pr(g)}));v=E,_((y=g).participants,o(A,v)),x(y.artifacts,v),i.push((function(){!function(e,t){_(e,o(f,t))}(y.messageFlows,v)})),function(e,t){w(e,(function(e){return!n[e.id]&&Sr(e,"bpmn:Process")&&e.laneSets})).forEach(o(h,t))}(s.rootElements,E)}d(i)};var d=this.handleDeferred=function(){for(;i.length;)i.shift()()};function h(e,t){T(e,t),E(e.ioSpecification,t),x(e.artifacts,t),s(e)}function f(e,t){a(e,t)}function m(e,t){a(e,t)}function g(e,t){a(e,t)}function y(e,t){a(e,t)}function v(e,t){a(e,t)}function x(e,t){_(e,(function(e){Sr(e,"bpmn:Association")?i.push((function(){v(e,t)})):v(e,t)}))}function E(e,t){e&&(_(e.dataInputs,o(g,t)),_(e.dataOutputs,o(y,t)))}var O=this.handleSubProcess=function(e,t){T(e,t),x(e.artifacts,t)};function P(e,t){var n=a(e,t);Sr(e,"bpmn:SubProcess")&&O(e,n||t),Sr(e,"bpmn:Activity")&&E(e.ioSpecification,t),i.push((function(){_(e.dataInputAssociations,o(m,t)),_(e.dataOutputAssociations,o(m,t))}))}function k(e,t){a(e,t)}function S(e,t){i.push((function(){var n=a(e,t);e.childLaneSet&&C(e.childLaneSet,n||t),function(e){_(e.flowNodeRef,(function(t){var n=t.get("lanes");n&&n.push(e)}))}(e)}))}function C(e,t){_(e.lanes,o(S,t))}function T(e,n){!function(e,n){_(e,(function(e){Sr(e,"bpmn:SequenceFlow")?i.push((function(){!function(e,t){a(e,t)}(e,n)})):Sr(e,"bpmn:BoundaryEvent")?i.unshift((function(){P(e,n)})):Sr(e,"bpmn:FlowNode")?P(e,n):Sr(e,"bpmn:DataObject")||(Sr(e,"bpmn:DataStoreReference")||Sr(e,"bpmn:DataObjectReference")?k(e,n):l(t("unrecognized flowElement {element} in context {context}",{element:Pr(e),context:n?Pr(n.businessObject):"null"}),{element:e,context:n}))}))}(e.flowElements,n),e.laneSets&&function(e,t){_(e,o(C,t))}(e.laneSets,n)}function A(e,t){var n=a(e,t),i=e.processRef;i&&h(i,n||t)}}function Tr(e,t){var n=Mr(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function Ar(e,t){return k(t,(function(t){return Tr(e,t)}))}function Mr(e){return e&&e.businessObject||e}function Dr(e){return e&&e.di}function Rr(e,t,n){var i,r,o,s,a=[];function l(e,t){var n=new Cr({root:function(e,t){return i.add(e,t)},element:function(e,t,n){return i.add(e,t,n)},error:function(e,t){a.push({message:e,context:t})}},o);t=t||e.diagrams&&e.diagrams[0];var r=function(e,t){if(!t)return;var n,i=t.plane.bpmnElement,r=i;Tr(i,"bpmn:Process")||Tr(i,"bpmn:Collaboration")||(r=function(e){var t=e;for(;t;){if(Tr(t,"bpmn:Process"))return t;t=t.$parent}}(i));n=Tr(r,"bpmn:Collaboration")?r:b(e.rootElements,(function(e){if(Tr(e,"bpmn:Collaboration"))return b(e.participants,(function(e){return e.processRef===r}))}));var o=[r];n&&(o=S(n.participants,(function(e){return e.processRef}))).push(n);var s=Nr(o),a=[t],l=[i];return _(e.diagrams,(function(e){var t=e.plane.bpmnElement;-1!==s.indexOf(t)&&-1===l.indexOf(t)&&(a.push(e),l.push(t))})),a}(e,t);if(!r)throw new Error(o("no diagram to display"));_(r,(function(t){n.handleDefinitions(e,t)}));var l=t.plane.bpmnElement.id;s.setRootElement(s.findRoot(l+"_plane")||s.findRoot(l))}return new Promise((function(c,p){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("translate"),s=e.get("canvas"),r.fire("import.render.start",{definitions:t}),l(t,n),r.fire("import.render.complete",{error:undefined,warnings:a}),c({warnings:a})}catch(e){return e.warnings=a,p(e)}}))}function Nr(e){var t=[];return _(e,(function(e){e&&(t.push(e),t=t.concat(Nr(e.flowElements)))})),t}var $r,jr='',Ir={verticalAlign:"middle"},Lr={color:"#404040"},Br={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},qr={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},zr={position:"absolute",left:"50%",top:"40%",transform:"translate(-50%)",width:"260px",padding:"10px",background:"white",boxShadow:"0 1px 4px rgba(0,0,0,0.3)",fontFamily:"Helvetica, Arial, sans-serif",fontSize:"14px",display:"flex",lineHeight:"1.3"},Fr=''+jr+'Web-based tooling for BPMN, DMN and forms powered by bpmn.io. ';function Vr(){$r||(Z($r=be(Fr),Br),Z(we("svg",$r),Ir),Z(we(".backdrop",$r),qr),Z(we(".notice",$r),zr),Z(we(".link",$r),Lr,{margin:"15px 20px 15px 10px",alignSelf:"center"}),me.bind($r,".backdrop","click",(function(e){document.body.removeChild($r)}))),document.body.appendChild($r)}function Hr(e){e=z({},Wr,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),function(e){const t=be(''+jr+"");Z(we("svg",t),Ir),Z(t,Lr,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(t),de.bind(t,"click",(function(e){Vr(),e.preventDefault()}))}(this._container),this._init(this._container,this._moddle,e)}function Ur(e,t){return e.warnings=t,e}i(Hr,ci),Hr.prototype.importXML=async function(e,t){const n=this;let i=[];try{let o;e=this._emit("import.parse.start",{xml:e})||e;try{o=await this._moddle.fromXML(e,"bpmn:Definitions")}catch(e){throw this._emit("import.parse.complete",{error:e}),e}let s=o.rootElement;const a=o.references,l=o.warnings,c=o.elementsById;i=i.concat(l),s=this._emit("import.parse.complete",(r={error:null,definitions:s,elementsById:c,references:a,warnings:i},n.get("eventBus").createEvent(r)))||s;const p=await this.importDefinitions(s,t);return i=i.concat(p.warnings),this._emit("import.done",{error:null,warnings:i}),{warnings:i}}catch(e){let t=e;throw i=i.concat(t.warnings||[]),Ur(t,i),t=function(e){const t=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);t&&(e.message="unparsable content <"+t[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+t[2]);return e}(t),this._emit("import.done",{error:t,warnings:t.warnings}),t}var r},Hr.prototype.importDefinitions=async function(e,t){this._setDefinitions(e);return{warnings:(await this.open(t)).warnings}},Hr.prototype.open=async function(e){const t=this._definitions;let n=e;if(!t){const e=new Error("no XML imported");throw Ur(e,[]),e}if("string"==typeof e&&(n=function(e,t){if(!t)return null;return b(e.diagrams,(function(e){return e.id===t}))||null}(t,e),!n)){const t=new Error("BPMNDiagram <"+e+"> not found");throw Ur(t,[]),t}try{this.clear()}catch(e){throw Ur(e,[]),e}const{warnings:i}=await Rr(this,t,n);return{warnings:i}},Hr.prototype.saveXML=async function(e){e=e||{};let t,n,i=this._definitions;try{if(!i)throw new Error("no definitions loaded");i=this._emit("saveXML.start",{definitions:i})||i;n=(await this._moddle.toXML(i,e)).xml,n=this._emit("saveXML.serialized",{xml:n})||n}catch(e){t=e}const r=t?{error:t}:{xml:n};if(this._emit("saveXML.done",r),t)throw t;return r},Hr.prototype.saveSVG=async function(){let e,t;this._emit("saveSVG.start");try{const t=this.get("canvas"),n=t.getActiveLayer(),i=we("defs",t._svg),r=Xe(n),o=i?""+Xe(i)+"":"",s=n.getBBox();e='\n\x3c!-- created with bpmn-js / http://bpmn.io --\x3e\n\n"}catch(e){t=e}if(this._emit("saveSVG.done",{error:t,svg:e}),t)throw t;return{svg:e}},Hr.prototype._setDefinitions=function(e){this._definitions=e},Hr.prototype.getModules=function(){return this._modules},Hr.prototype.clear=function(){this.getDefinitions()&&ci.prototype.clear.call(this)},Hr.prototype.destroy=function(){ci.prototype.destroy.call(this),Ee(this._container)},Hr.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Hr.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Hr.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=we(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Hr.prototype.getDefinitions=function(){return this._definitions},Hr.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Hr.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],i,r),s=z(H(n,["additionalModules"]),{canvas:z({},n.canvas,{container:e}),modules:o});ci.call(this,s),n&&n.container&&this.attachTo(n.container)},Hr.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Hr.prototype._createContainer=function(e){const t=be('');return Z(t,{width:Gr(e.width),height:Gr(e.height),position:e.position}),t},Hr.prototype._createModdle=function(e){return new Or(z({},this._moddleExtensions,e.moddleExtensions))},Hr.prototype._modules=[];const Wr={width:"100%",height:"100%",position:"relative"};function Gr(e){return e+(m(e)?"px":"")}function Qr(e){Hr.call(this,e),this.on("import.parse.complete",(function(e){e.error||this._collectIds(e.definitions,e.elementsById)}),this),this.on("diagram.destroy",(function(){this.get("moddle").ids.clear()}),this)}function Xr(e,t){return!Tr(e,"bpmn:CallActivity")&&(Tr(e,"bpmn:SubProcess")?!(!(t=t||Dr(e))||!Tr(t,"bpmndi:BPMNPlane"))||t&&!!t.isExpanded:!Tr(e,"bpmn:Participant")||!!Mr(e).processRef)}function Kr(e){if(Tr(e,"bpmn:Participant")||Tr(e,"bpmn:Lane")){var t=Dr(e).isHorizontal;return void 0===t||t}}function Yr(e){return e&&!!Mr(e).triggeredByEvent}function Zr(e,t){return k(Mr(e).eventDefinitions,(function(e){return Tr(e,t)}))}i(Qr,Hr),Qr.prototype._createModdle=function(e){var t=Hr.prototype._createModdle.call(this,e);return t.ids=new s([32,36,1]),t},Qr.prototype._collectIds=function(e,t){var n,i=e.$model.ids;for(n in i.clear(),t)i.claim(n,t[n])};var Jr={width:90,height:20};function eo(e){return Tr(e,"bpmn:Event")||Tr(e,"bpmn:Gateway")||Tr(e,"bpmn:DataStoreReference")||Tr(e,"bpmn:DataObjectReference")||Tr(e,"bpmn:DataInput")||Tr(e,"bpmn:DataOutput")||Tr(e,"bpmn:SequenceFlow")||Tr(e,"bpmn:MessageFlow")||Tr(e,"bpmn:Group")}function to(e){return vn(e.label)}function no(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=function(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),s=r.x,a=r.y;return Math.abs(o)1?r.get("parallelMultiple")?I(t,e,n,o):j(t,e,n,o):ao(r,"bpmn:MessageEventDefinition")?S(t,e,n,o):ao(r,"bpmn:TimerEventDefinition")?C(t,e,n,o):ao(r,"bpmn:ConditionalEventDefinition")?A(t,e,n,o):ao(r,"bpmn:SignalEventDefinition")?$(t,e,n,o):ao(r,"bpmn:EscalationEventDefinition")?T(t,e,n,o):ao(r,"bpmn:LinkEventDefinition")?M(t,e,n,o):ao(r,"bpmn:ErrorEventDefinition")?D(t,e,n,o):ao(r,"bpmn:CancelEventDefinition")?R(t,e,n,o):ao(r,"bpmn:CompensateEventDefinition")?N(t,e,n,o):ao(r,"bpmn:TerminateEventDefinition")?L(t,e,n,o):null}var q={ParticipantMultiplicityMarker:function(e,t,n={}){var r=ho(t,n),o=fo(t,n);O("participant-multiplicity",e,i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:r,containerHeight:o,position:{mx:(r/2-6)/r,my:(o-15)/o}}),{strokeWidth:2,fill:lo(t,a,n.fill),stroke:co(t,l,n.stroke)})},SubProcessMarker:function(e,t,n={}){ii(b(e,14,14,0,{strokeWidth:1,fill:lo(t,a,n.fill),stroke:co(t,l,n.stroke)}),t.width/2-7.5,t.height-20),O("sub-process",e,i.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:lo(t,a,n.fill),stroke:co(t,l,n.stroke)})},ParallelMarker:function(e,t,n){var r=ho(t,n),o=fo(t,n);O("parallel",e,i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:r,containerHeight:o,position:{mx:(r/2+n.parallel)/r,my:(o-20)/o}}),{fill:lo(t,a,n.fill),stroke:co(t,l,n.stroke)})},SequentialMarker:function(e,t,n){O("sequential",e,i.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:lo(t,a,n.fill),stroke:co(t,l,n.stroke)})},CompensationMarker:function(e,t,n){O("compensation",e,i.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:lo(t,a,n.fill),stroke:co(t,l,n.stroke)})},LoopMarker:function(e,t,n){var r=ho(t,n),o=fo(t,n);O("loop",e,i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:r,containerHeight:o,position:{mx:(r/2+n.loop)/r,my:(o-7)/o}}),{strokeWidth:1.5,fill:"none",stroke:co(t,l,n.stroke),strokeMiterlimit:.5})},AdhocMarker:function(e,t,n){var r=ho(t,n),o=fo(t,n);O("adhoc",e,i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:r,containerHeight:o,position:{mx:(r/2+n.adhoc)/r,my:(o-15)/o}}),{strokeWidth:1,fill:co(t,l,n.stroke),stroke:co(t,l,n.stroke)})}};function F(e,t,n,i){q[e](t,n,i)}function V(e,t,n,i={}){i={fill:i.fill,stroke:i.stroke,width:ho(t,i),height:fo(t,i)};var r=Mr(t),o=n&&n.includes("SubProcessMarker");i=o?{...i,seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{...i,seq:-5,parallel:-6,compensation:-27,loop:0,adhoc:10},_(n,(function(n){F(n,e,t,i)})),r.get("isForCompensation")&&F("CompensationMarker",e,t,i),Tr(r,"bpmn:AdHocSubProcess")&&F("AdhocMarker",e,t,i);var s=r.get("loopCharacteristics"),a=s&&s.get("isSequential");s&&(void 0===a&&F("LoopMarker",e,t,i),!1===a&&F("ParallelMarker",e,t,i),!0===a&&F("SequentialMarker",e,t,i))}function H(e,t,n={}){n=z({size:{width:100}},n);var i=o.createText(t||"",n);return Me(i).add("djs-label"),ke(e,i),i}function U(e,t,n,i={}){var r=Mr(t),o=uo({x:t.x,y:t.y,width:t.width,height:t.height},i);return H(e,r.name,{align:n,box:o,padding:7,style:{fill:po(t,c,l,i.stroke)}})}function W(e,t,n,i={}){var r=Kr(n),o=H(e,t,{box:{height:30,width:r?fo(n,i):ho(n,i)},align:"center-middle",style:{fill:po(n,c,l,i.stroke)}});r&&ni(o,0,-(-1*fo(n,i)),270)}function G(e,t,n={}){var{width:i,height:r}=uo(t,n);return b(e,i,r,10,{...n,fill:lo(t,a,n.fill),fillOpacity:go,stroke:co(t,l,n.stroke)})}function Q(e,t,n={}){var i=Mr(t),r=lo(t,a,n.fill),o=co(t,l,n.stroke);return"One"!==i.get("associationDirection")&&"Both"!==i.get("associationDirection")||(n.markerEnd=y("association-end",r,o)),"Both"===i.get("associationDirection")&&(n.markerStart=y("association-start",r,o)),n=vo(n,["markerStart","markerEnd"]),w(e,t.waypoints,{...n,stroke:o,strokeDasharray:"0, 5"})}function X(e,t,n={}){var r=lo(t,a,n.fill),o=co(t,l,n.stroke),s=E(e,i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),{fill:r,fillOpacity:go,stroke:o});(function(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection})(Mr(t))&&E(e,i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.33,my:(t.height-18)/t.height}}),{strokeWidth:2,fill:r,stroke:o});return s}function K(e,t,n={}){return v(e,t.width,t.height,{fillOpacity:go,...n,fill:lo(t,a,n.fill),stroke:co(t,l,n.stroke)})}function Y(e,t,n={}){return function(e,t,n,i){var r=t/2,o=n/2,s=[{x:r,y:0},{x:t,y:o},{x:r,y:n},{x:0,y:o}].map((function(e){return e.x+","+e.y})).join(" ");i=d(i);var a=Le("polygon",{...i,points:s});return ke(e,a),a}(e,t.width,t.height,{fill:lo(t,a,n.fill),fillOpacity:go,stroke:co(t,l,n.stroke)})}function Z(e,t,n={}){var i=b(e,ho(t,n),fo(t,n),0,{fill:lo(t,a,n.fill),fillOpacity:n.fillOpacity||go,stroke:co(t,l,n.stroke),strokeWidth:1.5}),r=Mr(t);Tr(r,"bpmn:Lane")&&W(e,r.get("name"),t,n);return i}function J(e,t,n={}){var i=G(e,t,n);Yr(t)&&Te(i,{strokeDasharray:"0, 5.5",strokeWidth:2.5});var r=Xr(t);return U(e,t,r?"center-top":"center-middle",n),V(e,t,r?void 0:["SubProcessMarker"],n),i}function ee(e,t,n={}){var i=G(e,t,n);return U(e,t,"center-middle",n),V(e,t,void 0,n),i}var te=this.handlers={"bpmn:AdHocSubProcess":function(e,t,n={}){return J(e,t,n=Xr(t)?vo(n,["fill","stroke","width","height"]):vo(n,["fill","stroke"]))},"bpmn:Association":function(e,t,n={}){return Q(e,t,n=vo(n,["fill","stroke"]))},"bpmn:BoundaryEvent":function(e,t,n={}){var{renderIcon:i=!0}=n;n=vo(n,["fill","stroke"]);var r=Mr(t).get("cancelActivity");n={strokeWidth:1.5,fill:lo(t,a,n.fill),fillOpacity:1,stroke:co(t,l,n.stroke)},r||(n.strokeDasharray="6");var o=K(e,t,n);return v(e,t.width,t.height,3,{...n,fill:"none"}),i&&B(t,e,n),o},"bpmn:BusinessRuleTask":function(e,t,n={}){var r=ee(e,t,n=vo(n,["fill","stroke"]));return Te(E(e,i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}})),{fill:lo(t,a,n.fill),stroke:co(t,l,n.stroke),strokeWidth:1}),Te(E(e,i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}})),{fill:co(t,l,n.stroke),stroke:co(t,l,n.stroke),strokeWidth:1}),r},"bpmn:CallActivity":function(e,t,n={}){return n=vo(n,["fill","stroke"]),J(e,t,{strokeWidth:5,...n})},"bpmn:ComplexGateway":function(e,t,n={}){var r=Y(e,t,n=vo(n,["fill","stroke"]));return E(e,i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}}),{fill:co(t,l,n.stroke),stroke:co(t,l,n.stroke),strokeWidth:1}),r},"bpmn:DataInput":function(e,t,n={}){n=vo(n,["fill","stroke"]);var r=i.getRawPath("DATA_ARROW"),o=X(e,t,n);return E(e,r,{fill:"none",stroke:co(t,l,n.stroke),strokeWidth:1}),o},"bpmn:DataInputAssociation":function(e,t,n={}){return n=vo(n,["fill","stroke"]),Q(e,t,{...n,markerEnd:y("association-end",lo(t,a,n.fill),co(t,l,n.stroke))})},"bpmn:DataObject":function(e,t,n={}){return X(e,t,n=vo(n,["fill","stroke"]))},"bpmn:DataObjectReference":k("bpmn:DataObject"),"bpmn:DataOutput":function(e,t,n={}){n=vo(n,["fill","stroke"]);var r=i.getRawPath("DATA_ARROW"),o=X(e,t,n);return E(e,r,{strokeWidth:1,fill:lo(t,a,n.fill),stroke:co(t,l,n.stroke)}),o},"bpmn:DataOutputAssociation":function(e,t,n={}){return n=vo(n,["fill","stroke"]),Q(e,t,{...n,markerEnd:y("association-end",lo(t,a,n.fill),co(t,l,n.stroke))})},"bpmn:DataStoreReference":function(e,t,n={}){return n=vo(n,["fill","stroke"]),E(e,i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),{fill:lo(t,a,n.fill),fillOpacity:go,stroke:co(t,l,n.stroke),strokeWidth:2})},"bpmn:EndEvent":function(e,t,n={}){var{renderIcon:i=!0}=n;n=vo(n,["fill","stroke"]);var r=K(e,t,{...n,strokeWidth:4});return i&&B(t,e,n),r},"bpmn:EventBasedGateway":function(e,t,n={}){n=vo(n,["fill","stroke"]);var r=Mr(t),o=Y(e,t,n);v(e,t.width,t.height,.2*t.height,{fill:lo(t,"none",n.fill),stroke:co(t,l,n.stroke),strokeWidth:1});var s=r.get("eventGatewayType"),a=!!r.get("instantiate");if("Parallel"===s){var c=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}});E(e,c,{fill:"none",stroke:co(t,l,n.stroke),strokeWidth:1})}else"Exclusive"===s&&(a||v(e,t.width,t.height,.26*t.height,{fill:"none",stroke:co(t,l,n.stroke),strokeWidth:1}),function(){var r=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:t.width,containerHeight:t.height,position:{mx:.36,my:.44}});E(e,r,{fill:"none",stroke:co(t,l,n.stroke),strokeWidth:2})}());return o},"bpmn:ExclusiveGateway":function(e,t,n={}){var r=Y(e,t,n=vo(n,["fill","stroke"])),o=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return Dr(t).get("isMarkerVisible")&&E(e,o,{fill:co(t,l,n.stroke),stroke:co(t,l,n.stroke),strokeWidth:1}),r},"bpmn:Gateway":function(e,t,n={}){return Y(e,t,n=vo(n,["fill","stroke"]))},"bpmn:Group":function(e,t,n={}){return n=vo(n,["fill","stroke","width","height"]),b(e,t.width,t.height,10,{stroke:co(t,l,n.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:ho(t,n),height:fo(t,n)})},"bpmn:InclusiveGateway":function(e,t,n={}){var i=Y(e,t,n=vo(n,["fill","stroke"]));return v(e,t.width,t.height,.24*t.height,{fill:lo(t,a,n.fill),stroke:co(t,l,n.stroke),strokeWidth:2.5}),i},"bpmn:IntermediateEvent":function(e,t,n={}){var{renderIcon:i=!0}=n;n=vo(n,["fill","stroke"]);var r=K(e,t,{...n,strokeWidth:1.5});return v(e,t.width,t.height,3,{fill:"none",stroke:co(t,l,n.stroke),strokeWidth:1.5}),i&&B(t,e,n),r},"bpmn:IntermediateCatchEvent":k("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":k("bpmn:IntermediateEvent"),"bpmn:Lane":function(e,t,n={}){return n=vo(n,["fill","stroke","width","height"]),Z(e,t,{...n,fillOpacity:.25})},"bpmn:ManualTask":function(e,t,n={}){var r=ee(e,t,n=vo(n,["fill","stroke"]));return E(e,i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}}),{fill:lo(t,a,n.fill),stroke:co(t,l,n.stroke),strokeWidth:.5}),r},"bpmn:MessageFlow":function(e,t,n={}){n=vo(n,["fill","stroke"]);var r=Mr(t),o=Dr(t),s=lo(t,a,n.fill),c=co(t,l,n.stroke),p=w(e,t.waypoints,{markerEnd:y("messageflow-end",s,c),markerStart:y("messageflow-start",s,c),stroke:c,strokeDasharray:"10, 11",strokeWidth:1.5});if(r.get("messageRef")){var u=p.getPointAtLength(p.getTotalLength()/2),d=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:u.x,y:u.y}}),h={strokeWidth:1};"initiating"===o.get("messageVisibleKind")?(h.fill=s,h.stroke=c):(h.fill=c,h.stroke=s);var f=E(e,d,h),m=H(e,r.get("messageRef").get("name"),{align:"center-top",fitBox:!0,style:{fill:c}}),g=f.getBBox(),v=m.getBBox();ni(m,u.x-v.width/2,u.y+g.height/2+10,0)}return p},"bpmn:ParallelGateway":function(e,t,n={}){var r=Y(e,t,n=vo(n,["fill","stroke"]));return E(e,i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}}),{fill:co(t,l,n.stroke),stroke:co(t,l,n.stroke),strokeWidth:1}),r},"bpmn:Participant":function(e,t,n={}){var i=Z(e,t,n=vo(n,["fill","stroke","width","height"])),r=Xr(t),o=Kr(t),s=Mr(t),a=s.get("name");if(r){x(e,o?[{x:30,y:0},{x:30,y:fo(t,n)}]:[{x:0,y:30},{x:ho(t,n),y:30}],{stroke:co(t,l,n.stroke),strokeWidth:1.5}),W(e,a,t,n)}else{var p=uo(t,n);o||(p.height=ho(t,n),p.width=fo(t,n));var u=H(e,a,{box:p,align:"center-middle",style:{fill:po(t,c,l,n.stroke)}});if(!o)ni(u,0,-(-1*fo(t,n)),270)}return s.get("participantMultiplicity")&&F("ParticipantMultiplicityMarker",e,t,n),i},"bpmn:ReceiveTask":function(e,t,n={}){n=vo(n,["fill","stroke"]);var r,o=Mr(t),s=ee(e,t,n);return o.get("instantiate")?(v(e,28,28,4.4,{fill:lo(t,a,n.fill),stroke:co(t,l,n.stroke),strokeWidth:1}),r=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):r=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),E(e,r,{fill:lo(t,a,n.fill),stroke:co(t,l,n.stroke),strokeWidth:1}),s},"bpmn:ScriptTask":function(e,t,n={}){var r=ee(e,t,n=vo(n,["fill","stroke"]));return E(e,i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{fill:lo(t,a,n.fill),stroke:co(t,l,n.stroke),strokeWidth:1}),r},"bpmn:SendTask":function(e,t,n={}){var r=ee(e,t,n=vo(n,["fill","stroke"]));return E(e,i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}}),{fill:co(t,l,n.stroke),stroke:lo(t,a,n.fill),strokeWidth:1}),r},"bpmn:SequenceFlow":function(e,t,n={}){n=vo(n,["fill","stroke"]);var i=lo(t,a,n.fill),r=co(t,l,n.stroke),o=w(e,t.waypoints,{markerEnd:y("sequenceflow-end",i,r),stroke:r}),s=Mr(t),{source:c}=t;if(c){var p=Mr(c);s.get("conditionExpression")&&Tr(p,"bpmn:Activity")&&Te(o,{markerStart:y("conditional-flow-marker",i,r)}),p.get("default")&&(Tr(p,"bpmn:Gateway")||Tr(p,"bpmn:Activity"))&&p.get("default")===s&&Te(o,{markerStart:y("conditional-default-flow-marker",i,r)})}return o},"bpmn:ServiceTask":function(e,t,n={}){var r=ee(e,t,n=vo(n,["fill","stroke"]));return v(e,10,10,{fill:lo(t,a,n.fill),stroke:"none",transform:"translate(6, 6)"}),E(e,i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}}),{fill:lo(t,a,n.fill),stroke:co(t,l,n.stroke),strokeWidth:1}),v(e,10,10,{fill:lo(t,a,n.fill),stroke:"none",transform:"translate(11, 10)"}),E(e,i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{fill:lo(t,a,n.fill),stroke:co(t,l,n.stroke),strokeWidth:1}),r},"bpmn:StartEvent":function(e,t,n={}){var{renderIcon:i=!0}=n;n=vo(n,["fill","stroke"]),Mr(t).get("isInterrupting")||(n={...n,strokeDasharray:"6"});var r=K(e,t,n);return i&&B(t,e,n),r},"bpmn:SubProcess":function(e,t,n={}){return J(e,t,n=Xr(t)?vo(n,["fill","stroke","width","height"]):vo(n,["fill","stroke"]))},"bpmn:Task":function(e,t,n={}){return ee(e,t,n=vo(n,["fill","stroke"]))},"bpmn:TextAnnotation":function(e,t,n={}){n=vo(n,["fill","stroke","width","height"]);var{width:r,height:o}=uo(t,n),s=b(e,r,o,0,0,{fill:"none",stroke:"none"});return E(e,i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r,containerHeight:o,position:{mx:0,my:0}}),{stroke:co(t,l,n.stroke)}),H(e,Mr(t).get("text")||"",{align:"left-top",box:uo(t,n),padding:7,style:{fill:po(t,c,l,n.stroke)}}),s},"bpmn:Transaction":function(e,t,i={}){i=Xr(t)?vo(i,["fill","stroke","width","height"]):vo(i,["fill","stroke"]);var r=J(e,t,{strokeWidth:1.5,...i}),o=n.style(["no-fill","no-events"],{stroke:co(t,l,i.stroke),strokeWidth:1.5});return Xr(t)||(i={}),b(e,ho(t,i),fo(t,i),7,3,o),r},"bpmn:UserTask":function(e,t,n={}){var r=ee(e,t,n=vo(n,["fill","stroke"]));return E(e,i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:15,y:12}}),{fill:lo(t,a,n.fill),stroke:co(t,l,n.stroke),strokeWidth:.5}),E(e,i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{fill:lo(t,a,n.fill),stroke:co(t,l,n.stroke),strokeWidth:.5}),E(e,i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{fill:co(t,l,n.stroke),stroke:co(t,l,n.stroke),strokeWidth:.5}),r},label:function(e,t,n={}){return function(e,t,n={}){var i={width:90,height:30,x:t.width/2+t.x,y:t.height/2+t.y};return H(e,oo(t),{box:i,fitBox:!0,style:z({},o.getExternalStyle(),{fill:po(t,c,l,n.stroke)})})}(e,t,n)}};this._drawPath=E,this._renderer=P}function vo(e,t=[]){return t.reduce(((t,n)=>(e[n]&&(t[n]=e[n]),t)),{})}i(yo,ct),yo.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],yo.prototype.canRender=function(e){return Tr(e,"bpmn:BaseElement")},yo.prototype.drawShape=function(e,t,n={}){var{type:i}=t;return this._renderer(i)(e,t,n)},yo.prototype.drawConnection=function(e,t,n={}){var{type:i}=t;return this._renderer(i)(e,t,n)},yo.prototype.getShapePath=function(e){return Tr(e,"bpmn:Event")?(n=(t=e).x+t.width/2,i=t.y+t.height/2,r=t.width/2,pt([["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"]])):Tr(e,"bpmn:Activity")?function(e,t){var n=e.x,i=e.y,r=e.width,o=e.height;return pt([["M",n+t,i],["l",r-2*t,0],["a",t,t,0,0,1,t,t],["l",0,o-2*t],["a",t,t,0,0,1,-t,t],["l",2*t-r,0],["a",t,t,0,0,1,-t,-t],["l",0,2*t-o],["a",t,t,0,0,1,t,-t],["z"]])}(e,10):Tr(e,"bpmn:Gateway")?function(e){var t=e.width/2,n=e.height/2;return pt([["M",e.x+t,e.y],["l",t,n],["l",-t,n],["l",-t,-n],["z"]])}(e):function(e){var t=e.x,n=e.y,i=e.width;return pt([["M",t,n],["l",i,0],["l",0,e.height],["l",-i,0],["z"]])}(e);var t,n,i,r};var bo={width:150,height:50};function xo(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 wo(e,t,n){for(var i,r=e.shift(),o=r;;){if((i=xo(o,n)).width=o?i.width:0," "===o||""===o||i.width1)for(;n=i.shift();){if(!(n.length+oe?t.width:e}),0),m=o.top;"middle"===r.vertical&&(m+=(n.height-d)/2),m-=(a||c[0].height)/4;var g=Le("text");return Te(g,i),_(c,(function(e){var t;switch(m+=a||e.height,r.horizontal){case"left":t=o.left;break;case"right":t=(s?h:p)-o.right-e.width;break;default:t=Math.max(((s?h:p)-e.width)/2+o.left,0)}var n=Le("tspan");Te(n,{x:t,y:m}),n.textContent=e.text,ke(g,n)})),Ke(u),{dimensions:{width:h,height:d},element:g}};function ko(e){var t=z({fontFamily:"Arial, sans-serif",fontSize:12,fontWeight:"normal",lineHeight:1.2},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=z({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Po({style:t});this.getExternalLabelBounds=function(e,t){var n=r.getDimensions(t,{box:{width:90,height:30},style:i});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,n){var i=r.getDimensions(n,{box:e,style:t,align:"left-top",padding:5});return{x:e.x,y:e.y,width:e.width,height:Math.max(30,Math.round(i.height))}},this.createText=function(e,t){return r.createText(e,t||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}ko.$inject=["config.textRenderer"];var So=/\{([^{}]+)\}/g,Co=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;const To={__init__:["bpmnRenderer"],bpmnRenderer:["type",yo],textRenderer:["type",ko],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 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(e){return this.pathMap[e].d},this.getScaledPath=function(e,t){var n,i,r=this.pathMap[e];t.abspos?(n=t.abspos.x,i=t.abspos.y):(n=t.containerWidth*t.position.mx,i=t.containerHeight*t.position.my);var o,s,a={};if(t.position){for(var l=t.containerHeight/r.height*t.yScaleFactor,c=t.containerWidth/r.width*t.xScaleFactor,p=0;p=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}(n,On(p))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else{if(!Tr(t,"bpmndi:BPMNEdge"))throw new Error(s("unknown di {di} for element {semantic}",{di:Pr(t),semantic:Pr(e)}));var u=this._getSource(e),d=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Mo(e,t,{hidden:r,source:u,target:d,waypoints:Do(t,u,d)})),Tr(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}return eo(e)&&oo(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},No.prototype._attachBoundary=function(e,t){var n=this._translate,i=e.attachedToRef;if(!i)throw new Error(n("missing {semantic}#attachedToRef",{semantic:Pr(e)}));var r=this._elementRegistry.get(i.id),o=r&&r.attachers;if(!r)throw Ro(n,e,i,"attachedToRef");t.host=r,o||(r.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},No.prototype.addLabel=function(e,t,n){var i,r,o;return i=function(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Jr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=io(t),i=Jr),z({x:n.x-i.width/2,y:n.y-i.height/2},i)}(t,n),(r=oo(n))&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Mo(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!oo(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},No.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type,o=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?Ro(o,e,i,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:Pr(e),side:t}))},No.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},No.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},No.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};const $o={__depends__:[To,{__depends__:[Ao],bpmnImporter:["type",No]}]};function jo(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function Io(e){return e.originalEvent||e.srcEvent}function Lo(e){jo(e),jo(Io(e))}function Bo(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 qo(){return/mac/i.test(navigator.platform)}function zo(e,t){return(Io(e)||e).button===t}function Fo(e){return zo(e,0)}function Vo(e){var t=Io(e)||e;return!!Fo(e)&&(qo()?t.metaKey:t.ctrlKey)}function Ho(e){var t=Io(e)||e;return Fo(e)&&t.shiftKey}function Uo(e){return!0}function Wo(e){return Fo(e)||function(e){return zo(e,1)}(e)}function Go(e,t,n){var i=this;function r(n,i,r){var o,s;(function(e,t){var n=l[e]||Fo;return!n(t)})(n,i)||(r?s=t.getGraphics(r):(o=i.delegateTarget||i.target)&&(s=o,r=t.get(s)),s&&r&&!1===e.fire(n,{element:r,gfx:s,originalEvent:i})&&(i.stopPropagation(),i.preventDefault()))}var o={};function s(e){return o[e]}var a={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":Uo,"element.mousedown":Wo,"element.mouseup":Wo,"element.click":Wo,"element.dblclick":Wo};function c(e,t,n,i){var s=o[n]=function(e){r(n,e)};i&&(l[n]=i),s.$delegate=me.bind(e,"svg, .djs-element",t,s)}function p(e,t,n){var i=s(n);i&&me.unbind(e,t,i.$delegate)}e.on("canvas.destroy",(function(e){!function(e){_(a,(function(t,n){p(e,n,t)}))}(e.svg)})),e.on("canvas.init",(function(e){!function(e){_(a,(function(t,n){c(e,n,t)}))}(e.svg)})),e.on(["shape.added","connection.added"],(function(t){var n=t.element,i=t.gfx;e.fire("interactionEvents.createHit",{element:n,gfx:i})})),e.on(["shape.changed","connection.changed"],500,(function(t){var n=t.element,i=t.gfx;e.fire("interactionEvents.updateHit",{element:n,gfx:i})})),e.on("interactionEvents.createHit",500,(function(e){var t=e.element,n=e.gfx;i.createDefaultHit(t,n)})),e.on("interactionEvents.updateHit",(function(e){var t=e.element,n=e.gfx;i.updateDefaultHit(t,n)}));var u=f("djs-hit djs-hit-stroke"),d=f("djs-hit djs-hit-click-stroke"),h={all:f("djs-hit djs-hit-all"),"click-stroke":d,stroke:u,"no-move":f("djs-hit djs-hit-no-move")};function f(e,t){return t=z({stroke:"white",strokeWidth:15},t||{}),n.cls(e,["no-fill","no-border"],t)}function m(e,t){var n=h[t];if(!n)throw new Error("invalid hit type <"+t+">");return Te(e,n),e}function g(e,t){ke(e,t)}this.removeHits=function(e){_(_e(".djs-hit",e),Ke)},this.createDefaultHit=function(e,t){var n,i=e.waypoints,r=e.isFrame;return i?this.createWaypointsHit(t,i):(n=r?"stroke":"all",this.createBoxHit(t,n,{width:e.width,height:e.height}))},this.createWaypointsHit=function(e,t){var n=mt(t);return m(n,"stroke"),g(e,n),n},this.createBoxHit=function(e,t,n){n=z({x:0,y:0},n);var i=Le("rect");return m(i,t),Te(i,n),g(e,i),i},this.updateDefaultHit=function(e,t){var n=we(".djs-hit",t);if(n)return e.waypoints?gt(n,e.waypoints):Te(n,{width:e.width,height:e.height}),n},this.fire=r,this.triggerMouseEvent=function(e,t,n){var i=a[e];if(!i)throw new Error("unmapped DOM event name <"+e+">");return r(i,t,n)},this.mouseHandler=s,this.registerEvent=c,this.unregisterEvent=p}Go.$inject=["eventBus","elementRegistry","styles"];const Qo={__init__:["interactionEvents"],interactionEvents:["type",Go]};function Xo(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),i=this;function r(e){var t=Le("rect");return Te(t,z({x:0,y:0,rx:4,width:100,height:100},n)),t}e.on(["shape.added","shape.changed"],500,(function(e){var t=e.element,n=e.gfx,o=we(".djs-outline",n);o||ke(n,o=i.getOutline(t)||r()),i.updateShapeOutline(o,t)})),e.on(["connection.added","connection.changed"],(function(e){var t=e.element,n=e.gfx,o=we(".djs-outline",n);o||ke(n,o=r()),i.updateConnectionOutline(o,t)}))}Xo.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&_(i,(function(i){n=n||i.updateOutline(t,e)})),n||Te(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},Xo.prototype.updateConnectionOutline=function(e,t){var n=Et(t);Te(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},Xo.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("outline.getProviders",e,(function(e){e.providers.push(t)}))},Xo.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Xo.prototype.getOutline=function(e){var t;return _(this._getProviders(),(function(n){g(n.getOutline)&&(t=t||n.getOutline(e))})),t},Xo.$inject=["eventBus","styles","elementRegistry"];const Ko={__init__:["outline"],outline:["type",Xo]};function Yo(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],(function(e){var t=e.element;n.deselect(t)})),e.on(["diagram.clear","root.set"],(function(e){n.select(null)}))}Yo.$inject=["eventBus","canvas"],Yo.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})}},Yo.prototype.get=function(){return this._selectedElements},Yo.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},Yo.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();h(e)||(e=e?[e]:[]);var r=this._canvas,o=r.getRootElement();e=e.filter((function(e){var t=r.findRoot(e);return o===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 Zo="hover",Jo="selected";function es(e,t,n){this._canvas=e;var i=this;function r(t,n){e.addMarker(t,n)}function o(t,n){e.removeMarker(t,n)}this._multiSelectionBox=null,t.on("element.hover",(function(e){r(e.element,Zo)})),t.on("element.out",(function(e){o(e.element,Zo)})),t.on("selection.changed",(function(e){var t=e.oldSelection,n=e.newSelection;_(t,(function(e){-1===n.indexOf(e)&&function(e){o(e,Jo)}(e)})),_(n,(function(e){-1===t.indexOf(e)&&function(e){r(e,Jo)}(e)})),i._updateSelectionOutline(n)})),t.on("element.changed",(function(e){n.isSelected(e.element)&&i._updateSelectionOutline(n.get())}))}function ts(e,t,n,i){e.on("create.end",500,(function(e){var n=e.context,i=n.canExecute,r=n.elements,o=(n.hints||{}).autoSelect;if(i){if(!1===o)return;h(o)?t.select(o):t.select(r.filter(ns))}})),e.on("connect.end",500,(function(e){var n=e.context.connection;n&&t.select(n)})),e.on("shape.move.end",500,(function(e){var n=e.previousSelection||[],r=i.get(e.context.shape.id);b(n,(function(e){return r.id===e.id}))||t.select(r)})),e.on("element.click",(function(e){if(Fo(e)){var i=e.element;i===n.getRootElement()&&(i=null);var r=t.isSelected(i),o=t.get().length>1,s=Vo(e)||Ho(e);if(r&&o)return s?t.deselect(i):t.select(i);r?t.deselect(i):t.select(i,s)}}))}function ns(e){return!e.hidden}es.$inject=["canvas","eventBus","selection"],es.prototype._updateSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Re(t);var n=e.length>1;if(Me(this._canvas.getContainer())[n?"add":"remove"]("djs-multi-select"),n){var i=function(e){return{x:e.x-6,y:e.y-6,width:e.width+12,height:e.height+12}}(Et(e)),r=Le("rect");Te(r,z({rx:3},i)),Me(r).add("djs-selection-outline"),ke(t,r)}},ts.$inject=["eventBus","selection","canvas","elementRegistry"];const is={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Qo,Ko],selection:["type",Yo],selectionVisuals:["type",es],selectionBehavior:["type",ts]};function rs(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}rs.prototype.next=function(){return this._prefix+ ++this._counter};var os=new rs("ov");function ss(e,t,n,i){var r,o;this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=os,this._overlayDefaults=z({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=(r=n.getContainer(),Z(o=be(''),{position:"absolute",width:0,height:0}),r.insertBefore(o,r.firstChild),o),this._init()}function as(e,t,n){Z(e,{left:t+"px",top:n+"px"})}function ls(e,t){e.style.display=!1===t?"none":""}function cs(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach((function(n){e.style[n+"transform"]=t}))}ss.$inject=["config.overlays","eventBus","canvas","elementRegistry"],ss.prototype.get=function(e){if(y(e)&&(e={id:e}),y(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?w(t.overlays,N({type:e.type})):t.overlays.slice():[]}return e.type?w(this._overlays,N({type:e.type})):e.id?this._overlays[e.id]:null},ss.prototype.add=function(e,t,n){if(f(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=z({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},ss.prototype.remove=function(e){var t=this.get(e)||[];h(t)||(t=[t]);var n=this;_(t,(function(e){var t=n._getOverlayContainer(e.element,!0);if(e&&(Ee(e.html),Ee(e.htmlContainer),delete e.htmlContainer,delete e.element,delete n._overlays[e.id]),t){var i=t.overlays.indexOf(e);-1!==i&&t.overlays.splice(i,1)}}))},ss.prototype.isShown=function(){return"none"!==this._overlayRoot.style.display},ss.prototype.show=function(){ls(this._overlayRoot)},ss.prototype.hide=function(){ls(this._overlayRoot,!1)},ss.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ie(this._overlayRoot)},ss.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Et(t);i=o.x,r=o.y}as(n,i,r),J(e.html,"data-container-id",t.id)},ss.prototype._updateOverlay=function(e){var t,n,i=e.position,r=e.htmlContainer,o=e.element,s=i.left,a=i.top;void 0!==i.right&&(t=o.waypoints?Et(o).width:o.width,s=-1*i.right+t);void 0!==i.bottom&&(n=o.waypoints?Et(o).height:o.height,a=-1*i.bottom+n);as(r,s||0,a||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},ss.prototype._createOverlayContainer=function(e){var t=be('');Z(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},ss.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";cs(this._overlayRoot,n)},ss.prototype._getOverlayContainer=function(e,t){var n=b(this._overlayContainers,(function(t){return t.element===e}));return n||t?n:this._createOverlayContainer(e)},ss.prototype._addOverlay=function(e){var t,n,i=e.id,r=e.element,o=e.html;o.get&&o.constructor.prototype.jquery&&(o=o.get(0)),y(o)&&(o=be(o)),n=this._getOverlayContainer(r),Z(t=be(''),{position:"absolute"}),t.appendChild(o),e.type&&te(t).add("djs-overlay-"+e.type),ls(t,this._canvas.findRoot(r)===this._canvas.getRootElement()),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[i]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},ss.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,s=e.htmlContainer,a=!0;(i!==this._canvas.getRootElement()||n&&(u(r)&&r>t.scale||u(o)&&o
i&&(r=(1/t.scale||1)*i)),u(r)&&(a="scale("+r+","+r+")"),cs(s,a)},ss.prototype._updateOverlaysVisibilty=function(e){var t=this;_(this._overlays,(function(n){t._updateOverlayVisibilty(n,e)}))},ss.prototype._init=function(){var e=this._eventBus,t=this;e.on("canvas.viewbox.changing",(function(e){t.hide()})),e.on("canvas.viewbox.changed",(function(e){var n;n=e.viewbox,t._updateRoot(n),t._updateOverlaysVisibilty(n),t.show()})),e.on(["shape.remove","connection.remove"],(function(e){var n=e.element;_(t.get({element:n}),(function(e){t.remove(e.id)}));var i=t._getOverlayContainer(n);if(i){Ee(i.html);var r=t._overlayContainers.indexOf(i);-1!==r&&t._overlayContainers.splice(r,1)}})),e.on("element.changed",500,(function(e){var n=e.element,i=t._getOverlayContainer(n,!0);i&&(_(i.overlays,(function(e){t._updateOverlay(e)})),t._updateOverlayContainer(i))})),e.on("element.marker.update",(function(e){var n=t._getOverlayContainer(e.element,!0);n&&te(n.html)[e.add?"add":"remove"](e.marker)})),e.on("root.set",(function(){t._updateOverlaysVisibilty(t._canvas.viewbox())})),e.on("diagram.clear",this.clear,this)};const ps={__init__:["overlays"],overlays:["type",ss]};function us(e,t,n,i){e.on("element.changed",(function(i){var r=i.element;(r.parent||r===t.getRootElement())&&(i.gfx=n.getGraphics(r)),i.gfx&&e.fire(Ot(r)+".changed",i)})),e.on("elements.changed",(function(t){var n=t.elements;n.forEach((function(t){e.fire("element.changed",{element:t})})),i.updateContainments(n)})),e.on("shape.changed",(function(e){i.update("shape",e.element,e.gfx)})),e.on("connection.changed",(function(e){i.update("connection",e.element,e.gfx)}))}us.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const ds={__init__:["changeSupport"],changeSupport:["type",us]};function hs(e){this._eventBus=e}function fs(e){return function(t,n,i,r,o){(g(t)||m(t))&&(o=r,r=i,i=n,n=t,t=null),this.on(t,e,n,i,r,o)}}function ms(e,t){t.invoke(hs,this),this.executed((function(t){var n=t.context;n.rootElement?e.setRootElement(n.rootElement):n.rootElement=e.getRootElement()})),this.revert((function(t){var n=t.context;n.rootElement&&e.setRootElement(n.rootElement)}))}hs.$inject=["eventBus"],hs.prototype.on=function(e,t,n,i,r,o){if((g(t)||m(t))&&(o=r,r=i,i=n,n=t,t=null),g(n)&&(o=r,r=i,i=n,n=1e3),f(r)&&(o=r,r=!1),!g(i))throw new Error("handlerFn must be a function");h(e)||(e=[e]);var s=this._eventBus;_(e,(function(e){var a=["commandStack",e,t].filter((function(e){return e})).join(".");s.on(a,n,r?function(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}(i,o):i,o)}))},hs.prototype.canExecute=fs("canExecute"),hs.prototype.preExecute=fs("preExecute"),hs.prototype.preExecuted=fs("preExecuted"),hs.prototype.execute=fs("execute"),hs.prototype.executed=fs("executed"),hs.prototype.postExecute=fs("postExecute"),hs.prototype.postExecuted=fs("postExecuted"),hs.prototype.revert=fs("revert"),hs.prototype.reverted=fs("reverted"),i(ms,hs),ms.$inject=["canvas","injector"];const gs={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",ms]};function ys(e){return CSS.escape(e)}var vs={"&":"&","<":"<",">":">",'"':""","'":"'"};function bs(e){return(e=""+e)&&e.replace(/[&<>"']/g,(function(e){return vs[e]}))}var xs="_plane";function ws(e){return function(e){return e.replace(new RegExp(xs+"$"),"")}(e.id)}function _s(e){var t=e.id;return Tr(e,"bpmn:SubProcess")?Ps(t):t}function Es(e){return Ps(e)}function Os(e){return Tr(Dr(e),"bpmndi:BPMNPlane")}function Ps(e){return e+xs}function ks(e,t,n){var i=be(''),r=n.getContainer(),o=te(r);r.appendChild(i);var s=[];function a(e){e&&(s=function(e){for(var t=Mr(e),n=[],i=t;i;i=i.$parent)(Tr(i,"bpmn:SubProcess")||Tr(i,"bpmn:Process"))&&n.push(i);return n.reverse()}(e));var r=s.map((function(e){var i=bs(e.name||e.id),r=be(''+i+""),o=n.findRoot(_s(e))||n.findRoot(e.id);if(!o&&Tr(e,"bpmn:Process")){var s=t.find((function(t){var n=Mr(t);return n&&n.get("processRef")&&n.get("processRef")===e}));o=n.findRoot(s.id)}return r.addEventListener("click",(function(){n.setRootElement(o)})),r}));i.innerHTML="";var a=r.length>1;o.toggle("bjs-breadcrumbs-shown",a),r.forEach((function(e){i.appendChild(e)}))}e.on("element.changed",(function(e){var t=Mr(e.element);b(s,(function(e){return e===t}))&&a()})),e.on("root.set",(function(e){a(e.element)}))}function Ss(e,t){var n=null,i=new Cs;e.on("root.set",(function(e){var r=e.element,o=t.viewbox(),s=i.get(r);if(i.set(n,{x:o.x,y:o.y,zoom:o.scale}),n=r,!Tr(r,"bpmn:Collaboration")||s){s=s||{x:0,y:0,zoom:1};var a=(o.x-s.x)*o.scale,l=(o.y-s.y)*o.scale;0===a&&0===l||t.scroll({dx:a,dy:l}),s.zoom!==o.scale&&t.zoom(s.zoom,{x:0,y:0})}})),e.on("diagram.clear",(function(){i.clear(),n=null}))}function Cs(){this._entries=[],this.set=function(e,t){var n=!1;for(var i in this._entries)if(this._entries[i][0]===e){this._entries[i][1]=t,n=!0;break}n||this._entries.push([e,t])},this.get=function(e){for(var t in this._entries)if(this._entries[t][0]===e)return this._entries[t][1];return null},this.clear=function(){this._entries.length=0},this.remove=function(e){var t=-1;for(var n in this._entries)if(this._entries[n][0]===e){t=n;break}-1!==t&&this._entries.splice(t,1)}}ks.$inject=["eventBus","elementRegistry","canvas"],Ss.$inject=["eventBus","canvas"];var Ts=180,As=160;function Ms(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,(function(e,t){n._handleImport(t.definitions)}))}function Ds(e){return Tr(e,"bpmndi:BPMNDiagram")?e:Ds(e.$parent)}Ms.prototype._handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach((function(e){e.plane&&e.plane.bpmnElement&&(t._processToDiagramMap[e.plane.bpmnElement.id]=e)}));var n=[];e.diagrams.forEach((function(e){var i=t._createNewDiagrams(e.plane);Array.prototype.push.apply(n,i)})),n.forEach((function(e){t._movePlaneElementsToOrigin(e.plane)}))}},Ms.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach((function(t){var r=t.bpmnElement;if(r){var o=r.$parent;Tr(r,"bpmn:SubProcess")&&!t.isExpanded&&n.push(r),function(e,t){var n=e.$parent;if(!Tr(n,"bpmn:SubProcess")||n===t.bpmnElement)return!1;if(Ar(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))return!1;return!0}(r,e)&&i.push({diElement:t,parent:o})}}));var r=[];return n.forEach((function(e){if(!t._processToDiagramMap[e.id]){var n=t._createDiagram(e);t._processToDiagramMap[e.id]=n,r.push(n)}})),i.forEach((function(e){for(var i=e.diElement,r=e.parent;r&&-1===n.indexOf(r);)r=r.$parent;if(r){var o=t._processToDiagramMap[r.id];t._moveToDiPlane(i,o.plane)}})),r},Ms.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=function(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach((function(e){if(e.bounds){var n=wn(e.bounds);t.top=Math.min(n.top,t.top),t.left=Math.min(n.left,t.left)}})),_n(t)}(e),i=n.x-Ts,r=n.y-As;t.forEach((function(e){e.waypoint?e.waypoint.forEach((function(e){e.x=e.x-i,e.y=e.y-r})):e.bounds&&(e.bounds.x=e.bounds.x-i,e.bounds.y=e.bounds.y-r)}))},Ms.prototype._moveToDiPlane=function(e,t){var n=Ds(e).plane.get("planeElement");n.splice(n.indexOf(e),1),t.get("planeElement").push(e)},Ms.prototype._createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n},Ms.$inject=["eventBus","moddle"];var Rs=250;function Ns(e,t,n,i){hs.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i;var r=this;this.executed("shape.toggleCollapse",Rs,(function(e){var t=e.shape;r._canDrillDown(t)?r._addOverlay(t):r._removeOverlay(t)}),!0),this.reverted("shape.toggleCollapse",Rs,(function(e){var t=e.shape;r._canDrillDown(t)?r._addOverlay(t):r._removeOverlay(t)}),!0),this.executed(["shape.create","shape.move","shape.delete"],Rs,(function(e){var t=e.oldParent,n=e.newParent||e.parent,i=e.shape;r._canDrillDown(i)&&r._addOverlay(i),r._updateDrilldownOverlay(t),r._updateDrilldownOverlay(n),r._updateDrilldownOverlay(i)}),!0),this.reverted(["shape.create","shape.move","shape.delete"],Rs,(function(e){var t=e.oldParent,n=e.newParent||e.parent,i=e.shape;r._canDrillDown(i)&&r._addOverlay(i),r._updateDrilldownOverlay(t),r._updateDrilldownOverlay(n),r._updateDrilldownOverlay(i)}),!0),t.on("import.render.complete",(function(){n.filter((function(e){return r._canDrillDown(e)})).map((function(e){r._addOverlay(e)}))}))}i(Ns,hs),Ns.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Ns.prototype._canDrillDown=function(e){var t=this._canvas;return Tr(e,"bpmn:SubProcess")&&t.findRoot(_s(e))},Ns.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Mr(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;te(i.html).toggle("bjs-drilldown-empty",!r)}},Ns.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays;n.get({element:e,type:"drilldown"}).length&&this._removeOverlay(e);var i=be('');i.addEventListener("click",(function(){t.setRootElement(t.findRoot(_s(e)))})),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:i}),this._updateOverlayVisibility(e)},Ns.prototype._removeOverlay=function(e){this._overlays.remove({element:e,type:"drilldown"})},Ns.$inject=["canvas","eventBus","elementRegistry","overlays"];const $s={__depends__:[ps,ds,gs],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",ks],drilldownCentering:["type",Ss],drilldownOverlayBehavior:["type",Ns],subprocessCompatibility:["type",Ms]};function js(e){Hr.call(this,e)}i(js,Hr),js.prototype._modules=[$o,Ao,is,ps,$s],js.prototype._moddleExtensions={};var Is=["c","C"],Ls=["v","V"],Bs=["y","Y"],qs=["z","Z"];function zs(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Fs(e,t){return-1!==(e=h(e)?e:[e]).indexOf(t.key)||-1!==e.indexOf(t.code)}function Vs(e){return e.shiftKey}var Hs="keyboard.keydown",Us="input-handle-modified-keys";function Ws(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()}))}Ws.$inject=["config.keyboard","eventBus"],Ws.prototype._keydownHandler=function(e){this._keyHandler(e,Hs)},Ws.prototype._keyupHandler=function(e){this._keyHandler(e,"keyboard.keyup")},Ws.prototype._keyHandler=function(e,t){if(!this._isEventIgnored(e)){var n={keyEvent:e};this._eventBus.fire(t||Hs,n)&&e.preventDefault()}},Ws.prototype._isEventIgnored=function(e){return!!e.defaultPrevented||(t=e.target)&&(xe(t,"input, textarea")||"true"===t.contentEditable)&&this._isModifiedKeyIgnored(e);var t},Ws.prototype._isModifiedKeyIgnored=function(e){return!zs(e)||-1===this._getAllowedModifiers(e.target).indexOf(e.key)},Ws.prototype._getAllowedModifiers=function(e){var t=re(e,"["+Us+"]",!0);return!t||this._node&&!this._node.contains(t)?[]:t.getAttribute(Us).split(",")},Ws.prototype.bind=function(e){this.unbind(),this._node=e,de.bind(e,"keydown",this._keydownHandler),de.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Ws.prototype.getBinding=function(){return this._node},Ws.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),de.unbind(e,"keydown",this._keydownHandler),de.unbind(e,"keyup",this._keyupHandler)),this._node=null},Ws.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Ws.prototype.addListener=function(e,t,n){g(e)&&(n=t,t=e,e=1e3),this._eventBus.on(n||Hs,e,t)},Ws.prototype.removeListener=function(e,t){this._eventBus.off(t||Hs,e)},Ws.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},Ws.prototype.isCmd=zs,Ws.prototype.isShift=Vs,Ws.prototype.isKey=Fs;function Gs(e,t){var n=this;e.on("editorActions.init",500,(function(e){var i=e.editorActions;n.registerBindings(t,i)}))}Gs.$inject=["eventBus","keyboard"],Gs.prototype.registerBindings=function(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}n("undo",(function(e){if(function(e){return zs(e)&&!Vs(e)&&Fs(qs,e)}(e.keyEvent))return t.trigger("undo"),!0})),n("redo",(function(e){if(function(e){return zs(e)&&(Fs(Bs,e)||Fs(qs,e)&&Vs(e))}(e.keyEvent))return t.trigger("redo"),!0})),n("copy",(function(e){if(function(e){return zs(e)&&Fs(Is,e)}(e.keyEvent))return t.trigger("copy"),!0})),n("paste",(function(e){if(function(e){return zs(e)&&Fs(Ls,e)}(e.keyEvent))return t.trigger("paste"),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(Fs(["+","Add","="],n)&&zs(n))return t.trigger("stepZoom",{value:1}),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(Fs(["-","Subtract"],n)&&zs(n))return t.trigger("stepZoom",{value:-1}),!0})),n("zoom",(function(e){var n=e.keyEvent;if(Fs("0",n)&&zs(n))return t.trigger("zoom",{value:1}),!0})),n("removeSelection",(function(e){if(Fs(["Backspace","Delete","Del"],e.keyEvent))return t.trigger("removeSelection"),!0}))};const Qs={__init__:["keyboard","keyboardBindings"],keyboard:["type",Ws],keyboardBindings:["type",Gs]};var Xs={moveSpeed:50,moveSpeedAccelerated:200};function Ks(e,t,n){var i=this;this._config=z({},Xs,e||{}),t.addListener((function(e){var n=e.keyEvent,r=i._config;if(!t.isCmd(n))return;if(t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],n)){var o,s=t.isShift(n)?r.moveSpeedAccelerated:r.moveSpeed;switch(n.key){case"ArrowLeft":case"Left":o="left";break;case"ArrowUp":case"Up":o="up";break;case"ArrowRight":case"Right":o="right";break;case"ArrowDown":case"Down":o="down"}return i.moveCanvas({speed:s,direction:o}),!0}})),this.moveCanvas=function(e){var t=0,i=0,r=e.speed/Math.min(Math.sqrt(n.viewbox().scale),1);switch(e.direction){case"left":t=r;break;case"up":i=r;break;case"right":t=-r;break;case"down":i=-r}n.scroll({dx:t,dy:i})}}Ks.$inject=["config.keyboardMove","keyboard","canvas"];const Ys={__depends__:[Qs],__init__:["keyboardMove"],keyboardMove:["type",Ks]};var Zs=/^djs-cursor-.*$/;function Js(e){var t=te(document.body);t.removeMatching(Zs),e&&t.add("djs-cursor-"+e)}function ea(){Js(null)}function ta(e,t){function n(){return!1}return t=t||"element.click",e.once(t,5e3,n),function(){e.off(t,n)}}function na(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ia(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ra(e,t){var n;function i(i){var r,o=n.start,s=n.button,a=Bo(i),l=ia(a,o);(!n.dragging&&(r=l,Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2))>15)&&(n.dragging=!0,0===s&&ta(e),Js("grab")),n.dragging)&&(l=ia(a,n.last||n.start),t.scroll({dx:l.x,dy:l.y}),n.last=a);i.preventDefault()}function r(e){de.unbind(document,"mousemove",i),de.unbind(document,"mouseup",r),n=null,ea()}e.on("element.mousedown",500,(function(e){return function(e){if(re(e.target,".djs-draggable"))return;var t=e.button;if(t>=2||e.ctrlKey||e.shiftKey||e.altKey)return;return n={button:t,start:Bo(e)},de.bind(document,"mousemove",i),de.bind(document,"mouseup",r),!0}(e.originalEvent)})),this.isActive=function(){return!!n}}ra.$inject=["eventBus","canvas"];const oa={__init__:["moveCanvas"],moveCanvas:["type",ra]};function sa(e){return Math.log(e)/Math.log(10)}function aa(e,t){var n=sa(e.min),i=sa(e.max);return(Math.abs(n)+Math.abs(i))/t}var la=Math.sign||function(e){return e>=0?1:-1},ca={min:.2,max:4};function pa(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=q(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||.75;var i=this;t.on("canvas.init",(function(t){i._init(!1!==e.enabled)}))}pa.$inject=["config.zoomScroll","eventBus","canvas"],pa.prototype.scroll=function(e){this._canvas.scroll(e)},pa.prototype.reset=function(){this._canvas.zoom("fit-viewport")},pa.prototype.zoom=function(e,t){var n=aa(ca,20);this._totalDelta+=e,Math.abs(this._totalDelta)>.1&&(this._zoom(e,t,n),this._totalDelta=0)},pa.prototype._handleWheel=function(e){if(!re(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,i=e.ctrlKey||qo()&&e.metaKey,r=e.shiftKey,o=-1*this._scale;if(o*=i?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,i){var s=t.getBoundingClientRect(),a={x:e.clientX-s.left,y:e.clientY-s.top};n=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*la(e.deltaY)*o,this.zoom(n,a)}else n=r?{dx:o*e.deltaY,dy:0}:{dx:o*e.deltaX,dy:o*e.deltaY},this.scroll(n)}},pa.prototype.stepZoom=function(e,t){var n=aa(ca,10);this._zoom(e,t,n)},pa.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=sa(i.zoom()),s=Math.round(o/n)*n;s+=n*r;var a=Math.pow(10,s);i.zoom(function(e,t){return Math.max(e.min,Math.min(e.max,t))}(ca,a),t)},pa.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return void 0===e&&(e=!i),i!==e&&de[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},pa.prototype._init=function(e){this.toggle(e)};const ua={__init__:["zoomScroll"],zoomScroll:["type",pa]};function da(e){js.call(this,e)}i(da,js),da.prototype._navigationModules=[Ys,oa,ua],da.prototype._modules=[].concat(js.prototype._modules,da.prototype._navigationModules);var ha=n(168),fa=n.n(ha),ma=["mousedown","mouseup","mouseover","mouseout","click","dblclick"];function ga(e,t){return t.get(e,!1)}function ya(e){e.preventDefault(),"function"==typeof e.stopPropagation?e.stopPropagation():e.srcEvent&&"function"==typeof e.srcEvent.stopPropagation&&e.srcEvent.stopPropagation(),"function"==typeof e.stopImmediatePropagation&&e.stopImmediatePropagation()}function va(e){function t(t){setTimeout((function(){_(ma,(function(t){de.unbind(e,t,ya,!0)}))}),500)}de.bind(e,"touchstart",(function(t){_(ma,(function(t){de.bind(e,t,ya,!0)}))}),!0),de.bind(e,"touchend",t,!0),de.bind(e,"touchcancel",t,!0);var n=new(fa().Manager)(e,{inputClass:fa().TouchInput,recognizers:[],domEvents:!0}),i=new(fa().Tap),r=new(fa().Pan)({threshold:10}),o=new(fa().Press),s=new(fa().Pinch),a=new(fa().Tap)({event:"doubletap",taps:2});return s.requireFailure(r),s.requireFailure(o),n.add([r,o,s,a,i]),n.reset=function(e){var t=this.recognizers,i=this.session;i.stopped||(n.stop(e),setTimeout((function(){var e,n;for(e=0;n=t[e];e++)n.reset(),n.state=8;i.curRecognizer=null}),0))},n.on("hammer.input",(function(e){e.srcEvent.defaultPrevented&&n.reset(!0)})),n}function ba(e,t,n,i,r){var o,s=ga("dragging",e),a=ga("move",e),l=ga("contextPad",e),c=ga("palette",e);function p(e,t){return function(n){var o=u(n.target),s=o&&i.get(o);return t&&(n.srcEvent.button=t),r.fire(e,n,s)}}function u(e){return re(e,"svg, .djs-element",!0)}function d(e){function n(e){var n=u(e.target),r=n&&i.get(n);if(a&&t.getRootElement()!==r)return a.start(e,r,!0);!function(){var e=0,n=0;function i(i){var r=i.deltaX-e,o=i.deltaY-n;t.scroll({dx:r,dy:o}),e=i.deltaX,n=i.deltaY}function r(e){o.off("panmove",i),o.off("panend",r),o.off("pancancel",r)}o.on("panmove",i),o.on("panend",r),o.on("pancancel",r)}()}(o=va(e)).on("tap",p("element.click")),o.on("doubletap",p("element.dblclick",1)),o.on("panstart",n),o.on("press",n),o.on("pinchstart",(function(e){var n=t.zoom(),i=e.center;function r(e){var r=1-(1-e.scale)/1.5,o=Math.max(.2,Math.min(4,r*n));t.zoom(o,i),ya(e)}function s(e){o.off("pinchmove",r),o.off("pinchend",s),o.off("pinchcancel",s),o.reset(!0)}o.on("pinchmove",r),o.on("pinchend",s),o.on("pinchcancel",s)}))}s&&n.on("drag.move",(function(e){var t=e.originalEvent;if(t&&!(t instanceof MouseEvent)){var n=Bo(t),r=u(document.elementFromPoint(n.x,n.y)),o=r&&i.get(r);o!==e.hover&&(e.hover&&s.out(e),o&&(s.hover({element:o,gfx:r}),e.hover=o,e.hoverGfx=r))}})),l&&n.on("contextPad.create",(function(e){var t=va(e.pad.html);t.on("panstart",(function(e){l.trigger("dragstart",e,!0)})),t.on("press",(function(e){l.trigger("dragstart",e,!0)})),t.on("tap",(function(e){l.trigger("click",e)}))})),c&&n.on("palette.create",(function(e){var t=va(e.container);t.on("panstart",(function(e){c.trigger("dragstart",e,!0)})),t.on("press",(function(e){c.trigger("dragstart",e,!0)})),t.on("tap",(function(e){c.trigger("click",e)}))})),n.on("canvas.init",(function(e){d(e.svg)}))}function xa(e){var t=this;e.on("canvas.init",(function(e){t.addBBoxMarker(e.svg)}))}ba.$inject=["injector","canvas","eventBus","elementRegistry","interactionEvents","touchFix"],xa.$inject=["eventBus"],xa.prototype.addBBoxMarker=function(e){var t={fill:"none",class:"outer-bound-marker"},n=Le("rect");Te(n,{x:-1e4,y:1e4,width:10,height:10}),Te(n,t),ke(e,n);var i=Le("rect");Te(i,{x:1e4,y:1e4,width:10,height:10}),Te(i,t),ke(e,i)};const wa={__depends__:[{__depends__:[Qo],__init__:["touchInteractionEvents"],touchInteractionEvents:["type",ba],touchFix:["type",xa]}]};function _a(e){return e&&e[e.length-1]}function Ea(e){return e.y}function Oa(e){return e.x}var Pa={left:Oa,center:Oa,right:function(e){return e.x+e.width},top:Ea,middle:Ea,bottom:function(e){return e.y+e.height}};function ka(e,t){this._modeling=e,this._rules=t}ka.$inject=["modeling","rules"],ka.prototype._getOrientationDetails=function(e){var t="x",n="width";return-1!==["top","bottom","middle"].indexOf(e)&&(t="y",n="height"),{axis:t,dimension:n}},ka.prototype._isType=function(e,t){return-1!==t.indexOf(e)},ka.prototype._alignmentPosition=function(e,t){var n,i,r,o=this._getOrientationDetails(e),s=o.axis,a=o.dimension,l={},c={},p=!1;if(this._isType(e,["left","top"]))l[e]=t[0][s];else if(this._isType(e,["right","bottom"]))r=_a(t),l[e]=r[s]+r[a];else if(this._isType(e,["center","middle"])){if(_(t,(function(e){var t=e[s]+Math.round(e[a]/2);c[t]?c[t].elements.push(e):c[t]={elements:[e],center:t}})),n=R(c,(function(e){return e.elements.length>1&&(p=!0),e.elements.length})),p)return l[e]=_a(n).center,l;i=t[0],r=_a(t=R(t,(function(e){return e[s]+e[a]}))),l[e]=function(e,t){return Math.round((e[s]+t[s]+t[a])/2)}(i,r)}return l},ka.prototype.trigger=function(e,t){var n,i=this._modeling,r=w(e,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));if(h(n=this._rules.allowed("elements.align",{elements:r}))&&(r=n),!(r.length<2)&&n){var o=R(r,Pa[t]),s=this._alignmentPosition(t,o);i.alignElements(o,s)}};const Sa={__init__:["alignElements"],alignElements:["type",ka]};var Ca=".entry";function Ta(e,t,n,i){this._canvas=e,this._eventBus=n,this._overlays=i;var r=u(t&&t.scale)?t.scale:{min:1,max:1.5};this._overlaysConfig={scale:r},this._current=null,this._init()}function Aa(e,t){return-1!==e.indexOf(t)}Ta.$inject=["canvas","config.contextPad","eventBus","overlays"],Ta.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",(function(t){var n=t.newSelection,i=n.length?1===n.length?n[0]:n:null;i?e.open(i,!0):e.close()})),this._eventBus.on("elements.changed",(function(t){var n=t.elements,i=e._current;if(i){var r=i.target;k(h(r)?r:[r],(function(e){return Aa(n,e)}))&&e.open(r,!0)}}))},Ta.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("contextPad.getProviders",e,(function(e){e.providers.push(t)}))},Ta.prototype.getEntries=function(e){var t=this._getProviders(),n=h(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return _(t,(function(t){if(g(t[n])){var r=t[n](e);g(r)?i=r(i):_(r,(function(e,t){i[t]=e}))}})),i},Ta.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=J(o,"data-action"),r=t.originalEvent||t,"mouseover"===e?this._timeout=setTimeout((()=>{this._mouseout=this.triggerEntry(i,"hover",r,n)}),300):"mouseout"===e&&(clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null)),this.triggerEntry(i,e,r,n)):t.preventDefault()},Ta.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries[e];if(o){var s=o.action;if(!1!==this._eventBus.fire("contextPad.trigger",{entry:o,event:n})){if(g(s)){if("click"===t)return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Ta.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},Ta.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ta.prototype._updateAndOpen=function(e){var t,n=this.getEntries(e),i=this.getPad(e),r=i.html;_(n,(function(e,n){var i,o=e.group||"default",s=be(e.html||'');J(s,"data-action",n),(i=we("[data-group="+ys(o)+"]",r))||(J(i=be(''),"data-group",o),r.appendChild(i)),i.appendChild(s),e.className&&function(e,t){var n=te(e);(t=h(t)?t:t.split(/\s+/g)).forEach((function(e){n.add(e)}))}(s,e.className),e.title&&J(s,"title",e.title),e.imageUrl&&(J(t=be("
"),"src",e.imageUrl),t.style.width="100%",t.style.height="100%",s.appendChild(t))})),te(r).add("open"),this._current={target:e,entries:n,pad:i},this._eventBus.fire("contextPad.open",{current:this._current})},Ta.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,i=be(''),r=this._getPosition(e),o=z({html:i},this._overlaysConfig,r);me.bind(i,Ca,"click",(function(e){t.trigger("click",e)})),me.bind(i,Ca,"dragstart",(function(e){t.trigger("dragstart",e)})),me.bind(i,Ca,"mouseover",(function(e){t.trigger("mouseover",e)})),me.bind(i,Ca,"mouseout",(function(e){t.trigger("mouseout",e)})),de.bind(i,"mousedown",(function(e){e.stopPropagation()}));var s=this._canvas.getRootElement();this._overlayId=n.add(s,"context-pad",o);var a=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{target:e,pad:a}),a},Ta.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Ta.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return h(e)===h(n)&&(h(e)?e.length===n.length&&P(e,(function(e){return Aa(n,e)})):n===e)},Ta.prototype.isShown=function(){return this.isOpen()&&this._overlays.isShown()},Ta.prototype._getPosition=function(e){var t,n=Et(h(e=yn(e)?(t=e).waypoints[t.waypoints.length-1]:e)?e:[e]);return{position:{left:n.x+n.width+12,top:n.y-6}}};const Ma={__depends__:[Qo,ps],contextPad:["type",Ta]};var Da,Ra,Na,$a,ja,Ia,La,Ba,qa,za,Fa={},Va=[],Ha=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ua=Array.isArray;function Wa(e,t){for(var n in t)e[n]=t[n];return e}function Ga(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Qa(e,t,n){var i,r,o,s={};for(o in t)"key"==o?i=t[o]:"ref"==o?r=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?Da.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===s[o]&&(s[o]=e.defaultProps[o]);return Xa(e,s,i,r,null)}function Xa(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++Na:r,__i:-1,__u:0};return null==r&&null!=Ra.vnode&&Ra.vnode(o),o}function Ka(e){return e.children}function Ya(e,t){this.props=e,this.context=t}function Za(e,t){if(null==t)return e.__?Za(e.__,e.__i+1):null;for(var n;tt&&$a.sort(La));tl.__r=0}function nl(e,t,n,i,r,o,s,a,l,c,p){var u,d,h,f,m,g=i&&i.__k||Va,y=t.length;for(n.__d=l,il(n,t,g),l=n.__d,u=0;u0?Xa(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r).__=e,r.__b=e.__b+1,o=null,-1!==(a=r.__i=ol(r,n,s,p))&&(p--,(o=n[a])&&(o.__u|=131072)),null==o||null===o.__v?(-1==a&&u--,"function"!=typeof r.type&&(r.__u|=65536)):a!==s&&(a==s-1?u--:a==s+1?u++:(a>s?u--:u++,r.__u|=65536))):r=e.__k[i]=null;if(p)for(i=0;i(null==l||131072&l.__u?0:1))for(;s>=0||a=0){if((l=t[s])&&!(131072&l.__u)&&r==l.key&&o===l.type)return s;s--}if(a=5&&((r||!e&&5===i)&&(s.push(i,0,r,n),i=6),e&&(s.push(i,e,0,n),i=6)),r=""},l=0;l"===t?(i=1,r=""):r=t+r[0]:o?t===o?o="":r+=t:'"'===t||"'"===t?o=t:">"===t?(a(),i=1):i&&("="===t?(i=5,n=r,r=""):"/"===t&&(i<5||">"===e[l][c+1])?(a(),3===i&&(s=s[0]),i=s,(s=s[0]).push(2,0,i),i=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(a(),i=2):r+=t),3===i&&"!--"===r&&(i=4,s=s[0])}return a(),s}(e)),t),arguments,[])).length>1?t:t[0]}.bind(Qa),El=0,Ol=[],Pl=Ra,kl=Pl.__b,Sl=Pl.__r,Cl=Pl.diffed,Tl=Pl.__c,Al=Pl.unmount,Ml=Pl.__;function Dl(e,t){Pl.__h&&Pl.__h(bl,e,El||t),El=0;var n=bl.__H||(bl.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Rl(e){return El=1,function(e,t,n){var i=Dl(vl++,2);if(i.t=e,!i.__c&&(i.__=[n?n(t):Ul(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=bl,!bl.u)){var r=function(e,t,n){if(!i.__c.__H)return!0;var r=i.__c.__H.__.filter((function(e){return!!e.__c}));if(r.every((function(e){return!e.__N})))return!o||o.call(this,e,t,n);var s=i.__c.props!==e;return r.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),o&&o.call(this,e,t,n)||s};bl.u=!0;var o=bl.shouldComponentUpdate,s=bl.componentWillUpdate;bl.componentWillUpdate=function(e,t,n){if(this.__e){var i=o;o=void 0,r(e,t,n),o=i}s&&s.call(this,e,t,n)},bl.shouldComponentUpdate=r}return i.__N||i.__}(Ul,e)}function Nl(e,t){var n=Dl(vl++,3);!Pl.__s&&Hl(n.__H,t)&&(n.__=e,n.i=t,bl.__H.__h.push(n))}function $l(e,t){var n=Dl(vl++,4);!Pl.__s&&Hl(n.__H,t)&&(n.__=e,n.i=t,bl.__h.push(n))}function jl(e){return El=5,Il((function(){return{current:e}}),[])}function Il(e,t){var n=Dl(vl++,7);return Hl(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ll(e,t){return El=8,Il((function(){return e}),t)}function Bl(){for(var e;e=Ol.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Fl),e.__H.__h.forEach(Vl),e.__H.__h=[]}catch(t){e.__H.__h=[],Pl.__e(t,e.__v)}}Pl.__b=function(e){bl=null,kl&&kl(e)},Pl.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ml&&Ml(e,t)},Pl.__r=function(e){Sl&&Sl(e),vl=0;var t=(bl=e.__c).__H;t&&(xl===bl?(t.__h=[],bl.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.i=e.__N=void 0}))):(t.__h.forEach(Fl),t.__h.forEach(Vl),t.__h=[],vl=0)),xl=bl},Pl.diffed=function(e){Cl&&Cl(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Ol.push(t)&&wl===Pl.requestAnimationFrame||((wl=Pl.requestAnimationFrame)||zl)(Bl)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.i=void 0}))),xl=bl=null},Pl.__c=function(e,t){t.some((function(e){try{e.__h.forEach(Fl),e.__h=e.__h.filter((function(e){return!e.__||Vl(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Pl.__e(n,e.__v)}})),Tl&&Tl(e,t)},Pl.unmount=function(e){Al&&Al(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{Fl(e)}catch(e){t=e}})),n.__H=void 0,t&&Pl.__e(t,n.__v))};var ql="function"==typeof requestAnimationFrame;function zl(e){var t,n=function(){clearTimeout(i),ql&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);ql&&(t=requestAnimationFrame(n))}function Fl(e){var t=bl,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),bl=t}function Vl(e){var t=bl;e.__c=e.__(),bl=t}function Hl(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function Ul(e,t){return"function"==typeof t?t(e):t}function Wl(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;to(e,t,"dragstart")}
- draggable=${!0}
- >
-
- ${t.documentationRef&&_l`
-
- `}
-
- `}function Xl(e){const{selectedEntry:t,setSelectedEntry:n,entries:i,...r}=e,o=jl(),s=Il((()=>function(e){const t=[],n=e=>t.find((t=>e.id===t.id)),i=e=>!!n(e),r=e=>"string"==typeof e?{id:e}:e;return e.forEach((e=>{const o=e.group?r(e.group):{id:"default"};i(o)?n(o).entries.push(e):t.push({...o,entries:[e]})})),t}(i)),[i]);return $l((()=>{const e=o.current;if(!e)return;const t=e.querySelector(".selected");var n;t&&("function"==typeof(n=t).scrollIntoViewIfNeeded?n.scrollIntoViewIfNeeded():n.scrollIntoView({scrollMode:"if-needed",block:"nearest"}))}),[t]),_l`
-
- `}function Kl(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:s,width:a,scale:l,search:c,entries:p,onOpened:d,onClosed:h}=e,f=Il((()=>!!u(c)&&p.length>5),[c,p]),m=jl(),[g,y]=Rl(""),v=Ll(((e,t)=>{if(!f)return e;return e.filter((e=>{if(!t)return(e.rank||0)>=0;if(!1===e.searchable)return!1;const n=[e.description||"",e.label||"",e.search||""].join("---").toLowerCase();return t.toLowerCase().split(/\s/g).every((e=>n.includes(e)))}))}),[f]),[b,x]=Rl(v(p,g)),[w,_]=Rl(b[0]),E=Ll((e=>{w&&e.includes(w)||_(e[0]),x(e)}),[w,x,_]);Nl((()=>{E(v(p,g))}),[g,p]),Nl((()=>{const e=e=>{if("Escape"===e.key)return e.preventDefault(),t()};return document.documentElement.addEventListener("keydown",e),()=>{document.documentElement.removeEventListener("keydown",e)}}),[]),$l((()=>{m.current&&m.current.focus()}),[]);const O=Ll((e=>{let t=b.indexOf(w)+e;t<0&&(t=b.length-1),t>=b.length&&(t=0),_(b[t])}),[b,w,_]),P=Ll((e=>"Enter"===e.key&&w?n(e,w):"ArrowUp"===e.key||"Tab"===e.key&&e.shiftKey?(O(-1),e.preventDefault()):"ArrowDown"===e.key||"Tab"===e.key?(O(1),e.preventDefault()):void 0),[n,t,w,O]),k=Ll((e=>{xe(e.target,"input")&&y((()=>e.target.value))}),[y]);Nl((()=>(d(),()=>{h()})),[]);const S=Il((()=>s||r.length>0),[s,r]);return _l`
- <${Yl}
- onClose=${t}
- onKeyup=${k}
- onKeydown=${P}
- className=${i}
- position=${o}
- width=${a}
- scale=${l}
- >
- ${S&&_l`
-
- `}
- ${p.length>0&&_l`
-
+"use strict";
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ AlignToOrigin)\n/* harmony export */ });\n/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! min-dash */ \"./node_modules/min-dash/dist/index.esm.js\");\n\n\nvar DEFAULT_OPTIONS = {\n offset: {\n x: 150,\n y: 75\n },\n tolerance: 50,\n alignOnSave: true\n};\n\nvar HIGHER_PRIORITY = 1250;\n\n\n/**\n * Moves diagram contents to the origin + offset,\n * optionally upon diagram save.\n *\n * @param {Object} config\n * @param {didi.Injector} injector\n * @param {EventBus} eventBus\n * @param {CommandStack} commandStack\n * @param {Canvas} canvas\n * @param {Modeling} modeling\n */\nfunction AlignToOrigin(config, injector, eventBus, commandStack, canvas, modeling) {\n\n /**\n * Return actual config with defaults applied.\n */\n function applyDefaults(config) {\n\n var c = (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.assign)({}, DEFAULT_OPTIONS, config || {});\n\n if ((0,min_dash__WEBPACK_IMPORTED_MODULE_0__.isNumber)(c.offset)) {\n c.offset = {\n x: c.offset,\n y: c.offset\n };\n }\n\n return c;\n }\n\n config = applyDefaults(config);\n\n /**\n * Compute adjustment given the specified diagram origin.\n *\n * @param {Point} origin\n *\n * @return {Point} adjustment\n */\n function computeAdjustment(origin, config) {\n\n var offset = config.offset,\n tolerance = config.tolerance;\n\n var adjustment = {};\n\n [ 'x', 'y' ].forEach(function(axis) {\n\n var delta = -origin[axis] + offset[axis];\n\n var gridSnapping = injector.get('gridSnapping', false);\n\n if (gridSnapping) {\n delta = quantize(delta, gridSnapping.getGridSpacing());\n }\n\n adjustment[axis] = Math.abs(delta) < tolerance ? 0 : delta;\n });\n\n return adjustment;\n }\n\n\n /**\n * Align the diagram content to the origin.\n *\n * @param {Object} options\n */\n function align() {\n\n var bounds = canvas.viewbox().inner;\n\n var elements = canvas.getRootElement().children;\n\n if (!elements.length) {\n return;\n }\n\n var delta = computeAdjustment(bounds, config);\n\n if (delta.x === 0 && delta.y === 0) {\n return;\n }\n\n commandStack.execute('elements.alignToOrigin', {\n elements: elements,\n delta: delta\n });\n }\n\n\n /**\n * Setup align on save functionality\n */\n function bindOnSave() {\n\n // nested editors expose _parent to access the\n // save responsible entity\n var parent = injector.get('_parent', false);\n\n var localEvents = eventBus;\n\n var parentEvents = parent && parent._eventBus;\n\n (parentEvents || localEvents).on('saveXML.start', HIGHER_PRIORITY, align);\n\n if (parentEvents) {\n\n // unregister for saveXML.start\n localEvents.on('diagram.destroy', function() {\n parentEvents.off('saveXML.start', align);\n });\n }\n }\n\n\n /**\n * Create a function that compensates the element movement\n * by moving applying the delta in the given direction.\n */\n function movementCompensator(direction) {\n\n /**\n * Handler to executed\n */\n return function(context) {\n\n // adjust canvas after the commandstack got changed\n eventBus.once('commandStack.changed', function() {\n\n var delta = context.delta;\n var scale = canvas.viewbox().scale;\n\n canvas.scroll({\n dx: direction * delta.x * scale,\n dy: direction * delta.y * scale\n });\n });\n };\n }\n\n // command registration\n\n /**\n * A command handler that compensates the element movement\n * by applying the inverse move operation on the canvas.\n */\n commandStack.register('elements.alignToOrigin', {\n\n preExecute: function(context) {\n var delta = context.delta,\n elements = context.elements;\n\n modeling.moveElements(elements, delta);\n },\n\n execute: movementCompensator(-1),\n revert: movementCompensator(1)\n });\n\n // setup\n\n if (config.alignOnSave) {\n bindOnSave();\n }\n\n // API\n\n this.align = align;\n this.computeAdjustment = computeAdjustment;\n\n // internal debugging purposes\n this._config = config;\n}\n\nAlignToOrigin.$inject = [\n 'config.alignToOrigin',\n 'injector',\n 'eventBus',\n 'commandStack',\n 'canvas',\n 'modeling'\n];\n\n\n// helpers /////////////////////////\n\nfunction quantize(value, quantum, fn) {\n if (!fn) {\n fn = 'round';\n }\n\n return Math[ fn ](value / quantum) * quantum;\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvQGJwbW4taW8vYWxpZ24tdG8tb3JpZ2luL2xpYi9hbGlnbi10by1vcmlnaW4uanMiLCJtYXBwaW5ncyI6Ijs7Ozs7QUFHa0I7O0FBRWxCO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsR0FBRztBQUNIO0FBQ0E7QUFDQTs7QUFFQTs7O0FBR0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxXQUFXLFFBQVE7QUFDbkIsV0FBVyxlQUFlO0FBQzFCLFdBQVcsVUFBVTtBQUNyQixXQUFXLGNBQWM7QUFDekIsV0FBVyxRQUFRO0FBQ25CLFdBQVcsVUFBVTtBQUNyQjtBQUNlOztBQUVmO0FBQ0E7QUFDQTtBQUNBOztBQUVBLFlBQVksZ0RBQU0sR0FBRywrQkFBK0I7O0FBRXBELFFBQVEsa0RBQVE7QUFDaEI7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBOztBQUVBO0FBQ0E7QUFDQTtBQUNBLGFBQWEsT0FBTztBQUNwQjtBQUNBLGNBQWMsT0FBTztBQUNyQjtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7O0FBRUE7O0FBRUE7O0FBRUE7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0EsS0FBSzs7QUFFTDtBQUNBOzs7QUFHQTtBQUNBO0FBQ0E7QUFDQSxhQUFhLFFBQVE7QUFDckI7QUFDQTs7QUFFQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBLEtBQUs7QUFDTDs7O0FBR0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBOztBQUVBOztBQUVBOztBQUVBOztBQUVBO0FBQ0E7QUFDQTtBQUNBLE9BQU87QUFDUDtBQUNBOzs7QUFHQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxTQUFTO0FBQ1QsT0FBTztBQUNQO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQSxLQUFLOztBQUVMO0FBQ0E7QUFDQSxHQUFHOztBQUVIOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOzs7QUFHQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vLy4vbm9kZV9tb2R1bGVzL0BicG1uLWlvL2FsaWduLXRvLW9yaWdpbi9saWIvYWxpZ24tdG8tb3JpZ2luLmpzPzIwNzUiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHtcbiAgYXNzaWduLFxuICBpc051bWJlclxufSBmcm9tICdtaW4tZGFzaCc7XG5cbnZhciBERUZBVUxUX09QVElPTlMgPSB7XG4gIG9mZnNldDoge1xuICAgIHg6IDE1MCxcbiAgICB5OiA3NVxuICB9LFxuICB0b2xlcmFuY2U6IDUwLFxuICBhbGlnbk9uU2F2ZTogdHJ1ZVxufTtcblxudmFyIEhJR0hFUl9QUklPUklUWSA9IDEyNTA7XG5cblxuLyoqXG4gKiBNb3ZlcyBkaWFncmFtIGNvbnRlbnRzIHRvIHRoZSBvcmlnaW4gKyBvZmZzZXQsXG4gKiBvcHRpb25hbGx5IHVwb24gZGlhZ3JhbSBzYXZlLlxuICpcbiAqIEBwYXJhbSB7T2JqZWN0fSBjb25maWdcbiAqIEBwYXJhbSB7ZGlkaS5JbmplY3Rvcn0gaW5qZWN0b3JcbiAqIEBwYXJhbSB7RXZlbnRCdXN9IGV2ZW50QnVzXG4gKiBAcGFyYW0ge0NvbW1hbmRTdGFja30gY29tbWFuZFN0YWNrXG4gKiBAcGFyYW0ge0NhbnZhc30gY2FudmFzXG4gKiBAcGFyYW0ge01vZGVsaW5nfSBtb2RlbGluZ1xuICovXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBBbGlnblRvT3JpZ2luKGNvbmZpZywgaW5qZWN0b3IsIGV2ZW50QnVzLCBjb21tYW5kU3RhY2ssIGNhbnZhcywgbW9kZWxpbmcpIHtcblxuICAvKipcbiAgICogUmV0dXJuIGFjdHVhbCBjb25maWcgd2l0aCBkZWZhdWx0cyBhcHBsaWVkLlxuICAgKi9cbiAgZnVuY3Rpb24gYXBwbHlEZWZhdWx0cyhjb25maWcpIHtcblxuICAgIHZhciBjID0gYXNzaWduKHt9LCBERUZBVUxUX09QVElPTlMsIGNvbmZpZyB8fCB7fSk7XG5cbiAgICBpZiAoaXNOdW1iZXIoYy5vZmZzZXQpKSB7XG4gICAgICBjLm9mZnNldCA9IHtcbiAgICAgICAgeDogYy5vZmZzZXQsXG4gICAgICAgIHk6IGMub2Zmc2V0XG4gICAgICB9O1xuICAgIH1cblxuICAgIHJldHVybiBjO1xuICB9XG5cbiAgY29uZmlnID0gYXBwbHlEZWZhdWx0cyhjb25maWcpO1xuXG4gIC8qKlxuICAgKiBDb21wdXRlIGFkanVzdG1lbnQgZ2l2ZW4gdGhlIHNwZWNpZmllZCBkaWFncmFtIG9yaWdpbi5cbiAgICpcbiAgICogQHBhcmFtIHtQb2ludH0gb3JpZ2luXG4gICAqXG4gICAqIEByZXR1cm4ge1BvaW50fSBhZGp1c3RtZW50XG4gICAqL1xuICBmdW5jdGlvbiBjb21wdXRlQWRqdXN0bWVudChvcmlnaW4sIGNvbmZpZykge1xuXG4gICAgdmFyIG9mZnNldCA9IGNvbmZpZy5vZmZzZXQsXG4gICAgICAgIHRvbGVyYW5jZSA9IGNvbmZpZy50b2xlcmFuY2U7XG5cbiAgICB2YXIgYWRqdXN0bWVudCA9IHt9O1xuXG4gICAgWyAneCcsICd5JyBdLmZvckVhY2goZnVuY3Rpb24oYXhpcykge1xuXG4gICAgICB2YXIgZGVsdGEgPSAtb3JpZ2luW2F4aXNdICsgb2Zmc2V0W2F4aXNdO1xuXG4gICAgICB2YXIgZ3JpZFNuYXBwaW5nID0gaW5qZWN0b3IuZ2V0KCdncmlkU25hcHBpbmcnLCBmYWxzZSk7XG5cbiAgICAgIGlmIChncmlkU25hcHBpbmcpIHtcbiAgICAgICAgZGVsdGEgPSBxdWFudGl6ZShkZWx0YSwgZ3JpZFNuYXBwaW5nLmdldEdyaWRTcGFjaW5nKCkpO1xuICAgICAgfVxuXG4gICAgICBhZGp1c3RtZW50W2F4aXNdID0gTWF0aC5hYnMoZGVsdGEpIDwgdG9sZXJhbmNlID8gMCA6IGRlbHRhO1xuICAgIH0pO1xuXG4gICAgcmV0dXJuIGFkanVzdG1lbnQ7XG4gIH1cblxuXG4gIC8qKlxuICAgKiBBbGlnbiB0aGUgZGlhZ3JhbSBjb250ZW50IHRvIHRoZSBvcmlnaW4uXG4gICAqXG4gICAqIEBwYXJhbSB7T2JqZWN0fSBvcHRpb25zXG4gICAqL1xuICBmdW5jdGlvbiBhbGlnbigpIHtcblxuICAgIHZhciBib3VuZHMgPSBjYW52YXMudmlld2JveCgpLmlubmVyO1xuXG4gICAgdmFyIGVsZW1lbnRzID0gY2FudmFzLmdldFJvb3RFbGVtZW50KCkuY2hpbGRyZW47XG5cbiAgICBpZiAoIWVsZW1lbnRzLmxlbmd0aCkge1xuICAgICAgcmV0dXJuO1xuICAgIH1cblxuICAgIHZhciBkZWx0YSA9IGNvbXB1dGVBZGp1c3RtZW50KGJvdW5kcywgY29uZmlnKTtcblxuICAgIGlmIChkZWx0YS54ID09PSAwICYmIGRlbHRhLnkgPT09IDApIHtcbiAgICAgIHJldHVybjtcbiAgICB9XG5cbiAgICBjb21tYW5kU3RhY2suZXhlY3V0ZSgnZWxlbWVudHMuYWxpZ25Ub09yaWdpbicsIHtcbiAgICAgIGVsZW1lbnRzOiBlbGVtZW50cyxcbiAgICAgIGRlbHRhOiBkZWx0YVxuICAgIH0pO1xuICB9XG5cblxuICAvKipcbiAgICogU2V0dXAgYWxpZ24gb24gc2F2ZSBmdW5jdGlvbmFsaXR5XG4gICAqL1xuICBmdW5jdGlvbiBiaW5kT25TYXZlKCkge1xuXG4gICAgLy8gbmVzdGVkIGVkaXRvcnMgZXhwb3NlIF9wYXJlbnQgdG8gYWNjZXNzIHRoZVxuICAgIC8vIHNhdmUgcmVzcG9uc2libGUgZW50aXR5XG4gICAgdmFyIHBhcmVudCA9IGluamVjdG9yLmdldCgnX3BhcmVudCcsIGZhbHNlKTtcblxuICAgIHZhciBsb2NhbEV2ZW50cyA9IGV2ZW50QnVzO1xuXG4gICAgdmFyIHBhcmVudEV2ZW50cyA9IHBhcmVudCAmJiBwYXJlbnQuX2V2ZW50QnVzO1xuXG4gICAgKHBhcmVudEV2ZW50cyB8fCBsb2NhbEV2ZW50cykub24oJ3NhdmVYTUwuc3RhcnQnLCBISUdIRVJfUFJJT1JJVFksIGFsaWduKTtcblxuICAgIGlmIChwYXJlbnRFdmVudHMpIHtcblxuICAgICAgLy8gdW5yZWdpc3RlciBmb3Igc2F2ZVhNTC5zdGFydFxuICAgICAgbG9jYWxFdmVudHMub24oJ2RpYWdyYW0uZGVzdHJveScsIGZ1bmN0aW9uKCkge1xuICAgICAgICBwYXJlbnRFdmVudHMub2ZmKCdzYXZlWE1MLnN0YXJ0JywgYWxpZ24pO1xuICAgICAgfSk7XG4gICAgfVxuICB9XG5cblxuICAvKipcbiAgICogQ3JlYXRlIGEgZnVuY3Rpb24gdGhhdCBjb21wZW5zYXRlcyB0aGUgZWxlbWVudCBtb3ZlbWVudFxuICAgKiBieSBtb3ZpbmcgYXBwbHlpbmcgdGhlIGRlbHRhIGluIHRoZSBnaXZlbiBkaXJlY3Rpb24uXG4gICAqL1xuICBmdW5jdGlvbiBtb3ZlbWVudENvbXBlbnNhdG9yKGRpcmVjdGlvbikge1xuXG4gICAgLyoqXG4gICAgICogSGFuZGxlciB0byBleGVjdXRlZFxuICAgICAqL1xuICAgIHJldHVybiBmdW5jdGlvbihjb250ZXh0KSB7XG5cbiAgICAgIC8vIGFkanVzdCBjYW52YXMgYWZ0ZXIgdGhlIGNvbW1hbmRzdGFjayBnb3QgY2hhbmdlZFxuICAgICAgZXZlbnRCdXMub25jZSgnY29tbWFuZFN0YWNrLmNoYW5nZWQnLCBmdW5jdGlvbigpIHtcblxuICAgICAgICB2YXIgZGVsdGEgPSBjb250ZXh0LmRlbHRhO1xuICAgICAgICB2YXIgc2NhbGUgPSBjYW52YXMudmlld2JveCgpLnNjYWxlO1xuXG4gICAgICAgIGNhbnZhcy5zY3JvbGwoe1xuICAgICAgICAgIGR4OiBkaXJlY3Rpb24gKiBkZWx0YS54ICogc2NhbGUsXG4gICAgICAgICAgZHk6IGRpcmVjdGlvbiAqIGRlbHRhLnkgKiBzY2FsZVxuICAgICAgICB9KTtcbiAgICAgIH0pO1xuICAgIH07XG4gIH1cblxuICAvLyBjb21tYW5kIHJlZ2lzdHJhdGlvblxuXG4gIC8qKlxuICAgKiBBIGNvbW1hbmQgaGFuZGxlciB0aGF0IGNvbXBlbnNhdGVzIHRoZSBlbGVtZW50IG1vdmVtZW50XG4gICAqIGJ5IGFwcGx5aW5nIHRoZSBpbnZlcnNlIG1vdmUgb3BlcmF0aW9uIG9uIHRoZSBjYW52YXMuXG4gICAqL1xuICBjb21tYW5kU3RhY2sucmVnaXN0ZXIoJ2VsZW1lbnRzLmFsaWduVG9PcmlnaW4nLCB7XG5cbiAgICBwcmVFeGVjdXRlOiBmdW5jdGlvbihjb250ZXh0KSB7XG4gICAgICB2YXIgZGVsdGEgPSBjb250ZXh0LmRlbHRhLFxuICAgICAgICAgIGVsZW1lbnRzID0gY29udGV4dC5lbGVtZW50cztcblxuICAgICAgbW9kZWxpbmcubW92ZUVsZW1lbnRzKGVsZW1lbnRzLCBkZWx0YSk7XG4gICAgfSxcblxuICAgIGV4ZWN1dGU6IG1vdmVtZW50Q29tcGVuc2F0b3IoLTEpLFxuICAgIHJldmVydDogbW92ZW1lbnRDb21wZW5zYXRvcigxKVxuICB9KTtcblxuICAvLyBzZXR1cFxuXG4gIGlmIChjb25maWcuYWxpZ25PblNhdmUpIHtcbiAgICBiaW5kT25TYXZlKCk7XG4gIH1cblxuICAvLyBBUElcblxuICB0aGlzLmFsaWduID0gYWxpZ247XG4gIHRoaXMuY29tcHV0ZUFkanVzdG1lbnQgPSBjb21wdXRlQWRqdXN0bWVudDtcblxuICAvLyBpbnRlcm5hbCBkZWJ1Z2dpbmcgcHVycG9zZXNcbiAgdGhpcy5fY29uZmlnID0gY29uZmlnO1xufVxuXG5BbGlnblRvT3JpZ2luLiRpbmplY3QgPSBbXG4gICdjb25maWcuYWxpZ25Ub09yaWdpbicsXG4gICdpbmplY3RvcicsXG4gICdldmVudEJ1cycsXG4gICdjb21tYW5kU3RhY2snLFxuICAnY2FudmFzJyxcbiAgJ21vZGVsaW5nJ1xuXTtcblxuXG4vLyBoZWxwZXJzIC8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy9cblxuZnVuY3Rpb24gcXVhbnRpemUodmFsdWUsIHF1YW50dW0sIGZuKSB7XG4gIGlmICghZm4pIHtcbiAgICBmbiA9ICdyb3VuZCc7XG4gIH1cblxuICByZXR1cm4gTWF0aFsgZm4gXSh2YWx1ZSAvIHF1YW50dW0pICogcXVhbnR1bTtcbn0iXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./node_modules/@bpmn-io/align-to-origin/lib/align-to-origin.js\n");
- ${f&&_l`
-
- `}
+/***/ }),
- <${Xl}
- entries=${b}
- selectedEntry=${w}
- setSelectedEntry=${_}
- onAction=${n}
- />
-
- ${0===b.length&&_l`
-
- `}
- `}
- ${Yl}>
- `}function Yl(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,position:s}=e,a=jl(),l=Ll((e=>{re(e.target,".djs-popup",!0)||t()}),[t]);return $l((()=>{if("function"!=typeof s)return;const e=a.current,t=s(e);e.style.left=`${t.x}px`,e.style.top=`${t.y}px`}),[a.current,s]),$l((()=>{a.current&&a.current.focus()}),[]),_l`
-
- `}var Zl=["contextPad.close","canvas.viewbox.changing","commandStack.changed"];function Jl(e,t,n){this._eventBus=t,this._canvas=n,this._current=null;var i=u(e&&e.scale)?e.scale:{min:1,max:1.5};this._config={scale:i},t.on("diagram.destroy",(()=>{this.close()})),t.on("element.changed",(e=>{const t=this.isOpen()&&this._current.target;e.element===t&&this._render()}))}Jl.$inject=["config.popupMenu","eventBus","canvas"],Jl.prototype._render=function(){const{position:e,className:t,entries:n,headerEntries:i,options:r}=this._current,o=Object.entries(n).map((([e,t])=>({id:e,...t}))),s=Object.entries(i).map((([e,t])=>({id:e,...t}))),a=e&&(t=>this._ensureVisible(t,e)),l=this._updateScale(this._current.container);ml(_l`
- <${Kl}
- onClose=${e=>this.close(e)}
- onSelect=${(e,t,n)=>this.trigger(e,t,n)}
- position=${a}
- className=${t}
- entries=${o}
- headerEntries=${s}
- scale=${l}
- onOpened=${this._onOpened.bind(this)}
- onClosed=${this._onClosed.bind(this)}
- ...${{...r}}
- />
- `,this._current.container)},Jl.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");this.isOpen()&&this.close();const{entries:r,headerEntries:o}=this._getContext(e,t);this._current={position:n,className:t,target:e,entries:r,headerEntries:o,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},Jl.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),r=this._getHeaderEntries(e,n);return{entries:i,headerEntries:r,empty:!(Object.keys(i).length||Object.keys(r).length)}},Jl.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._current=null)},Jl.prototype.reset=function(){const e=this._current.container;ml(null,e),Ee(e)},Jl.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Jl.prototype._onOpened=function(){this._emit("opened")},Jl.prototype._onClosed=function(){this._emit("closed")},Jl.prototype._createContainer=function(e){var t=this._canvas.getContainer();const n=be(``);return t.appendChild(n),n},Jl.prototype._bindAutoClose=function(){this._eventBus.once(Zl,this.close,this)},Jl.prototype._unbindAutoClose=function(){this._eventBus.off(Zl,this.close,this)},Jl.prototype._updateScale=function(){var e,t,n=this._canvas.zoom(),i=this._config.scale,r=n;return!0!==i&&(!1===i?(e=1,t=1):(e=i.min,t=i.max),u(e)&&nt&&(r=t)),r},Jl.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),r={},o=t.x,s=t.y;return t.x+i.width>n.width&&(r.x=!0),t.y+i.height>n.height&&(r.y=!0),r.x&&r.y?(o=t.x-i.width,s=t.y-i.height):r.x?(o=t.x-i.width,s=t.y):r.y&&t.y\n \n \n \n ',bottom:'',center:'',left:'',right:'',top:'',middle:''};function nc(e,t,n,i){e.registerProvider(900,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}nc.$inject=["contextPad","popupMenu","translate","canvas"],nc.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},nc.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},nc.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`${tc.align}
`,action:{click:function(t,n){var i=e._getMenuPosition(n);z(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},nc.prototype._getMenuPosition=function(e){var t=this._contextPad.getPad(e).html.getBoundingClientRect();return{x:t.left,y:t.bottom+5}};var ic=["left","center","right","top","middle","bottom"];function rc(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}function oc(e){hs.call(this,e),this.init()}function sc(e){oc.call(this,e)}rc.$inject=["popupMenu","alignElements","translate","rules"],rc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},rc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},rc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return _(ic,(function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:tc[o],action:function(){t.trigger(e,o),i.close()}}})),r},oc.$inject=["eventBus"],i(oc,hs),oc.prototype.addRule=function(e,t,n){var i=this;"string"==typeof e&&(e=[e]),e.forEach((function(e){i.canExecute(e,t,(function(e,t,i){return n(e)}),!0)}))},oc.prototype.init=function(){},sc.$inject=["eventBus"],i(sc,oc),sc.prototype.init=function(){this.addRule("elements.align",(function(e){var t=w(e.elements,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));return!((t=yt(t)).length<2)&&t}))};const ac={__depends__:[Sa,Ma,ec],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",nc],alignElementsMenuProvider:["type",rc],bpmnAlignElements:["type",sc]};function lc(e,t,n,i){for(var r;r=pc(e,n,t);)n=i(t,n,r);return n}function cc(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach((function(o){var s=e[o];if(s){var a="x"===o?"width":"height",l=s.margin,c=s.minDistance;r[o]=l<0?Math.min(i[o]+l-t[a]/2,n[o]-c+l):Math.max(i[o]+i[a]+l+t[a]/2,n[o]+c+l)}})),r}}function pc(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=function(e){var t=uc(e);e.host&&(t=t.concat(uc(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(uc(t))}),[])));return t}(e);return b(r,(function(e){return e!==n&&"intersect"===Pn(e,i,10)}))}function uc(e){return(t=e,t.outgoing.map((function(e){return e.target}))).concat(function(e){return e.incoming.map((function(e){return e.source}))}(e));var t}function dc(){return!0}function hc(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var i=n.defaultDistance||50,r=On(e),o=wn(e);return{x:o.right+i+t.width/2,y:r.y}}(e.source,t)})),e.on("autoPlace.end",(function(e){n.scrollToElement(e.shape)})),this.append=function(n,i,r){e.fire("autoPlace.start",{source:n,shape:i});var o=e.fire("autoPlace",{source:n,shape:i}),s=t.appendShape(n,i,o,n.parent,r);return e.fire("autoPlace.end",{source:n,shape:s}),s}}function fc(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}hc.$inject=["eventBus","modeling","canvas"],fc.$inject=["eventBus","selection"];const mc={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",hc],autoPlaceSelectionBehavior:["type",fc]};function gc(e,t){return Tr(t,"bpmn:TextAnnotation")?function(e,t){var n=wn(e),i={x:n.right+t.width/2,y:n.top-50-t.height/2};yn(e)&&((i=On(e)).x+=100,i.y-=50);return lc(e,t,i,cc({y:{margin:-30,minDistance:20}}))}(e,t):Ar(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t){var n=wn(e),i={x:n.right-10+t.width/2,y:n.bottom+40+t.width/2};return lc(e,t,i,cc({x:{margin:30,minDistance:30}}))}(e,t):Tr(t,"bpmn:FlowNode")?function(e,t){var n=wn(e),i=On(e),r=function(e,t){t||(t={});var n=t.defaultDistance||50,i=t.direction||"e",r=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},s=t.maxDistance||250,a=t.reference||"start";function l(e,t){return"n"===i?"start"===a?wn(e).top-wn(t).bottom:"center"===a?wn(e).top-On(t).y:wn(e).top-wn(t).top:"w"===i?"start"===a?wn(e).left-wn(t).right:"center"===a?wn(e).left-On(t).x:wn(e).left-wn(t).left:"s"===i?"start"===a?wn(t).top-wn(e).bottom:"center"===a?On(t).y-wn(e).bottom:wn(t).bottom-wn(e).bottom:"start"===a?wn(t).left-wn(e).right:"center"===a?On(t).x-wn(e).right:wn(t).right-wn(e).right}r||(r=dc);var c=e.incoming.filter(r).map((function(t){var n=o(t),i=n<0?l(t.source,e):l(e,t.source);return{id:t.source.id,distance:i,weight:n}})),p=e.outgoing.filter(r).map((function(t){var n=o(t),i=n>0?l(e,t.target):l(t.target,e);return{id:t.target.id,distance:i,weight:n}})),u=O(c.concat(p).reduce((function(e,t){return e[t.id+"__weight_"+t.weight]=t,e}),{}),(function(e,t){var n=t.distance,i=t.weight;return n<0||n>s||(e[String(n)]||(e[String(n)]=0),e[String(n)]+=1*i,(!e.distance||e[e.distance]t.top&&(n=n.concat("n"));e.rightt.left&&(n=n.concat("e"));return n}(V(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:i});var r=t.parent;r&&this._expand([t],r)}}},xc.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},xc.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},xc.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},wc.$inject=["injector"],i(wc,xc),wc.prototype.resize=function(e,t,n){Tr(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},_c.$inject=["eventBus"],i(_c,oc),_c.prototype.canResize=function(e,t){return!1},i(Ec,_c),Ec.$inject=["eventBus","modeling"],Ec.prototype.canResize=function(e,t){if(Tr(t.di,"bpmndi:BPMNPlane"))return!1;if(!Tr(t,"bpmn:Participant")&&!Tr(t,"bpmn:Lane")&&!Tr(t,"bpmn:SubProcess"))return!1;var n=!0;return _(e,(function(e){(Tr(e,"bpmn:Lane")||vn(e))&&(n=!1)})),n};const Oc={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",wc],bpmnAutoResizeProvider:["type",Ec]};function Pc(e,t,n){var i,r,o=this,s=n.get("dragging",!1);s&&t.on("drag.start",(function(n){t.once("drag.move",1500,(function(t){!function(t){if(!t.hover){var n=t.originalEvent,i=o._findTargetGfx(n),r=i&&e.get(i);i&&r&&(t.stopPropagation(),s.hover({element:r,gfx:i}),s.move(n))}}(t)}))})),t.on("element.hover",(function(e){i=e.gfx,r=e.element})),t.on("element.hover",1500,(function(e){r&&t.fire("element.out",{element:r,gfx:i})})),t.on("element.out",(function(){i=null,r=null})),this._findTargetGfx=function(e){var t;if(e instanceof MouseEvent)return t=Bo(e),function(e){return re(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}Pc.$inject=["elementRegistry","eventBus","injector"];const kc={__init__:["hoverFix"],hoverFix:["type",Pc]};var Sc=Math.round,Cc="djs-drag-active";function Tc(e){e.preventDefault()}function Ac(e,t,n,i){var r,o={threshold:5,trapClick:!0};function s(e){var n=t.viewbox(),i=t._container.getBoundingClientRect();return{x:n.x+(e.x-i.left)/n.scale,y:n.y+(e.y-i.top)/n.scale}}function a(t,n){n=n||r;var i=e.createEvent(z({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,i)&&e.fire(n.prefix+"."+t,i)}function l(e,i){var o,l=r.payload,c=r.displacement,p=r.globalStart,u=Bo(e),d=ia(u,p),h=r.localStart,f=s(u),g=ia(f,h);if(!r.active&&(i||(o=d,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>r.threshold))){if(z(l,{x:Sc(h.x+c.x),y:Sc(h.y+c.y),dx:0,dy:0},{originalEvent:e}),!1===a("start"))return m();r.active=!0,r.keepSelection||(l.previousSelection=n.get(),n.select(null)),r.cursor&&Js(r.cursor),t.addMarker(t.getRootElement(),Cc)}Lo(e),r.active&&(z(l,{x:Sc(f.x+c.x),y:Sc(f.y+c.y),dx:Sc(g.x),dy:Sc(g.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;r.active&&(e&&(r.payload.originalEvent=e,Lo(e)),t=a("end")),!1===t&&a("rejected"),a("ended",g(!0!==t))}function p(e){Fs("Escape",e)&&(Tc(e),m())}function u(t){var n;r.active&&(n=ta(e),setTimeout(n,400),Tc(t)),c(t)}function d(e){l(e)}function h(e){var t=r.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function f(e){a("out");var t=r.payload;t.hoverGfx=null,t.hover=null}function m(e){var t;if(r){var n=r.active;n&&a("cancel"),t=g(e),n&&a("canceled",t)}}function g(o){var s,g;a("cleanup"),ea(),g=r.trapClick?u:c,de.unbind(document,"mousemove",l),de.unbind(document,"dragstart",Tc),de.unbind(document,"selectstart",Tc),de.unbind(document,"mousedown",g,!0),de.unbind(document,"mouseup",g,!0),de.unbind(document,"keyup",p),de.unbind(document,"touchstart",d,!0),de.unbind(document,"touchcancel",m,!0),de.unbind(document,"touchmove",l,!0),de.unbind(document,"touchend",c,!0),e.off("element.hover",h),e.off("element.out",f),t.removeMarker(t.getRootElement(),Cc);var y=r.payload.previousSelection;return!1!==o&&y&&!n.get().length&&function(e){var t=e.filter((function(e){return i.get(e.id)}));t.length&&n.select(t)}(y),s=r,r=null,s}e.on("diagram.destroy",m),this.init=function(t,n,i,g){r&&m(!1),"string"==typeof n&&(g=i,i=n,n=null);var y,v,b,x,w,_=(g=z({},o,g||{})).data||{};x=g.trapClick?u:c,t?(y=Io(t)||t,v=Bo(t),Lo(t),"dragstart"===y.type&&Tc(y)):(y=null,v={x:0,y:0}),b=s(v),n||(n=b),w=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(y),r=z({prefix:i,data:_,payload:{},globalStart:v,displacement:ia(n,b),localStart:b,isTouch:w},g),g.manual||(w?(de.bind(document,"touchstart",d,!0),de.bind(document,"touchcancel",m,!0),de.bind(document,"touchmove",l,!0),de.bind(document,"touchend",c,!0)):(de.bind(document,"mousemove",l),de.bind(document,"dragstart",Tc),de.bind(document,"selectstart",Tc),de.bind(document,"mousedown",x,!0),de.bind(document,"mouseup",x,!0)),de.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",f)),a("init"),g.autoActivate&&l(t,!0)},this.move=l,this.hover=h,this.out=f,this.end=c,this.cancel=m,this.context=function(){return r},this.setOptions=function(e){z(o,e)}}Ac.$inject=["eventBus","canvas","selection","elementRegistry"];const Mc={__depends__:[kc,is],dragging:["type",Ac]};function Dc(e,t,n){this._canvas=n,this._opts=z({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",(function(e){var t=i._toBorderPoint(e);i.startScroll(t)})),t.on(["drag.cleanup"],(function(){i.stopScroll()}))}function Rc(e,t,n){return tg-3&&(n=Pn(r.target,m),s===g-2?"intersect"===n&&(h.pop(),h[h.length-1]=m):"intersect"!==n&&h.push(u)),i.newWaypoints=r.waypoints=a(r,h),c(i,y,e),i.newSegmentStartIndex=o+y,l(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,hp)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,hp)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,i=t.connection;t.draggerGfx&&Ke(t.draggerGfx),n.removeMarker(i,fp)})),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],(function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,l(e)})),t.on("connectionSegment.move.end",(function(e){var t=e.context,n=t.connection,i=t.newWaypoints,r=t.newSegmentStartIndex;i=i.map((function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}));var s=function(e,t){var n=0;return{waypoints:e.filter((function(i,r){return!Rt(e[r-1],e[r+1],i)||(n=r<=t?n-1:n,!1)})),segmentOffset:n}}(i,r),l=a(n,s.waypoints),c=s.segmentOffset,p={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:r+c}};o.updateWaypoints(n,l,p)}))}bp.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var xp=Math.abs,wp=Math.round;function _p(e){return{x:e.x,y:e.y}}function Ep(e){return{x:e.x+e.width,y:e.y+e.height}}function Op(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:wp(e.x+e.width/2),y:wp(e.y+e.height/2)}}function Pp(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function kp(e,t,n){if("string"!=typeof t)throw new Error("axis must be in [x, y]");if("number"!=typeof n&&!1!==n)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function Sp(e){return e.children||[]}var Cp=Math.abs,Tp=Math.round;function Ap(e){function t(e,t){if(h(e)){for(var n=e.length;n--;)if(Cp(e[n]-t)<=10)return e[n]}else{var i=t%(e=+e);if(i<10)return t-i;if(i>e-10)return t-i+e}return t}function n(e,t){return e.waypoints?Zc(t,e):e.width?{x:Tp(e.width/2+e.x),y:Tp(e.height/2+e.y)}:void 0}e.on("connectionSegment.move.move",1500,(function(e){var i,r,o=function(e){var t=e.context,i=t.snapPoints,r=t.connection,o=r.waypoints,s=t.segmentStart,a=t.segmentStartIndex,l=t.segmentEnd,c=t.segmentEndIndex,p=t.axis;if(i)return i;var u=[o[a-1],s,l,o[c+1]];return a<2&&u.unshift(n(r.source,e)),c>o.length-3&&u.unshift(n(r.target,e)),t.snapPoints=i={horizontal:[],vertical:[]},_(u,(function(e){e&&(e=e.original||e,"y"===p&&i.horizontal.push(e.y),"x"===p&&i.vertical.push(e.x))})),i}(e),s=e.x,a=e.y;if(o){var l=s-(i=t(o.vertical,s)),c=a-(r=t(o.horizontal,a));z(e,{dx:e.dx-l,dy:e.dy-c,x:i,y:r}),(l||-1!==o.vertical.indexOf(s))&&kp(e,"x",i),(c||-1!==o.horizontal.indexOf(a))&&kp(e,"y",r)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,i=t&&n(t,e);yn(t)&&i&&i.x&&i.y&&(kp(e,"x",i.x),kp(e,"y",i.y))})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var i,r,o=e.context,s=function(e){var t=e.snapPoints,n=e.connection.waypoints,i=e.bendpointIndex;if(t)return t;var r=[n[i-1],n[i+1]];return e.snapPoints=t={horizontal:[],vertical:[]},_(r,(function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))})),t}(o),a=o.hover,l=a&&n(a,e),c=e.x,p=e.y;if(s){var u=c-(i=t(l?s.vertical.concat([l.x]):s.vertical,c)),d=p-(r=t(l?s.horizontal.concat([l.y]):s.horizontal,p));z(e,{dx:e.dx-u,dy:e.dy-d,x:e.x-u,y:e.y-d}),(u||-1!==s.vertical.indexOf(c))&&kp(e,"x",i),(d||-1!==s.horizontal.indexOf(p))&&kp(e,"y",r)}}))}Ap.$inject=["eventBus"];const Mp={__depends__:[Mc,jc],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Jc],bendpointMove:["type",rp],bendpointMovePreview:["type",dp],connectionSegmentMove:["type",bp],bendpointSnapping:["type",Ap]};function Dp(e,t,n,i){function r(e,t){return i.allowed("connection.create",{source:e,target:t})}e.on("connect.hover",(function(e){var t,n=e.context,i=n.start,o=e.hover;if(n.hover=o,!d(t=n.canExecute=r(i,o))){if(!1!==t)return n.source=i,void(n.target=o);d(t=n.canExecute=r(o,i))||!1!==t&&(n.source=o,n.target=i)}})),e.on(["connect.out","connect.cleanup"],(function(e){var t=e.context;t.hover=null,t.source=null,t.target=null,t.canExecute=!1})),e.on("connect.end",(function(e){var t=e.context,i=t.canExecute,r=t.connectionStart,o={x:e.x,y:e.y},s=t.source,a=t.target;if(!i)return!1;var l=null,c={connectionStart:Rp(t)?o:r,connectionEnd:Rp(t)?r:o};f(i)&&(l=i),t.connection=n.connect(s,a,l,c)})),this.start=function(e,n,i,r){f(i)||(r=i,i=On(n)),t.init(e,"connect",{autoActivate:r,data:{shape:n,context:{start:n,connectionStart:i}}})}}function Rp(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}Dp.$inject=["eventBus","dragging","modeling","rules"];var Np="connect-ok",$p="connect-not-ok";function jp(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",(function(e){var t=e.context,n=t.canExecute,r=t.hover,o=t.source,s=t.start,a=t.startPosition,l=t.target,c=t.connectionStart||a,p=t.connectionEnd||{x:e.x,y:e.y},u=c,d=p;Rp(t)&&(u=p,d=c),i.drawPreview(t,n,{source:o||s,target:l||r,connectionStart:u,connectionEnd:d})})),t.on("connect.hover",900,(function(e){var t=e.context,i=e.hover,r=t.canExecute;null!==r&&n.addMarker(i,r?Np:$p)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,Np),n.removeMarker(t,$p))})),i&&t.on("connect.cleanup",(function(e){i.cleanUp(e.context)}))}jp.$inject=["injector","eventBus","canvas"];const Ip={__depends__:[is,jc,Mc],__init__:["connectPreview"],connect:["type",Dp],connectPreview:["type",jp]};function Lp(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Lp.$inject=["injector","canvas","graphicsFactory","elementFactory"],Lp.prototype.drawPreview=function(e,t,n){n=n||{};var i,r=e.connectionPreviewGfx,o=e.getConnection,s=n.source,a=n.target,l=n.waypoints,c=n.connectionStart,p=n.connectionEnd,u=n.noLayout,d=n.noCropping,h=n.noNoop,f=this;r||(r=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Re(r),o||(o=e.getConnection=function(e){var t={};return function(n){var i=JSON.stringify(n),r=t[i];return r||(r=t[i]=e.apply(null,arguments)),r}}((function(e,t,n){return f.getConnection(e,t,n)}))),t&&(i=o(t,s,a)),i?(i.waypoints=l||[],this._layouter&&!u&&(i.waypoints=this._layouter.layoutConnection(i,{source:s,target:a,connectionStart:c,connectionEnd:p,waypoints:n.waypoints||i.waypoints})),i.waypoints&&i.waypoints.length||(i.waypoints=[s?On(s):c,a?On(a):p]),this._connectionDocking&&(s||a)&&!d&&(i.waypoints=this._connectionDocking.getCroppedWaypoints(i,s,a)),this._graphicsFactory.drawConnection(r,i,{stroke:"var(--element-dragger-color)"})):!h&&this.drawNoopPreview(r,n)},Lp.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||On(n),o=t.connectionEnd||On(i),s=this.cropWaypoints(r,o,n,i);ke(e,this.createNoopConnection(s[0],s[1]))},Lp.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),s=i&&r.getShapePath(i),a=r.getConnectionPath({waypoints:[e,t]});return[e=n&&kn(o,a,!0)||e,t=i&&kn(s,a,!1)||t]},Lp.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ke(e.connectionPreviewGfx)},Lp.prototype.getConnection=function(e){var t=function(e){return f(e)?e:{}}(e);return this._elementFactory.createConnection(t)},Lp.prototype.createConnectionPreviewGfx=function(){var e=Le("g");return Te(e,{pointerEvents:"none"}),Me(e).add("djs-dragger"),ke(this._canvas.getActiveLayer(),e),e},Lp.prototype.createNoopConnection=function(e,t){return mt([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};const Bp={__init__:["connectionPreview"],connectionPreview:["type",Lp]};var qp=["marker-start","marker-mid","marker-end"],zp=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Fp(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i,this._clonedMarkers={};var r=this;t.on("drag.cleanup",(function(){r.cleanUp()}))}Fp.$inject=["elementRegistry","eventBus","canvas","styles"],Fp.prototype.cleanUp=function(){_(this._clonedMarkers,(function(e){Ke(e)})),this._clonedMarkers={}},Fp.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Fp.prototype.addDragger=function(e,t,n,i="djs-dragger"){var r=Ne(n=n||this.getGfx(e)),o=n.getBoundingClientRect();return this._cloneMarkers(ti(r),i),Te(r,this._styles.cls(i,[],{x:o.top,y:o.left})),ke(t,r),Te(r,"data-preview-support-element-id",e.id),r},Fp.prototype.addFrame=function(e,t){var n=Le("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ke(t,n),Te(n,"data-preview-support-element-id",e.id),n},Fp.prototype._cloneMarkers=function(e,t="djs-dragger"){var n=this;if(e.childNodes)for(var i=0;i!function(e){return e.hidden}(e))).forEach((e=>{let t;yn(e)?(t=this._graphicsFactory._createContainer("connection",Le("g")),this._graphicsFactory.drawConnection(ti(t),e)):(t=this._graphicsFactory._createContainer("shape",Le("g")),this._graphicsFactory.drawShape(ti(t),e),ii(t,e.x,e.y)),this._previewSupport.addDragger(e,o,t)})),n.forEach((({element:e,delta:t})=>{this._previewSupport.addDragger(e,o,void 0,"djs-dragging"),this._canvas.addMarker(e,"djs-element-hidden"),this._markers.push([e,"djs-element-hidden"]);const n=this._previewSupport.addDragger(e,o);yn(e)?ii(n,t.x,t.y):ii(n,e.x+t.x,e.y+t.y)})),i.forEach((e=>{this._previewSupport.addDragger(e,o,void 0,"djs-dragging"),this._canvas.addMarker(e,"djs-element-hidden"),this._markers.push([e,"djs-element-hidden"])})),r.forEach((({shape:e,bounds:t})=>{this._canvas.addMarker(e,"djs-hidden"),this._markers.push([e,"djs-hidden"]),this._previewSupport.addDragger(e,o,void 0,"djs-dragging");const n=this._graphicsFactory._createContainer("shape",Le("g"));this._graphicsFactory.drawShape(ti(n),e,{width:t.width,height:t.height}),ii(n,t.x,t.y),this._previewSupport.addDragger(e,o,n)}))}cleanUp(){Re(this._canvas.getLayer(Hp)),this._markers.forEach((([e,t])=>this._canvas.removeMarker(e,t))),this._markers=[],this._previewSupport.cleanUp()}show(){this._canvas.showLayer(Hp)}hide(){this._canvas.hideLayer(Hp)}}Up.$inject=["canvas","graphicsFactory","previewSupport"];const Wp={__depends__:[Vp],__init__:["complexPreview"],complexPreview:["type",Up]};var Gp=["top","bottom","left","right"],Qp=10;function Xp(e,t){function n(e){if(to(e)){var n=function(e){var t=On(e.label),n=On(e),i=Kp(n,t);if(r=i,-1===Gp.indexOf(r))return;var r;var o=function(e){var t=On(e),n=[].concat(e.incoming.map((function(e){return e.waypoints[e.waypoints.length-2]})),e.outgoing.map((function(e){return e.waypoints[1]}))).map((function(e){return Kp(t,e)}));return n}(e);if(e.host){var s=function(e){var t,n=e.host,i=On(e),r=Pn(i,n);t=r.indexOf("-")>=0?r.split("-"):[r];var o=Gp.filter((function(e){return-1===t.indexOf(e)}));return o}(e);o=o.concat(s)}var a=Gp.filter((function(e){return-1===o.indexOf(e)}));if(-1!==a.indexOf(i))return;return a[0]}(e);n&&function(e,n){var i=On(e),r=e.label,o=On(r);if(!r.parent)return;var s,a=wn(e);switch(n){case"top":s={x:i.x,y:a.top-Qp-r.height/2};break;case"left":s={x:a.left-Qp-r.width/2,y:i.y};break;case"bottom":s={x:i.x,y:a.bottom+Qp+r.height/2};break;case"right":s={x:a.right+Qp+r.width/2,y:i.y}}var l=ia(s,o);t.moveShape(r,l)}(e,n)}}hs.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],(function(e){var t=e.context,i=t.connection,r=i.source,o=i.target;!1!==(t.hints||{}).createElementsBehavior&&(n(r),n(o))})),this.postExecuted(["label.create"],(function(e){var t=e.context,i=t.shape;!1!==(t.hints||{}).createElementsBehavior&&n(i.labelTarget)})),this.postExecuted(["elements.create"],(function(e){var t=e.context,i=t.elements;!1!==(t.hints||{}).createElementsBehavior&&i.forEach((function(e){n(e)}))}))}function Kp(e,t){return Pn(t,e,5)}function Yp(e){hs.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(Tr(n,"bpmn:TextAnnotation")?e.position={x:t.x+t.width/2+75,y:t.y-50-n.height/2}:e.position={x:t.x+t.width+80+n.width/2,y:t.y+t.height/2})}),!0)}function Zp(e,t){e.invoke(hs,this),this.postExecute("shape.move",(function(e){var n=e.newParent,i=e.shape;_(w(i.incoming.concat(i.outgoing),(function(e){return Tr(e,"bpmn:Association")})),(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}i(Xp,hs),Xp.$inject=["eventBus","modeling"],i(Yp,hs),Yp.$inject=["eventBus"],i(Zp,hs),Zp.$inject=["injector","modeling"];function Jp(e,t){t.invoke(hs,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;1===(t=t.filter((function(e){return eu(e,e.host)}))).length&&t.map((function(e){return t.indexOf(e)})).forEach((function(i){var r=t[i];e.elements[i]=n._replaceShape(t[i],r)}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,i=e.newHost;if(1===t.length){var r=t[0];eu(r,i)&&(e.shapes=[n._replaceShape(r,i)])}}),!0)}function eu(e,t){return!vn(e)&&Ar(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function tu(e,t){function n(e){return w(e.attachers,(function(e){return Tr(e,"bpmn:BoundaryEvent")}))}hs.call(this,e),this.postExecute("connection.create",(function(e){var i=e.context.source,r=e.context.target,o=n(r);Tr(i,"bpmn:EventBasedGateway")&&Tr(r,"bpmn:ReceiveTask")&&o.length>0&&t.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var i=e.context.oldSource,r=e.context.newSource;Tr(i,"bpmn:Gateway")&&Tr(r,"bpmn:EventBasedGateway")&&_(r.outgoing,(function(e){var i=e.target,r=n(i);Tr(i,"bpmn:ReceiveTask")&&r.length>0&&t.removeElements(r)}))}))}function nu(e,t,n){function i(e){t.updateProperties(e,{isForCompensation:!0})}function r(e){t.updateProperties(e,{isForCompensation:void 0})}hs.call(this,e),this.preExecute("shape.replace",(function(e){const{newData:n,oldShape:i}=e;if(ru(e.oldShape)&&"bpmn:CompensateEventDefinition"!==n.eventDefinitionType||"bpmn:BoundaryEvent"!==n.type){const t=i.outgoing.find((({target:e})=>iu(e)));t&&t.target&&(e._connectionTarget=t.target)}else if(!ru(e.oldShape)&&"bpmn:CompensateEventDefinition"===n.eventDefinitionType&&"bpmn:BoundaryEvent"===n.type){const n=i.outgoing.find((({target:e})=>ou(e)));n&&n.target&&(e._connectionTarget=n.target),function(e){const n=e.outgoing.filter((e=>Tr(e,"bpmn:SequenceFlow")));t.removeElements(n)}(i)}}),!0),this.postExecuted("shape.replace",(function(e){const{_connectionTarget:n,newShape:i}=e;n&&t.connect(i,n)}),!0),this.preExecute("connection.create",(function(e){const n=e.connection,r=e.source,o=e.target;ru(r)&&ou(o)&&(i(o),function(e,n){const i=e.outgoing.filter((e=>Tr(e,"bpmn:Association"))),r=i.filter((e=>iu(e.target)&&!n.includes(e)));r.forEach((e=>t.removeConnection(e)))}(r,[n]))}),!0),this.postExecuted("connection.delete",(function(e){const t=e.source,n=e.target;ru(t)&&iu(n)&&r(n)}),!0),this.postExecuted("connection.reconnect",(function(e){const t=e.newTarget,n=e.oldSource,o=e.oldTarget;if(o!==t){const e=n;iu(o)&&r(o),ru(e)&&ou(t)&&i(t)}}),!0),this.postExecuted("element.updateProperties",(function(e){const{element:i}=e;iu(i)?(function(e){for(const i of e.incoming)n.canConnect(i.source,e)||t.removeConnection(i);for(const i of e.outgoing)n.canConnect(e,i.target)||t.removeConnection(i)}(i),function(e){const n=e.attachers.slice();if(!n.length)return;t.removeElements(n)}(i)):ou(i)&&function(e){const n=e.incoming.filter((e=>ru(e.source)));t.removeElements(n)}(i)}),!0)}function iu(e){const t=Mr(e);return t&&t.get("isForCompensation")}function ru(e){return e&&Tr(e,"bpmn:BoundaryEvent")&&Zr(e,"bpmn:CompensateEventDefinition")}function ou(e){return e&&Tr(e,"bpmn:Activity")&&!Yr(e)}function su(e,t){for(y(t)&&(t=[t]);e=e.parent;)if(Ar(e,t))return e;return null}function au(e){e.invoke(hs,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,i=t.shape;Tr(n,"bpmn:Lane")&&!Tr(i,"bpmn:Lane")&&(t.parent=su(n,"bpmn:Participant"))}))}function lu(e,t){hs.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context.shape;if(Tr(n,"bpmn:DataObjectReference")&&"label"!==n.type){var i=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=i}}))}Jp.$inject=["bpmnReplace","injector"],i(Jp,hs),Jp.prototype._replaceShape=function(e,t){var n,i=(n=Mr(e).eventDefinitions)&&n[0],r={type:"bpmn:BoundaryEvent",host:t};return i&&(r.eventDefinitionType=i.$type),this._bpmnReplace.replaceElement(e,r,{layoutConnection:!1})},tu.$inject=["eventBus","modeling"],i(tu,hs),i(nu,hs),nu.$inject=["eventBus","modeling","bpmnRules"],au.$inject=["injector"],i(au,hs),lu.$inject=["eventBus","bpmnFactory"],i(lu,hs);var cu=20,pu=20,uu=2e3;function du(e,t,n){function i(){var t=e.getRootElement();return Tr(t,"bpmn:Collaboration")?t:n.makeCollaboration()}hs.call(this,t),t.on(["create.start","shape.move.start"],uu,(function(t){var n=t.context,i=n.shape,r=e.getRootElement();if(Tr(i,"bpmn:Participant")&&Tr(r,"bpmn:Process")&&r.children.length){var o=r.children.filter((function(e){return!Tr(e,"bpmn:Group")&&!vn(e)&&!yn(e)}));if(o.length){var s=Et(o),a=function(e,t){t={width:t.width+40+30,height:t.height+40};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}(i,s);z(i,a),n.createConstraints=function(e,t){return t=wn(t),{bottom:t.top+e.height/2-pu,left:t.right-e.width/2+cu,top:t.bottom-e.height/2+pu,right:t.left+e.width/2-cu-30}}(i,s)}}})),t.on("create.start",uu,(function(n){var i=n.context.shape,r=e.getRootElement(),o=e.getGraphics(r);function s(e){e.element=r,e.gfx=o}Tr(i,"bpmn:Participant")&&Tr(r,"bpmn:Process")&&(t.on("element.hover",uu,s),t.once("create.cleanup",(function(){t.off("element.hover",s)})))})),this.preExecute("elements.create",uu,(function(e){var t,n=e.elements,r=e.parent,o=function(e){return b(e,(function(e){return Tr(e,"bpmn:Participant")}))}(n);o&&Tr(r,"bpmn:Process")&&(e.parent=i(),(t=e.hints=e.hints||{}).participant=o,t.process=r,t.processRef=Mr(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;Tr(n,"bpmn:Participant")&&Tr(t,"bpmn:Process")&&(e.parent=i(),e.process=t,e.processRef=Mr(n).get("processRef"))}),!0),this.execute("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,i=e.shape,r=t.participant;!n||r&&i!==r||Mr(i).set("processRef",Mr(n))}),!0),this.revert("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,i=e.processRef||t.processRef,r=e.shape,o=t.participant;!n||o&&r!==o||Mr(r).set("processRef",i)}),!0),this.postExecute("shape.create",(function(e){var t=e.hints||{},i=e.process||e.hints.process,r=e.shape,o=t.participant;if(i){var s=i.children.slice();o?r===o&&n.moveElements(s,{x:0,y:0},o):n.moveElements(s,{x:0,y:0},r)}}),!0)}du.$inject=["canvas","eventBus","modeling"],i(du,hs);var hu="__targetRef_placeholder";function fu(e,t){function n(e,n){var i=e.get("properties"),r=b(i,(function(e){return e.name===hu}));return!r&&n&&At(i,r=t.create("bpmn:Property",{name:hu})),r}function i(e,t){var i=n(e);i&&(function(e,t,n){return b(e.get("dataInputAssociations"),(function(e){return e!==n&&e.targetRef===t}))}(e,i,t)||Tt(e.get("properties"),i))}function r(e){var t,r=e.context,o=r.connection,s=o.businessObject,a=o.target,l=a&&a.businessObject,c=r.newTarget,p=c&&c.businessObject,u=r.oldTarget||r.target,d=u&&u.businessObject,h=o.businessObject;d&&d!==l&&i(d,s),p&&p!==l&&i(p,s),l?(t=n(l,!0),h.targetRef=t):h.targetRef=null}hs.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],mu(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],mu(r))}function mu(e){return function(t){if(Tr(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function gu(e){this._bpmnUpdater=e}function yu(e,t,n,i){function r(e){return e.children.filter((function(e){return Tr(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function o(e,i){var r=e.businessObject||e;if(i=i||n.filter((function(e){return Tr(e,"bpmn:Participant")&&Mr(e).processRef}))[0]){var o=i.businessObject||i;t.execute("dataStore.updateContainment",{dataStoreBo:r,dataStoreDi:Dr(e),newSemanticParent:o.processRef||o,newDiParent:Dr(i)})}}hs.call(this,i),t.registerHandler("dataStore.updateContainment",gu),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;Tr(n,"bpmn:DataStoreReference")&&"label"!==n.type&&(t.hints||(t.hints={}),t.hints.autoResize=!1)})),this.preExecute("elements.move",(function(e){var t=e.context,n=t.shapes;n.filter((function(e){return Tr(e,"bpmn:DataStoreReference")})).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!Tr(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context.shape,n=t.parent;Tr(t,"bpmn:DataStoreReference")&&"label"!==t.type&&Tr(n,"bpmn:Collaboration")&&o(t)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,i=t.oldParent,r=n.parent;Tr(i,"bpmn:Collaboration")||Tr(n,"bpmn:DataStoreReference")&&"label"!==n.type&&Tr(r,"bpmn:Collaboration")&&o(n,Tr(i,"bpmn:Participant")?i:function(e,t){for(;e.parent;){if(Tr(e.parent,t))return e.parent;e=e.parent}}(i,"bpmn:Participant"))})),this.postExecute("shape.delete",(function(t){var n=t.context.shape,i=e.getRootElement();Ar(n,["bpmn:Participant","bpmn:SubProcess"])&&Tr(i,"bpmn:Collaboration")&&r(i).filter((function(e){return function(e,t){var n=e.businessObject||e,i=t.businessObject||t;for(;n.$parent;){if(n.$parent===i.processRef||i)return!0;n=n.$parent}return!1}(e,n)})).forEach((function(e){o(e)}))})),this.postExecute("canvas.updateRoot",(function(e){var t=e.context,n=t.oldRoot,i=t.newRoot;r(n).forEach((function(e){Tr(i,"bpmn:Process")&&o(e,i)}))}))}fu.$inject=["eventBus","bpmnFactory"],i(fu,hs),gu.$inject=["bpmnUpdater"],gu.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},gu.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},yu.$inject=["canvas","commandStack","elementRegistry","eventBus"],i(yu,hs);var vu=Math.max,bu=Math.min;function xu(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function wu(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}}function _u(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return m(r)&&(i=(/top|left/.test(e)?bu:vu)(i,r)),m(o)&&(i=(/top|left/.test(e)?vu:bu)(i,o)),i}function Eu(e,t){return void 0!==e?e:20}function Ou(e){return!e.waypoints&&"label"!==e.type}function Pu(e,t){var n;if((n=void 0===e.length?w(e.children,Ou):e).length)return function(e,t){var n,i,r,o;return"object"==typeof t?(n=Eu(t.left),i=Eu(t.right),r=Eu(t.top),o=Eu(t.bottom)):n=i=r=o=Eu(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}(Et(n),t)}var ku=Math.abs;var Su=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Cu=30;function Tu(e,t){return t=t||[],e.children.filter((function(e){Tr(e,"bpmn:Lane")&&(Tu(e,t),t.push(e))})),t}function Au(e){return e.children.filter((function(e){return Tr(e,"bpmn:Lane")}))}function Mu(e){return su(e,Su)||e}function Du(e,t){var n=Mu(e),i=Tu(n,Tr(n,"bpmn:Process")?[]:[n]),r=wn(e),o=wn(t),s=function(e,t){return xu(wn(t),wn(e))}(e,t),a=[],l=Kr(e);return i.forEach((function(t){if(t!==e){var n=l?0:s.top,i=l?s.right:0,c=l?0:s.bottom,p=l?s.left:0,u=wn(t);s.top&&(ku(u.bottom-r.top)<10&&(c=o.top-u.bottom),ku(u.top-r.top)<5&&(n=o.top-u.top)),s.left&&(ku(u.right-r.left)<10&&(i=o.left-u.right),ku(u.left-r.left)<5&&(p=o.left-u.left)),s.bottom&&(ku(u.top-r.bottom)<10&&(n=o.bottom-u.top),ku(u.bottom-r.bottom)<5&&(c=o.bottom-u.bottom)),s.right&&(ku(u.left-r.right)<10&&(p=o.right-u.left),ku(u.right-r.right)<5&&(i=o.right-u.right)),(n||i||c||p)&&a.push({shape:t,newBounds:wu(t,{top:n,right:i,bottom:c,left:p})})}})),a}function Ru(e,t){hs.call(this,e),this.postExecuted("shape.delete",500,(function(e){var n=e.context,i=n.hints,r=n.shape,o=n.oldParent;Tr(r,"bpmn:Lane")&&(i&&i.nested||function(e,n){var i,r,o,s,a,l=Kr(e),c=Au(n),p=[],u=[],d=[],h=[];xt(c,(function(t){return l?t.y>e.y?u.push(t):p.push(t):t.x>e.x?h.push(t):d.push(t),t.children})),c.length&&(i=l?u.length&&p.length?e.height/2:e.height:h.length&&d.length?e.width/2:e.width,p.length&&(r=t.calculateAdjustments(p,"y",i,e.y-10),t.makeSpace(r.movingShapes,r.resizingShapes,{x:0,y:i},"s")),u.length&&(o=t.calculateAdjustments(u,"y",-i,e.y+e.height+10),t.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-i},"n")),d.length&&(s=t.calculateAdjustments(d,"x",i,e.x-10),t.makeSpace(s.movingShapes,s.resizingShapes,{x:i,y:0},"e")),h.length&&(a=t.calculateAdjustments(h,"x",-i,e.x+e.width+10),t.makeSpace(a.movingShapes,a.resizingShapes,{x:-i,y:0},"w")))}(r,o))}))}Ru.$inject=["eventBus","spaceTool"],i(Ru,hs);function Nu(e,t){t.invoke(hs,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;t.filter((function(e){return $u(e,e.host)})).map((function(e){return t.indexOf(e)})).forEach((function(i){e.elements[i]=n._replaceShape(t[i])}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,i=e.newHost;t.forEach((function(e,r){var o,s=e.host;$u(e,(o=s,-1!==t.indexOf(o)?s:i))&&(t[r]=n._replaceShape(e))}))}),!0)}function $u(e,t){return!vn(e)&&Tr(e,"bpmn:BoundaryEvent")&&!t}function ju(e,t,n){function i(e,i,r){var o,s,a,l,c,p,u,d,h=i.waypoints,f=e.outgoing.slice(),g=e.incoming.slice(),y=Bc(h,d=m(r.width)?On(r):r);if(y){if(o=h.slice(0,y.index),s=h.slice(y.index+(y.bendpoint?1:0)),!o.length||!s.length)return;a=y.bendpoint?h[y.index]:d,1!==o.length&&Iu(e,o[o.length-1])||o.push(Lu(a)),1!==s.length&&Iu(e,s[0])||s.unshift(Lu(a))}l=i.source,c=i.target,t.canConnect(l,e,i)&&(n.reconnectEnd(i,e,o||d),p=i),t.canConnect(e,c,i)&&(p?u=n.connect(e,c,{type:i.type,waypoints:s}):(n.reconnectStart(i,e,s||d),u=i));var v=[].concat(p&&w(g,(function(e){return e.source===p.source}))||[],u&&w(f,(function(e){return e.target===u.target}))||[]);v.length&&n.removeElements(v)}hs.call(this,e),this.preExecute("elements.move",(function(e){var n=e.newParent,i=e.shapes,r=e.delta,o=i[0];if(o&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var s=On(o),a={x:s.x+r.x,y:s.y+r.y},l=b(n.children,(function(e){return t.canInsert(i,e)&&Bc(e.waypoints,a)}));l&&(e.targetFlow=l,e.position=a)}}),!0),this.postExecuted("elements.move",(function(e){var t=e.shapes,n=e.targetFlow,r=e.position;n&&i(t[0],n,r)}),!0),this.preExecute("shape.create",(function(e){var n=e.parent,i=e.shape;t.canInsert(i,n)&&(e.targetFlow=n,e.parent=n.parent)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.targetFlow,r=e.position;n&&i(t,n,r)}),!0)}function Iu(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function Lu(e){return z({},e)}function Bu(e,t){hs.call(this,e),this.preExecuted("connection.create",(function(e){var n=e.context,i=n.connection,r=n.source,o=n.target,s=n.hints;if((!s||!1!==s.createElementsBehavior)&&qu(i)){(Tr(r,"bpmn:EventBasedGateway")?o.incoming.filter((e=>e!==i&&qu(e))):o.incoming.filter((e=>e!==i&&qu(e)&&Tr(e.source,"bpmn:EventBasedGateway")))).forEach((function(e){t.removeConnection(e)}))}})),this.preExecuted("shape.replace",(function(e){var n=e.context.newShape;Tr(n,"bpmn:EventBasedGateway")&&n.outgoing.filter(qu).reduce((function(e,t){return e.includes(t.target)?e:e.concat(t.target)}),[]).forEach((function(e){e.incoming.filter(qu).forEach((function(i){const r=e.incoming.filter(qu).filter((function(e){return e.source===n}));(i.source!==n||r.length>1)&&t.removeConnection(i)}))}))}))}function qu(e){return Tr(e,"bpmn:SequenceFlow")}Nu.$inject=["bpmnReplace","injector"],i(Nu,hs),Nu.prototype._replaceShape=function(e){var t,n,i=(n=Mr(e).eventDefinitions)&&n[0];return t=i?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:i.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},i(ju,hs),ju.$inject=["eventBus","bpmnRules","modeling"],Bu.$inject=["eventBus","modeling"],i(Bu,hs);var zu=1500;function Fu(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],zu,(function(t){var i=t.context.shape||t.shape,r=t.hover;Tr(r,"bpmn:Lane")&&!Ar(i,["bpmn:Lane","bpmn:Participant"])&&(t.hover=Mu(r),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();r!==o&&(i.labelTarget||Ar(i,["bpmn:Group","bpmn:TextAnnotation"]))&&(t.hover=o,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],zu,(function(t){var n=t.hover;Tr(n,"bpmn:Lane")&&(t.hover=Mu(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],zu,(function(t){var n=t.context,i=t.hover,r=n.type;Tr(i,"bpmn:Lane")&&/reconnect/.test(r)&&(t.hover=Mu(i)||i,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],zu,(function(e){var t=e.context,n=t.start;Tr(n,"bpmn:Lane")&&(t.start=Mu(n)||n)})),t.on("shape.move.start",2e3,(function(e){var t=e.shape;Tr(t,"bpmn:Lane")&&(e.shape=Mu(t)||t)})),t.on("spaceTool.move",2e3,(function(e){var t=e.hover;t&&Tr(t,"bpmn:Lane")&&(e.hover=Mu(t))}))}Fu.$inject=["elementRegistry","eventBus","canvas"];function Vu(e,t,n,i,r,o){function s(e,t,i){var r=n.filter((function(e){return Tr(e,"bpmn:Group")})).filter((function(e){return e.businessObject!==i}));t&&!function(e,t){return e.some((function(e){var n=Mr(e);return(n.categoryValueRef&&n.categoryValueRef.$parent)===t}))}(r,t)&&function(e){var t=e.$parent;t&&(Tt(t.get("rootElements"),e),e.$parent=null)}(t),e&&!function(e,t){return e.some((function(e){return Mr(e).categoryValueRef===t}))}(r,e)&&function(e){var t=e.$parent;t&&(Tt(t.get("categoryValue"),e),e.$parent=null)}(e)}function a(e,n){return function(e,t,n){return At(t.get("categoryValue"),e),e.$parent=t,At(n.get("rootElements"),t),t.$parent=n,e}(e,n,t.getDefinitions())}function l(n,i){var r=Mr(n),o=r.categoryValueRef;o||(o=r.categoryValueRef=i.categoryValue=i.categoryValue||function(e){return e.create("bpmn:CategoryValue")}(e));var s=o.$parent;s||(s=o.$parent=i.category=i.category||function(e){return e.create("bpmn:Category")}(e)),a(o,s,t.getDefinitions())}function c(e,t){var n=t.category,i=t.categoryValue,r=Mr(e);i?(r.categoryValueRef=null,s(i,n,r)):s(null,r.categoryValueRef.$parent,r)}function p(t,n){var i=e.create(t.$type);return o.copyElement(t,i,null,n)}r.invoke(hs,this),this.execute("label.create",(function(e){var t=e.context,n=t.labelTarget;Tr(n,"bpmn:Group")&&l(n,t)})),this.revert("label.create",(function(e){var t=e.context,n=t.labelTarget;Tr(n,"bpmn:Group")&&c(n,t)})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,i=Mr(n);if(Tr(n,"bpmn:Group")&&!n.labelTarget){var r=t.categoryValue=i.categoryValueRef;r&&(s(r,t.category=r.$parent,i),i.categoryValueRef=null)}})),this.reverted("shape.delete",(function(e){var t=e.context,n=t.shape;if(Tr(n,"bpmn:Group")&&!n.labelTarget){var i=t.category,r=t.categoryValue,o=Mr(n);r&&(o.categoryValueRef=r,a(r,i))}})),this.execute("shape.create",(function(e){var t=e.context,n=t.shape;Tr(n,"bpmn:Group")&&!n.labelTarget&&Mr(n).categoryValueRef&&l(n,t)})),this.reverted("shape.create",(function(e){var t=e.context,n=t.shape;Tr(n,"bpmn:Group")&&!n.labelTarget&&Mr(n).categoryValueRef&&c(n,t)})),i.on("copyPaste.copyElement",770,(function(e){var t=e.descriptor,n=e.element;if(Tr(n,"bpmn:Group")&&!n.labelTarget){var i=Mr(n);if(i.categoryValueRef){var r=i.categoryValueRef;t.categoryValue=p(r,!0),r.$parent&&(t.category=p(r.$parent,!0))}}})),i.on("copyPaste.pasteElement",770,(function(e){var t=e.descriptor,n=t.businessObject,i=t.categoryValue,r=t.category;i&&(i=n.categoryValueRef=p(i)),r&&(i.$parent=p(r)),delete t.category,delete t.categoryValue}))}function Hu(e,t,n,i){var r,o,s,a;return 0==(r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y))?null:(o=e.y-n.y,s=e.x-n.x,a=((i.x-n.x)*o-(i.y-n.y)*s)/r,{x:Math.round(e.x+a*(t.x-e.x)),y:Math.round(e.y+a*(t.y-e.y))})}function Uu(e){function t(e,t,n){var i,r={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},s=Hu(e,t,n,r),a=Hu(e,t,n,o);i=s&&a?Wu(s,n)>Wu(a,n)?a:s:s||a,e.original=i}e.on("bpmnElement.added",(function(e){var n,i,r=e.element;r.waypoints&&(t((i=(n=r).waypoints)[0],i[1],On(n.source)),t(i[i.length-1],i[i.length-2],On(n.target)))}))}function Wu(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Gu(e){hs.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],(function(e){var n=e.context.shape,i=Mr(n),r=Dr(n);if(Ar(i,t)){var o=r.get("isHorizontal");void 0===o&&(o=!0),r.set("isHorizontal",o)}}))}Vu.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],i(Vu,hs),Uu.$inject=["eventBus"],Gu.$inject=["eventBus"],i(Gu,hs);var Qu=Math.sqrt,Xu=Math.min,Ku=Math.max,Yu=Math.abs;function Zu(e){return Math.pow(e,2)}function Ju(e,t){return Qu(Zu(e.x-t.x)+Zu(e.y-t.y))}function ed(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,s=n.x-e.x,a=n.y-e.y,l=r*r+o*o,c=(r*s+o*a)/l,p=c*c-(s*s+a*a-i*i)/l;if(p<0&&p>-1e-6&&(p=0),p<0)return[];var u=Qu(p),d=-c+u,h=-c-u,f={x:e.x-r*d,y:e.y-o*d};return 0===p?[f]:[f,{x:e.x-r*h,y:e.y-o*h}].filter((function(n){return function(e,t,n){return td(e.x,t.x,n.x)&&td(e.y,t.y,n.y)}(n,e,t)}))}function td(e,t,n){return e>=Xu(t,n)-nd&&e<=Ku(t,n)+nd}var nd=.1;function id(e,t){return Yu(e.x-t.x)<=nd&&Yu(e.y-t.y)<=nd}function rd(e,t,n,i){var r=0,o=0,s={point:e,delta:{x:0,y:0}},a=function(e,t){var n,i,r,o,s,a,l,c,p,u,d,h,f=0;for(f=0;f line intersections");1===a.length&&(l={type:"bendpoint",position:a[0],segmentIndex:f,bendpointIndex:id(n,a[0])?f:f+1}),2===a.length&&(d=a[0],h=a[1],l={type:"segment",position:s={x:(d.x+h.x)/2,y:(d.y+h.y)/2},segmentIndex:f,relativeLocation:Ju(n,s)/Ju(n,i)}),c=Ju(l.position,e),(!u||p>c)&&(u=l,p=c)}return u}(e,n),l=a.segmentIndex,c=function(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var s=i.segmentMove.segmentStartIndex,a=i.segmentMove.newSegmentStartIndex;return r===s?a:r>=a?r+o=p&&(l=c?r+1:r-1),rt.length-2||null===c)return s;var p,u,d,h,f,m,g=sd(n,l),y=sd(t,c),v=a.position,b=(h=v,f=Hc((d=g)[0],d[1]),m=Hc(d[0],h),0===f?0:m/f),x=(p=y,u=zc(g),zc(p)-u);if("bendpoint"===a.type){var w=t.length-n.length,_=a.bendpointIndex,E=n[_];if(-1!==t.indexOf(E))return s;if(0===w){var O=t[_];return{delta:{x:r=O.x-a.position.x,y:o=O.y-a.position.y},point:{x:e.x+r,y:e.y+o}}}w<0&&0!==_&&_{Mr(e.context.element)===e.context.moddleElement&&r(e)})),this.postExecute(["shape.create","connection.create"],(function(e){var n=e.context;if(!1!==(n.hints||{}).createElementsBehavior){var i=n.shape||n.connection;!vn(i)&&eo(i)&&oo(i)&&t.updateLabel(i,oo(i))}})),this.postExecute("shape.delete",(function(e){var n=e.context,i=n.labelTarget,r=n.hints||{};i&&!1!==r.unsetLabel&&t.updateLabel(i,null,null,{removeShape:!1})})),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var n=e.context;if(!1!==(n.hints||{}).labelBehavior){var i,r=n.connection.label;r&&r.parent&&(i=o(e),t.moveShape(r,i))}})),this.postExecute(["shape.replace"],(function(e){var t=e.context,n=t.newShape,i=t.oldShape,r=Mr(n);r&&eo(r)&&i.label&&n.label&&(n.label.x=i.label.x,n.label.y=i.label.y)})),this.postExecute("shape.resize",(function(e){var n,i=e.context,r=i.shape,o=i.newBounds,s=i.oldBounds;if(to(r)){var a=r.label,l=function(e,t){if(!t.length)return;var n=function(e,t){var n=t.map((function(t){return{line:t,distance:Vc(e,t)}}));return R(n,"distance")[0].line}(e,t);return Fc(e,n)}(On(a),[[{x:(n=s).x,y:n.y},{x:n.x+(n.width||0),y:n.y}],[{x:n.x+(n.width||0),y:n.y},{x:n.x+(n.width||0),y:n.y+(n.height||0)}],[{x:n.x,y:n.y+(n.height||0)},{x:n.x+(n.width||0),y:n.y+(n.height||0)}],[{x:n.x,y:n.y},{x:n.x,y:n.y+(n.height||0)}]]),c=function(e,t,n){var i=ad(e,t,n);return xn(ia(i,e))}(l,s,o);t.moveShape(a,c)}}))}function dd(e,t){function n(e,t){var n=e.context,i=n.connection,r=z({},n.hints),o=n.newWaypoints||i.waypoints,s=n.oldWaypoints;return void 0===r.startChanged&&(r.startChanged=!!r.connectionStart),void 0===r.endChanged&&(r.endChanged=!!r.connectionEnd),function(e,t,n,i){return rd(e,t,n,i).point}(t,o,s,r)}hs.call(this,e),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var i=e.context.connection,r=i.outgoing;i.incoming.forEach((function(i){var r=i.waypoints[i.waypoints.length-1],o=n(e,r),s=[].concat(i.waypoints.slice(0,-1),[o]);t.updateWaypoints(i,s)})),r.forEach((function(i){var r=i.waypoints[0],o=n(e,r),s=[].concat([o],i.waypoints.slice(1));t.updateWaypoints(i,s)}))})),this.postExecute(["connection.move"],(function(e){var n=e.context,i=n.connection,r=i.outgoing,o=i.incoming,s=n.delta;o.forEach((function(e){var n=e.waypoints[e.waypoints.length-1],i={x:n.x+s.x,y:n.y+s.y},r=[].concat(e.waypoints.slice(0,-1),[i]);t.updateWaypoints(e,r)})),r.forEach((function(e){var n=e.waypoints[0],i={x:n.x+s.x,y:n.y+s.y},r=[].concat([i],e.waypoints.slice(1));t.updateWaypoints(e,r)}))}))}function hd(e,t,n){var i=vd(e),r=bd(i,t),o=i[0];return r.length?r[r.length-1]:ad(o.original||o,n,t)}function fd(e,t,n){var i=vd(e),r=bd(i,t),o=i[i.length-1];return r.length?r[0]:ad(o.original||o,n,t)}function md(e,t,n){var i=vd(e),r=yd(t,n),o=i[0];return ad(o.original||o,r,t)}function gd(e,t,n){var i=vd(e),r=yd(t,n),o=i[i.length-1];return ad(o.original||o,r,t)}function yd(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function vd(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function bd(e,t){return w(S(e,xd),(function(e){return function(e,t){return"intersect"===Pn(t,e,1)}(e,t)}))}function xd(e){return e.original||e}function wd(e,t){hs.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,i=e.newShape;if(function(e,t){return Tr(e,"bpmn:Participant")&&Xr(e)&&Tr(t,"bpmn:Participant")&&!Xr(t)}(n,i)){var r,o,s,a,l=(o=_t([r=n],!1),s=[],a=[],o.forEach((function(e){e!==r&&(e.incoming.forEach((function(e){Tr(e,"bpmn:MessageFlow")&&s.push(e)})),e.outgoing.forEach((function(e){Tr(e,"bpmn:MessageFlow")&&a.push(e)})))}),[]),{incoming:s,outgoing:a});l.incoming.forEach((function(e){var r=fd(e,i,n);t.reconnectEnd(e,i,r)})),l.outgoing.forEach((function(e){var r=hd(e,i,n);t.reconnectStart(e,i,r)}))}}),!0)}i(ud,hs),ud.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],i(dd,hs),dd.$inject=["eventBus","modeling"],wd.$inject=["eventBus","modeling"],i(wd,hs);const _d=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Ed(e){const t=Mr(e);if(!(Tr(t,"bpmn:BoundaryEvent")||Tr(t,"bpmn:StartEvent")&&Yr(t.$parent)))return!1;const n=t.get("eventDefinitions");return!(!n||!n.length)&&_d.some((e=>Tr(n[0],e)))}function Od(e){return Tr(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Pd(e,t){e.invoke(hs,this),this.postExecuted("shape.replace",(function(e){const n=e.context.oldShape,i=e.context.newShape,r=e.context.hints;if(!Ed(i))return;const o=Od(i);if(r.targetElement&&void 0!==r.targetElement[o])return;const s=Mr(n).get(o);s!==Mr(i).get(o)&&t.updateProperties(i,{[o]:s})}))}function kd(e,t){hs.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,i=Dr(n),r=i&&i.get("label");r&&r.get("bounds")&&t.updateModdleProperties(n,r,{bounds:void 0})}),!0)}function Sd(e,t,n){hs.call(this,e),this.preExecute("shape.delete",(function(e){var i=e.context.shape;if(1===i.incoming.length&&1===i.outgoing.length){var r=i.incoming[0],o=i.outgoing[0];if(Tr(r,"bpmn:SequenceFlow")&&Tr(o,"bpmn:SequenceFlow")&&t.canConnect(r.source,o.target,r)){var s=function(e,t){var n=Hu(Cd(e[e.length-2]),Cd(e[e.length-1]),Cd(t[1]),Cd(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Cd(e[0]),Cd(t[t.length-1])]}(r.waypoints,o.waypoints);n.reconnectEnd(r,o.target,s)}}}))}function Cd(e){return e.original||e}function Td(e,t){hs.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;Tr(t,"bpmn:Participant")&&(e.collaborationRoot=n)}),!0),this.postExecute("shape.delete",(function(e){var n=e.collaborationRoot;n&&!n.businessObject.participants.length&&t.makeProcess()}),!0)}function Ad(e,t,n,i){hs.call(this,e);var r=i.get("dragging",!1);function o(e){var i,r,o=e.source,s=e.target;e.parent&&(Tr(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,s)||(r=!0),n.canConnectMessageFlow(o,s)&&(i="bpmn:MessageFlow")),Tr(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,s)||(r=!0),n.canConnectSequenceFlow(o,s)&&(i="bpmn:SequenceFlow")),r&&t.removeConnection(e),i&&t.connect(o,s,{type:i,waypoints:e.waypoints.slice()}))}this.postExecuted("elements.move",(function(e){_(e.closure.allConnections,o)}),!0),this.preExecute("connection.reconnect",(function(e){var i,o,s=e.context,a=s.connection,l=s.newSource||a.source,c=s.newTarget||a.target;(i=n.canConnect(l,c))&&i.type!==a.type&&(o=t.connect(l,c,{type:i.type,associationDirection:i.associationDirection,waypoints:a.waypoints.slice()}),a.parent&&t.removeConnection(a),s.connection=o,r&&function(e,t){var n,i=r.context(),o=i&&i.payload.previousSelection;if(!o||!o.length)return;if(n=o.indexOf(e),-1===n)return;o.splice(n,1,t)}(a,o))})),this.postExecuted("element.updateProperties",(function(e){var n,i=e.context,r=i.properties,o=i.element,s=o.businessObject;r.default&&(n=b(o.outgoing,N({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),r.conditionExpression&&s.sourceRef.default===s&&t.updateProperties(o.source,{default:void 0})}))}function Md(e,t,n,i,r,o){i.invoke(hs,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,(function(e){var n=e.context,i=n.parent,r=n.elements,o=O(r,(function(e,n){var r=t.canReplace([n],n.host||n.parent||i);return r?e.concat(r.replacements):e}),[]);o.length&&this._replaceElements(r,o)}),this),this.postExecuted(["elements.move"],500,(function(e){var n=e.context,i=n.newParent,r=n.newHost,o=[];_(n.closure.topLevel,(function(e){o=Yr(e)?o.concat(e.children):o.concat(e)})),1===o.length&&r&&(i=r);var s=t.canReplace(o,i);s&&this._replaceElements(o,s.replacements,r)}),this),this.postExecute(["shape.replace"],1500,(function(e){var n,i=e.context,r=i.oldShape,o=i.newShape,s=r.attachers;s&&s.length&&(n=t.canReplace(s,o),this._replaceElements(s,n.replacements))}),this),this.postExecuted(["shape.replace"],1500,(function(e){var t=e.context,n=t.oldShape,i=t.newShape;r.unclaimId(n.businessObject.id,n.businessObject),r.updateProperties(i,{id:n.id})}))}Pd.$inject=["injector","modeling"],i(Pd,hs),i(kd,hs),kd.$inject=["eventBus","modeling"],i(Sd,hs),Sd.$inject=["eventBus","bpmnRules","modeling"],Td.$inject=["eventBus","modeling"],i(Td,hs),i(Ad,hs),Ad.$inject=["eventBus","modeling","bpmnRules","injector"],i(Md,hs),Md.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;_(t,(function(t){var r={type:t.newElementType},o=n.get(t.oldElementId),s=e.indexOf(o);e[s]=i.replaceElement(o,r,{select:!1})})),t&&r.select(e)},Md.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Dd={width:140,height:120},Rd={width:300,height:60},Nd={width:60,height:300},$d={width:300,height:150},jd={width:150,height:300},Id={width:140,height:120},Ld={width:50,height:30};function Bd(e){e.on("resize.start",1500,(function(e){var t=e.context,n=t.shape,i=t.direction,r=t.balanced;(Tr(n,"bpmn:Lane")||Tr(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var i=Mu(e),r=!0,o=!0,s=Tu(i,[i]),a=wn(e),l={},c={},p=Kr(e),u=p?Rd:Nd;/n/.test(t)?c.top=a.bottom-u.height:/e/.test(t)?c.right=a.left+u.width:/s/.test(t)?c.bottom=a.top+u.height:/w/.test(t)&&(c.left=a.right-u.width);s.forEach((function(e){var i=wn(e);/n/.test(t)&&(p&&i.topa.right+10&&(o=!1),n&&qd(a.right-i.left)<10&&Hd(l,"right",i.right-u.width),qd(a.right-i.right)<5&&Ud(c,"right",i.left+u.width)),/s/.test(t)&&(p&&i.bottom>a.bottom+10&&(o=!1),n&&qd(a.bottom-i.top)<10&&Hd(l,"bottom",i.bottom-u.height),qd(a.bottom-i.bottom)<5&&Ud(c,"bottom",i.top+u.height)),/w/.test(t)&&(!p&&i.left=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return(o=Au(r)).length?eh(o,t,n):r}Yd.$inject=["eventBus"];var th=180,nh=160;function ih(e,t,n,i,r,o,s){hs.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=s;var a=this;function l(e){return Tr(e,"bpmn:SubProcess")&&!Xr(e)}function c(t){var n=t.shape,i=t.newRootElement,r=Mr(n);i=a._addDiagram(i||r),t.newRootElement=e.addRootElement(i)}function p(t){var n=Mr(t.shape);a._removeDiagram(n);var i=t.newRootElement=s.get(_s(n));e.removeRootElement(i)}this.executed("shape.create",(function(e){l(e.shape)&&c(e)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.newRootElement;n&&t.children&&(a._showRecursively(t.children),a._moveChildrenToShape(t,n))}),!0),this.reverted("shape.create",(function(e){l(e.shape)&&p(e)}),!0),this.preExecuted("shape.delete",(function(e){var t=e.shape;if(l(t)){var i=s.get(_s(t));i&&n.removeElements(i.children.slice())}}),!0),this.executed("shape.delete",(function(e){l(e.shape)&&p(e)}),!0),this.reverted("shape.delete",(function(e){l(e.shape)&&c(e)}),!0),this.preExecuted("shape.replace",(function(t){var n=t.oldShape,i=t.newShape;l(n)&&l(i)&&(t.oldRoot=e.removeRootElement(_s(n)))}),!0),this.postExecuted("shape.replace",(function(t){var i=t.newShape,r=t.oldRoot,o=e.findRoot(_s(i));if(r&&o){var s=r.children;n.moveElements(s,{x:0,y:0},o)}}),!0),this.executed("element.updateProperties",(function(e){var t=e.element;if(Tr(t,"bpmn:SubProcess")){var n=e.properties,i=e.oldProperties.id,r=n.id;if(i!==r){if(Os(t))return s.updateId(t,Es(r)),void s.updateId(i,r);s.get(Es(i))&&s.updateId(Es(i),Es(r))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(Tr(t,"bpmn:SubProcess")){var n=e.properties,i=e.oldProperties.id,r=n.id;if(i!==r){if(Os(t))return s.updateId(t,Es(i)),void s.updateId(r,i);var o=s.get(Es(r));o&&s.updateId(o,Es(i))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(Os(n)){var i=n,r=s.get(ws(i));r&&r!==i&&t.fire("element.changed",{element:r})}})),this.executed("shape.toggleCollapse",400,(function(e){var t=e.shape;Tr(t,"bpmn:SubProcess")&&(Xr(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",400,(function(e){var t=e.shape;Tr(t,"bpmn:SubProcess")&&(Xr(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",600,(function(e){var t=e.shape;if(Tr(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(Xr(t)?a._moveChildrenToShape(n,t):a._moveChildrenToShape(t,n))}}),!0),t.on("copyPaste.createTree",(function(e){var t=e.element,n=e.children;if(l(t)){var i=_s(t),r=s.get(i);r&&n.push.apply(n,r.children)}})),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,i=e.elements,r=n.parent;if(Tr(Dr(r),"bpmndi:BPMNPlane")){var o=ws(r),s=b(i,(function(e){return e.id===o}));s&&(t.parent=s.id)}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor;t.parent&&(l(t.parent)||t.parent.hidden)&&(t.hidden=!0)}))}function rh(e,t){e.invoke(hs,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,i=e.context.newShape;if(Tr(i,"bpmn:SubProcess")&&(Tr(n,"bpmn:Task")||Tr(n,"bpmn:CallActivity"))&&Xr(i)){var r,o={x:(r=i).x+r.width/6,y:r.y+r.height/2};t.createShape({type:"bpmn:StartEvent"},o,i)}}))}function oh(e){hs.call(this,e),this.preExecute("connection.create",(function(e){const{target:t}=e;Tr(t,"bpmn:TextAnnotation")&&(e.parent=t.parent)}),!0),this.preExecute(["shape.create","shape.resize","elements.move"],(function(e){const t=e.shapes||[e.shape];1===t.length&&Tr(t[0],"bpmn:TextAnnotation")&&(e.hints=e.hints||{},e.hints.autoResize=!1)}),!0)}function sh(e,t){hs.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!Xr(n)){var i=_t(n);i.forEach((function(e){var t=e.incoming.slice(),n=e.outgoing.slice();_(t,(function(e){r(e,!0)})),_(n,(function(e){r(e,!1)}))}))}function r(e,r){-1!==i.indexOf(e.source)&&-1!==i.indexOf(e.target)||(r?t.reconnectEnd(e,n,On(n)):t.reconnectStart(e,n,On(n)))}}),!0)}i(ih,hs),ih.prototype._moveChildrenToShape=function(e,t){var n,i=this._modeling,r=e.children;if(r){var o=(r=r.concat(r.reduce((function(t,n){return n.label&&n.label.parent!==e?t.concat(n.label):t}),[]))).filter((function(e){return!e.hidden}));if(o.length){var s=Et(o);if(t.x){var a=On(t),l=On(s);n={x:a.x-l.x,y:a.y-l.y}}else n={x:th-s.x,y:nh-s.y};i.moveElements(r,n,t,{autoResize:!1})}else i.moveElements(r,{x:0,y:0},t,{autoResize:!1})}},ih.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach((function(e){e.hidden=!!t,i=i.concat(e),e.children&&(i=i.concat(n._showRecursively(e.children,e.collapsed||t)))})),i},ih.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},ih.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});return i.$parent=r,n.createRoot({id:_s(e),type:e.$type,di:i,businessObject:e,collapsed:!0})},ih.prototype._removeDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams,n=b(t,(function(t){return t.plane.bpmnElement.id===e.id}));return t.splice(t.indexOf(n),1),n},ih.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],rh.$inject=["injector","modeling"],i(rh,hs),i(oh,hs),oh.$inject=["eventBus"],i(sh,hs),sh.$inject=["eventBus","modeling"];function ah(e,t,n){hs.call(this,e),this.executed(["shape.toggleCollapse"],500,(function(e){var t,n=e.context.shape;Tr(n,"bpmn:SubProcess")&&(n.collapsed?Dr(n).isExpanded=!1:((t=n.children).length&&t.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})),Dr(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],500,(function(e){var t=e.context.shape;t.collapsed?Dr(t).isExpanded=!1:Dr(t).isExpanded=!0})),this.postExecuted(["shape.toggleCollapse"],500,(function(e){var i,r=e.context.shape,o=t.getDefaultSize(r);i=r.collapsed?function(e,t){return{x:e.x+(e.width-t.width)/2,y:e.y+(e.height-t.height)/2,width:t.width,height:t.height}}(r,o):function(e,t){var n,i,r=e.children,o=t;return(n=Pu((i=r,i.filter((function(e){return!e.hidden}))).concat([e])))?(o.width=Math.max(n.width,o.width),o.height=Math.max(n.height,o.height),o.x=n.x+(n.width-o.width)/2,o.y=n.y+(n.height-o.height)/2):(o.x=e.x+(e.width-o.width)/2,o.y=e.y+(e.height-o.height)/2),o}(r,o),n.resizeShape(r,i,null,{autoResize:!r.collapsed&&"nwse"})}))}function lh(e,t,n,i){t.invoke(hs,this),this.preExecute("shape.delete",(function(e){var t=e.context.shape,r=t.businessObject;vn(t)||(Tr(t,"bpmn:Participant")&&Xr(t)&&n.ids.unclaim(r.processRef.id),i.unclaimId(r.id,r))})),this.preExecute("connection.delete",(function(e){var t=e.context.connection.businessObject;i.unclaimId(t.id,t)})),this.preExecute("canvas.updateRoot",(function(){var t=e.getRootElement(),i=t.businessObject;Tr(t,"bpmn:Collaboration")&&n.ids.unclaim(i.id)}))}function ch(e,t){hs.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context.connection,i=n.source;(function(e,t){if(!Tr(e,"bpmn:SequenceFlow"))return!1;var n=Mr(t),i=Mr(e);return n.get("default")===i})(n,i)&&t.updateProperties(i,{default:null})}))}i(ah,hs),ah.$inject=["eventBus","elementFactory","modeling"],i(lh,hs),lh.$inject=["canvas","injector","moddle","modeling"],i(ch,hs),ch.$inject=["eventBus","modeling"];function ph(e,t,n){var i;function r(){if(!i)throw new Error(n("out of bounds release"));return i}hs.call(this,e);var o=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(o,5e3,(function(e){(i=i||new uh).enter()})),this.postExecuted(o,500,(function(e){!function(){if(!i)throw new Error(n("out of bounds release"));var e=i.leave();e&&(t.updateLaneRefs(i.flowNodes,i.lanes),i=null)}()})),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],(function(e){var t=e.context.shape,n=r();t.labelTarget||(Tr(t,"bpmn:Lane")&&n.addLane(t),Tr(t,"bpmn:FlowNode")&&n.addFlowNode(t))}))}function uh(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(e){this.lanes.push(e)},this.addFlowNode=function(e){this.flowNodes.push(e)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}ph.$inject=["eventBus","modeling","translate"],i(ph,hs);const dh={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","compensateBoundaryEventBehaviour","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","nonInterruptingBehavior","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","textAnnotationBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","unsetDefaultFlowBehavior"],adaptiveLabelPositioningBehavior:["type",Xp],appendBehavior:["type",Yp],associationBehavior:["type",Zp],attachEventBehavior:["type",Jp],boundaryEventBehavior:["type",tu],compensateBoundaryEventBehaviour:["type",nu],createBehavior:["type",au],createDataObjectBehavior:["type",lu],createParticipantBehavior:["type",du],dataInputAssociationBehavior:["type",fu],dataStoreBehavior:["type",yu],deleteLaneBehavior:["type",Ru],detachEventBehavior:["type",Nu],dropOnFlowBehavior:["type",ju],eventBasedGatewayBehavior:["type",Bu],fixHoverBehavior:["type",Fu],groupBehavior:["type",Vu],importDockingFix:["type",Uu],isHorizontalFix:["type",Gu],labelBehavior:["type",ud],layoutConnectionBehavior:["type",dd],messageFlowBehavior:["type",wd],nonInterruptingBehavior:["type",Pd],removeElementBehavior:["type",Sd],removeEmbeddedLabelBoundsBehavior:["type",kd],removeParticipantBehavior:["type",Td],replaceConnectionBehavior:["type",Ad],replaceElementBehaviour:["type",Md],resizeBehavior:["type",Bd],resizeLaneBehavior:["type",Qd],rootElementReferenceBehavior:["type",Xd],spaceToolBehavior:["type",Yd],subProcessPlaneBehavior:["type",ih],subProcessStartEventBehavior:["type",rh],textAnnotationBehavior:["type",oh],toggleCollapseConnectionBehaviour:["type",sh],toggleElementCollapseBehaviour:["type",ah],unclaimIdBehavior:["type",lh],unsetDefaultFlowBehavior:["type",ch],updateFlowNodeRefsBehavior:["type",ph]};function hh(e,t){var n=Pn(e,t,-15);return"intersect"!==n?n:null}function fh(e){oc.call(this,e)}function mh(e){return!e||vn(e)}function gh(e){do{if(Tr(e,"bpmn:Process"))return Mr(e);if(Tr(e,"bpmn:Participant"))return Mr(e).processRef||Mr(e)}while(e=e.parent)}function yh(e){return Tr(e,"bpmn:TextAnnotation")}function vh(e){return Tr(e,"bpmn:Group")&&!e.labelTarget}function bh(e){return Tr(e,"bpmn:BoundaryEvent")&&Eh(e,"bpmn:CompensateEventDefinition")}function xh(e){return Mr(e).isForCompensation}function wh(e){for(var t=e;t=t.parent;){if(Tr(t,"bpmn:FlowElementsContainer"))return Mr(t);if(Tr(t,"bpmn:Participant"))return Mr(t).processRef}return null}function _h(e,t){return wh(e)===wh(t)}function Eh(e,t){return!!b(Mr(e).eventDefinitions||[],(function(e){return Tr(e,t)}))}function Oh(e,t){return(Mr(e).eventDefinitions||[]).every((function(e){return Tr(e,t)}))}function Ph(e,t){var n=function(e){for(var t=[];e;)(e=e.parent)&&t.push(e);return t}(t);return-1!==n.indexOf(e)}function kh(e,t,n){if(mh(e)||mh(t))return null;if(!Tr(n,"bpmn:DataAssociation")){if(qh(e,t))return{type:"bpmn:MessageFlow"};if(zh(e,t))return{type:"bpmn:SequenceFlow"}}var i=Fh(e,t);return i||(Bh(e,t)?{type:"bpmn:Association",associationDirection:"One"}:!!Lh(e,t)&&{type:"bpmn:Association",associationDirection:"None"})}function Sh(e,t){return!(!vn(e)&&!vh(e))||!(Tr(t,"bpmn:Participant")&&!Xr(t))&&(Tr(e,"bpmn:Participant")?Tr(t,"bpmn:Process")||Tr(t,"bpmn:Collaboration"):Ar(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:Tr(e,"bpmn:Lane")?Tr(t,"bpmn:Participant")||Tr(t,"bpmn:Lane"):!(Tr(e,"bpmn:BoundaryEvent")&&(n=e,!Mr(n).cancelActivity||!Ah(n)&&!Mh(n)))&&(Tr(e,"bpmn:FlowElement")&&!Tr(e,"bpmn:DataStoreReference")?Tr(t,"bpmn:FlowElementsContainer")?Xr(t):Ar(t,["bpmn:Participant","bpmn:Lane"]):Tr(e,"bpmn:DataStoreReference")&&Tr(t,"bpmn:Collaboration")?k(Mr(t).get("participants"),(function(e){return!!e.get("processRef")})):Ar(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Ar(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!Tr(e,"bpmn:MessageFlow")&&(Tr(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)));var n}function Ch(e){return Tr(e,"bpmn:Lane")}function Th(e){return!!function(e){return!vn(e)&&Tr(e,"bpmn:BoundaryEvent")}(e)||(!(!Tr(e,"bpmn:IntermediateThrowEvent")||!Ah(e))||Tr(e,"bpmn:IntermediateCatchEvent")&&Mh(e))}function Ah(e){var t=Mr(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Mh(e){return Dh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Dh(e,t){return t.some((function(t){return Eh(e,t)}))}function Rh(e,t,n,i){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var r=e[0];return!vn(r)&&(!!Th(r)&&(!Yr(t)&&(!(!Tr(t,"bpmn:Activity")||xh(t))&&(!(i&&!hh(i,t))&&(!function(e){return Tr(e,"bpmn:ReceiveTask")&&b(e.incoming,(function(e){return Tr(e.source,"bpmn:EventBasedGateway")}))}(t)&&"attach")))))}function Nh(e,t,n){if(!t)return!1;var i={replacements:[]};return _(e,(function(e){Yr(t)||Tr(e,"bpmn:StartEvent")&&"label"!==e.type&&Sh(e,t)&&(function(e){return e&&!1!==Mr(e).isInterrupting}(e)||i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return Zr(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return Zr(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return Zr(e,"bpmn:CompensateEventDefinition")}(e))&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),Dh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&Tr(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),Tr(t,"bpmn:Transaction")||Eh(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(Tr(e,"bpmn:EndEvent")&&Sh(e,t)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),Tr(e,"bpmn:BoundaryEvent")&&Rh(e,t,0,n)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!i.replacements.length&&i}function $h(e,t){return!k(e,Ch)&&(!t||e.every((function(e){return Sh(e,t)})))}function jh(e,t,n,i){return!!t&&(!(!vn(e)&&!vh(e))||!function(e,t){return e===t}(n,t)&&((!n||!Ph(n,t))&&(Sh(e,t)||Vh(e,t,i))))}function Ih(e,t){return Tr(e,"bpmn:SubProcess")?Xr(e)&&(!t||t.width>=100&&t.height>=80):!!Tr(e,"bpmn:Lane")||(!!Tr(e,"bpmn:Participant")||(!!yh(e)||!!vh(e)))}function Lh(e,t){return!Ph(t,e)&&!Ph(e,t)&&(!!function(e,t){var n=yh(e),i=yh(t);return(n||i)&&n!==i}(e,t)||!!Fh(e,t))}function Bh(e,t){return _h(e,t)&&bh(e)&&Tr(t,"bpmn:Activity")&&(n=e,!t.attachers.includes(n))&&!Yr(t);var n}function qh(e,t){return!(Uh(e)&&!Uh(t))&&(Tr(n=e,"bpmn:InteractionNode")&&!Tr(n,"bpmn:BoundaryEvent")&&(!Tr(n,"bpmn:Event")||Tr(n,"bpmn:ThrowEvent")&&Oh(n,"bpmn:MessageEventDefinition"))&&function(e){return Tr(e,"bpmn:InteractionNode")&&!xh(e)&&(!Tr(e,"bpmn:Event")||Tr(e,"bpmn:CatchEvent")&&Oh(e,"bpmn:MessageEventDefinition"))&&!(Tr(e,"bpmn:BoundaryEvent")&&!Eh(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return gh(e)===gh(t)}(e,t));var n}function zh(e,t){return Tr(n=e,"bpmn:FlowNode")&&!Tr(n,"bpmn:EndEvent")&&!Yr(n)&&!(Tr(n,"bpmn:IntermediateThrowEvent")&&Eh(n,"bpmn:LinkEventDefinition"))&&!bh(n)&&!xh(n)&&function(e){return Tr(e,"bpmn:FlowNode")&&!Tr(e,"bpmn:StartEvent")&&!Tr(e,"bpmn:BoundaryEvent")&&!Yr(e)&&!(Tr(e,"bpmn:IntermediateCatchEvent")&&Eh(e,"bpmn:LinkEventDefinition"))&&!xh(e)}(t)&&_h(e,t)&&!(Tr(e,"bpmn:EventBasedGateway")&&!function(e){return Tr(e,"bpmn:ReceiveTask")||Tr(e,"bpmn:IntermediateCatchEvent")&&(Eh(e,"bpmn:MessageEventDefinition")||Eh(e,"bpmn:TimerEventDefinition")||Eh(e,"bpmn:ConditionalEventDefinition")||Eh(e,"bpmn:SignalEventDefinition"))}(t));var n}function Fh(e,t){return Ar(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ar(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!Ar(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!Ar(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function Vh(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(1!==e.length)return!1;e=e[0]}return t.source!==e&&t.target!==e&&(Ar(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!vn(t)&&Tr(e,"bpmn:FlowNode")&&!Tr(e,"bpmn:BoundaryEvent")&&Sh(e,t.parent))}function Hh(e,t){return!!vn(t)||!(Tr(t,"bpmn:Lane")&&!function(e,t){return e&&t&&-1!==e.indexOf(t)}(e,t.parent))}function Uh(e){return su(e,"bpmn:Process")||su(e,"bpmn:Collaboration")}i(fh,oc),fh.$inject=["eventBus"],fh.prototype.init=function(){this.addRule("connection.start",(function(e){return function(e){if(mh(e))return null;return Ar(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}(e.source)})),this.addRule("connection.create",(function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent;if(i.targetAttach)return!1;r&&(n.parent=r);try{return kh(t,n)}finally{r&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection;return kh(e.source,e.target,t)})),this.addRule("connection.updateWaypoints",(function(e){return{type:e.connection.type}})),this.addRule("shape.resize",(function(e){return Ih(e.shape,e.newBounds)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,i=e.target;return!(yn(i)&&!Vh(t,i,n))&&P(t,(function(e){return yn(e)?kh(e.source,e.target,e):e.host?Rh(e,e.host,null,n):jh(e,i,null,n)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,i=e.position;return Rh(n,t,null,i)||Nh(n,t,i)||$h(n,t)||Vh(n,t,i)})),this.addRule("shape.create",(function(e){return jh(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return Rh(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element;return Hh(e.elements,t)}))},fh.prototype.canConnectMessageFlow=qh,fh.prototype.canConnectSequenceFlow=zh,fh.prototype.canConnectDataAssociation=Fh,fh.prototype.canConnectAssociation=Lh,fh.prototype.canConnectCompensationAssociation=Bh,fh.prototype.canMove=$h,fh.prototype.canAttach=Rh,fh.prototype.canReplace=Nh,fh.prototype.canDrop=Sh,fh.prototype.canInsert=Vh,fh.prototype.canCreate=jh,fh.prototype.canConnect=kh,fh.prototype.canResize=Ih,fh.prototype.canCopy=Hh;const Wh={__depends__:[jc],__init__:["bpmnRules"],bpmnRules:["type",fh]};function Gh(e,t){e.on("saveXML.start",2e3,(function(){_(t.getRootElements(),(function(e){var t,n=Dr(e);t=S(w(_t([e],!1),(function(t){return t!==e&&!t.labelTarget})),Dr),n.set("planeElement",t)}))}))}Gh.$inject=["eventBus","canvas"];const Qh={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Gh]};function Xh(e){hs.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],(function(e){var n=e.context,i=n.shape||n.connection,r=n.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.parent=o.parent),n.parentIndex=o.index)})),this.preExecute(["shape.move","connection.move"],(function(e){var n=e.context,i=n.shape||n.connection,r=n.newParent||i.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.newParent=o.parent),n.newParentIndex=o.index)}))}function Kh(e,t,n){Xh.call(this,e);var i=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function r(e){var t=e.order;if(t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=b(i,(function(t){return Ar(e,[t.type])}));return t&&t.order||{level:1}}(e)),!t)throw new Error("no order for <"+e.id+">");return t}this.getOrdering=function(e,n){if(e.labelTarget||Tr(e,"bpmn:TextAnnotation"))return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var i=r(e);i.containers&&(n=function(e,t,n){for(var i=t;i&&!Ar(i,n);)i=i.parent;if(!i)throw new Error("no parent for <"+e.id+"> in <"+(t&&t.id)+">");return i}(e,n,i.containers));var o=n.children.indexOf(e),s=x(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&i.level$f(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if($f(i)<5)return!1;i<0&&(i*=-1),Vo(e)&&(i*=-1);var o=function(e,t){if("x"===e){if(t>0)return"e";if(t<0)return"w"}if("y"===e){if(t>0)return"s";if(t<0)return"n"}return null}(n,i),s=this._canvas.getRootElement();!Ho(e)&&e.hover&&(s=e.hover);var a=[..._t(s,!0),...s.attachers||[]],l=this.calculateAdjustments(a,n,i,r),c=function(e,t,n,i,r){var o=e.movingShapes,s=e.resizingShapes;if(!s.length)return;var a,l,c={};return _(s,(function(e){var p,u,d,h,f,g,y=e.attachers,v=e.children,b=wn(e),x=w(v,(function(e){return!(yn(e)||vn(e)||Hf(o,e)||Hf(s,e))})),_=w(v,(function(e){return!yn(e)&&!vn(e)&&Hf(o,e)})),E=[],O=[];x.length&&(u=Ff(wn(Et(x))),p=i-b[Bf[n]]+u[Bf[n]],"n"===n?c.bottom=l=m(l)?Math.min(l,p):p:"w"===n?c.right=l=m(l)?Math.min(l,p):p:"s"===n?c.top=a=m(a)?Math.max(a,p):p:"e"===n&&(c.left=a=m(a)?Math.max(a,p):p)),_.length&&(d=Ff(wn(Et(_))),p=i-d[Bf[qf[n]]]+b[Bf[qf[n]]],"n"===n?c.bottom=l=m(l)?Math.min(l,p):p:"w"===n?c.right=l=m(l)?Math.min(l,p):p:"s"===n?c.top=a=m(a)?Math.max(a,p):p:"e"===n&&(c.left=a=m(a)?Math.max(a,p):p)),y&&y.length&&(y.forEach((function(e){Hf(o,e)?E.push(e):O.push(e)})),E.length&&(h=wn(Et(E.map(On))),f=b[Bf[qf[n]]]-(h[Bf[qf[n]]]-i)),O.length&&(g=wn(Et(O.map(On)))[Bf[n]]-(b[Bf[n]]-i)),"n"===n?(p=Math.min(f||1/0,g||1/0),c.bottom=l=m(l)?Math.min(l,p):p):"w"===n?(p=Math.min(f||1/0,g||1/0),c.right=l=m(l)?Math.min(l,p):p):"s"===n?(p=Math.max(f||-1/0,g||-1/0),c.top=a=m(a)?Math.max(a,p):p):"e"===n&&(p=Math.max(f||-1/0,g||-1/0),c.left=a=m(a)?Math.max(a,p):p));var P=r&&r[e.id];P&&("n"===n?(p=i+e[If[t]]-P[If[t]],c.bottom=l=m(l)?Math.min(l,p):p):"w"===n?(p=i+e[If[t]]-P[If[t]],c.right=l=m(l)?Math.min(l,p):p):"s"===n?(p=i-e[If[t]]+P[If[t]],c.top=a=m(a)?Math.max(a,p):p):"e"===n&&(p=i-e[If[t]]+P[If[t]],c.left=a=m(a)?Math.max(a,p):p))})),c}(l,n,o,r,this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:l.resizingShapes,start:r}));return z(t,l,{axis:n,direction:o,spaceToolConstraints:c,start:r}),Js("resize-"+("x"===n?"ew":"ns")),!0},zf.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],s=[],a=[],l=[];function c(e){o.includes(e)||o.push(e);var t=e.label;t&&!o.includes(t)&&o.push(t)}_(e,(function(e){if(e.parent&&!vn(e))if(yn(e))l.push(e);else{var o=e[t],p=o+e[If[t]];if(function(e){return!!e.host}(e)&&(n>0&&On(e)[t]>i||n<0&&On(e)[t]0&&o>i||n<0&&pi&&r.allowed("shape.resize",{shape:e})?(u=e,void(s.includes(u)||s.push(u))):void 0;c(e)}}})),_(o,(function(e){var t=e.attachers;t&&_(t,(function(e){c(e)}))}));var p=o.concat(s);return _(a,(function(e){var t=e.host;Hf(p,t)&&c(e)})),p=o.concat(s),_(l,(function(e){var t=e.source,n=e.target,i=e.label;Hf(p,t)&&Hf(p,n)&&i&&c(i)})),{movingShapes:o,resizingShapes:s}},zf.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},zf.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^spaceTool/.test(e.prefix)};var Uf="djs-dragging",Wf="djs-resizing",Gf=Math.max;function Qf(e,t,n,i,r){function o(e,t){_(e,(function(e){r.addDragger(e,t),n.addMarker(e,Uf)}))}e.on("spaceTool.selection.start",(function(e){var t=n.getLayer("space"),r=e.context,o="M 0,-10000 L 0,10000",s="M -10000,0 L 10000,0",a=Le("g");Te(a,i.cls("djs-crosshair-group",["no-events"])),ke(t,a);var l=Le("path");Te(l,"d",o),Me(l).add("djs-crosshair"),ke(a,l);var c=Le("path");Te(c,"d",s),Me(c).add("djs-crosshair"),ke(a,c),r.crosshairGroup=a})),e.on("spaceTool.selection.move",(function(e){ii(e.context.crosshairGroup,e.x,e.y)})),e.on("spaceTool.selection.cleanup",(function(e){var t=e.context.crosshairGroup;t&&Ke(t)})),e.on("spaceTool.move",250,(function(e){var s=e.context,a=s.line,l=s.axis,c=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var u=n.getLayer("space");Te(a=Le("path"),"d","M0,0 L0,0"),Me(a).add("djs-crosshair"),ke(u,a),s.line=a;var d=Le("g");Te(d,i.cls("djs-drag-group",["no-events"])),ke(n.getActiveLayer(),d),o(c,d),o(s.movingConnections=t.filter((function(e){var t=!1;_(c,(function(n){_(n.outgoing,(function(n){e===n&&(t=!0)}))}));var n=!1;_(c,(function(t){_(t.incoming,(function(t){e===t&&(n=!0)}))}));var i=!1;_(p,(function(t){_(t.outgoing,(function(t){e===t&&(i=!0)}))}));var r=!1;return _(p,(function(t){_(t.incoming,(function(t){e===t&&(r=!0)}))})),yn(e)&&(t||i)&&(n||r)})),d),s.dragGroup=d}if(!s.frameGroup){var h=Le("g");Te(h,i.cls("djs-frame-group",["no-events"])),ke(n.getActiveLayer(),h);var f=[];_(p,(function(e){var t=r.addFrame(e,h),i=t.getBBox();f.push({element:t,initialBounds:i}),n.addMarker(e,Wf)})),s.frameGroup=h,s.frames=f}Te(a,{d:{x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y}[l]});var m={x:e.dx,y:e.dy};m[{x:"y",y:"x"}[s.axis]]=0,ii(s.dragGroup,m.x,m.y),_(s.frames,(function(e){var t,n,i=e.element,r=e.initialBounds;"e"===s.direction?Te(i,{width:Gf(r.width+m.x,5)}):Te(i,{width:t=Gf(r.width-m.x,5),x:r.x+r.width-t}),"s"===s.direction?Te(i,{height:Gf(r.height+m.y,5)}):Te(i,{height:n=Gf(r.height-m.y,5),y:r.y+r.height-n})}))}})),e.on("spaceTool.cleanup",(function(e){var t=e.context,i=t.movingShapes,r=t.movingConnections,o=t.resizingShapes,s=t.line,a=t.dragGroup,l=t.frameGroup;_(i,(function(e){n.removeMarker(e,Uf)})),_(r,(function(e){n.removeMarker(e,Uf)})),a&&(Ke(s),Ke(a)),_(o,(function(e){n.removeMarker(e,Wf)})),l&&Ke(l)}))}Qf.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const Xf={__init__:["spaceToolPreview"],__depends__:[Mc,jc,Rf,Vp,df],spaceTool:["type",zf],spaceToolPreview:["type",Qf]};function Kf(e){e.invoke(zf,this)}Kf.$inject=["injector"],i(Kf,zf),Kf.prototype.calculateAdjustments=function(e,t,n,i){var r=zf.prototype.calculateAdjustments.call(this,e,t,n,i);return r.resizingShapes=r.resizingShapes.filter((function(e){return!Tr(e,"bpmn:TextAnnotation")&&(!function(e){return Tr(e,"bpmn:Participant")&&!Mr(e).processRef}(e)||!("y"===t&&Kr(e)||"x"===t&&!Kr(e)))})),r};const Yf={__depends__:[Xf],spaceTool:["type",Kf]};function Zf(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],(function(){this.clear(!1)}),this)}Zf.$inject=["eventBus","injector"],Zf.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Zf.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(void 0===r){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},Zf.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},Zf.prototype.undo=function(){let e,t=this._getUndoAction();if(t){for(this._currentExecution.trigger="undo",this._pushAction(t);t&&(this._internalUndo(t),e=this._getUndoAction(),e&&e.id===t.id);)t=e;this._popAction()}},Zf.prototype.redo=function(){let e,t=this._getRedoAction();if(t){for(this._currentExecution.trigger="redo",this._pushAction(t);t&&(this._internalExecute(t,!0),e=this._getRedoAction(),e&&e.id===t.id);)t=e;this._popAction()}},Zf.prototype.register=function(e,t){this._setHandler(e,t)},Zf.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Zf.prototype.canUndo=function(){return!!this._getUndoAction()},Zf.prototype.canRedo=function(){return!!this._getRedoAction()},Zf.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Zf.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Zf.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo((()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)}))},Zf.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const e of i)if(r=this._eventBus.fire("commandStack."+e,n),n.cancelBubble)break;return r},Zf.prototype._createId=function(){return this._uid++},Zf.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Zf.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo((()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)})),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Zf.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in or phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Zf.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:M("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Zf.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=h(e)?e:[e],t.dirty=t.dirty.concat(e))},Zf.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Zf.prototype._revertedAction=function(e){this._stackIdx--},Zf.prototype._getHandler=function(e){return this._handlerMap[e]},Zf.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const Jf={commandStack:["type",Zf]};function em(e,t){if("function"!=typeof t)throw new Error("removeFn iterator must be a function");if(e){for(var n;n=e[0];)t(n);return e}}function tm(e,t,n){hs.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",1400,(function(e){var t=e.context,n=t.shapes,i=t.validatedShapes;t.shapes=nm(n),t.validatedShapes=nm(i)})),i&&t.on("shape.move.start",250,(function(e){var t=e.context,n=t.shapes,r=[];_(n,(function(e){_(e.labels,(function(n){n.hidden||-1!==t.shapes.indexOf(n)||r.push(n),e.labelTarget&&r.push(e)}))})),_(r,(function(e){i.makeDraggable(t,e,!0)}))})),this.preExecuted("elements.move",1400,(function(e){var t=e.context.closure,n=t.enclosedElements,i=[];_(n,(function(e){_(e.labels,(function(e){n[e.id]||i.push(e)}))})),t.addAll(i)})),this.preExecute(["connection.delete","shape.delete"],(function(e){var t=e.context;em((t.connection||t.shape).labels,(function(e){n.removeShape(e,{nested:!0})}))})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,i=n.labelTarget;i&&(t.labelTargetIndex=Mt(i.labels,n),t.labelTarget=i,n.labelTarget=null)})),this.revert("shape.delete",(function(e){var t=e.context,n=t.shape,i=t.labelTarget,r=t.labelTargetIndex;i&&(At(i.labels,n,r),n.labelTarget=i)}))}function nm(e){return w(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}i(tm,hs),tm.$inject=["injector","eventBus","modeling"];const im={__init__:["labelSupport"],labelSupport:["type",tm]};var rm="attach-ok";function om(e,t,n,i,r){hs.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",1401,(function(e){var t,n,i=e.context,r=i.shapes,o=i.validatedShapes;i.shapes=(n=sm(t=r),D("id",t,n)),i.validatedShapes=function(e){var t=A(e,"id");return w(e,(function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0}))}(o)})),o&&t.on("shape.move.start",251,(function(e){var t=e.context;_(sm(t.shapes),(function(e){o.makeDraggable(t,e,!0),_(e.labels,(function(e){o.makeDraggable(t,e,!0)}))}))})),o&&t.on("shape.move.start",(function(e){var i=e.context.shapes;if(1===i.length){var r=i[0].host;r&&(n.addMarker(r,rm),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(r,rm)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;_(sm(t.shapes),(function(e){n.add(e,n.topLevel[e.host.id])}))})),this.postExecuted("elements.move",(function(e){var t=e.context,n=t.shapes,i=t.newHost;i&&1!==n.length||_(i?n:w(n,(function(e){var t,i=e.host;return function(e){return!!e.host}(e)&&(t=i,!(-1!==n.indexOf(t)))})),(function(e){r.updateAttachment(e,i)}))})),this.postExecuted("elements.move",(function(e){_(e.context.shapes,(function(e){_(e.attachers,(function(e){_(e.outgoing.slice(),(function(e){i.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||r.removeConnection(e)})),_(e.incoming.slice(),(function(e){i.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||r.removeConnection(e)}))}))}))})),this.postExecute("shape.create",(function(e){var t=e.context,n=t.shape,i=t.host;i&&r.updateAttachment(n,i)})),this.postExecute("shape.replace",(function(e){var t=e.context,n=t.oldShape,o=t.newShape;em(n.attachers,(function(e){"attach"===i.allowed("elements.move",{target:o,shapes:[e]})?r.updateAttachment(e,o):r.removeShape(e)})),o.attachers.length&&_(o.attachers,(function(e){var t=ld(e,n,o);r.moveShape(e,t,e.parent)}))})),this.postExecute("shape.resize",(function(e){var t=e.context,n=t.shape,i=t.oldBounds,o=t.newBounds,s=n.attachers;!1!==(t.hints||{}).attachSupport&&_(s,(function(e){var t=ld(e,i,o);r.moveShape(e,t,e.parent),_(e.labels,(function(e){r.moveShape(e,t,e.parent)}))}))})),this.preExecute("shape.delete",(function(e){var t=e.context.shape;em(t.attachers,(function(e){r.removeShape(e)})),t.host&&r.updateAttachment(t,null)}))}function sm(e){return a(S(e,(function(e){return e.attachers||[]})))}i(om,hs),om.$inject=["injector","eventBus","canvas","rules","modeling"];const am={__depends__:[jc],__init__:["attachSupport"],attachSupport:["type",om]};function lm(e){this._model=e}function cm(e,t,n,i){hs.call(this,e),this._bpmnFactory=t,this._translate=i;var r=this;function o(e){_(e.context.oldRoot.children,(function(e){Tr(e,"bpmn:BaseElement")&&r.updateParent(e)}))}function s(e){var t=e.context.shape;Tr(t,"bpmn:BaseElement")&&r.updateBounds(t)}function a(e){r.updateConnection(e.context)}function l(e){r.updateConnectionWaypoints(e.context.connection)}function c(e){r.updateAttachment(e.context)}function p(e){const{element:n}=e.context,i=oo(n),r=Dr(n),o=r&&r.get("label");eo(n)||Os(n)||(i&&!o?r.set("label",t.create("bpmndi:BPMNLabel")):!i&&o&&r.set("label",void 0))}this.executed(["connection.layout","connection.create"],(function(e){var t,i=e.context,r=i.hints||{};i.cropped||!1===r.createElementsBehavior||((t=i.connection).waypoints=n.getCroppedWaypoints(t),i.cropped=!0)})),this.reverted(["connection.layout"],(function(e){delete e.context.cropped})),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],pm((function(e){var t=e.context;r.updateParent(t.shape||t.connection,t.oldParent)}))),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],pm((function(e){var t=e.context,n=t.shape||t.connection,i=t.parent||t.newParent;r.updateParent(n,i)}))),this.executed(["canvas.updateRoot"],o),this.reverted(["canvas.updateRoot"],o),this.executed(["shape.move","shape.create","shape.resize"],pm((function(e){"label"!==e.context.shape.type&&s(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],pm((function(e){"label"!==e.context.shape.type&&s(e)}))),e.on("shape.changed",(function(e){"label"===e.element.type&&s({context:{shape:e.element}})})),this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],pm(a)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],pm(a)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],pm(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],pm(l)),this.executed("connection.reconnect",pm((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=Mr(n),s=Mr(i),a=Mr(r);o.conditionExpression&&!Ar(a,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(t.oldConditionExpression=o.conditionExpression,delete o.conditionExpression),i!==r&&s.default===o&&(t.oldDefault=s.default,delete s.default)}))),this.reverted("connection.reconnect",pm((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=Mr(n),s=Mr(i),a=Mr(r);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(s.default=t.oldDefault,delete a.default)}))),this.executed(["element.updateAttachment"],pm(c)),this.reverted(["element.updateAttachment"],pm(c)),this.executed("element.updateLabel",pm(p)),this.reverted("element.updateLabel",pm(p))}function pm(e){return function(t){var n=t.context;Tr(n.shape||n.connection||n.element,"bpmn:BaseElement")&&e(t)}}function um(e,t,n){Kn.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}function dm(e,t,n){return void 0===t[n]?t:(e[n]=t[n],H(t,[n]))}function hm(e,t){this._modeling=e,this._canvas=t}function fm(e){this._modeling=e}function mm(e,t){this._canvas=e,this._layouter=t}lm.$inject=["moddle"],lm.prototype._needsId=function(e){return Ar(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},lm.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=Tr(e,"bpmn:Activity")?"Activity":Tr(e,"bpmn:Event")?"Event":Tr(e,"bpmn:Gateway")?"Gateway":Ar(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},lm.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},lm.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},lm.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",z({bpmnElement:e,bounds:this.createDiBounds()},t))},lm.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},lm.prototype.createDiWaypoints=function(e){var t=this;return S(e,(function(e){return t.createDiWaypoint(e)}))},lm.prototype.createDiWaypoint=function(e){return this.create("dc:Point",V(e,["x","y"]))},lm.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",z({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},lm.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",z({bpmnElement:e},t))},i(cm,hs),cm.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],cm.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},cm.prototype.updateParent=function(e,t){if(!(vn(e)||Tr(e,"bpmn:DataStoreReference")&&e.parent&&Tr(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Dr(e),o=n&&n.businessObject,s=Dr(n);Tr(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),Tr(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),Tr(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(i,o),Tr(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,s)}},cm.prototype.updateBounds=function(e){var t=Dr(e),n=function(e){if(!Tr(e,"bpmn:Activity"))return;var t=Dr(e);if(!t)return;var n=t.get("label");if(!n)return;return n.get("bounds")}(e);if(n){var i=ia(n,t.get("bounds"));z(n,{x:e.x+i.x,y:e.y+i.y})}var r=vn(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),z(o,{x:e.x,y:e.y,width:e.width,height:e.height})},cm.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(Tr(n,"bpmn:Lane")&&Tt(n.get("flowNodeRef"),e),Tr(t,"bpmn:Lane")&&At(t.get("flowNodeRef"),e))},cm.prototype.updateDiConnection=function(e,t,n){var i=Dr(e),r=Dr(t),o=Dr(n);i.sourceElement&&i.sourceElement.bpmnElement!==Mr(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==Mr(n)&&(i.targetElement=n&&o)},cm.prototype.updateDiParent=function(e,t){if(t&&!Tr(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Tt(n,e),e.$parent=null)}},cm.prototype.getLaneSet=function(e){var t,n;return Tr(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(Tr(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},cm.prototype.updateSemanticParent=function(e,t,n){var i,r=this._translate;if(e.$parent!==t&&(!Tr(e,"bpmn:DataInput")&&!Tr(e,"bpmn:DataOutput")||(Tr(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(Tr(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(Tr(e,"bpmn:FlowElement")){if(t)if(Tr(t,"bpmn:Participant"))t=t.processRef;else if(Tr(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(Tr(t,"bpmn:Lane"));i="flowElements"}else if(Tr(e,"bpmn:Artifact")){for(;t&&!Tr(t,"bpmn:Process")&&!Tr(t,"bpmn:SubProcess")&&!Tr(t,"bpmn:Collaboration");){if(Tr(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(Tr(e,"bpmn:MessageFlow"))i="messageFlows";else if(Tr(e,"bpmn:Participant")){i="participants";var o,s=e.processRef;s&&(o=function(e){for(;e&&!Tr(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(Tt(o.get("rootElements"),s),s.$parent=null),t&&(At(o.get("rootElements"),s),s.$parent=o))}else Tr(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":Tr(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(r("no parent for {element} in {parent}",{element:e.id,parent:t.id}));var a;if(e.$parent&&Tt(a=e.$parent.get(i),e),t?((a=t.get(i)).push(e),e.$parent=t):e.$parent=null,n){var l=n.get(i);Tt(a,e),t&&(l||(l=[],t.set(i,l)),l.push(e))}}},cm.prototype.updateConnectionWaypoints=function(e){Dr(e).set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},cm.prototype.updateConnection=function(e){var t,n=e.connection,i=Mr(n),r=n.source,o=Mr(r),s=n.target,a=Mr(n.target);if(Tr(i,"bpmn:DataAssociation"))Tr(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=o,t=e.parent||e.newParent||a,this.updateSemanticParent(i,a,t)):Tr(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,t),i.targetRef=a);else{var l=Tr(i,"bpmn:SequenceFlow");i.sourceRef!==o&&(l&&(Tt(i.sourceRef&&i.sourceRef.get("outgoing"),i),o&&o.get("outgoing")&&o.get("outgoing").push(i)),i.sourceRef=o),i.targetRef!==a&&(l&&(Tt(i.targetRef&&i.targetRef.get("incoming"),i),a&&a.get("incoming")&&a.get("incoming").push(i)),i.targetRef=a)}this.updateConnectionWaypoints(n),this.updateDiConnection(n,r,s)},cm.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},i(um,Kn),um.$inject=["bpmnFactory","moddle","translate"],um.prototype._baseCreate=Kn.prototype.create,um.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,z({type:"label",di:n},Jr,t))}return this.createElement(e,t)},um.prototype.createElement=function(e,t){var n,i,r,o=this._translate,s=(t=z({},t||{})).businessObject,a=t.di;if(!s){if(!t.type)throw new Error(o("no shape type specified"));kr(s=this._bpmnFactory.create(t.type))}if(!Ar(a,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])){var l=z({},a||{},{id:s.id+"_di"});a="root"===e?this._bpmnFactory.createDiPlane(s,l):"connection"===e?this._bpmnFactory.createDiEdge(s,l):this._bpmnFactory.createDiShape(s,l)}return Tr(s,"bpmn:Group")&&(t=z({isFrame:!0},t)),t=function(e,t,n){return _(n,(function(n){t=dm(e,t,n)})),t}(s,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=dm(a,t,"isExpanded")),Ar(s,["bpmn:Lane","bpmn:Participant"])&&(t=dm(a,t,"isHorizontal")),Tr(s,"bpmn:SubProcess")&&(t.collapsed=!Xr(s,a)),Tr(s,"bpmn:ExclusiveGateway")&&(v(t,"isMarkerVisible")?void 0===t.isMarkerVisible?a.isMarkerVisible=!1:t=dm(a,t,"isMarkerVisible"):a.isMarkerVisible=!0),u(t.triggeredByEvent)&&(s.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),u(t.cancelActivity)&&(s.cancelActivity=t.cancelActivity,delete t.cancelActivity),t.eventDefinitionType&&(i=s.get("eventDefinitions")||[],r=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(r.condition=this._bpmnFactory.create("bpmn:FormalExpression")),i.push(r),r.$parent=s,s.eventDefinitions=i,delete t.eventDefinitionType),n=this.getDefaultSize(s,a),t=z({id:s.id},n,t,{businessObject:s,di:a}),this._baseCreate(e,t)},um.prototype.getDefaultSize=function(e,t){var n=Mr(e);return t=t||Dr(e),Tr(n,"bpmn:SubProcess")?Xr(n,t)?{width:350,height:200}:{width:100,height:80}:Tr(n,"bpmn:Task")?{width:100,height:80}:Tr(n,"bpmn:Gateway")?{width:50,height:50}:Tr(n,"bpmn:Event")?{width:36,height:36}:Tr(n,"bpmn:Participant")?Xr(n,t)?{width:600,height:250}:{width:400,height:60}:Tr(n,"bpmn:Lane")?{width:400,height:100}:Tr(n,"bpmn:DataObjectReference")?{width:36,height:50}:Tr(n,"bpmn:DataStoreReference")?{width:50,height:50}:Tr(n,"bpmn:TextAnnotation")?{width:100,height:30}:Tr(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},um.prototype.createParticipantShape=function(e){return f(e)||(e={isExpanded:e}),!1!==(e=z({type:"bpmn:Participant"},e||{})).isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},hm.$inject=["modeling","canvas"],hm.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;_(n,(function(e){var n={x:0,y:0};u(i.left)?n.x=i.left-e.x:u(i.right)?n.x=i.right-e.width-e.x:u(i.center)?n.x=i.center-Math.round(e.width/2)-e.x:u(i.top)?n.y=i.top-e.y:u(i.bottom)?n.y=i.bottom-e.height-e.y:u(i.middle)&&(n.y=i.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},hm.prototype.postExecute=function(e){},fm.$inject=["modeling"],fm.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},fm.prototype.postExecute=function(e){var t,n,i=e.hints||{};t=e.source,n=e.shape,k(t.outgoing,(function(e){return e.target===n}))||(i.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))},mm.$inject=["canvas","layouter"],mm.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,s=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,s)),this._canvas.addConnection(t,r,o),t},mm.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var gm=Math.round;function ym(e){this._modeling=e}ym.$inject=["modeling"],ym.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,s=this._modeling;_(t,(function(e){m(e.x)||(e.x=0),m(e.y)||(e.y=0)}));var a=Et(w(t,(function(e){return!e.hidden})));_(t,(function(e){yn(e)&&(e.waypoints=S(e.waypoints,(function(e){return{x:gm(e.x-a.x-a.width/2+r.x),y:gm(e.y-a.y-a.height/2+r.y)}}))),z(e,{x:gm(e.x-a.x-a.width/2+r.x),y:gm(e.y-a.y-a.height/2+r.y)})}));var l=yt(t),c={};_(t,(function(e){if(yn(e))c[e.id]=m(i)?s.createConnection(c[e.source.id],c[e.target.id],i,e,e.parent||n,o):s.createConnection(c[e.source.id],c[e.target.id],e,e.parent||n,o);else{var t=z({},o);-1===l.indexOf(e)&&(t.autoResize=!1),vn(e)&&(t=H(t,["attach"])),c[e.id]=m(i)?s.createShape(e,V(e,["x","y","width","height"]),e.parent||n,i,t):s.createShape(e,V(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=T(c)};var vm=Math.round;function bm(e){this._canvas=e}function xm(e){bm.call(this,e)}bm.$inject=["canvas"],bm.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?z(t,n):z(t,{x:n.x-vm(t.width/2),y:n.y-vm(t.height/2)}),this._canvas.addShape(t,i,r),t},bm.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},i(xm,bm),xm.$inject=["canvas"];var wm=bm.prototype.execute;xm.prototype.execute=function(e){var t=e.shape;return function(e){["width","height"].forEach((function(t){void 0===e[t]&&(e[t]=0)}))}(t),t.labelTarget=e.labelTarget,wm.call(this,e)};var _m=bm.prototype.revert;function Em(e,t){this._canvas=e,this._modeling=t}function Om(e,t){this._modeling=e,this._elementRegistry=t}function Pm(e,t){this._canvas=e,this._modeling=t}function km(e){this._modeling=e}xm.prototype.revert=function(e){return e.shape.labelTarget=null,_m.call(this,e)},Em.$inject=["canvas","modeling"],Em.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;em(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),em(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},Em.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Mt(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Em.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,At(n.children,t,i),this._canvas.addConnection(t,n),t},Om.$inject=["modeling","elementRegistry"],Om.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;_(e.elements,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},Pm.$inject=["canvas","modeling"],Pm.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;em(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),em(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),em(n.children,(function(e){yn(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},Pm.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Mt(i.children,n),t.removeShape(n),n},Pm.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return At(i.children,n,r),t.addShape(n,i),n},km.$inject=["modeling"];var Sm={x:"y",y:"x"};function Cm(e,t){this._layouter=e,this._canvas=t}function Tm(){}function Am(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function Mm(e){this._modeling=e}function Dm(e){this._helper=new Mm(e)}function Rm(e){this._modeling=e,this._helper=new Mm(e)}function Nm(e){this._modeling=e}function $m(e){return e.original||e}function jm(e,t){this._modeling=e,this._rules=t}function Im(e){this._modeling=e}function Lm(e){this._modeling=e}function Bm(e){return z({},e)}function qm(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function zm(e,t,n){var i=qm(n);return/e|s/.test(n)?e[i]>t:/n|w/.test(n)?e[i] required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||function(e,t){return O(t,(function(t,n){return t[n]=e.get(n),t}),{})}(n,C(i));return Jm(n,i),e.oldProperties=o,e.changed=r,r},Zm.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Jm(n,t),i},Zm.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return Tr(e,"bpmn:DataObject")?function(e,t){return t.filter((function(t){return Tr(t,"bpmn:DataObjectReference")&&Mr(t).dataObjectRef===e}))}(e,t):[]};var eg="default",tg="id",ng="di",ig={width:0,height:0};function rg(e,t,n,i,r){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=i,this._textRenderer=r}function og(e,t){return tg in e&&e[tg]!==t[tg]}function sg(e,t){var n=e.businessObject,i=Dr(e);_(t,(function(e,t){t!==ng?n.set(t,e):i&&function(e,t){_(t,(function(t,n){e.set(n,t)}))}(i,e)}))}rg.$inject=["elementRegistry","moddle","translate","modeling","textRenderer"],rg.prototype.execute=function(e){var t=e.element,n=[t],i=this._translate;if(!t)throw new Error(i("element required"));var r=this._elementRegistry,o=this._moddle.ids,s=t.businessObject,a=function(e){var t=z({},e);return ag.forEach((function(n){n in e&&(t[n]=Mr(t[n]))})),t}(e.properties),l=e.oldProperties||function(e,t){var n=C(t),i=e.businessObject,r=Dr(e);return O(n,(function(e,n){return e[n]=n!==ng?i.get(n):function(e,t){return O(t,(function(t,n){return t[n]=e&&e.get(n),t}),{})}(r,C(t.di)),e}),{})}(t,a);return og(a,s)&&(o.unclaim(s[tg]),r.updateId(t,a[tg]),o.claim(a[tg],s)),eg in a&&(a[eg]&&n.push(r.get(a[eg].id)),s[eg]&&n.push(r.get(s[eg].id))),sg(t,a),e.oldProperties=l,e.changed=n,n},rg.prototype.postExecute=function(e){var t=e.element.label,n=t&&Mr(t).name;if(n){var i=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,i,ig)}},rg.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,s=this._moddle.ids;return sg(t,i),og(n,r)&&(s.unclaim(n[tg]),o.updateId(t,i[tg]),s.claim(i[tg],r)),e.changed};var ag=["default"];function lg(e,t){this._canvas=e,this._modeling=t}function cg(e,t){this._modeling=e,this._spaceTool=t}function pg(e,t){this._modeling=e,this._translate=t}function ug(e,t){this._modeling=e,this._spaceTool=t}lg.$inject=["canvas","modeling"],lg.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,s=o.$parent,a=Dr(r);return t.setRootElement(n),t.removeRootElement(r),At(s.rootElements,i),i.$parent=s,Tt(s.rootElements,o),o.$parent=null,r.di=null,a.bpmnElement=i,n.di=a,e.oldRoot=r,[]},lg.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,s=i.$parent,a=Dr(n);return t.setRootElement(r),t.removeRootElement(n),Tt(s.rootElements,i),i.$parent=null,At(s.rootElements,o),o.$parent=s,n.di=null,a.bpmnElement=o,r.di=a,[]},cg.$inject=["modeling","spaceTool"],cg.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Mu(i),s=o===i,a=s?i:i.parent,l=Au(a),c=Kr(i);if(c?"left"===r?r="top":"right"===r&&(r="bottom"):"top"===r?r="left":"bottom"===r&&(r="right"),!l.length){var p=c?{x:i.x+Cu,y:i.y,width:i.width-Cu,height:i.height}:{x:i.x,y:i.y+Cu,width:i.width,height:i.height-Cu};n.createShape({type:"bpmn:Lane",isHorizontal:c},p,a)}var u,d,h,f,m,g=[];xt(o,(function(e){return g.push(e),e.label&&g.push(e.label),e===i?[]:w(e.children,(function(e){return e!==i}))})),"top"===r?(u=-120,h=(d=i.y)+10,f="n",m="y"):"left"===r?(u=-120,h=(d=i.x)+10,f="w",m="x"):"bottom"===r?(u=120,h=(d=i.y+i.height)-10,f="s",m="y"):"right"===r&&(u=120,h=(d=i.x+i.width)-10,f="e",m="x");var y=t.calculateAdjustments(g,m,u,h),v=c?{x:0,y:u}:{x:u,y:0};t.makeSpace(y.movingShapes,y.resizingShapes,v,f,h);var b=c?{x:i.x+(s?Cu:0),y:d-("top"===r?120:0),width:i.width-(s?Cu:0),height:120}:{x:d-("left"===r?120:0),y:i.y+(s?Cu:0),width:120,height:i.height-(s?Cu:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:c},b,a)},pg.$inject=["modeling","translate"],pg.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,i=e.shape,r=e.count,o=Au(i),s=o.length;if(s>r)throw new Error(n("more than {count} child lanes",{count:r}));var a,l,c,p,u,d=Math.round(i.height/r);for(u=0;u0||c.bottom<0?-n:n,s=a.calculateAdjustments(u,"y",o,i),a.makeSpace(s.movingShapes,s.resizingShapes,{x:0,y:n},r)),(c.left||c.right)&&(n=c.right||c.left,i=e.x+(c.right?e.width:0)+(c.right?-10:100),r=c.right?"e":"w",o=c.left>0||c.right<0?-n:n,s=a.calculateAdjustments(d,"x",o,i),a.makeSpace(s.movingShapes,s.resizingShapes,{x:n,y:0},r))};var dg="flowNodeRef",hg="lanes";function fg(e){this._elementRegistry=e}function mg(e){this._moddle=e}fg.$inject=["elementRegistry"],fg.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function s(e){-1===n.indexOf(e)&&(o.push(e),n.push(e))}function a(e){if(!e.parent)return[];var t=function(e){var t=Mu(e);return r[t.id]||(r[t.id]=Tu(t)),r[t.id]}(e);return t.filter((function(t){return n=e,i=wn(t),r=n.x+n.width/2,o=n.y+n.height/2,r>i.left&&ri.top&&o: must be specified as : with start/end in { h,v,t,r,b,l }");if(Dg(n)){var i=function(e,t,n){return Pg(e,t,n)}(e,t,n),r=function(e,t,n){var i=Pg(t,e,kg(n));return{waypoints:i.waypoints.slice().reverse(),directions:kg(i.directions),turnNextDirections:i.turnNextDirections}}(e,t,n),o=function(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n="h"==n?"v":"h"),t.turnNextDirections&&(i="h"==i?"v":"h");var r=n+":"+i;return{waypoints:Sg(e.waypoints[e.waypoints.length-1],t.waypoints[0],r),directions:r}}(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return function(e,t,n){var i=Eg((t.x-e.x)/2+e.x),r=Eg((t.y-e.y)/2+e.y);if("h:v"===n)return[{x:t.x,y:e.y}];if("v:h"===n)return[{x:e.x,y:t.y}];if("h:h"===n)return[{x:i,y:e.y},{x:i,y:t.y}];if("v:v"===n)return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}(e,t,n)}function Cg(e,t,n,i,r){var o=E(r&&r.preferredLayouts||[],"straight")[0]||"h:h",s=Pn(e,t,Og[o]||0),a=function(e,t){if(Dg(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}(s,o);n=n||On(e),i=i||On(t);var l=a.split(":"),c=Rg(n,e,l[0],function(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}(s));return function(e,t,n){var i=Sg(e,t,n);return i.unshift(e),i.push(t),Ng(i)}(c,Rg(i,t,l[1],s),a)}function Tg(e,t,n,i,r,o){var s;return h(n)&&(r=n,o=i,n=On(e),i=On(t)),r=r||[],s=-1!==(o=z({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,i,r){var o,s,a={};if(s=Pn(e,t),!/^(top|bottom|left|right)$/.test(s))return null;/top|bottom/.test(s)&&(o="x");/left|right/.test(s)&&(o="y");return"target"===r.preserveDocking?Ag(o,i,e)?(a[o]=i[o],[{x:void 0!==a.x?a.x:n.x,y:void 0!==a.y?a.y:n.y,original:{x:void 0!==a.x?a.x:n.x,y:void 0!==a.y?a.y:n.y}},{x:i.x,y:i.y}]):null:Ag(o,n,t)?(a[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==a.x?a.x:i.x,y:void 0!==a.y?a.y:i.y,original:{x:void 0!==a.x?a.x:i.x,y:void 0!==a.y?a.y:i.y}}]):null}(e,t,n,i,o),s||(s=o.connectionEnd&&function(e,t,n,i){var r=i.slice().reverse();return r=Mg(e,t,n,r),r?r.reverse():null}(t,e,i,r),s||((s=o.connectionStart&&Mg(e,t,n,r))||(!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:Cg(e,t,n,i,o))))}function Ag(e,t,n){return function(e,t,n){return e>=t&&e<=n}(t[e],n[e],n[e]+n[{x:"width",y:"height"}[e]])}function Mg(e,t,n,i){if(function(e){return e.length<3||!(e.length>4)&&!!b(e,(function(t,n){var i=e[n-1];return i&&Dt(t,i)<3}))}(i))return null;var r,o=i[0],s=i.slice();return s[0]=n,s[1]=function(e,t,n){switch(Nt(t,e)){case"v":return{x:n.x,y:e.y};case"h":return{x:e.x,y:n.y}}return{x:e.x,y:e.y}}(s[1],o,n),r=function(e,t,n){var i;for(i=e.length-2;0!==i;i--)if(jt(e[i],t,20)||jt(e[i],n,20))return e.slice(i);return e}(s,e,t),r!==s&&(s=Mg(e,t,n,r)),s&&Nt(s)?null:s}function Dg(e){return e&&/t|r|b|l/.test(e)}function Rg(e,t,n,i){if("h"===n&&(n=/left/.test(i)?"l":"r"),"v"===n&&(n=/top/.test(i)?"t":"b"),"t"===n)return{original:e,x:e.x,y:t.y};if("r"===n)return{original:e,x:t.x+t.width,y:e.y};if("b"===n)return{original:e,x:e.x,y:t.y+t.height};if("l"===n)return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function Ng(e){return e.reduce((function(t,n,i){return Rt(t[t.length-1],e[i+1],n,0)||t.push(n),t}),[])}var $g={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},jg={top:"t",right:"r",bottom:"b",left:"l"};function Ig(){}function Lg(e,t){return Tr(t,"bpmn:Participant")?"source":Tr(e,"bpmn:Participant")?"target":Fg(t)?"source":Fg(e)||Tr(t,"bpmn:Event")?"target":Tr(e,"bpmn:Event")?"source":null}function Bg(e){return Fg(e)?"target":"source"}function qg(e,t){return e?e.original||e:On(t)}function zg(e,t){return Tr(t,"bpmn:Activity")&&Tr(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Fg(e){return Tr(e,"bpmn:SubProcess")&&Xr(e)}function Vg(e,t){return e===t}function Hg(e){var t=/right|left/.exec(e);return t&&t[0]}function Ug(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Wg(e){return"right"===e||"left"===e}function Gg(e,t){var n=t.waypoints,i=n&&n.length&&Pn(n[0],e);return"top"===i?["t:r"]:"right"===i?["r:b"]:"left"===i?["l:t"]:["b:l"]}function Qg(e,t,n){var i,r,o,s,a=On(e),l=On(t),c=(s=(o=e).host,Pn(On(o),s,-10)),p=Vg(e.host,t),u=-1!==["top","right","bottom","left"].indexOf(c),d=Pn(l,a,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return p?function(e,t,n,i,r){var o,s=t?e:Ug(e),a=jg[s];o=t?Wg(e)?Xg("y",n,i,r)?"h":"b":Xg("x",n,i,r)?"v":"l":"v";return[a+":"+o]}(c,u,e,t,n):(i=function(e,t,n){if(n)return jg[e];if(Vg(Ug(e),Ug(t))||function(e,t){return $g[e]===t}(Hg(e),Hg(t)))return jg[Ug(e)];return jg[Hg(e)]}(c,d,u),r=function(e,t,n){if(n)return Wg(e)?function(e,t){var n=Hg(e),i=$g[n];return-1!==t.indexOf(i)}(e,t)||Vg(e,t)?"h":"v":function(e,t){var n=Ug(e),i=$g[n];return-1!==t.indexOf(i)}(e,t)||Vg(e,t)?"v":"h";return Wg(t)||Vg(Ug(e),Ug(t))&&Hg(t)?"h":"v"}(c,d,u),[i+":"+r])}function Xg(e,t,n,i){return!(Kg(e,i,n,40)||Kg(e,i,{x:n.x+n.width,y:n.y+n.height},40)||Kg(e,i,On(t),40))}function Kg(e,t,n,i){return Math.abs(t[e]-n[e])!d(e)))})},ty.prototype.cleanUp=function(){this._complexPreview.cleanUp()},ty.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const ny={__depends__:[bc,Wp,Jg],__init__:["appendPreview"],appendPreview:["type",ty]};function iy(e){return e.originalEvent||e.srcEvent}function ry(e,t){return(iy(e)||e).button===t}function oy(e){return ry(e,0)}function sy(e){return["L",e.x,e.y]}function ay(e,t){const n=e.length,i=[(r=e[0],["M",r.x,r.y])];var r,o,s,a;for(let r=1;r");return Te(e,n),e}function y(e,t){ke(e,t)}this.removeHits=function(e){_(_e(".djs-hit",e),Ke)},this.createDefaultHit=function(e,t){var n,i=e.waypoints,r=e.isFrame;return i?this.createWaypointsHit(t,i):(n=r?"stroke":"all",this.createBoxHit(t,n,{width:e.width,height:e.height}))},this.createWaypointsHit=function(e,t){var n=function(e,t,n){m(t)&&(n=t,t=null),t||(t={});const i=Le("path",t);return m(n)&&(i.dataset.cornerRadius=String(n)),py(i,e)}(t);return g(n,"stroke"),y(e,n),n},this.createBoxHit=function(e,t,n){n=z({x:0,y:0},n);var i=Le("rect");return g(i,t),Te(i,n),y(e,i),i},this.updateDefaultHit=function(e,t){var n=we(".djs-hit",t);if(n)return e.waypoints?py(n,e.waypoints):Te(n,{width:e.width,height:e.height}),n},this.fire=r,this.triggerMouseEvent=function(e,t,n){var i=a[e];if(!i)throw new Error("unmapped DOM event name <"+e+">");return r(i,t,n)},this.mouseHandler=s,this.registerEvent=c,this.unregisterEvent=p}hy.$inject=["eventBus","elementRegistry","styles"];const fy={__init__:["interactionEvents"],interactionEvents:["type",hy]};var my=Math.min,gy=Math.max;function yy(e){e.preventDefault()}function vy(e){e.stopPropagation()}function by(e){this.container=e.container,this.parent=be(''),this.content=we("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=q(this.autoResize,this),this.handlePaste=q(this.handlePaste,this)}function xy(e,t){this._eventBus=e,this._providers=[],this._textbox=new by({container:t.getContainer(),keyHandler:q(this._handleKey,this),resizeHandler:q(this._handleResize,this)})}by.prototype.create=function(e,t,n,i){var r=this.parent,o=this.content,s=this.container;i=this.options=i||{};var a=V(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);z(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},a);var l=V(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return z(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&z(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),o.innerText=n,de.bind(o,"keydown",this.keyHandler),de.bind(o,"mousedown",vy),de.bind(o,"paste",this.handlePaste),i.autoResize&&de.bind(o,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),r},by.prototype.handlePaste=function(e){var t,n=this.options,i=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),this.insertText(t),n.autoResize){var r=this.autoResize(i);r&&this.resizeHandler(r)}},by.prototype.insertText=function(e){e=function(e){return e.replace(/\r\n|\r|\n/g,"\n")}(e),document.execCommand("insertText",!1,e)||this._insertTextIE(e)},by.prototype._insertTextIE=function(e){var t,n,i,r=this.getSelection(),o=r.startContainer,s=r.endContainer,a=r.startOffset,l=r.endOffset,c=r.commonAncestorContainer,p=(t=c.childNodes,[].slice.call(t));if(function(e){return e.nodeType===Node.TEXT_NODE}(c)){var u=o.textContent;o.textContent=u.substring(0,a)+e+u.substring(l),n=o,i=a+e.length}else if(o===this.content&&s===this.content){var d=document.createTextNode(e);this.content.insertBefore(d,p[a]),n=d,i=d.textContent.length}else{var h=p.indexOf(o),f=p.indexOf(s);p.forEach((function(t,n){n===h?t.textContent=o.textContent.substring(0,a)+e+s.textContent.substring(l):n>h&&n<=f&&Ee(t)})),n=o,i=a+e.length}n&&void 0!==i&&setTimeout((function(){self.setSelection(n,i)}))},by.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight
');var u=function(n){yy(n),vy(n);var u=my(gy(c+n.clientX-a,i),o),d=my(gy(p+n.clientY-l,r),s);t.style.width=u+"px",t.style.height=d+"px",e.resizeHandler({width:c,height:p,dx:n.clientX-a,dy:n.clientY-l})},d=function(e){yy(e),vy(e),de.unbind(document,"mousemove",u,!1),de.unbind(document,"mouseup",d,!1)};de.bind(n,"mousedown",(function(e){yy(e),vy(e),a=e.clientX,l=e.clientY;var n=t.getBoundingClientRect();c=n.width,p=n.height,de.bind(document,"mousemove",u),de.bind(document,"mouseup",d)}))}z(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},by.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),de.unbind(t,"keydown",this.keyHandler),de.unbind(t,"mousedown",vy),de.unbind(t,"input",this.autoResize),de.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),Ee(n)),Ee(e)},by.prototype.getValue=function(){return this.content.innerText.trim()},by.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},by.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)},xy.$inject=["eventBus","canvas"],xy.prototype.registerProvider=function(e){this._providers.push(e)},xy.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},xy.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},xy.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},xy.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},xy.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue();r===e.context.text&&i.height===n.height&&i.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},xy.prototype.getValue=function(){return this._textbox.getValue()},xy.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;return 27===t?(e.preventDefault(),this.cancel()):13!==t||e.shiftKey?void 0:(e.preventDefault(),this.complete())},xy.prototype._handleResize=function(e){this._fire("resize",e)},xy.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=b(this._providers,(function(n){return(t=n.activate(e))?n:null}));return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};const wy={__depends__:[fy],__init__:["directEditing"],directEditing:["type",xy]};function _y(e){return function(t){var n=t.target,i=Mr(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,s=(r&&r.$type)===n.eventDefinitionType,a=!!n.triggeredByEvent==!!i.triggeredByEvent,l=void 0===n.isExpanded||n.isExpanded===Xr(e);return!(o&&s&&a&&l)}}var Ey=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throwing",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],Oy=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throwing",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}}],Py=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message intermediate catch event",actionName:"replace-with-message-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Message intermediate throw event",actionName:"replace-with-message-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer intermediate catch event",actionName:"replace-with-timer-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation intermediate throw event",actionName:"replace-with-escalation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional intermediate catch event",actionName:"replace-with-conditional-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Link intermediate catch event",actionName:"replace-with-link-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},{label:"Link intermediate throw event",actionName:"replace-with-link-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},{label:"Compensation intermediate throw event",actionName:"replace-with-compensation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal intermediate catch event",actionName:"replace-with-signal-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Signal intermediate throw event",actionName:"replace-with-signal-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],ky=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message end event",actionName:"replace-with-message-end",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Escalation end event",actionName:"replace-with-escalation-end",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Error end event",actionName:"replace-with-error-end",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel end event",actionName:"replace-with-cancel-end",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Compensation end event",actionName:"replace-with-compensation-end",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal end event",actionName:"replace-with-signal-end",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Terminate end event",actionName:"replace-with-terminate-end",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}],Sy=[{label:"Exclusive gateway",actionName:"replace-with-exclusive-gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},{label:"Parallel gateway",actionName:"replace-with-parallel-gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},{label:"Inclusive gateway",actionName:"replace-with-inclusive-gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},{label:"Complex gateway",actionName:"replace-with-complex-gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},{label:"Event-based gateway",actionName:"replace-with-event-based-gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}}],Cy=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Event sub-process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Sub-process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}}],Ty=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Sub-process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Event sub-process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}}],Ay=Ty,My=[{label:"Task",actionName:"replace-with-task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},{label:"User task",actionName:"replace-with-user-task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},{label:"Service task",actionName:"replace-with-service-task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},{label:"Send task",actionName:"replace-with-send-task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},{label:"Receive task",actionName:"replace-with-receive-task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},{label:"Manual task",actionName:"replace-with-manual-task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},{label:"Business rule task",actionName:"replace-with-rule-task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},{label:"Script task",actionName:"replace-with-script-task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},{label:"Call activity",actionName:"replace-with-call-activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},{label:"Sub-process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},{label:"Sub-process (expanded)",actionName:"replace-with-expanded-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}}],Dy=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],Ry=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],Ny=[{label:"Message boundary event",actionName:"replace-with-message-boundary",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},{label:"Timer boundary event",actionName:"replace-with-timer-boundary",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},{label:"Escalation boundary event",actionName:"replace-with-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},{label:"Conditional boundary event",actionName:"replace-with-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},{label:"Error boundary event",actionName:"replace-with-error-boundary",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},{label:"Cancel boundary event",actionName:"replace-with-cancel-boundary",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},{label:"Signal boundary event",actionName:"replace-with-signal-boundary",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},{label:"Compensation boundary event",actionName:"replace-with-compensation-boundary",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},{label:"Message boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-message-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},{label:"Timer boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},{label:"Escalation boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},{label:"Conditional boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},{label:"Signal boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}}],$y=[{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},{label:"Error start event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},{label:"Escalation start event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},{label:"Compensation start event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},{label:"Message start event (non-interrupting)",actionName:"replace-with-non-interrupting-message-start",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},{label:"Timer start event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-start",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},{label:"Conditional start event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-start",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},{label:"Signal start event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-start",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},{label:"Escalation start event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-start",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}}],jy=[{label:"Sequence flow",actionName:"replace-with-sequence-flow",className:"bpmn-icon-connection"},{label:"Default flow",actionName:"replace-with-default-flow",className:"bpmn-icon-default-flow"},{label:"Conditional flow",actionName:"replace-with-conditional-flow",className:"bpmn-icon-conditional-flow"}],Iy=[{label:"Expanded pool/participant",actionName:"replace-with-expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t},actionName:"replace-with-collapsed-pool",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}}];const Ly={"start-event-non-interrupting":'\n ',"intermediate-event-non-interrupting":'\n '};function By(e,t,n,i,r,o,s,a){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=s,this._moddleCopy=a,this._register()}By.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],By.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},By.prototype.getPopupMenuEntries=function(e){var t=e.businessObject,n=this._rules,i=[];if(h(e)||!n.allowed("shape.replace",{element:e}))return{};var r=_y(e);return Tr(t,"bpmn:DataObjectReference")?this._createEntries(e,Dy):Tr(t,"bpmn:DataStoreReference")&&!Tr(e.parent,"bpmn:Collaboration")?this._createEntries(e,Ry):Tr(t,"bpmn:StartEvent")&&!Tr(t.$parent,"bpmn:SubProcess")?(i=w(Ey,r),this._createEntries(e,i)):Tr(t,"bpmn:Participant")?(i=w(Iy,(function(t){return Xr(e)!==t.target.isExpanded})),this._createEntries(e,i)):Tr(t,"bpmn:StartEvent")&&Yr(t.$parent)?(i=w($y,(function(e){var n=!1!==e.target.isInterrupting,i=t.isInterrupting===n;return r(e)||!r(e)&&!i})),this._createEntries(e,i)):Tr(t,"bpmn:StartEvent")&&!Yr(t.$parent)&&Tr(t.$parent,"bpmn:SubProcess")?(i=w(Oy,r),this._createEntries(e,i)):Tr(t,"bpmn:EndEvent")?(i=w(ky,(function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!Tr(t.$parent,"bpmn:Transaction"))&&r(e)})),this._createEntries(e,i)):Tr(t,"bpmn:BoundaryEvent")?(i=w(Ny,(function(e){var n=e.target;if("bpmn:CancelEventDefinition"==n.eventDefinitionType&&!Tr(t.attachedToRef,"bpmn:Transaction"))return!1;var i=!1!==n.cancelActivity,o=t.cancelActivity==i;return r(e)||!r(e)&&!o})),this._createEntries(e,i)):Tr(t,"bpmn:IntermediateCatchEvent")||Tr(t,"bpmn:IntermediateThrowEvent")?(i=w(Py,r),this._createEntries(e,i)):Tr(t,"bpmn:Gateway")?(i=w(Sy,r),this._createEntries(e,i)):Tr(t,"bpmn:Transaction")?(i=w(Ty,r),this._createEntries(e,i)):Yr(t)&&Xr(e)?(i=w(Ay,r),this._createEntries(e,i)):Tr(t,"bpmn:SubProcess")&&Xr(e)?(i=w(Cy,r),this._createEntries(e,i)):Tr(t,"bpmn:AdHocSubProcess")&&!Xr(e)?(i=w(My,(function(e){var t=e.target,n="bpmn:SubProcess"===t.type,i=!0===t.isExpanded;return _y(t)&&(!n||i)})),this._createEntries(e,i)):Tr(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,jy):Tr(t,"bpmn:FlowNode")?(i=w(My,r),Tr(t,"bpmn:SubProcess")&&!Xr(e)&&(i=w(i,(function(e){return"Sub-process (collapsed)"!==e.label}))),this._createEntries(e,i)):{}},By.prototype.getPopupMenuHeaderEntries=function(e){var t={};return Tr(e,"bpmn:Activity")&&!Yr(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),Tr(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),Tr(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),!Tr(e,"bpmn:SubProcess")||Tr(e,"bpmn:Transaction")||Yr(e)||(t={...t,...this._getAdHocHeaderEntries(e)}),Ed(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},By.prototype._createEntries=function(e,t){var n={},i=this;return _(t,(function(t){n[t.actionName]=i._createEntry(t,e)})),n},By.prototype._createSequenceFlowEntries=function(e,t){var n=Mr(e),i={},r=this._modeling,o=this._moddle,s=this;return _(t,(function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(Tr(n.sourceRef,"bpmn:ExclusiveGateway")||Tr(n.sourceRef,"bpmn:InclusiveGateway")||Tr(n.sourceRef,"bpmn:ComplexGateway")||Tr(n.sourceRef,"bpmn:Activity"))&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){r.updateProperties(e.source,{default:n})}))});break;case"replace-with-conditional-flow":!n.conditionExpression&&Tr(n.sourceRef,"bpmn:Activity")&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){var t=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:t})}))});break;default:Tr(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){r.updateProperties(e,{conditionExpression:void 0})}))}),(Tr(n.sourceRef,"bpmn:ExclusiveGateway")||Tr(n.sourceRef,"bpmn:InclusiveGateway")||Tr(n.sourceRef,"bpmn:ComplexGateway")||Tr(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){r.updateProperties(e.source,{default:void 0})}))})}})),i},By.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=e.label;return o&&"function"==typeof o&&(o=o(t)),n=n||function(){return r(t,e.target)},{label:i(o),className:e.className,action:n}},By.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(n,i){if(i.active)return void t._modeling.updateProperties(e,{loopCharacteristics:void 0});const r=e.businessObject.get("loopCharacteristics"),o=t._moddle.create(i.options.loopCharacteristics);r&&t._moddleCopy.copyElement(r,o),o.set("isSequential",i.options.isSequential),t._modeling.updateProperties(e,{loopCharacteristics:o})}var r,o,s,a=Mr(e).loopCharacteristics;return a&&(r=a.isSequential,o=void 0===a.isSequential,s=void 0!==a.isSequential&&!a.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:s,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:r,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},By.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};var r=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:r,action:function(n,r){t._modeling.updateModdleProperties(e,i,{isCollection:!r.active})}}}},By.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;var r=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!r,action:function(i,r){var o;r.active||(o=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:o})}}}},By.prototype._getAdHocHeaderEntries=function(e){var t=this._translate,n=Tr(Mr(e),"bpmn:AdHocSubProcess"),i=this._bpmnReplace.replaceElement;return{"toggle-adhoc":{className:"bpmn-icon-ad-hoc-marker",title:t("Ad-hoc"),active:n,action:function(t,r){return i(e,n?{type:"bpmn:SubProcess"}:{type:"bpmn:AdHocSubProcess"},{autoResize:!1,layoutConnection:!1})}}}},By.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Mr(e),i=this,r=Od(e),o=Tr(e,"bpmn:BoundaryEvent")?Ly["intermediate-event-non-interrupting"]:Ly["start-event-non-interrupting"],s=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:s,action:function(){i._modeling.updateProperties(e,{[r]:!!s})}}}};const qy={__depends__:[ec,Mf,bc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",By]};function zy(e,t,n,i,r,o,s,a,l,c,p,u,d){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=s,this._create=a,this._popupMenu=l,this._canvas=c,this._rules=p,this._translate=u,this._eventBus=n,this._appendPreview=d,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,(function(e){var t=e.context.shape;if(Vo(e)&&i.isOpen(t)){var n=i.getEntries(t);n.replace&&n.replace.action.click(e,t)}}))}function Fy(e,t,n){var i=e.$instanceOf(t),r=!1;return _(e.eventDefinitions||[],(function(e){e.$type===n&&(r=!0)})),i&&r}zy.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],zy.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&z(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(e,n){t.removeElements(n.slice())}}}}),n},zy.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return h(t)?P(t,(function(e){return n=e,-1!==t.indexOf(n);var n})):t},zy.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,s=this._popupMenu,a=this._rules,l=this._autoPlace,c=this._translate,p=this._appendPreview,u={};if("label"===e.type)return u;var d=e.businessObject;function f(e,t){r.start(e,t)}function m(e,t,n,r){function s(t,n){var s=i.createShape(z({type:e},r));o.start(t,s,{source:n}),p.cleanUp()}var a=l?function(t,n){var o=i.createShape(z({type:e},r));l.append(n,o),p.cleanUp()}:s,c=l?function(t,n){return p.create(n,e,r),()=>{p.cleanUp()}}:null;return{group:"model",className:t,title:n,action:{dragstart:s,click:a,hover:c}}}function g(e){return function(i,r){n.splitLane(r,e),t.open(r,!0)}}if(Ar(d,["bpmn:Lane","bpmn:Participant"])&&Xr(e)){var y=Au(e);z(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),y.length<2&&(e.height>=120&&z(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:g(2)}}}),e.height>=180&&z(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:g(3)}}})),z(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}Tr(d,"bpmn:FlowNode")&&(Tr(d,"bpmn:EventBasedGateway")?z(u,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Fy(d,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?z(u,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):Tr(d,"bpmn:EndEvent")||d.isForCompensation||Fy(d,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Yr(d)||z(u,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),s.isEmpty(e,"bpmn-replace")||z(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(e,n){var i=z(function(e){var n=t.getPad(e).html.getBoundingClientRect();return{x:n.left,y:n.bottom+5}}(n),{cursor:{x:e.x,y:e.y}});s.open(n,"bpmn-replace",i,{title:c("Change element"),width:300,search:!0})}}}}),Tr(d,"bpmn:SequenceFlow")&&z(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Ar(d,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&z(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),Tr(d,"bpmn:TextAnnotation")&&z(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),Ar(d,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&z(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),Tr(d,"bpmn:Group")&&z(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))});var v=a.allowed("elements.delete",{elements:[e]});return h(v)&&(v=v[0]===e),v&&z(u,{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:function(e,t){n.removeElements([t])}}}}),u};const Vy={__depends__:[ny,wy,Ma,is,Ip,pf,qy],__init__:["contextPadProvider"],contextPadProvider:["type",zy]};var Hy={horizontal:["x","width"],vertical:["y","height"]};function Uy(e,t){this._modeling=e,this._filters=[],this.registerFilter((function(e){var n=t.allowed("elements.distribute",{elements:e});return h(n)?n:n?e:[]}))}Uy.$inject=["modeling","rules"],Uy.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Uy.prototype.trigger=function(e,t){var n,i,r=this._modeling;if(!(e.length<3||(this._setOrientation(t),i=this._filterElements(e),(n=this._createGroups(i)).length<=2)))return r.distributeElements(n,this._axis,this._dimension),n},Uy.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(_(t,(function(e){r=e(r,n,i)})),r):e},Uy.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');return _(R(e,i),(function(e,o){var s,a=n._findRange(e,i,r),l=t[t.length-1];l&&n._hasIntersection(l.range,a)?t[t.length-1].elements.push(e):(s={range:a,elements:[e]},t.push(s))})),t},Uy.prototype._setOrientation=function(e){var t=Hy[e];this._axis=t[0],this._dimension=t[1]},Uy.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Uy.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};const Wy={__init__:["distributeElements"],distributeElements:["type",Uy]};function Gy(e){oc.call(this,e)}Gy.$inject=["eventBus"],i(Gy,oc),Gy.prototype.init=function(){this.addRule("elements.distribute",(function(e){var t=e.elements;return!((t=yt(t=w(t,(function(e){var t=Ar(e,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(e.labelTarget||t)})))).length<3)&&t}))};const Qy={horizontal:'',vertical:''};function Xy(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",900,this)}Xy.$inject=["popupMenu","distributeElements","translate","rules"],Xy.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},Xy.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Xy.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu;return{"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:Qy.horizontal,action:function(n,r){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Qy.vertical,action:function(n,r){t.trigger(e,"vertical"),i.close()}}}};const Ky={__depends__:[ec,Wy],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Gy],distributeElementsMenuProvider:["type",Xy]};var Yy="is not a registered action";function Zy(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function Jy(e,t){return new Error(e+" "+t)}Zy.$inject=["eventBus","injector"],Zy.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),s=e.get("canvas",!1),a=e.get("rules",!1),l=e.get("keyboardMove",!1),c=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",(function(){t.undo()})),this.register("redo",(function(){t.redo()}))),o&&i&&this.register("copy",(function(){var e=i.get();if(e.length)return o.copy(e)})),o&&this.register("paste",(function(){o.paste()})),r&&this.register("stepZoom",(function(e){r.stepZoom(e.value)})),s&&this.register("zoom",(function(e){s.zoom(e.value)})),n&&i&&a&&this.register("removeSelection",(function(){var e=i.get();if(e.length){var t,r=a.allowed("elements.delete",{elements:e});!1!==r&&(t=h(r)?r:e).length&&n.removeElements(t.slice())}})),l&&this.register("moveCanvas",(function(e){l.moveCanvas(e)})),c&&this.register("moveSelection",(function(e){c.moveSelection(e.direction,e.accelerated)}))},Zy.prototype.trigger=function(e,t){if(!this._actions[e])throw Jy(e,Yy);return this._actions[e](t)},Zy.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);_(e,(function(e,t){n._registerAction(t,e)}))},Zy.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Jy(e,"is already registered");this._actions[e]=t},Zy.prototype.unregister=function(e){if(!this.isRegistered(e))throw Jy(e,Yy);this._actions[e]=void 0},Zy.prototype.getActions=function(){return Object.keys(this._actions)},Zy.prototype.isRegistered=function(e){return!!this._actions[e]};const ev={__init__:["editorActions"],editorActions:["type",Zy]};function tv(e){e.invoke(Zy,this)}i(tv,Zy),tv.$inject=["injector"],tv.prototype._registerDefaultActions=function(e){Zy.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),s=e.get("handTool",!1),a=e.get("globalConnect",!1),l=e.get("distributeElements",!1),c=e.get("alignElements",!1),p=e.get("directEditing",!1),u=e.get("searchPad",!1),d=e.get("modeling",!1),h=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",(function(){var e=t.getRootElement(),r=n.filter((function(t){return t!==e}));return i.select(r),r})),r&&this._registerAction("spaceTool",(function(){r.toggle()})),o&&this._registerAction("lassoTool",(function(){o.toggle()})),s&&this._registerAction("handTool",(function(){s.toggle()})),a&&this._registerAction("globalConnectTool",(function(){a.toggle()})),i&&l&&this._registerAction("distributeElements",(function(e){var t=i.get(),n=e.type;t.length&&l.trigger(t,n)})),i&&c&&this._registerAction("alignElements",(function(e){var t=i.get(),n=[],r=e.type;t.length&&(n=w(t,(function(e){return!Tr(e,"bpmn:Lane")})),c.trigger(n,r))})),i&&d&&this._registerAction("setColor",(function(e){var t=i.get();t.length&&d.setColor(t,e)})),i&&p&&this._registerAction("directEditing",(function(){var e=i.get();e.length&&p.activate(e[0])})),u&&this._registerAction("find",(function(){u.toggle()})),t&&d&&this._registerAction("moveToOrigin",(function(){var e,i,r=t.getRootElement();e=Et(i=Tr(r,"bpmn:Collaboration")?n.filter((function(e){return Tr(e.parent,"bpmn:Collaboration")})):n.filter((function(e){return e!==r&&!Tr(e.parent,"bpmn:SubProcess")}))),d.moveElements(i,{x:-e.x,y:-e.y},r)})),i&&h&&this._registerAction("replaceElement",(function(e){h.triggerEntry("replace","click",e)}))};const nv={__depends__:[ev],editorActions:["type",tv]};function iv(e){e.on(["create.init","shape.move.init"],(function(e){var t=e.context;Ar(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")}))}iv.$inject=["eventBus"];function rv(e,t,n){return n||(n="round"),Math[n](e/t)*t}function ov(e,t,n){var i=!n||!1!==n.active;this._eventBus=t;var r=this;t.on("diagram.init",800,(function(){r.setActive(i)})),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],1200,(function(t){var n=t.originalEvent;if(!(!r.active||n&&zs(n))){var i=t.context,o=i.gridSnappingContext;o||(o=i.gridSnappingContext={}),["x","y"].forEach((function(n){var i={},o=function(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,s=o.snapLocation,a=o.snapOffset;if(a&&m(a[t]))return a[t];a||(a=o.snapOffset={});m(a[t])||(a[t]=0);if(!r)return a[t];n.get(r.id)||(sv(t)?a[t]+=r[t]+r.width/2:a[t]+=r[t]+r.height/2);if(!s)return a[t];"x"===t?/left/.test(s)?a[t]-=r.width/2:/right/.test(s)&&(a[t]+=r.width/2):/top/.test(s)?a[t]-=r.height/2:/bottom/.test(s)&&(a[t]+=r.height/2);return a[t]}(t,n,e);o&&(i.offset=o);var s=function(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,s=o.snapConstraints;if(s&&s[t])return s[t];s||(s=o.snapConstraints={});s[t]||(s[t]={});var a=n.direction;i&&(sv(t)?(s.x.min=i.left,s.x.max=i.right):(s.y.min=i.top,s.y.max=i.bottom));var l=r.min,c=r.max;l&&(sv(t)?lv(a)?s.x.max=l.left:s.x.min=l.right:av(a)?s.y.max=l.top:s.y.min=l.bottom);c&&(sv(t)?lv(a)?s.x.min=c.left:s.x.max=c.right:av(a)?s.y.min=c.top:s.y.max=c.bottom);return s[t]}(t,n);s&&z(i,s),Pp(t,n)||r.snapEvent(t,n,i)}))}}))}function sv(e){return"x"===e}function av(e){return-1!==e.indexOf("n")}function lv(e){return-1!==e.indexOf("w")}function cv(e,t){hs.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",(function(e){var t=e.context,i=(t.hints||{}).autoResize;if(i){var r=t.shape,o=t.newBounds;y(i)?t.newBounds=n.snapComplex(o,i):t.newBounds=n.snapSimple(r,o)}}))}ov.prototype.snapEvent=function(e,t,n){kp(e,t,this.snapValue(e[t],n))},ov.prototype.getGridSpacing=function(){return 10},ov.prototype.snapValue=function(e,t){var n,i,r=0;return t&&t.offset&&(r=t.offset),e=rv(e+=r,10),t&&t.min&&m(n=t.min)&&(n=rv(n+r,10,"ceil"),e=Math.max(e,n)),t&&t.max&&m(i=t.max)&&(i=rv(i+r,10,"floor"),e=Math.min(e,i)),e-=r},ov.prototype.isActive=function(){return this.active},ov.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},ov.prototype.toggleActive=function(){this.setActive(!this.active)},ov.$inject=["elementRegistry","eventBus","config.gridSnapping"],cv.$inject=["eventBus","gridSnapping","modeling"],i(cv,hs),cv.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t},cv.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e},cv.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),z(e,o),e},cv.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),z(e,o),e};function pv(e,t){e.on(["spaceTool.move","spaceTool.end"],2e3,(function(e){var n,i=e.context;i.initialized&&("x"===i.axis?(n=t.snapValue(e.dx),e.x=e.x+n-e.dx,e.dx=n):(n=t.snapValue(e.dy),e.y=e.y+n-e.dy,e.dy=n))}))}pv.$inject=["eventBus","gridSnapping"];const uv={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",cv],gridSnappingSpaceToolBehavior:["type",pv]}],__init__:["gridSnapping"],gridSnapping:["type",ov]};function dv(e,t){e.on("autoPlace",2e3,(function(e){var n=e.source,i=On(n),r=e.shape,o=gc(n,r);return["x","y"].forEach((function(e){var n={};o[e]!==i[e]&&(o[e]>i[e]?n.min=o[e]:n.max=o[e],Tr(r,"bpmn:TextAnnotation")&&(!function(e){return"x"===e}(e)?n.offset=-r.height/2:n.offset=-r.width/2),o[e]=t.snapValue(o[e],n))})),o}))}dv.$inject=["eventBus","gridSnapping"];function hv(e,t,n){t.on(["create.start","shape.move.start"],1750,(function(t){var i=t.context,r=i.shape,o=e.getRootElement();Tr(r,"bpmn:Participant")&&Tr(o,"bpmn:Process")&&o.children.length&&(i.createConstraints&&(r.width=n.snapValue(r.width,{min:r.width}),r.height=n.snapValue(r.height,{min:r.height})))}))}hv.$inject=["canvas","eventBus","gridSnapping"];function fv(e,t,n){hs.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],3e3,(function(e){var t=e.context,r=t.connection,o=t.hints||{},s=r.waypoints;o.connectionStart||o.connectionEnd||!1===o.createElementsBehavior||function(e){return e.length>3}(s)&&n.updateWaypoints(r,i.snapMiddleSegments(s))}))}function mv(e,t,n){var i=Nt(t,n),r={};return function(e){return"h"===e}(i)&&(r.y=e.snapValue(t.y)),function(e){return"v"===e}(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=z({},t,r),n=z({},n,r)),[t,n]}fv.$inject=["eventBus","gridSnapping","modeling"],i(fv,hs),fv.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var i=1;i5&&Te(s,{x:o.x,width:o.width}),o.height>5&&Te(s,{y:o.y,height:o.height}),i.canExecute?Me(s).remove(Rv):Me(s).add(Rv)})),e.on("resize.cleanup",(function(e){var n,i;n=e.context,i=n.shape,n.frame&&Ke(n.frame),t.removeMarker(i,Dv)}))}Nv.$inject=["eventBus","canvas","previewSupport"];var $v=-6,jv="djs-resizer",Iv=["n","w","s","e","nw","ne","se","sw"];function Lv(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",(function(e){var t=e.newSelection;r.removeResizers(),1===t.length&&_(t,q(r.addResizer,r))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))}))}Lv.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(t){Fo(t)&&i.activate(t,e,n)}de.bind(t,"mousedown",r),de.bind(t,"touchstart",r)},Lv.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=function(e){var t={x:0,y:0};-1!==e.indexOf("e")?t.x=6:-1!==e.indexOf("w")&&(t.x=$v);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=$v);return t}(i),s=Le("g");Me(s).add(jv),Me(s).add(jv+"-"+e.id),Me(s).add(jv+"-"+i),ke(r,s);var a=Le("rect");Te(a,{x:-4+o.x,y:-4+o.y,width:8,height:8}),Me(a).add(jv+"-visual"),ke(s,a);var l=Le("rect");return Te(l,{x:-10+o.x,y:-10+o.y,width:20,height:20}),Me(l).add(jv+"-hit"),ke(s,l),ni(s,t,n),s},Lv.prototype.createResizer=function(e,t){var n=Av(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Lv.prototype.addResizer=function(e){var t=this;!yn(e)&&this._resize.canResize({shape:e})&&_(Iv,(function(n){t.createResizer(e,n)}))},Lv.prototype.removeResizers=function(){Re(this._getResizersParent())},Lv.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Lv.$inject=["eventBus","canvas","selection","resize"];const Bv={__depends__:[jc,Mc,Vp],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Tv],resizePreview:["type",Nv],resizeHandles:["type",Lv]};function qv(e,t,n,i,r,o,s){function a(e,t){(t||Ar(e,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||zv(e))&&i.activate(e)}this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=s,i.registerProvider(this),e.on("element.dblclick",(function(e){a(e.element,!0)})),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],(function(){i.isActive()&&i.complete()})),e.on(["shape.remove","connection.remove"],2e3,(function(e){i.isActive(e.element)&&i.cancel()})),e.on(["commandStack.changed"],(function(e){i.isActive()&&i.cancel()})),e.on("directEditing.activate",(function(e){o.removeResizers()})),e.on("create.end",500,(function(e){var t=e.context,n=t.shape,i=e.context.canExecute;e.isTouch||i&&(t.hints&&!1===t.hints.createElementsBehavior||a(n))})),e.on("autoPlace.end",500,(function(e){a(e.shape)}))}function zv(e){return Tr(e,"bpmn:SubProcess")&&!Xr(e)}qv.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],qv.prototype.activate=function(e){var t=oo(e);if(void 0!==t){var n={text:t};z(n,this.getEditingBBox(e));var i={};return(Ar(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||zv(e))&&z(i,{centerVertically:!0}),eo(e)&&z(i,{autoResize:!0}),Tr(e,"bpmn:TextAnnotation")&&z(i,{resizable:!0,autoResize:!0}),z(n,{options:i}),n}},qv.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r=i.x+i.width/2,o=i.y+i.height/2,s={x:i.x,y:i.y},a=t.zoom(),l=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),p=c.fontSize*a,u=c.lineHeight,d=l.fontSize*a,h=l.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(Tr(e,"bpmn:Lane")||function(e){return Tr(e,"bpmn:Participant")&&Xr(e)}(e)){var m=Kr(e);z(s,m?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:o-30*a/2}:{width:i.width,height:30*a}),z(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(function(e){return Tr(e,"bpmn:Participant")&&!Xr(e)}(e)){var g=Kr(e);z(s,g?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r-i.height/2,y:o-i.width/2}),z(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(Ar(e,["bpmn:Task","bpmn:CallActivity"])||zv(e))&&(z(s,{width:i.width,height:i.height}),z(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),function(e){return Tr(e,"bpmn:SubProcess")&&Xr(e)}(e)&&(z(s,{width:i.width,x:i.x}),z(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var y=90*a,v=7*a,b=4*a;if(n.labelTarget&&(z(s,{width:y,height:i.height+v+b,x:r-y/2,y:i.y-v}),z(f,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})),eo(n)&&!to(n)&&!vn(n)){var x=io(e),w=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),_=p+v+b;z(s,{width:y,height:_,x:w.x-y/2,y:w.y-_/2}),z(f,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})}return Tr(e,"bpmn:TextAnnotation")&&(z(s,{width:i.width,height:i.height,minWidth:30*a,minHeight:10*a}),z(f,{textAlign:"left",paddingTop:5*a+"px",paddingBottom:7*a+"px",paddingLeft:7*a+"px",paddingRight:5*a+"px",fontSize:d+"px",lineHeight:h})),{bounds:s,style:f}},qv.prototype.update=function(e,t,n,i){var r,o,s;Tr(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),(s=t)&&s.trim()||(t=null),this._modeling.updateLabel(e,t,r)};var Fv="djs-element-hidden",Vv="djs-label-hidden";function Hv(e,t,n){var i,r,o,s=this,a=t.getDefaultLayer();e.on("directEditing.activate",(function(e){var l=e.active;if(Tr(i=l.element.label||l.element,"bpmn:TextAnnotation")){r=t.getAbsoluteBBox(i),o=Le("g");var c=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:i.width,containerHeight:i.height,position:{mx:0,my:0}}),p=s.path=Le("path");Te(p,{d:c,strokeWidth:2,stroke:Uv(i)}),ke(o,p),ke(a,o),ii(o,i.x,i.y)}Tr(i,"bpmn:TextAnnotation")||i.labelTarget?t.addMarker(i,Fv):(Tr(i,"bpmn:Task")||Tr(i,"bpmn:CallActivity")||Tr(i,"bpmn:SubProcess")||Tr(i,"bpmn:Participant"))&&t.addMarker(i,Vv)})),e.on("directEditing.resize",(function(e){if(Tr(i,"bpmn:TextAnnotation")){var t=e.height,o=e.dy,a=Math.max(i.height/r.height*(t+o),0),l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:i.width,containerHeight:a,position:{mx:0,my:0}});Te(s.path,{d:l})}})),e.on(["directEditing.complete","directEditing.cancel"],(function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,Fv),t.removeMarker(i,Vv)),i=void 0,r=void 0,o&&(Ke(o),o=void 0)}))}function Uv(e,t){return Dr(e).get("stroke")||t||"black"}Hv.$inject=["eventBus","canvas","pathMap"];const Wv={__depends__:[ds,Bv,wy],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",qv],labelEditingPreview:["type",Hv]};var Gv=new rs("tt");function Qv(e,t){e.style.display=!1===t?"none":""}var Xv="djs-tooltip",Kv="."+Xv;function Yv(e,t){var n,i;this._eventBus=e,this._canvas=t,this._ids=Gv,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),Z(i=be(''),{position:"absolute",width:"0",height:"0"}),n.insertBefore(i,n.firstChild),i);var r=this;me.bind(this._tooltipRoot,Kv,"mousedown",(function(e){e.stopPropagation()})),me.bind(this._tooltipRoot,Kv,"mouseover",(function(e){r.trigger("mouseover",e)})),me.bind(this._tooltipRoot,Kv,"mouseout",(function(e){r.trigger("mouseout",e)})),this._init()}Yv.$inject=["eventBus","canvas"],Yv.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=z({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Yv.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(J(n,"data-tooltip-id"));i&&("mouseover"===e&&i.timeout&&this.clearTimeout(i),"mouseout"===e&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Yv.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},Yv.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Yv.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout((function(){t.remove(e)}),e.timeout)}},Yv.prototype.remove=function(e){var t=this.get(e);t&&(Ee(t.html),Ee(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Yv.prototype.show=function(){Qv(this._tooltipRoot)},Yv.prototype.hide=function(){Qv(this._tooltipRoot,!1)},Yv.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},Yv.prototype._addTooltip=function(e){var t,n=e.id,i=e.html,r=this._tooltipRoot;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),y(i)&&(i=be(i)),Z(t=be(''),{position:"absolute"}),t.appendChild(i),e.type&&te(t).add("djs-tooltip-"+e.type),e.className&&te(t).add(e.className),e.htmlContainer=t,r.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},Yv.prototype._updateTooltip=function(e){var t=e.position;!function(e,t,n){Z(e,{left:t+"px",top:n+"px"})}(e.htmlContainer,t.x,t.y)},Yv.prototype._updateTooltipVisibilty=function(e){_(this._tooltips,(function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom"+r+"
"}))}))}Jv.$inject=["eventBus","tooltips","translate"];const eb={__depends__:[Zv],__init__:["modelingFeedback"],modelingFeedback:["type",Jv]};var tb=Math.round;function nb(e,t,n,i,r){function o(e,t,n,i){return r.allowed("elements.move",{shapes:e,delta:t,position:n,target:i})}function s(e,n,i,r){if(f(i)&&(r=i,i=!1),!n.waypoints&&n.parent&&!Me(e.target).has("djs-hit-no-move")){var o=function(e){return{x:e.x+tb(e.width/2),y:e.y+tb(e.height/2)}}(n);return t.init(e,o,"shape.move",{cursor:"grabbing",autoActivate:i,data:{shape:n,context:r||{}}}),!0}}e.on("shape.move.start",1500,(function(e){var t=e.context,n=e.shape,r=i.get().slice();-1===r.indexOf(n)&&(r=[n]),r=function(e){var t=A(e,"id");return w(e,(function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0}))}(r),z(t,{shapes:r,validatedShapes:r,shape:n})})),e.on("shape.move.start",1250,(function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=o(n)))return!1})),e.on("shape.move.move",500,(function(e){var t,n=e.context,i=n.validatedShapes,r=e.hover,s={x:e.dx,y:e.dy};t=o(i,s,{x:e.x,y:e.y},r),n.delta=s,n.canExecute=t,n.target=null!==t?r:null})),e.on("shape.move.end",(function(e){var t=e.context,i=t.delta,r=t.canExecute,o="attach"===r,s=t.shapes;if(!1===r)return!1;i.x=tb(i.x),i.y=tb(i.y),0===i.x&&0===i.y||n.moveElements(s,i,t.target,{primaryShape:t.shape,attach:o})})),e.on("element.mousedown",(function(e){if(Fo(e)){var t=Io(e);if(!t)throw new Error("must supply DOM mousedown event");return s(t,e.element)}})),this.start=s}nb.$inject=["eventBus","dragging","modeling","selection","rules"];var ib="djs-dragging",rb="drop-ok",ob="drop-not-ok",sb="new-parent",ab="attach-ok";function lb(e,t,n,i){function r(e){var t=function(e){var t=w(e,(function(t){return!yn(t)||b(e,N({id:t.source.id}))&&b(e,N({id:t.target.id}))}));return t}(o(e));return t}function o(e){var t=_t(e,!0),n=S(t,(function(e){return(e.incoming||[]).concat(e.outgoing||[])}));return a(t.concat(n))}function s(e,n){[ab,rb,ob,sb].forEach((function(i){i===n?t.addMarker(e,i):t.removeMarker(e,i)}))}e.on("shape.move.start",499,(function(e){var s=e.context,l=s.shapes,c=s.allDraggedElements,p=r(l);if(!s.dragGroup){var u=Le("g");Te(u,n.cls("djs-drag-group",["no-events"])),ke(t.getActiveLayer(),u),s.dragGroup=u}p.forEach((function(e){i.addDragger(e,s.dragGroup)})),_(c=c?a([c,o(l)]):o(l),(function(e){t.addMarker(e,ib)})),s.allDraggedElements=c,s.differentParents=1!==function(e){return C(e).length}(A(l,(function(e){return e.parent&&e.parent.id})))})),e.on("shape.move.move",499,(function(e){var t=e.context,n=t.dragGroup,i=t.target,r=t.shape.parent,o=t.canExecute;i&&("attach"===o?s(i,ab):t.canExecute&&i&&i.id!==r.id?s(i,sb):s(i,t.canExecute?rb:ob)),ii(n,e.dx,e.dy)})),e.on(["shape.move.out","shape.move.cleanup"],(function(e){var t=e.context.target;t&&s(t,null)})),e.on("shape.move.cleanup",(function(e){var n=e.context,i=n.allDraggedElements,r=n.dragGroup;_(i,(function(e){t.removeMarker(e,ib)})),r&&Ke(r)})),this.makeDraggable=function(e,n,r){i.addDragger(n,e.dragGroup),r&&t.addMarker(n,ib),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}}lb.$inject=["eventBus","canvas","styles","previewSupport"];const cb={__depends__:[Qo,is,Ko,jc,Mc,Vp],__init__:["move","movePreview"],move:["type",nb],movePreview:["type",lb]},pb={width:36,height:50},ub={width:50,height:50};function db(e,t,n){return Le("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}function hb(e,t){this._styles=t,e.registerProvider(this)}function fb(e,t){var n;return"bpmn:DataObjectReference"===t?n=pb:"bpmn:DataStoreReference"===t&&(n=ub),e.width===n.width&&e.height===n.height}hb.$inject=["outline","styles"],hb.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(!vn(e))return Tr(e,"bpmn:Gateway")?(z((n=Le("rect")).style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Te(n,z({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Ar(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group"])?Te(n=Le("rect"),z({x:-5,y:-5,rx:14,width:e.width+10,height:e.height+10},t)):Tr(e,"bpmn:EndEvent")?Te(n=Le("circle"),z({cx:e.width/2,cy:e.height/2,r:e.width/2+5+1},t)):Tr(e,"bpmn:Event")?Te(n=Le("circle"),z({cx:e.width/2,cy:e.height/2,r:e.width/2+5},t)):Tr(e,"bpmn:DataObjectReference")&&fb(e,"bpmn:DataObjectReference")?n=db("M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z",{x:-6,y:-6},t):Tr(e,"bpmn:DataStoreReference")&&fb(e,"bpmn:DataStoreReference")&&(n=db("M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z",{x:-6,y:-6},t)),n},hb.prototype.updateOutline=function(e,t){if(!vn(e))return Ar(e,["bpmn:SubProcess","bpmn:Group"])?(Te(t,{width:e.width+10,height:e.height+10}),!0):!!Ar(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};const mb={__depends__:[Ko],__init__:["outlineProvider"],outlineProvider:["type",hb]};var gb=".djs-palette-toggle",yb=".entry",vb=gb+", "+yb,bb="djs-palette-",xb="open",wb="two-column";function _b(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",(function(e){var t=e.tool;n.updateToolHighlight(t)})),e.on("i18n.changed",(function(){n._update()})),e.on("diagram.init",(function(){n._diagramInitialized=!0,n._rebuild()}))}function Eb(e,t){var n=t.getPaletteEntries();return g(n)?n(e):(_(n,(function(t,n){e[n]=t})),e)}_b.$inject=["eventBus","canvas"],_b.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},_b.prototype.getEntries=function(){return this._getProviders().reduce(Eb,{})},_b.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},_b.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=be(_b.HTML_MARKUP);n.appendChild(i),te(n).add(bb+"shown"),me.bind(i,vb,"click",(function(t){if(xe(t.delegateTarget,gb))return e.toggle();e.trigger("click",t)})),de.bind(i,"mousedown",(function(e){e.stopPropagation()})),me.bind(i,yb,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},_b.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},_b.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),i=this._container,r=this._eventBus,o=te(i),s=te(n);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle(wb,t),s.toggle(bb+wb,t),"open"in e&&(o.toggle(xb,e.open),s.toggle(bb+xb,e.open)),r.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},_b.prototype._update=function(){var e=we(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ie(e),_(t,(function(t,n){var i=t.group||"default",r=we("[data-group="+ys(i)+"]",e);r||(J(r=be(''),"data-group",i),e.appendChild(r));var o=t.html||(t.separator?'
':''),s=be(o);if(r.appendChild(s),!t.separator&&(J(s,"data-action",n),t.title&&J(s,"title",t.title),t.className&&function(e,t){var n=te(e);(h(t)?t:t.split(/\s+/g)).forEach((function(e){n.add(e)}))}(s,t.className),t.imageUrl)){var a=be("
");J(a,"src",t.imageUrl),s.appendChild(a)}})),this.open()},_b.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=J(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},_b.prototype.triggerEntry=function(e,t,n,i){var r,o;if((r=this._entries[e])&&(o=r.action,!1!==this._eventBus.fire("palette.trigger",{entry:r,event:n}))){if(g(o)){if("click"===t)return o(n,i)}else if(o[t])return o[t](n,i);n.preventDefault()}},_b.prototype._layoutChanged=function(){this._toggleState({})},_b.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},_b.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},_b.prototype.open=function(){this._toggleState({open:!0})},_b.prototype.toggle=function(){this.isOpen()?this.close():this.open()},_b.prototype.isActiveTool=function(e){return e&&this._activeTool===e},_b.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=we(".djs-palette-entries",this._container),this._toolsContainer=we("[data-group=tools]",t)),_(this._toolsContainer.children,(function(t){var n=t.getAttribute("data-action");if(n){var i=te(t);n=n.replace("-tool",""),i.contains("entry")&&n===e?i.add("highlighted-entry"):i.remove("highlighted-entry")}}))},_b.prototype.isOpen=function(){return te(this._container).has(xb)},_b.prototype._getParentContainer=function(){return this._canvas.getContainer()},_b.HTML_MARKUP='';const Ob={__init__:["palette"],palette:["type",_b]};var Pb="crosshair";function kb(e,t,n,i,r,o,s){this._selection=r,this._dragging=n,this._mouse=s;var a=this,l=function(e){var n,i=t.getActiveLayer();Te(n=e.frame=Le("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ke(i,n)},c=function(e){var t=e.frame,n=e.bbox;Te(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&Ke(e.frame)};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",(function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("lasso.selection.ended",(function(){a.activateLasso(t.originalEvent,!0)}))})),e.on("lasso.end",(function(e){var t=Sb(e),n=i.filter((function(e){return e}));a.select(n,t)})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=Sb(e),l(t)})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=Sb(e),c(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;p(t)})),e.on("element.mousedown",1500,(function(e){if(Ho(e))return a.activateLasso(e.originalEvent),!0}))}function Sb(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y};return t.x<=n.x&&t.y=n.x&&t.yn.x&&t.y<=n.y?{x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x=n.y?{x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?{x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:{x:n.x,y:n.y,width:0,height:0}}kb.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],kb.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Pb,data:{context:{}}})},kb.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Pb,data:{context:{}}})},kb.prototype.select=function(e,t){var n=function(e,t){var n={};return _(e,(function(e){var i=e;i.waypoints&&(i=Et(i)),!m(t.y)&&i.x>t.x&&(n[e.id]=e),!m(t.x)&&i.y>t.y&&(n[e.id]=e),i.x>t.x&&i.y>t.y&&(m(t.width)&&m(t.height)&&i.width+i.xt[i]+r-n&&kp(e,i,t[i]+r-n)}))}(e,r,function(e){return Tr(e,"bpmn:Task")?10:20}(r)),r&&function(e,t){return k(t,(function(t){return Gb(e,t)}))}(n,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(t.connectionStart=Op(i),Ar(r,["bpmn:Event","bpmn:Gateway"])&&Wb(e,Op(r)),Ar(r,["bpmn:Task","bpmn:SubProcess"])&&function(e,t){var n=Op(t);Vb.forEach((function(i){(function(e,t,n){return e[n]>t[n]+20&&e[n]r[t]?r[t]+Fb:r[t]-Fb,kp(e,t,n))}))}(e)):Gb(n,"bpmn:MessageFlow")?(Tr(i,"bpmn:Event")&&(t.connectionStart=Op(i)),Tr(r,"bpmn:Event")&&Wb(e,Op(r))):t.connectionStart=t.initialConnectionStart)}))}function Wb(e,t){kp(e,"x",t.x),kp(e,"y",t.y)}function Gb(e,t){return e&&e.type===t}function Qb(e,t){return"x"===e?t.width:t.height}function Xb(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function Kb(){this._snapValues={}}Ub.$inject=["eventBus"],Xb.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Xb.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},Xb.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Xb.prototype.getSnapLocations=function(){return this._snapLocations},Xb.prototype.setSnapLocations=function(e){this._snapLocations=e},Xb.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Kb).initDefaults(this._defaultSnaps),n},Kb.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),-1===n.x.indexOf(t.x)&&n.x.push(t.x),-1===n.y.indexOf(t.y)&&n.y.push(t.y)},Kb.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&function(e,t,n){var i,r;for(n=void 0===n?10:n,i=0;i=e.x||i&&i<=e.x)&&kp(e,"x",e.x),(n&&n>=e.y||r&&r<=e.y)&&kp(e,"y",e.y)}}function ex(e,t){return-1!==e.indexOf(t)}function tx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}i(Zb,Yb),Zb.$inject=["eventBus","injector"],Zb.prototype.initSnap=function(e){var t=Yb.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return _(n.outgoing,(function(n){var r=n.waypoints[0];r=r.original||r,t.setSnapOrigin(n.id+"-docking",tx(r,i,e))})),_(n.incoming,(function(n){var r=n.waypoints[n.waypoints.length-1];r=r.original||r,t.setSnapOrigin(n.id+"-docking",tx(r,i,e))})),Tr(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Zb.prototype.addSnapTargetPoints=function(e,t,n){Yb.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);_(i,(function(n){var i;(function(e){if(Tr(e,"bpmn:SubProcess")&&Xr(e))return!0;return Tr(e,"bpmn:Participant")}(n)||(i="bpmn:TextAnnotation",[t,n].every((function(e){return Tr(e,i)}))))&&(e.add("top-left",_p(n)),e.add("bottom-right",Ep(n)))}));var r=this._elementRegistry;return _(t.incoming,(function(n){if(r.get(t.id)){ex(i,n.source)||e.add("mid",On(n.source));var o=n.waypoints[0];e.add(n.id+"-docking",o.original||o)}})),_(t.outgoing,(function(n){if(r.get(t.id)){ex(i,n.target)||e.add("mid",On(n.target));var o=n.waypoints[n.waypoints.length-1];e.add(n.id+"-docking",o.original||o)}})),Tr(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Zb.prototype.getSnapTargets=function(e,t){return Yb.prototype.getSnapTargets.call(this,e,t).filter((function(e){return!Tr(e,"bpmn:Lane")}))};function nx(e,t){var n=this;e.on(["resize.start"],(function(e){n.initSnap(e)})),e.on(["resize.move","resize.end"],1250,(function(e){var i=e.context,r=i.shape,o=r.parent,s=i.direction,a=i.snapContext;if(!(e.originalEvent&&zs(e.originalEvent)||Pp(e))){var l=a.pointsForTarget(o);l.initialized||((l=n.addSnapTargetPoints(l,r,o,s)).initialized=!0),function(e){return"n"===e||"s"===e}(s)&&kp(e,"x",e.x),function(e){return"e"===e||"w"===e}(s)&&kp(e,"y",e.y),t.snap(e,l)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function ix(e,t){var n=On(e),i=wn(e),r={x:n.x,y:n.y};return-1!==t.indexOf("n")?r.y=i.top:-1!==t.indexOf("s")&&(r.y=i.bottom),-1!==t.indexOf("e")?r.x=i.right:-1!==t.indexOf("w")&&(r.x=i.left),r}nx.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Xb);var o=ix(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},nx.prototype.addSnapTargetPoints=function(e,t,n,i){return _(this.getSnapTargets(t,n),(function(t){e.add("corner",Ep(t)),e.add("corner",_p(t))})),e.add("corner",ix(t,i)),e},nx.$inject=["eventBus","snapping"],nx.prototype.getSnapTargets=function(e,t){return Sp(t).filter((function(t){return!(n=t,i=e,n.host===i||yn(t)||function(e){return!!e.hidden}(t)||vn(t));var n,i}))};function rx(e){this._canvas=e,this._asyncHide=B(q(this.hide,this),1e3)}rx.$inject=["canvas"],rx.prototype.snap=function(e,t){var n=e.context.snapContext,i=n.getSnapLocations(),r={x:Pp(e,"x"),y:Pp(e,"y")};_(i,(function(i){var o=n.getSnapOrigin(i),s={x:e.x+o.x,y:e.y+o.y};if(_(["x","y"],(function(e){var n;r[e]||void 0!==(n=t.snap(s,i,e,7))&&(r[e]={value:n,originValue:n-o[e]})})),r.x&&r.y)return!1})),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),_(["x","y"],(function(t){var n=r[t];f(n)&&kp(e,t,n.originValue)}))},rx.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Le("path");return Te(n,{d:"M0,0 L0,0"}),Me(n).add("djs-snap-line"),ke(t,n),{update:function(t){m(t)?Te(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):Te(n,{display:"none"})}}},rx.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},rx.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},rx.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},rx.prototype.hide=function(){_(this._snapLines,(function(e){e.update()}))};const ox={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Yb],resizeSnapping:["type",nx],snapping:["type",rx]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Ub],createMoveSnapping:["type",Zb]};function sx(e,t,n,i){this._open=!1,this._results=[],this._eventMaps=[],this._canvas=e,this._eventBus=t,this._overlays=n,this._selection=i,this._container=be(sx.BOX_HTML),this._searchInput=we(sx.INPUT_SELECTOR,this._container),this._resultsContainer=we(sx.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}function ax(e,t,n){var i=function(e){var t="";return e.forEach((function(e){e.matched?t+=''+bs(e.matched)+"":t+=bs(e.normal)})),""!==t?t:null}(t),r=be(n);r.innerHTML=i,e.appendChild(r)}sx.$inject=["canvas","eventBus","overlays","selection"],sx.prototype._bindEvents=function(){var e=this;function t(t,n,i,r){e._eventMaps.push({el:t,type:i,listener:me.bind(t,n,i,r)})}t(document,"html","click",(function(t){e.close()})),t(this._container,sx.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,sx.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,sx.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,sx.INPUT_SELECTOR,"keydown",(function(e){Fs("ArrowUp",e)&&e.preventDefault(),Fs("ArrowDown",e)&&e.preventDefault()})),t(this._container,sx.INPUT_SELECTOR,"keyup",(function(t){if(Fs("Escape",t))return e.close();if(Fs("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close()}return Fs("ArrowUp",t)?e._scrollToDirection(!0):Fs("ArrowDown",t)?e._scrollToDirection():void(Fs(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},sx.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){me.unbind(e.el,e.type,e.listener)}))},sx.prototype._search=function(e){var t=this;if(this._clearResults(),e&&""!==e){var n=this._searchProvider.find(e);if(n.length){n.forEach((function(e){var n=e.element.id,i=t._createResultNode(e,n);t._results[n]={element:e.element,node:i}}));var i=we(sx.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}}},sx.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},sx.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t0&&ax(n,e.primaryTokens,sx.RESULT_PRIMARY_HTML),ax(n,e.secondaryTokens,sx.RESULT_SECONDARY_HTML),J(n,sx.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},sx.prototype.registerProvider=function(e){this._searchProvider=e},sx.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,te(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},sx.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,te(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},sx.prototype.toggle=function(){this.isOpen()?this.close():this.open()},sx.prototype.isOpen=function(){return this._open},sx.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&te(t).remove(sx.RESULT_SELECTED_CLASS);var n=J(e,sx.RESULT_ID_ATTRIBUTE),i=this._results[n].element;te(e).add(sx.RESULT_SELECTED_CLASS),this._resetOverlay(i),this._canvas.scrollToElement(i,{top:400}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},sx.prototype._select=function(e){var t=J(e,sx.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this.close(),this._resetOverlay(),this._canvas.scrollToElement(n,{top:400}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},sx.prototype._resetOverlay=function(e){if(this._overlayId&&this._overlays.remove(this._overlayId),e){var t=function(e){var t=6,n=e.width+2*t,i=e.height+2*t,r={width:n+"px",height:i+"px"},o=be('');return Z(o,r),{position:{bottom:i-t,right:n-t},show:!0,html:o}}(Et(e));this._overlayId=this._overlays.add(e,t)}},sx.CONTAINER_SELECTOR=".djs-search-container",sx.INPUT_SELECTOR=".djs-search-input input",sx.RESULTS_CONTAINER_SELECTOR=".djs-search-results",sx.RESULT_SELECTOR=".djs-search-result",sx.RESULT_SELECTED_CLASS="djs-search-result-selected",sx.RESULT_SELECTED_SELECTOR="."+sx.RESULT_SELECTED_CLASS,sx.RESULT_ID_ATTRIBUTE="data-result-id",sx.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",sx.OVERLAY_CLASS="djs-search-overlay",sx.BOX_HTML='',sx.RESULT_HTML='',sx.RESULT_PRIMARY_HTML='',sx.RESULT_SECONDARY_HTML='';const lx={__depends__:[ps,is],searchPad:["type",sx]};function cx(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function px(e){return w(e,(function(e){return!!e.matched})).length>0}function ux(e,t){var n=[],i=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();var r=e.indexOf(t);return r>-1?(0!==r&&n.push({normal:i.substr(0,r)}),n.push({matched:i.substr(r,t.length)}),t.length+r')},hx.prototype._interactionModules=[Ys,oa,wa,ua],hx.prototype._modelingModules=[ac,bc,Nc,Oc,Mp,Ip,Bp,Vy,_f,pf,Ky,nv,gv,vv,xv,Cv,Wv,Jg,eb,cb,mb,Bb,zb,Bv,ox,dx],hx.prototype._modules=[].concat(js.prototype._modules,hx.prototype._interactionModules,hx.prototype._modelingModules);var mx={min:.2,max:4};function gx(e,t,n,i,r){var o=this;this._canvas=i,this._elementRegistry=r,this._eventBus=n,this._injector=t,this._state={isOpen:void 0,isDragging:!1,initialDragPosition:null,offsetViewport:null,cachedViewbox:null,dragger:null,svgClientRect:null,parentClientRect:null,zoomDelta:0},this._init();var s=new(fa().Manager)(document);s.add(new(fa().Pan)),s.on("panmove",u),s.on("panend",d);var a=new(fa().Manager)(this._svg);a.add(new(fa().Pan)),a.on("panstart",p(!0)),a.add(new(fa().Tap)),a.on("tap",(function(e){c(kx(e))}));var l=new(fa().Manager)(this._viewportDom);function c(e){o._state._svgClientRect&&!wx(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),vx(yx({x:e.x-o._state._svgClientRect.left,y:e.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),o._canvas),o._update()}function p(e){return function(t){var n=kx(t);o._state._svgClientRect&&!wx(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),e&&c(n);var r=yx({x:n.x-o._state._svgClientRect.left,y:n.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),s=i.viewbox(),a=function(e,t){var n={x:t.x+t.width/2,y:t.y+t.height/2};return{x:e.x-n.x,y:e.y-n.y}}(r,s),l=o._viewportDom.getBoundingClientRect(),p={x:n.x-l.left+1,y:n.y-l.top+1};z(o._state,{cachedViewbox:s,initialDragPosition:{x:n.x,y:n.y},isDragging:!0,offsetViewport:a,offsetViewportDom:p,viewportClientRect:o._viewport.getBoundingClientRect(),parentClientRect:o._parent.getBoundingClientRect()}),de.bind(document,"mousemove",u),de.bind(document,"mouseup",d)}}function u(e){var t=kx(e);if(o._state.isDragging){o._state._svgClientRect&&!wx(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect());var n=o._state.offsetViewportDom,i=o._state.viewportClientRect,r=o._state.parentClientRect;z(o._viewportDom.style,{top:t.y-n.y-r.top+"px",left:t.x-n.x-r.left+"px"});var s=Ex(r,{top:t.y-n.y-r.top,left:t.x-n.x-r.left,width:i.width,height:i.height});z(o._overlay.style,{clipPath:s});var a=yx({x:t.x-o._state._svgClientRect.left,y:t.y-o._state._svgClientRect.top},o._svg,o._lastViewbox);vx({x:a.x-o._state.offsetViewport.x,y:a.y-o._state.offsetViewport.y},o._canvas)}}function d(e){var t=kx(e);o._state.isDragging&&(o._state.initialDragPosition.x===t.x&&o._state.initialDragPosition.y===t.y&&c(e),o._update(),z(o._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),de.unbind(document,"mousemove",u),de.unbind(document,"mouseup",d))}l.add(new(fa().Pan)),l.on("panstart",p(!1)),this.toggle(e&&e.open||!1),de.bind(this._viewportDom,"mousedown",p(!1)),de.bind(this._svg,"mousedown",p(!0)),de.bind(this._parent,"wheel",(function(e){if(e.preventDefault(),e.stopPropagation(),e.ctrlKey&&(o._state._svgClientRect&&!wx(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),t=e,n=o._state._svgClientRect,t.x>n.left&&t.xn.top&&t.y.1){var u=p>0?1:-1,d=Math.log(i.zoom())/Math.log(10),h=(r=mx,s=20,a=Math.log(r.min)/Math.log(10),l=Math.log(r.max)/Math.log(10),(Math.abs(a)+Math.abs(l))/s),f=Math.round(d/h)*h;f+=h*u;var m=Math.pow(10,f);i.zoom(function(e,t){return Math.max(e.min,Math.min(e.max,t))}(mx,m),g),o._state.zoomDelta=0;var g=yx({x:e.clientX-o._state._svgClientRect.left,y:e.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox);vx(g,o._canvas),o._update()}}})),de.bind(this._toggle,"click",(function(e){e.preventDefault(),e.stopPropagation(),o.toggle()})),n.on(["shape.added","connection.added"],(function(e){var t=e.element;o._addElement(t),o._update()})),n.on(["shape.removed","connection.removed"],(function(e){var t=e.element;o._removeElement(t),o._update()})),n.on("elements.changed",250,(function(e){e.elements.forEach((function(e){o._updateElement(e)})),o._update()})),n.on("element.updateId",(function(e){var t=e.element,n=e.newId;o._updateElementId(t,n)})),n.on("canvas.viewbox.changed",(function(){o._state.isDragging||o._update()})),n.on("canvas.resized",(function(){document.body.contains(o._parent)&&(o._state.isDragging||o._update(),o._state._svgClientRect=o._svg.getBoundingClientRect())})),n.on(["root.set","plane.set"],(function(e){o._clear(),(e.element||e.plane.rootElement).children.forEach((function(e){o._addElement(e)})),o._update()}))}function yx(e,t,n){var i=t.getBoundingClientRect(),r=function(e,t){var n=e.width/e.height,i=z({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var r=i.width*(1/t);z(i,{y:i.y-(r-i.height)/2,height:r})}else if(na?xx(o,s,a):xx(o,s,s.childNodes.length-1):this._elementsGroup.appendChild(o),!function(e){return e.waypoints}(e)?(i=e.x,r=e.y,s&&(i-=(n=e.parent).x,r-=n.y),Te(o,{transform:"translate("+i+" "+r+")"})):(i=0,r=0,void 0!==(n=e.parent).x&&void 0!==n.y&&(i=-n.x,r=-n.y),Te(o,{transform:"translate("+i+" "+r+")"})),e.children&&e.children.length&&e.children.forEach((function(e){t._addElement(e)})),o}}},gx.prototype._removeElement=function(e){var t=this._svg.getElementById(e.id);t&&Ke(t)},gx.prototype._createElement=function(e){var t,n=this._elementRegistry.getGraphics(e);if(n&&(t=function(e){return e.childNodes[0]}(n),t)){var i=Ne(t);return Te(i,{id:e.id}),i}},gx.prototype._clear=function(){Re(this._elementsGroup)};var _x=Math.sign||function(e){return e>=0?1:-1};function Ex(e,t){return"polygon("+[Ox(t.left,t.top),Ox(t.left+t.width,t.top),Ox(t.left+t.width,t.top+t.height),Ox(t.left,t.top+t.height),Ox(t.left,e.height),Ox(e.width,e.height),Ox(e.width,0),Ox(0,0),Ox(0,e.height),Ox(t.left,e.height)].join(", ")+")"}function Ox(e,t){return e+"px "+t+"px"}function Px(e){return P(e,(function(e){return f(e)?Px(e):m(e)&&isFinite(e)}))}function kx(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}var Sx={__init__:["minimap"],minimap:["type",gx]};function Cx(e,t,n){return n||(n="round"),Math[n](e/t)*t}function Tx(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ax(e){for(var t=e.waypoints,n=t.reduce((function(e,n,i){var r=t[i-1];if(r){var o=e[e.length-1],s=o&&o.endLength||0,a=function(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}(r,n);e.push({start:r,end:n,startLength:s,endLength:s+a,length:a})}return e}),[]),i=n.reduce((function(e,t){return e+t.length}),0)/2,r=0,o=n[r];o.endLength2&&(s.children=arguments.length>3?Kx.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===s[o]&&(s[o]=e.defaultProps[o]);return uw(e,s,i,r,null)}function uw(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++Zx:r,__i:-1,__u:0};return null==r&&null!=Yx.vnode&&Yx.vnode(o),o}function dw(e){return e.children}function hw(e,t){this.props=e,this.context=t}function fw(e,t){if(null==t)return e.__?fw(e.__,e.__i+1):null;for(var n;tt&&Jx.sort(nw));yw.__r=0}function vw(e,t,n,i,r,o,s,a,l,c,p){var u,d,h,f,m,g=i&&i.__k||ow,y=t.length;for(n.__d=l,function(e,t,n){var i,r,o,s,a,l=t.length,c=n.length,p=c,u=0;for(e.__k=[],i=0;i0?uw(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)?(r.__=e,r.__b=e.__b+1,a=ww(r,n,s=i+u,p),r.__i=a,o=null,-1!==a&&(p--,(o=n[a])&&(o.__u|=131072)),null==o||null===o.__v?(-1==a&&u--,"function"!=typeof r.type&&(r.__u|=65536)):a!==s&&(a===s+1?u++:a>s?p>l-s?u+=a-s:u--:u=a(null==l||131072&l.__u?0:1))for(;s>=0||a=0){if((l=t[s])&&!(131072&l.__u)&&r==l.key&&o===l.type)return s;s--}if(a=n.__.length&&n.__.push({__V:Bw}),n.__[e]}function Ww(e){return Iw=1,Gw(s_,e)}function Gw(e,t,n){var i=Uw(Rw++,2);if(i.t=e,!i.__c&&(i.__=[n?n(t):s_(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=Nw,!Nw.u)){var r=function(e,t,n){if(!i.__c.__H)return!0;var r=i.__c.__H.__.filter((function(e){return e.__c}));if(r.every((function(e){return!e.__N})))return!o||o.call(this,e,t,n);var s=!1;return r.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&i.__c.props===e)&&(!o||o.call(this,e,t,n))};Nw.u=!0;var o=Nw.shouldComponentUpdate,s=Nw.componentWillUpdate;Nw.componentWillUpdate=function(e,t,n){if(this.__e){var i=o;o=void 0,r(e,t,n),o=i}s&&s.call(this,e,t,n)},Nw.shouldComponentUpdate=r}return i.__N||i.__}function Qw(e,t){var n=Uw(Rw++,3);!Yx.__s&&o_(n.__H,t)&&(n.__=e,n.i=t,Nw.__H.__h.push(n))}function Xw(e,t){var n=Uw(Rw++,4);!Yx.__s&&o_(n.__H,t)&&(n.__=e,n.i=t,Nw.__h.push(n))}function Kw(e){return Iw=5,Yw((function(){return{current:e}}),[])}function Yw(e,t){var n=Uw(Rw++,7);return o_(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Zw(e,t){return Iw=8,Yw((function(){return e}),t)}function Jw(e){var t=Nw.context[e.__c],n=Uw(Rw++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Nw)),t.props.value):e.__}function e_(){for(var e;e=Lw.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(i_),e.__H.__h.forEach(r_),e.__H.__h=[]}catch(t){e.__H.__h=[],Yx.__e(t,e.__v)}}Yx.__b=function(e){Nw=null,qw&&qw(e)},Yx.__r=function(e){zw&&zw(e),Rw=0;var t=(Nw=e.__c).__H;t&&($w===Nw?(t.__h=[],Nw.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=Bw,e.__N=e.i=void 0}))):(t.__h.forEach(i_),t.__h.forEach(r_),t.__h=[],Rw=0)),$w=Nw},Yx.diffed=function(e){Fw&&Fw(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Lw.push(t)&&jw===Yx.requestAnimationFrame||((jw=Yx.requestAnimationFrame)||n_)(e_)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==Bw&&(e.__=e.__V),e.i=void 0,e.__V=Bw}))),$w=Nw=null},Yx.__c=function(e,t){t.some((function(e){try{e.__h.forEach(i_),e.__h=e.__h.filter((function(e){return!e.__||r_(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Yx.__e(n,e.__v)}})),Vw&&Vw(e,t)},Yx.unmount=function(e){Hw&&Hw(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{i_(e)}catch(e){t=e}})),n.__H=void 0,t&&Yx.__e(t,n.__v))};var t_="function"==typeof requestAnimationFrame;function n_(e){var t,n=function(){clearTimeout(i),t_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);t_&&(t=requestAnimationFrame(n))}function i_(e){var t=Nw,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Nw=t}function r_(e){var t=Nw;e.__c=e.__(),Nw=t}function o_(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function s_(e,t){return"function"==typeof t?t(e):t}function a_(e,t){for(var n in t)e[n]=t[n];return e}function l_(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var i in t)if("__source"!==i&&e[i]!==t[i])return!0;return!1}function c_(e){this.props=e}(c_.prototype=new hw).isPureReactComponent=!0,c_.prototype.shouldComponentUpdate=function(e,t){return l_(this.props,e)||l_(this.state,t)};var p_=Yx.__b;Yx.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),p_&&p_(e)};var u_="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function d_(e){function t(t){var n=a_({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=u_,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var h_=Yx.__e;Yx.__e=function(e,t,n,i){if(e.then)for(var r,o=t;o=o.__;)if((r=o.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),r.__c(e,t);h_(e,t,n,i)};var f_=Yx.unmount;function m_(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),e.__c.__H=null),null!=(e=a_({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return m_(e,t,n)}))),e}function g_(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return g_(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function y_(){this.__u=0,this.t=null,this.__b=null}function v_(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function b_(){this.u=null,this.o=null}Yx.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),f_&&f_(e)},(y_.prototype=new hw).__c=function(e,t){var n=t.__c,i=this;null==i.t&&(i.t=[]),i.t.push(n);var r=v_(i.__v),o=!1,s=function(){o||(o=!0,n.__R=null,r?r(a):a())};n.__R=s;var a=function(){if(! --i.__u){if(i.state.__a){var e=i.state.__a;i.__v.__k[0]=g_(e,e.__c.__P,e.__c.__O)}var t;for(i.setState({__a:i.__b=null});t=i.t.pop();)t.forceUpdate()}};i.__u++||32&t.__u||i.setState({__a:i.__b=i.__v.__k[0]}),e.then(s,s)},y_.prototype.componentWillUnmount=function(){this.t=[]},y_.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=m_(this.__b,n,i.__O=i.__P)}this.__b=null}var r=t.__a&&pw(dw,null,e.fallback);return r&&(r.__u&=-33),[pw(dw,null,t.__a?null:e.children),r]};var x_=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]>>1,1),t.i.removeChild(e)}}),Mw(pw(w_,{context:t.context},e.__v),t.l)}function E_(e,t){var n=pw(__,{__v:e,i:t});return n.containerInfo=t,n}(b_.prototype=new hw).__a=function(e){var t=this,n=v_(t.__v),i=t.o.get(e);return i[0]++,function(r){var o=function(){t.props.revealOrder?(i.push(r),x_(t,e,i)):r()};n?n(o):o()}},b_.prototype.render=function(e){this.u=null,this.o=new Map;var t=xw(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},b_.prototype.componentDidUpdate=b_.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){x_(e,n,t)}))};var O_="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,P_=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,k_=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,S_=/[A-Z0-9]/g,C_="undefined"!=typeof document,T_=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};hw.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(hw.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var A_=Yx.event;function M_(){}function D_(){return this.cancelBubble}function R_(){return this.defaultPrevented}Yx.event=function(e){return A_&&(e=A_(e)),e.persist=M_,e.isPropagationStopped=D_,e.isDefaultPrevented=R_,e.nativeEvent=e};var N_={enumerable:!1,configurable:!0,get:function(){return this.class}},$_=Yx.vnode;Yx.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,i={};for(var r in t){var o=t[r];if(!("value"===r&&"defaultValue"in t&&null==o||C_&&"children"===r&&"noscript"===n||"class"===r||"className"===r)){var s=r.toLowerCase();"defaultValue"===r&&"value"in t&&null==t.value?r="value":"download"===r&&!0===o?o="":"ondoubleclick"===s?r="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||T_(t.type)?"onfocus"===s?r="onfocusin":"onblur"===s?r="onfocusout":k_.test(r)?r=s:-1===n.indexOf("-")&&P_.test(r)?r=r.replace(S_,"-$&").toLowerCase():null===o&&(o=void 0):s=r="oninput","oninput"===s&&i[r=s]&&(r="oninputCapture"),i[r]=o}}"select"==n&&i.multiple&&Array.isArray(i.value)&&(i.value=xw(t.children).forEach((function(e){e.props.selected=-1!=i.value.indexOf(e.props.value)}))),"select"==n&&null!=i.defaultValue&&(i.value=xw(t.children).forEach((function(e){e.props.selected=i.multiple?-1!=i.defaultValue.indexOf(e.props.value):i.defaultValue==e.props.value}))),t.class&&!t.className?(i.class=t.class,Object.defineProperty(i,"className",N_)):(t.className&&!t.class||t.class&&t.className)&&(i.class=i.className=t.className),e.props=i}(e),e.$$typeof=O_,$_&&$_(e)};var j_=Yx.__r;Yx.__r=function(e){j_&&j_(e),e.__c};var I_=Yx.diffed;Yx.diffed=function(e){I_&&I_(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value)};var L_=pw;var B_=0;Array.isArray;function q_(e,t,n,i,r,o){var s,a,l={};for(a in t)"ref"==a?s=t[a]:l[a]=t[a];var c={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--B_,__i:-1,__u:0,__source:r,__self:o};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return Yx.vnode&&Yx.vnode(c),c}var z_=n(942),F_=n.n(z_);const V_=1024;let H_=0;class U_{constructor(e,t){this.from=e,this.to=t}}class W_{constructor(e={}){this.id=H_++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=X_.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}W_.closedBy=new W_({deserialize:e=>e.split(" ")}),W_.openedBy=new W_({deserialize:e=>e.split(" ")}),W_.group=new W_({deserialize:e=>e.split(" ")}),W_.isolate=new W_({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),W_.contextHash=new W_({perNode:!0}),W_.lookAhead=new W_({perNode:!0}),W_.mounted=new W_({perNode:!0});class G_{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[W_.mounted.id]}}const Q_=Object.create(null);class X_{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):Q_,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),i=new X_(e.name||"",t,e.id,n);if(e.props)for(let n of e.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}return i}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(W_.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return e=>{for(let n=e.prop(W_.group),i=-1;i<(n?n.length:0);i++){let r=t[i<0?e.name:n[i]];if(r)return r}}}}X_.none=new X_("",Object.create(null),0,8);class K_{constructor(e){this.types=e;for(let t=0;t=t){let s=new sE(o.tree,o.overlay[0].from+e.from,-1,e);(r||(r=[i])).push(rE(s,t,n,!1))}}return r?uE(r):i}(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:r=this.length}=e,o=e.mode||0,s=(o&J_.IncludeAnonymous)>0;for(let e=this.cursor(o|J_.IncludeAnonymous);;){let o=!1;if(e.from<=r&&e.to>=i&&(!s&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;o=!0}for(;o&&n&&(s||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;o=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:yE(X_.none,this.children,this.positions,0,this.children.length,0,this.length,((e,t,n)=>new eE(this.type,e,t,n,this.propValues)),e.makeTree||((e,t,n)=>new eE(X_.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:i,maxBufferLength:r=V_,reused:o=[],minRepeatType:s=i.types.length}=e,a=Array.isArray(n)?new tE(n,n.length):n,l=i.types,c=0,p=0;function u(e,t,n,v,b,x){let{id:w,start:_,end:E,size:O}=a,P=p,k=c;for(;O<0;){if(a.next(),-1==O){let t=o[w];return n.push(t),void v.push(_-e)}if(-3==O)return void(c=w);if(-4==O)return void(p=w);throw new RangeError(`Unrecognized record size: ${O}`)}let S,C,T=l[w],A=_-e;if(E-_<=r&&(C=g(a.pos-t,b))){let t=new Uint16Array(C.size-C.skip),n=a.pos-C.size,r=t.length;for(;a.pos>n;)r=y(C.start,t,r);S=new nE(t,E-C.start,i),A=C.start-e}else{let e=a.pos-O;a.next();let t=[],n=[],i=w>=s?w:-1,o=0,l=E;for(;a.pos>e;)i>=0&&a.id==i&&a.size>=0?(a.end<=l-r&&(f(t,n,_,o,a.end,l,i,P,k),o=t.length,l=a.end),a.next()):x>2500?d(_,e,t,n):u(_,e,t,n,i,x+1);if(i>=0&&o>0&&o-1&&o>0){let e=h(T,k);S=yE(T,t,n,0,t.length,0,E-_,e,e)}else S=m(T,t,n,E-_,P-E,k)}n.push(S),v.push(A)}function d(e,t,n,o){let s=[],l=0,c=-1;for(;a.pos>t;){let{id:e,start:t,end:n,size:i}=a;if(i>4)a.next();else{if(c>-1&&t=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-r,t[n++]=s[e+2]-r,t[n++]=n;n.push(new nE(t,s[2]-r,i)),o.push(r-e)}}function h(e,t){return(n,i,r)=>{let o,s,a=0,l=n.length-1;if(l>=0&&(o=n[l])instanceof eE){if(!l&&o.type==e&&o.length==r)return o;(s=o.prop(W_.lookAhead))&&(a=i[l]+o.length+s)}return m(e,n,i,r,a,t)}}function f(e,t,n,r,o,s,a,l,c){let p=[],u=[];for(;e.length>r;)p.push(e.pop()),u.push(t.pop()+n-o);e.push(m(i.types[a],p,u,s-o,l-s,c)),t.push(o-n)}function m(e,t,n,i,r,o,s){if(o){let e=[W_.contextHash,o];s=s?[e].concat(s):[e]}if(r>25){let e=[W_.lookAhead,r];s=s?[e].concat(s):[e]}return new eE(e,t,n,i,s)}function g(e,t){let n=a.fork(),i=0,o=0,l=0,c=n.end-r,p={size:0,start:0,skip:0};e:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){p.size=i,p.start=o,p.skip=l,l+=4,i+=4,n.next();continue}let a=n.pos-e;if(e<0||a=s?4:0,d=n.start;for(n.next();n.pos>a;){if(n.size<0){if(-3!=n.size)break e;u+=4}else n.id>=s&&(u+=4);n.next()}o=d,i+=e,l+=u}return(t<0||i==e)&&(p.size=i,p.start=o,p.skip=l),p.size>4?p:void 0}function y(e,t,n){let{id:i,start:r,end:o,size:l}=a;if(a.next(),l>=0&&i4){let i=a.pos-(l-4);for(;a.pos>i;)n=y(e,t,n)}t[--n]=s,t[--n]=o-e,t[--n]=r-e,t[--n]=i}else-3==l?c=i:-4==l&&(p=i);return n}let v=[],b=[];for(;a.pos>0;)u(e.start||0,e.bufferStart||0,v,b,-1,0);let x=null!==(t=e.length)&&void 0!==t?t:v.length?b[0]+v[0].length:0;return new eE(l[e.topID],v.reverse(),b.reverse(),x)}(e)}}eE.empty=new eE(X_.none,[],[],0);class tE{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new tE(this.buffer,this.index)}}class nE{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return X_.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return s}slice(e,t,n){let i=this.buffer,r=new Uint16Array(t-e),o=0;for(let s=e,a=0;s=t&&nt;case 1:return n<=t&&i>t;case 2:return i>t;case 4:return!0}}function rE(e,t,n,i){for(var r;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to0?s.length:-1;e!=l;e+=t){let l=s[e],c=a[e]+o.from;if(iE(i,n,c,c+l.length))if(l instanceof nE){if(r&J_.ExcludeBuffers)continue;let s=l.findChild(0,l.buffer.length,t,n-c,i);if(s>-1)return new pE(new cE(o,l,e,c),null,s)}else if(r&J_.IncludeAnonymous||!l.type.isAnonymous||fE(l)){let s;if(!(r&J_.IgnoreMounts)&&(s=G_.get(l))&&!s.overlay)return new sE(s.tree,c,e,o);let a=new sE(l,c,e,o);return r&J_.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(t<0?l.children.length-1:0,t,n,i)}}if(r&J_.IncludeAnonymous||!o.type.isAnonymous)return null;if(e=o.index>=0?o.index+t:t<0?-1:o._parent._tree.children.length,o=o._parent,!o)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,n=0){let i;if(!(n&J_.IgnoreOverlays)&&(i=G_.get(this._tree))&&i.overlay){let n=e-this.from;for(let{from:e,to:r}of i.overlay)if((t>0?e<=n:e=n:r>n))return new sE(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function aE(e,t,n,i){let r=e.cursor(),o=[];if(!r.firstChild())return o;if(null!=n)for(let e=!1;!e;)if(e=r.type.is(n),!r.nextSibling())return o;for(;;){if(null!=i&&r.type.is(i))return o;if(r.type.is(t)&&o.push(r.node),!r.nextSibling())return null==i?o:[]}}function lE(e,t,n=t.length-1){for(let i=e;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[n]&&t[n]!=i.name)return!1;n--}}return!0}class cE{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class pE extends oE{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return r<0?null:new pE(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,n=0){if(n&J_.ExcludeBuffers)return null;let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new pE(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new pE(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new pE(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,r=n.buffer[this.index+3];if(r>i){let o=n.buffer[this.index+1];e.push(n.slice(i,r,o)),t.push(0)}return new eE(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function uE(e){if(!e.length)return null;let t=0,n=e[0];for(let i=1;in.from||r.to0){if(this.index-1)for(let i=t+e,r=e<0?-1:n._tree.children.length;i!=r;i+=e){let e=n._tree.children[i];if(this.mode&J_.IncludeAnonymous||e instanceof nE||!e.type.isAnonymous||fE(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;t=o,n=r+1;break e}i=this.stack[--r]}for(let e=n;e=0;r--){if(r<0)return lE(this._tree,e,i);let o=n[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function fE(e){return e.children.some((e=>e instanceof nE||!e.type.isAnonymous||fE(e)))}const mE=new WeakMap;function gE(e,t){if(!e.isAnonymous||t instanceof nE||t.type!=e)return 1;let n=mE.get(t);if(null==n){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof eE)){n=1;break}n+=gE(e,i)}mE.set(t,n)}return n}function yE(e,t,n,i,r,o,s,a,l){let c=0;for(let n=i;n=p)break;f+=t}if(c==r+1){if(f>p){let e=n[r];t(e.children,e.positions,0,e.children.length,i[r]+a);continue}u.push(n[r])}else{let t=i[c-1]+n[c-1].length-h;u.push(yE(e,n,i,r,c,h,t,null,l))}d.push(h+a-o)}}(t,n,i,r,0),(a||l)(u,d,s)}class vE{constructor(e,t,n,i,r=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(r?1:0)|(o?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let i=[new vE(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&i.push(n);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],r=1,o=e.length?e[0]:null;for(let s=0,a=0,l=0;;s++){let c=s=n)for(;o&&o.from=t.from||p<=t.to||l){let e=Math.max(t.from,a)-l,n=Math.min(t.to,p)-l;t=e>=n?null:new vE(e,n,t.tree,t.offset+l,s>0,!!c)}if(t&&i.push(t),o.to>p)break;o=rnew U_(e.from,e.to))):[new U_(0,0)]:[new U_(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let e=i.advance();if(e)return e}}}class xE{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}class wE{constructor(e,t,n,i,r){this.parser=e,this.parse=t,this.overlay=n,this.target=i,this.from=r}}function _E(e){if(!e.length||e.some((e=>e.from>=e.to)))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class EE{constructor(e,t,n,i,r,o,s){this.parser=e,this.predicate=t,this.mounts=n,this.index=i,this.start=r,this.target=o,this.prev=s,this.depth=0,this.ranges=[]}}const OE=new W_({perNode:!0});class PE{constructor(e,t,n,i,r){this.nest=t,this.input=n,this.fragments=i,this.ranges=r,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),null!=this.stoppedAt)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return null!=this.stoppedAt&&(e=new eE(e.type,e.children,e.positions,e.length,e.propValues.concat([[OE,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[W_.mounted.id]=new G_(t,e.overlay,e.parser),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt)a=!1;else if(e.hasNode(i)){if(t){let e=t.mounts.find((e=>e.frag.from<=i.from&&e.frag.to>=i.to&&e.mount.overlay));if(e)for(let n of e.mount.overlay){let r=n.from+e.pos,o=n.to+e.pos;r>=i.from&&o<=i.to&&!t.ranges.some((e=>e.fromr))&&t.ranges.push({from:r,to:o})}}a=!1}else if(n&&(o=kE(n.ranges,i.from,i.to)))a=2!=o;else if(!i.type.isAnonymous&&(r=this.nest(i,this.input))&&(i.fromnew U_(e.from-i.from,e.to-i.from))):null,i.tree,e.length?e[0].from:i.from)),r.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):a=!1}}else if(t&&(s=t.predicate(i))&&(!0===s&&(s=new U_(i.from,i.to)),s.from=0&&t.ranges[e].to==s.from?t.ranges[e]={from:t.ranges[e].from,to:s.to}:t.ranges.push(s)}if(a&&i.firstChild())t&&t.depth++,n&&n.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(t&&! --t.depth){let e=ME(this.ranges,t.ranges);e.length&&(_E(e),this.inner.splice(t.index,0,new wE(t.parser,t.parser.startParse(this.input,RE(t.mounts,e),e),t.ranges.map((e=>new U_(e.from-t.start,e.to-t.start))),t.target,e[0].from))),t=t.prev}n&&! --n.depth&&(n=n.prev)}}}}function kE(e,t,n){for(let i of e){if(i.from>=n)break;if(i.to>t)return i.from<=t&&i.to>=n?2:1}return 0}function SE(e,t,n,i,r,o){if(t=e&&t.enter(n,1,J_.IgnoreOverlays|J_.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(!(t.children.length&&0==t.positions[0]&&t.children[0]instanceof eE))break;t=t.children[0]}return!1}}class AE{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=null!==(t=n.tree.prop(OE))&&void 0!==t?t:n.to,this.inner=new TE(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(e=t.tree.prop(OE))&&void 0!==e?e:t.to,this.inner=new TE(t.tree,-t.offset)}}findMounts(e,t){var n;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let r=null===(n=e.tree)||void 0===n?void 0:n.prop(W_.mounted);if(r&&r.parser==t)for(let t=this.fragI;t=e.to)break;n.tree==this.curFrag.tree&&i.push({frag:n,pos:e.from-n.offset,mount:r})}}}return i}}function ME(e,t){let n=null,i=t;for(let r=1,o=0;r=a)break;e.to<=s||(n||(i=n=t.slice()),e.froma&&n.splice(o+1,0,new U_(a,e.to))):e.to>a?n[o--]=new U_(a,e.to):n.splice(o--,1))}}return i}function DE(e,t,n,i){let r=0,o=0,s=!1,a=!1,l=-1e9,c=[];for(;;){let p=r==e.length?1e9:s?e[r].to:e[r].from,u=o==t.length?1e9:a?t[o].to:t[o].from;if(s!=a){let e=Math.max(l,n),t=Math.min(p,u,i);enew U_(e.from+i,e.to+i))),a,l);for(let t=0,i=a;;t++){let a=t==s.length,c=a?l:s[t].from;if(c>i&&n.push(new vE(i,c,r.tree,-e,o.from>=i||o.openStart,o.to<=c||o.openEnd)),a)break;i=s[t].to}}else n.push(new vE(a,l,r.tree,-e,o.from>=e||o.openStart,o.to<=s||o.openEnd))}return n}var NE=n(225);class $E{constructor(e,t,n,i,r,o,s,a,l,c=0,p){this.p=e,this.stack=t,this.state=n,this.reducePos=i,this.pos=r,this.score=o,this.buffer=s,this.bufferBase=a,this.curContext=l,this.lookAhead=c,this.parent=p}toString(){return`[${this.stack.filter(((e,t)=>t%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let i=e.parser.context;return new $E(e,[],t,n,n,0,[],0,i?new jE(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,i=65535&e,{parser:r}=this.p,o=this.reducePos=2e3&&!(null===(t=this.p.parser.nodeSet.types[i])||void 0===t?void 0:t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(i,l)}storeNode(e,t,n,i=4,r=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==e.buffer[i-4]&&e.buffer[i-1]>-1){if(t==n)return;if(e.buffer[i-2]>=t)return void(e.buffer[i-2]=n)}}if(r&&this.pos!=n){let r=this.buffer.length;if(r>0&&0!=this.buffer[r-4]){let e=!1;for(let t=r;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;r>0&&this.buffer[r-2]>n;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=e,this.buffer[r+1]=t,this.buffer[r+2]=n,this.buffer[r+3]=i}else this.buffer.push(e,t,n,i)}shift(e,t,n,i){if(131072&e)this.pushState(65535&e,this.pos);else if(262144&e)this.pos=i,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,i,4);else{let r=e,{parser:o}=this.p;(i>this.pos||t<=o.maxNode)&&(this.pos=i,o.stateFlag(r,1)||(this.reducePos=i)),this.pushState(r,n),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,i,4)}}apply(e,t,n,i){65536&e?this.reduce(e):this.shift(e,t,n,i)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new $E(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new IE(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if(!(65536&n))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let i,r=0;r1&t&&e==i))||n.push(t[e],i)}t=n}let n=[];for(let e=0;e>19,i=65535&t,r=this.stack.length-3*n;if(r<0||e.getGoto(this.stack[r],i,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(i,r)=>{if(!t.includes(i))return t.push(i),e.allActions(i,(t=>{if(393216&t);else if(65536&t){let n=(t>>19)-r;if(n>1){let i=65535&t,r=this.stack.length-3*n;if(r>=0&&e.getGoto(this.stack[r],i,!1)>=0)return n<<19|65536|i}}else{let e=n(t,r+1);if(null!=e)return e}}))};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;tthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class jE{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class IE{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,n=e>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class LE{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new LE(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new LE(this.stack,this.pos,this.index)}}function BE(e,t=Uint16Array){if("string"!=typeof e)return e;let n=null;for(let i=0,r=0;i=92&&t--,t>=34&&t--;let r=t-32;if(r>=46&&(r-=46,n=!0),o+=r,n)break;o*=46}n?n[r++]=o:n=new t(o)}return n}class qE{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const zE=new qE;class FE{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=zE,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,i=this.rangeIndex,r=this.pos+e;for(;rn.to:r>=n.to;){if(i==this.ranges.length-1)return null;let e=this.ranges[++i];r+=e.from-n.to,n=e}return r}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t,n,i=this.chunkOff+e;if(i>=0&&i=this.chunk2Pos&&ti.to&&(this.chunk2=this.chunk2.slice(0,i.to-t)),n=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),n}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(null==n||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=zE,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return n}}class VE{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;UE(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}VE.prototype.contextual=VE.prototype.fallback=VE.prototype.extend=!1;VE.prototype.fallback=VE.prototype.extend=!1;class HE{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function UE(e,t,n,i,r,o){let s=0,a=1<0){let n=e[i];if(l.allows(n)&&(-1==t.token.value||t.token.value==n||GE(n,t.token.value,r,o))){t.acceptToken(n);break}}let i=t.next,c=0,p=e[s+2];if(!(t.next<0&&p>c&&65535==e[n+3*p-3])){for(;c>1,o=n+r+(r<<1),a=e[o],l=e[o+1]||65536;if(i=l)){s=e[o+2],t.advance();continue e}c=r+1}}break}s=e[n+3*p-1]}}function WE(e,t,n){for(let i,r=t;65535!=(i=e[r]);r++)if(i==n)return r-t;return-1}function GE(e,t,n,i){let r=WE(n,i,t);return r<0||WE(n,i,e)t)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,t-25)):Math.min(e.length,Math.max(i.from+1,t+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:e.length}}class YE{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?KE(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?KE(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(r instanceof eE){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+r.length}}}class ZE{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map((e=>new qE))}getActions(e){let t=0,n=null,{parser:i}=e.p,{tokenizers:r}=i,o=i.stateSlot(e.state,3),s=e.curContext?e.curContext.hash:0,a=0;for(let i=0;ic.end+25&&(a=Math.max(c.lookAhead,a)),0!=c.value)){let i=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!l.extend&&(n=c,t>i))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),n||e.pos!=this.stream.end||(n=new qE,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new qE,{pos:n,p:i}=e;return t.start=n,t.end=Math.min(n+1,i.stream.end),t.value=n==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,n){let i=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(i,e),n),e.value>-1){let{parser:t}=n.p;for(let i=0;i=0&&n.p.parser.dialect.allows(r>>1)){1&r?e.extended=r>>1:e.value=r>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,n,i){for(let t=0;t4*e.bufferLength?new YE(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,n=this.stacks,i=this.minStackPos,r=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[e]=n;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;oi)r.push(s);else{if(this.advanceStack(s,r,n))continue;{e||(e=[],t=[]),e.push(s);let n=this.tokens.getMainToken(s);t.push(n.value,n.end)}}break}}if(!r.length){let t=e&&function(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=e&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.scorethis.stoppedAt?e[0]:this.runRecovery(e,t,r);if(n)return QE&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(r.length>e)for(r.sort(((e,t)=>t.score-e.score));r.length>e;)r.pop();r.some((e=>e.reducePos>i))&&this.recovering--}else if(r.length>1){e:for(let e=0;e500&&i.buffer.length>500){if(!((t.score-i.score||t.buffer.length-i.buffer.length)>0)){r.splice(e--,1);continue e}r.splice(n--,1)}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let e=1;e ":"";if(null!=this.stoppedAt&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let s=this.fragments.nodeAt(i);s;){let i=this.parser.nodeSet.types[s.type.id]==s.type?r.getGoto(e.state,s.type.id):-1;if(i>-1&&s.length&&(!t||(s.prop(W_.contextHash)||0)==n))return e.useNode(s,i),QE&&console.log(o+this.stackID(e)+` (via reuse of ${r.getName(s.type.id)})`),!0;if(!(s instanceof eE)||0==s.children.length||s.positions[0]>0)break;let a=s.children[0];if(!(a instanceof eE&&0==s.positions[0]))break;s=a}}let s=r.stateSlot(e.state,4);if(s>0)return e.reduce(s),QE&&console.log(o+this.stackID(e)+` (via always-reduce ${r.getName(65535&s)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let s=0;si?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return eO(e,t),!0}}runRecovery(e,t,n){let i=null,r=!1;for(let o=0;o ":"";if(s.deadEnd){if(r)continue;if(r=!0,s.restart(),QE&&console.log(c+this.stackID(s)+" (restarted)"),this.advanceFully(s,n))continue}let p=s.split(),u=c;for(let e=0;p.forceReduce()&&e<10;e++){if(QE&&console.log(u+this.stackID(p)+" (via force-reduce)"),this.advanceFully(p,n))break;QE&&(u=this.stackID(p)+" -> ")}for(let e of s.recoverByInsert(a))QE&&console.log(c+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,n);this.stream.end>s.pos?(l==s.pos&&(l++,a=0),s.recoverByDelete(a,l),QE&&console.log(c+this.stackID(s)+` (via recover-delete ${this.parser.getName(a)})`),eO(s,n)):(!i||i.scoree;class iO{constructor(e){this.start=e.start,this.shift=e.shift||nO,this.reduce=e.reduce||nO,this.reuse=e.reuse||nO,this.hash=e.hash||(()=>0),this.strict=!1!==e.strict}}class rO extends bE{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let n=0;ne.topRules[t][1])),i=[];for(let e=0;e=0)r(i,e,t[n++]);else{let o=t[n+-i];for(let s=-i;s>0;s--)r(t[n++],e,o);n++}}}this.nodeSet=new K_(t.map(((t,r)=>X_.define({name:r>=this.minRepeatTerm?void 0:t,id:r,props:i[r],top:n.indexOf(r)>-1,error:0==r,skipped:e.skippedNodes&&e.skippedNodes.indexOf(r)>-1})))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=V_;let o=BE(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e"number"==typeof e?new VE(o,e):e)),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let i=new JE(this,e,t,n);for(let r of this.wrappers)i=r(i,e,t,n);return i}getGoto(e,t,n=!1){let i=this.goto;if(t>=i[0])return-1;for(let r=i[t+1];;){let t=i[r++],o=1&t,s=i[r++];if(o&&n)return s;for(let n=r+(t>>1);r0}validAction(e,t){return!!this.allActions(e,(e=>e==t||null))}allActions(e,t){let n=this.stateSlot(e,4),i=n?t(n):void 0;for(let n=this.stateSlot(e,1);null==i;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=oO(this.data,n+2)}i=t(oO(this.data,n+1))}return i}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=oO(this.data,n+2)}if(!(1&this.data[n+2])){let e=this.data[n+1];t.some(((t,n)=>1&n&&t==e))||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(rO.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map((t=>{let n=e.tokenizers.find((e=>e.from==t));return n?n.to:t}))),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map(((n,i)=>{let r=e.specializers.find((e=>e.from==n.external));if(!r)return n;let o=Object.assign(Object.assign({},n),{external:r.to});return t.specializers[i]=sO(o),o}))),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map((()=>!1));if(e)for(let i of e.split(" ")){let e=t.indexOf(i);e>=0&&(n[e]=!0)}let i=null;for(let e=0;ee.external(n,i)<<1|t}return e.get}let aO=0;class lO{constructor(e,t,n,i){this.name=e,this.set=t,this.base=n,this.modified=i,this.id=aO++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n="string"==typeof e?e:"?";if(e instanceof lO&&(t=e),null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let i=new lO(n,[],null,[]);if(i.set.push(i),t)for(let e of t.set)i.set.push(e);return i}static defineModifier(e){let t=new pO(e);return e=>e.modified.indexOf(t)>-1?e:pO.get(e.base||e,e.modified.concat(t).sort(((e,t)=>e.id-t.id)))}}let cO=0;class pO{constructor(e){this.name=e,this.instances=[],this.id=cO++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find((n=>n.base==e&&function(e,t){return e.length==t.length&&e.every(((e,n)=>e==t[n]))}(t,n.modified)));if(n)return n;let i=[],r=new lO(e.name,i,e,t);for(let e of t)e.instances.push(r);let o=function(e){let t=[[]];for(let n=0;nt.length-e.length))}(t);for(let t of e.set)if(!t.modified.length)for(let e of o)i.push(pO.get(t,e));return r}}function uO(e){let t=Object.create(null);for(let n in e){let i=e[n];Array.isArray(i)||(i=[i]);for(let e of n.split(" "))if(e){let n=[],r=2,o=e;for(let t=0;;){if("..."==o&&t>0&&t+3==e.length){r=1;break}let i=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!i)throw new RangeError("Invalid path: "+e);if(n.push("*"==i[0]?"":'"'==i[0][0]?JSON.parse(i[0]):i[0]),t+=i[0].length,t==e.length)break;let s=e[t++];if(t==e.length&&"!"==s){r=0;break}if("/"!=s)throw new RangeError("Invalid path: "+e);o=e.slice(t)}let s=n.length-1,a=n[s];if(!a)throw new RangeError("Invalid path: "+e);let l=new hO(i,r,s>0?n.slice(0,s):null);t[a]=l.sort(t[a])}}return dO.add(t)}const dO=new W_;class hO{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,this.next=i}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth{let t=r;for(let i of e)for(let e of i.set){let i=n[e.id];if(i){t=t?t+" "+i:i;break}}return t},scope:i}}function mO(e,t,n,i=0,r=e.length){let o=new gO(i,Array.isArray(t)?t:[t],n);o.highlightRange(e.cursor(),i,r,"",o.highlighters),o.flush(r)}hO.empty=new hO([],2,null);class gO{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,i,r){let{type:o,from:s,to:a}=e;if(s>=n||a<=t)return;o.isTop&&(r=this.highlighters.filter((e=>!e.scope||e.scope(o))));let l=i,c=function(e){let t=e.type.prop(dO);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||hO.empty,p=function(e,t){let n=null;for(let i of e){let e=i.style(t);e&&(n=n?n+" "+e:e)}return n}(r,c.tags);if(p&&(l&&(l+=" "),l+=p,1==c.mode&&(i+=(i?" ":"")+p)),this.startSpan(Math.max(t,s),l),c.opaque)return;let u=e.tree&&e.tree.prop(W_.mounted);if(u&&u.overlay){let o=e.node.enter(u.overlay[0].from+s,1),c=this.highlighters.filter((e=>!e.scope||e.scope(u.tree.type))),p=e.firstChild();for(let d=0,h=s;;d++){let f=d=m)&&e.nextSibling()););if(!f||m>n)break;h=f.to+s,h>t&&(this.highlightRange(o.cursor(),Math.max(t,f.from+s),Math.min(n,h),"",c),this.startSpan(Math.min(n,h),l))}p&&e.parent()}else if(e.firstChild()){u&&(i="");do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,i,r),this.startSpan(Math.min(n,e.to),l)}}while(e.nextSibling());e.parent()}}}const yO=lO.define,vO=yO(),bO=yO(),xO=yO(bO),wO=yO(bO),_O=yO(),EO=yO(_O),OO=yO(_O),PO=yO(),kO=yO(PO),SO=yO(),CO=yO(),TO=yO(),AO=yO(TO),MO=yO(),DO={comment:vO,lineComment:yO(vO),blockComment:yO(vO),docComment:yO(vO),name:bO,variableName:yO(bO),typeName:xO,tagName:yO(xO),propertyName:wO,attributeName:yO(wO),className:yO(bO),labelName:yO(bO),namespace:yO(bO),macroName:yO(bO),literal:_O,string:EO,docString:yO(EO),character:yO(EO),attributeValue:yO(EO),number:OO,integer:yO(OO),float:yO(OO),bool:yO(_O),regexp:yO(_O),escape:yO(_O),color:yO(_O),url:yO(_O),keyword:SO,self:yO(SO),null:yO(SO),atom:yO(SO),unit:yO(SO),modifier:yO(SO),operatorKeyword:yO(SO),controlKeyword:yO(SO),definitionKeyword:yO(SO),moduleKeyword:yO(SO),operator:CO,derefOperator:yO(CO),arithmeticOperator:yO(CO),logicOperator:yO(CO),bitwiseOperator:yO(CO),compareOperator:yO(CO),updateOperator:yO(CO),definitionOperator:yO(CO),typeOperator:yO(CO),controlOperator:yO(CO),punctuation:TO,separator:yO(TO),bracket:AO,angleBracket:yO(AO),squareBracket:yO(AO),paren:yO(AO),brace:yO(AO),content:PO,heading:kO,heading1:yO(kO),heading2:yO(kO),heading3:yO(kO),heading4:yO(kO),heading5:yO(kO),heading6:yO(kO),contentSeparator:yO(PO),list:yO(PO),quote:yO(PO),emphasis:yO(PO),strong:yO(PO),link:yO(PO),monospace:yO(PO),strikethrough:yO(PO),inserted:yO(),deleted:yO(),changed:yO(),invalid:yO(),meta:MO,documentMeta:yO(MO),annotation:yO(MO),processingInstruction:yO(MO),definition:lO.defineModifier("definition"),constant:lO.defineModifier("constant"),function:lO.defineModifier("function"),standard:lO.defineModifier("standard"),local:lO.defineModifier("local"),special:lO.defineModifier("special")};for(let e in DO){let t=DO[e];t instanceof lO&&(t.name=e)}fO([{tag:DO.link,class:"tok-link"},{tag:DO.heading,class:"tok-heading"},{tag:DO.emphasis,class:"tok-emphasis"},{tag:DO.strong,class:"tok-strong"},{tag:DO.keyword,class:"tok-keyword"},{tag:DO.atom,class:"tok-atom"},{tag:DO.bool,class:"tok-bool"},{tag:DO.url,class:"tok-url"},{tag:DO.labelName,class:"tok-labelName"},{tag:DO.inserted,class:"tok-inserted"},{tag:DO.deleted,class:"tok-deleted"},{tag:DO.literal,class:"tok-literal"},{tag:DO.string,class:"tok-string"},{tag:DO.number,class:"tok-number"},{tag:[DO.regexp,DO.escape,DO.special(DO.string)],class:"tok-string2"},{tag:DO.variableName,class:"tok-variableName"},{tag:DO.local(DO.variableName),class:"tok-variableName tok-local"},{tag:DO.definition(DO.variableName),class:"tok-variableName tok-definition"},{tag:DO.special(DO.variableName),class:"tok-variableName2"},{tag:DO.definition(DO.propertyName),class:"tok-propertyName tok-definition"},{tag:DO.typeName,class:"tok-typeName"},{tag:DO.namespace,class:"tok-namespace"},{tag:DO.className,class:"tok-className"},{tag:DO.macroName,class:"tok-macroName"},{tag:DO.propertyName,class:"tok-propertyName"},{tag:DO.operator,class:"tok-operator"},{tag:DO.comment,class:"tok-comment"},{tag:DO.meta,class:"tok-meta"},{tag:DO.invalid,class:"tok-invalid"},{tag:DO.punctuation,class:"tok-punctuation"}]);class RO{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=FO(this,e,t);let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(t,this.length,i,1),$O.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=FO(this,e,t);let n=[];return this.decompose(e,t,n,0),$O.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),i=new LO(this),r=new LO(e);for(let e=t,o=t;;){if(i.next(e),r.next(e),e=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(o+=i.value.length,i.done||o>=n)return!0}}iter(e=1){return new LO(this,e)}iterRange(e,t=this.length){return new BO(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new qO(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new NO(e):$O.from(NO.split(e,[])):RO.empty}}class NO extends RO{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let r=0;;r++){let o=this.text[r],s=i+o.length;if((t?n:s)>=e)return new zO(i,s,n,o);i=s+1,n++}}decompose(e,t,n,i){let r=e<=0&&t>=this.length?this:new NO(IO(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&i){let e=n.pop(),t=jO(r.text,e.text.slice(),0,r.length);if(t.length<=32)n.push(new NO(t,e.length+r.length));else{let e=t.length>>1;n.push(new NO(t.slice(0,e)),new NO(t.slice(e)))}}else n.push(r)}replace(e,t,n){if(!(n instanceof NO))return super.replace(e,t,n);[e,t]=FO(this,e,t);let i=jO(this.text,jO(n.text,IO(this.text,0,e)),t),r=this.length+n.length-(t-e);return i.length<=32?new NO(i,r):$O.from(NO.split(i,[]),r)}sliceString(e,t=this.length,n="\n"){[e,t]=FO(this,e,t);let i="";for(let r=0,o=0;r<=t&&oe&&o&&(i+=n),er&&(i+=s.slice(Math.max(0,e-r),t-r)),r=a+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let r of e)n.push(r),i+=r.length+1,32==n.length&&(t.push(new NO(n,i)),n=[],i=-1);return i>-1&&t.push(new NO(n,i)),t}}class $O extends RO{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,i){for(let r=0;;r++){let o=this.children[r],s=i+o.length,a=n+o.lines-1;if((t?a:s)>=e)return o.lineInner(e,t,n,i);i=s+1,n=a+1}}decompose(e,t,n,i){for(let r=0,o=0;o<=t&&r=o){let r=i&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!r?n.push(s):s.decompose(e-o,t-o,n,r)}o=a+1}}replace(e,t,n){if([e,t]=FO(this,e,t),n.lines=r&&t<=s){let a=o.replace(e-r,t-r,n),l=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>l>>6){let r=this.children.slice();return r[i]=a,new $O(r,this.length-(t-e)+n.length)}return super.replace(r,s,a)}r=s+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=FO(this,e,t);let i="";for(let r=0,o=0;re&&r&&(i+=n),eo&&(i+=s.sliceString(e-o,t-o,n)),o=a+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof $O))return 0;let n=0,[i,r,o,s]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,r+=t){if(i==o||r==s)return n;let a=this.children[i],l=e.children[r];if(a!=l)return n+a.scanIdentical(l,t);n+=a.length+1}}static from(e,t=e.reduce(((e,t)=>e+t.length+1),-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new NO(n,t)}let i=Math.max(32,n>>5),r=i<<1,o=i>>1,s=[],a=0,l=-1,c=[];function p(e){let t;if(e.lines>r&&e instanceof $O)for(let t of e.children)p(t);else e.lines>o&&(a>o||!a)?(u(),s.push(e)):e instanceof NO&&a&&(t=c[c.length-1])instanceof NO&&e.lines+t.lines<=32?(a+=e.lines,l+=e.length+1,c[c.length-1]=new NO(t.text.concat(e.text),t.length+1+e.length)):(a+e.lines>i&&u(),a+=e.lines,l+=e.length+1,c.push(e))}function u(){0!=a&&(s.push(1==c.length?c[0]:$O.from(c,l)),l=-1,a=c.length=0)}for(let t of e)p(t);return u(),1==s.length?s[0]:new $O(s,t)}}function jO(e,t,n=0,i=1e9){for(let r=0,o=0,s=!0;o=n&&(l>i&&(a=a.slice(0,i-r)),r0?1:(e instanceof NO?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],o=r>>1,s=i instanceof NO?i.text.length:i.children.length;if(o==(t>0?s:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(i instanceof NO){let r=i.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,r.length>Math.max(0,e))return this.value=0==e?r:t>0?r.slice(e):r.slice(0,r.length-e),this;e-=r.length}else{let r=i.children[o+(t<0?-1:0)];e>r.length?(e-=r.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(r),this.offsets.push(t>0?1:(r instanceof NO?r.text.length:r.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class BO{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new LO(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class qO{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(RO.prototype[Symbol.iterator]=function(){return this.iter()},LO.prototype[Symbol.iterator]=BO.prototype[Symbol.iterator]=qO.prototype[Symbol.iterator]=function(){return this});class zO{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}function FO(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}let VO="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((e=>e?parseInt(e,36):1));for(let e=1;ee)return VO[t-1]<=e;return!1}function UO(e){return e>=127462&&e<=127487}function WO(e,t,n=!0,i=!0){return(n?GO:QO)(e,t,i)}function GO(e,t,n){if(t==e.length)return t;t&&XO(e.charCodeAt(t))&&KO(e.charCodeAt(t-1))&&t--;let i=YO(e,t);for(t+=JO(i);t=0&&UO(YO(e,i));)n++,i-=2;if(n%2==0)break;t+=2}}}return t}function QO(e,t,n){for(;t>0;){let i=GO(e,t-2,n);if(i=56320&&e<57344}function KO(e){return e>=55296&&e<56320}function YO(e,t){let n=e.charCodeAt(t);if(!KO(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);return XO(i)?i-56320+(n-55296<<10)+65536:n}function ZO(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function JO(e){return e<65536?1:2}const eP=/\r\n?|\n/;var tP=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(tP||(tP={}));class nP{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-i);r+=s}else{if(n!=tP.Simple&&l>=e&&(n==tP.TrackDel&&ie||n==tP.TrackBefore&&ie))return null;if(l>e||l==e&&t<0&&!s)return e==i||t<0?r:r+a;r+=a}i=l}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return r}touchesRange(e,t=e){for(let n=0,i=0;n=0&&i<=t&&r>=e)return!(it)||"cover";i=r}return!1}toString(){let e="";for(let t=0;t=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some((e=>"number"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new nP(e)}static create(e){return new nP(e)}}class iP extends nP{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return sP(this,((t,n,i,r,o)=>e=e.replace(i,i+(n-t),o)),!1),e}mapDesc(e,t=!1){return aP(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,r=0;i=0){t[i]=s,t[i+1]=o;let a=i>>1;for(;n.length0&&oP(n,t,r.text),r.forward(e),s+=e}let l=e[o++];for(;s>1].toJSON()))}return e}static of(e,t,n){let i=[],r=[],o=0,s=null;function a(e=!1){if(!e&&!i.length)return;os||e<0||s>t)throw new RangeError(`Invalid change range ${e} to ${s} (in doc of length ${t})`);let p=c?"string"==typeof c?RO.of(c.split(n||eP)):c:RO.empty,u=p.length;if(e==s&&0==u)return;eo&&rP(i,e-o,-1),rP(i,s-e,u),oP(r,i,p),o=s}}(e),a(!s),s}static empty(e){return new iP(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;it&&"string"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==r.length)t.push(r[0],0);else{for(;n.length=0&&n<=0&&n==e[r+1]?e[r]+=t:0==t&&0==e[r]?e[r+1]+=n:i?(e[r]+=t,e[r+1]+=n):e.push(t,n)}function oP(e,t,n){if(0==n.length)return;let i=t.length-2>>1;if(i>1])),!(n||s==e.sections.length||e.sections[s+1]<0);)a=e.sections[s++],l=e.sections[s++];t(r,c,o,p,u),r=c,o=p}}}function aP(e,t,n,i=!1){let r=[],o=i?[]:null,s=new cP(e),a=new cP(t);for(let e=-1;;)if(-1==s.ins&&-1==a.ins){let e=Math.min(s.len,a.len);rP(r,e,-1),s.forward(e),a.forward(e)}else if(a.ins>=0&&(s.ins<0||e==s.i||0==s.off&&(a.len=0&&e=0)){if(s.done&&a.done)return o?iP.createSet(r,o):nP.create(r);throw new Error("Mismatched change set lengths")}{let t=0,n=s.len;for(;n;)if(-1==a.ins){let e=Math.min(n,a.len);t+=e,n-=e,a.forward(e)}else{if(!(0==a.ins&&a.lent||s.ins>=0&&s.len>t)&&(e||i.length>n),o.forward2(t),s.forward(t)}}else rP(i,0,s.ins,e),r&&oP(r,i,s.text),s.next()}}class cP{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?RO.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?RO.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class pP{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(e,t=-1){let n,i;return this.empty?n=i=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new pP(n,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return uP.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return uP.range(this.anchor,n)}eq(e,t=!1){return!(this.anchor!=e.anchor||this.head!=e.head||t&&this.empty&&this.assoc!=e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return uP.range(e.anchor,e.head)}static create(e,t,n){return new pP(e,t,n)}}class uP{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:uP.create(this.ranges.map((n=>n.map(e,t))),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;ne.toJSON())),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new uP(e.ranges.map((e=>pP.fromJSON(e))),e.main)}static single(e,t=e){return new uP([uP.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;ie?8:0)|r)}static normalized(e,t=0){let n=e[t];e.sort(((e,t)=>e.from-t.from)),t=e.indexOf(n);for(let n=1;ni.head?uP.range(s,o):uP.range(o,s))}}return new uP(e,t)}}function dP(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let hP=0;class fP{constructor(e,t,n,i,r){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=hP++,this.default=e([]),this.extensions="function"==typeof r?r(this):r}get reader(){return this}static define(e={}){return new fP(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:mP),!!e.static,e.enables)}of(e){return new gP([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new gP(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new gP(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],(n=>t(n.field(e))))}}function mP(e,t){return e==t||e.length==t.length&&e.every(((e,n)=>e===t[n]))}class gP{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=hP++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,r=this.id,o=e[r]>>1,s=2==this.type,a=!1,l=!1,c=[];for(let n of this.dependencies)"doc"==n?a=!0:"selection"==n?l=!0:1&(null!==(t=e[n.id])&&void 0!==t?t:1)||c.push(e[n.id]);return{create:e=>(e.values[o]=n(e),1),update(e,t){if(a&&t.docChanged||l&&(t.docChanged||t.selection)||vP(e,c)){let t=n(e);if(s?!yP(t,e.values[o],i):!i(t,e.values[o]))return e.values[o]=t,1}return 0},reconfigure:(e,t)=>{let a,l=t.config.address[r];if(null!=l){let r=RP(t,l);if(this.dependencies.every((n=>n instanceof fP?t.facet(n)===e.facet(n):!(n instanceof wP)||t.field(n,!1)==e.field(n,!1)))||(s?yP(a=n(e),r,i):i(a=n(e),r)))return e.values[o]=r,0}else a=n(e);return e.values[o]=a,1}}}}function yP(e,t,n){if(e.length!=t.length)return!1;for(let i=0;ie[t.id])),r=n.map((e=>e.type)),o=i.filter((e=>!(1&e))),s=e[t.id]>>1;function a(e){let n=[];for(let t=0;te===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(xP).find((e=>e.field==this));return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let i=e.values[t],r=this.updateF(i,n);return this.compareF(i,r)?0:(e.values[t]=r,1)},reconfigure:(e,n)=>null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}init(e){return[this,xP.of({field:this,create:e})]}get extension(){return this}}const _P=4,EP=3,OP=2,PP=1;function kP(e){return t=>new CP(t,e)}const SP={highest:kP(0),high:kP(PP),default:kP(OP),low:kP(EP),lowest:kP(_P)};class CP{constructor(e,t){this.inner=e,this.prec=t}}class TP{of(e){return new AP(this,e)}reconfigure(e){return TP.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class AP{constructor(e,t){this.compartment=e,this.inner=t}}class MP{constructor(e,t,n,i,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,n){let i=[],r=Object.create(null),o=new Map;for(let n of function(e,t,n){let i=[[],[],[],[],[]],r=new Map;function o(e,s){let a=r.get(e);if(null!=a){if(a<=s)return;let t=i[a].indexOf(e);t>-1&&i[a].splice(t,1),e instanceof AP&&n.delete(e.compartment)}if(r.set(e,s),Array.isArray(e))for(let t of e)o(t,s);else if(e instanceof AP){if(n.has(e.compartment))throw new RangeError("Duplicate use of compartment in extensions");let i=t.get(e.compartment)||e.inner;n.set(e.compartment,i),o(i,s)}else if(e instanceof CP)o(e.inner,e.prec);else if(e instanceof wP)i[s].push(e),e.provides&&o(e.provides,s);else if(e instanceof gP)i[s].push(e),e.facet.extensions&&o(e.facet.extensions,OP);else{let t=e.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(t,s)}}return o(e,OP),i.reduce(((e,t)=>e.concat(t)))}(e,t,o))n instanceof wP?i.push(n):(r[n.facet.id]||(r[n.facet.id]=[])).push(n);let s=Object.create(null),a=[],l=[];for(let e of i)s[e.id]=l.length<<1,l.push((t=>e.slot(t)));let c=null==n?void 0:n.config.facets;for(let e in r){let t=r[e],i=t[0].facet,o=c&&c[e]||[];if(t.every((e=>0==e.type)))if(s[i.id]=a.length<<1|1,mP(o,t))a.push(n.facet(i));else{let e=i.combine(t.map((e=>e.value)));a.push(n&&i.compare(e,n.facet(i))?n.facet(i):e)}else{for(let e of t)0==e.type?(s[e.id]=a.length<<1|1,a.push(e.value)):(s[e.id]=l.length<<1,l.push((t=>e.dynamicSlot(t))));s[i.id]=l.length<<1,l.push((e=>bP(e,i,t)))}}let p=l.map((e=>e(s)));return new MP(e,o,p,s,a,r)}}function DP(e,t){if(1&t)return 2;let n=t>>1,i=e.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;e.status[n]=4;let r=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|r}function RP(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const NP=fP.define(),$P=fP.define({combine:e=>e.some((e=>e)),static:!0}),jP=fP.define({combine:e=>e.length?e[0]:void 0,static:!0}),IP=fP.define(),LP=fP.define(),BP=fP.define(),qP=fP.define({combine:e=>!!e.length&&e[0]});class zP{constructor(e,t){this.type=e,this.value=t}static define(){return new FP}}class FP{of(e){return new zP(this,e)}}class VP{constructor(e){this.map=e}of(e){return new HP(this,e)}}class HP{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new HP(this.type,t)}is(e){return this.type==e}static define(e={}){return new VP(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let e=i.map(t);e&&n.push(e)}return n}}HP.reconfigure=HP.define(),HP.appendConfig=HP.define();class UP{constructor(e,t,n,i,r,o){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,n&&dP(n,t.newLength),r.some((e=>e.type==UP.time))||(this.annotations=r.concat(UP.time.of(Date.now())))}static create(e,t,n,i,r,o){return new UP(e,t,n,i,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(UP.userEvent);return!(!t||!(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function WP(e,t){let n=[];for(let i=0,r=0;;){let o,s;if(i=e[i]))o=e[i++],s=e[i++];else{if(!(r=0;r--){let o=n[r](e);o&&Object.keys(o).length&&(i=GP(i,QP(t,o,e.changes.newLength),!0))}return i==e?e:UP.create(t,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(e){let t=e.startState,n=!0;for(let i of t.facet(IP)){let t=i(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:WP(n,t))}if(!0!==n){let i,r;if(!1===n)r=e.changes.invertedDesc,i=iP.empty(t.doc.length);else{let t=e.changes.filter(n);i=t.changes,r=t.filtered.mapDesc(t.changes).invertedDesc}e=UP.create(t,i,e.selection&&e.selection.map(r),HP.mapEffects(e.effects,r),e.annotations,e.scrollIntoView)}let i=t.facet(LP);for(let n=i.length-1;n>=0;n--){let r=i[n](e);e=r instanceof UP?r:Array.isArray(r)&&1==r.length&&r[0]instanceof UP?r[0]:XP(t,YP(r),!1)}return e}(r):r)}UP.time=zP.define(),UP.userEvent=zP.define(),UP.addToHistory=zP.define(),UP.remote=zP.define();const KP=[];function YP(e){return null==e?KP:Array.isArray(e)?e:[e]}var ZP=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(ZP||(ZP={}));const JP=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ek;try{ek=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(Qa){}function tk(e){return t=>{if(!/\S/.test(t))return ZP.Space;if(function(e){if(ek)return ek.test(e);for(let t=0;t""&&(n.toUpperCase()!=n.toLowerCase()||JP.test(n)))return!0}return!1}(t))return ZP.Word;for(let n=0;n-1)return ZP.Word;return ZP.Other}}class nk{constructor(e,t,n,i,r,o){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let e=0;er.set(t,e))),n=null),r.set(t.value.compartment,t.value.extension)):t.is(HP.reconfigure)?(n=null,i=t.value):t.is(HP.appendConfig)&&(n=null,i=YP(i).concat(t.value));if(n)t=e.startState.values.slice();else{n=MP.resolve(i,r,this),t=new nk(n,this.doc,this.selection,n.dynamicSlots.map((()=>null)),((e,t)=>t.reconfigure(e,this)),null).values}let o=e.startState.facet($P)?e.newSelection:e.newSelection.asSingle();new nk(n,e.newDoc,o,t,((t,n)=>n.update(t,e)),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange((t=>({changes:{from:t.from,to:t.to,insert:e},range:uP.cursor(t.from+e.length)})))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),r=[n.range],o=YP(n.effects);for(let n=1;nr.spec.fromJSON(o,e))))}return nk.create({doc:e.doc,selection:uP.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=MP.resolve(e.extensions||[],new Map),n=e.doc instanceof RO?e.doc:RO.of((e.doc||"").split(t.staticFacet(nk.lineSeparator)||eP)),i=e.selection?e.selection instanceof uP?e.selection:uP.single(e.selection.anchor,e.selection.head):uP.single(0);return dP(i,n.length),t.staticFacet($P)||(i=i.asSingle()),new nk(t,n,i,t.dynamicSlots.map((()=>null)),((e,t)=>t.create(e)),null)}get tabSize(){return this.facet(nk.tabSize)}get lineBreak(){return this.facet(nk.lineSeparator)||"\n"}get readOnly(){return this.facet(qP)}phrase(e,...t){for(let t of this.facet(nk.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,((e,n)=>{if("$"==n)return"$";let i=+(n||1);return!i||i>t.length?e:t[i-1]}))),e}languageDataAt(e,t,n=-1){let i=[];for(let r of this.facet(NP))for(let o of r(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){return tk(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-n,s=e-n;for(;o>0;){let e=WO(t,o,!1);if(r(t.slice(e,o))!=ZP.Word)break;o=e}for(;se.length?e[0]:4}),nk.lineSeparator=jP,nk.readOnly=qP,nk.phrases=fP.define({compare(e,t){let n=Object.keys(e),i=Object.keys(t);return n.length==i.length&&n.every((n=>e[n]==t[n]))}}),nk.languageData=NP,nk.changeFilter=IP,nk.transactionFilter=LP,nk.transactionExtender=BP,TP.reconfigure=HP.define();class rk{eq(e){return this==e}range(e,t=e){return ok.create(e,t,this)}}rk.prototype.startSide=rk.prototype.endSide=0,rk.prototype.point=!1,rk.prototype.mapMode=tP.TrackDel;class ok{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new ok(e,t,n)}}function sk(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class ak{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,i=0){let r=n?this.to:this.from;for(let o=i,s=r.length;;){if(o==s)return o;let i=o+s>>1,a=r[i]-e||(n?this.value[i].endSide:this.value[i].startSide)-t;if(i==o)return a>=0?o:s;a>=0?s=i:o=i+1}}between(e,t,n,i){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,r);rc||l==c&&p.startSide>0&&p.endSide<=0)continue;(c-l||p.endSide-p.startSide)<0||(o<0&&(o=l),p.point&&(s=Math.max(s,c-l)),n.push(p),i.push(l-o),r.push(c-o))}return{mapped:n.length?new ak(i,r,n,s):null,pos:o}}}class lk{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new lk(e,t,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:i=0,filterTo:r=this.length}=e,o=e.filter;if(0==t.length&&!o)return this;if(n&&(t=t.slice().sort(sk)),this.isEmpty)return t.length?lk.of(t):this;let s=new uk(this,null,-1).goto(0),a=0,l=[],c=new ck;for(;s.value||a=0){let e=t[a++];c.addInner(e.from,e.to,e.value)||l.push(e)}else 1==s.rangeIndex&&s.chunkIndexthis.chunkEnd(s.chunkIndex)||rs.to||r=r&&e<=r+o.length&&!1===o.between(r,e-r,t-r,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return dk.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return dk.from(e).goto(t)}static compare(e,t,n,i,r=-1){let o=e.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=r)),s=t.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=r)),a=pk(o,s,n),l=new fk(o,a,r),c=new fk(s,a,r);n.iterGaps(((e,t,n)=>mk(l,e,c,t,n,i))),n.empty&&0==n.length&&mk(l,0,c,0,0,i)}static eq(e,t,n=0,i){null==i&&(i=999999999);let r=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0)),o=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0));if(r.length!=o.length)return!1;if(!r.length)return!0;let s=pk(r,o),a=new fk(r,s,0).goto(n),l=new fk(o,s,0).goto(n);for(;;){if(a.to!=l.to||!gk(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>i)return!0;a.next(),l.next()}}static spans(e,t,n,i,r=-1){let o=new fk(e,null,r).goto(t),s=t,a=o.openStart;for(;;){let e=Math.min(o.to,n);if(o.point){let n=o.activeForPoint(o.to),r=o.pointFroms&&(i.span(s,e,o.active,a),a=o.openEnd(e));if(o.to>n)return a+(o.point&&o.to>n?1:0);s=o.to,o.next()}}static of(e,t=!1){let n=new ck;for(let i of e instanceof ok?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n0)return e.slice().sort(sk);t=i}return e}(e):e)n.add(i.from,i.to,i.value);return n.finish()}static join(e){if(!e.length)return lk.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let i=e[n];i!=lk.empty;i=i.nextLayer)t=new lk(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}lk.empty=new lk([],[],null,-1),lk.empty.nextLayer=lk.empty;class ck{finishChunk(e){this.chunks.push(new ak(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new ck)).add(e,t,n)}addInner(e,t,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(lk.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=lk.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function pk(e,t,n){let i=new Map;for(let t of e)for(let e=0;e=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=n&&i.push(new uk(o,t,n,r));return 1==i.length?i[0]:new dk(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)hk(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)hk(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),hk(this.heap,0)}}}function hk(e,t){for(let n=e[t];;){let i=1+(t<<1);if(i>=e.length)break;let r=e[i];if(i+1=0&&(r=e[i+1],i++),n.compare(r)<0)break;e[i]=n,e[t]=r,t=i}}class fk{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=dk.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){yk(this.active,e),yk(this.activeTo,e),yk(this.activeRank,e),this.minActive=bk(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:r}=this.cursor;for(;t0;)t++;vk(this.active,t,n),vk(this.activeTo,t,i),vk(this.activeRank,t,r),e&&vk(e,t,this.cursor.from),this.minActive=bk(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&yk(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from=0&&n[t]=0&&!(this.activeRank[n]e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function mk(e,t,n,i,r,o){e.goto(t),n.goto(i);let s=i+r,a=i,l=i-t;for(;;){let t=e.to+l-n.to||e.endSide-n.endSide,i=t<0?e.to+l:n.to,r=Math.min(i,s);if(e.point||n.point?e.point&&n.point&&(e.point==n.point||e.point.eq(n.point))&&gk(e.activeForPoint(e.to),n.activeForPoint(n.to))||o.comparePoint(a,r,e.point,n.point):r>a&&!gk(e.active,n.active)&&o.compareRange(a,r,e.active,n.active),i>s)break;a=i,t<=0&&e.next(),t>=0&&n.next()}}function gk(e,t){if(e.length!=t.length)return!1;for(let n=0;n=t;n--)e[n+1]=e[n];e[t]=n}function bk(e,t){let n=-1,i=1e9;for(let r=0;re.map((e=>t.replace(/&/,e))))).reduce(((e,t)=>e.concat(t))),s,o);else if(s&&"object"==typeof s){if(!l)throw new RangeError("The value of a property ("+n+") should be a primitive value.");r(i(n),s,a,c)}else null!=s&&a.push(n.replace(/_.*/,"").replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))+": "+s+";")}(a.length||c)&&o.push((!n||l||s?e:e.map(n)).join(", ")+" {"+a.join(" ")+"}")}for(let t in e)r(i(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=Ek[wk]||1;return Ek[wk]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let i=e[_k],r=n&&n.nonce;i?r&&i.setNonce(r):i=new kk(e,r),i.mount(Array.isArray(t)?t:[t],e)}}let Pk=new Map;class kk{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let t=Pk.get(n);if(t)return e[_k]=t;this.sheet=new i.CSSStyleSheet,Pk.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[_k]=this}mount(e,t){let n=this.sheet,i=0,r=0;for(let t=0;t-1&&(this.modules.splice(s,1),r--,s=-1),-1==s){if(this.modules.splice(r++,0,o),n)for(let e=0;e",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Tk="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Ak="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Mk=0;Mk<10;Mk++)Sk[48+Mk]=Sk[96+Mk]=String(Mk);for(Mk=1;Mk<=24;Mk++)Sk[Mk+111]="F"+Mk;for(Mk=65;Mk<=90;Mk++)Sk[Mk]=String.fromCharCode(Mk+32),Ck[Mk]=String.fromCharCode(Mk);for(var Dk in Sk)Ck.hasOwnProperty(Dk)||(Ck[Dk]=Sk[Dk]);function Rk(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function Nk(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function $k(e,t){if(!t.anchorNode)return!1;try{return Nk(e,t.anchorNode)}catch(e){return!1}}function jk(e){return 3==e.nodeType?Xk(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function Ik(e,t,n,i){return!!n&&(qk(e,t,n,i,-1)||qk(e,t,n,i,1))}function Lk(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function Bk(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function qk(e,t,n,i,r){for(;;){if(e==n&&t==i)return!0;if(t==(r<0?0:zk(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=Lk(e)+(r<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(r<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=r<0?zk(e):0}}}function zk(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Fk(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function Vk(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function Hk(e,t){let n=t.width/e.offsetWidth,i=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-e.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}class Uk{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?zk(t):0),n,Math.min(e.focusOffset,n?zk(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}let Wk,Gk=null;function Qk(e){if(e.setActive)return e.setActive();if(Gk)return e.focus(Gk);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==Gk?{get preventScroll(){return Gk={preventScroll:!0},!0}}:void 0),!Gk){Gk=!1;for(let e=0;eMath.max(1,e.scrollHeight-e.clientHeight-4)}function Jk(e,t){for(let n=e,i=t;;){if(3==n.nodeType&&i>0)return{node:n,offset:i};if(1==n.nodeType&&i>0){if("false"==n.contentEditable)return null;n=n.childNodes[i-1],i=zk(n)}else{if(!n.parentNode||Bk(n))return null;i=Lk(n),n=n.parentNode}}}function eS(e,t){for(let n=e,i=t;;){if(3==n.nodeType&&it)return n.domBoundsAround(e,t,l);if(p>=e&&-1==i&&(i=a,r=l),l>t&&n.dom.parentNode==this.dom){o=a,s=c;break}c=p,l=p+n.breakAfter}return{from:r,to:s<0?n+this.length:s,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),1&t.flags)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,7&this.flags&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=nS){this.markDirty();for(let i=e;ithis.pos||e==this.pos&&(t>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function sS(e,t,n,i,r,o,s,a,l){let{children:c}=e,p=c.length?c[t]:null,u=o.length?o[o.length-1]:null,d=u?u.breakAfter:s;if(!(t==i&&p&&!s&&!d&&o.length<2&&p.merge(n,r,o.length?u:null,0==n,a,l))){if(i0&&(!s&&o.length&&p.merge(n,p.length,o[0],!1,a,0)?p.breakAfter=o.shift().breakAfter:(n2);var bS={mac:vS||/Mac/.test(lS.platform),windows:/Win/.test(lS.platform),linux:/Linux|X11/.test(lS.platform),ie:hS,ie_version:uS?cS.documentMode||6:dS?+dS[1]:pS?+pS[1]:0,gecko:fS,gecko_version:fS?+(/Firefox\/(\d+)/.exec(lS.userAgent)||[0,0])[1]:0,chrome:!!mS,chrome_version:mS?+mS[1]:0,ios:vS,android:/Android\b/.test(lS.userAgent),webkit:gS,safari:yS,webkit_version:gS?+(/\bAppleWebKit\/(\d+)/.exec(lS.userAgent)||[0,0])[1]:0,tabSize:null!=cS.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class xS extends iS{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){3==e.nodeType&&this.createDOM(e)}merge(e,t,n){return!(8&this.flags||n&&(!(n instanceof xS)||this.length-(t-e)+n.length>256||8&n.flags))&&(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new xS(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=8&this.flags,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new tS(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return function(e,t,n){let i=e.nodeValue.length;t>i&&(t=i);let r=t,o=t,s=0;0==t&&n<0||t==i&&n>=0?bS.chrome||bS.gecko||(t?(r--,s=1):o=0)?0:a.length-1];bS.safari&&!s&&0==l.width&&(l=Array.prototype.find.call(a,(e=>e.width))||l);return s?Fk(l,s<0):l||null}(this.dom,e,t)}}class wS extends iS{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let e of t)e.setParent(this)}setAttrs(e){if(Yk(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!(8&(this.flags|e.flags))}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,n,i,r,o){return(!n||!(!(n instanceof wS&&n.mark.eq(this.mark))||e&&r<=0||te&&t.push(n=e&&(i=r),n=s,r++}let o=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new wS(this.mark,t,o)}domAtPos(e){return OS(this,e)}coordsAt(e,t){return kS(this,e,t)}}class _S extends iS{static create(e,t,n){return new _S(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=_S.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){this.dom&&this.widget.updateDOM(this.dom,e)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,n,i,r,o){return!(n&&(!(n instanceof _S&&this.widget.compare(n.widget))||e>0&&r<=0||t0)?tS.before(this.dom):tS.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let i=this.dom.getClientRects(),r=null;if(!i.length)return null;let o=this.side?this.side<0:e>0;for(let t=o?i.length-1:0;r=i[t],!(e>0?0==t:t==i.length-1||r.top0?tS.before(this.dom):tS.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return RO.empty}get isHidden(){return!0}}function OS(e,t){let n=e.dom,{children:i}=e,r=0;for(let e=0;r