camunda-dmn-js
Version:
Embeddable Camunda modeling distributions based on dmn-js
1 lines • 1.18 MB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).DmnModeler=t()}(this,(function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function t(e,t,n){return t=r(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,n||[],r(e).constructor):t.apply(e,n))}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,h(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e,t,n){return(t=h(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},r(e)}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(s=function(){return!!e})()}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function u(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(t,n){if(t){if("string"==typeof t)return e(t,n);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?e(t,n):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}const d=Object.prototype.toString,p=Object.prototype.hasOwnProperty;function f(e){return void 0===e}function g(e){return void 0!==e}function m(e){return null==e}function v(e){return"[object Array]"===d.call(e)}function y(e){return"[object Object]"===d.call(e)}function b(e){return"[object Number]"===d.call(e)}function _(e){const t=d.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function x(e){return"[object String]"===d.call(e)}function w(e,t){return!m(e)&&p.call(e,t)}function k(e,t){const n=I(t);let i;return O(e,(function(e,t){if(n(e,t))return i=e,!1})),i}function C(e,t){const n=I(t);let i=[];return O(e,(function(e,t){n(e,t)&&i.push(e)})),i}function O(e,t){let n,i;if(f(e))return;const o=v(e)?N:j;for(let r in e)if(w(e,r)&&(n=e[r],i=t(n,o(r)),!1===i))return n}function E(e,t,n){return O(e,(function(e,i){n=t(n,e,i)})),n}function S(e,t){return!!E(e,(function(e,n,i){return e&&t(n,i)}),!0)}function P(e,t){return!!k(e,t)}function T(e,t){let n=[];return O(e,(function(e,i){n.push(t(e,i))})),n}function R(e){return e&&Object.keys(e)||[]}function A(e){return T(e,(e=>e))}function M(e,t,n={}){return t=B(t),O(e,(function(e){let i=t(e)||"_",o=n[i];o||(o=n[i]=[]),o.push(e)})),n}function D(e,...t){e=B(e);let n={};return O(t,(t=>M(t,e,n))),T(n,(function(e,t){return e[0]}))}function $(e,t){t=B(t);let n=[];return O(e,(function(e,i){let o=t(e,i),r={d:o,v:e};for(var s=0;s<n.length;s++){let{d:e}=n[s];if(o<e)return void n.splice(s,0,r)}n.push(r)})),T(n,(e=>e.v))}function L(e){return function(t){return S(e,(function(e,n){return t[n]===e}))}}function B(e){return _(e)?e:t=>t[e]}function I(e){return _(e)?e:t=>t===e}function j(e){return e}function N(e){return Number(e)}function q(e,t){let n,i,o,r;function s(n){let s=Date.now(),c=n?0:r+t-s;if(c>0)return a(c);e.apply(o,i),l()}function a(e){n=setTimeout(s,e)}function l(){n&&clearTimeout(n),n=r=i=o=void 0}function c(...e){r=Date.now(),i=e,o=this,n||a(t)}return c.flush=function(){n&&s(!0),l()},c.cancel=l,c}function F(e,t){return e.bind(t)}function V(e,...t){return Object.assign(e,...t)}function z(e,t,n){let i=e;return O(t,(function(e,o){if("number"!=typeof e&&"string"!=typeof e)throw new Error("illegal key type: "+typeof e+". Key should be of type number or string.");if("constructor"===e)throw new Error("illegal key: constructor");if("__proto__"===e)throw new Error("illegal key: __proto__");let r=t[o+1],s=i[e];g(r)&&m(s)&&(s=i[e]=isNaN(+r)?{}:[]),f(r)?f(n)?delete i[e]:i[e]=n:i=s})),e}function H(e,t){let n={},i=Object(e);return O(t,(function(t){t in i&&(n[t]=e[t])})),n}function W(e,t){let n={};return O(Object(e),(function(e,i){-1===t.indexOf(i)&&(n[i]=e)})),n}var Q="__fn",U=Array.prototype.slice;function X(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function G(){}function K(){}function Y(e,t){this.model=e,this.properties=t}X.prototype.on=function(e,t,n,i){if(e=v(e)?e:[e],_(t)&&(i=n,n=t,t=1e3),!b(t))throw new Error("priority must be a number");var o=n;i&&((o=F(n,i))[Q]=n[Q]||n);var r=this;e.forEach((function(e){r._addListener(e,{priority:t,callback:o,next:null})}))},X.prototype.once=function(e,t,n,i){var o=this;if(_(t)&&(i=n,n=t,t=1e3),!b(t))throw new Error("priority must be a number");function r(){r.__isTomb=!0;var t=n.apply(i,arguments);return o.off(e,r),t}r[Q]=n,this.on(e,t,r)},X.prototype.off=function(e,t){e=v(e)?e:[e];var n=this;e.forEach((function(e){n._removeListener(e,t)}))},X.prototype.createEvent=function(e){var t=new G;return t.init(e),t},X.prototype.fire=function(e,t){var n,i,o,r;if(r=U.call(arguments),"object"==typeof e&&(e=(t=e).type),!e)throw new Error("no event type specified");if(i=this._listeners[e]){n=t instanceof G?t:this.createEvent(t),r[0]=n;var s=n.type;e!==s&&(n.type=e);try{o=this._invokeListeners(n,r,i)}finally{e!==s&&(n.type=s)}return void 0===o&&n.defaultPrevented&&(o=!1),o}},X.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},X.prototype._destroy=function(){this._listeners={}},X.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},X.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=function(e,t){return e.apply(null,t)}(n.callback,t),void 0!==i&&(e.returnValue=i,e.stopPropagation()),!1===i&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener",e),e}return i},X.prototype._addListener=function(e,t){var n,i=this._getListeners(e);if(i){for(;i;){if(i.priority<t.priority)return t.next=i,void(n?n.next=t:this._setListeners(e,t));n=i,i=i.next}n.next=t}else this._setListeners(e,t)},X.prototype._getListeners=function(e){return this._listeners[e]},X.prototype._setListeners=function(e,t){this._listeners[e]=t},X.prototype._removeListener=function(e,t){var n,i,o,r=this._getListeners(e);if(t)for(;r;)n=r.next,(o=r.callback)!==t&&o[Q]!==t||(i?i.next=n:this._setListeners(e,n)),i=r,r=n;else this._setListeners(e,null)},G.prototype.stopPropagation=function(){this.cancelBubble=!0},G.prototype.preventDefault=function(){this.defaultPrevented=!0},G.prototype.init=function(e){V(this,e||{})},K.prototype.get=function(e){return this.$model.properties.get(this,e)},K.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},Y.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(K.prototype);O(e.properties,(function(e){e.isMany||void 0===e.default||(i[e.name]=e.default)})),n.defineModel(i,t),n.defineDescriptor(i,e);var o=e.ns.name;function r(e){n.define(this,"$type",{value:o,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),O(e,F((function(e,t){this.set(t,e)}),this))}return r.prototype=i,r.hasType=i.$instanceOf=this.model.hasType,n.defineModel(r,t),n.defineDescriptor(r,e),r};var Z={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},J={String:function(e){return e},Boolean:function(e){return"true"===e},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}};function ee(e,t){var n=J[e];return n?n(t):t}function te(e){return!!Z[e]}function ne(e){return!!J[e]}function ie(e,t){var n,i,o=e.split(/:/);if(1===o.length)n=e,i=t;else{if(2!==o.length)throw new Error("expected <prefix:localName> or <localName>, got "+e);n=o[1],i=o[0]}return{name:e=(i?i+":":"")+n,prefix:i,localName:n}}function oe(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function re(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,O(e,F(this.registerPackage,this))}function se(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function ae(e){this.model=e}function le(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function ce(e){return e.replace(/^:/,"")}function ue(e,t={}){this.properties=new ae(this),this.factory=new Y(this,this.properties),this.registry=new re(e,this.properties),this.typeCache={},this.config=t}oe.prototype.build=function(){return H(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},oe.prototype.addProperty=function(e,t,n){"boolean"==typeof t&&(n=t,t=void 0),this.addNamedProperty(e,!1!==n);var i=this.properties;void 0!==t?i.splice(t,0,e):i.push(e)},oe.prototype.replaceProperty=function(e,t,n){var i=e.ns,o=this.properties,r=this.propertiesByName,s=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var a=o.indexOf(e);if(-1===a)throw new Error("property <"+i.name+"> not found in property list");o.splice(a,1),this.addProperty(t,n?void 0:a,s),r[i.name]=r[i.localName]=t},oe.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=ie(o[0],i),s=ie(o[1],r.prefix).name,a=this.propertiesByName[s];if(!a)throw new Error("refined property <"+s+"> not found");this.replaceProperty(a,e,n),delete e.redefines},oe.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},oe.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},oe.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},oe.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},oe.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},oe.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},oe.prototype.hasProperty=function(e){return this.propertiesByName[e]},oe.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(O(e.properties,F((function(n){n=V({},n,{name:n.ns.localName,inherited:t}),Object.defineProperty(n,"definedBy",{value:e});var i=n.replaces,o=n.redefines;i||o?this.redefineProperty(n,i||o,i):(n.isBody&&this.setBodyProperty(n),n.isId&&this.setIdProperty(n),this.addProperty(n))}),this)),i.push(e),n[o]=e)},re.prototype.getPackage=function(e){return this.packageMap[e]},re.prototype.getPackages=function(){return this.packages},re.prototype.registerPackage=function(e){e=V({},e);var t=this.packageMap;se(t,e,"prefix"),se(t,e,"uri"),O(e.types,F((function(t){this.registerType(t,e)}),this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},re.prototype.registerType=function(e,t){var n=ie((e=V({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:V(e.meta||{})})).name,t.prefix),i=n.name,o={};O(e.properties,F((function(e){var t=ie(e.name,n.prefix),i=t.name;te(e.type)||(e.type=ie(e.type,t.prefix).name),V(e,{ns:t,name:i}),o[i]=e}),this)),V(e,{ns:n,name:i,propertiesByName:o}),O(e.extends,F((function(e){var t=ie(e,n.prefix),o=this.typeMap[t.name];o.traits=o.traits||[],o.traits.push(i)}),this)),this.definePackage(e,t),this.typeMap[i]=e},re.prototype.mapTypes=function(e,t,n){var i=te(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(n,i){var r=ie(n,te(n)?"":e.prefix);o.mapTypes(r,t,i)}function s(e){return r(e,!0)}if(!i)throw new Error("unknown type <"+e.name+">");O(i.superClass,n?s:function(e){return r(e,!1)}),t(i,!n),O(i.traits,s)},re.prototype.getEffectiveDescriptor=function(e){var t=ie(e),n=new oe(t);this.mapTypes(t,(function(e,t){n.addTrait(e,t)}));var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},re.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},ae.prototype.set=function(e,t,n){if(!x(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),o=i&&i.name;void 0===n?i?delete e[o]:delete e.$attrs[ce(t)]:i?o in e?e[o]=n:le(e,i,n):e.$attrs[ce(t)]=n},ae.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[ce(t)];var i=n.name;return!e[i]&&n.isMany&&le(e,n,[]),e[i]},ae.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;delete(n=V({},n,{get:function(){return i}})).value}Object.defineProperty(e,t,n)},ae.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},ae.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},ae.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const o=n.config.strict;if(void 0!==o){const n=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(o)throw n;"undefined"!=typeof console&&console.warn(n)}return null},ue.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},ue.prototype.getType=function(e){var t=this.typeCache,n=x(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},ue.prototype.createAny=function(e,t,n){var i=ie(e),o={$type:e,$instanceOf:function(e){return e===this.$type},get:function(e){return this[e]},set:function(e,t){z(this,[e],t)}},r={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(o,r),this.properties.defineModel(o,this),this.properties.define(o,"get",{enumerable:!1,writable:!0}),this.properties.define(o,"set",{enumerable:!1,writable:!0}),this.properties.define(o,"$parent",{enumerable:!1,writable:!0}),this.properties.define(o,"$instanceOf",{enumerable:!1,writable:!0}),O(n,(function(e,t){y(e)&&void 0!==e.value?o[e.name]=e.value:o[t]=e})),o},ue.prototype.getPackage=function(e){return this.registry.getPackage(e)},ue.prototype.getPackages=function(){return this.registry.getPackages()},ue.prototype.getElementDescriptor=function(e){return e.$descriptor},ue.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},ue.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},ue.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var he=String.fromCharCode,de=Object.prototype.hasOwnProperty,pe=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,fe={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function ge(e,t,n,i){return i?de.call(fe,i)?fe[i]:"&"+i+";":he(t||parseInt(n,16))}function me(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(pe,ge):e}Object.keys(fe).forEach((function(e){fe[e.toUpperCase()]=fe[e]}));var ve="non-whitespace outside of root node";function ye(e){return new Error(e)}function be(e){return"missing namespace for prefix <"+e+">"}function _e(e){return{get:e,enumerable:!0}}function xe(e){var t,n={};for(t in e)n[t]=e[t];return n}function we(e){return e+"$uri"}function ke(){return{line:0,column:0}}function Ce(e){throw e}function Oe(e){if(!this)return new Oe(e);var t,n,i,o,r,s,a,l,c,u=e&&e.proxy,h=Ce,d=ke,p=!1,f=!1,g=null,m=!1;function v(e){e instanceof Error||(e=ye(e)),g=e,h(e,d)}function y(e){r&&(e instanceof Error||(e=ye(e)),r(e,d))}this.on=function(e,c){if("function"!=typeof c)throw ye("required args <name, cb>");switch(e){case"openTag":n=c;break;case"text":t=c;break;case"closeTag":i=c;break;case"error":h=c;break;case"warn":r=c;break;case"cdata":o=c;break;case"attention":l=c;break;case"question":a=c;break;case"comment":s=c;break;default:throw ye("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw ye("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return f=!0,c=n,this},this.parse=function(e){if("string"!=typeof e)throw ye("required args <xml=string>");return g=null,function(e){var r,h,g,b,_,x,w,k,C,O,E,S=f?[]:null,P=f?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[we(n)]=t;return i}(c):null,T=[],R=0,A=!1,M=!1,D=0,$=0,L="",B=0;function I(){if(null!==E)return E;var e,t,n,i,o,r,s,a,l,u,h,d=f&&P.xmlns,g=f&&p?[]:null,m=B,v=L,b=v.length,_={},x={};e:for(;m<b;m++)if(l=!1,!(32===(u=v.charCodeAt(m))||u<14&&u>8)){for((u<65||u>122||u>90&&u<97)&&95!==u&&58!==u&&(y("illegal first char attribute name"),l=!0),h=m+1;h<b;h++)if(!((u=v.charCodeAt(h))>96&&u<123||u>64&&u<91||u>47&&u<59||46===u||45===u||95===u)){if(32===u||u<14&&u>8){y("missing attribute value"),m=h;continue e}if(61===u)break;y("illegal attribute name char"),l=!0}if("xmlns:xmlns"===(a=v.substring(m,h))&&(y("illegal declaration of xmlns"),l=!0),34===(u=v.charCodeAt(h+1)))-1===(h=v.indexOf('"',m=h+2))&&-1!==(h=v.indexOf("'",m))&&(y("attribute value quote missmatch"),l=!0);else if(39===u)-1===(h=v.indexOf("'",m=h+2))&&-1!==(h=v.indexOf('"',m))&&(y("attribute value quote missmatch"),l=!0);else for(y("missing attribute value quotes"),l=!0,h+=1;h<b&&!(32===(u=v.charCodeAt(h+1))||u<14&&u>8);h++);for(-1===h&&(y("missing closing quotes"),h=b,l=!0),l||(r=v.substring(m,h)),m=h;h+1<b&&!(32===(u=v.charCodeAt(h+1))||u<14&&u>8);h++)m===h&&(y("illegal character after attribute end"),l=!0);if(m=h+1,!l)if(a in x)y("attribute <"+a+"> already defined");else if(x[a]=!0,f)if(p){if(null!==(o="xmlns"===a?"xmlns":120===a.charCodeAt(0)&&"xmlns:"===a.substr(0,6)?a.substr(6):null)){if(e=me(r),t=we(o),!(s=c[e])){if("xmlns"===o||t in P&&P[t]!==e)do{s="ns"+R++}while(void 0!==P[s]);else s=o;c[e]=s}P[o]!==s&&(i||(P=xe(P),i=!0),P[o]=s,"xmlns"===o&&(P[we(s)]=e,d=s),P[t]=e),_[a]=r;continue}g.push(a,r)}else-1!==(u=a.indexOf(":"))?(n=P[a.substring(0,u)])?_[a=d===n?a.substr(u+1):n+a.substr(u)]=r:y(be(a.substring(0,u))):_[a]=r;else _[a]=r}if(p)for(m=0,b=g.length;m<b;m++){if(a=g[m++],r=g[m],-1!==(u=a.indexOf(":"))){if(!(n=P[a.substring(0,u)])){y(be(a.substring(0,u)));continue}a=d===n?a.substr(u+1):n+a.substr(u)}_[a]=r}return E=_}function j(){for(var t,n,i=/(\r\n|\r|\n)/g,o=0,r=0,s=0,a=$;D>=s&&(t=i.exec(e))&&!((a=t[0].length+t.index)>D);)o+=1,s=a;return-1==D?(r=a,n=e.substring($)):0===$?n=e.substring($,D):(r=D-s,n=-1==$?e.substring(D):e.substring(D,$+1)),{data:n,line:o,column:r}}d=j,u&&(O=Object.create({},{name:_e((function(){return k})),originalName:_e((function(){return C})),attrs:_e(I),ns:_e((function(){return P}))}));for(;-1!==$;){if(-1===(D=60===e.charCodeAt($)?$:e.indexOf("<",$)))return T.length?v("unexpected end of file"):0===$?v("missing start tag"):void($<e.length&&e.substring($).trim()&&y(ve));if($!==D)if(T.length){if(t&&(t(e.substring($,D),me,d),m))return}else if(e.substring($,D).trim()&&(y(ve),m))return;if(33===(_=e.charCodeAt(D+1))){if(91===(b=e.charCodeAt(D+2))&&"CDATA["===e.substr(D+3,6)){if(-1===($=e.indexOf("]]>",D)))return v("unclosed cdata");if(o&&(o(e.substring(D+9,$),d),m))return;$+=3;continue}if(45===b&&45===e.charCodeAt(D+3)){if(-1===($=e.indexOf("--\x3e",D)))return v("unclosed comment");if(s&&(s(e.substring(D+4,$),me,d),m))return;$+=3;continue}}if(63!==_){for(h=D+1;;h++){if(x=e.charCodeAt(h),isNaN(x))return $=-1,v("unclosed tag");if(34===x)h=-1!==(b=e.indexOf('"',h+1))?b:h;else if(39===x)h=-1!==(b=e.indexOf("'",h+1))?b:h;else if(62===x){$=h;break}}if(33!==_){if(E={},47===_){if(A=!1,M=!0,!T.length)return v("missing open tag");if(h=k=T.pop(),b=D+2+h.length,e.substring(D+2,b)!==h)return v("closing tag mismatch");for(;b<$;b++)if(!(32===(_=e.charCodeAt(b))||_>8&&_<14))return v("close tag")}else{if(47===e.charCodeAt($-1)?(h=k=e.substring(D+1,$-1),A=!0,M=!0):(h=k=e.substring(D+1,$),A=!0,M=!1),!(_>96&&_<123||_>64&&_<91||95===_||58===_))return v("illegal first char nodeName");for(b=1,g=h.length;b<g;b++)if(!((_=h.charCodeAt(b))>96&&_<123||_>64&&_<91||_>47&&_<59||45===_||95===_||46==_)){if(32===_||_<14&&_>8){k=h.substring(0,b),E=null;break}return v("invalid nodeName")}M||T.push(k)}if(f){if(r=P,A&&(M||S.push(r),null===E&&(p=-1!==h.indexOf("xmlns",b))&&(B=b,L=h,I(),p=!1)),C=k,-1!==(_=k.indexOf(":"))){if(!(w=P[k.substring(0,_)]))return v("missing namespace on <"+C+">");k=k.substr(_+1)}else w=P.xmlns;w&&(k=w+":"+k)}if(A&&(B=b,L=h,n&&(u?n(O,me,M,d):n(k,I,me,M,d),m)))return;if(M){if(i&&(i(u?O:k,me,A,d),m))return;f&&(P=A?r:S.pop())}$+=1}else{if(l&&(l(e.substring(D,$+1),me,d),m))return;$+=1}}else{if(-1===($=e.indexOf("?>",D)))return v("unclosed question");if(a&&(a(e.substring(D,$+2),d),m))return;$+=2}}}(e),d=ke,m=!1,g},this.stop=function(){m=!0}}function Ee(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var Se={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Pe="property";function Te(e){return e.xml&&e.xml.serialize}function Re(e,t){return Ee(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function Ae(e){return new Error(e)}function Me(e){return e.$descriptor}function De(e){V(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw Ae("expected element");var t,n=this.elementsById,i=Me(e).idProperty;if(i&&(t=e.get(i.name))){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(t))throw new Error("illegal ID <"+t+">");if(n[t])throw Ae("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function $e(){}function Le(){}function Be(){}function Ie(e,t){this.property=e,this.context=t}function je(e,t){this.element=t,this.propertyDesc=e}function Ne(){}function qe(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function Fe(e,t,n){qe.call(this,e,t,n)}function Ve(e,t,n){this.model=e,this.context=n}function ze(e){e instanceof ue&&(e={model:e}),V(this,{lax:!1},e)}$e.prototype.handleEnd=function(){},$e.prototype.handleText=function(){},$e.prototype.handleNode=function(){},Le.prototype=Object.create($e.prototype),Le.prototype.handleNode=function(){return this},Be.prototype=Object.create($e.prototype),Be.prototype.handleText=function(e){this.body=(this.body||"")+e},Ie.prototype=Object.create(Be.prototype),Ie.prototype.handleNode=function(e){if(this.element)throw Ae("expected no sub nodes");return this.element=this.createReference(e),this},Ie.prototype.handleEnd=function(){this.element.id=this.body},Ie.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},je.prototype=Object.create(Be.prototype),je.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=ee(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},Ne.prototype=Object.create(Be.prototype),Ne.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},qe.prototype=Object.create(Ne.prototype),qe.prototype.addReference=function(e){this.context.addReference(e)},qe.prototype.handleText=function(e){if(!Me(this.element).bodyProperty)throw Ae("unexpected body text <"+e+">");Be.prototype.handleText.call(this,e)},qe.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Me(t).bodyProperty;n&&void 0!==e&&(e=ee(n.type,e),t.set(n.name,e))},qe.prototype.createElement=function(e){var t,n=e.attributes,i=this.type,o=Me(i),r=this.context,s=new i({}),a=this.model;return O(n,(function(e,n){var i=o.propertiesByName[n];i&&i.isReference?i.isMany?O(e.split(" "),(function(e){r.addReference({element:s,property:i.ns.name,id:e})})):r.addReference({element:s,property:i.ns.name,id:e}):(i?e=ee(i.type,e):"xmlns"===n?n=":"+n:(t=ie(n,o.ns.prefix),a.getPackage(t.prefix)&&r.addWarning({message:"unknown attribute <"+n+">",element:s,property:n,value:e})),s.set(n,e))})),s},qe.prototype.getPropertyForNode=function(e){var t=ie(e.name),n=this.type,i=this.model,o=Me(n),r=t.name,s=o.propertiesByName[r];if(s&&!s.isAttr){const t=function(e){const t=Te(e);return t!==Pe&&(t||null)}(s);if(t){const n=e.attributes[t];if(n){const t=function(e,t,n){const i=ie(e,t.xmlns),o=ie(`${t[i.prefix]||i.prefix}:${i.localName}`);return function(e,t){var n=e.name,i=e.localName,o=t&&t.xml&&t.xml.typePrefix;return o&&0===i.indexOf(o)?e.prefix+":"+i.slice(o.length):n}(o,n.getPackage(o.prefix))}(n,e.ns,i);return V({},s,{effectiveType:Me(i.getType(t)).name})}}return s}var a=i.getPackage(t.prefix);if(a){const e=Re(t,a),n=i.getType(e);if(s=k(o.properties,(function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)})),s)return V({},s,{effectiveType:Me(n).name})}else if(s=k(o.properties,(function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type})),s)return s;throw Ae("unrecognized element <"+t.name+">")},qe.prototype.toString=function(){return"ElementDescriptor["+Me(this.type).name+"]"},qe.prototype.valueHandler=function(e,t){return new je(e,t)},qe.prototype.referenceHandler=function(e){return new Ie(e,this.context)},qe.prototype.handler=function(e){return"Element"===e?new Ve(this.model,e,this.context):new qe(this.model,e,this.context)},qe.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,ne(n=t.effectiveType||t.type))return this.valueHandler(t,i);var r=(o=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e)).element;return void 0!==r&&(t.isMany?i.get(t.name).push(r):i.set(t.name,r),t.isReference?(V(r,{element:i}),this.context.addReference(r)):r.$parent=i),o},Fe.prototype=Object.create(qe.prototype),Fe.prototype.createElement=function(e){var t=e.name,n=ie(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),s=r&&Re(n,r)||t;if(!o.hasType(s))throw Ae("unexpected element <"+e.originalName+">");return qe.prototype.createElement.call(this,e)},Ve.prototype=Object.create(Ne.prototype),Ve.prototype.createElement=function(e){var t=e.name,n=ie(t).prefix,i=e.ns[n+"$uri"],o=e.attributes;return this.model.createAny(t,i,o)},Ve.prototype.handleChild=function(e){var t=new Ve(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element;return void 0!==i&&((n.$children=n.$children||[]).push(i),i.$parent=n),t},Ve.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},ze.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof qe?(i=t,t={}):"string"==typeof t?(i=this.handler(t),t={}):"string"==typeof i&&(i=this.handler(i));var o=this.model,r=this.lax,s=new De(V({},t,{rootHandler:i})),a=new Oe({proxy:!0}),l=function(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}();function c(e,t,n){var i=t(),o=i.line,r=i.column,a=i.data;"<"===a.charAt(0)&&-1!==a.indexOf(" ")&&(a=a.slice(0,a.indexOf(" "))+">");var l="unparsable content "+(a?a+" ":"")+"detected\n\tline: "+o+"\n\tcolumn: "+r+"\n\tnested error: "+e.message;if(n)return s.addWarning({message:l,error:e}),!0;throw Ae(l)}function u(e,t){return c(e,t,!0)}i.context=s,l.push(i);var h=/^<\?xml /i,d=/ encoding="([^"]+)"/i,p=/^utf-8$/i;function f(e,t){try{l.peek().handleText(e)}catch(e){u(e,t)}}var g=o.getPackages().reduce((function(e,t){return e[t.uri]=t.prefix,e}),Object.entries(Se).reduce((function(e,[t,n]){return e[n]=t,e}),o.config&&o.config.nsMap||{}));return a.ns(g).on("openTag",(function(e,t,n,i){var o=e.attrs||{},s=Object.keys(o).reduce((function(e,n){var i=t(o[n]);return e[n]=i,e}),{});!function(e,t){var n=l.peek();try{l.push(n.handleNode(e))}catch(e){c(e,t,r)&&l.push(new Le)}}({name:e.name,originalName:e.originalName,attributes:s,ns:e.ns},i)})).on("question",(function(e){if(h.test(e)){var t=d.exec(e),n=t&&t[1];n&&!p.test(n)&&s.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}})).on("closeTag",(function(){l.pop().handleEnd()})).on("cdata",f).on("text",(function(e,t,n){!function(e,t){e.trim()&&f(e,t)}(t(e),n)})).on("error",c).on("warn",u),new Promise((function(t,n){var o;try{a.parse(e),function(){var e,t,n=s.elementsById,i=s.references;for(e=0;t=i[e];e++){var o=t.element,r=n[t.id],a=Me(o).propertiesByName[t.property];if(r||s.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),a.isMany){var l=o.get(a.name),c=l.indexOf(t);-1===c&&(c=l.length),r?l[c]=r:l.splice(c,1)}else o.set(a.name,r)}}()}catch(e){o=e}var r=i.element;o||r||(o=Ae("failed to parse document as <"+i.type.$descriptor.name+">"));var l=s.warnings,c=s.references,u=s.elementsById;return o?(o.warnings=l,n(o)):t({rootElement:r,elementsById:u,references:c,warnings:l})}))},ze.prototype.handler=function(e){return new Fe(this.model,e)};var He=/<|>|'|"|&|\n\r|\n/g,We=/<|>|&/g;function Qe(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}function Ue(e,t){return Ee(t)?function(e){return e.charAt(0).toLowerCase()+e.slice(1)}(e):e}function Xe(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Ge(e){return x(e)?e:(e.prefix?e.prefix+":":"")+e.localName}Qe.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Qe.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Qe.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Qe.prototype.add=function(e,t){this.uriMap[e.uri]=e,t?this.wellknown.push(e):this.custom.push(e),this.mapPrefix(e.prefix,e.uri)},Qe.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Qe.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Qe.prototype.getNSKey=function(e){return void 0!==e.prefix?e.uri+"|"+e.prefix:e.uri},Qe.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Qe.prototype.getUsed=function(e){return[].concat(this.wellknown,this.custom).filter((e=>{var t=this.getNSKey(e);return this.used[t]}))};var Ke={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},Ye={"<":"lt",">":"gt","&":"amp"};function Ze(e,t,n){return(e=x(e)?e:""+e).replace(t,(function(e){return"&"+n[e]+";"}))}function Je(e){this.tagName=e}function et(){}function tt(e){this.tagName=e}function nt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function it(e,t,n){nt.call(this,e,t),this.serialization=n}function ot(){this.value="",this.write=function(e){this.value+=e}}function rt(e,t){var n=[""];this.append=function(t){return e.write(t),this},this.appendNewLine=function(){return t&&e.write("\n"),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function st(e){return e=V({format:!1,preamble:!0},e||{}),{toXML:function(t,n){var i=n||new ot,o=new rt(i,e.format);e.preamble&&o.append('<?xml version="1.0" encoding="UTF-8"?>\n');var r=new nt,s=t.$model;if(r.getNamespaces().mapDefaultPrefixes(function(e){const t=e.config&&e.config.nsMap||{},n={};for(const e in Se)n[e]=Se[e];for(const e in t){n[t[e]]=e}for(const t of e.getPackages())n[t.prefix]=t.uri;return n}(s)),r.build(t).serializeTo(o),!n)return i.value}}}function at(e,t){ue.call(this,e,t)}Je.prototype.build=function(e){return this.element=e,this},Je.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},et.prototype.serializeValue=et.prototype.serializeTo=function(e){e.append(this.escape?Ze(this.value,We,Ye):this.value)},et.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(We)&&(this.escape=!0),this},Xe(tt,et),tt.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},nt.prototype.build=function(e){this.element=e;var t,n,i=e.$descriptor,o=this.propertyDescriptor,r=i.isGeneric;return t=r?this.parseGenericNsAttributes(e):this.parseNsAttributes(e),this.ns=o?this.nsPropertyTagName(o):this.nsTagName(i),this.tagName=this.addTagName(this.ns),r?this.parseGenericContainments(e):(n=function(e){return C(e.$descriptor.properties,(function(t){var n=t.name;if(t.isVirtual)return!1;if(!w(e,n))return!1;var i=e[n];return i!==t.default&&null!==i&&(!t.isMany||i.length)}))}(e),this.parseAttributes(C(n,(function(e){return e.isAttr}))),this.parseContainments(function(e){return C(e,(function(e){return!e.isAttr}))}(n))),this.parseGenericAttributes(e,t),this},nt.prototype.nsTagName=function(e){return function(e,t){return t.isGeneric?V({localName:t.ns.localName},e):V({localName:Ue(t.ns.localName,t.$pkg)},e)}(this.logNamespaceUsed(e.ns),e)},nt.prototype.nsPropertyTagName=function(e){return function(e,t){return V({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},nt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},nt.prototype.nsAttributeName=function(e){var t;if(t=x(e)?ie(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}:V({localName:t.localName},n)},nt.prototype.parseGenericNsAttributes=function(e){return Object.entries(e).filter((([t,n])=>!t.startsWith("$")&&this.parseNsAttribute(e,t,n))).map((([e,t])=>({name:e,value:t})))},nt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push((new et).build({type:"String"},t));var n=e.$children;n&&O(n,(e=>{this.body.push(new nt(this).build(e))}))},nt.prototype.parseNsAttribute=function(e,t,n){var i,o=e.$model,r=ie(t);if("xmlns"===r.prefix&&(i={prefix:r.localName,uri:n}),r.prefix||"xmlns"!==r.localName||(i={uri:n}),!i)return{name:t,value:n};if(o&&o.getPackage(n))this.logNamespace(i,!0,!0);else{var s=this.logNamespaceUsed(i,!0);this.getNamespaces().logUsed(s)}},nt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return O(n,(function(n,o){var r=t.parseNsAttribute(e,o,n);r&&i.push(r)})),i},nt.prototype.parseGenericAttributes=function(e,t){var n=this;O(t,(function(t){try{n.addAttribute(n.nsAttributeName(t.name),t.value)}catch(n){"undefined"!=typeof console&&console.warn(`missing namespace information for <${t.name}=${t.value}> on`,e,n)}}))},nt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;O(e,(function(e){var o=i.get(e.name),r=e.isReference;if(e.isMany||(o=[o]),e.isBody)n.push((new et).build(e,o[0]));else if(ne(e.type))O(o,(function(i){n.push(new tt(t.addTagName(t.nsPropertyTagName(e))).build(e,i))}));else if(r)O(o,(function(i){n.push(new Je(t.addTagName(t.nsPropertyTagName(e))).build(i))}));else{var s=Te(e);O(o,(function(i){var o;o=s?s===Pe?new nt(t,e):new it(t,e,s):new nt(t),n.push(o.build(i))}))}}))},nt.prototype.getNamespaces=function(e){var t,n=this.namespaces,i=this.parent;return n||(t=i&&i.getNamespaces(),e||!t?this.namespaces=n=new Qe(t):n=t),n},nt.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),o=e.uri,r=e.prefix;return i.byUri(o)&&!n||i.add(e,t),i.mapPrefix(r,o),e},nt.prototype.logNamespaceUsed=function(e,t){var n,i,o,r=this.getNamespaces(t),s=e.prefix,a=e.uri;if(!s&&!a)return{localName:e.localName};if(o=r.defaultUriByPrefix(s),!(a=a||o||r.uriByPrefix(s)))throw new Error("no namespace uri given for prefix <"+s+">");if((e=r.byUri(a))||s||(e=this.logNamespace({uri:a},o===a,!0)),!e){for(n=s,i=1;r.uriByPrefix(n);)n=s+"_"+i++;e=this.logNamespace({prefix:n,uri:a},o===a)}return s&&r.mapPrefix(s,a),e},nt.prototype.parseAttributes=function(e){var t=this,n=this.element;O(e,(function(e){var i=n.get(e.name);if(e.isReference)if(e.isMany){var o=[];O(i,(function(e){o.push(e.id)})),i=o.join(" ")}else i=i.id;t.addAttribute(t.nsAttributeName(e),i)}))},nt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Ge(e)},nt.prototype.addAttribute=function(e,t){var n=this.attrs;x(t)&&(t=Ze(t,He,Ke));var i=function(e,t){const n=I(t);let i=v(e)?-1:void 0;return O(e,(function(e,t){if(n(e,t))return i=t,!1})),i}(n,(function(t){return t.name.localName===e.localName&&t.name.uri===e.uri&&t.name.prefix===e.prefix})),o={name:e,value:t};-1!==i?n.splice(i,1,o):n.push(o)},nt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=function(e){return e.getUsed().filter((function(e){return"xml"!==e.prefix})).map((function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}}))}(n).concat(t)),O(t,(function(t){e.append(" ").append(Ge(t.name)).append('="').append(t.value).append('"')}))},nt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==et;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),O(this.body,(function(t){t.serializeTo(e)})),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()},Xe(it,nt),it.prototype.parseNsAttributes=function(e){var t=nt.prototype.parseNsAttributes.call(this,e).filter((e=>e.name!==this.serialization)),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var o=e.$model.getPackage(i.uri),r=o.xml&&o.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+r+n.ns.localName),t},it.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},at.prototype=Object.create(ue.prototype),at.prototype.fromXML=function(e,t,n){x(t)||(n=t,t="dmn:Definitions");var i=new ze(V({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},at.prototype.toXML=function(e,t){var n=new st(t);return new Promise((function(t,i){try{return t({xml:n.toXML(e)})}catch(e){return i(e)}}))};var lt={dc:{name:"DC",prefix:"dc",uri:"http://www.omg.org/spec/DMN/20180521/DC/",types:[{name:"Dimension",properties:[{name:"width",isAttr:!0,type:"Real"},{name:"height",isAttr:!0,type:"Real"}]},{name:"Bounds",properties:[{name:"height",isAttr:!0,type:"Real"},{name:"width",isAttr:!0,type:"Real"},{name:"x",isAttr:!0,type:"Real"},{name:"y",isAttr:!0,type:"Real"}]},{name:"Point",properties:[{name:"x",isAttr:!0,type:"Real"},{name:"y",isAttr:!0,type:"Real"}]},{name:"Color",properties:[{name:"red",type:"UML_Standard_Profile.mdzip:eee_1045467100323_917313_65"},{name:"green",type:"UML_Standard_Profile.mdzip:eee_1045467100323_917313_65"},{name:"blue",type:"UML_Standard_Profile.mdzip:eee_1045467100323_917313_65"}]}],associations:[],enumerations:[{name:"AlignmentKind",literalValues:[{name:"start"},{name:"center"},{name:"end"}]}]},di:{name:"DI",prefix:"di",uri:"http://www.omg.org/spec/DMN/20180521/DI/",types:[{name:"DiagramElement",isAbstract:!0,properties:[{name:"extension",type:"Extension"},{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"style",isReference:!0,type:"Style",xml:{serialize:"property"}},{name:"sharedStyle",isReference:!0,isVirtual:!0,type:"Style"}]},{name:"Diagram",superClass:["DiagramElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"}]},{name:"Shape",isAbstract:!0,properties:[{name:"bounds",type:"dc:Bounds"}],superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,properties:[{name:"waypoint",type:"dc:Point",isMany:!0,xml:{serialize:"property"}}],superClass:["DiagramElement"]},{name:"Style",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"}]},{name:"Extension",properties:[{name:"values",isMany:!0,type:"Element"}]}],associations:[],enumerations:[],xml:{tagAlias:"lowerCase"}},dmn:{name:"DMN",prefix:"dmn",uri:"https://www.omg.org/spec/DMN/20191111/MODEL/",types:[{name:"AuthorityRequirement",superClass:["DMNElement"],properties:[{name:"requiredAuthority",type:"DMNElementReference",xml:{serialize:"property"}},{name:"requiredDecision",type:"DMNElementReference",xml:{serialize:"property"}},{name:"requiredInput",type:"DMNElementReference",xml:{serialize:"property"}}]},{name:"ItemDefinition",superClass:["NamedElement"],properties:[{name:"typeRef",type:"String"},{name:"allowedValues",type:"UnaryTests",xml:{serialize:"property"}},{name:"typeLanguage",type:"String",isAttr:!0},{name:"itemComponent",type:"ItemDefinition",isMany:!0,xml:{serialize:"property"}},{name:"functionItem",type:"FunctionItem"},{name:"isCollection",isAttr:!0,type:"Boolean"}]},{name:"Definitions",superClass:["NamedElement"],properties:[{name:"import",type:"Import",isMany:!0},{name:"itemDefinition",type:"ItemDefinition",isMany:!0},{name:"drgElement",type:"DRGElement",isMany:!0},{name:"artifact",type:"Artifact",isMany:!0},{name:"elementCollection",type:"ElementCollection",isMany:!0},{name:"businessContextElement",type:"BusinessContextElement",isMany:!0},{name:"namespace",type:"String",isAttr:!0},{name:"expressionLanguage",type:"String",isAttr:!0},{name:"typeLanguage",type:"String",isAttr:!0},{name:"exporter",isAttr:!0,type:"String"},{name:"exporterVersion",isAttr:!0,type:"String"},{name:"dmnDI",type:"dmndi:DMNDI"}]},{name:"KnowledgeSource",superClass:["DRGElement"],properties:[{name:"authorityRequirement",type:"AuthorityRequirement",isMany:!0},{name:"type",type:"String"},{name:"owner",type:"DMNElementReference",xml:{serialize:"property"}},{name:"locationURI",type:"String",isAttr:!0}]},{name:"DecisionRule",superClass:["DMNElement"],properties:[{name:"inputEntry",type:"UnaryTests",isMany:!0,xml:{serialize:"property"}},{name:"outputEntry",type:"LiteralExpression",isMany:!0,xml:{serialize:"property"}},{name:"annotationEntry",type:"RuleAnnotation",isMany:!0,xml:{serialize:"property"}}]},{name:"Expression",isAbstract:!0,superClass:["DMNElement"],properties:[{name:"typeRef",isAttr:!0,type:"String"}]},{name:"InformationItem",superClass:["NamedElement"],properties:[{name:"typeRef",isAttr:!0,type:"String"}]},{name:"Decision",superClass:["DRGElement"],properties:[{name:"question",type:"String",xml:{serialize:"property"}},{name:"allowedAnswers",type:"String",xml:{serialize:"property"}},{name:"variable",type:"InformationItem",xml:{serialize:"property"}},{name:"informationRequirement",type:"InformationRequirement",isMany:!0},{name:"knowledgeRequirement",type:"KnowledgeRequirement",isMany:!0},{name:"authorityRequirement",type:"AuthorityRequirement",isMany:!0},{name:"supportedObjective",isMany:!0,type:"DMNElementReference",xml:{serialize:"property"}},{name:"impactedPerformanceIndicator",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}},{name:"decisionMaker",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}},{name:"decisionOwner",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}},{name:"usingProcess",isMany:!0,type:"DMNElementReference",xml:{serialize:"property"}},{name:"usingTask",isMany:!0,type:"DMNElementReference",xml:{serialize:"property"}},{name:"decisionLogic",type:"Expression"}]},{name:"Invocation",superClass:["Expression"],properties:[{name:"calledFunction",type:"Expression"},{name:"binding",type:"Binding",isMany:!0}]},{name:"OrganisationalUnit",superClass:["BusinessContextElement"],properties:[{name:"decisionMade",type:"Decision",isReference:!0,isMany:!0},{name:"decisionOwned",type:"Decision",isReference:!0,isMany:!0}]},{name:"Import",superClass:["NamedElement"],properties:[{name:"importType",type:"String",isAttr:!0},{name:"locationURI",type:"String",isAttr:!0},{name:"namespace",type:"String",isAttr:!0}]},{name:"InformationRequirement",superClass:["DMNElement"],properties:[{name:"requiredDecision",type:"DMNElementReference",xml:{serialize:"property"}},{name:"requiredInput",type:"DMNElementReference",xml:{serialize:"property"}}]},{name:"ElementCollection",superClass:["NamedElement"],properties:[{name:"drgElement",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}}]},{name:"DRGElement",isAbstract:!0,superClass:["NamedElement"],properties:[]},{name:"InputData",superClass:["DRGElement"],properties:[{name:"variable",type:"InformationItem",xml:{serialize:"property"}}]},{name:"DMNElement",isAbstract:!0,properties:[{name:"description",type:"String"},{name:"extensionElements",type:"ExtensionElements"},{name:"id",type:"String",isAttr:!0,isId:!0},{name:"extensionAttribute",type:"ExtensionAttribute",isMany:!0},{name:"label",isAttr:!0,type:"String"}]},{name:"InputClause",superClass:["DMNElement"],properties:[{name:"inputExpression",type:"LiteralExpression",xml:{serialize:"property"}},{name:"inputValues",type:"UnaryTests",xml:{serialize:"property"}}]},{name:"DecisionTable",superClass:["Expression"],properties:[{name:"input",type:"InputClause",isMany:!0,xml:{serialize:"property"}},{name:"output",type:"OutputClause",isMany:!0,xml:{serialize:"property"}},{name:"annotation",type:"RuleAnnotationClause",isMany:!0,xml:{serialize:"property"}},{name:"rule",type:"DecisionRule",isMany:!0,xml:{serialize:"property"}},{name:"hitPolicy",type:"HitPolicy",isAttr:!0,default:"UNIQUE"},{name:"aggregation",type:"BuiltinAggregator",isAttr:!0},{name:"preferredOrientation",type:"DecisionTableOrientation",isAttr:!0},{name:"outputLabel",isAttr:!0,type:"String"}]},{name:"LiteralExpression",superClass:["Expression"],properties:[{name:"expressionLanguage",type:"String",isAttr:!0},{name:"text",type:"String"},{name:"importedValues",type:"ImportedValues"}]},{name:"Binding",properties:[{name:"parameter",type:"InformationItem",xml:{serialize:"property"}},{name:"bindingFormula",type:"Expression"}]},{name:"KnowledgeRequirement",superClass:["DMNElement"],properties:[{name:"requiredKnowledge",type:"DMNElementReference",xml:{serialize:"property"}}]},{name:"BusinessKnowledgeModel",superClass:["Invocable"],properties:[{name:"encapsulatedLogic",type:"FunctionDefinition",xml:{serialize:"property"}},{name:"knowledgeRequirement",type:"KnowledgeRequirement",isMany:!0},{name:"authorityRequirement",type:"AuthorityRequirement",isMany:!0}]},{name:"BusinessContextElement",isAbstract:!0,superClass:["NamedElement"],properties:[{name:"URI",type:"String",isAttr:!0}]},{name:"PerformanceIndicator",superClass:["BusinessContextElement"],properties:[{name:"impactingDecision",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}}]},{name:"FunctionDefinition",superClass:["Expression"],properties:[{name:"formalParameter",type:"InformationItem",isMany:!0,xml:{serialize:"property"}},{name:"body",type:"Expression"},{name:"kind",type:"FunctionKind",isAttr:!0}]},{name:"Context",superClass:["Expression"],properties:[{name:"contextEntry",type:"ContextEntry",isMany:!0}]},{name:"ContextEntry",superClass:["DMNElement"],properties:[{name:"variable",type:"InformationItem",xml:{serialize:"property"}},{name:"value",type:"Expression"}]},{name:"List",superClass:["Expression"],properties:[{name:"elements",isMany:!0,type:"Expression"}]},{name:"Relation",superClass:["Expression"],properties:[{name:"column",type:"InformationItem",isMany:!0,xml:{serialize:"property"}},{name:"row",type:"List",isMany:!0,xml:{serialize:"property"}}]},{name:"OutputClause",superClass:["DMNElement"],properties:[{name:"outputValues",type:"UnaryTests",xml:{serialize:"property"}},{name:"defaultOutputEntry",type:"LiteralExpression",xml:{serialize:"property"}},{name:"name",isAttr:!0,type:"String"},{name:"typeRef",isAttr:!0,type:"String"}]},{name:"UnaryTests",superClass:["Expression"],properties:[{name:"text",type:"String"},{name:"expressionLanguage",type:"String",isAttr:!0}]},{name:"NamedElement",isAbstract:!0,superClass:["DMNElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ImportedValues",superClass:["Import"],properties:[{name:"importedElement",type:"String"},{name:"expressionLanguage",type:"String",isAttr:!0}]},{name:"DecisionService",superClass:["Invocable"],properties:[{name:"outputDecision",type:"DMNElementReference",isMany:!0,xml:{serialize:"prop