/*! dmn-js - dmn-modeler v6.0.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.DmnJS=t()}(this,function(){"use strict";function f(e){return Array.prototype.concat.apply([],e)}var t=Object.prototype.toString,a=Object.prototype.hasOwnProperty;function u(e){return void 0===e}function c(e){return void 0!==e}function y(e){return"[object Array]"===t.call(e)}function _(e){return"[object Object]"===t.call(e)}function l(e){return"[object Number]"===t.call(e)}function p(e){return"[object Function]"===t.call(e)}function d(e){return"[object String]"===t.call(e)}function g(e,n){var t,o;return n=p(t=n)?t:function(e){return e===t},w(e,function(e,t){if(n(e,t))return o=e,!1}),o}function h(e,n){var o=[];return w(e,function(e,t){n(e,t)&&o.push(e)}),o}function w(e,t){if(!u(e)){var n,o,r=y(e)?S:k;for(var i in e){if(n=e,o=i,a.call(n,o))if(!1===t(e[i],r(i)))return}}}function x(e,n,o){return w(e,function(e,t){o=n(o,e,t)}),o}function r(e,o){return x(e,function(e,t,n){return e&&o(t,n)},!0)}function i(e,t){return!!g(e,t)}function v(e,n){var o=[];return w(e,function(e,t){o.push(n(e,t))}),o}function m(e){return e&&Object.keys(e)||[]}function b(e,o){var r=2 or , got "+e);n=r[1],o=r[0]}return{name:e=(o?o+":":"")+n,prefix:o,localName:n}}function W(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function H(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,w(e,P(this.registerPackage,this))}function G(e,t,n){var o=t[n];if(o in e)throw new Error("package with "+n+" <"+o+"> already defined")}function q(e){this.model=e}function K(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function X(e){this.properties=new q(this),this.factory=new n(this,this.properties),this.registry=new H(e,this.properties),this.typeCache={}}W.prototype.build=function(){return A(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},W.prototype.addProperty=function(e,t,n){"boolean"==typeof t&&(n=t,t=void 0),this.addNamedProperty(e,!1!==n);var o=this.properties;void 0!==t?o.splice(t,0,e):o.push(e)},W.prototype.replaceProperty=function(e,t,n){var o=e.ns,r=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)}var s=r.indexOf(e);if(-1===s)throw new Error("property <"+o.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),i[o.name]=i[o.localName]=t},W.prototype.redefineProperty=function(e,t,n){var o=e.ns.prefix,r=t.split("#"),i=z(r[0],o),a=z(r[1],i.prefix).name,s=this.propertiesByName[a];if(!s)throw new Error("refined property <"+a+"> not found");this.replaceProperty(s,e,n),delete e.redefines},W.prototype.addNamedProperty=function(e,t){var n=e.ns,o=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),o[n.name]=o[n.localName]=e},W.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},W.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},W.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},W.prototype.assertNotDefined=function(e,t){var n=e.name,o=this.propertiesByName[n];if(o)throw new Error("property <"+n+"> already defined; override of <"+o.definedBy.ns.name+"#"+o.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},W.prototype.hasProperty=function(e){return this.propertiesByName[e]},W.prototype.addTrait=function(o,r){var e=this.allTypesByName,t=this.allTypes,n=o.name;n in e||(w(o.properties,P(function(e){e=R({},e,{name:e.ns.localName,inherited:r}),Object.defineProperty(e,"definedBy",{value:o});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(o),e[n]=o)},H.prototype.getPackage=function(e){return this.packageMap[e]},H.prototype.getPackages=function(){return this.packages},H.prototype.registerPackage=function(t){t=R({},t);var e=this.packageMap;G(e,t,"prefix"),G(e,t,"uri"),w(t.types,P(function(e){this.registerType(e,t)},this)),e[t.uri]=e[t.prefix]=t,this.packages.push(t)},H.prototype.registerType=function(e,t){var o=z((e=R({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:R(e.meta||{})})).name,t.prefix),n=o.name,r={};w(e.properties,P(function(e){var t=z(e.name,o.prefix),n=t.name;F(e.type)||(e.type=z(e.type,t.prefix).name),R(e,{ns:t,name:n}),r[n]=e},this)),R(e,{ns:o,name:n,propertiesByName:r}),w(e.extends,P(function(e){var t=this.typeMap[e];t.traits=t.traits||[],t.traits.push(n)},this)),this.definePackage(e,t),this.typeMap[n]=e},H.prototype.mapTypes=function(o,r,e){var t=F(o.name)?{name:o.name}:this.typeMap[o.name],i=this;function n(e){return a(e,!0)}function a(e,t){var n=z(e,F(e)?"":o.prefix);i.mapTypes(n,r,t)}if(!t)throw new Error("unknown type <"+o.name+">");w(t.superClass,e?n:a),r(t,!e),w(t.traits,n)},H.prototype.getEffectiveDescriptor=function(e){var t=z(e),n=new W(t);this.mapTypes(t,function(e,t){n.addTrait(e,t)});var o=n.build();return this.definePackage(o,o.allTypes[o.allTypes.length-1].$pkg),o},H.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},q.prototype.set=function(e,t,n){var o=this.model.getPropertyDescriptor(e,t),r=o&&o.name;void 0===n?o?delete e[r]:delete e.$attrs[t]:o?r in e?e[r]=n:K(e,o,n):e.$attrs[t]=n},q.prototype.get=function(e,t){var n=this.model.getPropertyDescriptor(e,t);if(!n)return e.$attrs[t];var o=n.name;return!e[o]&&n.isMany&&K(e,n,[]),e[o]},q.prototype.define=function(e,t,n){Object.defineProperty(e,t,n)},q.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},q.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},X.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},X.prototype.getType=function(e){var t=this.typeCache,n=d(e)?e:e.ns.name,o=t[n];return o||(e=this.registry.getEffectiveDescriptor(n),o=t[n]=this.factory.createType(e)),o},X.prototype.createAny=function(e,t,n){var o=z(e),r={$type:e,$instanceOf:function(e){return e===this.$type}},i={name:e,isGeneric:!0,ns:{prefix:o.prefix,localName:o.localName,uri:t}};return this.properties.defineDescriptor(r,i),this.properties.defineModel(r,this),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),w(n,function(e,t){_(e)&&void 0!==e.value?r[e.name]=e.value:r[t]=e}),r},X.prototype.getPackage=function(e){return this.registry.getPackage(e)},X.prototype.getPackages=function(){return this.registry.getPackages()},X.prototype.getElementDescriptor=function(e){return e.$descriptor},X.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},X.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},X.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Z="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(e,t){return e(t={exports:{}},t.exports),t.exports}var Y=e(function(e,t){var o,n=function(){function o(e,t){for(var n=0;n * @copyright 2018 * @license BSD-3-Clause * @link http://avoidwork.github.io/tiny-stack * @version 1.1.0 */ o=function(){function o(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")} /** * Tiny stack for browser or server * * @author Jason Mulligan * @copyright 2018 * @license BSD-3-Clause * @link http://avoidwork.github.io/tiny-stack * @version 1.1.0 */(this,o);for(var e=arguments.length,t=Array(e),n=0;n",lt:"<",quot:'"'};function oe(e,t,n,o){return o?ee.call(ne,o)?ne[o]:"&"+o+";":Q(t||parseInt(n,16))}function re(e){return 3"}function pe(e){return{get:e,enumerable:!0}}function fe(e){var t,n={};for(t in e)n[t]=e[t];return n}function de(e){return e+"$uri"}function he(){return{line:0,column:0}}function ye(e){throw e}function ve(e){if(!this)return new ve(e);var m,C,E,k,n,S,O,j,P,T=e&&e.proxy,o=ye,R=he,A=!1,D=!1,t=null,M=!1;function B(e){e instanceof Error||(e=ue(e)),o(t=e,R)}function I(e){n&&(e instanceof Error||(e=ue(e)),n(e,R))}this.on=function(e,t){if("function"!=typeof t)throw ue("required args ");switch(e){case"openTag":C=t;break;case"text":m=t;break;case"closeTag":E=t;break;case"error":o=t;break;case"warn":n=t;break;case"cdata":k=t;break;case"attention":j=t;break;case"question":O=t;break;case"comment":S=t;break;default:throw ue("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!==(void 0===e?"undefined":J(e)))throw ue("required args ");var t,n={};for(t in e)n[t]=e[t];return n[ie]=ae,D=!0,P=n,this},this.parse=function(e){if("string"!=typeof e)throw ue("required args ");return t=null,function(a){var e,t,n,o,r,i,s,c,u,g,l=D?[]:null,b=D?function(e){var t,n,o={};for(t in e)o[n=e[t]]=n,o[de(n)]=t;return o}(P):null,p=[],_=0,f=!1,d=!1,h=0,y=0,w="",x=0;function v(){if(null!==g)return g;var e,t,n,o,r,i,a,s,c,u,l,p=D&&b.xmlns,f=D&&A?[]:null,d=x,h=w,y=h.length,v={},m={};e:for(;d already defined");else if(m[s]=!0,D)if(A){if(null!==(r="xmlns"===s?"xmlns":120===s.charCodeAt(0)&&"xmlns:"===s.substr(0,6)?s.substr(6):null)){if(e=re(i),t=de(r),!(a=P[e])){if("xmlns"===r||t in b&&b[t]!==e)for(;a="ns"+_++,void 0!==b[a];);else a=r;P[e]=a}b[r]!==a&&(o||(b=fe(b),o=!0),b[r]=a,"xmlns"===r&&(b[de(a)]=e,p=a),b[t]=e),v[s]=i;continue}f.push(s,i)}else-1!==(u=s.indexOf(":"))?(n=b[s.substring(0,u)])?((s=p===n?s.substr(u+1):n+s.substr(u))===se&&(i=-1!==(u=i.indexOf(":"))?(n=i.substring(0,u),(n=b[n]||n)+i.substring(u)):p+":"+i),v[s]=i):I(le(s.substring(0,u))):v[s]=i;else v[s]=i}if(A)for(d=0,y=f.length;d",h+1)))return B("unclosed tag");if(g={},47===r){if(d=!(f=!1),!p.length)return B("missing open tag");if(t=s=p.pop(),o=h+2+t.length,a.substring(h+2,o)!==t)return B("closing tag mismatch");for(;o");s=s.substr(r+1)}else i=b.xmlns;i&&(s=i+":"+s)}if(f&&(x=o,w=t,C&&(T?C(u,re,d,R):C(s,v,re,d,R),M)))return;if(d){if(E&&(E(T?u:s,re,f,R),M))return;D&&(b=f?e:l.pop())}y+=1}else{if(-1===(y=a.indexOf("?>",h)))return B("unclosed question");if(O&&(O(a.substring(h,y+2),R),M))return;y+=2}else{if(91===(r=a.charCodeAt(h+2))&&"CDATA["===a.substr(h+3,6)){if(-1===(y=a.indexOf("]]>",h)))return B("unclosed cdata");if(k&&(k(a.substring(h+9,y),R),M))return;y+=3;continue}if(45===r&&45===a.charCodeAt(h+3)){if(-1===(y=a.indexOf("--\x3e",h)))return B("unclosed comment");if(S&&(S(a.substring(h+4,y),re,R),M))return;y+=3;continue}if(-1===(y=a.indexOf(">",h+1)))return B("unclosed tag");if(j&&(j(a.substring(h,y+1),re,R),M))return;y+=1}}}(e),R=he,M=!1,t},this.stop=function(){M=!0}}function me(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var ge={xsi:"http://www.w3.org/2001/XMLSchema-instance"},be="xsi:type";function _e(e){return e.xml&&e.xml.serialize}function we(e){return _e(e)===be}function xe(e,t){return me(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function Ce(e){return new Error(e)}function Ee(e){return e.$descriptor}function ke(e){R(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,o=Ee(e).idProperty;if(o&&(t=e.get(o.name))){if(n[t])throw Ce("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function Se(){}function Oe(){}function je(){}function Pe(e,t){this.property=e,this.context=t}function Te(e,t){this.element=t,this.propertyDesc=e}function Re(){}function Ae(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function De(e,t,n){Ae.call(this,e,t,n)}function Me(e,t,n){this.model=e,this.context=n}function Be(e){e instanceof X&&(e={model:e}),R(this,{lax:!1},e)}Se.prototype.handleEnd=function(){},Se.prototype.handleText=function(){},Se.prototype.handleNode=function(){},(Oe.prototype=Object.create(Se.prototype)).handleNode=function(){return this},(je.prototype=Object.create(Se.prototype)).handleText=function(e){this.body=(this.body||"")+e},(Pe.prototype=Object.create(je.prototype)).handleNode=function(e){if(this.element)throw Ce("expected no sub nodes");return this.element=this.createReference(e),this},Pe.prototype.handleEnd=function(){this.element.id=this.body},Pe.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},(Te.prototype=Object.create(je.prototype)).handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=$(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},(Re.prototype=Object.create(je.prototype)).handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t},(Ae.prototype=Object.create(Re.prototype)).addReference=function(e){this.context.addReference(e)},Ae.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ee(t).bodyProperty;n&&void 0!==e&&(e=$(n.type,e),t.set(n.name,e))},Ae.prototype.createElement=function(e){var o,t=e.attributes,n=this.type,r=Ee(n),i=this.context,a=new n({}),s=this.model;return w(t,function(e,t){var n=r.propertiesByName[t];n&&n.isReference?n.isMany?w(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=$(n.type,e):"xmlns"!==t&&(o=z(t,r.ns.prefix),s.getPackage(o.prefix)&&i.addWarning({message:"unknown attribute <"+t+">",element:a,property:t,value:e})),a.set(t,e))}),a},Ae.prototype.getPropertyForNode=function(e){var t,n,o,r,i,a,s,c,u,l,p=z(e.name),f=this.type,d=this.model,h=Ee(f),y=p.name,v=h.propertiesByName[y];if(v)return we(v)&&(t=e.attributes[be])?(o=d,u=z(t),l=o.getPackage(u.prefix),i=l,a=(r=u).name,s=r.localName,t=(c=i.xml&&i.xml.typePrefix)&&0===s.indexOf(c)?r.prefix+":"+s.slice(c.length):a,R({},v,{effectiveType:Ee(n=d.getType(t)).name})):v;var m=d.getPackage(p.prefix);if(m){if(t=xe(p,m),n=d.getType(t),v=g(h.properties,function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)}))return R({},v,{effectiveType:Ee(n).name})}else if(v=g(h.properties,function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type}))return v;throw Ce("unrecognized element <"+p.name+">")},Ae.prototype.toString=function(){return"ElementDescriptor["+Ee(this.type).name+"]"},Ae.prototype.valueHandler=function(e,t){return new Te(e,t)},Ae.prototype.referenceHandler=function(e){return new Pe(e,this.context)},Ae.prototype.handler=function(e){return"Element"===e?new Me(this.model,e,this.context):new Ae(this.model,e,this.context)},Ae.prototype.handleChild=function(e){var t,n,o,r;if(t=this.getPropertyForNode(e),o=this.element,U(n=t.effectiveType||t.type))return this.valueHandler(t,o);var i=(r=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e)).element;return void 0!==i&&(t.isMany?o.get(t.name).push(i):o.set(t.name,i),t.isReference?(R(i,{element:o}),this.context.addReference(i)):i.$parent=o),r},(De.prototype=Object.create(Ae.prototype)).createElement=function(e){var t=e.name,n=z(t),o=this.model,r=this.type,i=o.getPackage(n.prefix),a=i&&xe(n,i)||t;if(!r.hasType(a))throw Ce("unexpected element <"+e.originalName+">");return Ae.prototype.createElement.call(this,e)},(Me.prototype=Object.create(Re.prototype)).createElement=function(e){var t=e.name,n=z(t).prefix,o=e.ns[n+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},Me.prototype.handleChild=function(e){var t=new Me(this.model,"Element",this.context).handleNode(e),n=this.element,o=t.element;return void 0!==o&&((n.$children=n.$children||[]).push(o),o.$parent=n),t},Me.prototype.handleText=function(e){this.body=this.body||""+e},Me.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},Be.prototype.fromXML=function(n,e,o){var r=e.rootHandler;e instanceof Ae?(r=e,e={}):"string"==typeof e?(r=this.handler(e),e={}):"string"==typeof r&&(r=this.handler(r));var t=this.model,a=this.lax,u=new ke(R({},e,{rootHandler:r})),i=new ve({proxy:!0}),s=new Y;function c(e,t,n){var o=t(),r=o.line,i=o.column,a=o.data;"<"===a.charAt(0)&&-1!==a.indexOf(" ")&&(a=a.slice(0,a.indexOf(" "))+">");var s="unparsable content "+(a?a+" ":"")+"detected\n\tline: "+r+"\n\tcolumn: "+i+"\n\tnested error: "+e.message;if(n)return u.addWarning({message:s,error:e}),console.warn("could not parse node"),console.warn(e),!0;throw console.error("could not parse document"),console.error(e),Ce(s)}r.context=u,s.push(r);var l=/^<\?xml /i,p=/ encoding="([^"]+)"/i,f=/^utf-8$/i;var d=t.getPackages().reduce(function(e,t){return e[t.uri]=t.prefix,e},{});i.ns(d).on("openTag",function(e,o,t,n){var r=e.attrs||{},i=Object.keys(r).reduce(function(e,t){var n=o(r[t]);return e[t]=n,e},{});!function(e,t){var n=s.peek();try{s.push(n.handleNode(e))}catch(e){c(e,t,a)&&s.push(new Oe)}}({name:e.name,originalName:e.originalName,attributes:i,ns:e.ns},n)}).on("question",function(e){if(l.test(e)){var t=p.exec(e),n=t&&t[1];n&&!f.test(n)&&u.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}}).on("closeTag",function(){s.pop().handleEnd()}).on("cdata",function(e){s.peek().handleText(e)}).on("text",function(e,t){var n;(n=(n=t(e)).trim())&&s.peek().handleText(n)}).on("error",c).on("warn",function(e,t){return c(e,t,!0)}),setTimeout(function(){var t;try{i.parse(n),function(){var e,t,n=u.elementsById,o=u.references;for(e=0;t=o[e];e++){var r=t.element,i=n[t.id],a=Ee(r).propertiesByName[t.property];if(i||u.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),a.isMany){var s=r.get(a.name),c=s.indexOf(t);-1===c&&(c=s.length),i?s[c]=i:s.splice(c,1)}else r.set(a.name,i)}}()}catch(e){t=e}var e=r.element;t||e||(t=Ce("failed to parse document as <"+r.type.$descriptor.name+">")),o(t,t?void 0:e,u)},0)},Be.prototype.handler=function(e){return new De(this.model,e)};var Ie=/<|>|'|"|&|\n\r|\n/g,Ne=/<|>|&/g;function Ve(t){var n={},o={},r={},i=[],a=[];this.byUri=function(e){return o[e]||t&&t.byUri(e)},this.add=function(e,t){o[e.uri]=e,t?i.push(e):a.push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return n[e||"xmlns"]},this.mapPrefix=function(e,t){n[e||"xmlns"]=t},this.logUsed=function(e){var t=e.uri;r[t]=this.byUri(t)},this.getUsed=function(e){return[].concat(i,a).filter(function(e){return r[e.uri]})}}function Le(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function $e(e){return d(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function Fe(e,t){return t.isGeneric?R({localName:t.ns.localName},e):R({localName:(n=t.ns.localName,o=t.$pkg,me(o)?(r=n).charAt(0).toLowerCase()+r.slice(1):n)},e);var n,o,r}var Ue={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},ze={"<":"lt",">":"gt","&":"amp"};function We(e,t,n){return(e=d(e)?e:""+e).replace(t,function(e){return"&"+n[e]+";"})}function He(e){this.tagName=e}function Ge(){}function qe(e){this.tagName=e}function Ke(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function Xe(e,t){Ke.call(this,e,t)}function Ze(){this.value="",this.write=function(e){this.value+=e}}function Ye(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 Je(r){return r=R({format:!1,preamble:!0},r||{}),{toXML:function(e,t){var n=t||new Ze,o=new Ye(n,r.format);if(r.preamble&&o.append('\n'),(new Ke).build(e).serializeTo(o),!t)return n.value}}}function Qe(e,t){X.call(this,e,t)}He.prototype.build=function(e){return this.element=e,this},He.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"").appendNewLine()},Ge.prototype.serializeValue=Ge.prototype.serializeTo=function(e){e.append(this.escape?We(this.value,Ne,ze):this.value)},Ge.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(Ne)&&(this.escape=!0),this},Le(qe,Ge),qe.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("").appendNewLine()},Ke.prototype.build=function(e){var t,n,o,r=(this.element=e).$descriptor,i=this.propertyDescriptor,a=r.isGeneric;return t=a?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=i?this.nsPropertyTagName(i):this.nsTagName(r),this.tagName=this.addTagName(this.ns),a||(n=h((o=e).$descriptor.properties,function(e){var t=e.name;if(e.isVirtual)return!1;if(!o.hasOwnProperty(t))return!1;var n=o[t];return n!==e.default&&null!==n&&(!e.isMany||n.length)}),this.parseAttributes(h(n,function(e){return e.isAttr})),this.parseContainments(h(n,function(e){return!e.isAttr}))),this.parseGenericAttributes(e,t),this},Ke.prototype.nsTagName=function(e){return Fe(this.logNamespaceUsed(e.ns),e)},Ke.prototype.nsPropertyTagName=function(e){var t,n=this.logNamespaceUsed(e.ns);return t=n,R({localName:e.ns.localName},t)},Ke.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Ke.prototype.nsAttributeName=function(e){var t;if(t=d(e)?z(e):e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:R({localName:t.localName},n)},Ke.prototype.parseGeneric=function(n){var o=this,r=this.body,i=[];return w(n,function(e,t){"$body"===t?r.push((new Ge).build({type:"String"},e)):"$children"===t?w(e,function(e){r.push(new Ke(o).build(e))}):0!==t.indexOf("$")&&o.parseNsAttribute(n,t,e)&&i.push({name:t,value:e})}),i},Ke.prototype.parseNsAttribute=function(e,t,n){var o,r=e.$model,i=z(t);if("xmlns"===i.prefix&&(o={prefix:i.localName,uri:n}),i.prefix||"xmlns"!==i.localName||(o={uri:n}),!o)return{name:t,value:n};if(r&&r.getPackage(n))this.logNamespace(o,!0,!0);else{var a=this.logNamespaceUsed(o,!0);this.getNamespaces().logUsed(a)}},Ke.prototype.parseNsAttributes=function(o,e){var r=this,t=o.$attrs,i=[];return w(t,function(e,t){var n=r.parseNsAttribute(o,t,e);n&&i.push(n)}),i},Ke.prototype.parseGenericAttributes=function(n,e){var o=this;w(e,function(t){if(t.name!==be)try{o.addAttribute(o.nsAttributeName(t.name),t.value)}catch(e){console.warn("missing namespace information for ",t.name,"=",t.value,"on",n,e)}})},Ke.prototype.parseContainments=function(e){var i=this,a=this.body,s=this.element;w(e,function(n){var e=s.get(n.name),t=n.isReference;if(n.isMany||(e=[e]),n.isBody)a.push((new Ge).build(n,e[0]));else if(U(n.type))w(e,function(e){a.push(new qe(i.addTagName(i.nsPropertyTagName(n))).build(n,e))});else if(t)w(e,function(e){a.push(new He(i.addTagName(i.nsPropertyTagName(n))).build(e))});else{var o=we(n),r="property"===_e(n);w(e,function(e){var t;t=o?new Xe(i,n):r?new Ke(i,n):new Ke(i),a.push(t.build(e))})}})},Ke.prototype.getNamespaces=function(e){var t,n=this.namespaces,o=this.parent;return n||(t=o&&o.getNamespaces(),e||!t?this.namespaces=n=new Ve(t):n=t),n},Ke.prototype.logNamespace=function(e,t,n){var o=this.getNamespaces(n),r=e.uri,i=e.prefix;return o.byUri(r)||o.add(e,t),o.mapPrefix(i,r),e},Ke.prototype.logNamespaceUsed=function(e,t){var n,o,r,i=this.element.$model,a=this.getNamespaces(t),s=e.prefix,c=e.uri;if(!s&&!c)return{localName:e.localName};if(r=ge[s]||i&&(i.getPackage(s)||{}).uri,!(c=c||r||a.uriByPrefix(s)))throw new Error("no namespace uri given for prefix <"+s+">");if(!(e=a.byUri(c))){for(n=s,o=1;a.uriByPrefix(n);)n=s+"_"+o++;e=this.logNamespace({prefix:n,uri:c},r===c)}return s&&a.mapPrefix(s,c),e},Ke.prototype.parseAttributes=function(e){var o=this,r=this.element;w(e,function(e){var t=r.get(e.name);if(e.isReference)if(e.isMany){var n=[];w(t,function(e){n.push(e.id)}),t=n.join(" ")}else t=t.id;o.addAttribute(o.nsAttributeName(e),t)})},Ke.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),$e(e)},Ke.prototype.addAttribute=function(e,t){var n=this.attrs;d(t)&&(t=We(t,Ie,Ue)),n.push({name:e,value:t})},Ke.prototype.serializeAttributes=function(t){var e,n=this.attrs,o=this.namespaces;o&&(n=(e=o,v(e.getUsed(),function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}})).concat(n)),w(n,function(e){t.append(" ").append($e(e.name)).append('="').append(e.value).append('"')})},Ke.prototype.serializeTo=function(t){var e=this.body[0],n=e&&e.constructor!==Ge;t.appendIndent().append("<"+this.tagName),this.serializeAttributes(t),t.append(e?">":" />"),e&&(n&&t.appendNewLine().indent(),w(this.body,function(e){e.serializeTo(t)}),n&&t.unindent().appendIndent(),t.append("")),t.appendNewLine()},Le(Xe,Ke),Xe.prototype.parseNsAttributes=function(e){var t=Ke.prototype.parseNsAttributes.call(this,e),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var o=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(o.uri),i=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(be),(o.prefix?o.prefix+":":"")+i+n.ns.localName),t},Xe.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},(Qe.prototype=Object.create(X.prototype)).fromXML=function(e,t,n,o){d(t)||(o=n,n=t,t="dmn:Definitions"),p(n)&&(o=n,n={});var r=new Be(R({model:this,lax:!0},n)),i=r.handler(t);r.fromXML(e,i,o)};Qe.prototype.toXML=function(e,t,n){p(t)&&(n=t,t={});var o,r,i=new Je(t);try{o=i.toXML(e)}catch(e){r=e}return n(r,o)};var et={dmn:{name:"DMN",uri:"http://www.omg.org/spec/DMN/20151101/dmn.xsd",xml:{tagAlias:"lowerCase"},prefix:"dmn",types:[{name:"DMNElement",isAbstract:!0,properties:[{name:"description",type:"String"},{name:"id",type:"String",isAttr:!0,isId:!0},{name:"label",type:"String",isAttr:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"NamedElement",isAbstract:!0,superClass:["DMNElement"],properties:[{name:"name",type:"String",isAttr:!0}]},{name:"DMNElementReference",properties:[{name:"href",type:"String",isAttr:!0}]},{name:"ExtensionElements",properties:[{name:"values",type:"Element",isMany:!0}]},{name:"Definitions",superClass:["NamedElement"],properties:[{name:"namespace",type:"String",isAttr:!0},{name:"typeLanguage",type:"String",isAttr:!0,default:"http://www.omg.org/spec/FEEL/20140401"},{name:"expressionLanguage",type:"String",isAttr:!0,default:"http://www.omg.org/spec/FEEL/20140401"},{name:"exporter",type:"String",isAttr:!0},{name:"exporterVersion",type:"String",isAttr:!0},{name:"itemDefinition",type:"ItemDefinition",isMany:!0,xml:{serialize:"property"}},{name:"drgElements",type:"DRGElement",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"Import",properties:[{name:"namespace",type:"String",isAttr:!0},{name:"locationURI",type:"String",isAttr:!0},{name:"importType",type:"String",isAttr:!0}]},{name:"DRGElement",isAbstract:!0,superClass:["NamedElement"]},{name:"Decision",superClass:["DRGElement"],properties:[{name:"question",type:"String"},{name:"allowedAnswers",type:"String"},{name:"variable",type:"InformationItem",xml:{serialize:"property"}},{name:"informationRequirement",type:"InformationRequirement",isMany:!0,xml:{serialize:"property"}},{name:"knowledgeRequirement",type:"KnowledgeRequirement",isMany:!0,xml:{serialize:"property"}},{name:"authorityRequirement",type:"AuthorityRequirement",isMany:!0,xml:{serialize:"property"}},{name:"decisionTable",type:"DecisionTable",xml:{serialize:"property"}},{name:"literalExpression",type:"LiteralExpression",xml:{serialize:"property"}}]},{name:"BusinessKnowledgeModel",superClass:["DRGElement"],properties:[{name:"encapsulatedLogic",type:"FunctionDefinition"},{name:"variable",type:"InformationItem",xml:{serialize:"property"}},{name:"knowledgeRequirement",type:"KnowledgeRequirement",isMany:!0,xml:{serialize:"property"}},{name:"authorityRequirement",type:"AuthorityRequirement",isMany:!0,xml:{serialize:"property"}}]},{name:"InputData",superClass:["DRGElement"],properties:[{name:"variable",type:"InformationItem",xml:{serialize:"property"}}]},{name:"KnowledgeSource",superClass:["DRGElement"],properties:[{name:"authorityRequirement",type:"AuthorityRequirement",isMany:!0,xml:{serialize:"property"}},{name:"type",type:"String",isAttr:!0},{name:"owner",type:"DMNElementReference",isAttr:!0},{name:"locationURI",type:"String",isAttr:!0}]},{name:"InformationRequirement",properties:[{name:"requiredDecision",type:"DMNElementReference",xml:{serialize:"property"}},{name:"requiredInput",type:"DMNElementReference",xml:{serialize:"property"}}]},{name:"KnowledgeRequirement",properties:[{name:"requiredKnowledge",type:"DMNElementReference",isUnique:!0,xml:{serialize:"property"}}]},{name:"AuthorityRequirement",properties:[{name:"requiredDecision",type:"DMNElementReference",xml:{serialize:"property"}},{name:"requiredInput",type:"DMNElementReference",xml:{serialize:"property"}},{name:"requiredAuthority",type:"DMNElementReference",xml:{serialize:"property"}}]},{name:"Expression",isAbstract:!0,superClass:["DMNElement"],properties:[{name:"typeRef",type:"String",isAttr:!0}]},{name:"ItemDefinition",superClass:["NamedElement"],properties:[{name:"typeLanguage",type:"String",isAttr:!0},{name:"isCollection",type:"Boolean",isAttr:!0,default:!1},{name:"typeRef",type:"String"},{name:"allowedValues",type:"UnaryTests",isMany:!0,xml:{serialize:"property"}}]},{name:"LiteralExpression",superClass:["Expression"],properties:[{name:"expressionLanguage",type:"String",isAttr:!0},{name:"importedValues",type:"ImportedValues"},{name:"text",type:"String"}]},{name:"InformationItem",superClass:["NamedElement"],properties:[{name:"typeRef",type:"String",isAttr:!0}]},{name:"DecisionTable",superClass:["Expression"],properties:[{name:"input",type:"InputClause",isMany:!0,xml:{serialize:"property"}},{name:"output",type:"OutputClause",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,default:"Rule-as-Row"},{name:"outputLabel",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:"ImportedValues",superClass:["Import"],properties:[{name:"importedElement",type:"String",isMany:!0,xml:{serialize:"property"}},{name:"expressionLanguage",type:"String",isAttr:!0}]},{name:"Artifact",isAbstract:!0,superClass:["DMNElement"]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String",xml:{serialize:"property"}},{name:"textFormat",type:"String",isAttr:!0}]},{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,default:"None"}]},{name:"InputClause",superClass:["DMNElement"],properties:[{name:"inputExpression",type:"LiteralExpression",xml:{serialize:"property"}},{name:"inputValues",type:"UnaryTests",xml:{serialize:"property"}}]},{name:"OutputClause",superClass:["DMNElement"],properties:[{name:"outputValues",type:"UnaryTests",xml:{serialize:"property"}},{name:"defaultOutputEntry",type:"LiteralExpression",xml:{serialize:"property"}},{name:"name",type:"String",isAttr:!0},{name:"typeRef",type:"String",isAttr:!0}]},{name:"UnaryTests",superClass:["DMNElement"],properties:[{name:"text",type:"String"},{name:"expressionLanguage",type:"String",isAttr:!0}]},{name:"FunctionDefinition",superClass:["Expression"],properties:[{name:"formalParameter",type:"InformationItem",isMany:!0,xml:{serialize:"property"}},{name:"expression",type:"String",isReference:!0,xml:{serialize:"property"}}]}],emumerations:[{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{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"}]}]},camunda:{name:"Camunda",uri:"http://camunda.org/schema/1.0/dmn",prefix:"camunda",xml:{tagAlias:"lowerCase"},types:[{name:"InputVariable",extends:["dmn:InputClause"],properties:[{name:"inputVariable",isAttr:!0,type:"String"}]}]},dc:{name:"DC",uri:"http://www.omg.org/spec/DD/20100524/DC",types:[{name:"Boolean"},{name:"Integer"},{name:"Real"},{name:"String"},{name:"Font",properties:[{name:"name",type:"String",isAttr:!0},{name:"size",type:"Real",isAttr:!0},{name:"isBold",type:"Boolean",isAttr:!0},{name:"isItalic",type:"Boolean",isAttr:!0},{name:"isUnderline",type:"Boolean",isAttr:!0},{name:"isStrikeThrough",type:"Boolean",isAttr:!0}]},{name:"Point",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0}]},{name:"Bounds",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0},{name:"width",type:"Real",isAttr:!0},{name:"height",type:"Real",isAttr:!0}]}],prefix:"dc",associations:[]},biodi:{name:"bpmn.io DI for DMN",uri:"http://bpmn.io/schema/dmn/biodi/1.0",prefix:"biodi",xml:{tagAlias:"lowerCase"},types:[{name:"Edge",superClass:["Element"],properties:[{name:"source",type:"String",isAttr:!0},{name:"waypoints",type:"Waypoint",isMany:!0,xml:{serialize:"property"}}]},{name:"Bounds",superClass:["dc:Bounds","Element"]},{name:"Waypoint",superClass:["dc:Point"]}]}};function tt(e,t){return new Qe(R({},et,e),t)}function nt(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}var ot=[].indexOf,rt=function(e,t){if(ot)return e.indexOf(t);for(var n=0;n
a',xt=!dt.getElementsByTagName("link").length,dt=void 0);var Ct={legend:[1,"
","
"],tr:[2,"","
"],col:[2,"","
"],_default:xt?[1,"X
","
"]:[0,"",""]};Ct.td=Ct.th=[3,"","
"],Ct.option=Ct.optgroup=[1,'"],Ct.thead=Ct.tbody=Ct.colgroup=Ct.caption=Ct.tfoot=[1,"","
"],Ct.polyline=Ct.ellipse=Ct.polygon=Ct.circle=Ct.text=Ct.line=Ct.path=Ct.rect=Ct.g=[1,'',""];var Et="undefined"!=typeof Element?Element.prototype:{},kt=Et.matches||Et.matchesSelector||Et.webkitMatchesSelector||Et.mozMatchesSelector||Et.msMatchesSelector||Et.oMatchesSelector,St=function(e,t){if(!e||1!==e.nodeType)return!1;if(kt)return kt.call(e,t);for(var n=e.parentNode.querySelectorAll(t),o=0;o]+)> detected([\s\S]*)$/.exec(e.message);t&&(e.message="unparsable content <"+t[1]+"> detected; this may indicate an invalid DMN 1.1 diagram file"+t[2]);return e}(e)),e||!i.open)return s._emit("import.done",{error:e,warmings:o}),a(e,o);var r=s._activeView||s._getInitialView(s._views);if(!r)return a(new Error("no displayable contents"));s.open(r,function(e,t){var n=[].concat(o,t||[]);s._emit("import.done",{error:e,warnings:n}),a(e,n)})})}},{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,n){var o=this;"function"==typeof e&&(n=e,e={});var t=this._definitions;if(!t)return n(new Error("no definitions loaded"));t=this._emit("saveXML.start",{definitions:t})||t,this._moddle.toXML(t,e,function(e,t){try{t=o._emit("saveXML.serialized",{error:e,xml:t})||t,o._emit("saveXML.done",{error:e,xml:t})}catch(e){console.error("error in saveXML life-cycle listener",e)}n(e,t)})}},{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.get&&e.constructor.prototype.jquery&&(e=e.get(0)),"string"==typeof e&&(e=Ot(e)),e.appendChild(this._container)}},{key:"detach",value:function(){Pt(this._container)}},{key:"destroy",value:function(){var t=this;Object.keys(this._viewers,function(e){Ft(t._viewers[e],"destroy")}),Pt(this._container)}},{key:"_init",value:function(e){this._options=e,this._moddle=this._createModdle(e),this._viewers={},this._views=[];var t=wt('
'),n=R({},Bt,e);R(t.style,{width:Vt(n.width),height:Vt(n.height),position:n.position}),this._container=t,e.container&&this.attachTo(e.container)}},{key:"open",value:function(e){var t=1");var n=e.constructor,o=this._options[t]||{},r=this._options.common||{};return new n(Rt({},r,o,{additionalModules:[].concat(Mt(o.additionalModules||[]),[{_parent:["value",this],moddle:["value",this._moddle]}])}))}},{key:"_emit",value:function(){var e;(e=this._eventBus).fire.apply(e,arguments)}},{key:"_createModdle",value:function(e){return new tt(e.moddleExtensions||{})}},{key:"_getViewProviders",value:function(){return[]}}]),n}();function Nt(){}function Vt(e){return e+(l(e)?"px":"")}function Lt(e,t){return e.filter(t)[0]}function $t(e,t){return void 0===e?void 0===t:void 0!==t&&(e.element===t.element||e.element.id===t.element.id)}function Ft(e,t){"function"==typeof e[t]&&e[t]()}var Ut=e(function(e){var c=e.exports=function(e,t){if(t||(t=16),void 0===e&&(e=128),e<=0)return"0";for(var n=Math.log(Math.pow(2,e))/Math.log(t),o=2;n===1/0;o*=2)n=Math.log(Math.pow(2,e/o))/Math.log(t)*o;var r=n-Math.floor(n),i="";for(o=0;o=Math.pow(2,e)?c(e,t):i};c.rack=function(o,r,i){var n=function(e){var t=0;do{if(10 ");return a.length=0,new Error(t?e+" (Resolving: "+t+")":e)},n=function e(t,n){if(!f[t]&&-1!==t.indexOf(".")){for(var o=t.split("."),r=e(o.shift());o.length;)r=r[o.shift()];return r}if(dn(s,t))return s[t];if(dn(f,t)){if(-1!==a.indexOf(t))throw a.push(t),c("Cannot resolve circular dependency!");return a.push(t),s[t]=f[t][0](f[t][1]),a.pop(),s[t]}return i.get(t,n)},u=function(e){var t=1"+e+"",t=!0);var n,o,r=(n=e,(o=new DOMParser).async=!1,o.parseFromString(n,"text/xml"));if(!t)return r;for(var i=document.createDocumentFragment(),a=r.firstChild;a.firstChild;)i.appendChild(a.firstChild);return i}function Dn(e,t){var n;return n="<"===e.charAt(0)?(n=An(e).firstChild,document.importNode(n,!0)):document.createElementNS(Tn.svg,e),t&&wn(n,t),n}var Mn=Dn("svg");function Bn(e,t,n,o,r,i){var a=Mn.createSVGMatrix();switch(arguments.length){case 0:return a;case 6:e={a:e,b:t,c:n,d:o,e:r,f:i}}return function(e,t){var n,o,r=Object.keys(t);for(n=0;o=r[n];n++)e[o]=t[o];return e}(a,e)}function In(e){return e?Mn.createSVGTransformFromMatrix(e):Mn.createSVGTransform()}var Nn=/([&<>]{1})/g,Vn=/([\n\r"]{1})/g,Ln={"&":"&","<":"<",">":">",'"':"'"};function $n(e,t){return e.replace(t,function(e,t){return Ln[t]||t})}function Fn(e,t){var n,o,r,i,a;switch(e.nodeType){case 3:t.push($n(e.textContent,Nn));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(n=0,o=(r=e.attributes).length;n"),n=0,o=(a=e.childNodes).length;n")}else t.push("/>");break;case 8:t.push("\x3c!--",$n(e.nodeValue,Nn),"--\x3e");break;case 4:t.push("");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function Un(e,t){var n=An(t);if(Pn(e),t){"#document-fragment"!==n.nodeName&&(n=n.documentElement);for(var o,r=(o=n.childNodes,Array.prototype.slice.call(o)),i=0;i already created at index <"+t+">");return n.group},po.prototype._createLayer=function(e,n){n||(n=0);var t=x(this._layers,function(e,t){return n>=t.index&&e++,e},0);return{group:uo(this._viewport,"layer-"+e,t),index:n}},po.prototype.getContainer=function(){return this._container},po.prototype._updateMarker=function(e,t,n){var o;e.id||(e=this._elementRegistry.get(e)),(o=this._elementRegistry._elements[e.id])&&(w([o.gfx,o.secondaryGfx],function(e){e&&(n?Sn(e).add(t):Sn(e).remove(t))}),this._eventBus.fire("element.marker.update",{element:e,gfx:o.gfx,marker:t,add:!!n}))},po.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},po.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},po.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),Sn(this.getGraphics(e)).has(t)},po.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},po.prototype.getRootElement=function(){return this._rootElement||this.setRootElement({id:"__implicitroot",children:[]}),this._rootElement},po.prototype.setRootElement=function(e,t){e&&this._ensureValid("root",e);var n=this._rootElement,o=this._elementRegistry,r=this._eventBus;if(n){if(!t)throw new Error("rootElement already set, need to specify override");r.fire("root.remove",{element:n}),r.fire("root.removed",{element:n}),o.remove(n)}if(e){var i=this.getDefaultLayer();r.fire("root.add",{element:e}),o.add(e,i,this._svg),r.fire("root.added",{element:e,gfx:i})}return this._rootElement=e},po.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element with id "+t.id+" already exists");var n=lo[e];if(!r(n,function(e){return void 0!==t[e]}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},po.prototype._setParent=function(e,t,n){Jn(t.children,e,n),e.parent=t},po.prototype._addElement=function(e,t,n,o){n=n||this.getRootElement();var r=this._eventBus,i=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,o);var a=i.create(e,t,o);return this._elementRegistry.add(t,a),i.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},po.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},po.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},po.prototype._removeElement=function(e,t){var n=this._elementRegistry,o=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e))return r.fire(t+".remove",{element:e}),o.remove(e),Yn(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},po.prototype.removeShape=function(e){return this._removeElement(e,"shape")},po.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},po.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},po.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},po.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},po.prototype.viewbox=function(t){if(void 0===t&&this._cachedViewbox)return this._cachedViewbox;var e,n,o,r,i,a,s=this._viewport,c=this.getSize();return t?(this._changeViewbox(function(){r=Math.min(c.width/t.width,c.height/t.height);var e=this._svg.createSVGMatrix().scale(r).translate(-t.x,-t.y);Hn(s,e)}),t):(e=this.getDefaultLayer().getBBox(),n=(o=Hn(s))?o.matrix:Bn(),r=so(n.a,1e3),i=so(-n.e||0,1e3),a=so(-n.f||0,1e3),t=this._cachedViewbox={x:i?i/r:0,y:a?a/r:0,width:c.width/r,height:c.height/r,scale:r,inner:{width:e.width,height:e.height,x:e.x,y:e.y},outer:c})},po.prototype.scroll=function(e){var t=this._viewport,n=t.getCTM();return e&&this._changeViewbox(function(){e=R({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),fo(t,n)}),{x:n.e,y:n.f}},po.prototype.zoom=function(e,t){return e?"fit-viewport"===e?this._fitViewport(t):(this._changeViewbox(function(){"object"!==(void 0===t?"undefined":ao(t))&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),o=this._setZoom(e,t)}),so(o.a,1e3)):this.viewbox(e).scale;var n,o},po.prototype._fitViewport=function(e){var t,n,o=this.viewbox(),r=o.outer,i=o.inner;return n=0<=i.x&&0<=i.y&&i.x+i.width<=r.width&&i.y+i.height<=r.height&&!e?{x:0,y:0,width:Math.max(i.width+i.x,r.width),height:Math.max(i.height+i.y,r.height)}:(t=Math.min(1,r.width/i.width,r.height/i.height),{x:i.x+(e?i.width/2-r.width/t/2:0),y:i.y+(e?i.height/2-r.height/t/2:0),width:r.width/t,height:r.height/t}),this.viewbox(n),this.viewbox(!1).scale},po.prototype._setZoom=function(e,t){var n,o,r,i,a=this._svg,s=this._viewport,c=a.createSVGMatrix(),u=a.createSVGPoint(),l=(o=s.getCTM()).a;return i=t?(n=R(u,t).matrixTransform(o.inverse()),r=c.translate(n.x,n.y).scale(1/l*e).translate(-n.x,-n.y),o.multiply(r)):c.scale(e),fo(this._viewport,i),i},po.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},po.prototype.getAbsoluteBBox=function(e){var t,n=this.viewbox();e.waypoints?t=this.getGraphics(e).getBBox():t=e;return{x:t.x*n.scale-n.x*n.scale,y:t.y*n.scale-n.y*n.scale,width:t.width*n.scale,height:t.height*n.scale}},po.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var ho="data-element-id";function yo(e){this._elements={},this._eventBus=e}yo.$inject=["eventBus"],yo.prototype.add=function(e,t,n){var o=e.id;this._validateId(o),wn(t,ho,o),n&&wn(n,ho,o),this._elements[o]={element:e,gfx:t,secondaryGfx:n}},yo.prototype.remove=function(e){var t=this._elements,n=e.id||e,o=n&&t[n];o&&(wn(o.gfx,ho,""),o.secondaryGfx&&wn(o.secondaryGfx,ho,""),delete t[n])},yo.prototype.updateId=function(e,t){this._validateId(t),"string"==typeof e&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),o=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,o)},yo.prototype.get=function(e){var t;t="string"==typeof e?e:e&&wn(e,ho);var n=this._elements[t];return n&&n.element},yo.prototype.filter=function(n){var o=[];return this.forEach(function(e,t){n(e,t)&&o.push(e)}),o},yo.prototype.getAll=function(){return this.filter(function(e){return e})},yo.prototype.forEach=function(r){var i=this._elements;Object.keys(i).forEach(function(e){var t=i[e],n=t.element,o=t.gfx;return r(n,o)})},yo.prototype.getGraphics=function(e,t){var n=e.id||e,o=this._elements[n];return o&&(t?o.secondaryGfx:o.gfx)},yo.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};var vo={extend:function(e,o,t,r){var i=t.inverse;return Object.defineProperty(e,"remove",{value:function(e){var t=this.indexOf(e);return-1!==t&&(this.splice(t,1),o.unset(e,i,r)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e,t){var n=this.indexOf(e);if(void 0===t){if(-1!==n)return;t=this.length}-1!==n&&this.splice(n,1),this.splice(t,0,e),-1===n&&o.set(e,i,r)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e},isExtended:function(e){return!0===e.__refs_collection}};function mo(t,n,o){var e=vo.extend(o[n.name]||[],t,n,o);Object.defineProperty(o,n.name,{enumerable:n.enumerable,value:e}),e.length&&e.forEach(function(e){t.set(e,n.inverse,o)})}function go(e,t){if(!(this instanceof go))return new go(e,t);(e.inverse=t).inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}go.prototype.bind=function(e,t){if("string"==typeof t){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}var n,o,r,i,a;t.collection?mo(this,t,e):(n=this,r=e,i=(o=t).inverse,a=r[o.name],Object.defineProperty(r,o.name,{configurable:o.configurable,enumerable:o.enumerable,get:function(){return a},set:function(e){if(e!==a){var t=a;a=null,t&&n.unset(t,i,r),a=e,n.set(a,i,r)}}}))},go.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return vo.isExtended(n)||mo(this,t,e),n},go.prototype.ensureBound=function(e,t){var n,o;n=e,o=t,Object.prototype.hasOwnProperty.call(n,o.name||o)||this.bind(e,t)},go.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},go.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var bo=go,_o=vo;bo.Collection=_o;var wo=new bo({name:"children",enumerable:!0,collection:!0},{name:"parent"}),xo=new bo({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Co=new bo({name:"attachers",collection:!0},{name:"host"}),Eo=new bo({name:"outgoing",collection:!0},{name:"source"}),ko=new bo({name:"incoming",collection:!0},{name:"target"});function So(){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"),Eo.bind(this,"outgoing"),ko.bind(this,"incoming")}function Oo(){So.call(this),wo.bind(this,"children"),Co.bind(this,"host"),Co.bind(this,"attachers")}function jo(){Oo.call(this)}function Po(){Oo.call(this),xo.bind(this,"labelTarget")}function To(){So.call(this),Eo.bind(this,"source"),ko.bind(this,"target")}en(Oo,So),en(jo,Oo),en(Po,Oo),en(To,So);var Ro={connection:To,shape:Oo,label:Po,root:jo};function Ao(){this._uid=12}function Do(e,t,n){var o=In();o.setTranslate(t,n),Hn(e,o)}function Mo(e,t){this._eventBus=e,this._elementRegistry=t}function Bo(e,t,n){t.insertBefore(e,n||t.firstChild)}Ao.prototype.createRoot=function(e){return this.create("root",e)},Ao.prototype.createLabel=function(e){return this.create("label",e)},Ao.prototype.createShape=function(e){return this.create("shape",e)},Ao.prototype.createConnection=function(e){return this.create("connection",e)},Ao.prototype.create=function(e,t){return(t=R({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=Ro[e];if(!n)throw new Error("unknown type: <"+e+">");return R(new n,t)}(e,t)},Mo.$inject=["eventBus","elementRegistry"],Mo.prototype._getChildren=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=n.parentNode.childNodes[1])||(Sn(t=Dn("g")).add("djs-children"),mn(n.parentNode,t)):t=n,t},Mo.prototype._clear=function(e){var t=Ot(".djs-visual",e);return ut(t),t},Mo.prototype._createContainer=function(e,t,n){var o=Dn("g");Sn(o).add("djs-group"),void 0!==n?Bo(o,t,t.childNodes[n]):mn(t,o);var r=Dn("g");Sn(r).add("djs-element"),Sn(r).add("djs-"+e),mn(o,r);var i=Dn("g");return Sn(i).add("djs-visual"),mn(r,i),r},Mo.prototype.create=function(e,t,n){var o=this._getChildren(t.parent);return this._createContainer(e,o,n)},Mo.prototype.updateContainments=function(e){var o=this,r=this._elementRegistry;w(x(e,function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e},{}),function(e){var t=e.children;if(t){var n=o._getChildren(e);w(t.slice().reverse(),function(e){Bo(r.getGraphics(e).parentNode,n)})}})},Mo.prototype.drawShape=function(e,t){return this._eventBus.fire("render.shape",{gfx:e,element:t})},Mo.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},Mo.prototype.drawConnection=function(e,t){return this._eventBus.fire("render.connection",{gfx:e,element:t})},Mo.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},Mo.prototype.update=function(e,t,n){if(t.parent){var o=this._clear(n);if("shape"===e)this.drawShape(o,t),Do(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(o,t)}t.hidden?wn(n,"display","none"):wn(n,"display","block")}},Mo.prototype.remove=function(e){jn(this._elementRegistry.getGraphics(e).parentNode)};var Io={__depends__:[Zn],__init__:["canvas"],canvas:["type",po],elementRegistry:["type",yo],elementFactory:["type",Ao],eventBus:["type",o],graphicsFactory:["type",Mo]};function No(e){var o=[],r=[];function i(e){return 0<=o.indexOf(e)}e.forEach(function e(t){var n;i(t)||((t.__depends__||[]).forEach(e),i(t)||(n=t,o.push(n),(t.__init__||[]).forEach(function(e){r.push(e)})))});var t=new fn(o);return r.forEach(function(e){try{t["string"==typeof e?"get":"invoke"](e)}catch(e){throw console.error("Failed to instantiate component"),console.error(e.stack),e}}),t}function Vo(e,t){var n;this.injector=t=t||No([{config:["value",n=(n=e)||{}]},Io].concat(n.modules||[])),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}Vo.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Vo.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};var Lo,$o=(Lo=Object.freeze({default:Vo}))&&Lo.default||Lo;function Fo(n,e){var a=[];function s(e,t){if(e.gfx)throw new Error("already rendered "+e.id);return n.element(e,t)}function o(t){var n=[];!function(e,t){var n=e.extensionElements;if(!n)return;w(n.values,t)}(t,function(e){Ht(e,"biodi:Bounds")?s(t,e):Ht(e,"biodi:Edge")&&n.push(e)}),function(i,t){function n(e,t){var n,o=(n=t)&&n.href.slice(1),r=g(i,E({source:o}));r&&a.push(function(){s(e,r)})}if(Ht(t,"dmn:Association"))return n(t,t.sourceRef);w(["informationRequirement","knowledgeRequirement","authorityRequirement"],function(e){w(t[e],function(t){var e=null;Ht(t,"dmn:InformationRequirement")?e=["requiredDecision","requiredInput"]:Ht(t,"dmn:KnowledgeRequirement")?e=["requiredKnowledge"]:Ht(t,"dmn:AuthorityRequirement")&&(e=["requiredDecision","requiredInput","requiredAuthority"]),e&&w(e,function(e){t[e]&&n(t,t[e])})})})}(n,t)}return{handleDefinitions:function(t){n.root(t),w(["decision","drgElements","artifacts"],function(e){t[e]&&w(t[e],o)}),w(a,function(e){e()})}}}var Uo=0,zo={width:150,height:50};function Wo(e,t){var n;t.textContent=e;try{var o,r=""===e;return t.textContent=r?"dummy":e,o={width:(n=t.getBBox()).width+2*n.x,height:n.height},r&&(o.width=0),o}catch(e){return{width:0,height:0}}}function Ho(e,t,n){for(var o,r=e.shift(),i=r;;){if((o=Wo(i,n)).width=i?o.width:0," "===i||""===i||o.widthe?t.width:e},0),g=u.top;"middle"===c.vertical&&(g+=(a.height-v)/2),g-=(p||d[0].height)/4;var b=Dn("text");return wn(b,s),w(d,function(e){var t;switch(g+=p||e.height,c.horizontal){case"left":t=u.left;break;case"right":t=(l?m:h)-u.right-e.width;break;default:t=Math.max(((l?m:h)-e.width)/2+u.left,0)}var n=Dn("tspan");wn(n,{x:t,y:g}),n.textContent=e.text,mn(b,n)}),jn(y),{dimensions:{width:m,height:v},element:b}},en(Xo,yn),Xo.$inject=["eventBus","pathMap","styles"];var Yo=/\{([^}]+)\}/g,Jo=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var Qo={__init__:["drdRenderer"],drdRenderer:["type",Xo],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,o,r=this.pathMap[e];o=t.abspos?(n=t.abspos.x,t.abspos.y):(n=t.containerWidth*t.position.mx,t.containerHeight*t.position.my);var i,a,s={};if(t.position){for(var c=t.containerHeight/r.height*t.yScaleFactor,u=t.containerWidth/r.width*t.xScaleFactor,l=0;l");return i(o,t,n)},this.mouseHandler=u,this.registerEvent=o,this.unregisterEvent=d}pr.$inject=["eventBus","elementRegistry","styles"];var fr={__init__:["interactionEvents"],interactionEvents:["type",pr]};function dr(e,t,n){this.offset=6;var o=t.cls("djs-outline",["no-fill"]),r=this;function i(e,t){var n=Dn("rect");return wn(n,R({x:10,y:10,width:100,height:100},o)),mn(e,n),n}e.on(["shape.added","shape.changed"],500,function(e){var t=e.element,n=e.gfx,o=Ot(".djs-outline",n);o||(o=i(n)),r.updateShapeOutline(o,t)}),e.on(["connection.added","connection.changed"],function(e){var t=e.element,n=e.gfx,o=Ot(".djs-outline",n);o||(o=i(n)),r.updateConnectionOutline(o,t)})}dr.prototype.updateShapeOutline=function(e,t){wn(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},dr.prototype.updateConnectionOutline=function(e,t){var n=oo(t);wn(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},dr.$inject=["eventBus","styles","elementRegistry"];var hr={__init__:["outline"],outline:["type",dr]};function yr(e){this._eventBus=e,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],function(e){var t=e.element;n.deselect(t)}),e.on(["diagram.clear"],function(e){n.select(null)})}yr.$inject=["eventBus"],yr.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(-1!==n){var o=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:o,newSelection:t})}},yr.prototype.get=function(){return this._selectedElements},yr.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},yr.prototype.select=function(e,t){var n=this._selectedElements,o=n.slice();y(e)||(e=e?[e]:[]),t?w(e,function(e){-1===n.indexOf(e)&&n.push(e)}):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:o,newSelection:n})};var vr="selected";function mr(e,n,t,o){function r(e,t){n.addMarker(e,t)}function i(e,t){n.removeMarker(e,t)}this._multiSelectionBox=null,e.on("element.hover",function(e){r(e.element,"hover")}),e.on("element.out",function(e){i(e.element,"hover")}),e.on("selection.changed",function(e){var t=e.oldSelection,n=e.newSelection;w(t,function(e){-1===n.indexOf(e)&&i(e,vr)}),w(n,function(e){-1===t.indexOf(e)&&r(e,vr)})})}function gr(e,i,a,o){e.on("create.end",500,function(e){e.context.canExecute&&i.select(e.context.shape)}),e.on("connect.end",500,function(e){e.context.canExecute&&e.context.target&&i.select(e.context.target)}),e.on("shape.move.end",500,function(e){var t=e.previousSelection||[],n=o.get(e.context.shape.id);g(t,function(e){return n.id===e.id})||i.select(n)}),e.on("element.click",function(e){var t=e.element;t===a.getRootElement()&&(t=null);var n=i.isSelected(t),o=1'),r.insertBefore(i,r.firstChild),i),this._init()}function Cr(e,t,n){R(e.style,{left:t+"px",top:n+"px"})}function Er(e,t){e.style.display=!1===t?"none":""}function kr(t,n){t.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(e){t.style[e+"transform"]=n})}xr.$inject=["config.overlays","eventBus","canvas","elementRegistry"],xr.prototype.get=function(e){if(d(e)&&(e={id:e}),d(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?h(t.overlays,E({type:e.type})):t.overlays.slice():[]}return e.type?h(this._overlays,E({type:e.type})):e.id?this._overlays[e.id]:null},xr.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 o=this._ids.next();return n=R({},this._overlayDefaults,n,{id:o,type:t,element:e,html:n.html}),this._addOverlay(n),o},xr.prototype.remove=function(e){var t=this.get(e)||[];y(t)||(t=[t]);var o=this;w(t,function(e){var t=o._getOverlayContainer(e.element,!0);if(e&&(Pt(e.html),Pt(e.htmlContainer),delete e.htmlContainer,delete e.element,delete o._overlays[e.id]),t){var n=t.overlays.indexOf(e);-1!==n&&t.overlays.splice(n,1)}})},xr.prototype.show=function(){Er(this._overlayRoot)},xr.prototype.hide=function(){Er(this._overlayRoot,!1)},xr.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ut(this._overlayRoot)},xr.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,o=t.x,r=t.y;if(t.waypoints){var i=oo(t);o=i.x,r=i.y}Cr(n,o,r),nt(e.html,"data-container-id",t.id)},xr.prototype._updateOverlay=function(e){var t,n,o=e.position,r=e.htmlContainer,i=e.element,a=o.left,s=o.top;void 0!==o.right&&(t=i.waypoints?oo(i).width:i.width,a=-1*o.right+t);void 0!==o.bottom&&(n=i.waypoints?oo(i).height:i.height,s=-1*o.bottom+n);Cr(r,a||0,s||0)},xr.prototype._createOverlayContainer=function(e){var t=wt('
');this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},xr.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";kr(this._overlayRoot,n)},xr.prototype._getOverlayContainer=function(t,e){var n=g(this._overlayContainers,function(e){return e.element===t});return n||e?n:this._createOverlayContainer(t)},xr.prototype._addOverlay=function(e){var t,n,o=e.id,r=e.element,i=e.html;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),d(i)&&(i=wt(i)),n=this._getOverlayContainer(r),(t=wt('
')).appendChild(i),e.type&&st(t).add("djs-overlay-"+e.type),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[o]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},xr.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,o=n&&n.minZoom,r=n&&n.maxZoom,i=e.htmlContainer,a=!0;n&&((c(o)&&o>t.scale||c(r)&&ro&&(r=(1/t.scale||1)*o)),c(r)&&(s="scale("+r+","+r+")"),kr(a,s)},xr.prototype._updateOverlaysVisibilty=function(t){var n=this;w(this._overlays,function(e){n._updateOverlayVisibilty(e,t)})},xr.prototype._init=function(){var e=this._eventBus,r=this;e.on("canvas.viewbox.changing",function(e){r.hide()}),e.on("canvas.viewbox.changed",function(e){var t;t=e.viewbox,r._updateRoot(t),r._updateOverlaysVisibilty(t),r.show()}),e.on(["shape.remove","connection.remove"],function(e){var t=e.element;w(r.get({element:t}),function(e){r.remove(e.id)});var n=r._getOverlayContainer(t);if(n){Pt(n.html);var o=r._overlayContainers.indexOf(n);-1!==o&&r._overlayContainers.splice(o,1)}}),e.on("element.changed",500,function(e){var t=e.element,n=r._getOverlayContainer(t,!0);n&&(w(n.overlays,function(e){r._updateOverlay(e)}),r._updateOverlayContainer(n))}),e.on("element.marker.update",function(e){var t=r._getOverlayContainer(e.element,!0);t&&st(t.html)[e.add?"add":"remove"](e.marker)}),e.on("diagram.clear",this.clear,this)};var Sr={__init__:["overlays"],overlays:["type",xr]};function Or(e,t){this._eventBus=e,this._canvas=t,e.on("diagram.init",function(){this._init()},this),e.on("import.done",function(e){this.update()},this)}function jr(e,n){function t(e,t){st(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)})}Or.$inject=["eventBus","canvas"],Or.prototype._init=function(){var e=this._canvas,t=this._eventBus,n=e.getContainer(),o=this._container=wt(Or.HTML_MARKUP);n.appendChild(o),this.nameElement=Ot(".dmn-definitions-name",this._container),this.idElement=Ot(".dmn-definitions-id",this._container),_t.bind(o,".dmn-definitions-name, .dmn-definitions-id","mousedown",function(e){e.stopPropagation()}),t.fire("definitionIdView.create",{html:o})},Or.prototype.update=function(e){var t=this._canvas.getRootElement().businessObject;this.nameElement.textContent=t.name,this.idElement.textContent=t.id},Or.HTML_MARKUP='
',jr.$inject=["eventBus","canvas"];var Pr={__init__:["definitionPropertiesView","definitionPropertiesPaletteAdapter"],definitionPropertiesView:["type",Or],definitionPropertiesPaletteAdapter:["type",jr]},Tr=function(){function o(e,t){for(var n=0;n\n \n
\n '),o=this._overlays.add(e,{position:{top:2,left:2},html:n});!1!==this._config.enabled&&(st(n).add("interactive"),this.bindEventListener(e,n,o))}},{key:"bindEventListener",value:function(e,t,n){var o=this,r=this._overlays,i=this._eventBus,a=r._overlayRoot;_t.bind(a,'[data-overlay-id="'+n+'"]',"click",function(){!1!==i.fire("drillDown.click",{element:e})&&o.drillDown(e)})}},{key:"drillDown",value:function(e){var t=this._injector.get("_parent",!1);if(!t)return!1;var n=t.getView(e.businessObject);return!!n&&(t.open(n),!0)}}]),r}();Ar.$inject=["injector","eventBus","overlays","config.drillDown"];var Dr={__depends__:[Sr],__init__:["drillDown"],drillDown:["type",Ar]},Mr=''))+'" />'; /** * This file must not be changed or exchanged. * * @see http://bpmn.io/license for more information. */function Br(e){return e.join(";")}var Ir,Nr='
'+Mr+'Web-based tooling for BPMN, DMN and CMMN diagrams powered by bpmn.io.
';var Vr=Object.assign||function(e){for(var t=1;t'+Mr+""),t.appendChild(n),gt.bind(n,"click",function(e){Ir||(Ir=wt(Nr),_t.bind(Ir,".backdrop","click",function(e){document.body.removeChild(Ir)})),document.body.appendChild(Ir),e.preventDefault()}),this._init(this._container,e)}function Fr(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ur(e,t){return{x:e.x-t.x,y:e.y-t.y}}function zr(e){return Math.log(e)/Math.log(10)}function Wr(e,t){var n=zr(e.min),o=zr(e.max);return(Math.abs(n)+Math.abs(o))/t}en($r,$o),$r.prototype.saveSVG=function(e,t){t||(t=e,e={});var n=this.get("canvas"),o=n.getDefaultLayer(),r=Ot("defs",n._svg),i=zn(o),a=r&&r.outerHTML||"",s=o.getBBox();t(null,'\n\x3c!-- created with dmn-js / http://bpmn.io --\x3e\n\n'+a+i+"")},$r.prototype.getModules=function(){return this._modules},$r.prototype.destroy=function(){$o.prototype.destroy.call(this),Pt(this._container)},$r.prototype.on=function(e,t,n,o){return this.get("eventBus").on(e,t,n,o)},$r.prototype.off=function(e,t){this.get("eventBus").off(e,t)},$r.prototype._init=function(e,t){var n=t.additionalModules,o=t.canvas,r=function(e,t){var n={};for(var o in e)0<=t.indexOf(o)||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}(t,["additionalModules","canvas"]),i=t.modules||this.getModules(),a=[].concat([{drd:["value",this]}],Lr(i),Lr(n||[])),s=Vr({},r,{canvas:Vr({},o,{container:e}),modules:a});$o.call(this,s),t&&t.container&&this.attachTo(t.container)},$r.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},$r.prototype._createContainer=function(){return wt('
')},$r.prototype.open=function(e,t){var n;try{return this._definitions&&this.clear(),this._definitions=e,function(e,t,n){var o,r,i=e.get("drdImporter"),a=e.get("eventBus"),s=[];a.fire("import.start",{definitions:t});try{r=t,new Fo({root:function(e){return i.root(e)},element:function(e,t){return i.add(e,t)},error:function(e,t){s.push({message:e,context:t})}}).handleDefinitions(r)}catch(e){o=e}a.fire("import.done",{error:o,warnings:s}),n(o,s)}(this,e,t)}catch(e){n=e}return t(n)},$r.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()},$r.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},$r.prototype._modules=[nr,or,br,Sr,Pr,Dr];var Hr=Math.sign||function(e){return 0<=e?1:-1},Gr={min:.2,max:4};function qr(t,e,n){t=t||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=P(this._handleWheel,this),this._totalDelta=0,this._scale=t.scale||.75;var o=this;e.on("canvas.init",function(e){o._init(!1!==t.enabled)})}qr.$inject=["config.zoomScroll","eventBus","canvas"],qr.prototype.scroll=function(e){this._canvas.scroll(e)},qr.prototype.reset=function(){this._canvas.zoom("fit-viewport")},qr.prototype.zoom=function(e,t){var n=Wr(Gr,20);this._totalDelta+=e,.1\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",n=i.console&&(i.console.warn||i.console.log);return n&&n.call(i.console,r,t),o.apply(this,arguments)}}a="function"!=typeof Object.assign?function(e){if(e===y||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;nt[n]}):o.sort()),o}function P(e,t){for(var n,o,r=t[0].toUpperCase()+t.slice(1),i=0;iv(u.y)?u.x:u.y,t.scale=a?(f=a.pointers,d=o,ne(d[0],d[1],X)/ne(f[0],f[1],X)):1,t.rotation=a?(l=a.pointers,p=o,oe(p[1],p[0],X)+oe(l[1],l[0],X)):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,function(e,t){var n,o,r,i,a=e.lastInterval||t,s=t.timeStamp-a.timeStamp;if(t.eventType!=L&&(Iv(l.y)?l.x:l.y,i=te(c,u),e.lastInterval=t}else n=a.velocity,o=a.velocityX,r=a.velocityY,i=a.direction;t.velocity=n,t.velocityX=o,t.velocityY=r,t.direction=i}(n,t);var l,p;var f,d;var h=e.element;C(t.srcEvent.target,h)&&(h=t.srcEvent.target);t.target=h}(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function J(e){for(var t=[],n=0;n=v(t)?e<0?F:U:t<0?z:W}function ne(e,t,n){n||(n=K);var o=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return Math.sqrt(o*o+r*r)}function oe(e,t,n){n||(n=K);var o=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return 180*Math.atan2(r,o)/Math.PI}Z.prototype={handler:function(){},init: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)},destroy:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(R(this.element),this.evWin,this.domHandler)}};var re={mousedown:N,mousemove:2,mouseup:V},ie="mousedown",ae="mousemove mouseup";function se(){this.evEl=ie,this.evWin=ae,this.pressed=!1,Z.apply(this,arguments)}h(se,Z,{handler:function(e){var t=re[e.type];t&N&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=V),this.pressed&&(t&V&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:"mouse",srcEvent:e}))}});var ce={pointerdown:N,pointermove:2,pointerup:V,pointercancel:L,pointerout:L},ue={2:B,3:"pen",4:"mouse",5:"kinect"},le="pointerdown",pe="pointermove pointerup pointercancel";function fe(){this.evEl=le,this.evWin=pe,Z.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}i.MSPointerEvent&&!i.PointerEvent&&(le="MSPointerDown",pe="MSPointerMove MSPointerUp MSPointerCancel"),h(fe,Z,{handler:function(e){var t=this.store,n=!1,o=e.type.toLowerCase().replace("ms",""),r=ce[o],i=ue[e.pointerType]||e.pointerType,a=i==B,s=S(t,e.pointerId,"pointerId");r&N&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):r&(V|L)&&(n=!0),s<0||(t[s]=e,this.callback(this.manager,r,{pointers:t,changedPointers:[e],pointerType:i,srcEvent:e}),n&&t.splice(s,1))}});var de={touchstart:N,touchmove:2,touchend:V,touchcancel:L};function he(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,Z.apply(this,arguments)}h(he,Z,{handler:function(e){var t=de[e.type];if(t===N&&(this.started=!0),this.started){var n=function(e,t){var n=O(e.touches),o=O(e.changedTouches);t&(V|L)&&(n=j(n.concat(o),"identifier",!0));return[n,o]}.call(this,e,t);t&(V|L)&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:B,srcEvent:e})}}});var ye={touchstart:N,touchmove:2,touchend:V,touchcancel:L},ve="touchstart touchmove touchend touchcancel";function me(){this.evTarget=ve,this.targetIds={},Z.apply(this,arguments)}h(me,Z,{handler:function(e){var t=ye[e.type],n=function(e,t){var n=O(e.touches),o=this.targetIds;if(t&(2|N)&&1===n.length)return o[n[0].identifier]=!0,[n,n];var r,i,a=O(e.changedTouches),s=[],c=this.target;if(i=n.filter(function(e){return C(e.target,c)}),t===N)for(r=0;rt.threshold&&r&t.direction},attrTest:function(e){return Me.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=Ae(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),h(Ie,Me,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Ee]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),h(Ne,Te,{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,o=e.distancet.time;if(this._input=e,!o||!n||e.eventType&(V|L)&&!r)this.reset();else if(e.eventType&N)this.reset(),this._timer=l(function(){this.state=8,this.tryEmit()},t.time,this);else if(e.eventType&V)return 8;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&V?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=m(),this.manager.emit(this.options.event,this._input)))}}),h(Ve,Me,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Ee]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),h(Le,Me,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:H|G,pointers:1},getTouchAction:function(){return Be.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(H|G)?t=e.overallVelocity:n&H?t=e.overallVelocityX:n&G&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&v(t)>this.options.velocity&&e.eventType&V},emit:function(e){var t=Ae(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),h($e,Te,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Ce]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,o=e.distanceh.threshold))){if(R(o,{x:pi(c.x+r.x),y:pi(c.y+r.y),dx:0,dy:0},{originalEvent:e}),!1===m("start"))return k();h.active=!0,h.keepSelection||(o.previousSelection=d.get(),d.select(null)),h.cursor&&Zr(h.cursor),f.addMarker(f.getRootElement(),fi)}ar(e),h.active&&(R(o,{x:pi(u.x+r.x),y:pi(u.y+r.y),dx:pi(l.x),dy:pi(l.y)},{originalEvent:e}),m("move"))}function b(e){var t=!0;h.active&&(e&&ar(h.payload.originalEvent=e),t=m("end")),!1===t&&m("rejected"),m("ended",o(!0!==t))}function _(e){27===e.which&&(di(e),k())}function w(e){var t;h.active&&(t=Qr(p),setTimeout(t,400),di(e)),b(e)}function x(e){g(e)}function C(e){var t=h.payload;t.hoverGfx=e.gfx,t.hover=e.element,m("hover")}function E(e){m("out");var t=h.payload;t.hoverGfx=null,t.hover=null}function k(e){var t;if(h){var n=h.active;n&&m("cancel"),t=o(e),n&&m("canceled",t)}}function o(e){var t,n;m("cleanup"),Yr(),n=h.trapClick?w:b,gt.unbind(document,"mousemove",g),gt.unbind(document,"dragstart",di),gt.unbind(document,"selectstart",di),gt.unbind(document,"mousedown",n,!0),gt.unbind(document,"mouseup",n,!0),gt.unbind(document,"keyup",_),gt.unbind(document,"touchstart",x,!0),gt.unbind(document,"touchcancel",k,!0),gt.unbind(document,"touchmove",g,!0),gt.unbind(document,"touchend",b,!0),p.off("element.hover",C),p.off("element.out",E),f.removeMarker(f.getRootElement(),fi);var o=h.payload.previousSelection;return!1!==e&&o&&!d.get().length&&d.select(o),t=h,h=null,t}p.on("diagram.destroy",k),this.init=function(e,t,n,o){h&&k(!1),"string"==typeof t&&(o=n,n=t,t=null);var r,i,a,s,c,u,l=(o=R({},y,o||{})).data||{};s=o.trapClick?w:b,e?(r=ir(e)||e,i=sr(e),ar(e),"dragstart"===r.type&&di(r)):(r=null,i={x:0,y:0}),a=v(i),t||(t=a),u=r,c="undefined"!=typeof TouchEvent&&u instanceof TouchEvent,h=R({prefix:n,data:l,payload:{},globalStart:i,displacement:Ur(t,a),localStart:a,isTouch:c},o),o.manual||(c?(gt.bind(document,"touchstart",x,!0),gt.bind(document,"touchcancel",k,!0),gt.bind(document,"touchmove",g,!0),gt.bind(document,"touchend",b,!0)):(gt.bind(document,"mousemove",g),gt.bind(document,"dragstart",di),gt.bind(document,"selectstart",di),gt.bind(document,"mousedown",s,!0),gt.bind(document,"mouseup",s,!0)),gt.bind(document,"keyup",_),p.on("element.hover",C),p.on("element.out",E)),m("init"),o.autoActivate&&g(e,!0)},this.move=g,this.hover=C,this.out=E,this.end=b,this.cancel=k,this.context=function(){return h},this.setOptions=function(e){R(y,e)}}function yi(t,a,s){var n=this;t.on("drag.start",function(e){t.once("drag.move",function(){t.once("drag.move",function(e){n.ensureHover(e)})})}),this.ensureHover=function(e){if(!e.hover){var t,n,o,r,i=e.originalEvent;if(i instanceof MouseEvent)t=sr(i),n=document.elementFromPoint(t.x,t.y),(r=ht(n,"svg, .djs-element",!0))&&(o=s.get(r),a.hover({element:o,gfx:r}))}}}hi.$inject=["eventBus","canvas","selection"],yi.$inject=["eventBus","dragging","elementRegistry"];var vi={__init__:["hoverFix"],__depends__:[br],dragging:["type",hi],hoverFix:["type",yi]};function mi(e){this._commandStack=e.get("commandStack",!1)}mi.$inject=["injector"],mi.prototype.allowed=function(e,t){var n=!0,o=this._commandStack;return o&&(n=o.canExecute(e,t)),void 0===n||n};var gi={__init__:["rules"],rules:["type",mi]};function bi(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}function _i(e,t,n,o){if(void 0===o&&(o=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),i=bi(e,t);return Math.abs(r/i)<=o}var wi=2;function xi(e,t){return Math.abs(e.x-t.x)<=wi?"h":Math.abs(e.y-t.y)<=wi&&"v"}function Ci(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Ei="djs-bendpoint",ki="djs-segment-dragger";function Si(e,t){var n=Dn("g");Sn(n).add(Ei),mn(e,n);var o=Dn("circle");wn(o,{cx:0,cy:0,r:4}),Sn(o).add("djs-visual"),mn(n,o);var r=Dn("circle");return wn(r,{cx:0,cy:0,r:10}),Sn(r).add("djs-hit"),mn(n,r),t&&Sn(n).add(t),n}function Oi(e,t,n){var o=Dn("g");mn(e,o);var r=Dn("rect");wn(r,{x:-7,y:-1.5,width:14,height:3}),Sn(r).add("djs-visual"),mn(o,r);var i,a,s,c=Dn("rect");return wn(c,{x:-10,y:-4.5,width:20,height:9}),Sn(c).add("djs-hit"),mn(o,c),i=o,a="h"===n?90:0,(s=In()).setRotate(a,0,0),Hn(i,s),o}function ji(e,t,n){var o=Dn("g"),r=Ci(t,n),i=xi(t,n);return mn(e,o),Oi(o,0,i),Sn(o).add(ki),Sn(o).add("h"===i?"vertical":"horizontal"),Do(o,r.x,r.y),o}var Pi=e(function(e,t){var n,o,r="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};n=Z,o=function(e){if(e.CSS&&e.CSS.escape)return e.CSS.escape;var t=function(e){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var t,n=String(e),o=n.length,r=-1,i="",a=n.charCodeAt(0);++r=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Yi(e,t,n,o,r){return e*(e*(-3*t+9*n-9*o+3*r)+6*t-12*n+6*o)-3*t+3*n}function Ji(e,t,n,o,r,i,a,s,c){null==c&&(c=1);for(var u=(c=1Ni(r,a)||Ni(t,o)Ni(i,s))){var c=(e-n)*(i-s)-(t-o)*(r-a);if(c){var u=((e*o-t*n)*(r-a)-(e-n)*(r*s-i*a))/c,l=((e*o-t*n)*(i-s)-(t-o)*(r*s-i*a))/c,p=+u.toFixed(2),f=+l.toFixed(2);if(!(p<+Ii(e,n).toFixed(2)||p>+Ni(e,n).toFixed(2)||p<+Ii(r,a).toFixed(2)||p>+Ni(r,a).toFixed(2)||f<+Ii(t,o).toFixed(2)||f>+Ni(t,o).toFixed(2)||f<+Ii(i,s).toFixed(2)||f>+Ni(i,s).toFixed(2)))return{x:u,y:l}}}}function ea(e,t,n){var o,r,i=Xi(e),a=Xi(t);if(r=a,o=Hi(o=i),!(Zi(r=Hi(r),o.x,o.y)||Zi(r,o.x2,o.y)||Zi(r,o.x,o.y2)||Zi(r,o.x2,o.y2)||Zi(o,r.x,r.y)||Zi(o,r.x2,r.y)||Zi(o,r.x,r.y2)||Zi(o,r.x2,r.y2)||(o.xr.x||r.xo.x)&&(o.yr.y||r.yo.y)))return n?0:[];for(var s=~~(Ji.apply(0,e)/5),c=~~(Ji.apply(0,t)/5),u=[],l=[],p={},f=n?0:[],d=0;d=i[r]&&(a.push([t].concat(o.splice(0,i[r]))),i[r]););}),a.toString=Wi.toString,t.arr=zi(a),a}(e)),!e||!e.length)return[["M",0,0]];var n,o=[],r=0,i=0,a=0,s=0,c=0;"M"==e[0][0]&&(a=r=+e[0][1],s=i=+e[0][2],c++,o[0]=["M",r,i]);for(var u,l,p=3==e.length&&"M"==e[0][0]&&"R"==e[1][0].toUpperCase()&&"Z"==e[2][0].toUpperCase(),f=c,d=e.length;fh){var P=O,T=s,R=c;O=S+h*(a&&S=r.right,s=o.top-n.y>=r.bottom,c=i?"top":s?"bottom":null,u=o.right+n.x<=r.left?"left":a?"right":null;return u&&c?c+"-"+u:u||c||"intersect"}function Oa(e,t,n){var o=ca(e,t);return 1===o.length?Ca(o[0]):2===o.length&&bi(o[0],o[1])<1?Ca(o[0]):1o.length-3&&u.unshift(l(n.target)),e.snapPoints=t={horizontal:[],vertical:[]},w(u,function(e){e&&(e=e.original||e,"y"===c&&t.horizontal.push(e.y),"x"===c&&t.vertical.push(e.x))}),t}(e.context),r=e.x,i=e.y;if(o){var a=r-(t=u(o.vertical,r)),s=i-(n=u(o.horizontal,i));R(e,{dx:e.dx-a,dy:e.dy-s,x:t,y:n})}}),e.on("bendpoint.move.move",1500,function(e){var t=e.context,n=function(e){var t=e.snapPoints,n=e.connection.waypoints,o=e.bendpointIndex;if(t)return t;var r=[n[o-1],n[o+1]];return e.snapPoints=t={horizontal:[],vertical:[]},w(r,function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))}),t}(t),o=t.target,r=o&&l(o),i=e.x,a=e.y;if(n){var s=i-u(r?n.vertical.concat([r.x]):n.vertical,i),c=a-u(r?n.horizontal.concat([r.y]):n.horizontal,a);R(e,{dx:e.dx-s,dy:e.dy-c,x:e.x-s,y:e.y-c})}})}Na.$inject=["eventBus"];var Va={__depends__:[vi,gi],__init__:["bendpoints","bendpointSnapping"],bendpoints:["type",da],bendpointMove:["type",xa],connectionSegmentMove:["type",Ma],bendpointSnapping:["type",Na]};function La(e,t,n){this._providers=[],this._eventBus=t,this._overlays=n;var o=c(e&&e.scale)?e.scale:{min:1,max:1.5};this._overlaysConfig={position:{right:-9,top:-6},scale:o},this._current=null,this._init()}La.$inject=["config.contextPad","eventBus","overlays"],La.prototype._init=function(){var e=this._eventBus,o=this;e.on("selection.changed",function(e){var t=e.newSelection;1===t.length?o.open(t[0]):o.close()}),e.on("elements.delete",function(e){w(e.elements,function(e){o.isOpen(e)&&o.close()})}),e.on("element.changed",function(e){var t=e.element,n=o._current;n&&n.element===t&&o.open(t,!0)})},La.prototype.registerProvider=function(e){this._providers.push(e)},La.prototype.getEntries=function(t){var n={};return w(this._providers,function(e){w(e.getContextPadEntries(t),function(e,t){n[t]=e})}),n},La.prototype.trigger=function(e,t,n){var o,r,i=this._current.element,a=this._current.entries,s=t.delegateTarget||t.target;if(!s)return t.preventDefault();if(o=a[nt(s,"data-action")].action,r=t.originalEvent||t,p(o)){if("click"===e)return o(r,i,n)}else if(o[e])return o[e](r,i,n);t.preventDefault()},La.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},La.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this.getPad(e),c=n.html;w(t,function(e,t){var n,o,r,i,a=e.group||"default",s=wt(e.html||'
');nt(s,"data-action",t),(n=Ot("[data-group="+a+"]",c))||(n=wt('
'),c.appendChild(n)),n.appendChild(s),e.className&&(o=s,r=e.className,i=st(o),(y(r)?r:r.split(/\s+/g)).forEach(function(e){i.add(e)})),e.title&&nt(s,"title",e.title),e.imageUrl&&s.appendChild(wt(''))}),st(c).add("open"),this._current={element:e,pad:n,entries:t},this._eventBus.fire("contextPad.open",{current:this._current})},La.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,o=wt('
'),r=R({html:o},this._overlaysConfig);_t.bind(o,".entry","click",function(e){t.trigger("click",e)}),_t.bind(o,".entry","dragstart",function(e){t.trigger("dragstart",e)}),gt.bind(o,"mousedown",function(e){e.stopPropagation()}),this._overlayId=n.add(e,"context-pad",r);var i=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{element:e,pad:i}),i},La.prototype.close=function(){this.isOpen()&&(this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},La.prototype.isOpen=function(e){return!(!this._current||e&&this._current.element!==e)};var $a={__depends__:[fr,Sr],contextPad:["type",La]},Fa="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},Ua="connect-ok",za="connect-not-ok";function Wa(e,r,u,n,i,y){function l(e,t){return n.allowed("connection.create",{source:e,target:t})}e.on("connect.move",function(e){var t,n,o,r,i,a,s,c,u,l=e.context,p=l.source,f=l.target,d=l.visual,h=l.sourcePosition;t={x:e.x,y:e.y},o=h,r=t,i=p,a=f,s=y.getShapePath(i),c=a&&y.getShapePath(a),u=y.getConnectionPath({waypoints:[o,r]}),wn(d,{points:[(n=[o=Oa(s,u,!0)||o,r=a&&Oa(c,u,!1)||r])[0].x,n[0].y,n[1].x,n[1].y]})}),e.on("connect.hover",function(e){var t,n=e.context,o=n.source,r=e.hover;null!==(t=n.canExecute=l(o,r))&&(n.target=r,i.addMarker(r,t?Ua:za))}),e.on(["connect.out","connect.cleanup"],function(e){var t=e.context;t.target&&i.removeMarker(t.target,t.canExecute?Ua:za),t.target=null,t.canExecute=!1}),e.on("connect.cleanup",function(e){var t=e.context;t.visual&&jn(t.visual)}),e.on("connect.start",function(e){var t,n=e.context;wn(t=Dn("polyline"),{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"}),mn(i.getDefaultLayer(),t),n.visual=t}),e.on("connect.end",function(e){var t=e.context,n=t.source,o=t.sourcePosition,r=t.target,i={x:e.x,y:e.y},a=t.canExecute||l(n,r);if(!a)return!1;var s=null,c={connectionStart:o,connectionEnd:i};"object"===(void 0===a?"undefined":Fa(a))&&(s=a),u.connect(n,r,s,c)}),this.start=function(e,t,n,o){"object"!==(void 0===n?"undefined":Fa(n))&&(o=n,n=ka(t)),r.init(e,"connect",{autoActivate:o,data:{shape:t,context:{source:t,sourcePosition:n}}})}}Wa.$inject=["eventBus","dragging","modeling","rules","canvas","graphicsFactory"];var Ha={__depends__:[br,gi,vi],connect:["type",Wa]},Ga="drop-ok",qa="drop-not-ok",Ka="attach-ok",Xa="new-parent";function Za(e,o,c,u,i,a,s){function l(t,n){[Ka,Ga,qa,Xa].forEach(function(e){e===n?i.addMarker(t,e):i.removeMarker(t,e)})}e.on("create.move",function(e){var t,n=e.context,o=e.hover,r=n.shape,i=n.source,a={x:e.x,y:e.y};t=n.canExecute=o&&function(e,t,n,o){if(!t)return!1;var r,i,a,s={source:n,shape:e,target:t,position:o};return(i=c.allowed("shape.attach",s))||(r=c.allowed("shape.create",s)),(r||i)&&(a=n&&c.allowed("connection.create",{source:n,target:e,hints:{targetParent:t,targetAttach:i}})),!(!r&&!i)&&{attach:i,connect:a}}(r,o,i,a),o&&null!==t&&(n.target=o,t&&t.attach?l(o,Ka):l(o,t?Xa:qa))}),e.on("create.move",750,function(e){var t=e.context,n=t.shape,o=t.visual;o||(o=t.visual=function(e){var t,n,o;wn(t=Dn("g"),a.cls("djs-drag-group",["no-events"])),mn(i.getDefaultLayer(),t),Sn(n=Dn("g")).add("djs-dragger"),mn(t,n),Do(n,e.width/-2,e.height/-2);var r=Dn("g");return Sn(r).add("djs-visual"),mn(n,r),o=r,s.drawShape(o,e),t}(n)),Do(o,e.x,e.y)}),e.on(["create.end","create.out","create.cleanup"],function(e){var t=e.context.target;t&&l(t,null)}),e.on("create.end",function(e){var t=e.context,n=t.source,o=t.shape,r=t.target,i=t.canExecute,a=i&&i.attach,s=i&&i.connect,c={x:e.x,y:e.y};if(!i)return!1;o=s?u.appendShape(n,o,c,r,{attach:a,connection:!0===s?{}:s}):u.createShape(o,c,r,{attach:a}),t.shape=o}),e.on("create.cleanup",function(e){var t=e.context;t.visual&&jn(t.visual)}),this.start=function(e,t,n){o.init(e,"create",{cursor:"grabbing",autoActivate:!0,data:{shape:t,context:{shape:t,source:n}}})}}Za.$inject=["eventBus","dragging","rules","modeling","canvas","styles","graphicsFactory"];var Ya={__depends__:[vi,br,gi],create:["type",Za]},Ja="data-id";function Qa(e,t,n){var o=c(e&&e.scale)?e.scale:{min:1,max:1.5};this._config={scale:o},this._eventBus=t,this._canvas=n,this._providers={},this._current={}}Qa.$inject=["config.popupMenu","eventBus","canvas"],Qa.prototype.registerProvider=function(e,t){this._providers[e]=t},Qa.prototype.isEmpty=function(e,t){if(!e)throw new Error("element parameter is missing");if(!t)throw new Error("providerId parameter is missing");var n=this._providers[t],o=n.getEntries(e),r=n.getHeaderEntries&&n.getHeaderEntries(e),i=0'),t=this._current.position,n=this._current.className;return R(e.style,{position:"absolute",left:t.x+"px",top:t.y+"px",visibility:"hidden"}),st(e).add(n),e},Qa.prototype._attachContainer=function(e,t,n){var o=this;_t.bind(e,".entry","click",function(e){o.trigger(e)}),this._updateScale(e),t.appendChild(e),n&&this._assureIsInbounds(e,n),this._bindHandlers()},Qa.prototype._updateScale=function(e){var t,n,o,r,i=this._canvas.zoom(),a=this._config.scale,s=i;!0!==a&&(n=!1===a?t=1:(t=a.min,a.max),c(t)&&ir.width&&(u.x=!0),a+c>r.height&&(u.y=!0),u.x&&u.y?(n=l-s+"px",o=p-c+"px"):u.x?(n=l-s+"px",o=p+"px"):u.y&&p"),o=this;return st(n).add(t),w(e,function(e){var t=o._createEntry(e,n);n.appendChild(t)}),n},Qa.prototype._createEntry=function(e){if(!e.id)throw new Error("every entry must have the id property set");var t=wt("
"),n=st(t);if(n.add("entry"),e.className&&e.className.split(" ").forEach(function(e){n.add(e)}),nt(t,Ja,e.id),e.label){var o=wt("");o.textContent=e.label,t.appendChild(o)}return e.imageUrl&&t.appendChild(wt('')),!0===e.active&&n.add("active"),!0===e.disabled&&n.add("disabled"),e.title&&(t.title=e.title),t},Qa.prototype._bindHandlers=function(){var e=this._eventBus,t=this;function n(){t.close()}e.once("contextPad.close",n),e.once("canvas.viewbox.changing",n),e.once("commandStack.changed",n)},Qa.prototype._unbindHandlers=function(){var e=this._eventBus,t=this;function n(){t.close()}e.off("contextPad.close",n),e.off("canvas.viewbox.changed",n),e.off("commandStack.changed",n)};var es={__init__:["popupMenu"],popupMenu:["type",Qa]},ts=Math.round;function ns(e){this._modeling=e}ns.$inject=["modeling"],ns.prototype.replaceElement=function(e,t,n){var o=this._modeling,r=null;return e.waypoints||(t.x=ts(e.x+(t.width||e.width)/2),t.y=ts(e.y+(t.height||e.height)/2),r=o.replaceShape(e,t,n)),r};var os={__init__:["replace"],replace:["type",ns]};function rs(p,f,e,t){this.replaceElement=function(e,t,n){n=n||{};var o=t.type,r=e.businessObject,i=p.create(o),a={type:o,businessObject:i};if(a.width=e.width,a.height=e.height,i.name=r.name,t.table){var s=p.create("dmn:DecisionTable");(i.decisionTable=s).$parent=i;var c=p.create("dmn:OutputClause");c.typeRef="string",(c.$parent=s).output=[c];var u=p.create("dmn:InputClause");u.$parent=s;var l=p.create("dmn:LiteralExpression",{typeRef:"string"});(u.inputExpression=l).$parent=u,s.input=[u]}return t.expression&&(i.literalExpression=p.create("dmn:LiteralExpression"),i.variable=p.create("dmn:InformationItem")),f.replaceElement(e,a,n)}}rs.$inject=["drdFactory","replace","selection","modeling"];var is={__depends__:[os,br],drdReplace:["type",rs]},as=[{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 ss(e,t,n,o,r,i){this._popupMenu=e,this._modeling=t,this._moddle=n,this._drdReplace=o,this._rules=r,this._translate=i,this.register()}ss.$inject=["popupMenu","modeling","moddle","drdReplace","rules","translate"],ss.prototype.register=function(){this._popupMenu.registerProvider("dmn-replace",this)},ss.prototype.getEntries=function(e){var r=e.businessObject;if(!this._rules.allowed("shape.replace",{element:e}))return[];if(Ht(r,"dmn:Decision")){var t=h(as,function(e){var t="replace-with-empty-decision"===e.actionName&&(r.decisionTable||r.literalExpression),n="replace-with-decision-table"===e.actionName&&!r.decisionTable,o="replace-with-literal-expression"===e.actionName&&!r.literalExpression;return t||n||o});return this._createEntries(e,t)}return[]},ss.prototype._createEntries=function(n,e){var o=[],r=this;return w(e,function(e){var t=r._createMenuEntry(e,n);o.push(t)}),o},ss.prototype._createMenuEntry=function(e,t,n){var o=this._drdReplace.replaceElement;return n=n||function(){return o(t,e.target)},{label:(0,this._translate)(e.label),className:e.className,id:e.actionName,action:n}},ss.prototype.getHeaderEntries=function(e){return[]};var cs={__depends__:[or,es,is],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",ss]};function us(e,o,t,n,r,i,a,s,c,u){o.registerProvider(this),this._contextPad=o,this._modeling=t,this._elementFactory=n,this._connect=r,this._create=i,this._rules=a,this._popupMenu=s,this._canvas=c,this._translate=u,e.on("create.end",250,function(e){var t=e.context.shape;if(ur(e)){var n=o.getEntries(t);n.replace&&n.replace.action.click(e,t)}})}us.$inject=["eventBus","contextPad","modeling","elementFactory","connect","create","rules","popupMenu","canvas","translate"],us.prototype.getContextPadEntries=function(t){var n=this._modeling,i=this._elementFactory,o=this._connect,a=this._create,u=this._popupMenu,l=this._canvas,p=this._contextPad,e=this._rules,s=this._translate,r={};if("label"===t.type)return r;var c=t.businessObject;function f(e,t,n){o.start(e,t,n)}function d(o,e,t,r){function n(e,t){var n=i.createShape(R({type:o},r));a.start(e,n,t)}return"string"!=typeof t&&(r=t,t=s("Append {type}",{type:o.replace(/^dmn:/,"")})),{group:"model",className:e,title:t,action:{dragstart:n,click:n}}}Xt(c,["dmn:InputData","dmn:BusinessKnowledgeModel","dmn:KnowledgeSource","dmn:Decision"])&&R(r,{"append.decision":d("dmn:Decision","dmn-icon-decision")}),Xt(c,["dmn:InputData","dmn:Decision","dmn:KnowledgeSource"])&&R(r,{"append.knowledge-source":d("dmn:KnowledgeSource","dmn-icon-knowledge-source")}),Xt(c,["dmn:BusinessKnowledgeModel","dmn:KnowledgeSource"])&&R(r,{"append.business-knowledge-model":d("dmn:BusinessKnowledgeModel","dmn-icon-business-knowledge")}),Xt(c,["dmn:Decision"])&&R(r,{"append.input-data":d("dmn:InputData","dmn-icon-input-data")}),Ht(c,"dmn:DRGElement")&&R(r,{"append.text-annotation":d("dmn:TextAnnotation","dmn-icon-text-annotation"),connect:{group:"connect",className:"dmn-icon-connection-multi",title:s("Connect using Information/Knowledge/Authority Requirement or Association"),action:{click:f,dragstart:f}}}),u.isEmpty(t,"dmn-replace")||R(r,{replace:{group:"edit",className:"dmn-icon-screw-wrench",title:s("Change type"),action:{click:function(e,t){var n,o,r,i,a,s,c=R((n=t,o=l.getContainer(),r=p.getPad(n).html,i=o.getBoundingClientRect(),a=r.getBoundingClientRect(),s=a.top-i.top,{x:a.left-i.left,y:s+a.height+5}),{cursor:{x:e.x,y:e.y}});u.open(t,"dmn-replace",c)}}}});var h=e.allowed("elements.delete",{elements:[t]});return y(h)&&(h=h[0]===t),h&&R(r,{delete:{group:"edit",className:"dmn-icon-trash",title:s("Remove"),action:{click:function(e){n.removeElements([t])}}}}),r};var ls={__depends__:[or,$a,br,Ha,Ya,cs],__init__:["contextPadProvider"],contextPadProvider:["type",us]};function ps(e,t,n){this._eventBus=e,this._modeling=t,this._canvas=n,e.on("definitionIdView.create",function(e){var t=e.html,n=Ot(".dmn-definitions-name",t),o=Ot(".dmn-definitions-id",t);this._setup(n,"name"),this._setup(o,"id")},this)}ps.$inject=["eventBus","modeling","canvas"],ps.prototype.update=function(e,t){var n={};n[e]=t,this._modeling.updateProperties(this._canvas.getRootElement(),n)},ps.prototype._setup=function(t,n){var o=this;t.setAttribute("contenteditable",!0),t.addEventListener("input",j(function(e){var t=e.target.value||e.target.textContent;o.update(n,t.trim())},300)),t.addEventListener("keydown",function(e){13===e.keyCode&&(t.blur(),window.getSelection().removeAllRanges())})};var fs={__init__:["definitionPropertiesEdit","definitionPropertiesPaletteAdapter"],definitionPropertiesEdit:["type",ps],definitionPropertiesPaletteAdapter:["type",jr]},ds="is not a registered action";function hs(e,t){this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}function ys(e,t){return new Error(e+" "+t)}hs.$inject=["eventBus","injector"],hs.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),o=e.get("modeling",!1),r=e.get("selection",!1),n=e.get("zoomScroll",!1),i=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("mouseTracking",!1),u=e.get("keyboardMove",!1),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),i&&r&&this.register("copy",function(){var e=r.get();i.copy(e)}),c&&i&&this.register("paste",function(){var e=c.getHoverContext();i.paste(e)}),n&&this.register("stepZoom",function(e){n.stepZoom(e.value)}),a&&this.register("zoom",function(e){a.zoom(e.value)}),o&&r&&s&&this.register("removeSelection",function(){var e=r.get();if(e.length){var t,n=s.allowed("elements.delete",{elements:e});!1!==n&&(t=y(n)?n:e).length&&o.removeElements(t.slice())}}),u&&this.register("moveCanvas",function(e){u.moveCanvas(e)}),l&&this.register("moveSelection",function(e){l.moveSelection(e.direction,e.accelerated)})},hs.prototype.trigger=function(e,t){if(!this._actions[e])throw ys(e,ds);return this._actions[e](t)},hs.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);w(e,function(e,t){n._registerAction(t,e)})},hs.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw ys(e,"is already registered");this._actions[e]=t},hs.prototype.unregister=function(e){if(!this.isRegistered(e))throw ys(e,ds);this._actions[e]=void 0},hs.prototype.getActions=function(){return Object.keys(this._actions)},hs.prototype.isRegistered=function(e){return!!this._actions[e]};var vs={__init__:["editorActions"],editorActions:["type",hs]};function ms(e){e.invoke(hs,this)}en(ms,hs),ms.$inject=["injector"],ms.prototype._registerDefaultActions=function(e){hs.prototype._registerDefaultActions.call(this,e);var n=e.get("canvas",!1),o=e.get("elementRegistry",!1),r=e.get("selection",!1),t=e.get("lassoTool",!1),i=e.get("directEditing",!1);n&&o&&r&&this._registerAction("selectElements",function(){var t=n.getRootElement(),e=o.filter(function(e){return e!==t});return r.select(e),e}),t&&this._registerAction("lassoTool",function(){t.toggle()}),r&&i&&this._registerAction("directEditing",function(){var e=r.get();e.length&&i.activate(e[0])})};var gs={__depends__:[vs],editorActions:["type",ms]};function bs(e){return i(e.drgElements,_s)}function _s(e){var t=e.extensionElements,n=t&&t.values;return n&&g(n,function(e){return Ht(e,"biodi:Bounds")})}function ws(e,i,a){e.on("import.start",function(e){var r,t=e.definitions;bs(t)||(r=0,w(t.drgElements,function(e){var t,n,o;Ht(e,"dmn:Decision")&&((n=e.extensionElements)||((n=e.extensionElements=i.createDi()).$parent=e),o=a._getDefaultSize(e),t=i.createDiBounds({x:150+30*r,y:150+30*r,width:o.width,height:o.height}),n.get("values").push(t),t.$parent=n,r++)}))})}ws.$inject=["eventBus","drdFactory","elementFactory"];var xs={__init__:["diGenerator"],diGenerator:["type",ws]};function Cs(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Es(e,t){return-1<(e=y(e)?e:[e]).indexOf(t.key)}function ks(e){return e.shiftKey}var Ss="keyboard.keydown";function Os(e,t){var n=this;this._config=e||{},this._eventBus=t,this._keyHandler=this._keyHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),t.on("diagram.init",function(){n._fire("init")}),t.on("attach",function(){e&&e.bindTo&&n.bind(e.bindTo)}),t.on("detach",function(){n.unbind()})}Os.$inject=["config.keyboard","eventBus"],Os.prototype._keyHandler=function(e){var t=e.target;if(!(n=t)||!St(n,"input, textarea")&&"true"!==n.contentEditable){var n,o={keyEvent:e};this._eventBus.fire(Ss,o)&&e.preventDefault()}},Os.prototype.bind=function(e){this.unbind(),this._node=e,gt.bind(e,"keydown",this._keyHandler,!0),this._fire("bind")},Os.prototype.getBinding=function(){return this._node},Os.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),gt.unbind(e,"keydown",this._keyHandler,!0)),this._node=null},Os.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Os.prototype.addListener=function(e,t){p(e)&&(t=e,e=1e3),this._eventBus.on(Ss,e,t)},Os.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},Os.prototype.isCmd=Cs,Os.prototype.isShift=ks,Os.prototype.isKey=Es;var js=500;function Ps(e,n){var o=this;e.on("editorActions.init",js,function(e){var t=e.editorActions;o.registerBindings(n,t)})}Ps.$inject=["eventBus","keyboard"],Ps.prototype.registerBindings=function(n,o){function e(e,t){o.isRegistered(e)&&n.addListener(t)}e("undo",function(e){var t=e.keyEvent;if(Cs(t)&&!ks(t)&&Es(["z","Z"],t))return o.trigger("undo"),!0}),e("redo",function(e){var t=e.keyEvent;if(Cs(t)&&(Es(["y","Y"],t)||Es(["z","Z"],t)&&ks(t)))return o.trigger("redo"),!0}),e("copy",function(e){var t=e.keyEvent;if(Cs(t)&&Es(["c","C"],t))return o.trigger("copy"),!0}),e("paste",function(e){var t=e.keyEvent;if(Cs(t)&&Es(["v","V"],t))return o.trigger("paste"),!0}),e("stepZoom",function(e){var t=e.keyEvent;if(Es(["+","Add"],t)&&Cs(t))return o.trigger("stepZoom",{value:1}),!0}),e("stepZoom",function(e){var t=e.keyEvent;if(Es(["-","Subtract"],t)&&Cs(t))return o.trigger("stepZoom",{value:-1}),!0}),e("zoom",function(e){var t=e.keyEvent;if(Es("0",t)&&Cs(t))return o.trigger("zoom",{value:1}),!0}),e("removeSelection",function(e){if(Es(["Delete","Del"],e.keyEvent))return o.trigger("removeSelection"),!0})};var Ts={__init__:["keyboard","keyboardBindings"],keyboard:["type",Os],keyboardBindings:["type",Ps]};function Rs(e){e.invoke(Ps,this)}en(Rs,Ps),Rs.$inject=["injector"],Rs.prototype.registerBindings=function(n,o){function e(e,t){o.isRegistered(e)&&n.addListener(t)}Ps.prototype.registerBindings.call(this,n,o),e("selectElements",function(e){var t=e.keyEvent;if(n.isKey(["a","A"],t)&&n.isCmd(t))return o.trigger("selectElements"),!0}),e("lassoTool",function(e){var t=e.keyEvent;if(!n.hasModifier(t))return n.isKey(["l","L"],t)?(o.trigger("lassoTool"),!0):void 0}),e("directEditing",function(e){var t=e.keyEvent;if(!n.hasModifier(t))return n.isKey(["e","E"],t)?(o.trigger("directEditing"),!0):void 0})};var As={__depends__:[Ts],__init__:["keyboardBindings"],keyboardBindings:["type",Rs]},Ds={moveSpeed:50,moveSpeedAccelerated:200};function Ms(e,i,r){var a=this;this._config=R({},Ds,e||{}),i.addListener(function(e){var t=e.keyEvent,n=a._config;if(!i.isCmd(t))return;if(i.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],t)){var o,r=i.isShift(t)?n.moveSpeedAccelerated:n.moveSpeed;switch(t.key){case"ArrowLeft":case"Left":o="left";break;case"ArrowUp":case"Up":o="up";break;case"ArrowRight":case"Right":o="right";break;case"ArrowDown":case"Down":o="down"}return a.moveCanvas({speed:r,direction:o}),!0}}),this.moveCanvas=function(e){var t=0,n=0,o=e.speed/Math.min(Math.sqrt(r.viewbox().scale),1);switch(e.direction){case"left":t=o;break;case"up":n=o;break;case"right":t=-o;break;case"down":n=-o}r.scroll({dx:t,dy:n})}}Ms.$inject=["config.keyboardMove","keyboard","canvas"];var Bs={__depends__:[Ts],__init__:["keyboardMove"],keyboardMove:["type",Ms]},Is={moveSpeed:1,moveSpeedAccelerated:10},Ns={ArrowLeft:"left",Left:"left",ArrowUp:"up",Up:"up",ArrowRight:"right",Right:"right",ArrowDown:"down",Down:"down"},Vs={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function Ls(e,r,i,a){var s=this;this._config=R({},Is,e||{}),r.addListener(1500,function(e){var t=e.keyEvent,n=Ns[t.key];if(n&&!r.isCmd(t)){var o=r.isShift(t);return s.moveSelection(n,o),!0}}),this.moveSelection=function(e,t){var n=a.get();if(n.length){var o=this._config[t?"moveSpeedAccelerated":"moveSpeed"],r=Vs[e](o);i.moveElements(n,r)}}}Ls.$inject=["config.keyboardMoveSelection","keyboard","modeling","selection"];var $s={__depends__:[Ts,br],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Ls]};function Fs(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[]},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Fs.$inject=["eventBus","injector"],Fs.prototype.execute=function(e,t){if(!e)throw new Error("command required");var n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction(n)},Fs.prototype.canExecute=function(e,t){var n={command:e,context:t},o=this._getHandler(e),r=this._fire(e,"canExecute",n);if(void 0===r){if(!o)return!1;o.canExecute&&(r=o.canExecute(t))}return r},Fs.prototype.clear=function(e){this._stack.length=0,!(this._stackIdx=-1)!==e&&this._fire("changed")},Fs.prototype.undo=function(){var e,t=this._getUndoAction();if(t){for(this._pushAction(t);t&&(this._internalUndo(t),(e=this._getUndoAction())&&e.id===t.id);)t=e;this._popAction()}},Fs.prototype.redo=function(){var e,t=this._getRedoAction();if(t){for(this._pushAction(t);t&&(this._internalExecute(t,!0),(e=this._getRedoAction())&&e.id===t.id);)t=e;this._popAction()}},Fs.prototype.register=function(e,t){this._setHandler(e,t)},Fs.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");var n=this._injector.instantiate(t);this.register(e,n)},Fs.prototype.canUndo=function(){return!!this._getUndoAction()},Fs.prototype.canRedo=function(){return!!this._getRedoAction()},Fs.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Fs.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Fs.prototype._internalUndo=function(e){var t=this,n=e.command,o=e.context,r=this._getHandler(n);this._atomicDo(function(){t._fire(n,"revert",e),r.revert&&t._markDirty(r.revert(o)),t._revertedAction(e),t._fire(n,"reverted",e)})},Fs.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);var o,r,i,a=t?[e+"."+t,t]:[e];for(n=this._eventBus.createEvent(n),o=0;(r=a[o])&&(i=this._eventBus.fire("commandStack."+r,n),!n.cancelBubble);o++);return i},Fs.prototype._createId=function(){return this._uid++},Fs.prototype._atomicDo=function(e){var t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Fs.prototype._internalExecute=function(e,t){var n=this,o=e.command,r=e.context,i=this._getHandler(o);if(!i)throw new Error("no command handler registered for <"+o+">");this._pushAction(e),t||(this._fire(o,"preExecute",e),i.preExecute&&i.preExecute(r),this._fire(o,"preExecuted",e)),this._atomicDo(function(){n._fire(o,"execute",e),i.execute&&n._markDirty(i.execute(r)),n._executedAction(e,t),n._fire(o,"executed",e)}),t||(this._fire(o,"postExecute",e),i.postExecute&&i.postExecute(r),this._fire(o,"postExecuted",e)),this._popAction(e)},Fs.prototype._pushAction=function(e){var t=this._currentExecution,n=t.actions,o=n[0];if(t.atomic)throw new Error("illegal invocation in or phase (action: "+e.command+")");e.id||(e.id=o&&o.id||this._createId()),n.push(e)},Fs.prototype._popAction=function(){var e=this._currentExecution,t=e.actions,n=e.dirty;t.pop(),t.length||(this._eventBus.fire("elements.changed",{elements:function(t){t=s(t);for(var n={},e=arguments.length,o=Array(1");this._handlerMap[e]=t};var Us={commandStack:["type",Fs]};function zs(n,o,r,i){n.on("element.changed",function(e){var t=e.element;(t.parent||t===o.getRootElement())&&(e.gfx=r.getGraphics(t)),e.gfx&&n.fire(ro(t)+".changed",e)}),n.on("elements.changed",function(e){var t=e.elements;t.forEach(function(e){n.fire("element.changed",{element:e})}),i.updateContainments(t)}),n.on("shape.changed",function(e){i.update("shape",e.element,e.gfx)}),n.on("connection.changed",function(e){i.update("connection",e.element,e.gfx)})}zs.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var Ws={__init__:["changeSupport"],changeSupport:["type",zs]},Hs=Math.min,Gs=Math.max;function qs(e){e.preventDefault()}function Ks(e){e.stopPropagation()}function Xs(e){this.container=e.container,this.parent=wt('
'),this.content=Ot("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=P(this.autoResize,this),this.handlePaste=P(this.handlePaste,this)}function Zs(e,t){this._eventBus=e,this._providers=[],this._textbox=new Xs({container:t.getContainer(),keyHandler:P(this._handleKey,this),resizeHandler:P(this._handleResize,this)})}Xs.prototype.create=function(e,t,n,o){var r=this.parent,i=this.content,a=this.container;o=this.options=o||{};var s=A(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);R(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},s);var c=A(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return R(i.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},c),o.centerVertically&&R(i.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},c),i.innerText=n,gt.bind(i,"keydown",this.keyHandler),gt.bind(i,"mousedown",Ks),gt.bind(i,"paste",this.handlePaste),o.autoResize&>.bind(i,"input",this.autoResize),o.resizable&&this.resizable(t),a.appendChild(r),this.setSelection(i.lastChild,i.lastChild&&i.lastChild.length),r},Xs.prototype.handlePaste=function(e){var n,t,o=this,r=this.options,i=this.style;if(e.preventDefault(),n=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),!document.execCommand("insertHTML",!1,n)){var a,s,c=this.getSelection(),u=c.startContainer,l=c.endContainer,p=c.startOffset,f=c.endOffset,d=c.commonAncestorContainer,h=(t=d.childNodes,[].slice.call(t));if(d.nodeType===Node.TEXT_NODE){var y=u.textContent;u.textContent=y.substring(0,p)+n+y.substring(f),a=u,s=p+n.length}else if(u===this.content&&l===this.content){var v=document.createTextNode(n);this.content.insertBefore(v,h[p]),s=(a=v).textContent.length}else{var m=h.indexOf(u),g=h.indexOf(l);h.forEach(function(e,t){t===m?e.textContent=u.textContent.substring(0,p)+n+l.textContent.substring(f):me.offsetHeight||t.scrollHeight
');var n=function(e){qs(e),Ks(e);var t=Hs(Gs(p+e.clientX-u,i),s),n=Hs(Gs(f+e.clientY-l,a),c);r.style.width=t+"px",r.style.height=n+"px",o.resizeHandler({width:p,height:f,dx:e.clientX-u,dy:e.clientY-l})},d=function e(t){qs(t),Ks(t),gt.unbind(document,"mousemove",n,!1),gt.unbind(document,"mouseup",e,!1)};gt.bind(e,"mousedown",function(e){qs(e),Ks(e),u=e.clientX,l=e.clientY;var t=r.getBoundingClientRect();p=t.width,f=t.height,gt.bind(document,"mousemove",n),gt.bind(document,"mouseup",d)})}R(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"}),r.appendChild(e)},Xs.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),gt.unbind(t,"keydown",this.keyHandler),gt.unbind(t,"mousedown",Ks),gt.unbind(t,"input",this.autoResize),gt.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),Pt(n)),Pt(e)},Xs.prototype.getValue=function(){return this.content.innerText},Xs.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Xs.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var o=window.getSelection();o.removeAllRanges(),o.addRange(n)},Zs.$inject=["eventBus","canvas"],Zs.prototype.registerProvider=function(e){this._providers.push(e)},Zs.prototype.isActive=function(){return!!this._active},Zs.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Zs.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Zs.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},Zs.prototype.complete=function(){var e=this._active;if(e){var t=this.getValue(),n=this.$textbox.getBoundingClientRect();(t!==e.context.text||this.resizable)&&e.provider.update(e.element,t,e.context.text,{x:n.top,y:n.left,width:n.width,height:n.height}),this._fire("complete"),this.close()}},Zs.prototype.getValue=function(){return this._textbox.getValue()},Zs.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())},Zs.prototype._handleResize=function(e){this._fire("resize",e)},Zs.prototype.activate=function(t){var n;this.isActive()&&this.cancel();var e=g(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};var Ys={__depends__:[fr],__init__:["directEditing"],directEditing:["type",Zs]};function Js(e){return Ht(e,"dmn:Decision")||Ht(e,"dmn:BusinessKnowledgeModel")||Ht(e,"dmn:InputData")||Ht(e,"dmn:KnowledgeSource")?"name":Ht(e,"dmn:TextAnnotation")?"text":void 0}function Qs(e){var t=e.businessObject,n=Js(t);if(n)return t[n]||""}function ec(){function t(e,t){var n,o,r,i,a,s=e.label||e,c=e.labelTarget||e;return o=t,r=c!==(n=s),i=n.businessObject,(a=Js(i))&&(i[a]=o),r&&(n.hidden=!o),[s,c]}this.execute=function(e){return e.oldLabel=Qs(e.element),t(e.element,e.newLabel)},this.revert=function(e){return t(e.element,e.oldLabel)}}function tc(e,t,n,o){this._canvas=t,this._commandStack=o,n.registerProvider(this),o.registerHandler("element.updateLabel",ec),e.on("element.dblclick",function(e){n.activate(e.element)}),e.on(["element.mousedown","drag.init","canvas.viewbox.changed"],function(e){n.complete()}),e.on(["commandStack.changed"],function(){n.cancel()}),e.on("create.end",500,function(e){var t=e.shape;(Ht(t,"dmn:Decision")||Ht(t,"dmn:InputData")||Ht(t,"dmn:BusinessKnowledgeModel")||Ht(t,"dmn:KnowledgeSource"))&&n.activate(t)})}tc.$inject=["eventBus","canvas","directEditing","commandStack"],tc.prototype.activate=function(e){var t=Qs(e);if(void 0!==t){var n=this.getEditingBBox(e);return n.text=t,n}},tc.prototype.getEditingBBox=function(e){var t,n=this._canvas,o=e.label||e,r=n.getAbsoluteBBox(o),i={x:r.x,y:r.y},a={};return t=n.zoom(),i.height=1
'),u.appendChild(o));var r,i,a,s=e.html||(e.separator?'
':'
'),c=wt(s);o.appendChild(c),e.separator||(nt(c,"data-action",t),e.title&&nt(c,"title",e.title),e.className&&(r=c,i=e.className,a=st(r),(y(i)?i:i.split(/\s+/g)).forEach(function(e){a.add(e)})),e.imageUrl&&c.appendChild(wt('')))}),this.open()},Ou.prototype.trigger=function(e,t,n){var o,r,i,a=this._entries,s=t.delegateTarget||t.target;if(!s)return t.preventDefault();(o=a[nt(s,"data-action")])&&(r=o.action,i=t.originalEvent||t,p(r)?"click"===e&&r(i,n):r[e]&&r[e](i,n),t.preventDefault())},Ou.prototype._layoutChanged=function(){this._toggleState({})},Ou.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},Ou.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ou.prototype.open=function(){this._toggleState({open:!0})},Ou.prototype.toggle=function(e){this.isOpen()?this.close():this.open()},Ou.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ou.prototype.updateToolHighlight=function(o){var e;this._toolsContainer||(e=Ot(".djs-palette-entries",this._container),this._toolsContainer=Ot("[data-group=tools]",e)),w(this._toolsContainer.children,function(e){var t=e.getAttribute("data-action");if(t){var n=st(e);t=t.replace("-tool",""),n.contains("entry")&&t===o?n.add("highlighted-entry"):n.remove("highlighted-entry")}})},Ou.prototype.isOpen=function(){return st(this._container).has("open")},Ou.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ou.HTML_MARKUP='
';var ju={__init__:["palette"],palette:["type",Ou]};function Pu(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}Pu.$inject=["eventBus","dragging"],Pu.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)},Pu.prototype.isActive=function(e){return e&&this._active===e},Pu.prototype.length=function(e){return this._tools.length},Pu.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Pu.prototype.bindEvents=function(t,e){var n=this._eventBus,o=this._dragging,r=[];n.on(e.tool+".init",function(e){if(!e.context.reactivate&&this.isActive(t))return this.setActive(null),void o.cancel();this.setActive(t)},this),w(e,function(e){r.push(e+".ended"),r.push(e+".canceled")}),n.on(r,250,function(e){var t=e.originalEvent;this._active&&(t&&ht(t.target,'.group[data-group="tools"]')||this.setActive(null))},this)};var Tu={__depends__:[vi],__init__:["toolManager"],toolManager:["type",Pu]},Ru="crosshair";function Au(n,o,e,r,t,i){this._selection=t,this._dragging=e;var a=this,s=function(e){var t,n=o.getDefaultLayer();wn(t=e.frame=Dn("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),mn(n,t)},c=function(e){var t=e.frame,n=e.bbox;wn(t,{x:n.x,y:n.y,width:n.width,height:n.height})},u=function(e){e.frame&&jn(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(){a.activateLasso(e.originalEvent,!0)})}),n.on("lasso.end",function(e){var t=Du(e),n=r.filter(function(e){return e});a.select(n,t)}),n.on("lasso.start",function(e){var t=e.context;t.bbox=Du(e),s(t)}),n.on("lasso.move",function(e){var t=e.context;t.bbox=Du(e),c(t)}),n.on("lasso.cleanup",function(e){var t=e.context;u(t)}),n.on("element.mousedown",1500,function(e){if(n=ir(t=e)||t,cr(t)&&n.shiftKey)return a.activateLasso(e.originalEvent),!0;var t,n})}function Du(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y};return t.x<=n.x&&t.yn.x&&(o[e.id]=e),!l(n.x)&&t.y>n.y&&(o[e.id]=e),t.x>n.x&&t.y>n.y&&(l(n.width)&&l(n.height)&&t.width+t.x";var t=e.id?' id="'+e.id+'"':"";return"<"+e.$type+t+" />"}function Yp(s,e){function c(e,t,n){if(e.gfx)throw new Error("already rendered "+Zp(e));return s.element(e,t,n)}function u(e,t,n){w(e,function(e){c(e,t,n)})}function l(e,t,n){w(e,function(e){c(e,t,n)})}return{handleDecision:function(e){e.id||(e.id="decision");var t=e.decisionTable;if(!t)throw new Error("no table for "+Zp(e));if(!t.output)throw new Error("missing output for "+Zp(t));var n,o,r,i,a=(i=t,s.table(i));t.input&&u(t.input,a,t),u(t.output,a,t),n=t.rule,o=a,r=t,w(n,function(e){c(e,o,r),l(e.inputEntry,e),l(e.outputEntry,e)})}}}function Jp(){return _l(1,"th","annotation header",xl("Annotation"),2,{rowspan:"3"})}var Qp="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},ef="function"==typeof Symbol&&"symbol"===Qp(Symbol.iterator)?function(e){return void 0===e?"undefined":Qp(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":Qp(e)},tf=Object.assign||function(e){for(var t=1;t: cannot combine with non-fn component value");o[e]=function(r){for(var e=arguments.length,i=Array(1";case"COUNT":return"#";default:return""}}(e.aggregation)],0,{rowspan:"3",title:"Hit Policy = "+t})}}]),t}();function vd(e){e.onGetComponent("cell",function(e){if("before-label-cells"===e.cellType)return yd})}vd.$inject=["components"];var md={__init__:["hitPolicyProvider"],hitPolicyProvider:["type",vd]},gd="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},bd=function(){function o(e,t){for(var n=0;n')}}]),o}(),Nd="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},Vd=function(){function o(e,t){for(var n=0;n");var a=parseInt(o,10);if(isNaN(a))return e;return{row:n,col:"left"===t?a-1:a+1}}(t,e),a=(o=c,r=(n=i).row+":"+n.col,Ot('[data-coords="'+Pi(r)+'"]',o));if(!a)return!1;var s=dh(a);return s&&l(s,{focussed:!0,selected:!0}),!0}},n.on("contextMenu.close",function(){if(u)return l(u)})}gh.$inject=["config.renderer","eventBus","sheet","selection","elementRegistry"];var bh={__depends__:[Kd,Wd],__init__:["cellSelection"],cellSelection:["type",gh]};function _h(){}_h.prototype.get=function(){return this._data},_h.prototype.set=function(e){this._data=e},_h.prototype.clear=function(){var e=this._data;return delete this._data,e},_h.prototype.isEmpty=function(){return!this._data};var wh={clipboard:["type",_h]},xh="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},Ch=function(){function o(e,t){for(var n=0;n=o.length}),this.addRule("col.remove",2e3,function(e){var t=e.col,n=r._sheet.getRoot().cols;return!qt(t)||1]/,Jh=function(e){var t,n=""+e,o=Yh.exec(n);if(!o)return n;var r="",i=0,a=0;for(i=o.index;ie.length?(o=t,e):(o=e,t);se.length?{newStart:n.l_start,newEnd:n.l_end,type:"add"}:{newStart:n.s_start,newEnd:n.s_end,type:t.length")+"
",_l(1,"div",[o||"","content-editable"].join(" "),null,1,{contentEditable:"true",spellcheck:"false",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})}}]),r}();function iy(e){return e.innerText.replace(/\n$/,"")}function ay(){}var sy="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},cy=function(){function o(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=r.scrollLeft,s=r.scrollTop,c={};if(t.x+t.width/2>i.width/2){var u=t.x-i.left-o.width+n.x+a;u=Py(u,0+a,i.width-o.width+a),c.left=u+"px"}else{var l=window.scrollX-i.left+t.x+t.width-n.x+a;l=Py(l,0+a,i.width-o.width+a),c.left=l+"px"}var p=void 0;p=t.y+t.height/2>i.height/2?Py(p=t.y-i.top-o.height+n.y+s,0+s,i.height-o.height+s):Py(p=window.scrollY-i.top+t.y-n.y+s,0+s,i.height-o.height+s),c.top=p+"px",c.overflowY="auto",c.maxHeight=i.height-p+s+"px",R(this.node.style,c)}},{key:"render",value:function(){var e=this.props,n=e.context,t=e.components;return _l(1,"div",e.className,t.map(function(e,t){return wl(2,e,{context:n},t)}),0,{onContextMenu:function(e){return e.preventDefault()}},null,this.setNode)}}]),n}();function Py(e,t,n){return Math.max(t,Math.min(n,e))}jy.$inject=["renderer"];var Ty="\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";var Ry=function(){function o(e,t){for(var n=0;n'),this.renderer.getContainer().appendChild(this._portalEl)}},{key:"removePortalEl",value:function(){this._portalEl&&(Pt(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=this.props.options,n=this.state.value;if(t){var o=t.filter(function(e){return e.value===n})[0],r=o?t.indexOf(o):-1,i=-1===r?1===e?0:t.length-1:(r+e)%t.length,a=t[i<0?t.length+i:i];this.onChange(a.value)}}},{key:"setOptionsVisible",value:function(e){this.setState({optionsVisible:e})}},{key:"renderOptions",value:function(e,n){var o=this;return _l(1,"div","options",e.map(function(t){return _l(1,"div",["option",n===t?"active":""].join(" "),t.label,0,{"data-value":t.value,onClick:function(e){return o.onOptionClick(t.value,e)}})}),0)}},{key:"render",value:function(){var e,t,n=this,o=this.props,r=o.className,i=o.options,a=o.noInput,s=this.state,c=s.optionsVisible,u=s.value,l=!!i&&i.filter(function(e){return e.value===u})[0],p=l?l.label:u;return _l(1,"div",[r||"","dms-input-select"].join(" "),[a?_l(1,"div","dms-input",p,0,{tabindex:"0",onKeyDown:this.onKeyDown},null,function(e){return n.inputNode=e}):_l(64,"input","dms-input",null,1,{onInput:this.onInput,onKeyDown:this.onKeyDown,spellcheck:"false",type:"text",value:u},null,function(e){return n.inputNode=e}),_l(1,"span",["dms-input-select-icon",c?"dmn-icon-up":"dmn-icon-down"].join(" ")),c&&(e=this.renderOptions(i,l),t=this._portalEl,_l(1024,t,null,e,0,null,pl(e)?null:e.key,null))],0,{onClick:this.onInputClick},null,function(e){return n.parentNode=e})}}]),r}(),gv=function(){var o=this;this.onChange=function(e){o.setState({value:e});var t=o.props.onChange;"function"==typeof t&&t(e)},this.onInputClick=function(e){e.preventDefault(),e.stopPropagation(),o.setOptionsVisible(!o.state.optionsVisible),o.focusInput()},this.onInput=function(e){var t=e.target.value;o.onChange(t)},this.onOptionClick=function(e,t){t.preventDefault(),t.stopPropagation(),o.setOptionsVisible(!1),o.onChange(e),o.focusInput()},this.onFocusChanged=function(e){o.checkClose(e.target)},this.onGlobalClick=function(e){o.checkClose(e.target)},this.onKeyDown=function(e){var t=o.state.optionsVisible,n=e.which;40!==n&&38!==n||(e.stopPropagation(),e.preventDefault(),t?o.select(40===n?1:-1):o.setOptionsVisible(!0)),t&&(13!==n&&27!==n||(e.stopPropagation(),e.preventDefault(),o.setOptionsVisible(!1)))},this.onKeyboard=function(e){if(o.state.optionsVisible)return 27===e?(o.setOptionsVisible(!1),!0):void 0}};mv.$inject=["keyboard","renderer"];var bv="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},_v=function(){function o(e,t){for(var n=0;no.indexOf(t)&&(r=t,a=(i=o).indexOf(r),t=i[Math.min(i.length-1,a+1)]);var r,i,a;return n===fm?(s=t,u=(c=o).indexOf(s),c[Math.max(0,u-1)]):t;var s,c,u}(o,s,i,d._sheet.getRoot().rows);if(c===o)return;return c}if(o instanceof Hu){var u=_m(n,r),l=r.dataset.colId,p=d._elementRegistry.get(l);if(!p||p===o)return;var f=function(e,t,n,o){o.indexOf(e)>o.indexOf(t)&&(t=function(e,t){var n=t.indexOf(e);if(Gt(e)){var o=t.filter(function(e){return Gt(e)}),r=o[o.length-1],i=t.indexOf(r);return t[Math.min(i,n+1)]}return t[Math.min(t.length-1,n+1)]}(t,o));return n===ym?function(e,t){var n=t.indexOf(e);if(qt(e)){var o=t.filter(function(e){return qt(e)})[0],r=t.indexOf(o);return t[Math.max(r,n-1)]}return t[Math.max(0,n-1)]}(t,o):t}(o,p,u,d._sheet.getRoot().cols);if(f===o)return;return f}}),n.on("dragAndDrop.dragEnd",this._cleanup)}return pm(s,[{key:"startDrag",value:function(e,t){var n,o,r=this._renderer.getContainer();this._dragImage=wt(''),document.body.appendChild(this._dragImage),t.dataTransfer.setDragImage&&t.dataTransfer.setDragImage(this._dragImage,0,0),e instanceof Wu?(o=r,w(jt("[data-row-id="+e.id+"]",o),function(e){xm(e)&&st(e).add("dragged")})):e instanceof Hu&&(n=r,w(jt("[data-col-id="+e.id+"]",n),function(e){xm(e)&&st(e).add("dragged")})),this._dragAndDrop.startDrag(e,t)}}]),s}();function mm(e,t,n){var o=e.dataset.rowId;o&&w(jt("[data-row-id="+o+"]",t),function(e){xm(e)&&(st(e).add("dragover"),st(e).add(n))})}function gm(e,t,n){var o=e.dataset.colId;o&&w(jt("[data-col-id="+o+"]",t),function(e){xm(e)&&(st(e).add("dragover"),st(e).add(n))})}function bm(e){w(jt(".dragover",e),function(e){xm(e)&&(st(e).remove("dragover"),st(e).remove("top"),st(e).remove("right"),st(e).remove("bottom"),st(e).remove("left"))})}function _m(e,t){var n=t.getBoundingClientRect();return e.clientX";case"COUNT":return"#";default:return""}}(e.aggregation)],0,{"data-hit-policy":"true",title:"Hit Policy = "+t,onClick:this.onClick,rowspan:"3"})}}]),o}();ng.$inject=["changeSupport","sheet","eventBus"];var og="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},rg=function(){function o(e,t){for(var n=0;n")}o=n.create(r)}return function e(t,n,o){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var i=Object.getPrototypeOf(t);return null===i?void 0:e(i,n,o)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(o):void 0}(s.prototype.__proto__||Object.getPrototypeOf(s.prototype),"create",this).call(this,e,_g({businessObject:o,id:o.id},i))}}]),s}();xg.$inject=["dmnFactory"];var Cg="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},Eg=function(){function o(e,t){for(var n=0;n: cannot update values");var i=u.updateProperties(r,t),a=i.changed,s=i.oldProperties;return{changed:[].concat(Xg(e.changed),Xg(a),[r]),oldProperties:Gg({},e.oldProperties,Kg({},n,s))}}return"id"===n&&(o=t,c.id!==o)&&(l.unclaim(c.id),u._elementRegistry.updateId(c,t),l.claim(t,c)),c.set(n,t),{changed:e.changed,oldProperties:Gg({},e.oldProperties,Kg({},n,r))}},{changed:[],oldProperties:{}})}}]),n}();function Yg(e){return c(e)&&_(e)}Zg.$inject=["elementRegistry","moddle"];var Jg=function(){function o(e,t){for(var n=0;nr.width/2?s.left=window.scrollX-r.left+n.left-o.width+4+i+"px":s.left=window.scrollX-r.left+n.left+n.width-4+i+"px",n.top+n.height/2>r.height/2?s.top=window.scrollY-r.top+n.top-o.height+4+a+"px":s.top=window.scrollY-r.top+n.top-4+a+"px",R(this.node.style,s)}}},{key:"onClick",value:function(){if(!this.state.isDisabled){var e=this._selection.get();e&&(this._eventBus.fire("simpleMode.open",{element:e,node:hh(e.id,this._container)}),this.setState({isVisible:!1}))}}},{key:"render",value:function(){var t=this,e=this.state,n=e.isDisabled,o=e.isVisible,r=e.top,i=e.left,a=["simple-mode-button","no-deselect"];return n&&a.push("disabled"),o?_l(1,"div",a.join(" "),_l(1,"span","dmn-icon-edit"),2,{onClick:this.onClick,style:{top:r,left:i},title:n?"Editing not supported for set expression language":"Edit"},null,function(e){return t.node=e}):null}}]),a}();var Cb=function(){function o(e,t){for(var n=0;n)\s*date and time\("(\d{4}(?:-\d\d){2}T(?:\d\d:){2}\d\d)"\)/,Ib=/^date and time\("(\d{4}(?:-\d\d){2}T(?:\d\d:){2}\d\d)"\)$/;function Nb(e){if(!Db.test(e.trim()))return"Date must match pattern yyyy-MM-ddTHH:mm:ss."}function Vb(e,t){return"exact"===e?'date and time("'+t[0]+'")':"before"===e?'< date and time("'+t[0]+'")':"after"===e?'> date and time("'+t[0]+'")':"between"===e?'[date and time("'+t[0]+'")..date and time("'+t[1]+'")]':void 0}function Lb(){var e=new Date;return e.setUTCHours(0,0,0,0),e.toISOString().slice(0,-5)}function $b(e){if(!e||""===e.trim())return{type:"exact",date:""};var t=e.match(Mb);return t?{type:"between",dates:[t[1],t[2]]}:(t=e.match(Bb))?{type:"<"===t[1]?"before":"after",date:t[2]}:(t=e.match(Ib))?{type:"exact",date:t[1]}:void 0}var Fb="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},Ub=function(){function o(e,t){for(var n=0;n|=){0,2})\s*(-?(?:[0-9]|\.[0-9])+)$/,Qb=/^(\[|\]){1}(-?(?:[0-9]|\.[0-9])+){1,}\.\.(-?(?:[0-9]|\.[0-9])+){1,}(\[|\]){1}$/,e_={equals:"=",less:"<",lessEquals:"<=",greater:">",greaterEquals:">="};function t_(e){if(!e||""===e.trim())return{type:"comparison"};var t,n,o,r=e.match(Jb),i=e.match(Qb);if(r){if((o=r)[0]&&o[1]&&!o[2]&&!o[3])return{type:"comparison",value:parseFloat(r[1]),operator:"equals"};if((n=r)[0]&&!n[1]&&n[2]&&n[3])return{type:"comparison",value:parseFloat(r[3]),operator:(t=r[2],m(e_).filter(function(e){return t===e_[e]})[0])}}else if(i)return{type:"range",values:[i[2],i[3]].map(function(e){return parseFloat(e)}),start:"]"===i[1]?"exclude":"include",end:"["===i[4]?"exclude":"include"}}function n_(e,t){return"equals"===e?""+t:e_[e]+" "+t}function o_(e,t,n,o){return""+("exclude"===n?"]":"[")+e+".."+t+("exclude"===o?"[":"]")}var r_="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},i_=function(){function o(e,t){for(var n=0;n')}}]),o}(),kw="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},Sw=function(){function o(e,t){for(var n=0;n