/*! dmn-js - dmn-modeler v12.2.0 | Copyright (c) 2014-present, camunda Services GmbH | bpmn.io/license */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).DmnJS=t()}(this,function(){"use strict";function Ve(e){return(Ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n or , got "+e);n=o[1],r=o[0]}return{name:e=(r?r+":":"")+n,prefix:r,localName:n}}function J(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function ee(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,x(e,A(this.registerPackage,this))}function te(e,t,n){t=t[n];if(t in e)throw new Error("package with "+n+" <"+t+"> already defined")}function ne(e){this.model=e}function re(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function oe(e){this.properties=new ne(this),this.factory=new q(this,this.properties),this.registry=new ee(e,this.properties),this.typeCache={}}J.prototype.build=function(){return $(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},J.prototype.addProperty=function(e,t,n){"boolean"==typeof t&&(n=t,t=void 0),this.addNamedProperty(e,!1!==n);n=this.properties;void 0!==t?n.splice(t,0,e):n.push(e)},J.prototype.replaceProperty=function(e,t,n){var r=e.ns,o=this.properties,i=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}e=o.indexOf(e);if(-1===e)throw new Error("property <"+r.name+"> not found in property list");o.splice(e,1),this.addProperty(t,n?void 0:e,a),i[r.name]=i[r.localName]=t},J.prototype.redefineProperty=function(e,t,n){var r=e.ns.prefix,t=t.split("#"),r=Q(t[0],r),t=Q(t[1],r.prefix).name,r=this.propertiesByName[t];if(!r)throw new Error("refined property <"+t+"> not found");this.replaceProperty(r,e,n),delete e.redefines},J.prototype.addNamedProperty=function(e,t){var n=e.ns,r=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),r[n.name]=r[n.localName]=e},J.prototype.removeNamedProperty=function(e){var t=e.ns,e=this.propertiesByName;delete e[t.name],delete e[t.localName]},J.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},J.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},J.prototype.assertNotDefined=function(e,t){var n=e.name,r=this.propertiesByName[n];if(r)throw new Error("property <"+n+"> already defined; override of <"+r.definedBy.ns.name+"#"+r.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},J.prototype.hasProperty=function(e){return this.propertiesByName[e]},J.prototype.addTrait=function(r,o){var e=this.allTypesByName,t=this.allTypes,n=r.name;n in e||(x(r.properties,A(function(e){e=L({},e,{name:e.ns.localName,inherited:o}),Object.defineProperty(e,"definedBy",{value:r});var t=e.replaces,n=e.redefines;t||n?this.redefineProperty(e,t||n,t):(e.isBody&&this.setBodyProperty(e),e.isId&&this.setIdProperty(e),this.addProperty(e))},this)),t.push(r),e[n]=r)},ee.prototype.getPackage=function(e){return this.packageMap[e]},ee.prototype.getPackages=function(){return this.packages},ee.prototype.registerPackage=function(t){t=L({},t);var e=this.packageMap;te(e,t,"prefix"),te(e,t,"uri"),x(t.types,A(function(e){this.registerType(e,t)},this)),e[t.uri]=e[t.prefix]=t,this.packages.push(t)},ee.prototype.registerType=function(e,t){var r=Q((e=L({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:L(e.meta||{})})).name,t.prefix),n=r.name,o={};x(e.properties,A(function(e){var t=Q(e.name,r.prefix),n=t.name;Y(e.type)||(e.type=Q(e.type,t.prefix).name),L(e,{ns:t,name:n}),o[n]=e},this)),L(e,{ns:r,name:n,propertiesByName:o}),x(e.extends,A(function(e){e=this.typeMap[e];e.traits=e.traits||[],e.traits.push(n)},this)),this.definePackage(e,t),this.typeMap[n]=e},ee.prototype.mapTypes=function(n,r,e){var t=Y(n.name)?{name:n.name}:this.typeMap[n.name],o=this;function i(e){return a(e,!0)}function a(e,t){e=Q(e,G[e]?"":n.prefix);o.mapTypes(e,r,t)}if(!t)throw new Error("unknown type <"+n.name+">");x(t.superClass,e?i:a),r(t,!e),x(t.traits,i)},ee.prototype.getEffectiveDescriptor=function(e){var e=Q(e),n=new J(e);this.mapTypes(e,function(e,t){n.addTrait(e,t)});e=n.build();return this.definePackage(e,e.allTypes[e.allTypes.length-1].$pkg),e},ee.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},ne.prototype.set=function(e,t,n){var r=this.model.getPropertyDescriptor(e,t),o=r&&r.name;void 0===n?r?delete e[o]:delete e.$attrs[t]:r?o in e?e[o]=n:re(e,r,n):e.$attrs[t]=n},ne.prototype.get=function(e,t){var n=this.model.getPropertyDescriptor(e,t);if(!n)return e.$attrs[t];t=n.name;return!e[t]&&n.isMany&&re(e,n,[]),e[t]},ne.prototype.define=function(e,t,n){var r;n.writable||(r=n.value,delete(n=L({},n,{get:function(){return r}})).value),Object.defineProperty(e,t,n)},ne.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},ne.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},oe.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},oe.prototype.getType=function(e){var t=this.typeCache,n=v(e)?e:e.ns.name,r=t[n];return r||(e=this.registry.getEffectiveDescriptor(n),r=t[n]=this.factory.createType(e)),r},oe.prototype.createAny=function(e,t,n){var r=Q(e),o={$type:e,$instanceOf:function(e){return e===this.$type}},t={name:e,isGeneric:!0,ns:{prefix:r.prefix,localName:r.localName,uri:t}};return this.properties.defineDescriptor(o,t),this.properties.defineModel(o,this),this.properties.define(o,"$parent",{enumerable:!1,writable:!0}),this.properties.define(o,"$instanceOf",{enumerable:!1,writable:!0}),x(n,function(e,t){_(e)&&void 0!==e.value?o[e.name]=e.value:o[t]=e}),o},oe.prototype.getPackage=function(e){return this.registry.getPackage(e)},oe.prototype.getPackages=function(){return this.registry.getPackages()},oe.prototype.getElementDescriptor=function(e){return e.$descriptor},oe.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},oe.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},oe.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var ie=String.fromCharCode,ae=Object.prototype.hasOwnProperty,ce=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,ue={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function se(e,t,n,r){return r?ae.call(ue,r)?ue[r]:"&"+r+";":ie(t||parseInt(n,16))}function le(e){return 3"}function ye(e){return{get:e,enumerable:!0}}function me(e){return e+"$uri"}function ve(){return{line:0,column:0}}function ge(e){throw e}function be(e){if(!this)return new be(e);var O,j,E,C,n,S,P,k,R,T=e&&e.proxy,r=ge,D=ve,M=!1,B=!1,t=null,I=!1;function A(e){e instanceof Error||(e=de(e)),r(t=e,D)}function N(e){n&&(e instanceof Error||(e=de(e)),n(e,D))}this.on=function(e,t){if("function"!=typeof t)throw de("required args ");switch(e){case"openTag":j=t;break;case"text":O=t;break;case"closeTag":E=t;break;case"error":r=t;break;case"warn":n=t;break;case"cdata":C=t;break;case"attention":k=t;break;case"question":P=t;break;case"comment":S=t;break;default:throw de("unsupported event: "+e)}return this},this.ns=function(e){if("object"!==Ve(e=void 0===e?{}:e))throw de("required args ");var t,n={};for(t in e)n[t]=e[t];return n["http://www.w3.org/2001/XMLSchema-instance"]="xsi",B=!0,R=n,this},this.parse=function(e){if("string"!=typeof e)throw de("required args ");return t=null,function(a){var e,t,n,r,o,i,c,u,s,l,g,p=B?[]:null,b=B?function(e){var t,n,r={};for(t in e)r[n=e[t]]=n,r[me(n)]=t;return r}(R):null,f=[],_=0,d=!1,h=!1,y=0,m=0,w="",x=0;function v(){if(null!==g)return g;var e,t,n,r,o,i,a,c,u,s,l,p=B&&b.xmlns,f=B&&M?[]:null,d=x,h=w,y=h.length,m={},v={};e:for(;d already defined");else if(v[c]=!0,B)if(M)if(null===(o="xmlns"===c?"xmlns":120===c.charCodeAt(0)&&"xmlns:"===c.substr(0,6)?c.substr(6):null))f.push(c,i);else{if(e=le(i),t=me(o),!(a=R[e])){if("xmlns"===o||t in b&&b[t]!==e)for(;a="ns"+_++,void 0!==b[a];);else a=o;R[e]=a}b[o]!==a&&(r||(b=function(e){var t,n={};for(t in e)n[t]=e[t];return n}(b),r=!0),b[o]=a,"xmlns"===o&&(b[me(a)]=e,p=a),b[t]=e),m[c]=i}else-1!==(s=c.indexOf(":"))?(n=b[c.substring(0,s)])?((c=p===n?c.substr(s+1):n+c.substr(s))===pe&&(i=-1!==(s=i.indexOf(":"))?(n=i.substring(0,s),(n=b[n]||n)+i.substring(s)):p+":"+i),m[c]=i):N(he(c.substring(0,s))):m[c]=i;else m[c]=i}if(M)for(d=0,y=f.length;d",y)))return A("unclosed cdata");if(C&&(C(a.substring(y+9,m),D),I))return;m+=3;continue}if(45===r&&45===a.charCodeAt(y+3)){if(-1===(m=a.indexOf("--\x3e",y)))return A("unclosed comment");if(S&&(S(a.substring(y+4,m),le,D),I))return;m+=3;continue}}if(63!==o){for(t=y+1;;t++){if(i=a.charCodeAt(t),isNaN(i))return m=-1,A("unclosed tag");if(34===i)r=a.indexOf('"',t+1),t=-1!==r?r:t;else if(39===i)r=a.indexOf("'",t+1),t=-1!==r?r:t;else if(62===i){m=t;break}}if(33!==o){if(g={},47===o){if(h=!(d=!1),!f.length)return A("missing open tag");if(t=u=f.pop(),r=y+2+t.length,a.substring(y+2,r)!==t)return A("closing tag mismatch");for(;r");u=u.substr(o+1)}else c=b.xmlns;c&&(u=c+":"+u)}if(d&&(x=r,w=t,j&&(T?j(l,le,h,D):j(u,v,le,h,D),I)))return;if(h){if(E&&(E(T?l:u,le,d,D),I))return;B&&(b=d?e:p.pop())}m+=1}else{if(k&&(k(a.substring(y,m+1),le,D),I))return;m+=1}}else{if(-1===(m=a.indexOf("?>",y)))return A("unclosed question");if(P&&(P(a.substring(y,m+2),D),I))return;m+=2}}}(e),D=ve,I=!1,t},this.stop=function(){I=!0}}function _e(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var we={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},xe="xsi:type";function Oe(e){return e.xml&&e.xml.serialize}function je(e){return Oe(e)===xe}function Ee(e,t){return _e(t)?e.prefix+":"+((t=e.localName).charAt(0).toUpperCase()+t.slice(1)):e.name}function Ce(e){return new Error(e)}function Se(e){return e.$descriptor}function Pe(e){L(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw Ce("expected element");var t,n=this.elementsById,r=Se(e).idProperty;if(r&&(t=e.get(r.name))){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(t))throw new Error("illegal ID <"+t+">");if(n[t])throw Ce("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function e(){}function ke(){}function Re(){}function Te(e,t){this.property=e,this.context=t}function De(e,t){this.element=t,this.propertyDesc=e}function Me(){}function Be(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function Ie(e,t,n){Be.call(this,e,t,n)}function Ae(e,t,n){this.model=e,this.context=n}function Ne(e){L(this,{lax:!1},e=e instanceof oe?{model:e}:e)}e.prototype.handleEnd=function(){},e.prototype.handleText=function(){},e.prototype.handleNode=function(){},(ke.prototype=Object.create(e.prototype)).handleNode=function(){return this},(Re.prototype=Object.create(e.prototype)).handleText=function(e){this.body=(this.body||"")+e},(Te.prototype=Object.create(Re.prototype)).handleNode=function(e){if(this.element)throw Ce("expected no sub nodes");return this.element=this.createReference(e),this},Te.prototype.handleEnd=function(){this.element.id=this.body},Te.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},(De.prototype=Object.create(Re.prototype)).handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc,e=X(n.type,e);n.isMany?t.get(n.name).push(e):t.set(n.name,e)},(Me.prototype=Object.create(Re.prototype)).handleNode=function(e){var t,n=this;return(t=this.element)?n=this.handleChild(e):(t=this.element=this.createElement(e),this.context.addElement(t)),n},(Be.prototype=Object.create(Me.prototype)).addReference=function(e){this.context.addReference(e)},Be.prototype.handleText=function(e){if(!Se(this.element).bodyProperty)throw Ce("unexpected body text <"+e+">");Re.prototype.handleText.call(this,e)},Be.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Se(t).bodyProperty;n&&void 0!==e&&(e=X(n.type,e),t.set(n.name,e))},Be.prototype.createElement=function(e){var r,t=e.attributes,e=this.type,o=Se(e),i=this.context,a=new e({}),c=this.model;return x(t,function(e,t){var n=o.propertiesByName[t];n&&n.isReference?n.isMany?x(e.split(" "),function(e){i.addReference({element:a,property:n.ns.name,id:e})}):i.addReference({element:a,property:n.ns.name,id:e}):(n?e=X(n.type,e):"xmlns"!==t&&(r=Q(t,o.ns.prefix),c.getPackage(r.prefix)&&i.addWarning({message:"unknown attribute <"+t+">",element:a,property:t,value:e})),a.set(t,e))}),a},Be.prototype.getPropertyForNode=function(e){var t,n,r=Q(e.name),o=this.type,i=this.model,a=Se(o),c=r.name,u=a.propertiesByName[c];if(u&&!u.isAttr)return je(u)&&(t=e.attributes[xe])?(o=i,e=Q(c=t),s=o.getPackage(e.prefix),c=s,s=(o=e).name,e=o.localName,t=(c=c.xml&&c.xml.typePrefix)&&0===e.indexOf(c)?o.prefix+":"+e.slice(c.length):s,L({},u,{effectiveType:Se(n=i.getType(t)).name})):u;var s=i.getPackage(r.prefix);if(s){if(t=Ee(r,s),n=i.getType(t),u=b(a.properties,function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)}))return L({},u,{effectiveType:Se(n).name})}else if(u=b(a.properties,function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type}))return u;throw Ce("unrecognized element <"+r.name+">")},Be.prototype.toString=function(){return"ElementDescriptor["+Se(this.type).name+"]"},Be.prototype.valueHandler=function(e,t){return new De(e,t)},Be.prototype.referenceHandler=function(e){return new Te(e,this.context)},Be.prototype.handler=function(e){return new("Element"===e?Ae:Be)(this.model,e,this.context)},Be.prototype.handleChild=function(e){var t=this.getPropertyForNode(e),n=this.element,r=t.effectiveType||t.type;if(K[r])return this.valueHandler(t,n);e=(r=(t.isReference?this.referenceHandler(t):this.handler(r)).handleNode(e)).element;return void 0!==e&&(t.isMany?n.get(t.name).push(e):n.set(t.name,e),t.isReference?(L(e,{element:n}),this.context.addReference(e)):e.$parent=n),r},(Ie.prototype=Object.create(Be.prototype)).createElement=function(e){var t=e.name,n=Q(t),r=this.model,o=this.type,r=r.getPackage(n.prefix),t=r&&Ee(n,r)||t;if(!o.hasType(t))throw Ce("unexpected element <"+e.originalName+">");return Be.prototype.createElement.call(this,e)},(Ae.prototype=Object.create(Me.prototype)).createElement=function(e){var t=e.name,n=Q(t).prefix,n=e.ns[n+"$uri"],e=e.attributes;return this.model.createAny(t,n,e)},Ae.prototype.handleChild=function(e){var t=new Ae(this.model,0,this.context).handleNode(e),n=this.element,e=t.element;return void 0!==e&&((n.$children=n.$children||[]).push(e),e.$parent=n),t},Ae.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},Ne.prototype.fromXML=function(c,e,t){var u=e.rootHandler;e instanceof Be?(u=e,e={}):"string"==typeof e?(u=this.handler(e),e={}):"string"==typeof u&&(u=this.handler(u));var n=this.model,a=this.lax,s=new Pe(L({},e,{rootHandler:u})),l=new be({proxy:!0}),p=(e=[],Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e);function f(e,t,n){var r=t(),o=r.line,t=r.column,r=r.data,t="unparsable content "+((r="<"===r.charAt(0)&&-1!==r.indexOf(" ")?r.slice(0,r.indexOf(" "))+">":r)?r+" ":"")+"detected\n\tline: "+o+"\n\tcolumn: "+t+"\n\tnested error: "+e.message;if(n)return s.addWarning({message:t,error:e}),!0;throw Ce(t)}function r(e,t){return f(e,t,!0)}u.context=s,p.push(u);var o=/^<\?xml /i,i=/ encoding="([^"]+)"/i,d=/^utf-8$/i;function h(e,t){try{p.peek().handleText(e)}catch(e){r(e,t)}}n=n.getPackages().reduce(function(e,t){return e[t.uri]=t.prefix,e},{"http://www.w3.org/XML/1998/namespace":"xml"});return l.ns(n).on("openTag",function(e,r,t,n){var o=e.attrs||{},i=Object.keys(o).reduce(function(e,t){var n=r(o[t]);return e[t]=n,e},{});!function(e,t){var n=p.peek();try{p.push(n.handleNode(e))}catch(e){f(e,t,a)&&p.push(new ke)}}({name:e.name,originalName:e.originalName,attributes:i,ns:e.ns},n)}).on("question",function(e){!o.test(e)||(e=(e=i.exec(e))&&e[1])&&!d.test(e)&&s.addWarning({message:"unsupported document encoding <"+e+">, falling back to UTF-8"})}).on("closeTag",function(){p.pop().handleEnd()}).on("cdata",h).on("text",function(e,t,n){e=t(e),n=n,e.trim()&&h(e,n)}).on("error",f).on("warn",r),new Promise(function(e,t){var n;try{l.parse(c),function(){for(var e=s.elementsById,t=s.references,n=0;o=t[n];n++){var r,o,i=o.element,a=e[o.id],c=Se(i).propertiesByName[o.property];a||s.addWarning({message:"unresolved reference <"+o.id+">",element:o.element,property:o.property,value:o.id}),c.isMany?(-1===(o=(r=i.get(c.name)).indexOf(o))&&(o=r.length),a?r[o]=a:r.splice(o,1)):i.set(c.name,a)}}()}catch(e){n=e}var r=u.element;n||r||(n=Ce("failed to parse document as <"+u.type.$descriptor.name+">"));var o=s.warnings,i=s.references,a=s.elementsById;return n?(n.warnings=o,t(n)):e({rootElement:r,elementsById:a,references:i,warnings:o})})},Ne.prototype.handler=function(e){return new Ie(this.model,e)};var Le=/<|>|'|"|&|\n\r|\n/g,$e=/<|>|&/g;function ze(r){var n={},o={},i={},a=[],c=[];this.byUri=function(e){return o[e]||r&&r.byUri(e)},this.add=function(e,t){o[e.uri]=e,(t?a:c).push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return n[e||"xmlns"]},this.mapPrefix=function(e,t){n[e||"xmlns"]=t},this.getNSKey=function(e){return void 0!==e.prefix?e.uri+"|"+e.prefix:e.uri},this.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);i[n]=this.byUri(t),r&&r.logUsed(e)},this.getUsed=function(e){var t=this;return[].concat(a,c).filter(function(e){return e=t.getNSKey(e),i[e]})}}function Fe(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Ue(e){return v(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function He(e,t){return t.isGeneric?L({localName:t.ns.localName},e):L({localName:(n=t.ns.localName,_e(t=t.$pkg)?(t=n).charAt(0).toLowerCase()+t.slice(1):n)},e);var n}var We={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},qe={"<":"lt",">":"gt","&":"amp"};function Ge(e,t,n){return(e=v(e)?e:""+e).replace(t,function(e){return"&"+n[e]+";"})}function Ke(e){this.tagName=e}function Xe(){}function Ye(e){this.tagName=e}function Ze(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function Qe(e,t){Ze.call(this,e,t)}function Je(){this.value="",this.write=function(e){this.value+=e}}function et(t,e){var n=[""];this.append=function(e){return t.write(e),this},this.appendNewLine=function(){return e&&t.write("\n"),this},this.appendIndent=function(){return e&&t.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function tt(o){return o=L({format:!1,preamble:!0},o||{}),{toXML:function(e,t){var n=t||new Je,r=new et(n,o.format);if(o.preamble&&r.append('\n'),(new Ze).build(e).serializeTo(r),!t)return n.value}}}function nt(e,t){oe.call(this,e,t)}Ke.prototype.build=function(e){return this.element=e,this},Ke.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"").appendNewLine()},Xe.prototype.serializeValue=Xe.prototype.serializeTo=function(e){e.append(this.escape?Ge(this.value,$e,qe):this.value)},Xe.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search($e)&&(this.escape=!0),this},Fe(Ye,Xe),Ye.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("").appendNewLine()},Ze.prototype.build=function(e){var n,t=(this.element=e).$descriptor,r=this.propertyDescriptor,o=t.isGeneric,i=o?this.parseGeneric(e):this.parseNsAttributes(e);return this.ns=r?this.nsPropertyTagName(r):this.nsTagName(t),this.tagName=this.addTagName(this.ns),o||(o=w((n=e).$descriptor.properties,function(e){var t=e.name;if(!e.isVirtual&&g(n,t)){t=n[t];return t!==e.default?null!==t&&(!e.isMany||t.length):void 0}}),this.parseAttributes(w(o,function(e){return e.isAttr})),this.parseContainments(w(o,function(e){return!e.isAttr}))),this.parseGenericAttributes(e,i),this},Ze.prototype.nsTagName=function(e){return He(this.logNamespaceUsed(e.ns),e)},Ze.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return L({localName:e.ns.localName},t)},Ze.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Ze.prototype.nsAttributeName=function(e){var t=v(e)?Q(e):e.ns;if(e.inherited)return{localName:t.localName};e=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(e),this.isLocalNs(e)?{localName:t.localName}:L({localName:t.localName},e)},Ze.prototype.parseGeneric=function(n){var r=this,o=this.body,i=[];return x(n,function(e,t){"$body"===t?o.push((new Xe).build({type:"String"},e)):"$children"===t?x(e,function(e){o.push(new Ze(r).build(e))}):0!==t.indexOf("$")&&r.parseNsAttribute(n,t,e)&&i.push({name:t,value:e})}),i},Ze.prototype.parseNsAttribute=function(e,t,n){var r,o=e.$model,e=Q(t);if("xmlns"===e.prefix&&(r={prefix:e.localName,uri:n}),!(r=!e.prefix&&"xmlns"===e.localName?{uri:n}:r))return{name:t,value:n};o&&o.getPackage(n)?this.logNamespace(r,!0,!0):(r=this.logNamespaceUsed(r,!0),this.getNamespaces().logUsed(r))},Ze.prototype.parseNsAttributes=function(n,e){var r=this,t=n.$attrs,o=[];return x(t,function(e,t){e=r.parseNsAttribute(n,t,e);e&&o.push(e)}),o},Ze.prototype.parseGenericAttributes=function(n,e){var r=this;x(e,function(t){if(t.name!==xe)try{r.addAttribute(r.nsAttributeName(t.name),t.value)}catch(e){console.warn("missing namespace information for ",t.name,"=",t.value,"on",n,e)}})},Ze.prototype.parseContainments=function(e){var i=this,a=this.body,c=this.element;x(e,function(n){var r,o,e=c.get(n.name),t=n.isReference;n.isMany||(e=[e]),n.isBody?a.push((new Xe).build(n,e[0])):Z(n.type)?x(e,function(e){a.push(new Ye(i.addTagName(i.nsPropertyTagName(n))).build(n,e))}):t?x(e,function(e){a.push(new Ke(i.addTagName(i.nsPropertyTagName(n))).build(e))}):(r=je(n),o="property"===Oe(n),x(e,function(e){var t=r?new Qe(i,n):o?new Ze(i,n):new Ze(i);a.push(t.build(e))}))})},Ze.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent;return t||(n=n&&n.getNamespaces(),e||!n?this.namespaces=t=new ze(n):t=n),t},Ze.prototype.logNamespace=function(e,t,n){var r=this.getNamespaces(n),o=e.uri,i=e.prefix;return r.byUri(o)&&!n||r.add(e,t),r.mapPrefix(i,o),e},Ze.prototype.logNamespaceUsed=function(e,t){var n,r,o=this.element.$model,i=this.getNamespaces(t),a=e.prefix,t=e.uri;if(!a&&!t)return{localName:e.localName};if(o=we[a]||o&&(o.getPackage(a)||{}).uri,!(t=t||o||i.uriByPrefix(a)))throw new Error("no namespace uri given for prefix <"+a+">");if(!(e=i.byUri(t))){for(n=a,r=1;i.uriByPrefix(n);)n=a+"_"+r++;e=this.logNamespace({prefix:n,uri:t},o===t)}return a&&i.mapPrefix(a,t),e},Ze.prototype.parseAttributes=function(e){var r=this,o=this.element;x(e,function(e){var t,n=o.get(e.name);e.isReference&&(n=e.isMany?(t=[],x(n,function(e){t.push(e.id)}),t.join(" ")):n.id),r.addAttribute(r.nsAttributeName(e),n)})},Ze.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Ue(e)},Ze.prototype.addAttribute=function(e,t){var n=this.attrs;v(t)&&(t=Ge(t,Le,We)),n.push({name:e,value:t})},Ze.prototype.serializeAttributes=function(t){var e=this.attrs,n=this.namespaces;x(e=n?n.getUsed().filter(function(e){return"xml"!==e.prefix}).map(function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}}).concat(e):e,function(e){t.append(" ").append(Ue(e.name)).append('="').append(e.value).append('"')})},Ze.prototype.serializeTo=function(t){var e=this.body[0],n=e&&e.constructor!==Xe;t.appendIndent().append("<"+this.tagName),this.serializeAttributes(t),t.append(e?">":" />"),e&&(n&&t.appendNewLine().indent(),x(this.body,function(e){e.serializeTo(t)}),n&&t.unindent().appendIndent(),t.append("")),t.appendNewLine()},Fe(Qe,Ze),Qe.prototype.parseNsAttributes=function(e){var t=Ze.prototype.parseNsAttributes.call(this,e),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var r=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);e=e.$model.getPackage(r.uri),e=e.xml&&e.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(xe),(r.prefix?r.prefix+":":"")+e+n.ns.localName),t},Qe.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},(nt.prototype=Object.create(oe.prototype)).fromXML=function(e,t,n){v(t)||(n=t,t="dmn:Definitions");n=new Ne(L({model:this,lax:!0},n)),t=n.handler(t);return n.fromXML(e,t)},nt.prototype.toXML=function(n,e){var r=new tt(e);return new Promise(function(e,t){try{return e({xml:r.toXML(n)})}catch(e){return t(e)}})};var rt={dc:{name:"DC",prefix:"dc",uri:"http://www.omg.org/spec/DMN/20180521/DC/",types:[{name:"Dimension",properties:[{name:"width",isAttr:!0,type:"Real"},{name:"height",isAttr:!0,type:"Real"}]},{name:"Bounds",properties:[{name:"height",isAttr:!0,type:"Real"},{name:"width",isAttr:!0,type:"Real"},{name:"x",isAttr:!0,type:"Real"},{name:"y",isAttr:!0,type:"Real"}]},{name:"Point",properties:[{name:"x",isAttr:!0,type:"Real"},{name:"y",isAttr:!0,type:"Real"}]},{name:"Color",properties:[{name:"red",type:"UML_Standard_Profile.mdzip:eee_1045467100323_917313_65"},{name:"green",type:"UML_Standard_Profile.mdzip:eee_1045467100323_917313_65"},{name:"blue",type:"UML_Standard_Profile.mdzip:eee_1045467100323_917313_65"}]}],associations:[],enumerations:[{name:"AlignmentKind",literalValues:[{name:"start"},{name:"center"},{name:"end"}]}]},di:{name:"DI",prefix:"di",uri:"http://www.omg.org/spec/DMN/20180521/DI/",types:[{name:"DiagramElement",isAbstract:!0,properties:[{name:"extension",type:"Extension"},{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"style",isReference:!0,type:"Style",xml:{serialize:"property"}},{name:"sharedStyle",isReference:!0,isVirtual:!0,type:"Style"}]},{name:"Diagram",superClass:["DiagramElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"}]},{name:"Shape",isAbstract:!0,properties:[{name:"bounds",type:"dc:Bounds"}],superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,properties:[{name:"waypoint",type:"dc:Point",isMany:!0,xml:{serialize:"property"}}],superClass:["DiagramElement"]},{name:"Style",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"}]},{name:"Extension",properties:[{name:"values",isMany:!0,type:"Element"}]}],associations:[],enumerations:[],xml:{tagAlias:"lowerCase"}},dmn:{name:"DMN",prefix:"dmn",uri:"https://www.omg.org/spec/DMN/20191111/MODEL/",types:[{name:"AuthorityRequirement",superClass:["DMNElement"],properties:[{name:"requiredAuthority",type:"DMNElementReference",xml:{serialize:"property"}},{name:"requiredDecision",type:"DMNElementReference",xml:{serialize:"property"}},{name:"requiredInput",type:"DMNElementReference",xml:{serialize:"property"}}]},{name:"ItemDefinition",superClass:["NamedElement"],properties:[{name:"typeRef",type:"String"},{name:"allowedValues",type:"UnaryTests",xml:{serialize:"property"}},{name:"typeLanguage",type:"String",isAttr:!0},{name:"itemComponent",type:"ItemDefinition",isMany:!0,xml:{serialize:"property"}},{name:"functionItem",type:"FunctionItem"},{name:"isCollection",isAttr:!0,type:"Boolean"}]},{name:"Definitions",superClass:["NamedElement"],properties:[{name:"import",type:"Import",isMany:!0},{name:"itemDefinition",type:"ItemDefinition",isMany:!0},{name:"drgElement",type:"DRGElement",isMany:!0},{name:"artifact",type:"Artifact",isMany:!0},{name:"elementCollection",type:"ElementCollection",isMany:!0},{name:"businessContextElement",type:"BusinessContextElement",isMany:!0},{name:"namespace",type:"String",isAttr:!0},{name:"expressionLanguage",type:"String",isAttr:!0},{name:"typeLanguage",type:"String",isAttr:!0},{name:"exporter",isAttr:!0,type:"String"},{name:"exporterVersion",isAttr:!0,type:"String"},{name:"dmnDI",type:"dmndi:DMNDI"}]},{name:"KnowledgeSource",superClass:["DRGElement"],properties:[{name:"authorityRequirement",type:"AuthorityRequirement",isMany:!0},{name:"type",type:"String"},{name:"owner",type:"DMNElementReference",xml:{serialize:"property"}},{name:"locationURI",type:"String",isAttr:!0}]},{name:"DecisionRule",superClass:["DMNElement"],properties:[{name:"inputEntry",type:"UnaryTests",isMany:!0,xml:{serialize:"property"}},{name:"outputEntry",type:"LiteralExpression",isMany:!0,xml:{serialize:"property"}},{name:"annotationEntry",type:"RuleAnnotation",isMany:!0,xml:{serialize:"property"}}]},{name:"Expression",isAbstract:!0,superClass:["DMNElement"],properties:[{name:"typeRef",isAttr:!0,type:"String"}]},{name:"InformationItem",superClass:["NamedElement"],properties:[{name:"typeRef",isAttr:!0,type:"String"}]},{name:"Decision",superClass:["DRGElement"],properties:[{name:"question",type:"String",xml:{serialize:"property"}},{name:"allowedAnswers",type:"String",xml:{serialize:"property"}},{name:"variable",type:"InformationItem",xml:{serialize:"property"}},{name:"informationRequirement",type:"InformationRequirement",isMany:!0},{name:"knowledgeRequirement",type:"KnowledgeRequirement",isMany:!0},{name:"authorityRequirement",type:"AuthorityRequirement",isMany:!0},{name:"supportedObjective",isMany:!0,type:"DMNElementReference",xml:{serialize:"property"}},{name:"impactedPerformanceIndicator",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}},{name:"decisionMaker",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}},{name:"decisionOwner",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}},{name:"usingProcess",isMany:!0,type:"DMNElementReference",xml:{serialize:"property"}},{name:"usingTask",isMany:!0,type:"DMNElementReference",xml:{serialize:"property"}},{name:"decisionLogic",type:"Expression"}]},{name:"Invocation",superClass:["Expression"],properties:[{name:"calledFunction",type:"Expression"},{name:"binding",type:"Binding",isMany:!0}]},{name:"OrganisationalUnit",superClass:["BusinessContextElement"],properties:[{name:"decisionMade",type:"Decision",isReference:!0,isMany:!0},{name:"decisionOwned",type:"Decision",isReference:!0,isMany:!0}]},{name:"Import",superClass:["NamedElement"],properties:[{name:"importType",type:"String",isAttr:!0},{name:"locationURI",type:"String",isAttr:!0},{name:"namespace",type:"String",isAttr:!0}]},{name:"InformationRequirement",superClass:["DMNElement"],properties:[{name:"requiredDecision",type:"DMNElementReference",xml:{serialize:"property"}},{name:"requiredInput",type:"DMNElementReference",xml:{serialize:"property"}}]},{name:"ElementCollection",superClass:["NamedElement"],properties:[{name:"drgElement",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}}]},{name:"DRGElement",isAbstract:!0,superClass:["NamedElement"],properties:[]},{name:"InputData",superClass:["DRGElement"],properties:[{name:"variable",type:"InformationItem",xml:{serialize:"property"}}]},{name:"DMNElement",isAbstract:!0,properties:[{name:"description",type:"String"},{name:"extensionElements",type:"ExtensionElements"},{name:"id",type:"String",isAttr:!0,isId:!0},{name:"extensionAttribute",type:"ExtensionAttribute",isMany:!0},{name:"label",isAttr:!0,type:"String"}]},{name:"InputClause",superClass:["DMNElement"],properties:[{name:"inputExpression",type:"LiteralExpression",xml:{serialize:"property"}},{name:"inputValues",type:"UnaryTests",xml:{serialize:"property"}}]},{name:"DecisionTable",superClass:["Expression"],properties:[{name:"input",type:"InputClause",isMany:!0,xml:{serialize:"property"}},{name:"output",type:"OutputClause",isMany:!0,xml:{serialize:"property"}},{name:"annotation",type:"RuleAnnotationClause",isMany:!0,xml:{serialize:"property"}},{name:"rule",type:"DecisionRule",isMany:!0,xml:{serialize:"property"}},{name:"hitPolicy",type:"HitPolicy",isAttr:!0,default:"UNIQUE"},{name:"aggregation",type:"BuiltinAggregator",isAttr:!0},{name:"preferredOrientation",type:"DecisionTableOrientation",isAttr:!0},{name:"outputLabel",isAttr:!0,type:"String"}]},{name:"LiteralExpression",superClass:["Expression"],properties:[{name:"expressionLanguage",type:"String",isAttr:!0},{name:"text",type:"String"},{name:"importedValues",type:"ImportedValues"}]},{name:"Binding",properties:[{name:"parameter",type:"InformationItem",xml:{serialize:"property"}},{name:"bindingFormula",type:"Expression"}]},{name:"KnowledgeRequirement",superClass:["DMNElement"],properties:[{name:"requiredKnowledge",type:"DMNElementReference",xml:{serialize:"property"}}]},{name:"BusinessKnowledgeModel",superClass:["Invocable"],properties:[{name:"encapsulatedLogic",type:"FunctionDefinition",xml:{serialize:"property"}},{name:"knowledgeRequirement",type:"KnowledgeRequirement",isMany:!0},{name:"authorityRequirement",type:"AuthorityRequirement",isMany:!0}]},{name:"BusinessContextElement",isAbstract:!0,superClass:["NamedElement"],properties:[{name:"URI",type:"String",isAttr:!0}]},{name:"PerformanceIndicator",superClass:["BusinessContextElement"],properties:[{name:"impactingDecision",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}}]},{name:"FunctionDefinition",superClass:["Expression"],properties:[{name:"formalParameter",type:"InformationItem",isMany:!0,xml:{serialize:"property"}},{name:"body",type:"Expression"},{name:"kind",type:"FunctionKind",isAttr:!0}]},{name:"Context",superClass:["Expression"],properties:[{name:"contextEntry",type:"ContextEntry",isMany:!0}]},{name:"ContextEntry",superClass:["DMNElement"],properties:[{name:"variable",type:"InformationItem",xml:{serialize:"property"}},{name:"value",type:"Expression"}]},{name:"List",superClass:["Expression"],properties:[{name:"elements",isMany:!0,type:"Expression"}]},{name:"Relation",superClass:["Expression"],properties:[{name:"column",type:"InformationItem",isMany:!0,xml:{serialize:"property"}},{name:"row",type:"List",isMany:!0,xml:{serialize:"property"}}]},{name:"OutputClause",superClass:["DMNElement"],properties:[{name:"outputValues",type:"UnaryTests",xml:{serialize:"property"}},{name:"defaultOutputEntry",type:"LiteralExpression",xml:{serialize:"property"}},{name:"name",isAttr:!0,type:"String"},{name:"typeRef",isAttr:!0,type:"String"}]},{name:"UnaryTests",superClass:["Expression"],properties:[{name:"text",type:"String"},{name:"expressionLanguage",type:"String",isAttr:!0}]},{name:"NamedElement",isAbstract:!0,superClass:["DMNElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ImportedValues",superClass:["Import"],properties:[{name:"importedElement",type:"String"},{name:"expressionLanguage",type:"String",isAttr:!0}]},{name:"DecisionService",superClass:["Invocable"],properties:[{name:"outputDecision",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}},{name:"encapsulatedDecision",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}},{name:"inputDecision",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}},{name:"inputData",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}}]},{name:"ExtensionElements",properties:[{name:"values",type:"Element",isMany:!0}]},{name:"ExtensionAttribute",properties:[{name:"value",type:"Element"},{name:"valueRef",type:"Element",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Element",isAbstract:!0,properties:[{name:"extensionAttribute",type:"ExtensionAttribute",isAttr:!0,isReference:!0},{name:"elements",type:"ExtensionElements",isAttr:!0,isReference:!0}]},{name:"Artifact",isAbstract:!0,superClass:["DMNElement"],properties:[]},{name:"Association",superClass:["Artifact"],properties:[{name:"sourceRef",type:"DMNElementReference",xml:{serialize:"property"}},{name:"targetRef",type:"DMNElementReference",xml:{serialize:"property"}},{name:"associationDirection",type:"AssociationDirection",isAttr:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",isAttr:!0,type:"String",default:"text/plain"}]},{name:"RuleAnnotationClause",properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"RuleAnnotation",properties:[{name:"text",type:"String"}]},{name:"Invocable",isAbstract:!0,superClass:["DRGElement"],properties:[{name:"variable",type:"InformationItem",xml:{serialize:"property"}}]},{name:"Group",superClass:["Artifact"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"FunctionItem",superClass:["DMNElement"],properties:[{name:"parameters",isMany:!0,type:"InformationItem",xml:{serialize:"property"}},{name:"outputTypeRef",isAttr:!0,type:"String"}]},{name:"DMNElementReference",properties:[{isAttr:!0,name:"href",type:"String"}]}],enumerations:[{name:"HitPolicy",literalValues:[{name:"UNIQUE"},{name:"FIRST"},{name:"PRIORITY"},{name:"ANY"},{name:"COLLECT"},{name:"RULE ORDER"},{name:"OUTPUT ORDER"}]},{name:"BuiltinAggregator",literalValues:[{name:"SUM"},{name:"COUNT"},{name:"MIN"},{name:"MAX"}]},{name:"DecisionTableOrientation",literalValues:[{name:"Rule-as-Row"},{name:"Rule-as-Column"},{name:"CrossTable"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"FunctionKind",literalValues:[{name:"FEEL"},{name:"Java"},{name:"PMML"}]}],associations:[],xml:{tagAlias:"lowerCase"}},dmndi:{name:"DMNDI",prefix:"dmndi",uri:"https://www.omg.org/spec/DMN/20191111/DMNDI/",types:[{name:"DMNDI",properties:[{name:"diagrams",type:"DMNDiagram",isMany:!0},{name:"styles",type:"DMNStyle",isMany:!0}]},{name:"DMNStyle",superClass:["di:Style"],properties:[{name:"fillColor",type:"dc:Color",isAttr:!0},{name:"strokeColor",type:"dc:Color",isAttr:!0},{name:"fontColor",type:"dc:Color",isAttr:!0},{name:"fontSize",isAttr:!0,type:"Real"},{name:"fontFamily",isAttr:!0,type:"String"},{name:"fontItalic",isAttr:!0,type:"Boolean"},{name:"fontBold",isAttr:!0,type:"Boolean"},{name:"fontUnderline",isAttr:!0,type:"Boolean"},{name:"fontStrikeThrough",isAttr:!0,type:"Boolean"},{name:"labelHorizontalAlignment",type:"dc:AlignmentKind",isAttr:!0},{name:"labelVerticalAlignment",type:"dc:AlignmentKind",isAttr:!0}]},{name:"DMNDiagram",superClass:["di:Diagram"],properties:[{name:"dmnElementRef",type:"dmn:DMNElement",isAttr:!0,isReference:!0},{name:"size",type:"Size"},{name:"localStyle",type:"DMNStyle",isVirtual:!0},{name:"sharedStyle",type:"DMNStyle",isVirtual:!0,isReference:!0,redefines:"di:DiagramElement#sharedStyle"},{name:"diagramElements",type:"DMNDiagramElement",isMany:!0}]},{name:"DMNDiagramElement",isAbstract:!0,superClass:["di:DiagramElement"],properties:[{name:"dmnElementRef",type:"dmn:DMNElement",isAttr:!0,isReference:!0},{name:"sharedStyle",type:"DMNStyle",isVirtual:!0,isReference:!0,redefines:"di:DiagramElement#sharedStyle"},{name:"localStyle",type:"DMNStyle",isVirtual:!0},{name:"label",type:"DMNLabel"}]},{name:"DMNLabel",superClass:["di:Shape"],properties:[{name:"text",type:"Text"}]},{name:"DMNShape",superClass:["di:Shape","DMNDiagramElement"],properties:[{name:"isListedInputData",isAttr:!0,type:"Boolean"},{name:"decisionServiceDividerLine",type:"DMNDecisionServiceDividerLine"},{name:"isCollapsed",isAttr:!0,type:"Boolean"}]},{name:"DMNEdge",superClass:["di:Edge","DMNDiagramElement"],properties:[{name:"sourceElement",type:"DMNDiagramElement",isAttr:!0,isReference:!0},{name:"targetElement",type:"DMNDiagramElement",isAttr:!0,isReference:!0}]},{name:"DMNDecisionServiceDividerLine",superClass:["di:Edge"]},{name:"Text",properties:[{name:"text",isBody:!0,type:"String"}]},{name:"Size",superClass:["dc:Dimension"]}],associations:[],enumerations:[]},biodi:{name:"bpmn.io DI for DMN",uri:"http://bpmn.io/schema/dmn/biodi/2.0",prefix:"biodi",xml:{tagAlias:"lowerCase"},types:[{name:"DecisionTable",isAbstract:!0,extends:["dmn:DecisionTable"],properties:[{name:"annotationsWidth",isAttr:!0,type:"Integer"}]},{name:"OutputClause",isAbstract:!0,extends:["dmn:OutputClause"],properties:[{name:"width",isAttr:!0,type:"Integer"}]},{name:"InputClause",isAbstract:!0,extends:["dmn:InputClause"],properties:[{name:"width",isAttr:!0,type:"Integer"}]}]}};function ot(e,t){return new nt(L({},rt,e),t)}var it=Object.prototype.toString,at=Object.prototype.hasOwnProperty;function ct(e,t){var n;if(void 0!==e){var r,o,i="[object Array]"===it.call(e)?st:ut;for(r in e)if(o=r,at.call(e,o)&&!1===t(n=e[r],i(r)))return n}}function ut(e){return e}function st(e){return Number(e)}function lt(e){for(var n=e.style,t=arguments.length,r=Array(1
a',Rt=!ju.getElementsByTagName("link").length,ju=void 0);var Tt={legend:[1,"
","
"],tr:[2,"","
"],col:[2,"","
"],_default:Rt?[1,"X
","
"]:[0,"",""]};function Dt(e,t){return(t=t||document).querySelector(e)}function Mt(e,t){return(t=t||document).querySelectorAll(e)}function Bt(e){e.parentNode&&e.parentNode.removeChild(e)}function It(t){return function(){if(!window.Promise)throw new Error("Promises is not supported in this environment. Please polyfill Promise.");var e=arguments.length;if(!(1<=e&&m(arguments[e-1])))return t.apply(this,arguments);var n=arguments[e-1];console.warn(new Error("Passing callbacks to "+t.name.replace("bound ","")+" is deprecated and will be removed in a future major release. Please switch to promises: https://bpmn.io/l/moving-to-promises.html"));e=Array.prototype.slice.call(arguments,0,-1);t.apply(this,e).then(function(e){var t=Object.keys(e)[0];return n(null,e[t])},function(e){return n(e,e.warnings)})}}function At(t,e){var n,r=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function Nt(t){for(var e=1;ee.length)&&(t=e.length);for(var n=0,r=new Array(t);n",""],Tt.option=Tt.optgroup=[1,'"],Tt.thead=Tt.tbody=Tt.colgroup=Tt.caption=Tt.tfoot=[1,"","
"],Tt.polyline=Tt.ellipse=Tt.polygon=Tt.circle=Tt.text=Tt.line=Tt.path=Tt.rect=Tt.g=[1,'',""];var Ut={width:"100%",height:"100%",position:"relative"},Ht=function(){function n(){var e=this,t=0"!==e.message)return null;t=-1!==t.indexOf('"http://www.omg.org/spec/DMN/20151101/dmn.xsd"')?"1.1":-1!==t.indexOf('"http://www.omg.org/spec/DMN/20180521/MODEL/"')&&"1.2";return t?(e=new Error("unsupported DMN "+t+" file detected; only DMN 1.3 files can be opened"),console.error("Cannot open what looks like a DMN "+t+" diagram. Please refer to https://bpmn.io/l/dmn-compatibility.html to learn how to make the toolkit compatible with older DMN files",e),e):null}(e,r)||(t=e,(n=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(t.message))?(t.message="unparsable content <"+n[1]+"> detected; this may indicate an invalid DMN 1.3 diagram file"+n[2],t):null)||e,s._emit("import.parse.complete",l({error:e,warnings:o})),s._emit("import.done",{error:e,warnings:o}),e.warnings=o,a(e)})}).catch(function(e){return s._emit("import.done",{error:e,warnings:[]}),e.warnings=[],a(e)})});function l(e){var t=s._eventBus.createEvent(e);return Object.defineProperty(t,"context",{enumerable:!0,get:function(){return console.warn(new Error("import.parse.complete is deprecated and will be removed in future library versions")),{warnings:e.warnings,references:e.references,elementsById:e.elementsById}}}),t}}},{key:"getDefinitions",value:function(){return this._definitions}},{key:"getActiveView",value:function(){return this._activeView}},{key:"getActiveViewer",value:function(){var e=this.getActiveView();return e&&this._getViewer(e)}},{key:"getView",value:function(t){return this._views.filter(function(e){return e.element===t})[0]}},{key:"getViews",value:function(){return this._views}},{key:"saveXML",value:function(e){var r=this;e=e||{};var o=this._definitions;return new Promise(function(t,n){o?(o=r._emit("saveXML.start",{definitions:o})||o,r._moddle.toXML(o,e).then(function(e){var e=e.xml;return{xml:e=r._emit("saveXML.serialized",{xml:e})||e}}).catch(function(e){return{error:e}}).then(function(e){r._emit("saveXML.done",e),e.error?n(e.error):t({xml:e.xml})})):n(new Error("no definitions loaded"))})}},{key:"on",value:function(){var e;(e=this._eventBus).on.apply(e,arguments)}},{key:"off",value:function(){var e;(e=this._eventBus).off.apply(e,arguments)}},{key:"once",value:function(){var e;(e=this._eventBus).once.apply(e,arguments)}},{key:"attachTo",value:function(e){(e="string"==typeof(e=e.get&&e.constructor.prototype.jquery?e.get(0):e)?Dt(e):e).appendChild(this._container),this._emit("attach",{})}},{key:"detach",value:function(){this._emit("detach",{}),Bt(this._container)}},{key:"destroy",value:function(){var t=this;Object.keys(this._viewers).forEach(function(e){Kt(t._viewers[e],"destroy")}),Bt(this._container)}},{key:"_init",value:function(e){this._options=e,this._moddle=this._createModdle(e),this._viewers={},this._views=[];var t=kt('
'),n=L({},Ut,e);L(t.style,{width:Wt(n.width),height:Wt(n.height),position:n.position}),this._container=t,e.container&&this.attachTo(e.container)}},{key:"_clear",value:function(){return this._switchView(null)}},{key:"open",value:function(e){return this._switchView(e)}},{key:"_setDefinitions",value:function(e){this._definitions=e,this._updateViews()}},{key:"_updateViews",value:function(){var e=this._definitions;if(!e)return this._views=[],void this._switchView(null);var t,n=this._getViewProviders(),r=[e].concat(Lt(e.drgElement||[])),o=this._views,i=[],a=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=$t(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,t=function(){};return{s:t,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}(r);try{for(a.s();!(t=a.n()).done;){var c,u=t.value,s=b(n,function(e){return"string"==typeof e.opens?e.opens===u.$type:e.opens(u)});s&&(c={element:u,id:u.id,name:u.name,type:s.id},i.push(c))}}catch(e){a.e(e)}finally{a.f()}var l,p=this._activeView;!p||(l=b(i,function(e){return qt(p,e)})||this._getInitialView(i))?(e=!qt(p,l)||Gt(p,l),r=o.length!==i.length||!j(i,function(t){return b(o,function(e){return qt(e,t)&&!Gt(e,t)})}),this._activeView=l,this._views=i,(e||r)&&this._viewsChanged()):this._switchView(null)}},{key:"_getInitialView",value:function(e,t){var n;return(n=t?b(e,function(e){return qt(e,t)})||b(e,function(e){return e.type===t}):n)||e[0]}},{key:"_switchView",value:function(c){var u=this;return new Promise(function(n,r){function t(e,t){u._viewsChanged(),e?r(e):n(t)}var e,o=u.getActiveView(),i=c&&u._getViewer(c),a=c&&c.element;if(o&&(e=u._getViewer(o))!==i&&(Kt(e,"clear"),e.detach()),u._activeView=c,i)return e!==i&&i.attachTo(u._container),u._emit("import.render.start",{view:c,element:a}),void i.open(a).then(function(e){u._emit("import.render.complete",{view:c,error:null,warnings:e.warnings}),t(null,e)}).catch(function(e){u._emit("import.render.complete",{view:c,error:e,warnings:e.warnings}),t(e,null)});t()})}},{key:"_getViewer",value:function(e){var t=e.type,n=this._viewers[t];return n||(n=this._viewers[t]=this._createViewer(e.type),this._emit("viewer.created",{type:t,viewer:n})),n}},{key:"_createViewer",value:function(t){var e=b(this._getViewProviders(),function(e){return e.id===t});if(!e)throw new Error("no provider for view type <"+t+">");var n=e.constructor,e=this._options[t]||{};return new n(Nt(Nt(Nt({},this._options.common||{}),e),{},{additionalModules:[].concat(Lt(e.additionalModules||[]),[{_parent:["value",this],moddle:["value",this._moddle]}])}))}},{key:"_emit",value:function(){var e;return(e=this._eventBus).fire.apply(e,arguments)}},{key:"_createModdle",value:function(e){return new ot(e.moddleExtensions)}},{key:"_getViewProviders",value:function(){return[]}}])&&zt(e.prototype,t),r&&zt(e,r),Object.defineProperty(e,"prototype",{writable:!1}),n}();function Wt(e){return e+(h(e)?"px":"")}function qt(e,t){return f(e)?!!f(t)&&(e.element===t.element||e.id===t.id):!f(t)}function Gt(e,t){return!e||!t||e.name!==t.name}function Kt(e,t){m(e[t])&&e[t]()}var Xt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Yt(e,t){return e(t={exports:{}},t.exports),t.exports}var Zt=Yt(function(e){var c=e.exports=function(e,t){if(t=t||16,(e=void 0===e?128:e)<=0)return"0";for(var n=Math.log(Math.pow(2,e))/Math.log(t),r=2;n===1/0;r*=2)n=Math.log(Math.pow(2,e/r))/Math.log(t)*r;for(var o=n-Math.floor(n),i="",r=0;r=Math.pow(2,e)?c(e,t):i};c.rack=function(r,o,i){function n(e){var t=0;do{if(10 ");return i.length=0,new Error(t?e+" (Resolving: "+t+")":e)};function u(e,t){if(!f[e]&&-1!==e.indexOf(".")){for(var n=e.split("."),r=u(n.shift());n.length;)r=r[n.shift()];return r}if(mn(a,e))return a[e];if(mn(f,e)){if(-1!==i.indexOf(e))throw i.push(e),c("Cannot resolve circular dependency!");return i.push(e),a[e]=f[e][0](f[e][1]),i.pop(),a[e]}return o.get(e,t)}function r(e,t){if(void 0===t&&(t={}),"function"!=typeof e){if(!yn(e))throw new Error('Cannot invoke "'+e+'". Expected a function!');e=vn(e.slice())}return{fn:e,dependencies:(e.$inject||wn(e)).map(function(e){return mn(t,e)?t[e]:u(e)})}}function t(e){var t=r(e),e=t.fn,t=t.dependencies;return new(Function.prototype.bind.apply(e,[null].concat(t)))}function n(e,t,n){e=r(e,n),n=e.fn,e=e.dependencies;return n.apply(t,e)}function s(e,t){if(t&&t.length){var n,r,o,i,a,c=Object.create(null),u=Object.create(null),s=[],l=[],p=[];for(a in f)n=f[a],-1!==t.indexOf(a)&&("private"===n[2]?-1===(r=s.indexOf(n[3]))?(i=function(t){return vn(function(e){return t.get(e)})}(o=n[3].createChild([],t)),s.push(n[3]),l.push(o),p.push(i),c[a]=[i,a,"private",o]):c[a]=[p[r],a,"private",l[r]]:c[a]=[n[2],n[1]],u[a]=!0),"factory"!==n[2]&&"type"!==n[2]||!n[1].$scope||t.forEach(function(e){-1!==n[1].$scope.indexOf(e)&&(c[a]=[n[2],n[1]],u[e]=!0)});t.forEach(function(e){if(!u[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')}),e.unshift(c)}return new xn(e,d)}var l,p,h={factory:n,type:t,value:function(e){return e}};function y(e,t){var n=e.__init__||[];return function(){n.forEach(function(e){try{"string"==typeof e?t.get(e):t.invoke(e)}catch(e){if("undefined"!=typeof AggregateError)throw new AggregateError([e],"Failed to initialize!");throw new Error("Failed to initialize! "+e.message)}})}}function m(r){var e=r.__exports__;if(e){var t=r.__modules__,n=Object.keys(r).reduce(function(e,t){return"__exports__"!==t&&"__modules__"!==t&&"__init__"!==t&&"__depends__"!==t&&(e[t]=r[t]),e},Object.create(null)),o=s((t||[]).concat(n)),i=vn(function(e){return o.get(e)});e.forEach(function(e){f[e]=[i,e,"private",o]});e=(r.__init__||[]).slice();return e.unshift(function(){o.init()}),y(r=Object.assign({},r,{__init__:e}),o)}return Object.keys(r).forEach(function(e){var t,n;"__init__"!==e&&"__depends__"!==e&&("private"!==r[e][2]?(t=r[e][0],n=r[e][1],f[e]=[h[t],function(e,t){"value"!==e&&yn(t)&&(t=vn(t.slice()));return t}(t,n),t]):f[e]=r[e])}),y(r,d)}function v(e,t){return-1!==e.indexOf(t)||-1!==(e=(t.__depends__||[]).reduce(v,e)).indexOf(t)?e:e.concat(t)}this.get=u,this.invoke=n,this.instantiate=t,this.createChild=s,this.init=(l=e.reduce(v,[]).map(m),p=!1,function(){p||(p=!0,l.forEach(function(e){return e()}))})}function On(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function jn(e,t){var o=this;e.on(["render.shape","render.connection"],t=t||1e3,function(e,t){var n=e.type,r=t.element,e=t.gfx,t=t.attrs;if(o.canRender(r))return"render.shape"===n?o.drawShape(e,r,t):o.drawConnection(e,r,t)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(e,t){if(o.canRender(t))return"render.getShapePath"===e.type?o.getShapePath(t):o.getConnectionPath(t)})}function En(e,t){return t.appendChild(function(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch(e){}return e}(e,t))}function Cn(e,t){return En(t,e),e}jn.prototype.canRender=function(){},jn.prototype.drawShape=function(){},jn.prototype.drawConnection=function(){},jn.prototype.getShapePath=function(){},jn.prototype.getConnectionPath=function(){};var Sn=2,Pn={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":Sn,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":Sn,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function kn(e,t,n){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=Pn[r];o?(o===Sn&&"number"==typeof n&&(n=String(n)+"px"),e.style[r]=n):e.setAttributeNS(null,t,n)}function Rn(e,t,n){if("string"==typeof t){if(void 0===n)return r=e,Pn[o=t]?r.style[o]:r.getAttributeNS(null,o);kn(e,t,n)}else!function(e,t){for(var n,r=Object.keys(t),o=0;n=r[o];o++)kn(e,n,t[n])}(e,t);var r,o;return e}function Tn(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;n"+e+"",t=!0);var n=(n=e,(e=new DOMParser).async=!1,e.parseFromString(n,"text/xml"));if(!t)return n;for(var r=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)r.appendChild(o.firstChild);return r}function Un(e,t){var n="<"===e.charAt(0)?(n=Fn(e).firstChild,document.importNode(n,!0)):document.createElementNS(Vn.svg,e);return t&&Rn(n,t),n}var Hn=Un("svg");function Wn(e,t){for(var n,r=Object.keys(t),o=0;n=r[o];o++)e[n]=t[n];return e}function qn(e){return e?Hn.createSVGTransformFromMatrix(e):Hn.createSVGTransform()}var Gn=/([&<>]{1})/g,Kn=/([\n\r"]{1})/g,Xn={"&":"&","<":"<",">":">",'"':"'"};function Yn(e,t){return e.replace(t,function(e,t){return Xn[t]||t})}function Zn(e,t){var n=Fn(t);if(Ln(e),t){"#document-fragment"!==n.nodeName&&(n=n.documentElement);for(var r=(n=n.childNodes,Array.prototype.slice.call(n)),o=0;o"),r=0,o=(c=t.childNodes).length;r")}else n.push("/>");break;case 8:n.push("\x3c!--",Yn(t.nodeValue,Gn),"--\x3e");break;case 4:n.push("");break;default:throw new Error("unable to handle node "+t.nodeType)}return n}(t,n),t=t.nextSibling;return n.join("")}function Jn(e,t){var n,r,o;for(e.clear(),n=0;o=t[n];n++)e.appendItem((r=e,(o=o)instanceof SVGMatrix?r.createSVGTransformFromMatrix(o):o))}function er(e,t){e=e.transform.baseVal;return t&&Jn(e,t=!Array.isArray(t)?[t]:t),e.consolidate()}function tr(e){return e.join(",").replace(/,?([A-z]),?/g,"$1")}function nr(e){for(var t,n="",r=0;t=e[r];r++)n+=t.x+","+t.y+" ";return n}function rr(e,t){var n=Un("polyline");return Rn(n,{points:nr(e)}),t&&Rn(n,t),n}function or(e){return w(e,function(t){return!b(e,function(e){return e!==t&&function e(t,n){if(!n)return;if(t===n)return n;if(!t.parent)return;return e(t.parent,n)}(t,e)})})}function ir(e,t,n){n=!n||-1===e.indexOf(t);return n&&e.push(t),n}function ar(e,n,r){r=r||0,x(e=!y(e)?[e]:e,function(e,t){t=n(e,t,r);y(t)&&t.length&&ar(t,n,r+1)})}function cr(e,t){return r=!t,o=-1,i=[],a=[],ar(e,function(e,t,n){ir(i,e,r);e=e.children;if((-1===o||n=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Hr(e,t,n,r,o){return e*(e*(-3*t+9*n-9*r+3*o)+6*t-12*n+6*r)-3*t+3*n}function Wr(e,t,n,r,o,i,a,c,u){for(var s=(u=1<(u=null==u?1:u)?1:u<0?0:u)/2,l=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],f=0,d=0;d<12;d++){var h=s*l[d]+s,y=Hr(h,e,n,o,a),h=Hr(h,t,r,i,c);f+=p[d]*Er.sqrt(y*y+h*h)}return s*f}function qr(e){return Math.round(1e11*e)/1e11}function Gr(e,t,n){var r=Fr(e),o=Fr(t);if(o=o,r=Lr(r=r),!(Ur(o=Lr(o),r.x,r.y)||Ur(o,r.x2,r.y)||Ur(o,r.x,r.y2)||Ur(o,r.x2,r.y2)||Ur(r,o.x,o.y)||Ur(r,o.x2,o.y)||Ur(r,o.x,o.y2)||Ur(r,o.x2,o.y2)||(r.xo.x||o.xr.x)&&(r.yo.y||o.yr.y)))return n?0:[];for(var o=Wr.apply(0,e),r=Wr.apply(0,t),i=!Xr(e)&&~~(o/5)||1,a=!Xr(t)&&~~(r/5)||1,c=[],u=[],s={},l=n?0:[],p=0;pPr(o,a)||Pr(t,r)Pr(i,c))){var u=(e*r-t*n)*(o-a)-(e-n)*(o*c-i*a),s=(e*r-t*n)*(i-c)-(t-r)*(o*c-i*a),l=(e-n)*(i-c)-(t-r)*(o-a);if(l){var p=qr(u/l),u=qr(s/l),s=+p.toFixed(2),l=+u.toFixed(2);if(!(s<+Sr(e,n).toFixed(2)||s>+Pr(e,n).toFixed(2)||s<+Sr(o,a).toFixed(2)||s>+Pr(o,a).toFixed(2)||l<+Sr(t,r).toFixed(2)||l>+Pr(t,r).toFixed(2)||l<+Sr(i,c).toFixed(2)||l>+Pr(i,c).toFixed(2)))return{x:p,y:u}}}}(y.x,y.y,m.x,m.y,v.x,v.y,g.x,g.y);w&&(s[h=w.x.toFixed(9)+"#"+w.y.toFixed(9)]||(s[h]=!0,y=y.t+Rr((w[b]-y[b])/(m[b]-y[b]))*(m.t-y.t),v=v.t+Rr((w[_]-v[_])/(g[_]-v[_]))*(g.t-v.t),0<=y&&y<=1&&0<=v&&v<=1&&(n?l++:l.push({x:w.x,y:w.y,t1:y,t2:v}))))}return l}function Kr(e){var t=Nr(e);if(t.abs)return Vr(t.abs);if(!(e=!Mr(e)||!Mr(e&&e[0])?function(e){if(!e)return null;var t=Nr(e);if(t.arr)return Ir(t.arr);var i={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},a=[];return(a=Mr(e)&&Mr(e[0])?Ir(e):a).length||String(e).replace(Tr,function(e,t,n){var r=[],o=t.toLowerCase();for(n.replace(Dr,function(e,t){t&&r.push(+t)}),"m"==o&&2=i[o]&&(a.push([t].concat(r.splice(0,i[o]))),i[o]););}),a.toString=Nr.toString,t.arr=Ir(a),a}(e):e)||!e.length)return[["M",0,0]];var n,r=[],o=0,i=0,a=0,c=0,u=0;"M"==e[0][0]&&(a=o=+e[0][1],c=i=+e[0][2],u++,r[0]=["M",o,i]);for(var s,l,p=u,f=e.length;pd&&(l=w,p=c,f=u,y=Qr(c=g+n*Er.cos(w=_+d*(a&&_=o.right,t=r.top-n.y>=o.bottom,t=i?"top":t?"bottom":null,e=r.right+n.x<=o.left?"left":e?"right":null;return e&&t?t+"-"+e:e||t||"intersect"}function co(e,t,n){t=eo(e,t);return 1===t.length||2===t.length&&gr(t[0],t[1])<1?to(t[0]):1 already created at index <"+t+">");return n.group},fo.prototype._getChildIndex=function(n){return O(this._layers,function(e,t){return t.visible&&n>=t.index&&e++,e},0)},fo.prototype._createLayer=function(e,t){var n=this._getChildIndex(t=void 0===t?1:t);return{group:lo(this._viewport,"layer-"+e,n),index:t,visible:!0}},fo.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");var t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");var n=this._viewport,r=t.group,e=t.index;if(t.visible)return r;e=this._getChildIndex(e);return n.insertBefore(r,n.childNodes[e]||null),t.visible=!0,r},fo.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");var t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");e=t.group;return t.visible&&(Nn(e),t.visible=!1),e},fo.prototype._removeLayer=function(e){var t=this._layers[e];t&&(delete this._layers[e],Nn(t.group))},fo.prototype.getActiveLayer=function(){var e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},fo.prototype.findRoot=function(e){if(e="string"==typeof e?this._elementRegistry.get(e):e)return(this._findPlaneForRoot(function(e){for(;e.parent;)e=e.parent;return e}(e))||{}).rootElement},fo.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},fo.prototype._findPlaneForRoot=function(t){return b(this._planes,function(e){return e.rootElement===t})},fo.prototype.getContainer=function(){return this._container},fo.prototype._updateMarker=function(e,t,n){var r;e.id||(e=this._elementRegistry.get(e)),(r=this._elementRegistry._elements[e.id])&&(x([r.gfx,r.secondaryGfx],function(e){e&&(n?In(e).add(t):In(e).remove(t))}),this._eventBus.fire("element.marker.update",{element:e,gfx:r.gfx,marker:t,add:!!n}))},fo.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},fo.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},fo.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),In(this.getGraphics(e)).has(t)},fo.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},fo.prototype.getRootElement=function(){var e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},fo.prototype.addRootElement=function(e){var t=this._rootsIdx++,n=(e=e||{id:"__implicitroot_"+t,children:[],isImplicit:!0}).layer="root-"+t;this._ensureValid("root",e);t=this.getLayer(n,0);return this.hideLayer(n),this._addRoot(e,t),this._planes.push({rootElement:e,layer:t}),e},fo.prototype.removeRootElement=function(t){if("string"==typeof t&&(t=this._elementRegistry.get(t)),this._findPlaneForRoot(t))return this._removeRoot(t),this._removeLayer(t.layer),this._planes=this._planes.filter(function(e){return e.rootElement!==t}),this._rootElement===t&&(this._rootElement=null),t},fo.prototype.setRootElement=function(e,t){if(f(t))throw new Error("override not supported");if(e!==this._rootElement){if(!e)throw new Error("rootElement required");return this._findPlaneForRoot(e)||(e=this.addRootElement(e)),this._setRoot(e),e}},fo.prototype._removeRoot=function(e){var t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},fo.prototype._addRoot=function(e,t){var n=this._elementRegistry,r=this._eventBus;r.fire("root.add",{element:e}),n.add(e,t),r.fire("root.added",{element:e,gfx:t})},fo.prototype._setRoot=function(e,t){var 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})},fo.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");var n=po[e];if(!j(n,function(e){return void 0!==t[e]}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},fo.prototype._setParent=function(e,t,n){mr(t.children,e,n),e.parent=t},fo.prototype._addElement=function(e,t,n,r){n=n||this.getRootElement();var o=this._eventBus,i=this._graphicsFactory;this._ensureValid(e,t),o.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,r);r=i.create(e,t,r);return this._elementRegistry.add(t,r),i.update(e,t,r),o.fire(e+".added",{element:t,gfx:r}),t},fo.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},fo.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},fo.prototype._removeElement=function(e,t){var n=this._elementRegistry,r=this._graphicsFactory,o=this._eventBus;if(e=n.get(e.id||e))return o.fire(t+".remove",{element:e}),r.remove(e),yr(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},fo.prototype.removeShape=function(e){return this._removeElement(e,"shape")},fo.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},fo.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},fo.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},fo.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},fo.prototype.viewbox=function(t){if(void 0===t&&this._cachedViewbox)return this._cachedViewbox;var e,n,r,o,i=this._viewport,a=this.getSize();return t?(this._changeViewbox(function(){n=Math.min(a.width/t.width,a.height/t.height);var e=this._svg.createSVGMatrix().scale(n).translate(-t.x,-t.y);er(i,e)}),t):(e=(o=this._rootElement?this.getActiveLayer():null)&&o.getBBox()||{},o=(r=er(i))?r.matrix:function(e,t,n,r,o,i){var a=Hn.createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Wn(a,e);case 6:return Wn(a,{a:e,b:t,c:n,d:r,e:o,f:i})}}(),n=uo(o.a,1e3),r=uo(-o.e||0,1e3),o=uo(-o.f||0,1e3),t=this._cachedViewbox={x:r?r/n:0,y:o?o/n:0,width:a.width/n,height:a.height/n,scale:n,inner:{width:e.width||0,height:e.height||0,x:e.x||0,y:e.y||0},outer:a})},fo.prototype.scroll=function(e){var t=this._viewport,n=t.getCTM();return e&&this._changeViewbox(function(){e=L({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),ho(t,n)}),{x:n.e,y:n.f}},fo.prototype.scrollToElement=function(e,t){var n=100;"string"==typeof e&&(e=this._elementRegistry.get(e));var r=this.findRoot(e);r!==this.getRootElement()&&this.setRootElement(r),"number"==typeof(t=t||{})&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};var o=sr(e),i=no(o),a=this.viewbox(),r=this.zoom();a.y+=t.top/r,a.x+=t.left/r,a.width-=(t.right+t.left)/r,a.height-=(t.bottom+t.top)/r;var c,n=no(a);a=o.width in ref");t=this.props[t]}var n,r,o,i;t.collection?go(this,t,e):(n=this,r=e,o=(t=t).inverse,i=r[t.name],Object.defineProperty(r,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return i},set:function(e){var t;e!==i&&(t=i,i=null,t&&n.unset(t,o,r),i=e,n.set(i,o,r))}}))},bo.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return vo.isExtended(n)||go(this,t,e),n},bo.prototype.ensureBound=function(e,t){var n;n=t,Object.prototype.hasOwnProperty.call(e,n.name||n)||this.bind(e,t)},bo.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},bo.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var _o=bo;_o.Collection=vo;var wo=new _o({name:"children",enumerable:!0,collection:!0},{name:"parent"}),xo=new _o({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Oo=new _o({name:"attachers",collection:!0},{name:"host"}),jo=new _o({name:"outgoing",collection:!0},{name:"source"}),Eo=new _o({name:"incoming",collection:!0},{name:"target"});function Co(){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)}}),wo.bind(this,"parent"),xo.bind(this,"labels"),jo.bind(this,"outgoing"),Eo.bind(this,"incoming")}function So(){Co.call(this),wo.bind(this,"children"),Oo.bind(this,"host"),Oo.bind(this,"attachers")}function Po(){So.call(this)}function ko(){So.call(this),xo.bind(this,"labelTarget")}function Ro(){Co.call(this),jo.bind(this,"source"),Eo.bind(this,"target")}On(So,Co),On(Po,So),On(ko,So),On(Ro,Co);var To={connection:Ro,shape:So,label:ko,root:Po};function Do(){this._uid=12}function Mo(e){return e.childNodes[0]}function Bo(e,t,n){var r=qn();r.setTranslate(t,n),er(e,r)}function Io(e,t){this._eventBus=e,this._elementRegistry=t}function Ao(e,t,n){n=n||t.firstChild;e!==n&&t.insertBefore(e,n)}Do.prototype.createRoot=function(e){return this.create("root",e)},Do.prototype.createLabel=function(e){return this.create("label",e)},Do.prototype.createShape=function(e){return this.create("shape",e)},Do.prototype.createConnection=function(e){return this.create("connection",e)},Do.prototype.create=function(e,t){return(t=L({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=To[e];if(!n)throw new Error("unknown type: <"+e+">");return L(new n,t)}(e,t)},Io.$inject=["eventBus","elementRegistry"],Io.prototype._getChildrenContainer=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=n.parentNode.childNodes[1])||(In(t=Un("g")).add("djs-children"),Cn(n.parentNode,t)):t=n,t},Io.prototype._clear=function(e){e=Mo(e);return gt(e),e},Io.prototype._createContainer=function(e,t,n,r){var o=Un("g");In(o).add("djs-group"),void 0!==n?Ao(o,t,t.childNodes[n]):Cn(t,o);t=Un("g");In(t).add("djs-element"),In(t).add("djs-"+e),r&&In(t).add("djs-frame"),Cn(o,t);o=Un("g");return In(o).add("djs-visual"),Cn(t,o),t},Io.prototype.create=function(e,t,n){var r=this._getChildrenContainer(t.parent);return this._createContainer(e,r,n,pr(t))},Io.prototype.updateContainments=function(e){var r=this,o=this._elementRegistry;x(O(e,function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e},{}),function(e){var t,n=e.children;n&&(t=r._getChildrenContainer(e),x(n.slice().reverse(),function(e){Ao(o.getGraphics(e).parentNode,t)}))})},Io.prototype.drawShape=function(e,t){return this._eventBus.fire("render.shape",{gfx:e,element:t})},Io.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},Io.prototype.drawConnection=function(e,t){return this._eventBus.fire("render.connection",{gfx:e,element:t})},Io.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},Io.prototype.update=function(e,t,n){if(t.parent){var r=this._clear(n);if("shape"===e)this.drawShape(r,t),Bo(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(r,t)}t.hidden?Rn(n,"display","none"):Rn(n,"display","block")}},Io.prototype.remove=function(e){Nn(this._elementRegistry.getGraphics(e).parentNode)};var No={__depends__:[hr],__init__:["canvas"],canvas:["type",fo],elementRegistry:["type",mo],elementFactory:["type",Do],eventBus:["type",U],graphicsFactory:["type",Io]};function Lo(e){var e=[{config:["value",e=e||{}]},No].concat(e.modules||[]);return(e=new xn(e=e)).init(),e}function $o(e,t){this.injector=t=t||Lo(e),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}$o.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},$o.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};var Vo=new _o({name:"dmnElementRef",enumerable:!0},{name:"di",configurable:!0});function zo(r,e){var o=[];function i(t){try{return t.di&&function(e){if(e.gfx)throw new Error("already rendered "+e.id);return r.element(e)}(t)}catch(e){n(e.message,{element:t,error:e})}}function a(e){var t;(e=(t=e).dmnElementRef)?e.di?n("multiple DI elements defined for element",{element:e}):(Vo.bind(e,"di"),e.di=t):n("no DMN element referenced in element",{element:t})}function c(e){o.push(e)}function n(e,t){r.error(e,t)}return{handleDefinitions:function(e,t){var n=e.dmnDI;if(!n)throw new Error("no dmndi:DMNDI");if(n=n.diagrams||[],t&&-1===n.indexOf(t))throw new Error("diagram not part of dmndi:DMNDI");if(!(t=!t&&n&&n.length?n[0]:t))throw new Error("no diagram to display");x((e.di=t).diagramElements,a),r.root(e),x(e.get("drgElement"),function(e){var t;i(e),t=e,x(["informationRequirement","knowledgeRequirement","authorityRequirement"],function(e){x(t[e],function(e){c(function(){i(e)})})})}),x(e.get("artifact"),function(e){var t;en(e,"dmn:Association")?(t=e,c(function(){i(t)})):i(e)}),x(o,function(e){e()})}}}function Fo(e,t,n){var r,o=e.get("drdImporter"),e=e.get("eventBus"),i=[];e.fire("import.start",{definitions:t});try{new zo({root:function(e){return o.root(e)},element:function(e,t){return o.add(e,t)},error:function(e,t){i.push({message:e,context:t})}}).handleDefinitions(t)}catch(e){r=e}e.fire("import.done",{error:r,warnings:i}),n(r,i)}var Uo=new Jt,Ho="hsl(225, 10%, 15%)";function Wo(e,t,r,n,o,a){jn.call(this,t);var i=Uo.next(),c=n.computeStyle,u={},s=e&&e.defaultFillColor||"white",l=e&&e.defaultStrokeColor||Ho,p=e&&e.defaultLabelColor;function f(e,t,n){t=e+"-"+Go(t)+"-"+Go(n)+"-"+i;return u[t]||function(e,t,n){{var r,o;"association-start"===t?(Rn(r=Un("path"),{d:"M 11 5 L 1 10 L 11 15"}),d(e,{element:r,attrs:{fill:"none",stroke:n,strokeWidth:1.5},ref:{x:1,y:10},scale:.5})):"association-end"===t?(Rn(r=Un("path"),{d:"M 1 5 L 11 10 L 1 15"}),d(e,{element:r,attrs:{fill:"none",stroke:n,strokeWidth:1.5},ref:{x:12,y:10},scale:.5})):"information-requirement-end"===t?(Rn(o=Un("path"),{d:"M 1 5 L 11 10 L 1 15 Z"}),d(e,{element:o,attrs:{fill:n,stroke:"none"},ref:{x:11,y:10},scale:1})):"knowledge-requirement-end"===t?(Rn(o=Un("path"),{d:"M 1 3 L 11 10 L 1 17"}),d(e,{element:o,attrs:{fill:"none",stroke:n,strokeWidth:2},ref:{x:11,y:10},scale:.8})):"authority-requirement-end"===t&&(Rn(t=Un("circle"),{cx:3,cy:3,r:3}),d(e,{element:t,attrs:{fill:n,stroke:"none"},ref:{x:3,y:3},scale:.9}))}}(t,e,n),"url(#"+t+")"}function d(e,t){var n=L({strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},t.attrs),r=t.ref||{x:0,y:0},o=t.scale||1;"none"===n.strokeDasharray&&(n.strokeDasharray=[1e4,1]);var i=Un("marker");Rn(t.element,n),Cn(i,t.element),Rn(i,{id:e,viewBox:"0 0 20 20",refX:r.x,refY:r.y,markerWidth:20*o,markerHeight:20*o,orient:"auto"});o=Dt("defs",a._svg);o||(o=Un("defs"),Cn(a._svg,o)),Cn(o,i),u[e]=i}function h(e,t,n,r,o,i){_(o)&&(i=o,o=0),o=o||0,i=c(i,{stroke:Ho,strokeWidth:2,fill:"white"});var a=Un("rect");return Rn(a,{x:o,y:o,width:t-2*o,height:n-2*o,rx:r,ry:r}),Rn(a,i),Cn(e,a),a}function y(e,t,n){n=o.createText(t||"",n);return pt(n,"class","djs-label"),Cn(e,n),n}function m(e,t,n,r){return y(e,rn(t).name,r=L({box:t,align:n,padding:5,style:{fill:Ko(0,p,l)}},r))}function v(e,t,n){n=c(n,["no-fill"],{strokeWidth:2,stroke:Ho});var r=Un("path");return Rn(r,{d:t}),Rn(r,n),Cn(e,r),r}var g={"dmn:Decision":function(e,t){var n=h(e,t.width,t.height,0,{stroke:l,fill:s});return m(e,t,"center-middle"),n},"dmn:KnowledgeSource":function(e,t){var n=v(e,r.getScaledPath("KNOWLEDGE_SOURCE",{xScaleFactor:1.021,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.075}}),{strokeWidth:2,fill:s,stroke:l});return m(e,t,"center-middle"),n},"dmn:BusinessKnowledgeModel":function(e,t){var n=v(e,r.getScaledPath("BUSINESS_KNOWLEDGE_MODEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.3}}),{strokeWidth:2,fill:s,stroke:l});return m(e,t,"center-middle"),n},"dmn:InputData":function(e,t){var n=h(e,t.width,t.height,22,{stroke:l,fill:s});return m(e,t,"center-middle"),n},"dmn:TextAnnotation":function(e,t){var n=h(e,t.width,t.height,0,0,{fill:"none",stroke:"none"});return v(e,r.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:0}}),{stroke:l}),y(e,qo(t).text||"",{style:{fill:Ko(0,p,l)},box:t,align:"left-top",padding:5}),n},"dmn:Association":function(e,t){var n=qo(t),r=s,o=l,i={stroke:o,strokeDasharray:"0.5, 5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"};return"One"!==n.associationDirection&&"Both"!==n.associationDirection||(i.markerEnd=f("association-end",r,o)),"Both"===n.associationDirection&&(i.markerStart=f("association-start",r,o)),b(e,t.waypoints,i)},"dmn:InformationRequirement":function(e,t){var n={stroke:l,strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",markerEnd:f("information-requirement-end",s,l)};return b(e,t.waypoints,n)},"dmn:KnowledgeRequirement":function(e,t){var n={stroke:l,strokeWidth:1,strokeDasharray:5,strokeLinecap:"round",strokeLinejoin:"round",markerEnd:f("knowledge-requirement-end",s,l)};return b(e,t.waypoints,n)},"dmn:AuthorityRequirement":function(e,t){var n={stroke:l,strokeWidth:1.5,strokeDasharray:5,strokeLinecap:"round",strokeLinejoin:"round",markerEnd:f("authority-requirement-end",s,l)};return b(e,t.waypoints,n)}};function b(e,t,n){n=rr(t,n=c(n,["no-fill"],{stroke:Ho,strokeWidth:2,fill:"none"}));return Cn(e,n),n}this.canRender=function(e){return en(e,"dmn:DMNElement")||en(e,"dmn:InformationRequirement")||en(e,"dmn:KnowledgeRequirement")||en(e,"dmn:AuthorityRequirement")},this.drawShape=function(e,t){var n=g[t.type];return n?n(e,t):jn.prototype.drawShape.apply(this,[e,t])},this.drawConnection=function(e,t){var n=t.type;return(n=g[n])?n(e,t):jn.prototype.drawConnection.apply(this,[e,t])}}function qo(e){return e.businessObject}function Go(e){return e.replace(/[^0-9a-zA-z]+/g,"_")}function Ko(e,t,n){return t||n}dn(Wo,jn),Wo.$inject=["config.drdRenderer","eventBus","pathMap","styles","textRenderer","canvas"];var Xo={width:150,height:50};function Yo(e,t,n){for(var r,o=e.shift(),i=o;;){if((r=function(e,t){var n;t.textContent=e;try{var r,o=""===e;return t.textContent=o?"dummy":e,r={width:(n=t.getBBox()).width+2*n.x,height:n.height},o&&(r.width=0),r}catch(e){return{width:0,height:0}}}(i,n)).width=i?r.width:0," "===i||""===i||r.widthe?t.width:e},0),h=a.top;"middle"===i.vertical&&(h+=(r.height-e)/2),h-=(u||l[0].height)/4;var y=Un("text");return Rn(y,o),x(l,function(e){var t;switch(h+=u||e.height,i.horizontal){case"left":t=a.left;break;case"right":t=(c?d:p)-a.right-e.width;break;default:t=Math.max(((c?d:p)-e.width)/2+a.left,0)}var n=Un("tspan");Rn(n,{x:t,y:h}),n.textContent=e.text,Cn(y,n)}),Nn(f),{dimensions:{width:d,height:e},element:y}};function Jo(e){var n=L({fontFamily:"Arial, sans-serif",fontSize:12,fontWeight:"normal",lineHeight:1.2},e&&e.defaultStyle||{}),t=parseInt(n.fontSize,10)-1,r=L({},n,{fontSize:t},e&&e.externalStyle||{}),o=new Qo({style:n});this.getExternalLabelBounds=function(e,t){t=o.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:r});return{x:Math.round(e.x+e.width/2-t.width/2),y:Math.round(e.y),width:Math.ceil(t.width),height:Math.ceil(t.height)}},this.getTextAnnotationBounds=function(e,t){t=o.getDimensions(t,{box:e,style:n,align:"left-top",padding:5});return{x:e.x,y:e.y,width:e.width,height:Math.max(30,Math.round(t.height))}},this.createText=function(e,t){return o.createText(e,t||{})},this.getDefaultStyle=function(){return n},this.getExternalStyle=function(){return r}}Jo.$inject=["config.textRenderer"];var ei=/\{([^{}]+)\}/g,ti=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var ni={__init__:["drdRenderer"],drdRenderer:["type",Wo],textRenderer:["type",Jo],pathMap:["type",function(){this.pathMap={KNOWLEDGE_SOURCE:{d:"m {mx},{my} l 0,{e.y0} c {e.x0},{e.y1} {e.x1},-{e.y2} {e.x2},-{e.y3} c {e.x3},-{e.y4} {e.x4},{e.y5} {e.x5},{e.y6} l 0,-{e.y7}z",width:100,height:65,widthElements:[29.8,48.4,67.2,12.2,19.8,30.8],heightElements:[55.3,19.7,4.2,6.7,2.3,1.6,6.2,54.6]},BUSINESS_KNOWLEDGE_MODEL:{d:"m {mx},{my} l {e.x0},-{e.y0} l {e.x1},0 l 0,{e.y1} l -{e.x2},{e.y2} l -{e.x3},0z",width:125,height:45,widthElements:[13.8,109.2,13.8,109.1],heightElements:[13.2,29.8,13.2]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",width:10,height:30,widthElements:[10],heightElements:[30]}},this.getRawPath=function(e){return this.pathMap[e].d},this.getScaledPath=function(e,t){var n,r,o=this.pathMap[e],e=t.abspos?(n=t.abspos.x,t.abspos.y):(n=t.containerWidth*t.position.mx,t.containerHeight*t.position.my),i={};if(t.position){for(var a=t.containerHeight/o.height*t.yScaleFactor,c=t.containerWidth/o.width*t.xScaleFactor,u=0;u");return Rn(e,n),e}function v(e,t){Cn(e,t)}this.removeHits=function(e){x(Mt(".djs-hit",e),Nn)},this.createDefaultHit=function(e,t){var n=e.waypoints,r=e.isFrame;return n?this.createWaypointsHit(t,n):this.createBoxHit(t,r?"stroke":"all",{width:e.width,height:e.height})},this.createWaypointsHit=function(e,t){t=rr(t);return m(t,"stroke"),v(e,t),t},this.createBoxHit=function(e,t,n){n=L({x:0,y:0},n);var r=Un("rect");return m(r,t),Rn(r,n),v(e,r),r},this.updateDefaultHit=function(e,t){var n,r=Dt(".djs-hit",t);if(r)return e.waypoints?(n=r,t=e.waypoints,Rn(n,{points:nr(t)})):Rn(r,{width:e.width,height:e.height}),r},this.fire=c,this.triggerMouseEvent=function(e,t,n){var r=s[e];if(!r)throw new Error("unmapped DOM event name <"+e+">");return c(r,t,n)},this.mouseHandler=o,this.registerEvent=f,this.unregisterEvent=d}gi.$inject=["eventBus","elementRegistry","styles"];var bi={__init__:["interactionEvents"],interactionEvents:["type",gi]};function _i(e,t,n){this.offset=6;var r=t.cls("djs-outline",["no-fill"]),o=this;function i(e){var t=Un("rect");return Rn(t,L({x:10,y:10,rx:3,width:100,height:100},r)),Cn(e,t),t}e.on(["shape.added","shape.changed"],500,function(e){var t=e.element,n=e.gfx,e=(e=Dt(".djs-outline",n))||i(n);o.updateShapeOutline(e,t)}),e.on(["connection.added","connection.changed"],function(e){var t=e.element,n=e.gfx,e=(e=Dt(".djs-outline",n))||i(n);o.updateConnectionOutline(e,t)})}_i.prototype.updateShapeOutline=function(e,t){Rn(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},_i.prototype.updateConnectionOutline=function(e,t){t=sr(t);Rn(e,{x:t.x-this.offset,y:t.y-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},_i.$inject=["eventBus","styles","elementRegistry"];var wi={__init__:["outline"],outline:["type",_i]};function xi(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],function(e){e=e.element;n.deselect(e)}),e.on(["diagram.clear","root.set"],function(e){n.select(null)})}xi.$inject=["eventBus","canvas"],xi.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);-1!==n&&(e=t.slice(),t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:e,newSelection:t}))},xi.prototype.get=function(){return this._selectedElements},xi.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},xi.prototype.select=function(e,t){var n=this._selectedElements,r=n.slice();y(e)||(e=e?[e]:[]);var o=this._canvas,i=o.getRootElement();e=e.filter(function(e){e=o.findRoot(e);return i===e}),t?x(e,function(e){-1!==n.indexOf(e)||n.push(e)}):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:r,newSelection:n})};var Oi="selected";function ji(n,e,t){this._canvas=n;var r=this;function o(e,t){n.addMarker(e,t)}function i(e,t){n.removeMarker(e,t)}this._multiSelectionBox=null,e.on("element.hover",function(e){o(e.element,"hover")}),e.on("element.out",function(e){i(e.element,"hover")}),e.on("selection.changed",function(e){var t=e.oldSelection,n=e.newSelection;x(t,function(e){-1===n.indexOf(e)&&i(e,Oi)}),x(n,function(e){-1===t.indexOf(e)&&o(e,Oi)}),r._updateSelectionOutline(n)}),e.on("element.changed",function(e){t.isSelected(e.element)&&r._updateSelectionOutline(t.get())})}function Ei(e,o,i,r){e.on("create.end",500,function(e){var t=e.context,n=t.canExecute,e=t.elements,t=(t.hints||{}).autoSelect;n&&!1!==t&&(y(t)?o.select(t):o.select(e.filter(Ci)))}),e.on("connect.end",500,function(e){e=e.context.connection;e&&o.select(e)}),e.on("shape.move.end",500,function(e){var t=e.previousSelection||[],n=r.get(e.context.shape.id);b(t,function(e){return n.id===e.id})||o.select(n)}),e.on("element.click",function(e){if(di(e)){var t=e.element;t===i.getRootElement()&&(t=null);var n=o.isSelected(t),r=1'),{position:"absolute",width:0,height:0}),e.insertBefore(n,e.firstChild),n),this._init()}function Ti(e,t,n){lt(e,{left:t+"px",top:n+"px"})}function Di(e,t){e.style.display=!1===t?"none":""}function Mi(t,n){t.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(e){t.style[e+"transform"]=n})}Ri.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Ri.prototype.get=function(e){if(v(e)&&(e={id:e}),v(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,r({type:e.type})):t.overlays.slice():[]}return e.type?w(this._overlays,r({type:e.type})):e.id?this._overlays[e.id]:null},Ri.prototype.add=function(e,t,n){if(_(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 r=this._ids.next();return n=L({},this._overlayDefaults,n,{id:r,type:t,element:e,html:n.html}),this._addOverlay(n),r},Ri.prototype.remove=function(e){e=this.get(e)||[];y(e)||(e=[e]);var n=this;x(e,function(e){var t=n._getOverlayContainer(e.element,!0);e&&(Bt(e.html),Bt(e.htmlContainer),delete e.htmlContainer,delete e.element,delete n._overlays[e.id]),!t||-1!==(e=t.overlays.indexOf(e))&&t.overlays.splice(e,1)})},Ri.prototype.show=function(){Di(this._overlayRoot)},Ri.prototype.hide=function(){Di(this._overlayRoot,!1)},Ri.prototype.clear=function(){this._overlays={},this._overlayContainers=[],gt(this._overlayRoot)},Ri.prototype._updateOverlayContainer=function(e){var t,n=e.element,r=e.html,o=n.x,i=n.y;n.waypoints&&(o=(t=sr(n)).x,i=t.y),Ti(r,o,i),pt(e.html,"data-container-id",n.id)},Ri.prototype._updateOverlay=function(e){var t,n=e.position,r=e.htmlContainer,o=e.element,i=n.left,a=n.top;void 0!==n.right&&(t=(o.waypoints?sr(o):o).width,i=-1*n.right+t),void 0!==n.bottom&&(o=(o.waypoints?sr(o):o).height,a=-1*n.bottom+o),Ti(r,i||0,a||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Ri.prototype._createOverlayContainer=function(e){var t=kt('
');lt(t,{position:"absolute"}),this._overlayRoot.appendChild(t);e={html:t,element:e,overlays:[]};return this._updateOverlayContainer(e),this._overlayContainers.push(e),e},Ri.prototype._updateRoot=function(e){var t=e.scale||1,t="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Mi(this._overlayRoot,t)},Ri.prototype._getOverlayContainer=function(t,e){var n=b(this._overlayContainers,function(e){return e.element===t});return n||e?n:this._createOverlayContainer(t)},Ri.prototype._addOverlay=function(e){var t,n,r=e.id,o=e.element,i=e.html;v(i=i.get&&i.constructor.prototype.jquery?i.get(0):i)&&(i=kt(i)),n=this._getOverlayContainer(o),lt(t=kt('
'),{position:"absolute"}),t.appendChild(i),e.type&&mt(t).add("djs-overlay-"+e.type),Di(t,this._canvas.findRoot(o)===this._canvas.getRootElement()),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[r]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Ri.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,r=this._canvas.findRoot(e.element),o=n&&n.minZoom,i=n&&n.maxZoom,a=!0;Di(e.htmlContainer,a=r!==this._canvas.getRootElement()||n&&(f(o)&&o>t.scale||f(i)&&io&&(r=(1/t.scale||1)*o)),Mi(i,e=f(r)?"scale("+r+","+r+")":e)},Ri.prototype._updateOverlaysVisibilty=function(t){var n=this;x(this._overlays,function(e){n._updateOverlayVisibilty(e,t)})},Ri.prototype._init=function(){var e=this._eventBus,n=this;e.on("canvas.viewbox.changing",function(e){n.hide()}),e.on("canvas.viewbox.changed",function(e){e=e.viewbox,n._updateRoot(e),n._updateOverlaysVisibilty(e),n.show()}),e.on(["shape.remove","connection.remove"],function(e){e=e.element;x(n.get({element:e}),function(e){n.remove(e.id)});var e=n._getOverlayContainer(e);e&&(Bt(e.html),-1!==(e=n._overlayContainers.indexOf(e))&&n._overlayContainers.splice(e,1))}),e.on("element.changed",500,function(e){e=e.element,e=n._getOverlayContainer(e,!0);e&&(x(e.overlays,function(e){n._updateOverlay(e)}),n._updateOverlayContainer(e))}),e.on("element.marker.update",function(e){var t=n._getOverlayContainer(e.element,!0);t&&mt(t.html)[e.add?"add":"remove"](e.marker)}),e.on("root.set",function(){n._updateOverlaysVisibilty(n._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};var Bi={__init__:["overlays"],overlays:["type",Ri]};function Ii(e,t){this._eventBus=e,this._canvas=t,e.on("diagram.init",function(){this._init()},this),e.on("import.done",function(e){e.error||this.update()},this)}function Ai(e,n){function t(e,t){mt(n.getContainer()).toggle(e,t)}e.on("palette.create",function(){t("with-palette",!0)}),e.on("palette.changed",function(e){t("with-palette-two-column",e.twoColumn)})}Ii.$inject=["eventBus","canvas"],Ii.prototype._init=function(){var e=this._canvas,t=this._eventBus,n=e.getContainer(),e=this._container=kt(Ii.HTML_MARKUP);n.appendChild(e),this.nameElement=Dt(".dmn-definitions-name",this._container),this.idElement=Dt(".dmn-definitions-id",this._container),Pt.bind(e,".dmn-definitions-name, .dmn-definitions-id","mousedown",function(e){e.stopPropagation()}),t.fire("definitionIdView.create",{html:e})},Ii.prototype.update=function(){var e=this._canvas.getRootElement().businessObject;this.nameElement.textContent=e.name,this.idElement.textContent=e.id},Ii.HTML_MARKUP='
',Ai.$inject=["eventBus","canvas"];var Ni={__init__:["definitionPropertiesView","definitionPropertiesPaletteAdapter"],definitionPropertiesView:["type",Ii],definitionPropertiesPaletteAdapter:["type",Ai]};function Li(e,t){for(var n=0;n\n \n
\n ')),t=this._overlays.add(e,{position:{top:2,left:2},html:n});!1!==this._config.enabled&&(mt(n).add("interactive"),this.bindEventListener(e,n,t))}},{key:"bindEventListener",value:function(e,t,n){var r=this,o=this._overlays,i=this._eventBus,o=o._overlayRoot;Pt.bind(o,'[data-overlay-id="'+n+'"]',"click",function(){!1!==i.fire("drillDown.click",{element:e})&&r.drillDown(e)})}},{key:"drillDown",value:function(e){var t=this._injector.get("_parent",!1);if(!t)return!1;e=t.getView(e.businessObject);return!!e&&(t.open(e),!0)}}])&&Li(e.prototype,t),n&&Li(e,n),Object.defineProperty(e,"prototype",{writable:!1}),o}();Vi.$inject=["injector","eventBus","overlays","config.drillDown"];var zi={__depends__:[Bi],__init__:["drillDown"],drillDown:["type",Vi]},Fi=''; /** * This file must not be changed or exchanged. * * @see http://bpmn.io/license for more information. */function Ui(e){return e.join(";")}var Hi,Wi='
'+Fi+'Web-based tooling for BPMN, DMN and CMMN diagrams powered by bpmn.io.
';var qi=["additionalModules","canvas"];function Gi(t,e){var n,r=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function Ki(r){for(var e=1;ee.length)&&(t=e.length);for(var n=0,r=new Array(t);n'+Fi+""),t.appendChild(n),Ct.bind(n,"click",function(e){Hi||(Hi=kt(Wi),Pt.bind(Hi,".backdrop","click",function(e){document.body.removeChild(Hi)})),document.body.appendChild(Hi),e.preventDefault()}),this._init(this._container,e)}function Ji(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ea(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ta(e){return Math.log(e)/Math.log(10)}function na(e,t){var n=ta(e.min),e=ta(e.max);return(Math.abs(n)+Math.abs(e))/t}dn(Qi,$o),Qi.prototype.saveSVG=It(function(e){var o=this;return new Promise(function(e){var t=o.get("canvas"),n=t.getDefaultLayer(),r=Dt("defs",t._svg),t=function(e,t){if(void 0===t)return Qn(e);try{Zn(e,t)}catch(e){throw new Error("error parsing SVG: "+e.message)}return e}(n),r=r&&r.outerHTML||"",n=n.getBBox();e({svg:'\n\x3c!-- created with dmn-js / http://bpmn.io --\x3e\n\n'+r+t+""})})}),Qi.prototype.getModules=function(){return this._modules},Qi.prototype.destroy=function(){$o.prototype.destroy.call(this),Bt(this._container)},Qi.prototype.on=function(e,t,n,r){return this.get("eventBus").on(e,t,n,r)},Qi.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Qi.prototype._init=function(e,t){var n=t.additionalModules,r=t.canvas,o=Zi(t,qi),i=t.modules||this.getModules(),n=[].concat([{drd:["value",this]}],Xi(i),Xi(n||[])),n=Ki(Ki({},o),{},{canvas:Ki(Ki({},r),{},{container:e}),modules:n});$o.call(this,n),t&&t.container&&this.attachTo(t.container)},Qi.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Qi.prototype._createContainer=function(){return kt('
')},Qi.prototype.open=function(e){var o=this;return new Promise(function(n,r){var t;try{return o._definitions&&o.clear(),o._definitions=e,Fo(o,e,function(e,t){e?(e.warnings=t||[],r(e)):n({warnings:t||[]})})}catch(e){t=e}t?(t.warnings=t.warnings||[],r(t)):n({warnings:[]})})},Qi.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach();var t=this._container;e.appendChild(t),this._emit("attach",{}),this.get("canvas").resized()},Qi.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Qi.prototype._modules=[ai,ci,Si,Bi,Ni,zi];var ra=Math.sign||function(e){return 0<=e?1:-1},oa={min:.2,max:4};function ia(t,e,n){t=t||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=A(this._handleWheel,this),this._totalDelta=0,this._scale=t.scale||.75;var r=this;e.on("canvas.init",function(e){r._init(!1!==t.enabled)})}ia.$inject=["config.zoomScroll","eventBus","canvas"],ia.prototype.scroll=function(e){this._canvas.scroll(e)},ia.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ia.prototype.zoom=function(e,t){var n=na(oa,20);this._totalDelta+=e,.1\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",e=o.console&&(o.console.warn||o.console.log);return e&&e.call(o.console,r,t),n.apply(this,arguments)}}var d="function"!=typeof Object.assign?function(e){if(e===s||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;nt[n]}):r.sort():r}function P(e,t){for(var n,r=t[0].toUpperCase()+t.slice(1),o=0;ol(o.y)?o.x:o.y,t.scale=a?function(e,t){return te(t[0],t[1],K)/te(e[0],e[1],K)}(a.pointers,r):1,t.rotation=a?function(e,t){return ne(t[1],t[0],K)+ne(e[1],e[0],K)}(a.pointers,r):0,t.maxPointers=!n.prevInput||t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers,function(e,t){var n,r,o=e.lastInterval||t,i=t.timeStamp-o.timeStamp;{var a,c,u;t.eventType!=L&&(Il(u.y)?u.x:u.y,c=ee(a,c),e.lastInterval=t):(u=o.velocity,n=o.velocityX,r=o.velocityY,c=o.direction)}t.velocity=u,t.velocityX=n,t.velocityY=r,t.direction=c}(n,t);e=e.element;x(t.srcEvent.target,e)&&(e=t.srcEvent.target);t.target=e}(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function Z(e){for(var t=[],n=0;n=l(t)?e<0?V:z:t<0?F:U}function te(e,t,n){var r=t[(n=n||G)[0]]-e[n[0]],n=t[n[1]]-e[n[1]];return Math.sqrt(r*r+n*n)}function ne(e,t,n){var r=t[(n=n||G)[0]]-e[n[0]],n=t[n[1]]-e[n[1]];return 180*Math.atan2(n,r)/Math.PI}X.prototype={handler:function(){},init:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(R(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(R(this.element),this.evWin,this.domHandler)}};var re={mousedown:A,mousemove:2,mouseup:N};function oe(){this.evEl="mousedown",this.evWin="mousemove mouseup",this.pressed=!1,X.apply(this,arguments)}m(oe,X,{handler:function(e){var t=re[e.type];t&A&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=N),this.pressed&&(t&N&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:"mouse",srcEvent:e}))}});var ie={pointerdown:A,pointermove:2,pointerup:N,pointercancel:L,pointerout:L},ae={2:B,3:"pen",4:"mouse",5:"kinect"},ce="pointerdown",ue="pointermove pointerup pointercancel";function se(){this.evEl=ce,this.evWin=ue,X.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}o.MSPointerEvent&&!o.PointerEvent&&(ce="MSPointerDown",ue="MSPointerMove MSPointerUp MSPointerCancel"),m(se,X,{handler:function(e){var t=this.store,n=!1,r=e.type.toLowerCase().replace("ms",""),o=ie[r],i=ae[e.pointerType]||e.pointerType,a=i==B,r=E(t,e.pointerId,"pointerId");o&A&&(0===e.button||a)?r<0&&(t.push(e),r=t.length-1):o&(N|L)&&(n=!0),r<0||(t[r]=e,this.callback(this.manager,o,{pointers:t,changedPointers:[e],pointerType:i,srcEvent:e}),n&&t.splice(r,1))}});var le={touchstart:A,touchmove:2,touchend:N,touchcancel:L};function pe(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,X.apply(this,arguments)}m(pe,X,{handler:function(e){var t,n=le[e.type];n===A&&(this.started=!0),this.started&&(t=function(e,t){var n=C(e.touches),e=C(e.changedTouches);t&(N|L)&&(n=S(n.concat(e),"identifier",!0));return[n,e]}.call(this,e,n),n&(N|L)&&t[0].length-t[1].length==0&&(this.started=!1),this.callback(this.manager,n,{pointers:t[0],changedPointers:t[1],pointerType:B,srcEvent:e}))}});var fe={touchstart:A,touchmove:2,touchend:N,touchcancel:L};function de(){this.evTarget="touchstart touchmove touchend touchcancel",this.targetIds={},X.apply(this,arguments)}m(de,X,{handler:function(e){var t=fe[e.type],n=function(e,t){var n=C(e.touches),r=this.targetIds;if(t&(2|A)&&1===n.length)return r[n[0].identifier]=!0,[n,n];var o,i,a=C(e.changedTouches),c=[],u=this.target;if(i=n.filter(function(e){return x(e.target,u)}),t===A)for(o=0;ot.threshold&&o&t.direction},attrTest:function(e){return ke.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=Se(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),m(Te,ke,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[_e]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){var t;1!==e.scale&&(t=e.scale<1?"in":"out",e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),m(De,Ee,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return["auto"]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distancet.time;if(this._input=e,!r||!n||e.eventType&(N|L)&&!o)this.reset();else if(e.eventType&A)this.reset(),this._timer=p(function(){this.state=8,this.tryEmit()},t.time,this);else if(e.eventType&N)return 8;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&N?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=u(),this.manager.emit(this.options.event,this._input)))}}),m(Me,ke,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[_e]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),m(Be,ke,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:H|W,pointers:1},getTouchAction:function(){return Re.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(H|W)?t=e.overallVelocity:n&H?t=e.overallVelocityX:n&W&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&l(t)>this.options.velocity&&e.eventType&N},emit:function(e){var t=Se(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),m(Ie,Ee,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[be]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distancep.threshold))){if(L(n,{x:ec(c.x+r.x),y:ec(c.y+r.y),dx:0,dy:0},{originalEvent:e}),!1===h("start"))return x();p.active=!0,p.keepSelection||(n.previousSelection=s.get(),s.select(null)),p.cursor&&ua(p.cursor),u.addMarker(u.getRootElement(),tc)}li(e),p.active&&(L(n,{x:ec(o.x+r.x),y:ec(o.y+r.y),dx:ec(i.x),dy:ec(i.y)},{originalEvent:e}),h("move"))}function m(e){var t=!0;p.active&&(e&&li(p.payload.originalEvent=e),t=h("end")),!1===t&&h("rejected"),h("ended",n(!0!==t))}function v(e){27===e.which&&(nc(e),x())}function g(e){var t;p.active&&(t=pa(l),setTimeout(t,400),nc(e)),m(e)}function b(e){y(e)}function _(e){var t=p.payload;t.hoverGfx=e.gfx,t.hover=e.element,h("hover")}function w(e){h("out");var t=p.payload;t.hoverGfx=null,t.hover=null}function x(e){var t;p&&((t=p.active)&&h("cancel"),e=n(e),t&&h("canceled",e))}function n(e){h("cleanup"),sa(),n=p.trapClick?g:m,Ct.unbind(document,"mousemove",y),Ct.unbind(document,"dragstart",nc),Ct.unbind(document,"selectstart",nc),Ct.unbind(document,"mousedown",n,!0),Ct.unbind(document,"mouseup",n,!0),Ct.unbind(document,"keyup",v),Ct.unbind(document,"touchstart",b,!0),Ct.unbind(document,"touchcancel",x,!0),Ct.unbind(document,"touchmove",y,!0),Ct.unbind(document,"touchend",m,!0),l.off("element.hover",_),l.off("element.out",w),u.removeMarker(u.getRootElement(),tc);var t,n=p.payload.previousSelection;return!1!==e&&n&&!s.get().length&&(t=(t=n).filter(function(e){return r.get(e.id)})).length&&s.select(t),t=p,p=null,t}l.on("diagram.destroy",x),this.init=function(e,t,n,r){p&&x(!1),"string"==typeof t&&(r=n,n=t,t=null);var o,i,a,c,u=(r=L({},f,r||{})).data||{},s=r.trapClick?g:m;e?(o=si(e)||e,i=pi(e),li(e),"dragstart"===o.type&&nc(o)):(o=null,i={x:0,y:0}),a=d(i),t=t||a,c=o,c="undefined"!=typeof TouchEvent&&c instanceof TouchEvent,p=L({prefix:n,data:u,payload:{},globalStart:i,displacement:ea(t,a),localStart:a,isTouch:c},r),r.manual||(c?(Ct.bind(document,"touchstart",b,!0),Ct.bind(document,"touchcancel",x,!0),Ct.bind(document,"touchmove",y,!0),Ct.bind(document,"touchend",m,!0)):(Ct.bind(document,"mousemove",y),Ct.bind(document,"dragstart",nc),Ct.bind(document,"selectstart",nc),Ct.bind(document,"mousedown",s,!0),Ct.bind(document,"mouseup",s,!0)),Ct.bind(document,"keyup",v),l.on("element.hover",_),l.on("element.out",w)),h("init"),r.autoActivate&&y(e,!0)},this.move=y,this.hover=_,this.out=w,this.end=m,this.cancel=x,this.context=function(){return p},this.setOptions=function(e){L(f,e)}}rc.$inject=["eventBus","canvas","selection","elementRegistry"];var oc={__depends__:[Ja,Si],dragging:["type",rc]};function ic(e,t,n){this._canvas=n,this._opts=L({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var r=this;t.on("drag.move",function(e){e=r._toBorderPoint(e);r.startScroll(e)}),t.on(["drag.cleanup"],function(){r.stopScroll()})}ic.$inject=["config.autoScroll","eventBus","canvas"],ic.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,r=this,o=t.getContainer().getBoundingClientRect(),i=[e.x,e.y,o.width-e.x,o.height-e.y];this.stopScroll();for(var a=0,c=0,u=0;u<4;u++)!function(e,t,n){if(t=1&&i<=31||i==127||o==0&&i>=48&&i<=57||o==1&&i>=48&&i<=57&&c==45){a+="\\"+i.toString(16)+" ";continue}if(o==0&&r==1&&i==45){a+="\\"+n.charAt(o);continue}if(i>=128||i==45||i==95||i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122){a+=n.charAt(o);continue}a+="\\"+n.charAt(o)}return a};if(!e.CSS)e.CSS={};return e.CSS.escape=t}(typeof Xt!="undefined"?Xt:Xt)});function Oc(e,u,r,s,l){function n(e,t){var n,r,o,i,a=t.waypoints,c=mc(u,a,e);if(c)return o=c,n=(n=t).waypoints,i=!(o.index<=0||o.bendpoint)&&(o=wr((n={start:n[o.index-1],end:n[o.index]}).start,n.end))?_c("h"===o?n.end.x-n.start.x:n.end.y-n.start.y)/2:null,r=a,o=i,a=(n=c).index,i=n.point,!(a<=0||n.bendpoint)&&(a=xr(n=r[a-1],r=r[a]),n=wr(n,r),r=Math.abs(i.x-a.x),a=Math.abs(i.y-a.y),n&&r<=o&&a<=o)?l.start(e,t,c.index):s.start(e,t,c.index,!c.bendpoint),!0}function a(e,t,n){Ct.bind(e,t,function(e){r.triggerMouseEvent(t,e,n),e.stopPropagation()})}function i(e,t){var n=u.getLayer("overlays"),r=Dt('.djs-bendpoints[data-element-id="'+xc(e.id)+'"]',n);return!r&&t&&(Rn(r=Un("g"),{"data-element-id":e.id}),In(r).add("djs-bendpoints"),Cn(n,r),a(r,"mousedown",e),a(r,"click",e),a(r,"dblclick",e)),r}function c(e,t){return Dt('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function o(r,e){e.waypoints.forEach(function(e,t){var n=vc(r);Cn(r,n),Bo(n,e.x,e.y)}),vc(r,"floating")}function p(e,t){for(var n,r,o=t.waypoints,i=1;il.length-3&&c.unshift(f(o.target,a)),i.snapPoints=t={horizontal:[],vertical:[]},x(c,function(e){e&&(e=e.original||e,"y"===r&&t.horizontal.push(e.y),"x"===r&&t.vertical.push(e.x))}),t)),s=e.x,l=e.y;u&&(a=s-(o=p(u.vertical,s)),c=l-(i=p(u.horizontal,l)),L(e,{dx:e.dx-a,dy:e.dy-c,x:o,y:i}),!a&&-1===u.vertical.indexOf(s)||Kc(e,"x",o),!c&&-1===u.horizontal.indexOf(l)||Kc(e,"y",i))}),e.on(["connect.hover","connect.move","connect.end"],1500,function(e){var t=e.context.hover,n=t&&f(t,e);(t=t)&&t.waypoints&&n&&n.x&&n.y&&(Kc(e,"x",n.x),Kc(e,"y",n.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(e){var t,n,r=e.context,o=(t=(u=r).snapPoints,c=u.connection.waypoints,n=u.bendpointIndex,t||(n=[c[n-1],c[n+1]],u.snapPoints=t={horizontal:[],vertical:[]},x(n,function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))}),t)),i=r.hover,a=i&&f(i,e),c=e.x,u=e.y;o&&(r=c-(n=p(a?o.vertical.concat([a.x]):o.vertical,c)),a=u-(i=p(a?o.horizontal.concat([a.y]):o.horizontal,u)),L(e,{dx:e.dx-r,dy:e.dy-a,x:e.x-r,y:e.y-a}),!r&&-1===o.vertical.indexOf(c)||Kc(e,"x",n),!a&&-1===o.horizontal.indexOf(u)||Kc(e,"y",i))})}Qc.$inject=["eventBus"];var Jc={__depends__:[oc,uc],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Oc],bendpointMove:["type",Pc],bendpointMovePreview:["type",Ac],connectionSegmentMove:["type",Uc],bendpointSnapping:["type",Qc]};function eu(e,t,n,r){this._canvas=e,this._eventBus=n,this._overlays=r;t=f(t&&t.scale)?t.scale:{min:1,max:1.5};this._overlaysConfig={scale:t},this._current=null,this._init()}function tu(e,t){return-1!==e.indexOf(t)}eu.$inject=["canvas","config.contextPad","eventBus","overlays"],eu.prototype._init=function(){var n=this;this._eventBus.on("selection.changed",function(e){e=e.newSelection,e=e.length?1===e.length?e[0]:e:null;e?n.open(e,!0):n.close()}),this._eventBus.on("elements.changed",function(e){var t=e.elements,e=n._current;!e||E(y(e=e.target)?e:[e],function(e){return tu(t,e)})&&n.open(e,!0)})},eu.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("contextPad.getProviders",e,function(e){e.providers.push(t)})},eu.prototype.getEntries=function(t){var e=this._getProviders(),n=y(t)?"getMultiElementContextPadEntries":"getContextPadEntries",r={};return x(e,function(e){m(e[n])&&(m(e=e[n](t))?r=e(r):x(e,function(e,t){r[t]=e}))}),r},eu.prototype.trigger=function(e,t,n){var r=this._current.target,o=this._current.entries,i=t.delegateTarget||t.target;if(!i)return t.preventDefault();if(o=o[pt(i,"data-action")].action,i=t.originalEvent||t,m(o)){if("click"===e)return o(i,r,n)}else if(o[e])return o[e](i,r,n);t.preventDefault()},eu.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},eu.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},eu.prototype._updateAndOpen=function(e){var i,t=this.getEntries(e),n=this.getPad(e),a=n.html;x(t,function(e,t){var n,r=e.group||"default",o=kt(e.html||'
');pt(o,"data-action",t),(t=Dt("[data-group="+xc(r)+"]",a))||(pt(t=kt('
'),"data-group",r),a.appendChild(t)),t.appendChild(o),e.className&&(t=e.className,n=mt(o),(t=y(t)?t:t.split(/\s+/g)).forEach(function(e){n.add(e)})),e.title&&pt(o,"title",e.title),e.imageUrl&&(pt(i=kt(""),"src",e.imageUrl),i.style.width="100%",i.style.height="100%",o.appendChild(i))}),mt(a).add("open"),this._current={target:e,entries:t,pad:n},this._eventBus.fire("contextPad.open",{current:this._current})},eu.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,r=kt('
'),o=this._getPosition(e),o=L({html:r},this._overlaysConfig,o);Pt.bind(r,".entry","click",function(e){t.trigger("click",e)}),Pt.bind(r,".entry","dragstart",function(e){t.trigger("dragstart",e)}),Ct.bind(r,"mousedown",function(e){e.stopPropagation()});r=this._canvas.getRootElement();this._overlayId=n.add(r,"context-pad",o);n=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},eu.prototype.close=function(){this.isOpen()&&(this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},eu.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return y(e)===y(n)&&(y(e)?e.length===n.length&&j(e,function(e){return tu(n,e)}):n===e)},eu.prototype._getPosition=function(e){e=sr(y(e)?e:[e]);return{position:{left:e.x+e.width+12,top:e.y-6}}};var nu={__depends__:[bi,Bi],contextPad:["type",eu]};function ru(e,o,c,n){function i(e,t){return n.allowed("connection.create",{source:e,target:t})}e.on("connect.hover",function(e){var t=e.context,n=t.start,r=e.hover;if(t.hover=r,!d(e=t.canExecute=i(n,r))){if(!1!==e)return t.source=n,void(t.target=r);d(e=t.canExecute=i(r,n))||!1!==e&&(t.source=r,t.target=n)}}),e.on(["connect.out","connect.cleanup"],function(e){e=e.context;e.hover=null,e.source=null,e.target=null,e.canExecute=!1}),e.on("connect.end",function(e){var t=e.context,n=t.canExecute,r=t.connectionStart,o={x:e.x,y:e.y},i=t.source,a=t.target;if(!n)return!1;e=null,o={connectionStart:ou(t)?o:r,connectionEnd:ou(t)?r:o};_(n)&&(e=n),t.connection=c.connect(i,a,e,o)}),this.start=function(e,t,n,r){_(n)||(r=n,n=io(t)),o.init(e,"connect",{autoActivate:r,data:{shape:t,context:{start:t,connectionStart:n}}})}}function ou(e){var t=e.hover,n=e.source,e=e.target;return t&&n&&t===n&&n!==e}ru.$inject=["eventBus","dragging","modeling","rules"];var iu="connect-ok",au="connect-not-ok";function cu(e,t,n){var l=e.get("connectionPreview",!1);l&&t.on("connect.move",function(e){var t=e.context,n=t.canExecute,r=t.hover,o=t.source,i=t.start,a=t.startPosition,c=t.target,u=t.connectionStart||a,s=t.connectionEnd||{x:e.x,y:e.y},a=u,e=s;ou(t)&&(a=s,e=u),l.drawPreview(t,n,{source:o||i,target:c||r,connectionStart:a,connectionEnd:e})}),t.on("connect.hover",900,function(e){var t=e.context,e=e.hover,t=t.canExecute;null!==t&&n.addMarker(e,t?iu:au)}),t.on(["connect.out","connect.cleanup"],1100,function(e){e=e.hover;e&&(n.removeMarker(e,iu),n.removeMarker(e,au))}),l&&t.on("connect.cleanup",function(e){l.cleanUp(e.context)})}cu.$inject=["injector","eventBus","canvas"];var uu={__depends__:[Si,uc,oc],__init__:["connectPreview"],connect:["type",ru],connectPreview:["type",cu]},su=["marker-start","marker-mid","marker-end"],lu=["circle","ellipse","line","path","polygon","polyline","rect"];function pu(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._styles=r,this._clonedMarkers={};var o=this;t.on("drag.cleanup",function(){x(o._clonedMarkers,function(e){Nn(e)}),o._clonedMarkers={}})}pu.$inject=["elementRegistry","eventBus","canvas","styles"],pu.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},pu.prototype.addDragger=function(e,t,n){e=$n(n=n||this.getGfx(e)),n=n.getBoundingClientRect();return this._cloneMarkers(Mo(e)),Rn(e,this._styles.cls("djs-dragger",[],{x:n.top,y:n.left})),Cn(t,e),e},pu.prototype.addFrame=function(e,t){e=Un("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Cn(t,e),e},pu.prototype._cloneMarkers=function(o){var i=this;if(o.childNodes)for(var e=0;e'),n=this._current.position,r=this._current.className;return lt(t,{position:"absolute",left:n.x+"px",top:n.y+"px",visibility:"hidden"}),mt(t).add(r),pt(t,"data-popup",e),t},Ou.prototype._attachContainer=function(e,t,n){var r=this;Pt.bind(e,".entry","click",function(e){r.trigger(e)}),this._updateScale(e),t.appendChild(e),n&&this._assureIsInbounds(e,n),lt(e,{visibility:"visible"})},Ou.prototype._updateScale=function(e){var t,n,r,o=this._canvas.zoom(),i=this._config.scale,a=o;!0!==i&&(i=!1===i?t=1:(t=i.min,i.max),f(t)&&oo.width&&(s.x=!0),a+u>o.height&&(s.y=!0),s.x&&s.y?(n=l-c+"px",r=t-u+"px"):s.x?(n=l-c+"px",r=t+"px"):s.y&&t"),o=this;return mt(r).add(t),x(e,function(e,t){var n=o._createEntry(e,t),t=e.group||"default",e=Dt("[data-group="+xc(t)+"]",r);e||(pt(e=kt('
'),"data-group",t),r.appendChild(e)),e.appendChild(n)}),r},Ou.prototype._createEntry=function(e,t){var n,r=kt("
"),o=mt(r);return o.add("entry"),e.className&&e.className.split(" ").forEach(function(e){o.add(e)}),pt(r,wu,t),e.label&&((n=kt("")).textContent=e.label,r.appendChild(n)),e.imageUrl&&(pt(n=kt(""),"src",e.imageUrl),r.appendChild(n)),!0===e.active&&o.add("active"),!0===e.disabled&&o.add("disabled"),e.title&&(r.title=e.title),r},Ou.prototype._bindAutoClose=function(){this._eventBus.once(xu,this.close,this)},Ou.prototype._unbindAutoClose=function(){this._eventBus.off(xu,this.close,this)};var ju={__init__:["popupMenu"],popupMenu:["type",Ou]},Eu=Math.round;function Cu(e){this._modeling=e}Cu.$inject=["modeling"],Cu.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var r=this._modeling,o=t.width||e.width,i=t.height||e.height,a=t.x||e.x,c=t.y||e.y,a=Eu(a+o/2),c=Eu(c+i/2);return r.replaceShape(e,L({},t,{x:a,y:c,width:o,height:i}),n)};Rt={__init__:["replace"],replace:["type",Cu]};function Su(u,s,e,t){this.replaceElement=function(e,t,n){n=n||{};var r,o=t.type,i=e.businessObject,a=u.create(o),c={type:o,businessObject:a};return c.width=e.width,c.height=e.height,a.name=i.name,t.table&&(r=u.create("dmn:DecisionTable"),(a.decisionLogic=r).$parent=a,(o=u.create("dmn:OutputClause")).typeRef="string",(o.$parent=r).output=[o],(i=u.create("dmn:InputClause")).$parent=r,o=u.create("dmn:LiteralExpression",{typeRef:"string"}),(i.inputExpression=o).$parent=i,r.input=[i]),t.expression&&(a.decisionLogic=u.create("dmn:LiteralExpression"),a.variable=u.create("dmn:InformationItem")),s.replaceElement(e,c,n)}}Su.$inject=["drdFactory","replace","selection","modeling"];var hr={__depends__:[Rt,Si],drdReplace:["type",Su]},Pu=[{label:"Empty",actionName:"replace-with-empty-decision",className:"dmn-icon-clear",target:{type:"dmn:Decision",table:!1,expression:!1}},{label:"Decision Table",actionName:"replace-with-decision-table",className:"dmn-icon-decision-table",target:{type:"dmn:Decision",table:!0,expression:!1}},{label:"Literal Expression",actionName:"replace-with-literal-expression",className:"dmn-icon-literal-expression",target:{type:"dmn:Decision",table:!1,expression:!0}}];function ku(e,t,n,r,o,i){this._popupMenu=e,this._modeling=t,this._moddle=n,this._drdReplace=r,this._rules=o,this._translate=i,this.register()}ku.$inject=["popupMenu","modeling","moddle","drdReplace","rules","translate"],ku.prototype.register=function(){this._popupMenu.registerProvider("dmn-replace",this)},ku.prototype.getEntries=function(e){var r=e.businessObject;if(!this._rules.allowed("shape.replace",{element:e}))return[];if(en(r,"dmn:Decision")){var t=w(Pu,function(e){var t="replace-with-empty-decision"===e.actionName&&r.decisionLogic,n="replace-with-decision-table"===e.actionName&&!en(r.decisionLogic,"dmn:DecisionTable"),e="replace-with-literal-expression"===e.actionName&&!en(r.decisionLogic,"dmn:LiteralExpression");return t||n||e});return this._createEntries(e,t)}return[]},ku.prototype._createEntries=function(t,e){var n=[],r=this;return x(e,function(e){e=r._createMenuEntry(e,t);n.push(e)}),n},ku.prototype._createMenuEntry=function(e,t,n){var r=this._drdReplace.replaceElement;return n=n||function(){return r(t,e.target)},{label:(0,this._translate)(e.label),className:e.className,id:e.actionName,action:n}},ku.prototype.getHeaderEntries=function(e){return[]};_o={__depends__:[ci,ju,hr],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",ku]};function Ru(e,r,t,n,o,i,a,c,u,s,l,p){l=l||{},r.registerProvider(this),this._contextPad=r,this._modeling=t,this._elementFactory=n,this._connect=o,this._create=i,this._rules=a,this._popupMenu=c,this._canvas=u,this._translate=s,!1!==l.autoPlace&&(this._autoPlace=p.get("autoPlace",!1)),e.on("create.end",250,function(e){var t,n=e.context.shape;!hi(e)||(t=r.getEntries(n)).replace&&t.replace.action.click(e,n)})}Ru.$inject=["eventBus","contextPad","modeling","elementFactory","connect","create","rules","popupMenu","canvas","translate","config.contextPad","injector"],Ru.prototype.getContextPadEntries=function(t){var n=this._modeling,i=this._elementFactory,r=this._connect,a=this._create,c=this._popupMenu,u=this._canvas,s=this._contextPad,e=this._rules,l=this._translate,p=this._autoPlace,o={};if("label"===t.type)return o;var f=t.businessObject;function d(e,t,n){r.start(e,t,n)}function h(r,e,t,o){function n(e,t){var n=i.createShape(L({type:r},o));a.start(e,n,{source:t,hints:{connectionTarget:t}})}return"string"!=typeof t&&(o=t,t=l("Append {type}",{type:r.replace(/^dmn:/,"")})),{group:"model",className:e,title:t,action:{dragstart:n,click:p?function(e,t){var n=i.createShape(L({type:r},o));p.append(t,n,{connectionTarget:t})}:n}}}en(f,"dmn:Decision")&&L(o,{"append.decision":h("dmn:Decision","dmn-icon-decision")}),on(f,["dmn:BusinessKnowledgeModel","dmn:Decision","dmn:KnowledgeSource"])&&L(o,{"append.knowledge-source":h("dmn:KnowledgeSource","dmn-icon-knowledge-source")}),on(f,["dmn:BusinessKnowledgeModel","dmn:Decision"])&&L(o,{"append.business-knowledge-model":h("dmn:BusinessKnowledgeModel","dmn-icon-business-knowledge")}),on(f,["dmn:Decision","dmn:KnowledgeSource"])&&L(o,{"append.input-data":h("dmn:InputData","dmn-icon-input-data")}),en(f,"dmn:DRGElement")&&L(o,{"append.text-annotation":h("dmn:TextAnnotation","dmn-icon-text-annotation"),connect:{group:"connect",className:"dmn-icon-connection-multi",title:l("Connect using Information/Knowledge/Authority Requirement or Association"),action:{click:d,dragstart:d}}}),en(f,"dmn:TextAnnotation")&&L(o,{connect:{group:"connect",className:"dmn-icon-connection-multi",title:l("Connect using association"),action:{click:d,dragstart:d}}}),c.isEmpty(t,"dmn-replace")||L(o,{replace:{group:"edit",className:"dmn-icon-screw-wrench",title:l("Change type"),action:{click:function(e,t){var n,r,o,e=L((n=t,r=u.getContainer(),o=s.getPad(n).html,n=r.getBoundingClientRect(),o=(r=o.getBoundingClientRect()).top-n.top,{x:r.left-n.left,y:o+r.height+5}),{cursor:{x:e.x,y:e.y}});c.open(t,"dmn-replace",e)}}}});e=e.allowed("elements.delete",{elements:[t]});return(e=y(e)?e[0]===t:e)&&L(o,{delete:{group:"edit",className:"dmn-icon-trash",title:l("Remove"),action:{click:function(e){n.removeElements([t])}}}}),o};ni={__depends__:[ci,nu,Si,uu,bt,_o],__init__:["contextPadProvider"],contextPadProvider:["type",Ru]};function Tu(e,t,n,r){this._canvas=t,this._graphicsFactory=n,this._elementFactory=r,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Tu.$inject=["injector","canvas","graphicsFactory","elementFactory"],Tu.prototype.drawPreview=function(e,t,n){var r,o,i,a=e.connectionPreviewGfx,c=e.getConnection,u=(n=n||{}).source,s=n.target,l=n.waypoints,p=n.connectionStart,f=n.connectionEnd,d=n.noLayout,h=n.noCropping,y=n.noNoop,m=this;Ln(a=a||(e.connectionPreviewGfx=this.createConnectionPreviewGfx())),c=c||(e.getConnection=(o=function(e,t,n){return m.getConnection(e,t,n)},i={},function(e){e=JSON.stringify(e);return i[e]||(i[e]=o.apply(null,arguments))})),(r=t?c(t,u,s):r)?(r.waypoints=l||[],this._layouter&&!d&&(r.waypoints=this._layouter.layoutConnection(r,{source:u,target:s,connectionStart:p,connectionEnd:f,waypoints:n.waypoints||r.waypoints})),r.waypoints&&r.waypoints.length||(r.waypoints=[u?io(u):p,s?io(s):f]),this._connectionDocking&&(u||s)&&!h&&(r.waypoints=this._connectionDocking.getCroppedWaypoints(r,u,s)),this._graphicsFactory.drawConnection(a,r)):y||this.drawNoopPreview(a,n)},Tu.prototype.drawNoopPreview=function(e,t){var n=t.source,r=t.target,o=t.connectionStart||io(n),t=t.connectionEnd||io(r),r=this.cropWaypoints(o,t,n,r);Cn(e,this.createNoopConnection(r[0],r[1]))},Tu.prototype.cropWaypoints=function(e,t,n,r){var o=this._graphicsFactory,i=n&&o.getShapePath(n),a=r&&o.getShapePath(r),o=o.getConnectionPath({waypoints:[e,t]});return[e=n&&co(i,o,!0)||e,t=r&&co(a,o,!1)||t]},Tu.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Nn(e.connectionPreviewGfx)},Tu.prototype.getConnection=function(e){e=_(e=e)?e:{};return this._elementFactory.createConnection(e)},Tu.prototype.createConnectionPreviewGfx=function(){var e=Un("g");return Rn(e,{pointerEvents:"none"}),In(e).add("djs-connection-preview"),Cn(this._canvas.getActiveLayer(),e),e},Tu.prototype.createNoopConnection=function(e,t){var n=Un("polyline");return Rn(n,{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"}),Rn(n,{points:[e.x,e.y,t.x,t.y]}),n};var Vi={__init__:["connectionPreview"],connectionPreview:["type",Tu]},Du=/\s/,Mu=/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i,Bu=/^[a-z_][\w-.]*$/i,Iu=/\$\{([^}]*)\}/g;function Au(e,t){var n=e.$model.ids.assigned(t);return t?n&&n!==e?"Element must have unique ID.":function(e){if(function(e){return Du.test(e)}(e=function(e){return e.replace(Iu,"$1")}(e)))return"Id must not contain spaces.";if(!Bu.test(e))return Mu.test(e)?"Id must not contain prefix.":"Id must be a valid QName."}(t):"Element must have ID."}function Nu(e,t,n,r){this._eventBus=e,this._modeling=t,this._canvas=n,this._definitionPropertiesView=r,e.on("definitionIdView.create",function(e){this._container=e.html;var t=Dt(".dmn-definitions-name",this._container),e=Dt(".dmn-definitions-id",this._container);this._setup(t,"name"),this._setup(e,"id")},this)}Nu.$inject=["eventBus","modeling","canvas","definitionPropertiesView"],Nu.prototype.update=function(e,t){var n=this._canvas.getRootElement(),r={};if(r[e]=t,"id"===e){t=Au(rn(n),t);if(t)return void this._addErrorMessage(t);this._clearErrorMessage()}this._modeling.updateProperties(n,r)},Nu.prototype._setup=function(t,n){var r=this;t.setAttribute("contenteditable",!0),t.addEventListener("input",I(function(e){e=e.target.value||e.target.textContent;r.update(n,e.trim())},300)),t.addEventListener("keydown",function(e){13===e.keyCode&&(t.blur(),window.getSelection().removeAllRanges())}),t.addEventListener("blur",function(){r._clearErrorMessage(),r._definitionPropertiesView.update()})},Nu.prototype._addErrorMessage=function(e){var t=''+e+"",e=Dt(".dmn-definitions-id",this._container);this._clearErrorMessage(),mt(e).add("dmn-definitions-error"),e.parentElement.appendChild(kt(t))},Nu.prototype._clearErrorMessage=function(){var e,t=Dt(".dmn-definitions-id",this._container);mt(t).has("dmn-definitions-error")&&(mt(t).remove("dmn-definitions-error"),e=Dt(".dmn-definitions-error-message",this._container),t.parentNode.removeChild(e))};var ai={__depends__:[Ni],__init__:["definitionPropertiesEdit","definitionPropertiesPaletteAdapter"],definitionPropertiesEdit:["type",Nu],definitionPropertiesPaletteAdapter:["type",Ai]},Lu={horizontal:["x","width"],vertical:["y","height"]};function $u(e,n){this._modeling=e,this._filters=[],this.registerFilter(function(e){var t=n.allowed("elements.distribute",{elements:e});return y(t)?t:t?e:[]})}$u.$inject=["modeling","rules"],$u.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},$u.prototype.trigger=function(e,t){var n,r=this._modeling;if(!(e.length<3||(this._setOrientation(t),n=this._filterElements(e),(n=this._createGroups(n)).length<=2)))return r.distributeElements(n,this._axis,this._dimension),n},$u.prototype._filterElements=function(e){var t=this._filters,n=this._axis,r=this._dimension,o=[].concat(e);return t.length?(x(t,function(e){o=e(o,n,r)}),o):e},$u.prototype._createGroups=function(e){var o=[],i=this,a=this._axis,c=this._dimension;if(!a)throw new Error('must have a defined "axis" and "dimension"');return x(T(e,a),function(e,t){var n=i._findRange(e,a,c),r=o[o.length-1];r&&i._hasIntersection(r.range,n)?o[o.length-1].elements.push(e):o.push({range:n,elements:[e]})}),o},$u.prototype._setOrientation=function(e){e=Lu[e];this._axis=e[0],this._dimension=e[1]},$u.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)},$u.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};zi={__init__:["distributeElements"],distributeElements:["type",$u]};function Vu(e){e.registerFilter(function(e){return w(e,function(e){var t=on(e,["dmn:AuthorityRequirement","dmn:InformationRequirement","dmn:KnowledgeRequirement","dmn:Association","dmn:TextAnnotation"]);return!e.labelTarget&&!t})})}Vu.$inject=["distributeElements"];var aa={__depends__:[zi],__init__:["drdDistributeElements"],drdDistributeElements:["type",Vu]},zu="is not a registered action";function Fu(e,t){this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}function Uu(e,t){return new Error(e+" "+t)}Fu.$inject=["eventBus","injector"],Fu.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),r=e.get("modeling",!1),o=e.get("selection",!1),n=e.get("zoomScroll",!1),i=e.get("copyPaste",!1),a=e.get("canvas",!1),c=e.get("rules",!1),u=e.get("keyboardMove",!1),s=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),i&&o&&this.register("copy",function(){var e=o.get();i.copy(e)}),i&&this.register("paste",function(){i.paste()}),n&&this.register("stepZoom",function(e){n.stepZoom(e.value)}),a&&this.register("zoom",function(e){a.zoom(e.value)}),r&&o&&c&&this.register("removeSelection",function(){var e,t,n=o.get();!n.length||!1!==(e=c.allowed("elements.delete",{elements:n}))&&(t=y(e)?e:n).length&&r.removeElements(t.slice())}),u&&this.register("moveCanvas",function(e){u.moveCanvas(e)}),s&&this.register("moveSelection",function(e){s.moveSelection(e.direction,e.accelerated)})},Fu.prototype.trigger=function(e,t){if(!this._actions[e])throw Uu(e,zu);return this._actions[e](t)},Fu.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);x(e,function(e,t){n._registerAction(t,e)})},Fu.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Uu(e,"is already registered");this._actions[e]=t},Fu.prototype.unregister=function(e){if(!this.isRegistered(e))throw Uu(e,zu);this._actions[e]=void 0},Fu.prototype.getActions=function(){return Object.keys(this._actions)},Fu.prototype.isRegistered=function(e){return!!this._actions[e]};da={__init__:["editorActions"],editorActions:["type",Fu]};function Hu(e){e.invoke(Fu,this)}dn(Hu,Fu),Hu.$inject=["injector"],Hu.prototype._registerDefaultActions=function(e){Fu.prototype._registerDefaultActions.call(this,e);var n=e.get("canvas",!1),r=e.get("elementRegistry",!1),o=e.get("selection",!1),t=e.get("lassoTool",!1),i=e.get("handTool",!1),a=e.get("directEditing",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1);n&&r&&o&&this._registerAction("selectElements",function(){var t=n.getRootElement(),e=r.filter(function(e){return e!==t});return o.select(e),e}),o&&c&&this._registerAction("distributeElements",function(e){var t=o.get(),e=e.type;2");this._pushAction(e),t||(this._fire(r,"preExecute",e),i.preExecute&&i.preExecute(o),this._fire(r,"preExecuted",e)),this._atomicDo(function(){n._fire(r,"execute",e),i.execute&&n._markDirty(i.execute(o)),n._executedAction(e,t),n._fire(r,"executed",e)}),t||(this._fire(r,"postExecute",e),i.postExecute&&i.postExecute(o),this._fire(r,"postExecuted",e)),this._popAction(e)},bs.prototype._pushAction=function(e){var t=this._currentExecution,n=t.actions,r=n[0];if(t.atomic)throw new Error("illegal invocation in or phase (action: "+e.command+")");e.id||(e.id=r&&r.id||this._createId()),n.push(e)},bs.prototype._popAction=function(){var e=this._currentExecution,t=e.trigger,n=e.actions,r=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:function(t){t=D(t);for(var n={},e=arguments.length,r=new Array(1");this._handlerMap[e]=t};nu={commandStack:["type",bs]};function _s(n,r,o,t){n.on("element.changed",function(e){var t=e.element;!t.parent&&t!==r.getRootElement()||(e.gfx=o.getGraphics(t)),e.gfx&&n.fire(lr(t)+".changed",e)}),n.on("elements.changed",function(e){e=e.elements;e.forEach(function(e){n.fire("element.changed",{element:e})}),t.updateContainments(e)}),n.on("shape.changed",function(e){t.update("shape",e.element,e.gfx)}),n.on("connection.changed",function(e){t.update("connection",e.element,e.gfx)})}_s.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var uu={__init__:["changeSupport"],changeSupport:["type",_s]},ws=Math.min,xs=Math.max;function Os(e){e.preventDefault()}function js(e){e.stopPropagation()}function Es(e){this.container=e.container,this.parent=kt('
'),this.content=Dt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=A(this.autoResize,this),this.handlePaste=A(this.handlePaste,this)}function Cs(e,t){this._eventBus=e,this._providers=[],this._textbox=new Es({container:t.getContainer(),keyHandler:A(this._handleKey,this),resizeHandler:A(this._handleResize,this)})}Es.prototype.create=function(e,t,n,r){var o=this.parent,i=this.content,a=this.container;r=this.options=r||{};var c=$(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);L(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);c=$(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return L(i.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},c),r.centerVertically&&L(i.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},c),i.innerText=n,Ct.bind(i,"keydown",this.keyHandler),Ct.bind(i,"mousedown",js),Ct.bind(i,"paste",this.handlePaste),r.autoResize&&Ct.bind(i,"input",this.autoResize),r.resizable&&this.resizable(t),a.appendChild(o),this.setSelection(i.lastChild,i.lastChild&&i.lastChild.length),o},Es.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault(),e=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),this.insertText(e),!t.autoResize||(n=this.autoResize(n))&&this.resizeHandler(n)},Es.prototype.insertText=function(e){e=e.replace(/\r\n|\r|\n/g,"\n"),document.execCommand("insertText",!1,e)||this._insertTextIE(e)},Es.prototype._insertTextIE=function(n){var e,t,r,o,i=this.getSelection(),a=i.startContainer,c=i.endContainer,u=i.startOffset,s=i.endOffset,l=i.commonAncestorContainer,i=(i=l.childNodes,[].slice.call(i)),p=l.nodeType===Node.TEXT_NODE?(t=a.textContent,a.textContent=t.substring(0,u)+n+t.substring(s),e=a,u+n.length):a===this.content&&c===this.content?(t=document.createTextNode(n),this.content.insertBefore(t,i[u]),(e=t).textContent.length):(r=i.indexOf(a),o=i.indexOf(c),i.forEach(function(e,t){t===r?e.textContent=a.textContent.substring(0,u)+n+c.textContent.substring(s):re.offsetHeight||t.scrollHeight
'),n=function(e){Os(e),js(e);var t=ws(xs(i+e.clientX-r,s),p),n=ws(xs(a+e.clientY-o,l),f);u.style.width=t+"px",u.style.height=n+"px",c.resizeHandler({width:i,height:a,dx:e.clientX-r,dy:e.clientY-o})},t=function e(t){Os(t),js(t),Ct.unbind(document,"mousemove",n,!1),Ct.unbind(document,"mouseup",e,!1)},Ct.bind(e,"mousedown",function(e){Os(e),js(e),r=e.clientX,o=e.clientY;e=u.getBoundingClientRect();i=e.width,a=e.height,Ct.bind(document,"mousemove",n),Ct.bind(document,"mouseup",t)})),L(e.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"}),u.appendChild(e)},Es.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ct.unbind(t,"keydown",this.keyHandler),Ct.unbind(t,"mousedown",js),Ct.unbind(t,"input",this.autoResize),Ct.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),Bt(n)),Bt(e)},Es.prototype.getValue=function(){return this.content.innerText.trim()},Es.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Es.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));t=window.getSelection();t.removeAllRanges(),t.addRange(n)},Cs.$inject=["eventBus","canvas"],Cs.prototype.registerProvider=function(e){this._providers.push(e)},Cs.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},Cs.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Cs.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Cs.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},Cs.prototype.complete=function(){var e,t,n,r=this._active;r&&(e=r.context.bounds,t=this.$textbox.getBoundingClientRect(),(n=this.getValue())===r.context.text&&t.height===e.height&&t.width===e.width||(e=this._textbox.container.getBoundingClientRect(),r.provider.update(r.element,n,r.context.text,{x:t.left-e.left,y:t.top-e.top,width:t.width,height:t.height})),this._fire("complete"),this.close())},Cs.prototype.getValue=function(){return this._textbox.getValue()},Cs.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())},Cs.prototype._handleResize=function(e){this._fire("resize",e)},Cs.prototype.activate=function(t){var n;this.isActive()&&this.cancel();var e=b(this._providers,function(e){return(n=e.activate(t))?e:null});return n&&(this.$textbox=this._textbox.create(n.bounds,n.style,n.text,n.options),this._active={element:t,context:n,provider:e},n.options&&n.options.resizable&&(this.resizable=!0),this._fire("activate")),!!n};_o={__depends__:[bi],__init__:["directEditing"],directEditing:["type",Cs]};function Ss(e){return en(e,"dmn:Decision")||en(e,"dmn:BusinessKnowledgeModel")||en(e,"dmn:InputData")||en(e,"dmn:KnowledgeSource")?"name":en(e,"dmn:TextAnnotation")?"text":void 0}function Ps(e){var t=e.businessObject,e=Ss(t);if(e)return t[e]||""}function ks(e,t,n,r,o){this._canvas=e,this._modeling=r,this._textRenderer=o,t.registerProvider(this),n.on("element.dblclick",function(e){t.activate(e.element)}),n.on(["autoPlace.start","canvas.viewbox.changing","drag.init","drillDown.click","element.mousedown","popupMenu.open","selection.changed"],function(){t.complete()}),n.on(["commandStack.changed"],function(){t.cancel()}),n.on("create.end",500,function(e){e=e.shape;(en(e,"dmn:Decision")||en(e,"dmn:InputData")||en(e,"dmn:BusinessKnowledgeModel")||en(e,"dmn:KnowledgeSource")||en(e,"dmn:TextAnnotation"))&&t.activate(e)}),n.on("autoPlace.end",500,function(e){t.activate(e.shape)})}ks.$inject=["canvas","directEditing","eventBus","modeling","textRenderer"],ks.prototype.activate=function(e){var t=Ps(e);if(f(t)){var n={text:t};L(n,this.getEditingBBox(e));t={};return en(e,"dmn:DRGElement")&&L(t,{centerVertically:!0}),en(e,"dmn:TextAnnotation")&&L(t,{resizable:!0}),L(n,{options:t}),n}},ks.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,r=t.getAbsoluteBBox(n),o={x:r.x,y:r.y},i=t.zoom(),a=this._textRenderer.getDefaultStyle(),n=a.fontSize*i,t=a.lineHeight,a={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};return en(e,"dmn:DRGElement")&&(L(o,{width:r.width,height:r.height}),L(a,{fontSize:n+"px",lineHeight:t,paddingTop:7*i+"px",paddingBottom:7*i+"px",paddingLeft:5*i+"px",paddingRight:5*i+"px"})),en(e,"dmn:TextAnnotation")&&(L(o,{width:r.width,height:r.height,minWidth:30*i,minHeight:10*i}),L(a,{textAlign:"left",paddingTop:5*i+"px",paddingBottom:7*i+"px",paddingLeft:7*i+"px",paddingRight:5*i+"px",fontSize:n+"px",lineHeight:t})),{bounds:o,style:a}},ks.prototype.update=function(e,t,n,r){var o;en(e,"dmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),o={x:e.x,y:e.y,width:e.width/o.width*r.width,height:e.height/o.height*r.height}),(r=t)&&r.trim()||(t=null),this._modeling.updateLabel(e,t,o)};zi={__depends__:[nu,uu,_o],__init__:["labelEditingProvider"],labelEditingProvider:["type",ks]};function Rs(o,e){e.invoke(ts,this),this.preExecute("connection.create",function(e){var t=e.connection,n=t.businessObject,r=e.source,e=e.target;en(t,"dmn:Association")?(((n.sourceRef=o.create("dmn:DMNElementReference",{href:"#"+r.id})).$parent=n).targetRef=o.create("dmn:DMNElementReference",{href:"#"+e.id})).$parent=n:(n["required"+(en(e=r,"dmn:BusinessKnowledgeModel")?"Knowledge":en(e,"dmn:Decision")?"Decision":en(e,"dmn:InputData")?"Input":en(e,"dmn:KnowledgeSource")?"Authority":void 0)]=o.create("dmn:DMNElementReference",{href:"#"+r.id})).$parent=n},!0)}Rs.$inject=["drdFactory","injector"],dn(Rs,ts);function Ts(e,u,s,o){function i(n,e,t){e=e||n.incoming.filter(function(e){return en(e,"dmn:InformationRequirement")});var r,o,i={};t?i[t]=e:(r=n,o={},e.forEach(function(e){var t=ao(e.source,r).split("-").shift();o[t]||(o[t]=[]),o[t].push(e)}),i=o),x(i,function(e,t){e=function(e,t){var n;n=t.includes("top")||t.includes("bottom")?"x":"y";return e.sort(function(e,t){return io(e.source)[n]-io(t.source)[n]})}(e,t);var i,a,c,r=(a=n,c=t,(i=e).map(function(e,t){var n=e.source,r=io(n),o=no(n),e=no(a),n=i.length;return c.includes("bottom")?{start:{x:r.x,y:o.top},end:{x:e.left+a.width/(n+1)*(t+1),y:e.bottom}}:c.includes("top")?{start:{x:r.x,y:o.bottom},end:{x:e.left+a.width/(n+1)*(t+1),y:e.top}}:c.includes("right")?{start:{x:o.left,y:r.y},end:{x:e.right,y:e.top+a.height/(n+1)*(t+1)}}:{start:{x:o.right,y:r.y},end:{x:e.left,y:e.top+a.height/(n+1)*(t+1)}}}));e.forEach(function(e,t){var n=r[t].start,t=r[t].end,t=u.layoutConnection(e,{connectionStart:n,connectionEnd:t});s.updateWaypoints(e,t)})})}e.invoke(ts,this),this.preExecute(["connection.create","connection.reconnect"],function(e){var t=e.connection,n=e.newSource||e.source,r=e.newTarget||e.target;en(t,"dmn:InformationRequirement")&&!o.allowed("connection.connect",{connection:t,source:n,target:r})||en(t,"dmn:InformationRequirement")&&(t=ao(n,r),e.hints||(e.hints={}),L(e.hints,function(e,t,n){var r=io(e),o=io(t);n.includes("bottom")?(r.y=e.y,o.y=t.y+t.height):n.includes("top")?(r.y=e.y+e.height,o.y=t.y):n.includes("right")?(r.x=e.x,o.x=t.x+t.width):(r.x=e.x+e.width,o.x=t.x);return{connectionStart:r,connectionEnd:o}}(n,r,t)))},!0),this.postExecuted(["connection.create","connection.delete","connection.reconnect"],function(e){var n,t=e.connection,r=t.source||e.source,e=t.target||e.target;en(t,"dmn:InformationRequirement")&&(n=ao(r,e),(r=e.incoming.filter(function(e){var t=ao(e.source,e.target);return en(e,"dmn:InformationRequirement")&&Ds(t,n)})).length&&i(e,r,n))},!0),this.preExecute("connection.reconnect",function(e){var n,r=e.connection,t=r.source,e=r.target;en(r,"dmn:InformationRequirement")&&(n=ao(t,e),(t=e.incoming.filter(function(e){var t=ao(e.source,e.target);return e!==r&&en(e,"dmn:InformationRequirement")&&Ds(t,n)})).length&&i(e,t,n))},!0),this.postExecuted("elements.move",500,function(e){var t=e.shapes,n=e.closure.enclosedConnections;t.forEach(function(e){var t;on(e,["dmn:Decision","dmn:InputData"])&&((t=e.incoming.filter(function(e){return en(e,"dmn:InformationRequirement")&&!n[e.id]})).length&&i(e,t),e.outgoing.forEach(function(e){en(e,"dmn:InformationRequirement")&&!n[e.id]&&i(e.target)}))})},!0)}function Ds(e,t){return e&&t&&e.split("-").shift()===t.split("-").shift()}function Ms(e,a,c){e.invoke(ts,this),this.preExecute("connection.reconnect",function(e){var t=e.connection,n=e.newSource||t.source,r=e.newTarget||t.target,o=t.waypoints.slice(),i=c.allowed("connection.reconnect",{connection:t,source:n,target:r});i&&i.type!==t.type&&(e.connection=a.connect(n,r,{type:i.type,waypoints:o}),a.removeConnection(t))},!0)}function Bs(e,n,r){ts.call(this,e),this._modeling=n,this.postExecuted(["shape.replace"],1500,function(e){var t=e.context,e=t.oldShape,t=t.newShape;n.unclaimId(e.businessObject.id,e.businessObject),n.updateProperties(t,{id:e.id}),r.select(t)})}function Is(e){return(Is="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function As(e,t){for(var n=0;nt:/n|w/.test(n)&&e[r]
'),"data-group",n),a.appendChild(r));var o,i,n=e.html||(e.separator?'
':'
'),n=kt(n);r.appendChild(n),e.separator||(pt(n,"data-action",t),e.title&&pt(n,"title",e.title),e.className&&(o=e.className,i=mt(n),(y(o)?o:o.split(/\s+/g)).forEach(function(e){i.add(e)})),e.imageUrl&&(pt(o=kt(""),"src",e.imageUrl),n.appendChild(o)))}),this.open()},dp.prototype.trigger=function(e,t,n){var r=this._entries,o=t.delegateTarget||t.target;if(!o)return t.preventDefault();(r=r[pt(o,"data-action")])&&(o=r.action,r=t.originalEvent||t,m(o)?"click"===e&&o(r,n):o[e]&&o[e](r,n),t.preventDefault())},dp.prototype._layoutChanged=function(){this._toggleState({})},dp.prototype._needsCollapse=function(e,t){return e<50+46*Object.keys(t).length},dp.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},dp.prototype.open=function(){this._toggleState({open:!0})},dp.prototype.toggle=function(e){this.isOpen()?this.close():this.open()},dp.prototype.isActiveTool=function(e){return e&&this._activeTool===e},dp.prototype.updateToolHighlight=function(n){var e;this._toolsContainer||(e=Dt(".djs-palette-entries",this._container),this._toolsContainer=Dt("[data-group=tools]",e)),x(this._toolsContainer.children,function(e){var t=e.getAttribute("data-action");t&&(e=mt(e),t=t.replace("-tool",""),e.contains("entry")&&t===n?e.add("highlighted-entry"):e.remove("highlighted-entry"))})},dp.prototype.isOpen=function(){return mt(this._container).has(pp)},dp.prototype._getParentContainer=function(){return this._canvas.getContainer()},dp.HTML_MARKUP='
';uu={__init__:["palette"],palette:["type",dp]};function yp(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}yp.$inject=["eventBus","dragging"],yp.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error('A tool has to be registered with it\'s "events"');n.push(e),this.bindEvents(e,t)},yp.prototype.isActive=function(e){return e&&this._active===e},yp.prototype.length=function(e){return this._tools.length},yp.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},yp.prototype.bindEvents=function(t,e){var n=this._eventBus,r=this._dragging,o=[];n.on(e.tool+".init",function(e){return!e.context.reactivate&&this.isActive(t)?(this.setActive(null),void r.cancel()):void this.setActive(t)},this),x(e,function(e){o.push(e+".ended"),o.push(e+".canceled")}),n.on(o,250,function(e){this._active&&!function(e){e=e.originalEvent&&e.originalEvent.target;return e&&xt(e,'.group[data-group="tools"]')}(e)&&this.setActive(null)},this)};bi={__depends__:[oc],__init__:["toolManager"],toolManager:["type",yp]};function mp(e){var t=this;function n(e){t._lastMoveEvent=e}this._lastMoveEvent=null,e.on("canvas.init",function(e){(t._svg=e.svg).addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}mp.$inject=["eventBus"],mp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||function(e,t){var n=document.createEvent("MouseEvent"),r=e,o=t,e=e,t=t;n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,r,o,e,t,!1,!1,!1,!1,0,null);return n}(0,0)};var Si={__init__:["mouse"],mouse:["type",mp]},vp="crosshair";function gp(n,r,e,o,t,i,a){this._selection=t,this._dragging=e,this._mouse=a;var c=this,u=function(e){var t=r.getActiveLayer(),e=e.frame=Un("rect");Rn(e,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Cn(t,e)},s=function(e){var t=e.frame,e=e.bbox;Rn(t,{x:e.x,y:e.y,width:e.width,height:e.height})},l=function(e){e.frame&&Nn(e.frame)};i.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),n.on("lasso.selection.end",function(e){var t=e.originalEvent.target;(e.hover||t instanceof SVGElement)&&n.once("lasso.selection.ended",function(){c.activateLasso(e.originalEvent,!0)})}),n.on("lasso.end",function(e){var t=bp(e),e=o.filter(function(e){return e});c.select(e,t)}),n.on("lasso.start",function(e){var t=e.context;t.bbox=bp(e),u(t)}),n.on("lasso.move",function(e){var t=e.context;t.bbox=bp(e),s(t)}),n.on("lasso.cleanup",function(e){e=e.context;l(e)}),n.on("element.mousedown",1500,function(e){if(yi(e))return c.activateLasso(e.originalEvent),!0})}function bp(e){var t={x:e.x-e.dx,y:e.y-e.dy},e={x:e.x,y:e.y},e=t.x<=e.x&&t.yn.x&&(r[e.id]=e),!h(n.x)&&t.y>n.y&&(r[e.id]=e),t.x>n.x&&t.y>n.y&&(!(h(n.width)&&h(n.height)&&t.width+t.x ");return a.length=0,new Error(t?e+" (Resolving: "+t+")":e)},r=function e(t,n){if(!f[t]&&-1!==t.indexOf(".")){for(var r=t.split("."),o=e(r.shift());r.length;)o=o[r.shift()];return o}if(Qp(c,t))return c[t];if(Qp(f,t)){if(-1!==a.indexOf(t))throw a.push(t),u("Cannot resolve circular dependency!");return a.push(t),c[t]=f[t][0](f[t][1]),a.pop(),c[t]}return i.get(t,n)},o=function(e,t){if(void 0===t&&(t={}),"function"!=typeof e){if(!Zp(e))throw new Error('Cannot invoke "'+e+'". Expected a function!');e=Jp(e.slice())}return{fn:e,dependencies:(e.$inject||rf(e)).map(function(e){return Qp(t,e)?t[e]:r(e)})}},h=function(t){return Jp(function(e){return t.get(e)})},s={factory:n,type:t,value:function(e){return e}};e.forEach(function(r){function o(e,t){return t="value"!==e&&Zp(t)?Jp(t.slice()):t}var e,t,n;r instanceof function(){var n=[];this.factory=function(e,t){return n.push([e,"factory",t]),this},this.value=function(e,t){return n.push([e,"value",t]),this},this.type=function(e,t){return n.push([e,"type",t]),this},this.forEach=function(e){n.forEach(e)}}?r.forEach(function(e){var t=e[0],n=e[1],e=e[2];f[t]=[s[n],o(n,e),n]}):"object"===Ve(r)&&(r.__exports__?(e=Object.keys(r).reduce(function(e,t){return"__"!==t.substring(0,2)&&(e[t]=r[t]),e},Object.create(null)),t=new of((r.__modules__||[]).concat([e]),d),n=Jp(function(e){return t.get(e)}),r.__exports__.forEach(function(e){f[e]=[n,e,"private",t]})):Object.keys(r).forEach(function(e){var t,n;"private"!==r[e][2]?(t=r[e][0],n=r[e][1],f[e]=[s[t],o(t,n),t]):f[e]=r[e]}))}),this.get=r,this.invoke=n,this.instantiate=t,this.createChild=function(e,t){if(t&&t.length){var n,r,o,i,a,c=Object.create(null),u=Object.create(null),s=[],l=[],p=[];for(a in f)n=f[a],-1!==t.indexOf(a)&&("private"===n[2]?-1===(r=s.indexOf(n[3]))?(o=n[3].createChild([],t),i=h(o),s.push(n[3]),l.push(o),p.push(i),c[a]=[i,a,"private",o]):c[a]=[p[r],a,"private",l[r]]:c[a]=[n[2],n[1]],u[a]=!0),"factory"!==n[2]&&"type"!==n[2]||!n[1].$scope||t.forEach(function(e){-1!==n[1].$scope.indexOf(e)&&(c[a]=[n[2],n[1]],u[e]=!0)});t.forEach(function(e){if(!u[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')}),e.unshift(c)}return new of(e,d)}}function af(e){return(af="function"==typeof Symbol&&"symbol"===Ve(Symbol.iterator)?function(e){return Ve(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":Ve(e)})(e)}function cf(e,t){return!t||"object"!==af(t)&&"function"!=typeof t?sf(e):t}function uf(e){return(uf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function sf(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function lf(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&pf(e,t)}function pf(e,t){return(pf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ff(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function df(e){ff(this,df),L(this,e),gf(this,"businessObject",{writable:!0})}var ju=function(){function t(e){return ff(this,t),gf(sf(e=cf(this,uf(t).call(this,e))),"rows",{enumerable:!0,value:e.rows||[]}),gf(sf(e),"cols",{enumerable:!0,value:e.cols||[]}),e}return lf(t,df),t}(),hf=function(){function t(e){return ff(this,t),gf(sf(e=cf(this,uf(t).call(this,e))),"root",{writable:!0}),gf(sf(e),"cells",{enumerable:!0,value:e.cells||[]}),e}return lf(t,df),t}(),yf=function(){function t(e){return ff(this,t),gf(sf(e=cf(this,uf(t).call(this,e))),"root",{writable:!0}),gf(sf(e),"cells",{enumerable:!0,value:e.cells||[]}),e}return lf(t,df),t}(),mf=function(){function t(e){return ff(this,t),gf(sf(e=cf(this,uf(t).call(this,e))),"row",{writable:!0}),gf(sf(e),"col",{writable:!0}),e}return lf(t,df),t}(),vf={root:ju,row:hf,col:yf,cell:mf};function gf(e,t,n){Object.defineProperty(e,t,n)}function bf(e,t){for(var n=0;n> "+(Sf(e)?"Array("+(3":16&t?"Text("+e.children+")":1024&t?"Portal*":"<"+((e=e.type).name||e.displayName||e.constructor.name||(e.toString().match(/^function\s*([^\s(]+)/)||[])[1])+" />")+"\n"}function Vf(e){var t;1&e.childFlags||(64&e.flags&&Af("input elements can't have children."),128&e.flags&&Af("textarea elements can't have children."),481&e.flags&&(t=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],"media"===(e=e.type.toLowerCase())&&Af("media elements can't have children."),-1!==(e=t.indexOf(e))&&Af(t[e]+" elements can't have children.")))}function zf(e){var t;!1===e.isValidated&&e.children&&481&e.flags&&((t=function e(t,n){for(var r={},o=0,i=t.length;o";var t=e.id?' id="'.concat(e.id,'"'):"";return"<".concat(e.$type).concat(t," />")}function wh(i,e){function a(e,t,n){if(e.gfx)throw new Error("already rendered ".concat(_h(e)));return i.element(e,t,n)}function c(e,t,n){x(e,function(e){a(e,t,n)})}function u(e,t,n){x(e,function(e){a(e,t,n)})}return{handleDecision:function(e){e.id||(e.id="decision");var t=e.decisionLogic;if(!t)throw new Error("no table for ".concat(_h(e)));if(!t.output)throw new Error("missing output for ".concat(_h(t)));var n,r,o=i.table(t);t.input&&c(t.input,o,t),c(t.output,o,t),e=t.rule,n=o,r=t,x(e,function(e){a(e,n,r),u(e.inputEntry,e),u(e.outputEntry,e)})}}}function xh(e,t,n){var r,o=e.get("tableImporter"),i=e.get("eventBus"),a=e.get("sheet"),c=(e.get("modeling",!1),[]);i.fire("import.render.start",{decision:t});try{new wh({create:function(e,t,n,r){return o.create(e,t,n,r)},table:function(e){return o.add(e)},element:function(e,t,n){return o.add(e,t,n)},error:function(e,t){c.push({message:e,context:t})}}).handleDecision(t)}catch(e){r=e}i.fire("import.render.complete",{error:r,warnings:c}),i.fire("elements.changed",{elements:[a.getRoot()]}),n(r,c)}function Oh(e){return(Oh="function"==typeof Symbol&&"symbol"===Ve(Symbol.iterator)?function(e){return Ve(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":Ve(e)})(e)}function jh(t,e){var n=Object.keys(t);return Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(t)),n=e?n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}):n}function Eh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ch(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t: cannot combine with non-fn component value"));r[e]=function(o){for(var e=arguments.length,i=new Array(1e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n')}}],(t=[{key:"open",value:function(e){var o=this;return new Promise(function(n,r){var t;try{return o._decision&&o.clear(),o._decision=e,xh(o,e,function(e,t){e?(e.warnings=t||[],r(e)):n({warnings:t||[]})})}catch(e){t=e}t?(t.warnings=t.warnings||[],r(t)):n({warnings:[]})})}},{key:"_init",value:function(e){var t=e.modules,n=e.additionalModules,r=uv(e,iv),e=t||this.getModules(),t=n||[],n=[{decisionTable:["value",this]}];return{modules:[rv].concat(av(e),av(t),n),config:r}}},{key:"on",value:function(e,t,n,r){return this.get("eventBus").on(e,t,n,r)}},{key:"off",value:function(e,t){this.get("eventBus").off(e,t)}},{key:"_emit",value:function(e,t){return this.get("eventBus").fire(e,t)}},{key:"attachTo",value:function(e){if(!e)throw new Error("parentNode required");this.detach();var t=this._container;e.appendChild(t),this._emit("attach",{})}},{key:"detach",value:function(){var e=this._container;e.parentNode&&(this._emit("detach",{}),Bt(e))}},{key:"destroy",value:function(){lv(dv(o.prototype),"destroy",this).call(this),this.detach()}},{key:"getModules",value:function(){return o._getModules()}}])&&sv(e.prototype,t),n&&sv(e,n),Object.defineProperty(e,"prototype",{writable:!1}),o}();function yv(e){return(yv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function mv(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n");r=parseInt(r,10);if(isNaN(r))return e;return{row:n,col:"left"===t?r-1:r+1}}(t,e),e=(e=i,t="".concat((t=t).row,":").concat(t.col),Dt('[data-coords="'.concat(xc(t),'"]'),e));if(!e)return!1;e=Kv(e);return e&&u(e,{focussed:!0,selected:!0}),!0}},n.on("contextMenu.close",function(){if(a)return u(a)})}Jv.$inject=["config.renderer","eventBus","sheet","selection","elementRegistry"];var eg={__depends__:[kv,Cv],__init__:["cellSelection"],cellSelection:["type",Jv]};function tg(){}tg.prototype.get=function(){return this._data},tg.prototype.set=function(e){this._data=e},tg.prototype.clear=function(){var e=this._data;return delete this._data,e},tg.prototype.isEmpty=function(){return!this._data};zi={clipboard:["type",tg]};function ng(e){return(ng="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function rg(e,t){for(var n=0;n=e.length}),this.addRule("col.remove",2e3,function(e){var t=e.col,e=r._sheet.getRoot().cols;return!nn(t)||1e.length)&&(t=e.length);for(var n=0,r=new Array(t);n]/,Ig=function(e){var t,n=""+e,e=Bg.exec(n);if(!e)return n;var r="",o=0,i=0;for(o=e.index;oe.length?(r=t,e):(r=e,t);for(;ce.length?{newStart:n.l_start,newEnd:n.l_end,type:"add"}:{newStart:n.s_start,newEnd:n.s_end,type:t.length")+"
";return Hf(1,"div",this.getClassName(),null,1,{contentEditable:"true",spellcheck:"false","data-placeholder":e||"",onInput:this.onInput,onKeypress:this.onKeypress,onPaste:this.onPaste,onFocus:this.onFocus,onBlur:this.onBlur,onKeydown:this.onKeydown,dangerouslySetInnerHTML:{__html:n}},null,function(e){return t.node=e})}}])&&$g(e.prototype,t),n&&$g(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function qg(e){return e.innerText.replace(/\n$/,"")}function Gg(e){return(Gg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Kg(e,t){for(var n=0;ni.height?(this.node.classList.add("horizontal"),this.node.classList.remove("vertical")):(this.node.classList.add("vertical"),this.node.classList.remove("horizontal"));var a,c,u,s=function(e){var t=xt(e,".tjs-container");if(!t)return{scrollTop:0,scrollLeft:0};e=t.scrollLeft;return{scrollTop:t.scrollTop,scrollLeft:e}}(r),l=s.scrollLeft,e=s.scrollTop,s={};"left"===((a=t.align?t.align.split("-"):a)&&a[1]||(t.x+t.width/2>i.width/2?"left":"right"))?(c=t.x-i.left-o.width+n.x+l,r.classList.remove("right"),r.classList.add("left")):(c=-i.left+t.x+t.width-n.x+l,r.classList.remove("left"),r.classList.add("right")),c=a?c:kb(c,0+l,i.width-o.width+l),s.left=c+"px","top"===(a&&a[0]||(t.y+t.height/2>i.height/2?"top":"bottom"))?(u=t.y-i.top-o.height+n.y+e,r.classList.remove("bottom"),r.classList.add("top")):(u=-i.top+t.y-n.y+e,r.classList.remove("top"),r.classList.add("bottom")),u=a?u:kb(u,0+e,i.height-o.height+e),s.top=u+"px",s.overflowY="auto",s.maxHeight=i.height-u+e+"px",L(this.node.style,Cb,s)}},{key:"render",value:function(){var e=this.props,n=e.context,t=e.components;return Hf(1,"div",e.className,t.map(function(e,t){return Wf(2,e,{context:n},t)}),0,{onContextMenu:function(e){return e.preventDefault()}},null,this.setNode)}}]),r}();function kb(e,t,n){return Math.max(t,Math.min(n,e))}Pb.$inject=["renderer"];var Rb="\n input[type=text],\n input[type=number],\n input[type=button],\n input[type=submit],\n [contenteditable],\n [tabindex],\n a[href],\n textarea,\n button\n";function Tb(e,t){for(var n=0;n'),this.renderer.getContainer().appendChild(this._portalEl),this._portalEl.addEventListener("mousedown",Sw)}},{key:"removePortalEl",value:function(){this._portalEl&&(this._portalEl.removeEventListener("mousedown",Sw),Bt(this._portalEl),this._portalEl=null)}},{key:"focusInput",value:function(){var e=this.inputNode;e.focus(),"selectionStart"in e&&(e.selectionStart=1e5)}},{key:"checkClose",value:function(e){!this._portalEl||this._portalEl.contains(e)||this.parentNode.contains(e)||this.setOptionsVisible(!1)}},{key:"select",value:function(e){var t,n=this.props.options,r=this.state.value;n&&(t=(t=n.filter(function(e){return e.value===r})[0])?n.indexOf(t):-1,e=n[(e=-1===t?1===e?0:n.length-1:(t+e)%n.length)<0?n.length+e:e],this.onChange(e.value))}},{key:"setOptionsVisible",value:function(e){this.setState({optionsVisible:e})}},{key:"renderOptions",value:function(e,n){var r=this;return Hf(1,"div","options",e.map(function(t){return Hf(1,"div",["option",n===t?"active":""].join(" "),t.label,0,{"data-value":t.value,onClick:function(e){return r.onOptionClick(t.value,e)}})}),0)}},{key:"render",value:function(){var t=this,e=this.props,n=e.className,r=e.options,o=e.noInput,i=e.title,a=this.state,c=a.optionsVisible,u=a.value,e=!!r&&r.filter(function(e){return e.value===u})[0],a=e?e.label:u;return Hf(1,"div",[n||"","dms-input-select"].join(" "),[o?Hf(1,"div","dms-input",a,0,{tabindex:"0",onKeyDown:this.onKeyDown},null,function(e){return t.inputNode=e}):Hf(64,"input","dms-input",null,1,{onInput:this.onInput,onKeyDown:this.onKeyDown,spellcheck:"false",type:"text",value:u},null,function(e){return t.inputNode=e}),Hf(1,"span",["dms-input-select-icon",c?"dmn-icon-up":"dmn-icon-down"].join(" ")),c&&(e=this.renderOptions(r,e),Hf(1024,this._portalEl,null,e,0,null,Rf(e)?null:e.key,null))],0,{title:i,onClick:this.onInputClick},null,function(e){return t.parentNode=e})}}])&&_w(e.prototype,t),n&&_w(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Sw(e){e.stopPropagation()}function Pw(e){return(Pw="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function kw(e,t){for(var n=0;nr.indexOf(t)&&(t=function(e,t){e=t.indexOf(e);return t[Math.min(t.length-1,e+1)]}(t,r));return n===z0?function(e,t){e=t.indexOf(e);return t[Math.max(0,e-1)]}(t,r):t}(r,t,e,l._sheet.getRoot().rows);return e===r?void 0:e}if(r instanceof yf){n=K0(n,o),o=o.dataset.colId,o=l._elementRegistry.get(o);if(o&&o!==r){n=function(e,t,n,r){r.indexOf(e)>r.indexOf(t)&&(t=function(e,t){var n=t.indexOf(e);if(tn(e)){e=t.filter(tn),e=e[e.length-1],e=t.indexOf(e);return t[Math.min(e,n+1)]}return t[Math.min(t.length-1,n+1)]}(t,r));return n===H0?function(e,t){var n=t.indexOf(e);if(nn(e)){e=t.filter(nn)[0],e=t.indexOf(e);return t[Math.max(e,n-1)]}return t[Math.max(0,n-1)]}(t,r):t}(r,o,n,l._sheet.getRoot().cols);if(n!==r)return n}}}),n.on("dragAndDrop.dragEnd",this._cleanup)}var e,t,n;return e=p,(t=[{key:"startDrag",value:function(e,t){var n,r=this._renderer.getContainer();this._dragImage=kt(''),document.body.appendChild(this._dragImage),t.dataTransfer.setDragImage&&t.dataTransfer.setDragImage(this._dragImage,0,0),e instanceof hf?(n=r,x(Mt("[data-row-id=".concat(e.id,"]"),n),function(e){Y0(e)&&mt(e).add("dragged")})):e instanceof yf&&(r=r,x(Mt("[data-col-id=".concat(e.id,"]"),r),function(e){Y0(e)&&mt(e).add("dragged")})),this._dragAndDrop.startDrag(e,t)}}])&&V0(e.prototype,t),n&&V0(e,n),Object.defineProperty(e,"prototype",{writable:!1}),p}();function W0(e,t,n){e=e.dataset.rowId;e&&x(Mt("[data-row-id=".concat(e,"]"),t),function(e){Y0(e)&&(mt(e).add("dragover"),mt(e).add(n))})}function q0(e,t,n){e=e.dataset.colId;e&&x(Mt("[data-col-id=".concat(e,"]"),t),function(e){Y0(e)&&(mt(e).add("dragover"),mt(e).add(n))})}function G0(e){x(Mt(".dragover",e),function(e){Y0(e)&&(mt(e).remove("dragover"),mt(e).remove("top"),mt(e).remove("right"),mt(e).remove("bottom"),mt(e).remove("left"))})}function K0(e,t){t=t.getBoundingClientRect();return e.clientX");r=n.create(o)}return o1(c1(a.prototype),"create",this).call(this,e,t1({businessObject:r,id:r.id},i))}}])&&r1(e.prototype,t),n&&r1(e,n),Object.defineProperty(e,"prototype",{writable:!1}),a}();function u1(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n: cannot update values"));var o=c.updateProperties(r,t),i=o.changed,o=o.oldProperties;return{changed:[].concat(D1(e.changed),D1(i),[r]),oldProperties:R1(R1({},e.oldProperties),{},T1({},n,o))}}return"id"===n&&a.id!==t&&(u.unclaim(a.id),c._elementRegistry.updateId(a,t),u.claim(t,a)),a.set(n,t),{changed:e.changed,oldProperties:R1(R1({},e.oldProperties),{},T1({},n,r))}},{changed:[],oldProperties:{}})}}])&&B1(e.prototype,t),r&&B1(e,r),Object.defineProperty(e,"prototype",{writable:!1}),n}();function A1(e){return f(e)&&_(e)}function N1(e,t){for(var n=0;ne.width/2?(o.left=-e.left+t.left-n.width+4+i+"px",a.classList.remove("right"),a.classList.add("left")):(o.left=-e.left+t.left+t.width-4+i+"px",a.classList.remove("left"),a.classList.add("right")),t.top+t.height/2>e.height/2?(o.top=-e.top+t.top-n.height+4+r+"px",a.classList.remove("top"),a.classList.add("bottom")):(o.top=-e.top+t.top-4+r+"px",a.classList.remove("bottom"),a.classList.add("top")),L(this.node.style,o))}},{key:"onClick",value:function(){var e,t=this.eventBus;this.state.isDisabled||(e=this.selection.get())&&(t.fire("simpleMode.open",{element:e,node:Xv(e.id,this._container)}),this.hide())}},{key:"render",value:function(){var t=this,e=this.state,n=e.isDisabled,r=e.isVisible,o=e.top,i=e.left,e=["simple-mode-button","no-deselect"];return n&&e.push("disabled"),r?Hf(1,"div",e.join(" "),Hf(1,"span","dmn-icon-edit"),2,{onClick:this.onClick,style:{top:o,left:i},title:n?"Editing not supported for set expression language":"Edit"},null,function(e){return t.node=e}):null}}])&&bO(e.prototype,t),n&&bO(e,n),Object.defineProperty(e,"prototype",{writable:!1}),o}();function EO(e,t){for(var n=0;n)\s*date\("([^"]*)"\)$/,FO=/^date\("([^"]*)"\)$/;function UO(e){if(!$O.test(e.trim()))return"Date must match pattern yyyy-MM-dd."}function HO(e,t){return"exact"===e?'date("'.concat(t[0],'")'):"before"===e?'< date("'.concat(t[0],'")'):"after"===e?'> date("'.concat(t[0],'")'):"between"===e?'[date("'.concat(t[0],'")..date("').concat(t[1],'")]'):void 0}function WO(){var e=new Date;return e.setUTCHours(0,0,0,0),e.toISOString().slice(0,10)}function qO(e){if(!e||""===e.trim())return{type:"exact",date:""};var t=e.match(VO);return t?{type:"between",dates:[t[1],t[2]]}:(t=e.match(zO))?{type:"<"===t[1]?"before":"after",date:t[2]}:(t=e.match(FO))?{type:"exact",date:t[1]}:void 0}function GO(e){return(GO="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function KO(e,t){for(var n=0;n)\s*date and time\("([^"]*)"\)$/,mj=/^date and time\("([^"]*)"\)$/;function vj(e){if(!dj.test(e.trim()))return"Date and time must match pattern yyyy-MM-ddTHH:mm:ss[time zone]."}function gj(e,t){return"exact"===e?'date and time("'.concat(t[0],'")'):"before"===e?'< date and time("'.concat(t[0],'")'):"after"===e?'> date and time("'.concat(t[0],'")'):"between"===e?'[date and time("'.concat(t[0],'")..date and time("').concat(t[1],'")]'):void 0}function bj(){var e=new Date;return e.setUTCHours(0,0,0,0),e.toISOString().replace(".000Z","Z")}function _j(e){if(!e||""===e.trim())return{type:"exact",date:""};var t=e.match(hj);return t?{type:"between",dates:[t[1],t[2]]}:(t=e.match(yj))?{type:"<"===t[1]?"before":"after",date:t[2]}:(t=e.match(mj))?{type:"exact",date:t[1]}:void 0}function wj(e){return(wj="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function xj(e,t){for(var n=0;n]+)>/g,function(e,t){return"$"+n[t]}))}if("function"!=typeof t)return o[Symbol.replace].call(this,e,t);var r=this;return o[Symbol.replace].call(this,e,function(){var e=arguments;return"object"!=zj(e[e.length-1])&&(e=[].slice.call(e)).push(a(e,r)),t.apply(this,e)})},Fj.apply(this,arguments)}function Uj(e,t){return(Uj=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Hj={equals:"=",less:"<",lessEquals:"<=",greater:">",greaterEquals:">="};function Wj(e){if(!e||""===e.trim())return{type:"comparison",values:[]};var t=function(e){var t=Kj(e);if(t)return{type:"comparison",operator:"equals",values:[t]};t=Xj(Fj(/^(=|(:?<|>)=?)[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*duration\("((?:(?!")[\s\S])*)"\)$/,{operator:1,value:3}),e),e=t.operator,t=t.value;if(e&&t)return{type:"comparison",values:[t],operator:function(t){return S(Hj).filter(function(e){return t===Hj[e]})[0]}(e)}}(e);if(t)return t;e=function(e){var t=Xj(Fj(/^([\[\]])duration\("((?:(?!")[\s\S])*)"\)\.\.duration\("((?:(?!")[\s\S])*)"\)([\[\]])$/,{start:1,firstValue:2,secondValue:3,end:4}),e),n=t.start,r=t.end,e=t.firstValue,t=t.secondValue;if(n&&r)return{type:"range",values:[e,t],start:"]"===n?"exclude":"include",end:"["===r?"exclude":"include"}}(e);return e||void 0}function qj(e,t){return("equals"===e?'duration("':"".concat(Hj[e],' duration("')).concat(t,'")')}function Gj(e,t,n,r){r="exclude"===r?"[":"]";return"".concat("exclude"===n?"]":"[",'duration("').concat(e,'")')+'..duration("'.concat(t,'")').concat(r)}function Kj(e){e=/^duration\("([^"]*)"\)$/.exec(e);return e&&e[1]}function Xj(e,t){return(e.exec(t)||{groups:{}}).groups}function Yj(e){return(Yj="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Zj(e,t){for(var n=0;n|=){0,2})\s*(-?(?:[0-9]|\.[0-9])+)$/,SE=/^(\[|\]){1}(-?(?:[0-9]|\.[0-9])+){1,}\.\.(-?(?:[0-9]|\.[0-9])+){1,}(\[|\]){1}$/,PE={equals:"=",less:"<",lessEquals:"<=",greater:">",greaterEquals:">="};function kE(e){if(!e||""===e.trim())return{type:"comparison"};var t,n=e.match(CE),r=e.match(SE);return n?(e=n)[0]&&e[1]&&!e[2]&&!e[3]?{type:"comparison",value:parseFloat(n[1]),operator:"equals"}:(e=n)[0]&&!e[1]&&e[2]&&e[3]?{type:"comparison",value:parseFloat(n[3]),operator:(t=n[2],S(PE).filter(function(e){return t===PE[e]})[0])}:void 0:r?{type:"range",values:[r[2],r[3]].map(function(e){return parseFloat(e)}),start:"]"===r[1]?"exclude":"include",end:"["===r[4]?"exclude":"include"}:void 0}function RE(e,t){return("equals"===e?"":"".concat(PE[e]," ")).concat(t)}function TE(e,t,n,r){r="exclude"===r?"[":"]";return"".concat("exclude"===n?"]":"[").concat(e,"..").concat(t).concat(r)}function DE(e){return(DE="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ME(e,t){for(var n=0;n)\s*time\("([^"]*)"\)$/,_C=/^time\("([^"]*)"\)$/;function wC(e){if(!vC.test(e.trim()))return"Time must match pattern hh:mm:ss[time zone]."}function xC(e,t){return"exact"===e?'time("'.concat(t[0],'")'):"before"===e?'< time("'.concat(t[0],'")'):"after"===e?'> time("'.concat(t[0],'")'):"between"===e?'[time("'.concat(t[0],'")..time("').concat(t[1],'")]'):void 0}function OC(){return(new Date).toISOString().slice(11,-5)+"Z"}function jC(e){if(!e||""===e.trim())return{type:"exact",time:""};var t=e.match(gC);return t?{type:"between",times:[t[1],t[2]]}:(t=e.match(bC))?{type:"<"===t[1]?"before":"after",time:t[2]}:(t=e.match(_C))?{type:"exact",time:t[1]}:void 0}function EC(e){return(EC="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function CC(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n')}}],(t=[{key:"open",value:function(r){var o=this;return new Promise(function(e,t){var n;try{o._decision&&(o.clear(),o.get("eventBus").fire("renderer.unmount")),o._decision=r,o.get("eventBus").fire("import",r),o.get("eventBus").fire("renderer.mount")}catch(e){n=e}n?(n.warnings=n.warnings||[],t(n)):e({warnings:[]})})}},{key:"_init",value:function(e){var t=e.modules,n=e.additionalModules,r=kP(e,CP),e=t||this.getModules(),t=n||[],n=[{viewer:["value",this]}];return{modules:[].concat(SP(e),SP(t),n),config:r}}},{key:"on",value:function(e,t,n,r){return this.get("eventBus").on(e,t,n,r)}},{key:"off",value:function(e,t){this.get("eventBus").off(e,t)}},{key:"_emit",value:function(e,t){return this.get("eventBus").fire(e,t)}},{key:"getDecision",value:function(){return this._decision}},{key:"attachTo",value:function(e){if(!e)throw new Error("parentNode required");this.detach(),e.appendChild(this._container),this._emit("attach",{})}},{key:"detach",value:function(){var e=this._container;e.parentNode&&(this._emit("detach",{}),Bt(e))}},{key:"destroy",value:function(){TP(BP(o.prototype),"destroy",this).call(this),this.detach()}},{key:"getModules",value:function(){return o._getModules()}}])&&RP(e.prototype,t),n&&RP(e,n),Object.defineProperty(e,"prototype",{writable:!1}),o}();function AP(e){return(AP="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function NP(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function LP(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n