@camunda8/cli 4.2.0-alpha.2 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,45 +13,67 @@ var __export = (target, all) => {
13
13
  __defProp(target, name2, { get: all[name2], enumerable: true });
14
14
  };
15
15
 
16
- // node_modules/bpmn-moddle/node_modules/min-dash/dist/index.esm.js
17
- function isString2(obj) {
18
- return nativeToString.call(obj) === "[object String]";
19
- }
20
- function assign(target, ...others) {
21
- return Object.assign(target, ...others);
22
- }
23
- var nativeToString;
24
- var init_index_esm = __esm({
25
- "node_modules/bpmn-moddle/node_modules/min-dash/dist/index.esm.js"() {
26
- nativeToString = Object.prototype.toString;
27
- }
28
- });
29
-
30
- // node_modules/moddle/node_modules/min-dash/dist/index.esm.js
31
- function isUndefined2(obj) {
16
+ // node_modules/min-dash/dist/index.js
17
+ function isUndefined(obj) {
32
18
  return obj === void 0;
33
19
  }
34
20
  function isDefined(obj) {
35
21
  return obj !== void 0;
36
22
  }
37
- function isNil2(obj) {
23
+ function isNil(obj) {
38
24
  return obj == null;
39
25
  }
40
26
  function isArray(obj) {
41
- return nativeToString2.call(obj) === "[object Array]";
27
+ return nativeToString.call(obj) === "[object Array]";
42
28
  }
43
29
  function isObject(obj) {
44
- return nativeToString2.call(obj) === "[object Object]";
30
+ return nativeToString.call(obj) === "[object Object]";
45
31
  }
46
- function isString3(obj) {
47
- return nativeToString2.call(obj) === "[object String]";
32
+ function isFunction(obj) {
33
+ const tag = nativeToString.call(obj);
34
+ return tag === "[object Function]" || tag === "[object AsyncFunction]" || tag === "[object GeneratorFunction]" || tag === "[object AsyncGeneratorFunction]" || tag === "[object Proxy]";
35
+ }
36
+ function isString(obj) {
37
+ return nativeToString.call(obj) === "[object String]";
48
38
  }
49
39
  function has(target, key) {
50
- return !isNil2(target) && nativeHasOwnProperty.call(target, key);
40
+ return !isNil(target) && nativeHasOwnProperty.call(target, key);
41
+ }
42
+ function find(collection, matcher) {
43
+ const matchFn = toMatcher(matcher);
44
+ let match;
45
+ forEach(collection, function(val, key) {
46
+ if (matchFn(val, key)) {
47
+ match = val;
48
+ return false;
49
+ }
50
+ });
51
+ return match;
52
+ }
53
+ function findIndex(collection, matcher) {
54
+ const matchFn = toMatcher(matcher);
55
+ let idx = isArray(collection) ? -1 : void 0;
56
+ forEach(collection, function(val, key) {
57
+ if (matchFn(val, key)) {
58
+ idx = key;
59
+ return false;
60
+ }
61
+ });
62
+ return idx;
63
+ }
64
+ function filter(collection, matcher) {
65
+ const matchFn = toMatcher(matcher);
66
+ let result = [];
67
+ forEach(collection, function(val, key) {
68
+ if (matchFn(val, key)) {
69
+ result.push(val);
70
+ }
71
+ });
72
+ return result;
51
73
  }
52
74
  function forEach(collection, iterator) {
53
75
  let val, result;
54
- if (isUndefined2(collection)) {
76
+ if (isUndefined(collection)) {
55
77
  return;
56
78
  }
57
79
  const convertKey = isArray(collection) ? toNum : identity;
@@ -65,6 +87,11 @@ function forEach(collection, iterator) {
65
87
  }
66
88
  }
67
89
  }
90
+ function toMatcher(matcher) {
91
+ return isFunction(matcher) ? matcher : (e) => {
92
+ return e === matcher;
93
+ };
94
+ }
68
95
  function identity(arg) {
69
96
  return arg;
70
97
  }
@@ -74,7 +101,7 @@ function toNum(arg) {
74
101
  function bind(fn, target) {
75
102
  return fn.bind(target);
76
103
  }
77
- function assign2(target, ...others) {
104
+ function assign(target, ...others) {
78
105
  return Object.assign(target, ...others);
79
106
  }
80
107
  function set(target, path, value) {
@@ -91,11 +118,11 @@ function set(target, path, value) {
91
118
  }
92
119
  let nextKey = path[idx + 1];
93
120
  let nextTarget = currentTarget[key];
94
- if (isDefined(nextKey) && isNil2(nextTarget)) {
121
+ if (isDefined(nextKey) && isNil(nextTarget)) {
95
122
  nextTarget = currentTarget[key] = isNaN(+nextKey) ? {} : [];
96
123
  }
97
- if (isUndefined2(nextKey)) {
98
- if (isUndefined2(value)) {
124
+ if (isUndefined(nextKey)) {
125
+ if (isUndefined(value)) {
99
126
  delete currentTarget[key];
100
127
  } else {
101
128
  currentTarget[key] = value;
@@ -116,10 +143,10 @@ function pick(target, properties) {
116
143
  });
117
144
  return result;
118
145
  }
119
- var nativeToString2, nativeHasOwnProperty;
120
- var init_index_esm2 = __esm({
121
- "node_modules/moddle/node_modules/min-dash/dist/index.esm.js"() {
122
- nativeToString2 = Object.prototype.toString;
146
+ var nativeToString, nativeHasOwnProperty;
147
+ var init_dist = __esm({
148
+ "node_modules/min-dash/dist/index.js"() {
149
+ nativeToString = Object.prototype.toString;
123
150
  nativeHasOwnProperty = Object.prototype.hasOwnProperty;
124
151
  }
125
152
  });
@@ -167,13 +194,13 @@ function DescriptorBuilder(nameNs) {
167
194
  this.ns = nameNs;
168
195
  this.name = nameNs.name;
169
196
  this.allTypes = [];
170
- this.allTypesByName = {};
197
+ this.allTypesByName = /* @__PURE__ */ Object.create(null);
171
198
  this.properties = [];
172
- this.propertiesByName = {};
199
+ this.propertiesByName = /* @__PURE__ */ Object.create(null);
173
200
  }
174
201
  function Registry(packages2, properties) {
175
- this.packageMap = {};
176
- this.typeMap = {};
202
+ this.packageMap = /* @__PURE__ */ Object.create(null);
203
+ this.typeMap = /* @__PURE__ */ Object.create(null);
177
204
  this.packages = [];
178
205
  this.properties = properties;
179
206
  forEach(packages2, bind(this.registerPackage, this));
@@ -187,7 +214,7 @@ function ensureAvailable(packageMap, pkg, identifierKey) {
187
214
  function Properties(model) {
188
215
  this.model = model;
189
216
  }
190
- function isUndefined3(val) {
217
+ function isUndefined2(val) {
191
218
  return typeof val === "undefined";
192
219
  }
193
220
  function defineProperty(target, property, value) {
@@ -205,13 +232,13 @@ function Moddle(packages2, config = {}) {
205
232
  this.properties = new Properties(this);
206
233
  this.factory = new Factory(this, this.properties);
207
234
  this.registry = new Registry(packages2, this.properties);
208
- this.typeCache = {};
235
+ this.typeCache = /* @__PURE__ */ Object.create(null);
209
236
  this.config = config;
210
237
  }
211
238
  var BUILTINS, TYPE_CONVERTERS;
212
- var init_dist = __esm({
239
+ var init_dist2 = __esm({
213
240
  "node_modules/moddle/dist/index.js"() {
214
- init_index_esm2();
241
+ init_dist();
215
242
  Base.prototype.get = function(name2) {
216
243
  return this.$model.properties.get(this, name2);
217
244
  };
@@ -243,14 +270,14 @@ var init_dist = __esm({
243
270
  props.defineDescriptor(ModdleElement, descriptor);
244
271
  return ModdleElement;
245
272
  };
246
- BUILTINS = {
273
+ BUILTINS = assign(/* @__PURE__ */ Object.create(null), {
247
274
  String: true,
248
275
  Boolean: true,
249
276
  Integer: true,
250
277
  Real: true,
251
278
  Element: true
252
- };
253
- TYPE_CONVERTERS = {
279
+ });
280
+ TYPE_CONVERTERS = assign(/* @__PURE__ */ Object.create(null), {
254
281
  String: function(s) {
255
282
  return s;
256
283
  },
@@ -263,7 +290,7 @@ var init_dist = __esm({
263
290
  Real: function(s) {
264
291
  return parseFloat(s);
265
292
  }
266
- };
293
+ });
267
294
  DescriptorBuilder.prototype.build = function() {
268
295
  return pick(this, [
269
296
  "ns",
@@ -387,7 +414,7 @@ var init_dist = __esm({
387
414
  return;
388
415
  }
389
416
  forEach(t.properties, bind(function(p) {
390
- p = assign2({}, p, {
417
+ p = assign({}, p, {
391
418
  name: p.ns.localName,
392
419
  inherited
393
420
  });
@@ -417,7 +444,7 @@ var init_dist = __esm({
417
444
  return this.packages;
418
445
  };
419
446
  Registry.prototype.registerPackage = function(pkg) {
420
- pkg = assign2({}, pkg);
447
+ pkg = assign({}, pkg);
421
448
  var pkgMap = this.packageMap;
422
449
  ensureAvailable(pkgMap, pkg, "prefix");
423
450
  ensureAvailable(pkgMap, pkg, "uri");
@@ -428,25 +455,25 @@ var init_dist = __esm({
428
455
  this.packages.push(pkg);
429
456
  };
430
457
  Registry.prototype.registerType = function(type, pkg) {
431
- type = assign2({}, type, {
458
+ type = assign({}, type, {
432
459
  superClass: (type.superClass || []).slice(),
433
460
  extends: (type.extends || []).slice(),
434
461
  properties: (type.properties || []).slice(),
435
- meta: assign2(type.meta || {})
462
+ meta: assign({}, type.meta || {})
436
463
  });
437
- var ns = parseName(type.name, pkg.prefix), name2 = ns.name, propertiesByName = {};
464
+ var ns = parseName(type.name, pkg.prefix), name2 = ns.name, propertiesByName = /* @__PURE__ */ Object.create(null);
438
465
  forEach(type.properties, bind(function(p) {
439
466
  var propertyNs = parseName(p.name, ns.prefix), propertyName = propertyNs.name;
440
467
  if (!isBuiltIn(p.type)) {
441
468
  p.type = parseName(p.type, propertyNs.prefix).name;
442
469
  }
443
- assign2(p, {
470
+ assign(p, {
444
471
  ns: propertyNs,
445
472
  name: propertyName
446
473
  });
447
474
  propertiesByName[propertyName] = p;
448
475
  }, this));
449
- assign2(type, {
476
+ assign(type, {
450
477
  ns,
451
478
  name: name2,
452
479
  propertiesByName
@@ -494,12 +521,12 @@ var init_dist = __esm({
494
521
  this.properties.define(target, "$pkg", { value: pkg });
495
522
  };
496
523
  Properties.prototype.set = function(target, name2, value) {
497
- if (!isString3(name2) || !name2.length) {
524
+ if (!isString(name2) || !name2.length) {
498
525
  throw new TypeError("property name must be a non-empty string");
499
526
  }
500
527
  var property = this.getProperty(target, name2);
501
528
  var propertyName = property && property.name;
502
- if (isUndefined3(value)) {
529
+ if (isUndefined2(value)) {
503
530
  if (property) {
504
531
  delete target[propertyName];
505
532
  } else {
@@ -531,7 +558,7 @@ var init_dist = __esm({
531
558
  Properties.prototype.define = function(target, name2, options) {
532
559
  if (!options.writable) {
533
560
  var value = options.value;
534
- options = assign2({}, options, {
561
+ options = assign({}, options, {
535
562
  get: function() {
536
563
  return value;
537
564
  }
@@ -575,7 +602,7 @@ var init_dist = __esm({
575
602
  };
576
603
  Moddle.prototype.getType = function(descriptor) {
577
604
  var cache = this.typeCache;
578
- var name2 = isString3(descriptor) ? descriptor : descriptor.ns.name;
605
+ var name2 = isString(descriptor) ? descriptor : descriptor.ns.name;
579
606
  var type = cache[name2];
580
607
  if (!type) {
581
608
  descriptor = this.registry.getEffectiveDescriptor(name2);
@@ -647,96 +674,6 @@ var init_dist = __esm({
647
674
  }
648
675
  });
649
676
 
650
- // node_modules/moddle-xml/node_modules/min-dash/dist/index.esm.js
651
- function isUndefined4(obj) {
652
- return obj === void 0;
653
- }
654
- function isNil3(obj) {
655
- return obj == null;
656
- }
657
- function isArray2(obj) {
658
- return nativeToString3.call(obj) === "[object Array]";
659
- }
660
- function isFunction(obj) {
661
- const tag = nativeToString3.call(obj);
662
- return tag === "[object Function]" || tag === "[object AsyncFunction]" || tag === "[object GeneratorFunction]" || tag === "[object AsyncGeneratorFunction]" || tag === "[object Proxy]";
663
- }
664
- function isString4(obj) {
665
- return nativeToString3.call(obj) === "[object String]";
666
- }
667
- function has2(target, key) {
668
- return !isNil3(target) && nativeHasOwnProperty2.call(target, key);
669
- }
670
- function find(collection, matcher) {
671
- const matchFn = toMatcher(matcher);
672
- let match;
673
- forEach2(collection, function(val, key) {
674
- if (matchFn(val, key)) {
675
- match = val;
676
- return false;
677
- }
678
- });
679
- return match;
680
- }
681
- function findIndex(collection, matcher) {
682
- const matchFn = toMatcher(matcher);
683
- let idx = isArray2(collection) ? -1 : void 0;
684
- forEach2(collection, function(val, key) {
685
- if (matchFn(val, key)) {
686
- idx = key;
687
- return false;
688
- }
689
- });
690
- return idx;
691
- }
692
- function filter(collection, matcher) {
693
- const matchFn = toMatcher(matcher);
694
- let result = [];
695
- forEach2(collection, function(val, key) {
696
- if (matchFn(val, key)) {
697
- result.push(val);
698
- }
699
- });
700
- return result;
701
- }
702
- function forEach2(collection, iterator) {
703
- let val, result;
704
- if (isUndefined4(collection)) {
705
- return;
706
- }
707
- const convertKey = isArray2(collection) ? toNum2 : identity2;
708
- for (let key in collection) {
709
- if (has2(collection, key)) {
710
- val = collection[key];
711
- result = iterator(val, convertKey(key));
712
- if (result === false) {
713
- return val;
714
- }
715
- }
716
- }
717
- }
718
- function toMatcher(matcher) {
719
- return isFunction(matcher) ? matcher : (e) => {
720
- return e === matcher;
721
- };
722
- }
723
- function identity2(arg) {
724
- return arg;
725
- }
726
- function toNum2(arg) {
727
- return Number(arg);
728
- }
729
- function assign3(target, ...others) {
730
- return Object.assign(target, ...others);
731
- }
732
- var nativeToString3, nativeHasOwnProperty2;
733
- var init_index_esm3 = __esm({
734
- "node_modules/moddle-xml/node_modules/min-dash/dist/index.esm.js"() {
735
- nativeToString3 = Object.prototype.toString;
736
- nativeHasOwnProperty2 = Object.prototype.hasOwnProperty;
737
- }
738
- });
739
-
740
677
  // node_modules/saxen/dist/index.js
741
678
  function replaceEntities(_, d, x, z) {
742
679
  if (z) {
@@ -770,7 +707,7 @@ function getter(getFn) {
770
707
  };
771
708
  }
772
709
  function cloneNsMatrix(nsMatrix) {
773
- var clone = {}, key;
710
+ var clone = /* @__PURE__ */ Object.create(null), key;
774
711
  for (key in nsMatrix) {
775
712
  clone[key] = nsMatrix[key];
776
713
  }
@@ -780,7 +717,7 @@ function uriPrefix(prefix2) {
780
717
  return prefix2 + "$uri";
781
718
  }
782
719
  function buildNsMatrix(nsUriToPrefix) {
783
- var nsMatrix = {}, uri2, prefix2;
720
+ var nsMatrix = /* @__PURE__ */ Object.create(null), uri2, prefix2;
784
721
  for (uri2 in nsUriToPrefix) {
785
722
  prefix2 = nsUriToPrefix[uri2];
786
723
  nsMatrix[prefix2] = prefix2;
@@ -801,10 +738,14 @@ function Parser(options) {
801
738
  var proxy = options && options["proxy"];
802
739
  var onText, onOpenTag, onCloseTag, onCDATA, onError = throwFunc, onWarning, onComment, onQuestion, onAttention;
803
740
  var getContext = noopGetContext;
741
+ var streaming = false;
742
+ var rootTagFound = false;
743
+ var leftoverXml = "";
804
744
  var maybeNS = false;
805
745
  var isNamespace = false;
806
746
  var returnError = null;
807
747
  var parseStop = false;
748
+ var nsMatrixStack, nsMatrix, nodeStack;
808
749
  var nsUriToPrefix;
809
750
  function handleError(err) {
810
751
  if (!(err instanceof Error)) {
@@ -868,7 +809,7 @@ function Parser(options) {
868
809
  if (typeof nsMap !== "object") {
869
810
  throw error("required args <nsMap={}>");
870
811
  }
871
- var _nsUriToPrefix = {}, k;
812
+ var _nsUriToPrefix = /* @__PURE__ */ Object.create(null), k;
872
813
  for (k in nsMap) {
873
814
  _nsUriToPrefix[k] = nsMap[k];
874
815
  }
@@ -876,27 +817,79 @@ function Parser(options) {
876
817
  nsUriToPrefix = _nsUriToPrefix;
877
818
  return this;
878
819
  };
820
+ function resetState() {
821
+ nsMatrixStack = isNamespace ? [] : null;
822
+ nsMatrix = isNamespace ? buildNsMatrix(nsUriToPrefix) : null;
823
+ nodeStack = [];
824
+ getContext = noopGetContext;
825
+ parseStop = false;
826
+ returnError = null;
827
+ rootTagFound = false;
828
+ leftoverXml = "";
829
+ }
879
830
  this["parse"] = function(xml2) {
880
831
  if (typeof xml2 !== "string") {
881
832
  throw error("required args <xml=string>");
882
833
  }
883
- returnError = null;
834
+ if (streaming) {
835
+ throw error("parse during stream; call end() first");
836
+ }
837
+ resetState();
884
838
  parse(xml2);
885
839
  getContext = noopGetContext;
886
840
  parseStop = false;
887
841
  return returnError;
888
842
  };
843
+ this["write"] = function(xml2) {
844
+ if (typeof xml2 !== "string") {
845
+ throw error("required args <xml=string>");
846
+ }
847
+ if (!streaming) {
848
+ resetState();
849
+ streaming = true;
850
+ }
851
+ if (!returnError) {
852
+ leftoverXml = parse(leftoverXml + xml2, true) || "";
853
+ }
854
+ return this;
855
+ };
856
+ this["end"] = function() {
857
+ if (!streaming) {
858
+ resetState();
859
+ }
860
+ streaming = false;
861
+ if (!returnError) {
862
+ parse(leftoverXml);
863
+ }
864
+ leftoverXml = "";
865
+ getContext = noopGetContext;
866
+ parseStop = false;
867
+ return returnError;
868
+ };
889
869
  this["stop"] = function() {
890
870
  parseStop = true;
891
871
  };
892
- function parse(xml2) {
893
- var nsMatrixStack = isNamespace ? [] : null, nsMatrix = isNamespace ? buildNsMatrix(nsUriToPrefix) : null, _nsMatrix, nodeStack = [], anonymousNsCount = 0, tagStart = false, tagEnd = false, i = 0, j = 0, x, y, q, w, v, xmlns, elementName, _elementName, elementProxy;
872
+ function parse(xml2, streaming2 = false) {
873
+ var elNameCache = null, elNameCacheMatrix = null;
874
+ var _nsMatrix, anonymousNsCount = 0, tagStart = false, tagEnd = false, i = 0, j = 0, x, y, q, w, v, xmlns, elementName, _elementName, elementProxy;
894
875
  var attrsString = "", attrsStart = 0, cachedAttrs;
876
+ function normalizeAttrName(name2, defaultAlias) {
877
+ var w2 = name2.indexOf(":");
878
+ if (w2 === -1) {
879
+ return name2;
880
+ }
881
+ var nsName2 = nsMatrix[name2.substring(0, w2)];
882
+ if (!nsName2) {
883
+ handleWarning(missingNamespaceForPrefix(name2.substring(0, w2)));
884
+ return null;
885
+ }
886
+ return defaultAlias === nsName2 ? name2.substr(w2 + 1) : nsName2 + name2.substr(w2);
887
+ }
895
888
  function getAttrs() {
896
889
  if (cachedAttrs !== null) {
897
890
  return cachedAttrs;
898
891
  }
899
- var nsUri, nsUriPrefix, nsName2, defaultAlias = isNamespace && nsMatrix["xmlns"], attrList = isNamespace && maybeNS ? [] : null, i2 = attrsStart, s = attrsString, l = s.length, hasNewMatrix, newalias, value, alias, name2, attrs = {}, seenAttrs = {}, skipAttr, w2, j2;
892
+ var nsUri, nsUriPrefix, defaultAlias = isNamespace && nsMatrix["xmlns"], attrList = isNamespace && maybeNS ? [] : null, i2 = attrsStart, s = attrsString, l = s.length, hasNewMatrix, newalias, value, alias, name2, attrs = {}, seenAttrs = /* @__PURE__ */ new Set(), skipAttr, w2, j2;
900
893
  parseAttr:
901
894
  for (; i2 < l; i2++) {
902
895
  skipAttr = false;
@@ -985,11 +978,11 @@ function Parser(options) {
985
978
  if (skipAttr) {
986
979
  continue parseAttr;
987
980
  }
988
- if (name2 in seenAttrs) {
981
+ if (seenAttrs.has(name2)) {
989
982
  handleWarning("attribute <" + name2 + "> already defined");
990
983
  continue;
991
984
  }
992
- seenAttrs[name2] = true;
985
+ seenAttrs.add(name2);
993
986
  if (!isNamespace) {
994
987
  attrs[name2] = value;
995
988
  continue;
@@ -1028,29 +1021,18 @@ function Parser(options) {
1028
1021
  attrList.push(name2, value);
1029
1022
  continue;
1030
1023
  }
1031
- w2 = name2.indexOf(":");
1032
- if (w2 === -1) {
1033
- attrs[name2] = value;
1034
- continue;
1035
- }
1036
- if (!(nsName2 = nsMatrix[name2.substring(0, w2)])) {
1037
- handleWarning(missingNamespaceForPrefix(name2.substring(0, w2)));
1024
+ name2 = normalizeAttrName(name2, defaultAlias);
1025
+ if (name2 === null) {
1038
1026
  continue;
1039
1027
  }
1040
- name2 = defaultAlias === nsName2 ? name2.substr(w2 + 1) : nsName2 + name2.substr(w2);
1041
1028
  attrs[name2] = value;
1042
1029
  }
1043
1030
  if (maybeNS) {
1044
1031
  for (i2 = 0, l = attrList.length; i2 < l; i2++) {
1045
- name2 = attrList[i2++];
1032
+ name2 = normalizeAttrName(attrList[i2++], defaultAlias);
1046
1033
  value = attrList[i2];
1047
- w2 = name2.indexOf(":");
1048
- if (w2 !== -1) {
1049
- if (!(nsName2 = nsMatrix[name2.substring(0, w2)])) {
1050
- handleWarning(missingNamespaceForPrefix(name2.substring(0, w2)));
1051
- continue;
1052
- }
1053
- name2 = defaultAlias === nsName2 ? name2.substr(w2 + 1) : nsName2 + name2.substr(w2);
1034
+ if (name2 === null) {
1035
+ continue;
1054
1036
  }
1055
1037
  attrs[name2] = value;
1056
1038
  }
@@ -1114,10 +1096,13 @@ function Parser(options) {
1114
1096
  i = xml2.indexOf("<", j);
1115
1097
  }
1116
1098
  if (i === -1) {
1099
+ if (streaming2) {
1100
+ return xml2.substring(j);
1101
+ }
1117
1102
  if (nodeStack.length) {
1118
1103
  return handleError("unexpected end of file");
1119
1104
  }
1120
- if (j === 0) {
1105
+ if (!rootTagFound) {
1121
1106
  return handleError("missing start tag");
1122
1107
  }
1123
1108
  if (j < xml2.length) {
@@ -1127,6 +1112,9 @@ function Parser(options) {
1127
1112
  }
1128
1113
  return;
1129
1114
  }
1115
+ if (!rootTagFound) {
1116
+ rootTagFound = true;
1117
+ }
1130
1118
  if (j !== i) {
1131
1119
  if (nodeStack.length) {
1132
1120
  if (onText) {
@@ -1150,6 +1138,9 @@ function Parser(options) {
1150
1138
  if (q === 91 && xml2.substr(i + 3, 6) === "CDATA[") {
1151
1139
  j = xml2.indexOf("]]>", i);
1152
1140
  if (j === -1) {
1141
+ if (streaming2) {
1142
+ return xml2.substring(i);
1143
+ }
1153
1144
  return handleError("unclosed cdata");
1154
1145
  }
1155
1146
  if (onCDATA) {
@@ -1164,6 +1155,9 @@ function Parser(options) {
1164
1155
  if (q === 45 && xml2.charCodeAt(i + 3) === 45) {
1165
1156
  j = xml2.indexOf("-->", i);
1166
1157
  if (j === -1) {
1158
+ if (streaming2) {
1159
+ return xml2.substring(i);
1160
+ }
1167
1161
  return handleError("unclosed comment");
1168
1162
  }
1169
1163
  if (onComment) {
@@ -1179,6 +1173,9 @@ function Parser(options) {
1179
1173
  if (w === 63) {
1180
1174
  j = xml2.indexOf("?>", i);
1181
1175
  if (j === -1) {
1176
+ if (streaming2) {
1177
+ return xml2.substring(i);
1178
+ }
1182
1179
  return handleError("unclosed question");
1183
1180
  }
1184
1181
  if (onQuestion) {
@@ -1193,6 +1190,9 @@ function Parser(options) {
1193
1190
  for (x = i + 1; ; x++) {
1194
1191
  v = xml2.charCodeAt(x);
1195
1192
  if (isNaN(v)) {
1193
+ if (streaming2) {
1194
+ return xml2.substring(i);
1195
+ }
1196
1196
  j = -1;
1197
1197
  return handleError("unclosed tag");
1198
1198
  }
@@ -1281,18 +1281,31 @@ function Parser(options) {
1281
1281
  }
1282
1282
  }
1283
1283
  _elementName = elementName;
1284
- w = elementName.indexOf(":");
1285
- if (w !== -1) {
1286
- xmlns = nsMatrix[elementName.substring(0, w)];
1287
- if (!xmlns) {
1288
- return handleError("missing namespace on <" + _elementName + ">");
1284
+ if (elNameCacheMatrix !== nsMatrix) {
1285
+ elNameCache = nsMatrix[NAME_CACHE];
1286
+ if (elNameCache === void 0) {
1287
+ elNameCache = nsMatrix[NAME_CACHE] = /* @__PURE__ */ Object.create(null);
1289
1288
  }
1290
- elementName = elementName.substr(w + 1);
1291
- } else {
1292
- xmlns = nsMatrix["xmlns"];
1289
+ elNameCacheMatrix = nsMatrix;
1293
1290
  }
1294
- if (xmlns) {
1295
- elementName = xmlns + ":" + elementName;
1291
+ var _cachedName = elNameCache[elementName];
1292
+ if (_cachedName !== void 0) {
1293
+ elementName = _cachedName;
1294
+ } else {
1295
+ w = elementName.indexOf(":");
1296
+ if (w !== -1) {
1297
+ xmlns = nsMatrix[elementName.substring(0, w)];
1298
+ if (!xmlns) {
1299
+ return handleError("missing namespace on <" + _elementName + ">");
1300
+ }
1301
+ elementName = elementName.substr(w + 1);
1302
+ } else {
1303
+ xmlns = nsMatrix["xmlns"];
1304
+ }
1305
+ if (xmlns) {
1306
+ elementName = xmlns + ":" + elementName;
1307
+ }
1308
+ elNameCache[_elementName] = elementName;
1296
1309
  }
1297
1310
  }
1298
1311
  if (tagStart) {
@@ -1328,8 +1341,8 @@ function Parser(options) {
1328
1341
  }
1329
1342
  }
1330
1343
  }
1331
- var fromCharCode, hasOwnProperty, ENTITY_PATTERN, ENTITY_MAPPING, NON_WHITESPACE_OUTSIDE_ROOT_NODE;
1332
- var init_dist2 = __esm({
1344
+ var fromCharCode, hasOwnProperty, ENTITY_PATTERN, ENTITY_MAPPING, NON_WHITESPACE_OUTSIDE_ROOT_NODE, NAME_CACHE;
1345
+ var init_dist3 = __esm({
1333
1346
  "node_modules/saxen/dist/index.js"() {
1334
1347
  fromCharCode = String.fromCharCode;
1335
1348
  hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -1345,6 +1358,7 @@ var init_dist2 = __esm({
1345
1358
  ENTITY_MAPPING[k.toUpperCase()] = ENTITY_MAPPING[k];
1346
1359
  });
1347
1360
  NON_WHITESPACE_OUTSIDE_ROOT_NODE = "non-whitespace outside of root node";
1361
+ NAME_CACHE = /* @__PURE__ */ Symbol("nameCache");
1348
1362
  }
1349
1363
  });
1350
1364
 
@@ -1391,7 +1405,7 @@ function getModdleDescriptor(element) {
1391
1405
  return element.$descriptor;
1392
1406
  }
1393
1407
  function Context(options) {
1394
- assign3(this, options);
1408
+ assign(this, options);
1395
1409
  this.elementsById = {};
1396
1410
  this.references = [];
1397
1411
  this.warnings = [];
@@ -1456,7 +1470,7 @@ function Reader(options) {
1456
1470
  model: options
1457
1471
  };
1458
1472
  }
1459
- assign3(this, { lax: false }, options);
1473
+ assign(this, { lax: false }, options);
1460
1474
  }
1461
1475
  function createStack() {
1462
1476
  var stack = [];
@@ -1498,7 +1512,7 @@ function inherits(ctor, superCtor) {
1498
1512
  });
1499
1513
  }
1500
1514
  function nsName(ns) {
1501
- if (isString4(ns)) {
1515
+ if (isString(ns)) {
1502
1516
  return ns;
1503
1517
  } else {
1504
1518
  return (ns.prefix ? ns.prefix + ":" : "") + ns.localName;
@@ -1514,13 +1528,13 @@ function getNsAttrs(namespaces) {
1514
1528
  }
1515
1529
  function getElementNs(ns, descriptor) {
1516
1530
  if (descriptor.isGeneric) {
1517
- return assign3({ localName: descriptor.ns.localName }, ns);
1531
+ return assign({ localName: descriptor.ns.localName }, ns);
1518
1532
  } else {
1519
- return assign3({ localName: nameToAlias(descriptor.ns.localName, descriptor.$pkg) }, ns);
1533
+ return assign({ localName: nameToAlias(descriptor.ns.localName, descriptor.$pkg) }, ns);
1520
1534
  }
1521
1535
  }
1522
1536
  function getPropertyNs(ns, descriptor) {
1523
- return assign3({ localName: descriptor.ns.localName }, ns);
1537
+ return assign({ localName: descriptor.ns.localName }, ns);
1524
1538
  }
1525
1539
  function getSerializableProperties(element) {
1526
1540
  var descriptor = element.$descriptor;
@@ -1529,7 +1543,7 @@ function getSerializableProperties(element) {
1529
1543
  if (p.isVirtual) {
1530
1544
  return false;
1531
1545
  }
1532
- if (!has2(element, name2)) {
1546
+ if (!has(element, name2)) {
1533
1547
  return false;
1534
1548
  }
1535
1549
  var value = element[name2];
@@ -1543,7 +1557,7 @@ function getSerializableProperties(element) {
1543
1557
  });
1544
1558
  }
1545
1559
  function escape(str, charPattern, replaceMap) {
1546
- str = isString4(str) ? str : "" + str;
1560
+ str = isString(str) ? str : "" + str;
1547
1561
  return str.replace(charPattern, function(s) {
1548
1562
  return "&" + replaceMap[s] + ";";
1549
1563
  });
@@ -1578,6 +1592,42 @@ function ElementSerializer(parent, propertyDescriptor) {
1578
1592
  this.parent = parent;
1579
1593
  this.propertyDescriptor = propertyDescriptor;
1580
1594
  }
1595
+ function serializeTree(root, writer) {
1596
+ var stack = [{ serializer: root, index: 0, opened: false, indent: false }];
1597
+ while (stack.length) {
1598
+ var frame = stack[stack.length - 1], serializer = frame.serializer;
1599
+ if (!frame.opened) {
1600
+ var firstBody = serializer.body[0];
1601
+ frame.indent = firstBody && firstBody.constructor !== BodySerializer;
1602
+ writer.appendIndent().append("<" + serializer.tagName);
1603
+ serializer.serializeAttributes(writer);
1604
+ writer.append(firstBody ? ">" : " />");
1605
+ frame.opened = true;
1606
+ if (!firstBody) {
1607
+ writer.appendNewLine();
1608
+ stack.pop();
1609
+ continue;
1610
+ }
1611
+ if (frame.indent) {
1612
+ writer.appendNewLine().indent();
1613
+ }
1614
+ }
1615
+ if (frame.index < serializer.body.length) {
1616
+ var child = serializer.body[frame.index++];
1617
+ if (child instanceof ElementSerializer) {
1618
+ stack.push({ serializer: child, index: 0, opened: false, indent: false });
1619
+ } else {
1620
+ child.serializeTo(writer);
1621
+ }
1622
+ continue;
1623
+ }
1624
+ if (frame.indent) {
1625
+ writer.unindent().appendIndent();
1626
+ }
1627
+ writer.append("</" + serializer.tagName + ">").appendNewLine();
1628
+ stack.pop();
1629
+ }
1630
+ }
1581
1631
  function TypeSerializer(parent, propertyDescriptor, serialization) {
1582
1632
  ElementSerializer.call(this, parent, propertyDescriptor);
1583
1633
  this.serialization = serialization;
@@ -1616,7 +1666,7 @@ function FormatingWriter(out, format) {
1616
1666
  };
1617
1667
  }
1618
1668
  function Writer(options) {
1619
- options = assign3({ format: false, preamble: true }, options || {});
1669
+ options = assign({ format: false, preamble: true }, options || {});
1620
1670
  function toXML(tree, writer) {
1621
1671
  var internalWriter = writer || new SavingWriter();
1622
1672
  var formatingWriter = new FormatingWriter(internalWriter, options.format);
@@ -1635,6 +1685,31 @@ function Writer(options) {
1635
1685
  toXML
1636
1686
  };
1637
1687
  }
1688
+ function buildTree(rootSerializer, rootElement) {
1689
+ var stack = [{
1690
+ serializer: rootSerializer,
1691
+ children: rootSerializer.enter(rootElement),
1692
+ index: 0
1693
+ }];
1694
+ while (stack.length) {
1695
+ var frame = stack[stack.length - 1];
1696
+ if (frame.index >= frame.children.length) {
1697
+ frame.serializer.exit();
1698
+ stack.pop();
1699
+ continue;
1700
+ }
1701
+ var child = frame.children[frame.index++];
1702
+ var childSerializer = child.create();
1703
+ frame.serializer.body.push(childSerializer);
1704
+ if (child.element) {
1705
+ stack.push({
1706
+ serializer: childSerializer,
1707
+ children: childSerializer.enter(child.element),
1708
+ index: 0
1709
+ });
1710
+ }
1711
+ }
1712
+ }
1638
1713
  function getDefaultPrefixMappings(model) {
1639
1714
  const nsMap = model.config && model.config.nsMap || {};
1640
1715
  const prefixMap = {};
@@ -1651,11 +1726,11 @@ function getDefaultPrefixMappings(model) {
1651
1726
  return prefixMap;
1652
1727
  }
1653
1728
  var DEFAULT_NS_MAP, SERIALIZE_PROPERTY, XML_PREAMBLE, ESCAPE_ATTR_CHARS, ESCAPE_CHARS, ESCAPE_ATTR_MAP, ESCAPE_MAP;
1654
- var init_dist3 = __esm({
1729
+ var init_dist4 = __esm({
1655
1730
  "node_modules/moddle-xml/dist/index.js"() {
1656
- init_index_esm3();
1657
- init_dist2();
1658
1731
  init_dist();
1732
+ init_dist3();
1733
+ init_dist2();
1659
1734
  DEFAULT_NS_MAP = {
1660
1735
  "xsi": "http://www.w3.org/2001/XMLSchema-instance",
1661
1736
  "xml": "http://www.w3.org/XML/1998/namespace"
@@ -1734,7 +1809,7 @@ var init_dist3 = __esm({
1734
1809
  };
1735
1810
  ElementHandler.prototype.createElement = function(node) {
1736
1811
  var attributes = node.attributes, Type = this.type, descriptor = getModdleDescriptor(Type), context = this.context, instance = new Type({}), model = this.model, propNameNs;
1737
- forEach2(attributes, function(value, name2) {
1812
+ forEach(attributes, function(value, name2) {
1738
1813
  var prop = descriptor.propertiesByName[name2], values;
1739
1814
  if (prop && prop.isReference) {
1740
1815
  if (!prop.isMany) {
@@ -1745,7 +1820,7 @@ var init_dist3 = __esm({
1745
1820
  });
1746
1821
  } else {
1747
1822
  values = value.split(" ");
1748
- forEach2(values, function(v) {
1823
+ forEach(values, function(v) {
1749
1824
  context.addReference({
1750
1825
  element: instance,
1751
1826
  property: prop.ns.name,
@@ -1786,7 +1861,7 @@ var init_dist3 = __esm({
1786
1861
  if (elementTypeName) {
1787
1862
  const normalizedTypeName = normalizeTypeName(elementTypeName, node.ns, model);
1788
1863
  const elementType = model.getType(normalizedTypeName);
1789
- return assign3({}, property, {
1864
+ return assign({}, property, {
1790
1865
  effectiveType: getModdleDescriptor(elementType).name
1791
1866
  });
1792
1867
  }
@@ -1801,7 +1876,7 @@ var init_dist3 = __esm({
1801
1876
  return !p.isVirtual && !p.isReference && !p.isAttribute && elementType.hasType(p.type);
1802
1877
  });
1803
1878
  if (property) {
1804
- return assign3({}, property, {
1879
+ return assign({}, property, {
1805
1880
  effectiveType: getModdleDescriptor(elementType).name
1806
1881
  });
1807
1882
  }
@@ -1852,7 +1927,7 @@ var init_dist3 = __esm({
1852
1927
  element.set(propertyDesc.name, newElement);
1853
1928
  }
1854
1929
  if (propertyDesc.isReference) {
1855
- assign3(newElement, {
1930
+ assign(newElement, {
1856
1931
  element
1857
1932
  });
1858
1933
  this.context.addReference(newElement);
@@ -1904,7 +1979,7 @@ var init_dist3 = __esm({
1904
1979
  }
1905
1980
  }
1906
1981
  var model = this.model, lax = this.lax;
1907
- var context = new Context(assign3({}, options, { rootHandler })), parser = new Parser({ proxy: true }), stack = createStack();
1982
+ var context = new Context(assign({}, options, { rootHandler })), parser = new Parser({ proxy: true }), stack = createStack();
1908
1983
  rootHandler.context = context;
1909
1984
  stack.push(rootHandler);
1910
1985
  function handleError(err, getContext, lax2) {
@@ -2064,8 +2139,27 @@ var init_dist3 = __esm({
2064
2139
  Namespaces.prototype.defaultUriByPrefix = function(prefix2) {
2065
2140
  return this.defaultPrefixMap[prefix2];
2066
2141
  };
2142
+ Namespaces.prototype.resolve = function(fn) {
2143
+ var scope = this;
2144
+ while (scope) {
2145
+ var resolved = fn(scope);
2146
+ if (resolved) {
2147
+ return resolved;
2148
+ }
2149
+ scope = scope.parent;
2150
+ }
2151
+ };
2152
+ Namespaces.prototype.eachScope = function(fn) {
2153
+ var scope = this;
2154
+ while (scope) {
2155
+ fn(scope);
2156
+ scope = scope.parent;
2157
+ }
2158
+ };
2067
2159
  Namespaces.prototype.byUri = function(uri2) {
2068
- return this.uriMap[uri2] || this.parent && this.parent.byUri(uri2);
2160
+ return this.resolve(function(scope) {
2161
+ return scope.uriMap[uri2];
2162
+ });
2069
2163
  };
2070
2164
  Namespaces.prototype.add = function(ns, isWellknown) {
2071
2165
  this.uriMap[ns.uri] = ns;
@@ -2077,7 +2171,10 @@ var init_dist3 = __esm({
2077
2171
  this.mapPrefix(ns.prefix, ns.uri);
2078
2172
  };
2079
2173
  Namespaces.prototype.uriByPrefix = function(prefix2) {
2080
- return this.prefixMap[prefix2 || "xmlns"] || this.parent && this.parent.uriByPrefix(prefix2);
2174
+ var key = prefix2 || "xmlns";
2175
+ return this.resolve(function(scope) {
2176
+ return scope.prefixMap[key];
2177
+ });
2081
2178
  };
2082
2179
  Namespaces.prototype.mapPrefix = function(prefix2, uri2) {
2083
2180
  this.prefixMap[prefix2 || "xmlns"] = uri2;
@@ -2088,10 +2185,9 @@ var init_dist3 = __esm({
2088
2185
  Namespaces.prototype.logUsed = function(ns) {
2089
2186
  var uri2 = ns.uri;
2090
2187
  var nsKey = this.getNSKey(ns);
2091
- this.used[nsKey] = this.byUri(uri2);
2092
- if (this.parent) {
2093
- this.parent.logUsed(ns);
2094
- }
2188
+ this.eachScope(function(scope) {
2189
+ scope.used[nsKey] = scope.byUri(uri2);
2190
+ });
2095
2191
  };
2096
2192
  Namespaces.prototype.getUsed = function(ns) {
2097
2193
  var allNs = [].concat(this.wellknown, this.custom);
@@ -2140,14 +2236,17 @@ var init_dist3 = __esm({
2140
2236
  writer.append("</" + this.tagName + ">").appendNewLine();
2141
2237
  };
2142
2238
  ElementSerializer.prototype.build = function(element) {
2239
+ buildTree(this, element);
2240
+ return this;
2241
+ };
2242
+ ElementSerializer.prototype.enter = function(element) {
2143
2243
  this.element = element;
2144
2244
  var elementDescriptor = element.$descriptor, propertyDescriptor = this.propertyDescriptor;
2145
- var otherAttrs, properties;
2146
2245
  var isGeneric = elementDescriptor.isGeneric;
2147
2246
  if (isGeneric) {
2148
- otherAttrs = this.parseGenericNsAttributes(element);
2247
+ this.otherAttrs = this.parseGenericNsAttributes(element);
2149
2248
  } else {
2150
- otherAttrs = this.parseNsAttributes(element);
2249
+ this.otherAttrs = this.parseNsAttributes(element);
2151
2250
  }
2152
2251
  if (propertyDescriptor) {
2153
2252
  this.ns = this.nsPropertyTagName(propertyDescriptor);
@@ -2156,14 +2255,14 @@ var init_dist3 = __esm({
2156
2255
  }
2157
2256
  this.tagName = this.addTagName(this.ns);
2158
2257
  if (isGeneric) {
2159
- this.parseGenericContainments(element);
2160
- } else {
2161
- properties = getSerializableProperties(element);
2162
- this.parseAttributes(filterAttributes(properties));
2163
- this.parseContainments(filterContained(properties));
2258
+ return this.collectGenericContainments(element);
2164
2259
  }
2165
- this.parseGenericAttributes(element, otherAttrs);
2166
- return this;
2260
+ var properties = getSerializableProperties(element);
2261
+ this.parseAttributes(filterAttributes(properties));
2262
+ return this.collectContainments(filterContained(properties));
2263
+ };
2264
+ ElementSerializer.prototype.exit = function() {
2265
+ this.parseGenericAttributes(this.element, this.otherAttrs);
2167
2266
  };
2168
2267
  ElementSerializer.prototype.nsTagName = function(descriptor) {
2169
2268
  var effectiveNs = this.logNamespaceUsed(descriptor.ns);
@@ -2178,7 +2277,7 @@ var init_dist3 = __esm({
2178
2277
  };
2179
2278
  ElementSerializer.prototype.nsAttributeName = function(element) {
2180
2279
  var ns;
2181
- if (isString4(element)) {
2280
+ if (isString(element)) {
2182
2281
  ns = parseName(element);
2183
2282
  } else {
2184
2283
  ns = element.ns;
@@ -2191,7 +2290,7 @@ var init_dist3 = __esm({
2191
2290
  if (this.isLocalNs(effectiveNs)) {
2192
2291
  return { localName: ns.localName };
2193
2292
  } else {
2194
- return assign3({ localName: ns.localName }, effectiveNs);
2293
+ return assign({ localName: ns.localName }, effectiveNs);
2195
2294
  }
2196
2295
  };
2197
2296
  ElementSerializer.prototype.parseGenericNsAttributes = function(element) {
@@ -2201,17 +2300,28 @@ var init_dist3 = __esm({
2201
2300
  ([key, value]) => ({ name: key, value })
2202
2301
  );
2203
2302
  };
2204
- ElementSerializer.prototype.parseGenericContainments = function(element) {
2205
- var body = element.$body;
2206
- if (body) {
2207
- this.body.push(new BodySerializer().build({ type: "String" }, body));
2303
+ ElementSerializer.prototype.collectGenericContainments = function(element) {
2304
+ var self = this, children = [];
2305
+ var bodyText = element.$body;
2306
+ if (bodyText) {
2307
+ children.push({
2308
+ create: function() {
2309
+ return new BodySerializer().build({ type: "String" }, bodyText);
2310
+ }
2311
+ });
2208
2312
  }
2209
- var children = element.$children;
2210
- if (children) {
2211
- forEach2(children, (child) => {
2212
- this.body.push(new ElementSerializer(this).build(child));
2313
+ var genericChildren = element.$children;
2314
+ if (genericChildren) {
2315
+ forEach(genericChildren, function(child) {
2316
+ children.push({
2317
+ create: function() {
2318
+ return new ElementSerializer(self);
2319
+ },
2320
+ element: child
2321
+ });
2213
2322
  });
2214
2323
  }
2324
+ return children;
2215
2325
  };
2216
2326
  ElementSerializer.prototype.parseNsAttribute = function(element, name2, value) {
2217
2327
  var model = element.$model;
@@ -2240,7 +2350,7 @@ var init_dist3 = __esm({
2240
2350
  var self = this;
2241
2351
  var genericAttrs = element.$attrs;
2242
2352
  var attributes = [];
2243
- forEach2(genericAttrs, function(value, name2) {
2353
+ forEach(genericAttrs, function(value, name2) {
2244
2354
  var nonNsAttr = self.parseNsAttribute(element, name2, value);
2245
2355
  if (nonNsAttr) {
2246
2356
  attributes.push(nonNsAttr);
@@ -2250,7 +2360,7 @@ var init_dist3 = __esm({
2250
2360
  };
2251
2361
  ElementSerializer.prototype.parseGenericAttributes = function(element, attributes) {
2252
2362
  var self = this;
2253
- forEach2(attributes, function(attr) {
2363
+ forEach(attributes, function(attr) {
2254
2364
  try {
2255
2365
  self.addAttribute(self.nsAttributeName(attr.name), attr.value);
2256
2366
  } catch (e) {
@@ -2262,45 +2372,59 @@ var init_dist3 = __esm({
2262
2372
  }
2263
2373
  });
2264
2374
  };
2265
- ElementSerializer.prototype.parseContainments = function(properties) {
2266
- var self = this, body = this.body, element = this.element;
2267
- forEach2(properties, function(p) {
2375
+ ElementSerializer.prototype.collectContainments = function(properties) {
2376
+ var self = this, element = this.element, children = [];
2377
+ forEach(properties, function(p) {
2268
2378
  var value = element.get(p.name), isReference = p.isReference, isMany = p.isMany;
2269
2379
  if (!isMany) {
2270
2380
  value = [value];
2271
2381
  }
2272
2382
  if (p.isBody) {
2273
- body.push(new BodySerializer().build(p, value[0]));
2383
+ children.push({
2384
+ create: function() {
2385
+ return new BodySerializer().build(p, value[0]);
2386
+ }
2387
+ });
2274
2388
  } else if (isSimple(p.type)) {
2275
- forEach2(value, function(v) {
2276
- body.push(new ValueSerializer(self.addTagName(self.nsPropertyTagName(p))).build(p, v));
2389
+ forEach(value, function(v) {
2390
+ children.push({
2391
+ create: function() {
2392
+ return new ValueSerializer(self.addTagName(self.nsPropertyTagName(p))).build(p, v);
2393
+ }
2394
+ });
2277
2395
  });
2278
2396
  } else if (isReference) {
2279
- forEach2(value, function(v) {
2280
- body.push(new ReferenceSerializer(self.addTagName(self.nsPropertyTagName(p))).build(v));
2397
+ forEach(value, function(v) {
2398
+ children.push({
2399
+ create: function() {
2400
+ return new ReferenceSerializer(self.addTagName(self.nsPropertyTagName(p))).build(v);
2401
+ }
2402
+ });
2281
2403
  });
2282
2404
  } else {
2283
2405
  var serialization = getSerialization(p);
2284
- forEach2(value, function(v) {
2285
- var serializer;
2286
- if (serialization) {
2287
- if (serialization === SERIALIZE_PROPERTY) {
2288
- serializer = new ElementSerializer(self, p);
2289
- } else {
2290
- serializer = new TypeSerializer(self, p, serialization);
2291
- }
2292
- } else {
2293
- serializer = new ElementSerializer(self);
2294
- }
2295
- body.push(serializer.build(v));
2406
+ forEach(value, function(v) {
2407
+ children.push({
2408
+ create: function() {
2409
+ if (serialization) {
2410
+ if (serialization === SERIALIZE_PROPERTY) {
2411
+ return new ElementSerializer(self, p);
2412
+ }
2413
+ return new TypeSerializer(self, p, serialization);
2414
+ }
2415
+ return new ElementSerializer(self);
2416
+ },
2417
+ element: v
2418
+ });
2296
2419
  });
2297
2420
  }
2298
2421
  });
2422
+ return children;
2299
2423
  };
2300
2424
  ElementSerializer.prototype.getNamespaces = function(local) {
2301
- var namespaces = this.namespaces, parent = this.parent, parentNamespaces;
2425
+ var namespaces = this.namespaces;
2302
2426
  if (!namespaces) {
2303
- parentNamespaces = parent && parent.getNamespaces();
2427
+ var parentNamespaces = this.getParentNamespaces();
2304
2428
  if (local || !parentNamespaces) {
2305
2429
  this.namespaces = namespaces = new Namespaces(parentNamespaces);
2306
2430
  } else {
@@ -2309,6 +2433,24 @@ var init_dist3 = __esm({
2309
2433
  }
2310
2434
  return namespaces;
2311
2435
  };
2436
+ ElementSerializer.prototype.getParentNamespaces = function() {
2437
+ if (this.parentNamespaces !== void 0) {
2438
+ return this.parentNamespaces;
2439
+ }
2440
+ var scope = null, ancestor = this.parent;
2441
+ while (ancestor) {
2442
+ if (ancestor.namespaces) {
2443
+ scope = ancestor.namespaces;
2444
+ break;
2445
+ }
2446
+ if (ancestor.parentNamespaces !== void 0) {
2447
+ scope = ancestor.parentNamespaces;
2448
+ break;
2449
+ }
2450
+ ancestor = ancestor.parent;
2451
+ }
2452
+ return this.parentNamespaces = scope;
2453
+ };
2312
2454
  ElementSerializer.prototype.logNamespace = function(ns, wellknown, local) {
2313
2455
  var namespaces = this.getNamespaces(local);
2314
2456
  var nsUri = ns.uri, nsPrefix = ns.prefix;
@@ -2349,14 +2491,14 @@ var init_dist3 = __esm({
2349
2491
  };
2350
2492
  ElementSerializer.prototype.parseAttributes = function(properties) {
2351
2493
  var self = this, element = this.element;
2352
- forEach2(properties, function(p) {
2494
+ forEach(properties, function(p) {
2353
2495
  var value = element.get(p.name);
2354
2496
  if (p.isReference) {
2355
2497
  if (!p.isMany) {
2356
2498
  value = value.id;
2357
2499
  } else {
2358
2500
  var values = [];
2359
- forEach2(value, function(v) {
2501
+ forEach(value, function(v) {
2360
2502
  values.push(v.id);
2361
2503
  });
2362
2504
  value = values.join(" ");
@@ -2372,7 +2514,7 @@ var init_dist3 = __esm({
2372
2514
  };
2373
2515
  ElementSerializer.prototype.addAttribute = function(name2, value) {
2374
2516
  var attrs = this.attrs;
2375
- if (isString4(value)) {
2517
+ if (isString(value)) {
2376
2518
  value = escapeAttr(value);
2377
2519
  }
2378
2520
  var idx = findIndex(attrs, function(element) {
@@ -2390,28 +2532,12 @@ var init_dist3 = __esm({
2390
2532
  if (namespaces) {
2391
2533
  attrs = getNsAttrs(namespaces).concat(attrs);
2392
2534
  }
2393
- forEach2(attrs, function(a) {
2535
+ forEach(attrs, function(a) {
2394
2536
  writer.append(" ").append(nsName(a.name)).append('="').append(a.value).append('"');
2395
2537
  });
2396
2538
  };
2397
2539
  ElementSerializer.prototype.serializeTo = function(writer) {
2398
- var firstBody = this.body[0], indent = firstBody && firstBody.constructor !== BodySerializer;
2399
- writer.appendIndent().append("<" + this.tagName);
2400
- this.serializeAttributes(writer);
2401
- writer.append(firstBody ? ">" : " />");
2402
- if (firstBody) {
2403
- if (indent) {
2404
- writer.appendNewLine().indent();
2405
- }
2406
- forEach2(this.body, function(b) {
2407
- b.serializeTo(writer);
2408
- });
2409
- if (indent) {
2410
- writer.unindent().appendIndent();
2411
- }
2412
- writer.append("</" + this.tagName + ">");
2413
- }
2414
- writer.appendNewLine();
2540
+ serializeTree(this, writer);
2415
2541
  };
2416
2542
  inherits(TypeSerializer, ElementSerializer);
2417
2543
  TypeSerializer.prototype.parseNsAttributes = function(element) {
@@ -2440,7 +2566,7 @@ var init_dist3 = __esm({
2440
2566
  // node_modules/bpmn-moddle/dist/index.js
2441
2567
  var dist_exports = {};
2442
2568
  __export(dist_exports, {
2443
- default: () => SimpleBpmnModdle
2569
+ BpmnModdle: () => SimpleBpmnModdle
2444
2570
  });
2445
2571
  function BpmnModdle(packages2, options) {
2446
2572
  Moddle.call(this, packages2, options);
@@ -2450,14 +2576,14 @@ function SimpleBpmnModdle(additionalPackages, options) {
2450
2576
  return new BpmnModdle(pks, options);
2451
2577
  }
2452
2578
  var name$5, uri$5, prefix$5, associations$5, types$5, enumerations$3, xml$1, BpmnPackage, name$4, uri$4, prefix$4, types$4, enumerations$2, associations$4, BpmnDiPackage, name$3, uri$3, prefix$3, types$3, associations$3, DcPackage, name$2, uri$2, prefix$2, types$2, associations$2, xml, DiPackage, name$1, uri$1, prefix$1, types$1, enumerations$1, associations$1, BiocPackage, name, uri, prefix, types, enumerations, associations, BpmnInColorPackage, packages;
2453
- var init_dist4 = __esm({
2579
+ var init_dist5 = __esm({
2454
2580
  "node_modules/bpmn-moddle/dist/index.js"() {
2455
- init_index_esm();
2456
2581
  init_dist();
2457
- init_dist3();
2582
+ init_dist2();
2583
+ init_dist4();
2458
2584
  BpmnModdle.prototype = Object.create(Moddle.prototype);
2459
2585
  BpmnModdle.prototype.fromXML = function(xmlStr, typeName, options) {
2460
- if (!isString2(typeName)) {
2586
+ if (!isString(typeName)) {
2461
2587
  options = typeName;
2462
2588
  typeName = "bpmn:Definitions";
2463
2589
  }
@@ -6243,8 +6369,9 @@ var init_zeebe = __esm({
6243
6369
  ],
6244
6370
  meta: {
6245
6371
  allowedIn: [
6246
- "zeebe:ZeebeServiceTask",
6247
- "bpmn:UserTask"
6372
+ "bpmn:UserTask",
6373
+ "zeebe:ExecutionListener",
6374
+ "zeebe:ZeebeServiceTask"
6248
6375
  ]
6249
6376
  },
6250
6377
  properties: [
@@ -6365,6 +6492,11 @@ var init_zeebe = __esm({
6365
6492
  isAttr: true,
6366
6493
  type: "Boolean",
6367
6494
  default: true
6495
+ },
6496
+ {
6497
+ name: "businessId",
6498
+ isAttr: true,
6499
+ type: "String"
6368
6500
  }
6369
6501
  ]
6370
6502
  },
@@ -6398,7 +6530,8 @@ var init_zeebe = __esm({
6398
6530
  ],
6399
6531
  meta: {
6400
6532
  allowedIn: [
6401
- "bpmn:UserTask"
6533
+ "bpmn:UserTask",
6534
+ "bpmn:StartEvent"
6402
6535
  ]
6403
6536
  },
6404
6537
  properties: [
@@ -6546,6 +6679,25 @@ var init_zeebe = __esm({
6546
6679
  }
6547
6680
  ]
6548
6681
  },
6682
+ {
6683
+ name: "JobPriorityDefinition",
6684
+ superClass: [
6685
+ "Element"
6686
+ ],
6687
+ meta: {
6688
+ allowedIn: [
6689
+ "bpmn:Process",
6690
+ "zeebe:ZeebeServiceTask"
6691
+ ]
6692
+ },
6693
+ properties: [
6694
+ {
6695
+ name: "priority",
6696
+ type: "String",
6697
+ isAttr: true
6698
+ }
6699
+ ]
6700
+ },
6549
6701
  {
6550
6702
  name: "TaskSchedule",
6551
6703
  superClass: [
@@ -6623,6 +6775,26 @@ var init_zeebe = __esm({
6623
6775
  }
6624
6776
  ]
6625
6777
  },
6778
+ {
6779
+ name: "ConfigurationSupported",
6780
+ isAbstract: true,
6781
+ extends: [
6782
+ "zeebe:Input",
6783
+ "zeebe:Property"
6784
+ ],
6785
+ properties: [
6786
+ {
6787
+ name: "modelerConfigurationTemplate",
6788
+ isAttr: true,
6789
+ type: "String"
6790
+ },
6791
+ {
6792
+ name: "modelerConfigurationName",
6793
+ isAttr: true,
6794
+ type: "String"
6795
+ }
6796
+ ]
6797
+ },
6626
6798
  {
6627
6799
  name: "TemplatedRootElement",
6628
6800
  isAbstract: true,
@@ -6712,6 +6884,10 @@ var init_zeebe = __esm({
6712
6884
  name: "type",
6713
6885
  type: "String",
6714
6886
  isAttr: true
6887
+ },
6888
+ {
6889
+ name: "headers",
6890
+ type: "TaskHeaders"
6715
6891
  }
6716
6892
  ]
6717
6893
  },
@@ -6852,6 +7028,25 @@ var init_zeebe = __esm({
6852
7028
  type: "String"
6853
7029
  }
6854
7030
  ]
7031
+ },
7032
+ {
7033
+ name: "AgentDefinition",
7034
+ superClass: [
7035
+ "Element"
7036
+ ],
7037
+ meta: {
7038
+ allowedIn: [
7039
+ "bpmn:ServiceTask",
7040
+ "bpmn:AdHocSubProcess"
7041
+ ]
7042
+ },
7043
+ properties: [
7044
+ {
7045
+ name: "agentType",
7046
+ type: "String",
7047
+ isAttr: true
7048
+ }
7049
+ ]
6855
7050
  }
6856
7051
  ]
6857
7052
  };
@@ -6868,15 +7063,8 @@ import { dirname, resolve as resolvePath } from "node:path";
6868
7063
  import { fileURLToPath } from "node:url";
6869
7064
  import { styleText } from "node:util";
6870
7065
 
6871
- // node_modules/min-dash/dist/index.js
6872
- function isUndefined(obj) {
6873
- return obj === void 0;
6874
- }
6875
- function isNil(obj) {
6876
- return obj == null;
6877
- }
6878
-
6879
7066
  // node_modules/@bpmn-io/moddle-utils/index.js
7067
+ init_dist();
6880
7068
  function pathStringify(path, separator = ".") {
6881
7069
  if (isNil(path) || isUndefined(path)) {
6882
7070
  return null;
@@ -6937,7 +7125,7 @@ async function readBpmnInput(filePath) {
6937
7125
  return null;
6938
7126
  }
6939
7127
  async function createBpmnModdle() {
6940
- const BpmnModdle2 = (await Promise.resolve().then(() => (init_dist4(), dist_exports))).default;
7128
+ const { BpmnModdle: BpmnModdle2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports));
6941
7129
  const zeebeSchema = (await Promise.resolve().then(() => (init_zeebe(), zeebe_exports))).default;
6942
7130
  return new BpmnModdle2({ zeebe: zeebeSchema });
6943
7131
  }