@wavemaker/angular-codegen 11.14.1-3.6306 → 11.14.1-32.647748

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.
@@ -5867,14 +5867,14 @@ function createNgModuleType(meta) {
5867
5867
  if (meta.kind === R3NgModuleMetadataKind.Local) {
5868
5868
  return new ExpressionType$1(meta.type.value);
5869
5869
  }
5870
- const { type: moduleType, declarations, exports: exports$1, imports, includeImportTypes, publicDeclarationTypes, } = meta;
5870
+ const { type: moduleType, declarations, exports, imports, includeImportTypes, publicDeclarationTypes, } = meta;
5871
5871
  return new ExpressionType$1(importExpr(Identifiers.NgModuleDeclaration, [
5872
5872
  new ExpressionType$1(moduleType.type),
5873
5873
  publicDeclarationTypes === null
5874
5874
  ? tupleTypeOf(declarations)
5875
5875
  : tupleOfTypes(publicDeclarationTypes),
5876
5876
  includeImportTypes ? tupleTypeOf(imports) : NONE_TYPE,
5877
- tupleTypeOf(exports$1),
5877
+ tupleTypeOf(exports),
5878
5878
  ]));
5879
5879
  }
5880
5880
  /**
@@ -28490,17 +28490,17 @@ var root = freeGlobal || freeSelf || Function('return this')();
28490
28490
  var Symbol$1 = root.Symbol;
28491
28491
 
28492
28492
  /** Used for built-in method references. */
28493
- var objectProto$h = Object.prototype;
28493
+ var objectProto$i = Object.prototype;
28494
28494
 
28495
28495
  /** Used to check objects for own properties. */
28496
- var hasOwnProperty$e = objectProto$h.hasOwnProperty;
28496
+ var hasOwnProperty$f = objectProto$i.hasOwnProperty;
28497
28497
 
28498
28498
  /**
28499
28499
  * Used to resolve the
28500
28500
  * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
28501
28501
  * of values.
28502
28502
  */
28503
- var nativeObjectToString$1 = objectProto$h.toString;
28503
+ var nativeObjectToString$1 = objectProto$i.toString;
28504
28504
 
28505
28505
  /** Built-in value references. */
28506
28506
  var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
@@ -28513,7 +28513,7 @@ var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
28513
28513
  * @returns {string} Returns the raw `toStringTag`.
28514
28514
  */
28515
28515
  function getRawTag(value) {
28516
- var isOwn = hasOwnProperty$e.call(value, symToStringTag$1),
28516
+ var isOwn = hasOwnProperty$f.call(value, symToStringTag$1),
28517
28517
  tag = value[symToStringTag$1];
28518
28518
 
28519
28519
  try {
@@ -28533,14 +28533,14 @@ function getRawTag(value) {
28533
28533
  }
28534
28534
 
28535
28535
  /** Used for built-in method references. */
28536
- var objectProto$g = Object.prototype;
28536
+ var objectProto$h = Object.prototype;
28537
28537
 
28538
28538
  /**
28539
28539
  * Used to resolve the
28540
28540
  * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
28541
28541
  * of values.
28542
28542
  */
28543
- var nativeObjectToString = objectProto$g.toString;
28543
+ var nativeObjectToString = objectProto$h.toString;
28544
28544
 
28545
28545
  /**
28546
28546
  * Converts `value` to a string using `Object.prototype.toString`.
@@ -29006,17 +29006,17 @@ var reIsHostCtor = /^\[object .+?Constructor\]$/;
29006
29006
 
29007
29007
  /** Used for built-in method references. */
29008
29008
  var funcProto$1 = Function.prototype,
29009
- objectProto$f = Object.prototype;
29009
+ objectProto$g = Object.prototype;
29010
29010
 
29011
29011
  /** Used to resolve the decompiled source of functions. */
29012
29012
  var funcToString$1 = funcProto$1.toString;
29013
29013
 
29014
29014
  /** Used to check objects for own properties. */
29015
- var hasOwnProperty$d = objectProto$f.hasOwnProperty;
29015
+ var hasOwnProperty$e = objectProto$g.hasOwnProperty;
29016
29016
 
29017
29017
  /** Used to detect if a method is native. */
29018
29018
  var reIsNative = RegExp('^' +
29019
- funcToString$1.call(hasOwnProperty$d).replace(reRegExpChar, '\\$&')
29019
+ funcToString$1.call(hasOwnProperty$e).replace(reRegExpChar, '\\$&')
29020
29020
  .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
29021
29021
  );
29022
29022
 
@@ -29431,10 +29431,10 @@ function eq(value, other) {
29431
29431
  }
29432
29432
 
29433
29433
  /** Used for built-in method references. */
29434
- var objectProto$e = Object.prototype;
29434
+ var objectProto$f = Object.prototype;
29435
29435
 
29436
29436
  /** Used to check objects for own properties. */
29437
- var hasOwnProperty$c = objectProto$e.hasOwnProperty;
29437
+ var hasOwnProperty$d = objectProto$f.hasOwnProperty;
29438
29438
 
29439
29439
  /**
29440
29440
  * Assigns `value` to `key` of `object` if the existing value is not equivalent
@@ -29448,7 +29448,7 @@ var hasOwnProperty$c = objectProto$e.hasOwnProperty;
29448
29448
  */
29449
29449
  function assignValue(object, key, value) {
29450
29450
  var objValue = object[key];
29451
- if (!(hasOwnProperty$c.call(object, key) && eq(objValue, value)) ||
29451
+ if (!(hasOwnProperty$d.call(object, key) && eq(objValue, value)) ||
29452
29452
  (value === undefined && !(key in object))) {
29453
29453
  baseAssignValue(object, key, value);
29454
29454
  }
@@ -29654,7 +29654,7 @@ function createAssigner(assigner) {
29654
29654
  }
29655
29655
 
29656
29656
  /** Used for built-in method references. */
29657
- var objectProto$d = Object.prototype;
29657
+ var objectProto$e = Object.prototype;
29658
29658
 
29659
29659
  /**
29660
29660
  * Checks if `value` is likely a prototype object.
@@ -29665,7 +29665,7 @@ var objectProto$d = Object.prototype;
29665
29665
  */
29666
29666
  function isPrototype(value) {
29667
29667
  var Ctor = value && value.constructor,
29668
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$d;
29668
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$e;
29669
29669
 
29670
29670
  return value === proto;
29671
29671
  }
@@ -29704,13 +29704,13 @@ function baseIsArguments(value) {
29704
29704
  }
29705
29705
 
29706
29706
  /** Used for built-in method references. */
29707
- var objectProto$c = Object.prototype;
29707
+ var objectProto$d = Object.prototype;
29708
29708
 
29709
29709
  /** Used to check objects for own properties. */
29710
- var hasOwnProperty$b = objectProto$c.hasOwnProperty;
29710
+ var hasOwnProperty$c = objectProto$d.hasOwnProperty;
29711
29711
 
29712
29712
  /** Built-in value references. */
29713
- var propertyIsEnumerable$1 = objectProto$c.propertyIsEnumerable;
29713
+ var propertyIsEnumerable$1 = objectProto$d.propertyIsEnumerable;
29714
29714
 
29715
29715
  /**
29716
29716
  * Checks if `value` is likely an `arguments` object.
@@ -29731,7 +29731,7 @@ var propertyIsEnumerable$1 = objectProto$c.propertyIsEnumerable;
29731
29731
  * // => false
29732
29732
  */
29733
29733
  var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
29734
- return isObjectLike(value) && hasOwnProperty$b.call(value, 'callee') &&
29734
+ return isObjectLike(value) && hasOwnProperty$c.call(value, 'callee') &&
29735
29735
  !propertyIsEnumerable$1.call(value, 'callee');
29736
29736
  };
29737
29737
 
@@ -29904,10 +29904,10 @@ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
29904
29904
  var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
29905
29905
 
29906
29906
  /** Used for built-in method references. */
29907
- var objectProto$b = Object.prototype;
29907
+ var objectProto$c = Object.prototype;
29908
29908
 
29909
29909
  /** Used to check objects for own properties. */
29910
- var hasOwnProperty$a = objectProto$b.hasOwnProperty;
29910
+ var hasOwnProperty$b = objectProto$c.hasOwnProperty;
29911
29911
 
29912
29912
  /**
29913
29913
  * Creates an array of the enumerable property names of the array-like `value`.
@@ -29927,7 +29927,7 @@ function arrayLikeKeys(value, inherited) {
29927
29927
  length = result.length;
29928
29928
 
29929
29929
  for (var key in value) {
29930
- if ((inherited || hasOwnProperty$a.call(value, key)) &&
29930
+ if ((inherited || hasOwnProperty$b.call(value, key)) &&
29931
29931
  !(skipIndexes && (
29932
29932
  // Safari 9 has enumerable `arguments.length` in strict mode.
29933
29933
  key == 'length' ||
@@ -29962,10 +29962,10 @@ function overArg(func, transform) {
29962
29962
  var nativeKeys = overArg(Object.keys, Object);
29963
29963
 
29964
29964
  /** Used for built-in method references. */
29965
- var objectProto$a = Object.prototype;
29965
+ var objectProto$b = Object.prototype;
29966
29966
 
29967
29967
  /** Used to check objects for own properties. */
29968
- var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
29968
+ var hasOwnProperty$a = objectProto$b.hasOwnProperty;
29969
29969
 
29970
29970
  /**
29971
29971
  * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
@@ -29980,7 +29980,7 @@ function baseKeys(object) {
29980
29980
  }
29981
29981
  var result = [];
29982
29982
  for (var key in Object(object)) {
29983
- if (hasOwnProperty$9.call(object, key) && key != 'constructor') {
29983
+ if (hasOwnProperty$a.call(object, key) && key != 'constructor') {
29984
29984
  result.push(key);
29985
29985
  }
29986
29986
  }
@@ -30020,10 +30020,10 @@ function keys(object) {
30020
30020
  }
30021
30021
 
30022
30022
  /** Used for built-in method references. */
30023
- var objectProto$9 = Object.prototype;
30023
+ var objectProto$a = Object.prototype;
30024
30024
 
30025
30025
  /** Used to check objects for own properties. */
30026
- var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
30026
+ var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
30027
30027
 
30028
30028
  /**
30029
30029
  * Assigns own enumerable string keyed properties of source objects to the
@@ -30063,7 +30063,7 @@ var assign = createAssigner(function(object, source) {
30063
30063
  return;
30064
30064
  }
30065
30065
  for (var key in source) {
30066
- if (hasOwnProperty$8.call(source, key)) {
30066
+ if (hasOwnProperty$9.call(source, key)) {
30067
30067
  assignValue(object, key, source[key]);
30068
30068
  }
30069
30069
  }
@@ -30089,10 +30089,10 @@ function nativeKeysIn(object) {
30089
30089
  }
30090
30090
 
30091
30091
  /** Used for built-in method references. */
30092
- var objectProto$8 = Object.prototype;
30092
+ var objectProto$9 = Object.prototype;
30093
30093
 
30094
30094
  /** Used to check objects for own properties. */
30095
- var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
30095
+ var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
30096
30096
 
30097
30097
  /**
30098
30098
  * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
@@ -30109,7 +30109,7 @@ function baseKeysIn(object) {
30109
30109
  result = [];
30110
30110
 
30111
30111
  for (var key in object) {
30112
- if (!(key == 'constructor' && (isProto || !hasOwnProperty$7.call(object, key)))) {
30112
+ if (!(key == 'constructor' && (isProto || !hasOwnProperty$8.call(object, key)))) {
30113
30113
  result.push(key);
30114
30114
  }
30115
30115
  }
@@ -30203,10 +30203,10 @@ function hashDelete(key) {
30203
30203
  var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
30204
30204
 
30205
30205
  /** Used for built-in method references. */
30206
- var objectProto$7 = Object.prototype;
30206
+ var objectProto$8 = Object.prototype;
30207
30207
 
30208
30208
  /** Used to check objects for own properties. */
30209
- var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
30209
+ var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
30210
30210
 
30211
30211
  /**
30212
30212
  * Gets the hash value for `key`.
@@ -30223,14 +30223,14 @@ function hashGet(key) {
30223
30223
  var result = data[key];
30224
30224
  return result === HASH_UNDEFINED$2 ? undefined : result;
30225
30225
  }
30226
- return hasOwnProperty$6.call(data, key) ? data[key] : undefined;
30226
+ return hasOwnProperty$7.call(data, key) ? data[key] : undefined;
30227
30227
  }
30228
30228
 
30229
30229
  /** Used for built-in method references. */
30230
- var objectProto$6 = Object.prototype;
30230
+ var objectProto$7 = Object.prototype;
30231
30231
 
30232
30232
  /** Used to check objects for own properties. */
30233
- var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
30233
+ var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
30234
30234
 
30235
30235
  /**
30236
30236
  * Checks if a hash value for `key` exists.
@@ -30243,7 +30243,7 @@ var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
30243
30243
  */
30244
30244
  function hashHas(key) {
30245
30245
  var data = this.__data__;
30246
- return nativeCreate ? (data[key] !== undefined) : hasOwnProperty$5.call(data, key);
30246
+ return nativeCreate ? (data[key] !== undefined) : hasOwnProperty$6.call(data, key);
30247
30247
  }
30248
30248
 
30249
30249
  /** Used to stand-in for `undefined` hash values. */
@@ -30888,13 +30888,13 @@ var objectTag$3 = '[object Object]';
30888
30888
 
30889
30889
  /** Used for built-in method references. */
30890
30890
  var funcProto = Function.prototype,
30891
- objectProto$5 = Object.prototype;
30891
+ objectProto$6 = Object.prototype;
30892
30892
 
30893
30893
  /** Used to resolve the decompiled source of functions. */
30894
30894
  var funcToString = funcProto.toString;
30895
30895
 
30896
30896
  /** Used to check objects for own properties. */
30897
- var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
30897
+ var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
30898
30898
 
30899
30899
  /** Used to infer the `Object` constructor. */
30900
30900
  var objectCtorString = funcToString.call(Object);
@@ -30935,7 +30935,7 @@ function isPlainObject(value) {
30935
30935
  if (proto === null) {
30936
30936
  return true;
30937
30937
  }
30938
- var Ctor = hasOwnProperty$4.call(proto, 'constructor') && proto.constructor;
30938
+ var Ctor = hasOwnProperty$5.call(proto, 'constructor') && proto.constructor;
30939
30939
  return typeof Ctor == 'function' && Ctor instanceof Ctor &&
30940
30940
  funcToString.call(Ctor) == objectCtorString;
30941
30941
  }
@@ -31740,10 +31740,10 @@ function stubArray() {
31740
31740
  }
31741
31741
 
31742
31742
  /** Used for built-in method references. */
31743
- var objectProto$4 = Object.prototype;
31743
+ var objectProto$5 = Object.prototype;
31744
31744
 
31745
31745
  /** Built-in value references. */
31746
- var propertyIsEnumerable = objectProto$4.propertyIsEnumerable;
31746
+ var propertyIsEnumerable = objectProto$5.propertyIsEnumerable;
31747
31747
 
31748
31748
  /* Built-in method references for those with the same name as other `lodash` methods. */
31749
31749
  var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
@@ -31906,10 +31906,10 @@ if ((DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$3)
31906
31906
  }
31907
31907
 
31908
31908
  /** Used for built-in method references. */
31909
- var objectProto$3 = Object.prototype;
31909
+ var objectProto$4 = Object.prototype;
31910
31910
 
31911
31911
  /** Used to check objects for own properties. */
31912
- var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
31912
+ var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
31913
31913
 
31914
31914
  /**
31915
31915
  * Initializes an array clone.
@@ -31923,7 +31923,7 @@ function initCloneArray(array) {
31923
31923
  result = new array.constructor(length);
31924
31924
 
31925
31925
  // Add properties assigned by `RegExp#exec`.
31926
- if (length && typeof array[0] == 'string' && hasOwnProperty$3.call(array, 'index')) {
31926
+ if (length && typeof array[0] == 'string' && hasOwnProperty$4.call(array, 'index')) {
31927
31927
  result.index = array.index;
31928
31928
  result.input = array.input;
31929
31929
  }
@@ -32384,7 +32384,7 @@ function setCacheAdd(value) {
32384
32384
  * @name has
32385
32385
  * @memberOf SetCache
32386
32386
  * @param {*} value The value to search for.
32387
- * @returns {number} Returns `true` if `value` is found, else `false`.
32387
+ * @returns {boolean} Returns `true` if `value` is found, else `false`.
32388
32388
  */
32389
32389
  function setCacheHas(value) {
32390
32390
  return this.__data__.has(value);
@@ -32667,10 +32667,10 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
32667
32667
  var COMPARE_PARTIAL_FLAG$3 = 1;
32668
32668
 
32669
32669
  /** Used for built-in method references. */
32670
- var objectProto$2 = Object.prototype;
32670
+ var objectProto$3 = Object.prototype;
32671
32671
 
32672
32672
  /** Used to check objects for own properties. */
32673
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
32673
+ var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
32674
32674
 
32675
32675
  /**
32676
32676
  * A specialized version of `baseIsEqualDeep` for objects with support for
@@ -32698,7 +32698,7 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
32698
32698
  var index = objLength;
32699
32699
  while (index--) {
32700
32700
  var key = objProps[index];
32701
- if (!(isPartial ? key in other : hasOwnProperty$2.call(other, key))) {
32701
+ if (!(isPartial ? key in other : hasOwnProperty$3.call(other, key))) {
32702
32702
  return false;
32703
32703
  }
32704
32704
  }
@@ -32759,10 +32759,10 @@ var argsTag = '[object Arguments]',
32759
32759
  objectTag = '[object Object]';
32760
32760
 
32761
32761
  /** Used for built-in method references. */
32762
- var objectProto$1 = Object.prototype;
32762
+ var objectProto$2 = Object.prototype;
32763
32763
 
32764
32764
  /** Used to check objects for own properties. */
32765
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
32765
+ var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
32766
32766
 
32767
32767
  /**
32768
32768
  * A specialized version of `baseIsEqual` for arrays and objects which performs
@@ -32805,8 +32805,8 @@ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
32805
32805
  : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
32806
32806
  }
32807
32807
  if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
32808
- var objIsWrapped = objIsObj && hasOwnProperty$1.call(object, '__wrapped__'),
32809
- othIsWrapped = othIsObj && hasOwnProperty$1.call(other, '__wrapped__');
32808
+ var objIsWrapped = objIsObj && hasOwnProperty$2.call(object, '__wrapped__'),
32809
+ othIsWrapped = othIsObj && hasOwnProperty$2.call(other, '__wrapped__');
32810
32810
 
32811
32811
  if (objIsWrapped || othIsWrapped) {
32812
32812
  var objUnwrapped = objIsWrapped ? object.value() : object,
@@ -34349,10 +34349,10 @@ var mapTag = '[object Map]',
34349
34349
  setTag = '[object Set]';
34350
34350
 
34351
34351
  /** Used for built-in method references. */
34352
- var objectProto = Object.prototype;
34352
+ var objectProto$1 = Object.prototype;
34353
34353
 
34354
34354
  /** Used to check objects for own properties. */
34355
- var hasOwnProperty = objectProto.hasOwnProperty;
34355
+ var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
34356
34356
 
34357
34357
  /**
34358
34358
  * Checks if `value` is an empty object, collection, map, or set.
@@ -34404,7 +34404,7 @@ function isEmpty(value) {
34404
34404
  return !baseKeys(value).length;
34405
34405
  }
34406
34406
  for (var key in value) {
34407
- if (hasOwnProperty.call(value, key)) {
34407
+ if (hasOwnProperty$1.call(value, key)) {
34408
34408
  return false;
34409
34409
  }
34410
34410
  }
@@ -34628,6 +34628,12 @@ var merge$1 = createAssigner(function(object, source, srcIndex) {
34628
34628
  baseMerge(object, source, srcIndex);
34629
34629
  });
34630
34630
 
34631
+ /** Used for built-in method references. */
34632
+ var objectProto = Object.prototype;
34633
+
34634
+ /** Used to check objects for own properties. */
34635
+ var hasOwnProperty = objectProto.hasOwnProperty;
34636
+
34631
34637
  /**
34632
34638
  * The base implementation of `_.unset`.
34633
34639
  *
@@ -34638,8 +34644,34 @@ var merge$1 = createAssigner(function(object, source, srcIndex) {
34638
34644
  */
34639
34645
  function baseUnset(object, path) {
34640
34646
  path = castPath(path, object);
34641
- object = parent$1(object, path);
34642
- return object == null || delete object[toKey(last$1(path))];
34647
+
34648
+ // Prevent prototype pollution:
34649
+ // https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
34650
+ // https://github.com/lodash/lodash/security/advisories/GHSA-f23m-r3pf-42rh
34651
+ var index = -1,
34652
+ length = path.length;
34653
+
34654
+ if (!length) {
34655
+ return true;
34656
+ }
34657
+
34658
+ while (++index < length) {
34659
+ var key = toKey(path[index]);
34660
+
34661
+ // Always block "__proto__" anywhere in the path if it's not expected
34662
+ if (key === '__proto__' && !hasOwnProperty.call(object, '__proto__')) {
34663
+ return false;
34664
+ }
34665
+
34666
+ // Block constructor/prototype as non-terminal traversal keys to prevent
34667
+ // escaping the object graph into built-in constructors and prototypes.
34668
+ if ((key === 'constructor' || key === 'prototype') && index < length - 1) {
34669
+ return false;
34670
+ }
34671
+ }
34672
+
34673
+ var obj = parent$1(object, path);
34674
+ return obj == null || delete obj[toKey(last$1(path))];
34643
34675
  }
34644
34676
 
34645
34677
  /**
@@ -34816,7 +34848,7 @@ function baseOrderBy(collection, iteratees, orders) {
34816
34848
  if (isArray(iteratee)) {
34817
34849
  return function(value) {
34818
34850
  return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
34819
- }
34851
+ };
34820
34852
  }
34821
34853
  return iteratee;
34822
34854
  });
@@ -37685,11 +37717,22 @@ function requireConventions () {
37685
37717
  XMLNS: 'http://www.w3.org/2000/xmlns/',
37686
37718
  });
37687
37719
 
37720
+ //[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
37721
+ //[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
37722
+ //[5] Name ::= NameStartChar (NameChar)*
37723
+ var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;//\u10000-\uEFFFF
37724
+ var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
37725
+ var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$');
37726
+ //var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/
37727
+
37688
37728
  conventions.assign = assign;
37689
37729
  conventions.find = find;
37690
37730
  conventions.freeze = freeze;
37691
37731
  conventions.MIME_TYPE = MIME_TYPE;
37692
37732
  conventions.NAMESPACE = NAMESPACE;
37733
+ conventions.nameStartChar = nameStartChar;
37734
+ conventions.nameChar = nameChar;
37735
+ conventions.tagNamePattern = tagNamePattern;
37693
37736
  return conventions;
37694
37737
  }
37695
37738
 
@@ -37702,6 +37745,7 @@ function requireDom () {
37702
37745
 
37703
37746
  var find = conventions.find;
37704
37747
  var NAMESPACE = conventions.NAMESPACE;
37748
+ var tagNamePattern = conventions.tagNamePattern;
37705
37749
 
37706
37750
  /**
37707
37751
  * A prerequisite for `[].filter`, to drop elements that are empty
@@ -37811,14 +37855,14 @@ function requireDom () {
37811
37855
  ExceptionCode.DOMSTRING_SIZE_ERR = ((ExceptionMessage[2]="DOMString size error"),2);
37812
37856
  var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = ((ExceptionMessage[3]="Hierarchy request error"),3);
37813
37857
  ExceptionCode.WRONG_DOCUMENT_ERR = ((ExceptionMessage[4]="Wrong document"),4);
37814
- ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5);
37858
+ var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5);
37815
37859
  ExceptionCode.NO_DATA_ALLOWED_ERR = ((ExceptionMessage[6]="No data allowed"),6);
37816
37860
  ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = ((ExceptionMessage[7]="No modification allowed"),7);
37817
37861
  var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = ((ExceptionMessage[8]="Not found"),8);
37818
37862
  ExceptionCode.NOT_SUPPORTED_ERR = ((ExceptionMessage[9]="Not supported"),9);
37819
37863
  var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = ((ExceptionMessage[10]="Attribute in use"),10);
37820
37864
  //level2
37821
- ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11);
37865
+ var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11);
37822
37866
  ExceptionCode.SYNTAX_ERR = ((ExceptionMessage[12]="Syntax error"),12);
37823
37867
  ExceptionCode.INVALID_MODIFICATION_ERR = ((ExceptionMessage[13]="Invalid modification"),13);
37824
37868
  ExceptionCode.NAMESPACE_ERR = ((ExceptionMessage[14]="Invalid namespace"),14);
@@ -37868,9 +37912,10 @@ function requireDom () {
37868
37912
  item: function(index) {
37869
37913
  return index >= 0 && index < this.length ? this[index] : null;
37870
37914
  },
37871
- toString:function(isHTML,nodeFilter){
37915
+ toString:function(isHTML,nodeFilter,options){
37916
+ var requireWellFormed = !!options && !!options.requireWellFormed;
37872
37917
  for(var buf = [], i = 0;i<this.length;i++){
37873
- serializeToString(this[i],buf,isHTML,nodeFilter);
37918
+ serializeToString(this[i],buf,isHTML,nodeFilter,null,requireWellFormed);
37874
37919
  }
37875
37920
  return buf.join('');
37876
37921
  },
@@ -37932,6 +37977,13 @@ function requireDom () {
37932
37977
  * used for attributes or DocumentType entities
37933
37978
  */
37934
37979
  function NamedNodeMap() {
37980
+ // nodeName -> Attr membership index; lets the parse-time de-duplication in
37981
+ // setNamedItem resolve an existing attribute in O(1) instead of scanning the
37982
+ // list, so building an element with M attributes costs O(M) rather than O(M^2).
37983
+ // The numbered entries and length remain the sole authority for attribute order.
37984
+ // Object.create(null) so an attribute named __proto__ or constructor is an
37985
+ // ordinary key.
37986
+ this._nameIndex = Object.create(null);
37935
37987
  }
37936
37988
  function _findNodeIndex(list,node){
37937
37989
  var i = list.length;
@@ -37940,12 +37992,27 @@ function requireDom () {
37940
37992
  }
37941
37993
  }
37942
37994
 
37995
+ function _nnmIndexAdd(list, attr) {
37996
+ list._nameIndex[attr.nodeName] = attr;
37997
+ }
37998
+ function _nnmIndexRemove(list, attr) {
37999
+ // Only drop the entry if it still points at this attribute; a replacement with
38000
+ // a different nodeName may already have re-keyed it.
38001
+ if (list._nameIndex[attr.nodeName] === attr) {
38002
+ delete list._nameIndex[attr.nodeName];
38003
+ }
38004
+ }
38005
+
37943
38006
  function _addNamedNode(el,list,newAttr,oldAttr){
37944
38007
  if(oldAttr){
37945
38008
  list[_findNodeIndex(list,oldAttr)] = newAttr;
38009
+ // oldAttr leaves the list; drop its index entry (its nodeName may differ
38010
+ // from newAttr's when the replacement came via setNamedItemNS).
38011
+ _nnmIndexRemove(list, oldAttr);
37946
38012
  }else {
37947
38013
  list[list.length++] = newAttr;
37948
38014
  }
38015
+ _nnmIndexAdd(list, newAttr);
37949
38016
  if(el){
37950
38017
  newAttr.ownerElement = el;
37951
38018
  var doc = el.ownerDocument;
@@ -37964,6 +38031,7 @@ function requireDom () {
37964
38031
  list[i] = list[++i];
37965
38032
  }
37966
38033
  list.length = lastIndex;
38034
+ _nnmIndexRemove(list, attr);
37967
38035
  if(el){
37968
38036
  var doc = el.ownerDocument;
37969
38037
  if(doc){
@@ -37997,7 +38065,11 @@ function requireDom () {
37997
38065
  if(el && el!=this._ownerElement){
37998
38066
  throw new DOMException(INUSE_ATTRIBUTE_ERR);
37999
38067
  }
38000
- var oldAttr = this.getNamedItem(attr.nodeName);
38068
+ // Resolve any existing attribute with the same nodeName through the O(1)
38069
+ // membership index rather than an O(M) scan — this is the parse-dedup hot
38070
+ // path (setAttributeNode per attribute during parse). Absent -> undefined,
38071
+ // matching getNamedItem's contract.
38072
+ var oldAttr = this._nameIndex[attr.nodeName];
38001
38073
  _addNamedNode(this._ownerElement,this,attr,oldAttr);
38002
38074
  return oldAttr;
38003
38075
  },
@@ -38115,13 +38187,28 @@ function requireDom () {
38115
38187
  /**
38116
38188
  * Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.
38117
38189
  *
38118
- * __This behavior is slightly different from the in the specs__:
38190
+ * __This implementation differs from the specification:__
38119
38191
  * - this implementation is not validating names or qualified names
38120
38192
  * (when parsing XML strings, the SAX parser takes care of that)
38121
38193
  *
38194
+ * Note: `internalSubset` can only be introduced via a direct property write to `node.internalSubset` after creation.
38195
+ * Creation-time validation of `publicId`, `systemId` is not enforced.
38196
+ * The serializer-level check covers all mutation vectors, including direct property writes.
38197
+ * `internalSubset` is only serialized as `[ ... ]` when both `publicId` and `systemId` are
38198
+ * absent (empty or `'.'`) — if either external identifier is present, `internalSubset` is
38199
+ * silently omitted from the serialized output.
38200
+ *
38122
38201
  * @param {string} qualifiedName
38123
38202
  * @param {string} [publicId]
38203
+ * The external subset public identifier. Stored verbatim including surrounding quotes.
38204
+ * When serialized with `requireWellFormed: true` (via the 4th-parameter options object),
38205
+ * throws `DOMException` with code `INVALID_STATE_ERR` if the value is non-empty and does
38206
+ * not match the XML `PubidLiteral` production (W3C DOM Parsing §3.2.1.3; XML 1.0 [12]).
38124
38207
  * @param {string} [systemId]
38208
+ * The external subset system identifier. Stored verbatim including surrounding quotes.
38209
+ * When serialized with `requireWellFormed: true`, throws `DOMException` with code
38210
+ * `INVALID_STATE_ERR` if the value is non-empty and does not match the XML `SystemLiteral`
38211
+ * production (W3C DOM Parsing §3.2.1.3; XML 1.0 [11]).
38125
38212
  * @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation
38126
38213
  * or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`
38127
38214
  *
@@ -38187,18 +38274,73 @@ function requireDom () {
38187
38274
  return cloneNode(this.ownerDocument||this,this,deep);
38188
38275
  },
38189
38276
  // Modified in DOM Level 2:
38190
- normalize:function(){
38191
- var child = this.firstChild;
38192
- while(child){
38193
- var next = child.nextSibling;
38194
- if(next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE){
38195
- this.removeChild(next);
38196
- child.appendData(next.data);
38197
- }else {
38198
- child.normalize();
38199
- child = next;
38200
- }
38201
- }
38277
+ /**
38278
+ * Puts the specified node and all of its subtree into a "normalized" form. In a normalized
38279
+ * subtree, no text nodes in the subtree are empty and there are no adjacent text nodes.
38280
+ *
38281
+ * Specifically, this method merges any adjacent text nodes (i.e., nodes for which `nodeType`
38282
+ * is `TEXT_NODE`) into a single node with the combined data. It also removes any empty text
38283
+ * nodes.
38284
+ *
38285
+ * This method iteratively traverses all child nodes to normalize all descendant nodes within
38286
+ * the subtree.
38287
+ *
38288
+ * @throws {DOMException}
38289
+ * May throw a DOMException if operations within removeChild or appendData (which are
38290
+ * potentially invoked in this method) do not meet their specific constraints.
38291
+ * @see {@link Node.removeChild}
38292
+ * @see {@link CharacterData.appendData}
38293
+ * @see ../docs/walk-dom.md.
38294
+ */
38295
+ normalize: function () {
38296
+ walkDOM(this, null, {
38297
+ enter: function (node) {
38298
+ // Merge adjacent text children of node before walkDOM schedules them.
38299
+ // walkDOM reads lastChild/previousSibling after enter returns, so the
38300
+ // surviving post-merge children are what it descends into.
38301
+ var child = node.firstChild;
38302
+ while (child) {
38303
+ var next = child.nextSibling;
38304
+ if (next !== null && next.nodeType === TEXT_NODE && child.nodeType === TEXT_NODE) {
38305
+ // Merge the whole run of adjacent text nodes at once: gather the
38306
+ // following text siblings' data, unlink them in a single pass, and
38307
+ // re-index the child list a single time. Per-sibling `removeChild`
38308
+ // (each an O(K) re-index) plus per-sibling `appendData` (each an O(K)
38309
+ // string rebuild) is O(K^2) over a long run of single-character text
38310
+ // nodes; this keeps it O(K). The first text node of the run survives
38311
+ // and carries the concatenated data, preserving node identity and
38312
+ // locator semantics.
38313
+ var tail = [];
38314
+ var sibling = next;
38315
+ while (sibling !== null && sibling.nodeType === TEXT_NODE) {
38316
+ tail.push(sibling.data);
38317
+ sibling = sibling.nextSibling;
38318
+ }
38319
+ // `sibling` is now the first non-text node after the run, or null.
38320
+ var removed = child.nextSibling;
38321
+ while (removed !== sibling) {
38322
+ var following = removed.nextSibling;
38323
+ removed.parentNode = null;
38324
+ removed.previousSibling = null;
38325
+ removed.nextSibling = null;
38326
+ removed = following;
38327
+ }
38328
+ child.nextSibling = sibling;
38329
+ if (sibling !== null) {
38330
+ sibling.previousSibling = child;
38331
+ } else {
38332
+ node.lastChild = child;
38333
+ }
38334
+ child.appendData(tail.join('')); // single O(K) string rebuild
38335
+ _onUpdateChild(node.ownerDocument, node); // single O(K) re-index
38336
+ child = sibling;
38337
+ } else {
38338
+ child = next;
38339
+ }
38340
+ }
38341
+ return true; // descend into surviving children
38342
+ },
38343
+ });
38202
38344
  },
38203
38345
  // Introduced in DOM Level 2:
38204
38346
  isSupported:function(feature, version){
@@ -38274,21 +38416,103 @@ function requireDom () {
38274
38416
  copy(NodeType,Node.prototype);
38275
38417
 
38276
38418
  /**
38277
- * @param callback return true for continue,false for break
38278
- * @return boolean true: break visit;
38419
+ * @param {Node} node
38420
+ * Root of the subtree to visit.
38421
+ * @param {function(Node): boolean} callback
38422
+ * Called for each node in depth-first pre-order. Return a truthy value to stop traversal early.
38423
+ * @return {boolean} `true` if traversal was aborted by the callback, `false` otherwise.
38279
38424
  */
38280
- function _visitNode(node,callback){
38281
- if(callback(node)){
38282
- return true;
38283
- }
38284
- if(node = node.firstChild){
38285
- do{
38286
- if(_visitNode(node,callback)){return true}
38287
- }while(node=node.nextSibling)
38288
- }
38425
+ function _visitNode(node, callback) {
38426
+ return walkDOM(node, null, { enter: function (n) { return callback(n) ? walkDOM.STOP : true; } }) === walkDOM.STOP;
38289
38427
  }
38290
38428
 
38429
+ /**
38430
+ * Depth-first pre/post-order DOM tree walker.
38431
+ *
38432
+ * Visits every node in the subtree rooted at `node`. For each node:
38433
+ *
38434
+ * 1. Calls `callbacks.enter(node, context)` before descending into the node's children. The
38435
+ * return value becomes the `context` passed to each child's `enter` call and to the matching
38436
+ * `exit` call.
38437
+ * 2. If `enter` returns `null` or `undefined`, the node's children are skipped;
38438
+ * sibling traversal continues normally.
38439
+ * 3. If `enter` returns `walkDOM.STOP`, the entire traversal is aborted immediately — no
38440
+ * further `enter` or `exit` calls are made.
38441
+ * 4. `lastChild` and `previousSibling` are read **after** `enter` returns, so `enter` may
38442
+ * safely modify the node's own child list before the walker descends. Modifying siblings of
38443
+ * the current node or any other part of the tree produces unpredictable results: nodes already
38444
+ * queued on the stack are visited regardless of DOM changes, and newly inserted nodes outside
38445
+ * the current child list are never visited.
38446
+ * 5. Calls `callbacks.exit(node, context)` (if provided) after all of a node's children have
38447
+ * been visited, passing the same `context` that `enter`
38448
+ * returned for that node.
38449
+ *
38450
+ * This implementation uses an explicit stack and does not recurse — it is safe on arbitrarily
38451
+ * deep trees.
38452
+ *
38453
+ * @param {Node} node
38454
+ * Root of the subtree to walk.
38455
+ * @param {*} context
38456
+ * Initial context value passed to the root node's `enter`.
38457
+ * @param {{ enter: function(Node, *): *, exit?: function(Node, *): void }} callbacks
38458
+ * @returns {void | walkDOM.STOP}
38459
+ * @see ../docs/walk-dom.md.
38460
+ */
38461
+ function walkDOM(node, context, callbacks) {
38462
+ // Each stack frame is {node, context, phase}:
38463
+ // walkDOM.ENTER — call enter, then push children
38464
+ // walkDOM.EXIT — call exit
38465
+ var stack = [{ node: node, context: context, phase: walkDOM.ENTER }];
38466
+ while (stack.length > 0) {
38467
+ var frame = stack.pop();
38468
+ if (frame.phase === walkDOM.ENTER) {
38469
+ var childContext = callbacks.enter(frame.node, frame.context);
38470
+ if (childContext === walkDOM.STOP) {
38471
+ return walkDOM.STOP;
38472
+ }
38473
+ // Push exit frame before children so it fires after all children are processed (Last In First Out)
38474
+ stack.push({ node: frame.node, context: childContext, phase: walkDOM.EXIT });
38475
+ if (childContext === null || childContext === undefined) {
38476
+ continue; // skip children
38477
+ }
38478
+ // lastChild is read after enter returns, so enter may modify the child list.
38479
+ var child = frame.node.lastChild;
38480
+ // Traverse from lastChild backwards so that pushing onto the stack
38481
+ // naturally yields firstChild on top (processed first).
38482
+ while (child) {
38483
+ stack.push({ node: child, context: childContext, phase: walkDOM.ENTER });
38484
+ child = child.previousSibling;
38485
+ }
38486
+ } else {
38487
+ // frame.phase === walkDOM.EXIT
38488
+ if (callbacks.exit) {
38489
+ callbacks.exit(frame.node, frame.context);
38490
+ }
38491
+ }
38492
+ }
38493
+ }
38291
38494
 
38495
+ /**
38496
+ * Sentinel value returned from a `walkDOM` `enter` callback to abort the entire traversal
38497
+ * immediately.
38498
+ *
38499
+ * @type {symbol}
38500
+ */
38501
+ walkDOM.STOP = Symbol('walkDOM.STOP');
38502
+ /**
38503
+ * Phase constant for a stack frame that has not yet been visited.
38504
+ * The `enter` callback is called and children are scheduled.
38505
+ *
38506
+ * @type {number}
38507
+ */
38508
+ walkDOM.ENTER = 0;
38509
+ /**
38510
+ * Phase constant for a stack frame whose subtree has been fully visited.
38511
+ * The `exit` callback is called.
38512
+ *
38513
+ * @type {number}
38514
+ */
38515
+ walkDOM.EXIT = 1;
38292
38516
 
38293
38517
  function Document(){
38294
38518
  this.ownerDocument = this;
@@ -38892,12 +39116,46 @@ function requireDom () {
38892
39116
  node.appendData(data);
38893
39117
  return node;
38894
39118
  },
39119
+ /**
39120
+ * Returns a new CDATASection node whose data is `data`.
39121
+ *
39122
+ * __This implementation differs from the specification:__
39123
+ * - calling this method on an HTML document does not throw `NotSupportedError`.
39124
+ *
39125
+ * @param {string} data
39126
+ * @returns {CDATASection}
39127
+ * @throws DOMException with code `INVALID_CHARACTER_ERR` if `data` contains `"]]>"`.
39128
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createCDATASection
39129
+ * @see https://dom.spec.whatwg.org/#dom-document-createcdatasection
39130
+ */
38895
39131
  createCDATASection : function(data){
39132
+ if (data.indexOf(']]>') !== -1) {
39133
+ throw new DOMException(INVALID_CHARACTER_ERR, 'data contains "]]>"');
39134
+ }
38896
39135
  var node = new CDATASection();
38897
39136
  node.ownerDocument = this;
38898
39137
  node.appendData(data);
38899
39138
  return node;
38900
39139
  },
39140
+ /**
39141
+ * Returns a ProcessingInstruction node whose target is target and data is data.
39142
+ *
39143
+ * __This implementation differs from the specification:__
39144
+ * - it does not do any input validation on the arguments and doesn't throw "InvalidCharacterError".
39145
+ *
39146
+ * Note: When the resulting document is serialized with `requireWellFormed: true`, the
39147
+ * serializer throws with code `INVALID_STATE_ERR` if `.target` is not a valid XML `NCName`
39148
+ * (a `Name` with no colon) or is an ASCII case-insensitive match for `"xml"`, or if `.data`
39149
+ * contains `?>` (W3C DOM Parsing §3.2.1.7). Without that option the target and data are
39150
+ * emitted verbatim.
39151
+ *
39152
+ * @param {string} target
39153
+ * @param {string} data
39154
+ * @returns {ProcessingInstruction}
39155
+ * @see https://developer.mozilla.org/docs/Web/API/Document/createProcessingInstruction
39156
+ * @see https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction
39157
+ * @see https://www.w3.org/TR/DOM-Parsing/#dfn-concept-serialize-xml §3.2.1.7
39158
+ */
38901
39159
  createProcessingInstruction : function(target,data){
38902
39160
  var node = new ProcessingInstruction();
38903
39161
  node.ownerDocument = this;
@@ -38914,7 +39172,27 @@ function requireDom () {
38914
39172
  node.specified = true;
38915
39173
  return node;
38916
39174
  },
39175
+ /**
39176
+ * Creates an EntityReference object, serialized as `&name;`.
39177
+ *
39178
+ * The `name` is validated against the XML `Name` production at creation time; an invalid name
39179
+ * throws a `DOMException` with code `INVALID_CHARACTER_ERR`. When the resulting node is
39180
+ * serialized with `requireWellFormed: true`, the serializer re-validates `nodeName` and throws
39181
+ * a `DOMException` with code `INVALID_STATE_ERR` if a later `nodeName` mutation made it invalid;
39182
+ * without that option the name is emitted verbatim.
39183
+ *
39184
+ * Note: xmldom does not expand entities — the parser resolves entity references inline and never
39185
+ * constructs `EntityReference` nodes, so this method is the only producer.
39186
+ *
39187
+ * @param {string} name The name of the entity to reference.
39188
+ * @returns {EntityReference}
39189
+ * @throws {DOMException} With code `INVALID_CHARACTER_ERR` when `name` is not a valid XML `Name`.
39190
+ * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-392B75AE
39191
+ */
38917
39192
  createEntityReference : function(name){
39193
+ if (!tagNamePattern.test(name)) {
39194
+ throw new DOMException(INVALID_CHARACTER_ERR, 'not a valid xml name "' + name + '"');
39195
+ }
38918
39196
  var node = new EntityReference();
38919
39197
  node.ownerDocument = this;
38920
39198
  node.nodeName = name;
@@ -39123,6 +39401,20 @@ function requireDom () {
39123
39401
  _extends(CDATASection,CharacterData);
39124
39402
 
39125
39403
 
39404
+ /**
39405
+ * Represents a DocumentType node (the `<!DOCTYPE ...>` declaration).
39406
+ *
39407
+ * `name`, `publicId`, `systemId`, and `internalSubset` are plain own-property assignments.
39408
+ * xmldom does not enforce the `readonly` constraint declared by the WHATWG DOM spec —
39409
+ * direct property writes succeed silently. Values are serialized verbatim when
39410
+ * `requireWellFormed` is false (the default). When the serializer is invoked with
39411
+ * `requireWellFormed: true` (via the 4th-parameter options object), it validates each
39412
+ * field — including `name`, which is checked against the XML `Name` production — and throws
39413
+ * `DOMException` with code `INVALID_STATE_ERR` on invalid values.
39414
+ *
39415
+ * @class
39416
+ * @see https://developer.mozilla.org/docs/Web/API/DocumentType MDN
39417
+ */
39126
39418
  function DocumentType() {
39127
39419
  } DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
39128
39420
  _extends(DocumentType,Node);
@@ -39135,6 +39427,20 @@ function requireDom () {
39135
39427
  } Entity.prototype.nodeType = ENTITY_NODE;
39136
39428
  _extends(Entity,Node);
39137
39429
 
39430
+ /**
39431
+ * Represents an EntityReference node, serialized as `&nodeName;`.
39432
+ *
39433
+ * `nodeName` is the referenced entity's name, stored verbatim. When serialized with
39434
+ * `requireWellFormed: true`, the serializer validates `nodeName` against the XML `Name` production
39435
+ * and throws a `DOMException` with code `INVALID_STATE_ERR` if it does not match; without that
39436
+ * option the name is emitted verbatim between `&` and `;`.
39437
+ *
39438
+ * Note: xmldom does not expand entities — the parser resolves entity references inline and never
39439
+ * constructs `EntityReference` nodes, so the only producer is `Document.createEntityReference`.
39440
+ *
39441
+ * @class
39442
+ * @see https://www.w3.org/TR/xml/#NT-Name
39443
+ */
39138
39444
  function EntityReference() {
39139
39445
  } EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
39140
39446
  _extends(EntityReference,Node);
@@ -39150,11 +39456,54 @@ function requireDom () {
39150
39456
  ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
39151
39457
  _extends(ProcessingInstruction,Node);
39152
39458
  function XMLSerializer(){}
39153
- XMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter){
39154
- return nodeSerializeToString.call(node,isHtml,nodeFilter);
39459
+ /**
39460
+ * Returns the result of serializing `node` to XML.
39461
+ *
39462
+ * When `options.requireWellFormed` is `true`, the serializer throws for content that would
39463
+ * produce ill-formed XML.
39464
+ *
39465
+ * __This implementation differs from the specification:__
39466
+ * - CDATASection nodes whose data contains `]]>` are serialized by splitting the section
39467
+ * at each `]]>` occurrence (following W3C DOM Level 3 Core `split-cdata-sections`
39468
+ * default behaviour) unless `requireWellFormed` is `true`.
39469
+ * - when `requireWellFormed` is `true`, `DOMException` with code `INVALID_STATE_ERR`
39470
+ * is only thrown to prevent injection vectors, not for all the spec mandated checks.
39471
+ *
39472
+ * @param {Node} node
39473
+ * @param {boolean} [isHtml]
39474
+ * @param {function} [nodeFilter]
39475
+ * @param {Object} [options]
39476
+ * @param {boolean} [options.requireWellFormed=false]
39477
+ * When `true`, throws for content that would produce ill-formed XML.
39478
+ * @returns {string}
39479
+ * @throws {DOMException}
39480
+ * With code `INVALID_STATE_ERR` when `requireWellFormed` is `true` and:
39481
+ * - an Element's qualified name (including any namespace prefix) is not a valid XML QName,
39482
+ * - an attribute's qualified name (including a synthesized `xmlns:` namespace declaration) is
39483
+ * not a valid XML QName,
39484
+ * - a CDATASection node's data contains `"]]>"`,
39485
+ * - a Comment node's data contains `"-->"` (bare `"--"` does not throw on this branch),
39486
+ * - a ProcessingInstruction's target is not a valid XML `NCName` (a `Name` with no colon) or is
39487
+ * an ASCII case-insensitive match for `"xml"`, or its data contains `"?>"`,
39488
+ * - a DocumentType's `name` is not a valid XML `Name` (XML 1.0 production [5]),
39489
+ * - a DocumentType's `publicId` is non-empty and does not match the XML `PubidLiteral`
39490
+ * production,
39491
+ * - a DocumentType's `systemId` is non-empty and does not match the XML `SystemLiteral`
39492
+ * production,
39493
+ * - a DocumentType's `internalSubset` contains `"]>"`, or
39494
+ * - an EntityReference's `nodeName` is not a valid XML `Name` (XML 1.0 production [5]).
39495
+ * Note: xmldom does not enforce `readonly` on DocumentType fields — direct property
39496
+ * writes succeed and are covered by the serializer-level checks above.
39497
+ * @see https://html.spec.whatwg.org/#dom-xmlserializer-serializetostring
39498
+ * @see https://w3c.github.io/DOM-Parsing/#xml-serialization
39499
+ * @see https://github.com/w3c/DOM-Parsing/issues/84
39500
+ */
39501
+ XMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter,options){
39502
+ return nodeSerializeToString.call(node,isHtml,nodeFilter,options);
39155
39503
  };
39156
39504
  Node.prototype.toString = nodeSerializeToString;
39157
- function nodeSerializeToString(isHtml,nodeFilter){
39505
+ function nodeSerializeToString(isHtml,nodeFilter,options){
39506
+ var requireWellFormed = !!options && !!options.requireWellFormed;
39158
39507
  var buf = [];
39159
39508
  var refNode = this.nodeType == 9 && this.documentElement || this;
39160
39509
  var prefix = refNode.prefix;
@@ -39171,7 +39520,7 @@ function requireDom () {
39171
39520
  ];
39172
39521
  }
39173
39522
  }
39174
- serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces);
39523
+ serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces,requireWellFormed);
39175
39524
  //console.log('###',this.nodeType,uri,prefix,buf.join(''))
39176
39525
  return buf.join('');
39177
39526
  }
@@ -39216,275 +39565,350 @@ function requireDom () {
39216
39565
  * @see https://www.w3.org/TR/xml11/#AVNormalize
39217
39566
  * @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes
39218
39567
  */
39219
- function addSerializedAttribute(buf, qualifiedName, value) {
39568
+ function addSerializedAttribute(buf, qualifiedName, value, requireWellFormed) {
39569
+ if (requireWellFormed && !tagNamePattern.test(qualifiedName)) {
39570
+ throw new DOMException(INVALID_STATE_ERR, 'The attribute name "' + qualifiedName + '" is not a valid XML QName');
39571
+ }
39220
39572
  buf.push(' ', qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"');
39221
39573
  }
39222
39574
 
39223
- function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
39575
+ function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces, requireWellFormed) {
39224
39576
  if (!visibleNamespaces) {
39225
39577
  visibleNamespaces = [];
39226
39578
  }
39227
-
39228
- if(nodeFilter){
39229
- node = nodeFilter(node);
39230
- if(node){
39231
- if(typeof node == 'string'){
39232
- buf.push(node);
39233
- return;
39234
- }
39235
- }else {
39236
- return;
39237
- }
39238
- //buf.sort.apply(attrs, attributeSorter);
39239
- }
39240
-
39241
- switch(node.nodeType){
39242
- case ELEMENT_NODE:
39243
- var attrs = node.attributes;
39244
- var len = attrs.length;
39245
- var child = node.firstChild;
39246
- var nodeName = node.tagName;
39247
-
39248
- isHTML = NAMESPACE.isHTML(node.namespaceURI) || isHTML;
39249
-
39250
- var prefixedNodeName = nodeName;
39251
- if (!isHTML && !node.prefix && node.namespaceURI) {
39252
- var defaultNS;
39253
- // lookup current default ns from `xmlns` attribute
39254
- for (var ai = 0; ai < attrs.length; ai++) {
39255
- if (attrs.item(ai).name === 'xmlns') {
39256
- defaultNS = attrs.item(ai).value;
39257
- break
39258
- }
39259
- }
39260
- if (!defaultNS) {
39261
- // lookup current default ns in visibleNamespaces
39262
- for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
39263
- var namespace = visibleNamespaces[nsi];
39264
- if (namespace.prefix === '' && namespace.namespace === node.namespaceURI) {
39265
- defaultNS = namespace.namespace;
39266
- break
39579
+ walkDOM(node, { ns: visibleNamespaces, isHTML: isHTML }, {
39580
+ enter: function (n, ctx) {
39581
+ var ns = ctx.ns;
39582
+ var html = ctx.isHTML;
39583
+
39584
+ if (nodeFilter) {
39585
+ n = nodeFilter(n);
39586
+ if (n) {
39587
+ if (typeof n == 'string') {
39588
+ buf.push(n);
39589
+ return null;
39267
39590
  }
39591
+ } else {
39592
+ return null;
39268
39593
  }
39269
39594
  }
39270
- if (defaultNS !== node.namespaceURI) {
39271
- for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
39272
- var namespace = visibleNamespaces[nsi];
39273
- if (namespace.namespace === node.namespaceURI) {
39274
- if (namespace.prefix) {
39275
- prefixedNodeName = namespace.prefix + ':' + nodeName;
39595
+
39596
+ switch (n.nodeType) {
39597
+ case ELEMENT_NODE:
39598
+ var attrs = n.attributes;
39599
+ var len = attrs.length;
39600
+ var nodeName = n.tagName;
39601
+
39602
+ html = NAMESPACE.isHTML(n.namespaceURI) || html;
39603
+
39604
+ var prefixedNodeName = nodeName;
39605
+ if (!html && !n.prefix && n.namespaceURI) {
39606
+ var defaultNS;
39607
+ // lookup current default ns from `xmlns` attribute
39608
+ for (var ai = 0; ai < attrs.length; ai++) {
39609
+ if (attrs.item(ai).name === 'xmlns') {
39610
+ defaultNS = attrs.item(ai).value;
39611
+ break;
39612
+ }
39613
+ }
39614
+ if (!defaultNS) {
39615
+ // lookup current default ns in visibleNamespaces
39616
+ for (var nsi = ns.length - 1; nsi >= 0; nsi--) {
39617
+ var nsEntry = ns[nsi];
39618
+ if (nsEntry.prefix === '' && nsEntry.namespace === n.namespaceURI) {
39619
+ defaultNS = nsEntry.namespace;
39620
+ break;
39621
+ }
39622
+ }
39623
+ }
39624
+ if (defaultNS !== n.namespaceURI) {
39625
+ for (var nsi = ns.length - 1; nsi >= 0; nsi--) {
39626
+ var nsEntry = ns[nsi];
39627
+ if (nsEntry.namespace === n.namespaceURI) {
39628
+ if (nsEntry.prefix) {
39629
+ prefixedNodeName = nsEntry.prefix + ':' + nodeName;
39630
+ }
39631
+ break;
39632
+ }
39633
+ }
39276
39634
  }
39277
- break
39278
39635
  }
39279
- }
39280
- }
39281
- }
39282
39636
 
39283
- buf.push('<', prefixedNodeName);
39637
+ if (requireWellFormed && !tagNamePattern.test(prefixedNodeName)) {
39638
+ throw new DOMException(INVALID_STATE_ERR, 'The element name "' + prefixedNodeName + '" is not a valid XML QName');
39639
+ }
39640
+ buf.push('<', prefixedNodeName);
39641
+
39642
+ // Build a fresh namespace snapshot for this element's children.
39643
+ // The slice prevents sibling elements from inheriting each other's declarations.
39644
+ var childNs = ns.slice();
39645
+ for (var i = 0; i < len; i++) {
39646
+ var attr = attrs.item(i);
39647
+ if (attr.prefix == 'xmlns') {
39648
+ childNs.push({ prefix: attr.localName, namespace: attr.value });
39649
+ } else if (attr.nodeName == 'xmlns') {
39650
+ childNs.push({ prefix: '', namespace: attr.value });
39651
+ }
39652
+ }
39284
39653
 
39285
- for(var i=0;i<len;i++){
39286
- // add namespaces for attributes
39287
- var attr = attrs.item(i);
39288
- if (attr.prefix == 'xmlns') {
39289
- visibleNamespaces.push({ prefix: attr.localName, namespace: attr.value });
39290
- }else if(attr.nodeName == 'xmlns'){
39291
- visibleNamespaces.push({ prefix: '', namespace: attr.value });
39292
- }
39293
- }
39654
+ for (var i = 0; i < len; i++) {
39655
+ var attr = attrs.item(i);
39656
+ if (needNamespaceDefine(attr, html, childNs)) {
39657
+ var attrPrefix = attr.prefix || '';
39658
+ var uri = attr.namespaceURI;
39659
+ addSerializedAttribute(buf, attrPrefix ? 'xmlns:' + attrPrefix : 'xmlns', uri, requireWellFormed);
39660
+ childNs.push({ prefix: attrPrefix, namespace: uri });
39661
+ }
39662
+ // Apply nodeFilter and serialize the attribute.
39663
+ var filteredAttr = nodeFilter ? nodeFilter(attr) : attr;
39664
+ if (filteredAttr) {
39665
+ if (typeof filteredAttr === 'string') {
39666
+ buf.push(filteredAttr);
39667
+ } else {
39668
+ addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value, requireWellFormed);
39669
+ }
39670
+ }
39671
+ }
39294
39672
 
39295
- for(var i=0;i<len;i++){
39296
- var attr = attrs.item(i);
39297
- if (needNamespaceDefine(attr,isHTML, visibleNamespaces)) {
39298
- var prefix = attr.prefix||'';
39299
- var uri = attr.namespaceURI;
39300
- addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
39301
- visibleNamespaces.push({ prefix: prefix, namespace:uri });
39302
- }
39303
- serializeToString(attr,buf,isHTML,nodeFilter,visibleNamespaces);
39304
- }
39673
+ // add namespace for current node
39674
+ if (nodeName === prefixedNodeName && needNamespaceDefine(n, html, childNs)) {
39675
+ var nodePrefix = n.prefix || '';
39676
+ var uri = n.namespaceURI;
39677
+ addSerializedAttribute(buf, nodePrefix ? 'xmlns:' + nodePrefix : 'xmlns', uri, requireWellFormed);
39678
+ childNs.push({ prefix: nodePrefix, namespace: uri });
39679
+ }
39305
39680
 
39306
- // add namespace for current node
39307
- if (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {
39308
- var prefix = node.prefix||'';
39309
- var uri = node.namespaceURI;
39310
- addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
39311
- visibleNamespaces.push({ prefix: prefix, namespace:uri });
39312
- }
39681
+ var child = n.firstChild;
39682
+ if (child || html && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) {
39683
+ buf.push('>');
39684
+ if (html && /^script$/i.test(nodeName)) {
39685
+ // Inline serialization for <script> children; return null to skip walkDOM descent.
39686
+ while (child) {
39687
+ if (child.data) {
39688
+ buf.push(child.data);
39689
+ } else {
39690
+ serializeToString(child, buf, html, nodeFilter, childNs.slice(), requireWellFormed);
39691
+ }
39692
+ child = child.nextSibling;
39693
+ }
39694
+ buf.push('</', nodeName, '>');
39695
+ return null;
39696
+ }
39697
+ // Return child context; walkDOM descends and exit emits the closing tag.
39698
+ return { ns: childNs, isHTML: html, tag: prefixedNodeName };
39699
+ } else {
39700
+ buf.push('/>');
39701
+ return null;
39702
+ }
39313
39703
 
39314
- if(child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)){
39315
- buf.push('>');
39316
- //if is cdata child node
39317
- if(isHTML && /^script$/i.test(nodeName)){
39318
- while(child){
39319
- if(child.data){
39320
- buf.push(child.data);
39321
- }else {
39322
- serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
39704
+ case DOCUMENT_NODE:
39705
+ case DOCUMENT_FRAGMENT_NODE:
39706
+ // Descend into children; exit is a no-op (tag is null).
39707
+ return { ns: ns.slice(), isHTML: html, tag: null };
39708
+
39709
+ case ATTRIBUTE_NODE:
39710
+ addSerializedAttribute(buf, n.name, n.value, requireWellFormed);
39711
+ return null;
39712
+
39713
+ case TEXT_NODE:
39714
+ /**
39715
+ * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,
39716
+ * except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.
39717
+ * If they are needed elsewhere, they must be escaped using either numeric character references or the strings
39718
+ * `&amp;` and `&lt;` respectively.
39719
+ * The right angle bracket (>) may be represented using the string " &gt; ", and must, for compatibility,
39720
+ * be escaped using either `&gt;` or a character reference when it appears in the string `]]>` in content,
39721
+ * when that string is not marking the end of a CDATA section.
39722
+ *
39723
+ * In the content of elements, character data is any string of characters
39724
+ * which does not contain the start-delimiter of any markup
39725
+ * and does not include the CDATA-section-close delimiter, `]]>`.
39726
+ *
39727
+ * @see https://www.w3.org/TR/xml/#NT-CharData
39728
+ * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node
39729
+ */
39730
+ buf.push(n.data.replace(/[<&>]/g, _xmlEncoder));
39731
+ return null;
39732
+
39733
+ case CDATA_SECTION_NODE:
39734
+ if (requireWellFormed && n.data.indexOf(']]>') !== -1) {
39735
+ throw new DOMException(INVALID_STATE_ERR, 'The CDATASection data contains "]]>"');
39323
39736
  }
39324
- child = child.nextSibling;
39325
- }
39326
- }else
39327
- {
39328
- while(child){
39329
- serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
39330
- child = child.nextSibling;
39331
- }
39332
- }
39333
- buf.push('</',prefixedNodeName,'>');
39334
- }else {
39335
- buf.push('/>');
39336
- }
39337
- // remove added visible namespaces
39338
- //visibleNamespaces.length = startVisibleNamespaces;
39339
- return;
39340
- case DOCUMENT_NODE:
39341
- case DOCUMENT_FRAGMENT_NODE:
39342
- var child = node.firstChild;
39343
- while(child){
39344
- serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
39345
- child = child.nextSibling;
39346
- }
39347
- return;
39348
- case ATTRIBUTE_NODE:
39349
- return addSerializedAttribute(buf, node.name, node.value);
39350
- case TEXT_NODE:
39351
- /**
39352
- * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,
39353
- * except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.
39354
- * If they are needed elsewhere, they must be escaped using either numeric character references or the strings
39355
- * `&amp;` and `&lt;` respectively.
39356
- * The right angle bracket (>) may be represented using the string " &gt; ", and must, for compatibility,
39357
- * be escaped using either `&gt;` or a character reference when it appears in the string `]]>` in content,
39358
- * when that string is not marking the end of a CDATA section.
39359
- *
39360
- * In the content of elements, character data is any string of characters
39361
- * which does not contain the start-delimiter of any markup
39362
- * and does not include the CDATA-section-close delimiter, `]]>`.
39363
- *
39364
- * @see https://www.w3.org/TR/xml/#NT-CharData
39365
- * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node
39366
- */
39367
- return buf.push(node.data
39368
- .replace(/[<&>]/g,_xmlEncoder)
39369
- );
39370
- case CDATA_SECTION_NODE:
39371
- return buf.push( '<![CDATA[',node.data,']]>');
39372
- case COMMENT_NODE:
39373
- return buf.push( "<!--",node.data,"-->");
39374
- case DOCUMENT_TYPE_NODE:
39375
- var pubid = node.publicId;
39376
- var sysid = node.systemId;
39377
- buf.push('<!DOCTYPE ',node.name);
39378
- if(pubid){
39379
- buf.push(' PUBLIC ', pubid);
39380
- if (sysid && sysid!='.') {
39381
- buf.push(' ', sysid);
39737
+ buf.push('<![CDATA[', n.data.replace(/]]>/g, ']]]]><![CDATA[>'), ']]>');
39738
+ return null;
39739
+
39740
+ case COMMENT_NODE:
39741
+ if (requireWellFormed && n.data.indexOf('-->') !== -1) {
39742
+ throw new DOMException(INVALID_STATE_ERR, 'The comment node data contains "-->"');
39743
+ }
39744
+ buf.push('<!--', n.data, '-->');
39745
+ return null;
39746
+
39747
+ case DOCUMENT_TYPE_NODE:
39748
+ if (requireWellFormed) {
39749
+ if (!tagNamePattern.test(n.name)) {
39750
+ throw new DOMException(INVALID_STATE_ERR, 'The doctype name "' + n.name + '" is not a valid XML Name');
39751
+ }
39752
+ if (n.publicId && !/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(n.publicId)) {
39753
+ throw new DOMException(INVALID_STATE_ERR, 'DocumentType publicId is not a valid PubidLiteral');
39754
+ }
39755
+ if (n.systemId && !/^("[^"]*"|'[^']*')$/.test(n.systemId)) {
39756
+ throw new DOMException(INVALID_STATE_ERR, 'DocumentType systemId is not a valid SystemLiteral');
39757
+ }
39758
+ if (n.internalSubset && n.internalSubset.indexOf(']>') !== -1) {
39759
+ throw new DOMException(INVALID_STATE_ERR, 'DocumentType internalSubset contains "]>"');
39760
+ }
39761
+ }
39762
+ var pubid = n.publicId;
39763
+ var sysid = n.systemId;
39764
+ buf.push('<!DOCTYPE ', n.name);
39765
+ if (pubid) {
39766
+ buf.push(' PUBLIC ', pubid);
39767
+ if (sysid && sysid != '.') {
39768
+ buf.push(' ', sysid);
39769
+ }
39770
+ buf.push('>');
39771
+ } else if (sysid && sysid != '.') {
39772
+ buf.push(' SYSTEM ', sysid, '>');
39773
+ } else {
39774
+ var sub = n.internalSubset;
39775
+ if (sub) {
39776
+ buf.push(' [', sub, ']');
39777
+ }
39778
+ buf.push('>');
39779
+ }
39780
+ return null;
39781
+
39782
+ case PROCESSING_INSTRUCTION_NODE:
39783
+ if (requireWellFormed) {
39784
+ if (!tagNamePattern.test(n.target) || n.target.indexOf(':') !== -1 || n.target.toLowerCase() === 'xml') {
39785
+ throw new DOMException(
39786
+ INVALID_STATE_ERR,
39787
+ 'The processing instruction target "' + n.target + '" is not a valid XML NCName or is reserved'
39788
+ );
39789
+ }
39790
+ if (n.data.indexOf('?>') !== -1) {
39791
+ throw new DOMException(INVALID_STATE_ERR, 'The ProcessingInstruction data contains "?>"');
39792
+ }
39793
+ }
39794
+ buf.push('<?', n.target, ' ', n.data, '?>');
39795
+ return null;
39796
+
39797
+ case ENTITY_REFERENCE_NODE:
39798
+ if (requireWellFormed && !tagNamePattern.test(n.nodeName)) {
39799
+ throw new DOMException(
39800
+ INVALID_STATE_ERR,
39801
+ 'The entity reference name "' + n.nodeName + '" is not a valid XML Name'
39802
+ );
39803
+ }
39804
+ buf.push('&', n.nodeName, ';');
39805
+ return null;
39806
+
39807
+ //case ENTITY_NODE:
39808
+ //case NOTATION_NODE:
39809
+ default:
39810
+ buf.push('??', n.nodeName);
39811
+ return null;
39382
39812
  }
39383
- buf.push('>');
39384
- }else if(sysid && sysid!='.'){
39385
- buf.push(' SYSTEM ', sysid, '>');
39386
- }else {
39387
- var sub = node.internalSubset;
39388
- if(sub){
39389
- buf.push(" [",sub,"]");
39813
+ },
39814
+ exit: function (n, childCtx) {
39815
+ if (childCtx && childCtx.tag) {
39816
+ buf.push('</', childCtx.tag, '>');
39390
39817
  }
39391
- buf.push(">");
39392
- }
39393
- return;
39394
- case PROCESSING_INSTRUCTION_NODE:
39395
- return buf.push( "<?",node.target," ",node.data,"?>");
39396
- case ENTITY_REFERENCE_NODE:
39397
- return buf.push( '&',node.nodeName,';');
39398
- //case ENTITY_NODE:
39399
- //case NOTATION_NODE:
39400
- default:
39401
- buf.push('??',node.nodeName);
39402
- }
39818
+ },
39819
+ });
39403
39820
  }
39404
- function importNode(doc,node,deep){
39405
- var node2;
39406
- switch (node.nodeType) {
39407
- case ELEMENT_NODE:
39408
- node2 = node.cloneNode(false);
39409
- node2.ownerDocument = doc;
39410
- //var attrs = node2.attributes;
39411
- //var len = attrs.length;
39412
- //for(var i=0;i<len;i++){
39413
- //node2.setAttributeNodeNS(importNode(doc,attrs.item(i),deep));
39414
- //}
39415
- case DOCUMENT_FRAGMENT_NODE:
39416
- break;
39417
- case ATTRIBUTE_NODE:
39418
- deep = true;
39419
- break;
39420
- //case ENTITY_REFERENCE_NODE:
39421
- //case PROCESSING_INSTRUCTION_NODE:
39422
- ////case TEXT_NODE:
39423
- //case CDATA_SECTION_NODE:
39424
- //case COMMENT_NODE:
39425
- // deep = false;
39426
- // break;
39427
- //case DOCUMENT_NODE:
39428
- //case DOCUMENT_TYPE_NODE:
39429
- //cannot be imported.
39430
- //case ENTITY_NODE:
39431
- //case NOTATION_NODE:
39432
- //can not hit in level3
39433
- //default:throw e;
39434
- }
39435
- if(!node2){
39436
- node2 = node.cloneNode(false);//false
39437
- }
39438
- node2.ownerDocument = doc;
39439
- node2.parentNode = null;
39440
- if(deep){
39441
- var child = node.firstChild;
39442
- while(child){
39443
- node2.appendChild(importNode(doc,child,deep));
39444
- child = child.nextSibling;
39445
- }
39446
- }
39447
- return node2;
39821
+ /**
39822
+ * Imports a node from a different document into `doc`, creating a new copy.
39823
+ * Delegates to {@link walkDOM} for traversal. Each node in the subtree is shallow-cloned,
39824
+ * stamped with `doc` as its `ownerDocument`, and detached (`parentNode` set to `null`).
39825
+ * Children are imported recursively when `deep` is `true`; for {@link Attr} nodes `deep` is
39826
+ * always forced to `true`
39827
+ * because an attribute's value lives in a child text node.
39828
+ *
39829
+ * @param {Document} doc
39830
+ * The document that will own the imported node.
39831
+ * @param {Node} node
39832
+ * The node to import.
39833
+ * @param {boolean} deep
39834
+ * If `true`, descendants are imported recursively.
39835
+ * @returns {Node}
39836
+ * The newly imported node, now owned by `doc`.
39837
+ */
39838
+ function importNode(doc, node, deep) {
39839
+ var destRoot;
39840
+ walkDOM(node, null, {
39841
+ enter: function (srcNode, destParent) {
39842
+ // Shallow-clone the node and stamp it into the target document.
39843
+ var destNode = srcNode.cloneNode(false);
39844
+ destNode.ownerDocument = doc;
39845
+ destNode.parentNode = null;
39846
+ // capture as the root of the imported subtree or attach to parent.
39847
+ if (destParent === null) {
39848
+ destRoot = destNode;
39849
+ } else {
39850
+ destParent.appendChild(destNode);
39851
+ }
39852
+ // ATTRIBUTE_NODE must always be imported deeply: its value lives in a child text node.
39853
+ var shouldDeep = srcNode.nodeType === ATTRIBUTE_NODE || deep;
39854
+ return shouldDeep ? destNode : null;
39855
+ },
39856
+ });
39857
+ return destRoot;
39448
39858
  }
39449
39859
  //
39450
39860
  //var _relationMap = {firstChild:1,lastChild:1,previousSibling:1,nextSibling:1,
39451
39861
  // attributes:1,childNodes:1,parentNode:1,documentElement:1,doctype,};
39452
- function cloneNode(doc,node,deep){
39453
- var node2 = new node.constructor();
39454
- for (var n in node) {
39455
- if (Object.prototype.hasOwnProperty.call(node, n)) {
39456
- var v = node[n];
39457
- if (typeof v != "object") {
39458
- if (v != node2[n]) {
39459
- node2[n] = v;
39862
+ function cloneNode(doc, node, deep) {
39863
+ var destRoot;
39864
+ walkDOM(node, null, {
39865
+ enter: function (srcNode, destParent) {
39866
+ // 1. Create a blank node of the same type and copy all scalar own properties.
39867
+ var destNode = new srcNode.constructor();
39868
+ for (var n in srcNode) {
39869
+ if (Object.prototype.hasOwnProperty.call(srcNode, n)) {
39870
+ var v = srcNode[n];
39871
+ if (typeof v != 'object') {
39872
+ if (v != destNode[n]) {
39873
+ destNode[n] = v;
39874
+ }
39875
+ }
39460
39876
  }
39461
39877
  }
39462
- }
39463
- }
39464
- if(node.childNodes){
39465
- node2.childNodes = new NodeList();
39466
- }
39467
- node2.ownerDocument = doc;
39468
- switch (node2.nodeType) {
39469
- case ELEMENT_NODE:
39470
- var attrs = node.attributes;
39471
- var attrs2 = node2.attributes = new NamedNodeMap();
39472
- var len = attrs.length;
39473
- attrs2._ownerElement = node2;
39474
- for(var i=0;i<len;i++){
39475
- node2.setAttributeNode(cloneNode(doc,attrs.item(i),true));
39476
- }
39477
- break; case ATTRIBUTE_NODE:
39478
- deep = true;
39479
- }
39480
- if(deep){
39481
- var child = node.firstChild;
39482
- while(child){
39483
- node2.appendChild(cloneNode(doc,child,deep));
39484
- child = child.nextSibling;
39485
- }
39486
- }
39487
- return node2;
39878
+ if (srcNode.childNodes) {
39879
+ destNode.childNodes = new NodeList();
39880
+ }
39881
+ destNode.ownerDocument = doc;
39882
+ // 2. Handle node-type-specific setup.
39883
+ // Attributes are not DOM children, so they are cloned inline here
39884
+ // rather than by walkDOM descent.
39885
+ // ATTRIBUTE_NODE forces deep=true so its own children are walked.
39886
+ var shouldDeep = deep;
39887
+ switch (destNode.nodeType) {
39888
+ case ELEMENT_NODE:
39889
+ var attrs = srcNode.attributes;
39890
+ var attrs2 = (destNode.attributes = new NamedNodeMap());
39891
+ var len = attrs.length;
39892
+ attrs2._ownerElement = destNode;
39893
+ for (var i = 0; i < len; i++) {
39894
+ destNode.setAttributeNode(cloneNode(doc, attrs.item(i), true));
39895
+ }
39896
+ break;
39897
+ case ATTRIBUTE_NODE:
39898
+ shouldDeep = true;
39899
+ }
39900
+ // 3. Attach to parent, or capture as the root of the cloned subtree.
39901
+ if (destParent !== null) {
39902
+ destParent.appendChild(destNode);
39903
+ } else {
39904
+ destRoot = destNode;
39905
+ }
39906
+ // 4. Return destNode as the context for children (causes walkDOM to descend),
39907
+ // or null to skip children (shallow clone).
39908
+ return shouldDeep ? destNode : null;
39909
+ },
39910
+ });
39911
+ return destRoot;
39488
39912
  }
39489
39913
 
39490
39914
  function __set__(object,key,value){
@@ -39500,49 +39924,55 @@ function requireDom () {
39500
39924
  }
39501
39925
  });
39502
39926
 
39503
- Object.defineProperty(Node.prototype,'textContent',{
39504
- get:function(){
39505
- return getTextContent(this);
39927
+ /**
39928
+ * The text content of this node and its descendants.
39929
+ *
39930
+ * Setting `textContent` on an element or document fragment replaces all child nodes with a
39931
+ * single text node; on other nodes it sets `data`, `value`, and `nodeValue` directly.
39932
+ *
39933
+ * @type {string | null}
39934
+ * @see {@link https://dom.spec.whatwg.org/#dom-node-textcontent}
39935
+ */
39936
+ Object.defineProperty(Node.prototype, 'textContent', {
39937
+ get: function () {
39938
+ if (this.nodeType === ELEMENT_NODE || this.nodeType === DOCUMENT_FRAGMENT_NODE) {
39939
+ var buf = [];
39940
+ walkDOM(this, null, {
39941
+ enter: function (n) {
39942
+ if (n.nodeType === ELEMENT_NODE || n.nodeType === DOCUMENT_FRAGMENT_NODE) {
39943
+ return true; // enter children
39944
+ }
39945
+ if (n.nodeType === PROCESSING_INSTRUCTION_NODE || n.nodeType === COMMENT_NODE) {
39946
+ return null; // excluded from text content
39947
+ }
39948
+ buf.push(n.nodeValue);
39949
+ },
39950
+ });
39951
+ return buf.join('');
39952
+ }
39953
+ return this.nodeValue;
39506
39954
  },
39507
39955
 
39508
- set:function(data){
39509
- switch(this.nodeType){
39510
- case ELEMENT_NODE:
39511
- case DOCUMENT_FRAGMENT_NODE:
39512
- while(this.firstChild){
39513
- this.removeChild(this.firstChild);
39514
- }
39515
- if(data || String(data)){
39516
- this.appendChild(this.ownerDocument.createTextNode(data));
39517
- }
39518
- break;
39956
+ set: function (data) {
39957
+ switch (this.nodeType) {
39958
+ case ELEMENT_NODE:
39959
+ case DOCUMENT_FRAGMENT_NODE:
39960
+ while (this.firstChild) {
39961
+ this.removeChild(this.firstChild);
39962
+ }
39963
+ if (data || String(data)) {
39964
+ this.appendChild(this.ownerDocument.createTextNode(data));
39965
+ }
39966
+ break;
39519
39967
 
39520
- default:
39521
- this.data = data;
39522
- this.value = data;
39523
- this.nodeValue = data;
39968
+ default:
39969
+ this.data = data;
39970
+ this.value = data;
39971
+ this.nodeValue = data;
39524
39972
  }
39525
- }
39973
+ },
39526
39974
  });
39527
39975
 
39528
- function getTextContent(node){
39529
- switch(node.nodeType){
39530
- case ELEMENT_NODE:
39531
- case DOCUMENT_FRAGMENT_NODE:
39532
- var buf = [];
39533
- node = node.firstChild;
39534
- while(node){
39535
- if(node.nodeType!==7 && node.nodeType !==8){
39536
- buf.push(getTextContent(node));
39537
- }
39538
- node = node.nextSibling;
39539
- }
39540
- return buf.join('');
39541
- default:
39542
- return node.nodeValue;
39543
- }
39544
- }
39545
-
39546
39976
  __set__ = function(object,key,value){
39547
39977
  //console.log(value)
39548
39978
  object['$$'+key] = value;
@@ -39558,6 +39988,7 @@ function requireDom () {
39558
39988
  dom.Element = Element;
39559
39989
  dom.Node = Node;
39560
39990
  dom.NodeList = NodeList;
39991
+ dom.walkDOM = walkDOM;
39561
39992
  dom.XMLSerializer = XMLSerializer;
39562
39993
  //}
39563
39994
  return dom;
@@ -39572,7 +40003,7 @@ var hasRequiredEntities;
39572
40003
  function requireEntities () {
39573
40004
  if (hasRequiredEntities) return entities;
39574
40005
  hasRequiredEntities = 1;
39575
- (function (exports$1) {
40006
+ (function (exports) {
39576
40007
 
39577
40008
  var freeze = requireConventions().freeze;
39578
40009
 
@@ -39583,7 +40014,7 @@ function requireEntities () {
39583
40014
  * @see https://www.w3.org/TR/2008/REC-xml-20081126/#sec-predefined-ent W3C XML 1.0
39584
40015
  * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML Wikipedia
39585
40016
  */
39586
- exports$1.XML_ENTITIES = freeze({
40017
+ exports.XML_ENTITIES = freeze({
39587
40018
  amp: '&',
39588
40019
  apos: "'",
39589
40020
  gt: '>',
@@ -39605,7 +40036,7 @@ function requireEntities () {
39605
40036
  * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML Wikipedia (HTML)
39606
40037
  * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML Wikpedia (XHTML)
39607
40038
  */
39608
- exports$1.HTML_ENTITIES = freeze({
40039
+ exports.HTML_ENTITIES = freeze({
39609
40040
  Aacute: '\u00C1',
39610
40041
  aacute: '\u00E1',
39611
40042
  Abreve: '\u0102',
@@ -41737,7 +42168,7 @@ function requireEntities () {
41737
42168
  * @deprecated use `HTML_ENTITIES` instead
41738
42169
  * @see HTML_ENTITIES
41739
42170
  */
41740
- exports$1.entityMap = exports$1.HTML_ENTITIES;
42171
+ exports.entityMap = exports.HTML_ENTITIES;
41741
42172
  } (entities));
41742
42173
  return entities;
41743
42174
  }
@@ -41750,14 +42181,8 @@ function requireSax () {
41750
42181
  if (hasRequiredSax) return sax;
41751
42182
  hasRequiredSax = 1;
41752
42183
  var NAMESPACE = requireConventions().NAMESPACE;
42184
+ var tagNamePattern = requireConventions().tagNamePattern;
41753
42185
 
41754
- //[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
41755
- //[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
41756
- //[5] Name ::= NameStartChar (NameChar)*
41757
- var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;//\u10000-\uEFFFF
41758
- var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
41759
- var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$');
41760
- //var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/
41761
42186
  //var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',')
41762
42187
 
41763
42188
  //S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE
@@ -41868,7 +42293,13 @@ function requireSax () {
41868
42293
  switch(source.charAt(tagStart+1)){
41869
42294
  case '/':
41870
42295
  var end = source.indexOf('>',tagStart+3);
41871
- var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, '');
42296
+ // Anchored trailing-whitespace trim. The former `/[ \t\n\r]+$/g` backtracked
42297
+ // quadratically on a name shaped `whitespace-run + non-whitespace char`
42298
+ // (an end tag `</ … x>`): from every start position it extended `[ws]+`
42299
+ // to the end and then failed the `$` anchor. This anchored form matches the
42300
+ // whole string once and captures everything up to the last non-whitespace
42301
+ // character, so it trims in linear time with byte-identical output.
42302
+ var tagName = source.substring(tagStart + 2, end).replace(/^([\s\S]*?[^ \t\n\r])?[ \t\n\r]*$/, '$1');
41872
42303
  var config = parseStack.pop();
41873
42304
  if(end<0){
41874
42305
 
@@ -41879,6 +42310,14 @@ function requireSax () {
41879
42310
  tagName = tagName.replace(/[\s<].*/,'');
41880
42311
  errorHandler.error("end tag name: "+tagName+' maybe not complete');
41881
42312
  end = tagStart+1+tagName.length;
42313
+ }else if(/[ \t\n\r]/.test(tagName) && tagNamePattern.test(tagName.split(/[ \t\n\r]/)[0])){
42314
+ // The XML `ETag` production is `'</' Name S? '>'`: only optional whitespace may follow
42315
+ // the `Name`. A valid `Name` followed by whitespace and non-whitespace residue (e.g.
42316
+ // `</a\nbogus>` or `</a bogus>`) is not well-formed, but historically it was silently
42317
+ // accepted (the malformed end tag ignored, the residue dropped, the element left on the
42318
+ // stack). Report it as a recoverable `error` (which a custom errorHandler may escalate to
42319
+ // fatal) while keeping the existing recovery so the parsed DOM stays byte-identical.
42320
+ errorHandler.error('end tag name is followed by whitespace and trailing content: "'+tagName+'"');
41882
42321
  }
41883
42322
  var localNSMap = config.localNSMap;
41884
42323
  var endMatch = config.tagName == tagName;
@@ -42002,6 +42441,15 @@ function requireSax () {
42002
42441
  var s = S_TAG;//status
42003
42442
  while(true){
42004
42443
  var c = source.charAt(p);
42444
+ if (s === S_TAG && c === '<') {
42445
+ // A `<` can never occur inside a tag name. Without this guard the scan runs
42446
+ // on to the next `>` (or EOF) before the tag name is rejected, so a document
42447
+ // with many `<` inside a malformed tag makes each one-character recovery step
42448
+ // re-scan to the distant `>` — O(n^2). Stopping at the `<` keeps each recovery
42449
+ // step bounded. The candidate scanned so far is reported raw, consistent with
42450
+ // the sibling invalid-tag-name throw below.
42451
+ throw new Error('unexpected < in tag name: ' + source.slice(start, p));
42452
+ }
42005
42453
  switch(c){
42006
42454
  case '=':
42007
42455
  if(s === S_ATTR){//attrName
@@ -42194,9 +42642,13 @@ function requireSax () {
42194
42642
  if(nsPrefix !== false){//hack!!
42195
42643
  if(localNSMap == null){
42196
42644
  localNSMap = {};
42197
- //console.log(currentNSMap,0)
42198
- _copy(currentNSMap,currentNSMap={});
42199
- //console.log(currentNSMap,1)
42645
+ // Derive the child scope's namespace map by prototype-chain inheritance
42646
+ // instead of a flat copy: lookups inherit ancestor prefixes transparently,
42647
+ // so a document nesting N scopes retains O(N) map entries rather than
42648
+ // sum(1..N) = O(N^2). localNSMap stays a flat own-only record of the
42649
+ // prefixes declared at THIS element, so own-property enumeration
42650
+ // (endPrefixMapping below) still reports only local declarations.
42651
+ currentNSMap = Object.create(currentNSMap);
42200
42652
  }
42201
42653
  currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
42202
42654
  a.uri = NAMESPACE.XMLNS;
@@ -42348,7 +42800,7 @@ function requireSax () {
42348
42800
  function parseInstruction(source,start,domBuilder){
42349
42801
  var end = source.indexOf('?>',start);
42350
42802
  if(end){
42351
- var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
42803
+ var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)$/);
42352
42804
  if(match){
42353
42805
  match[0].length;
42354
42806
  domBuilder.processingInstruction(match[1], match[2]) ;
@@ -43545,7 +43997,7 @@ var hasRequiredMoment;
43545
43997
  function requireMoment () {
43546
43998
  if (hasRequiredMoment) return moment$1.exports;
43547
43999
  hasRequiredMoment = 1;
43548
- (function (module, exports$1) {
44000
+ (function (module, exports) {
43549
44001
  (function (global, factory) {
43550
44002
  module.exports = factory() ;
43551
44003
  }(this, (function () {
@@ -49235,7 +49687,7 @@ function requireMomentTimezone () {
49235
49687
  hasRequiredMomentTimezone = 1;
49236
49688
  (function (module) {
49237
49689
  //! moment-timezone.js
49238
- //! version : 0.6.0
49690
+ //! version : 0.6.4
49239
49691
  //! Copyright (c) JS Foundation and other contributors
49240
49692
  //! license : MIT
49241
49693
  //! github.com/moment/moment-timezone
@@ -49261,12 +49713,18 @@ function requireMomentTimezone () {
49261
49713
  // return moment;
49262
49714
  // }
49263
49715
 
49264
- var VERSION = "0.6.0",
49716
+ var VERSION = "0.6.4",
49265
49717
  zones = {},
49266
49718
  links = {},
49267
49719
  countries = {},
49268
49720
  names = {},
49269
49721
  guesses = {},
49722
+ parsingInZone = false,
49723
+ parsingNow,
49724
+ parsingNowFunction,
49725
+ hasParsingNow = false,
49726
+ ignoreDefaultZoneForInput,
49727
+ hasIgnoredDefaultZoneInput = false,
49270
49728
  cachedGuess;
49271
49729
 
49272
49730
  if (!moment || typeof moment.version !== 'string') {
@@ -49438,17 +49896,16 @@ function requireMomentTimezone () {
49438
49896
  offsets = this.offsets,
49439
49897
  untils = this.untils,
49440
49898
  max = untils.length - 1,
49441
- offset, offsetNext, offsetPrev, i;
49899
+ offset, offsetNext, i;
49442
49900
 
49443
49901
  for (i = 0; i < max; i++) {
49444
49902
  offset = offsets[i];
49445
49903
  offsetNext = offsets[i + 1];
49446
- offsetPrev = offsets[i ? i - 1 : i];
49447
49904
 
49448
49905
  if (offset < offsetNext && tz.moveAmbiguousForward) {
49449
49906
  offset = offsetNext;
49450
- } else if (offset > offsetPrev && tz.moveInvalidForward) {
49451
- offset = offsetPrev;
49907
+ } else if (offset > offsetNext && tz.moveInvalidForward) {
49908
+ offset = offsetNext;
49452
49909
  }
49453
49910
 
49454
49911
  if (target < untils[i] - (offset * 60000)) {
@@ -49473,6 +49930,15 @@ function requireMomentTimezone () {
49473
49930
  }
49474
49931
  };
49475
49932
 
49933
+ var utcDefaultZone = new Zone();
49934
+ utcDefaultZone._set({
49935
+ name : 'UTC',
49936
+ abbrs : ['UTC'],
49937
+ untils : [Infinity],
49938
+ offsets : [0],
49939
+ population : 0
49940
+ });
49941
+
49476
49942
  /************************************
49477
49943
  Country object
49478
49944
  ************************************/
@@ -49810,6 +50276,85 @@ function requireMomentTimezone () {
49810
50276
  return !!(m._a && (m._tzm === undefined) && !isUnixTimestamp);
49811
50277
  }
49812
50278
 
50279
+ function isObjectInput (input) {
50280
+ var prop;
50281
+
50282
+ if (moment.isMoment(input) || input === null || Object.prototype.toString.call(input) !== '[object Object]') {
50283
+ return false;
50284
+ }
50285
+ if (Object.getOwnPropertyNames) {
50286
+ return Object.getOwnPropertyNames(input).length > 0;
50287
+ }
50288
+ for (prop in input) {
50289
+ if (Object.prototype.hasOwnProperty.call(input, prop)) {
50290
+ return true;
50291
+ }
50292
+ }
50293
+ return false;
50294
+ }
50295
+
50296
+ function parseWithZoneNow (args, name, stringInput) {
50297
+ var savedNow = moment.now,
50298
+ savedDefaultZone = moment.defaultZone,
50299
+ savedParsingInZone = parsingInZone,
50300
+ savedParsingNow = parsingNow,
50301
+ savedParsingNowFunction = parsingNowFunction,
50302
+ savedHasParsingNow = hasParsingNow,
50303
+ now,
50304
+ hasNow = false,
50305
+ zonedNow,
50306
+ wallNow,
50307
+ parsedDateParts,
50308
+ out;
50309
+
50310
+ if (!parsingInZone) {
50311
+ parsingNow = undefined;
50312
+ parsingNowFunction = savedNow;
50313
+ hasParsingNow = false;
50314
+ }
50315
+ parsingInZone = true;
50316
+ moment.now = function () {
50317
+ if (!hasNow) {
50318
+ if (!hasParsingNow) {
50319
+ parsingNow = parsingNowFunction.call(moment);
50320
+ hasParsingNow = true;
50321
+ }
50322
+ now = parsingNow;
50323
+ hasNow = true;
50324
+ zonedNow = moment.tz(now, name);
50325
+ wallNow = zonedNow.valueOf() + zonedNow.utcOffset() * 60000;
50326
+ }
50327
+ return wallNow;
50328
+ };
50329
+ if (stringInput) {
50330
+ moment.defaultZone = utcDefaultZone;
50331
+ }
50332
+ try {
50333
+ out = moment.utc.apply(null, args);
50334
+ if (stringInput && hasNow && out._a && out._tzm !== undefined) {
50335
+ parsedDateParts = out.parsingFlags().parsedDateParts;
50336
+ if (!parsedDateParts || parsedDateParts[0] == null || parsedDateParts[1] == null || parsedDateParts[2] == null) {
50337
+ moment.now = function () {
50338
+ return now;
50339
+ };
50340
+ moment.defaultZone = savedDefaultZone;
50341
+ out = moment.utc.apply(null, args);
50342
+ }
50343
+ }
50344
+ } finally {
50345
+ moment.now = savedNow;
50346
+ moment.defaultZone = savedDefaultZone;
50347
+ parsingInZone = savedParsingInZone;
50348
+ if (!savedParsingInZone) {
50349
+ parsingNow = savedParsingNow;
50350
+ parsingNowFunction = savedParsingNowFunction;
50351
+ hasParsingNow = savedHasParsingNow;
50352
+ }
50353
+ }
50354
+
50355
+ return out;
50356
+ }
50357
+
49813
50358
  function logError (message) {
49814
50359
  if (typeof console !== 'undefined' && typeof console.error === 'function') {
49815
50360
  console.error(message);
@@ -49823,10 +50368,13 @@ function requireMomentTimezone () {
49823
50368
  function tz (input) {
49824
50369
  var args = Array.prototype.slice.call(arguments, 0, -1),
49825
50370
  name = arguments[arguments.length - 1],
49826
- out = moment.utc.apply(null, args),
49827
- zone;
50371
+ objectInput = isObjectInput(input),
50372
+ stringInput = args.length > 0 && typeof input === 'string',
50373
+ zone = objectInput || stringInput ? getZone(name) : null,
50374
+ out = objectInput && zone ? parseWithZoneNow(args, name) :
50375
+ stringInput && zone ? parseWithZoneNow(args, name, true) : moment.utc.apply(null, args);
49828
50376
 
49829
- if (!moment.isMoment(input) && needsOffset(out) && (zone = getZone(name))) {
50377
+ if (!moment.isMoment(input) && needsOffset(out) && (zone || (!objectInput && (zone = getZone(name))))) {
49830
50378
  out.add(zone.parse(out), 'minutes');
49831
50379
  }
49832
50380
 
@@ -49866,10 +50414,49 @@ function requireMomentTimezone () {
49866
50414
  moment.tz = tz;
49867
50415
 
49868
50416
  moment.defaultZone = null;
50417
+ var momentGetDefaultDateParts = moment._getDefaultDateParts;
50418
+ if (momentGetDefaultDateParts) {
50419
+ moment._getDefaultDateParts = function (config, now, forWeek) {
50420
+ var zone = moment.defaultZone,
50421
+ zonedNow,
50422
+ dateParts,
50423
+ savedIgnoredInput,
50424
+ savedHasIgnoredInput;
50425
+ forWeek = forWeek || config._isDefaultDatePartsForWeek;
50426
+
50427
+ if (parsingInZone && config._tzm === undefined) {
50428
+ zonedNow = new Date(now);
50429
+ return [zonedNow.getUTCFullYear(), zonedNow.getUTCMonth(), zonedNow.getUTCDate()];
50430
+ }
50431
+
50432
+ if (zone && !config._useUTC && config._tzm === undefined) {
50433
+ zonedNow = new Date(now - zone.utcOffset(now) * 60000);
50434
+ return [zonedNow.getUTCFullYear(), zonedNow.getUTCMonth(), zonedNow.getUTCDate()];
50435
+ }
50436
+
50437
+ if (forWeek && (config._useUTC || config._tzm !== undefined)) {
50438
+ savedIgnoredInput = ignoreDefaultZoneForInput;
50439
+ savedHasIgnoredInput = hasIgnoredDefaultZoneInput;
50440
+ ignoreDefaultZoneForInput = now;
50441
+ hasIgnoredDefaultZoneInput = true;
50442
+ try {
50443
+ dateParts = momentGetDefaultDateParts.call(this, config, now, forWeek);
50444
+ } finally {
50445
+ ignoreDefaultZoneForInput = savedIgnoredInput;
50446
+ hasIgnoredDefaultZoneInput = savedHasIgnoredInput;
50447
+ }
50448
+ return dateParts;
50449
+ }
50450
+
50451
+ return momentGetDefaultDateParts.call(this, config, now, forWeek);
50452
+ };
50453
+ }
49869
50454
 
49870
50455
  moment.updateOffset = function (mom, keepTime) {
49871
- var zone = moment.defaultZone,
49872
- offset;
50456
+ var zone = hasIgnoredDefaultZoneInput && ignoreDefaultZoneForInput === mom._i ? null : moment.defaultZone,
50457
+ offset,
50458
+ localTimestamp,
50459
+ normalizedTimestamp;
49873
50460
 
49874
50461
  if (mom._z === undefined) {
49875
50462
  if (zone && needsOffset(mom) && !mom._isUTC && mom.isValid()) {
@@ -49880,6 +50467,20 @@ function requireMomentTimezone () {
49880
50467
  }
49881
50468
  if (mom._z) {
49882
50469
  offset = mom._z.utcOffset(mom);
50470
+ if (keepTime) {
50471
+ // Resolve local times inside a forward gap using the configured
50472
+ // invalid-input policy before applying the new offset.
50473
+ localTimestamp = mom._d.valueOf();
50474
+ if (!mom._isUTC) {
50475
+ localTimestamp -= mom._d.getTimezoneOffset() * 60000;
50476
+ }
50477
+ if (mom._z.utcOffset(localTimestamp + offset * 60000) !== offset) {
50478
+ offset = mom._z.parse(localTimestamp);
50479
+ localTimestamp += offset * 60000;
50480
+ offset = mom._z.utcOffset(localTimestamp);
50481
+ normalizedTimestamp = localTimestamp - offset * 60000;
50482
+ }
50483
+ }
49883
50484
  if (Math.abs(offset) < 16) {
49884
50485
  offset = offset / 60;
49885
50486
  }
@@ -49890,6 +50491,9 @@ function requireMomentTimezone () {
49890
50491
  } else {
49891
50492
  mom.zone(offset, keepTime);
49892
50493
  }
50494
+ if (normalizedTimestamp != null) {
50495
+ mom._d.setTime(normalizedTimestamp);
50496
+ }
49893
50497
  }
49894
50498
  };
49895
50499
 
@@ -81680,7 +82284,7 @@ function verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRo
81680
82284
  verifySemanticsOfNgModuleImport(modOrStandaloneCmpt, moduleType);
81681
82285
  verifySemanticsOfNgModuleDef(modOrStandaloneCmpt, false, moduleType);
81682
82286
  });
81683
- const exports$1 = maybeUnwrapFn(ngModuleDef.exports);
82287
+ const exports = maybeUnwrapFn(ngModuleDef.exports);
81684
82288
  declarations.forEach(verifyDeclarationsHaveDefinitions);
81685
82289
  declarations.forEach(verifyDirectivesHaveSelector);
81686
82290
  declarations.forEach((declarationType) => verifyNotStandalone(declarationType, moduleType));
@@ -81688,7 +82292,7 @@ function verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRo
81688
82292
  ...declarations.map(resolveForwardRef),
81689
82293
  ...flatten(imports.map(computeCombinedExports)).map(resolveForwardRef),
81690
82294
  ];
81691
- exports$1.forEach(verifyExportsAreDeclaredOrReExported);
82295
+ exports.forEach(verifyExportsAreDeclaredOrReExported);
81692
82296
  declarations.forEach((decl) => verifyDeclarationIsUnique(decl, allowDuplicateDeclarationsInRoot));
81693
82297
  const ngModule = getAnnotation(moduleType, 'NgModule');
81694
82298
  if (ngModule) {
@@ -99707,11 +100311,11 @@ const getRowActionAttrs = attrs => {
99707
100311
  return tmpl;
99708
100312
  };
99709
100313
 
99710
- const $RAF = window.requestAnimationFrame;
100314
+ const $RAF$1 = window.requestAnimationFrame;
99711
100315
  const $RAFQueue = [];
99712
100316
  const invokeLater = fn => {
99713
100317
  if (!$RAFQueue.length) {
99714
- $RAF(() => {
100318
+ $RAF$1(() => {
99715
100319
  $RAFQueue.forEach(f => f());
99716
100320
  $RAFQueue.length = 0;
99717
100321
  });
@@ -100253,220 +100857,83 @@ const getFnForEventExpr = (expr) => {
100253
100857
  return fnExecutor(expr, ExpressionType.Action);
100254
100858
  };
100255
100859
 
100256
- // Constants
100257
- const WIDGET_ID_REGEX = /^(widget-[^_]+)/;
100258
- const WIDGET_PROPERTY_REGEX = /^widget-[^_]+_(.+)$/;
100259
- const ARRAY_INDEX_PLACEHOLDER = '[$i]';
100260
- const ARRAY_INDEX_ZERO = '[0]';
100261
100860
  const registry = new Map();
100262
100861
  const watchIdGenerator = new IDGenerator('watch-id-');
100263
- const FIRST_TIME_WATCH = Object.freeze({});
100264
- /**
100265
- * Extracts widget ID from identifier (e.g., "widget-id23_eventsource" -> "widget-id23")
100266
- */
100267
- const getWidgetId = (identifier) => {
100268
- if (!identifier || typeof identifier !== 'string') {
100269
- return null;
100270
- }
100271
- const match = identifier.match(WIDGET_ID_REGEX);
100272
- return match ? match[1] : null;
100273
- };
100274
- /**
100275
- * Extracts property name from identifier (e.g., "widget-id23_eventsource" -> "eventsource")
100276
- */
100277
- const getPropertyName = (identifier) => {
100278
- if (!identifier || typeof identifier !== 'string') {
100279
- return identifier;
100280
- }
100281
- const match = identifier.match(WIDGET_PROPERTY_REGEX);
100282
- return match ? match[1] : identifier;
100283
- };
100284
- /**
100285
- * Array consumer wrapper for array-based expressions
100286
- */
100862
+ const FIRST_TIME_WATCH = {};
100863
+ Object.freeze(FIRST_TIME_WATCH);
100287
100864
  const arrayConsumer = (listenerFn, restExpr, newVal, oldVal) => {
100288
- if (!isArray(newVal)) {
100289
- return;
100290
- }
100291
- let formattedData = newVal.map(datum => findValueOf(datum, restExpr));
100292
- // Flatten if result is array of arrays
100293
- if (isArray(formattedData[0])) {
100294
- formattedData = flatten$1(formattedData);
100865
+ let data = newVal, formattedData;
100866
+ if (_.isArray(data)) {
100867
+ formattedData = data.map(function (datum) {
100868
+ return findValueOf(datum, restExpr);
100869
+ });
100870
+ // If resulting structure is an array of array, flatten it
100871
+ if (_.isArray(formattedData[0])) {
100872
+ formattedData = _.flatten(formattedData);
100873
+ }
100874
+ listenerFn(formattedData, oldVal);
100295
100875
  }
100296
- listenerFn(formattedData, oldVal);
100297
100876
  };
100298
- /**
100299
- * Updates watch info for array expressions
100300
- */
100301
- const getUpdatedWatchInfo = (expr, acceptsArray, listener) => {
100302
- const regex = /\[\$i\]/g;
100877
+ const getUpdatedWatcInfo = (expr, acceptsArray, listener) => {
100878
+ // listener doesn't accept array
100879
+ // replace all `[$i]` with `[0]` and return the expression
100880
+ let regex = /\[\$i\]/g, $I = '[$i]', $0 = '[0]';
100303
100881
  if (!acceptsArray) {
100304
100882
  return {
100305
- expr: expr.replace(regex, ARRAY_INDEX_ZERO),
100306
- listener
100883
+ 'expr': expr.replace(regex, $0),
100884
+ 'listener': listener
100307
100885
  };
100308
100886
  }
100309
- const lastIndex = expr.lastIndexOf(ARRAY_INDEX_PLACEHOLDER);
100310
- const baseExpr = expr.substring(0, lastIndex).replace(ARRAY_INDEX_PLACEHOLDER, ARRAY_INDEX_ZERO);
100311
- const restExpr = expr.substring(lastIndex + ARRAY_INDEX_PLACEHOLDER.length);
100312
- const arrayConsumerFn = restExpr
100313
- ? arrayConsumer.bind(undefined, listener, restExpr)
100314
- : listener;
100887
+ // listener accepts array
100888
+ // replace all except the last `[$i]` with `[0]` and return the expression.
100889
+ var index = expr.lastIndexOf($I), _expr = expr.substr(0, index).replace($I, $0), restExpr = expr.substr(index + 5), arrayConsumerFn = listener;
100890
+ if (restExpr) {
100891
+ arrayConsumerFn = arrayConsumer.bind(undefined, listener, restExpr);
100892
+ }
100315
100893
  return {
100316
- expr: baseExpr,
100317
- listener: arrayConsumerFn
100894
+ 'expr': _expr,
100895
+ 'listener': arrayConsumerFn
100318
100896
  };
100319
100897
  };
100320
- /**
100321
- * Determines if an expression is static (doesn't need to be watched)
100322
- */
100323
- const STATIC_EXPRESSION_NAMES = [
100324
- "row.getProperty('investment')",
100325
- "row.getProperty('factsheetLink')",
100326
- "row.getProperty('isRebalanceEligible')"
100327
- ];
100328
- const isStaticExpression = (expr) => {
100329
- if (typeof expr !== 'string') {
100330
- return false;
100331
- }
100332
- const trimmedExpr = expr.trim();
100333
- // Expressions that always evaluate to localization strings
100334
- if (trimmedExpr.includes('appLocale')) {
100335
- return true;
100336
- }
100337
- // Hard-coded static expression names
100338
- if (STATIC_EXPRESSION_NAMES.includes(trimmedExpr)) {
100339
- return true;
100340
- }
100341
- return false;
100342
- };
100343
- /**
100344
- * Gets the scope type from the scope object
100345
- */
100346
- const getScopeType = ($scope) => {
100347
- if (!$scope) {
100348
- return null;
100349
- }
100350
- if ($scope.pageName)
100351
- return 'Page';
100352
- if ($scope.prefabName)
100353
- return 'Prefab';
100354
- if ($scope.partialName)
100355
- return 'Partial';
100356
- // Check for App scope
100357
- if ($scope.Variables !== undefined &&
100358
- $scope.Actions !== undefined &&
100359
- !$scope.pageName &&
100360
- !$scope.prefabName &&
100361
- !$scope.partialName) {
100362
- return 'App';
100363
- }
100364
- if ($scope.constructor?.name === 'AppRef') {
100365
- return 'App';
100366
- }
100367
- return null;
100368
- };
100369
- /**
100370
- * Gets scope name based on scope type
100371
- */
100372
- const getScopeName = ($scope, scopeType) => {
100373
- if (!scopeType || !$scope) {
100374
- return null;
100375
- }
100376
- switch (scopeType) {
100377
- case 'Prefab': return $scope.prefabName || null;
100378
- case 'Partial': return $scope.partialName || null;
100379
- case 'Page': return $scope.pageName || null;
100380
- default: return null;
100381
- }
100382
- };
100383
- /**
100384
- * Main watch function
100385
- */
100386
100898
  const $watch = (expr, $scope, $locals, listener, identifier = watchIdGenerator.nextUid(), doNotClone = false, config = {}, isMuted) => {
100387
- // Handle array expressions
100388
- if (expr.includes(ARRAY_INDEX_PLACEHOLDER)) {
100389
- const watchInfo = getUpdatedWatchInfo(expr, config.arrayType || config.isList || false, listener);
100899
+ if (expr.indexOf('[$i]') !== -1) {
100900
+ let watchInfo = getUpdatedWatcInfo(expr, config && (config.arrayType || config.isList), listener);
100390
100901
  expr = watchInfo.expr;
100391
100902
  listener = watchInfo.listener;
100392
100903
  }
100393
- // Handle static expressions
100394
- if (isStaticExpression(expr)) {
100395
- try {
100396
- const fn = $parseExpr(expr);
100397
- const staticValue = fn($scope, $locals);
100398
- listener(staticValue, FIRST_TIME_WATCH);
100399
- }
100400
- catch (e) {
100401
- console.warn(`Error evaluating static expression '${expr}':`, e);
100402
- listener(undefined, FIRST_TIME_WATCH);
100403
- }
100404
- return () => { }; // No-op unsubscribe
100405
- }
100406
100904
  const fn = $parseExpr();
100407
- const scopeType = getScopeType($scope);
100408
- const scopeName = getScopeName($scope, scopeType);
100409
- const watchInfo = {
100410
- fn: fn.bind(null, $scope, $locals),
100905
+ registry.set(identifier, {
100906
+ fn: fn.bind(expr, $scope, $locals),
100411
100907
  listener,
100412
100908
  expr,
100413
100909
  last: FIRST_TIME_WATCH,
100414
100910
  doNotClone,
100415
- isMuted,
100416
- scopeType,
100417
- scopeName
100418
- };
100419
- // Store in registry
100420
- const widgetId = getWidgetId(identifier);
100421
- if (widgetId) {
100422
- const propertyName = getPropertyName(identifier);
100423
- if (!registry.has(widgetId)) {
100424
- registry.set(widgetId, {});
100425
- }
100426
- const widgetGroup = registry.get(widgetId);
100427
- widgetGroup[propertyName] = watchInfo;
100428
- }
100429
- else {
100430
- registry.set(identifier, watchInfo);
100431
- }
100911
+ isMuted: isMuted
100912
+ });
100432
100913
  return () => $unwatch(identifier);
100433
100914
  };
100434
- /**
100435
- * Unwatches a single identifier
100436
- */
100437
- const $unwatch = (identifier) => {
100438
- const widgetId = getWidgetId(identifier);
100439
- if (widgetId) {
100440
- const propertyName = getPropertyName(identifier);
100441
- const widgetGroup = registry.get(widgetId);
100442
- if (widgetGroup && typeof widgetGroup === 'object' && !widgetGroup.fn) {
100443
- const watchInfo = widgetGroup[propertyName];
100444
- if (watchInfo) {
100445
- delete widgetGroup[propertyName];
100446
- // Clean up empty widget groups
100447
- if (Object.keys(widgetGroup).length === 0) {
100448
- registry.delete(widgetId);
100449
- }
100450
- return true;
100451
- }
100915
+ const $unwatch = identifier => registry.delete(identifier);
100916
+ window.watchRegistry = registry;
100917
+ window.__WM_DEBUG_WATCHERS__ = false;
100918
+ /*export const $invokeWatchers = (force?: boolean, ignoreMuted?: boolean) => {
100919
+ if (force) {
100920
+ triggerWatchers(ignoreMuted);
100921
+ } else {
100922
+
100923
+ if (skipWatchers) {
100924
+ skipWatchers = false;
100925
+ return;
100452
100926
  }
100927
+ debouncedTriggerWatchers();
100453
100928
  }
100454
- // Fallback to direct lookup
100455
- if (registry.has(identifier)) {
100456
- registry.delete(identifier);
100457
- return true;
100458
- }
100459
- return false;
100460
- };
100929
+ };*/
100461
100930
  const $appDigest = (() => {
100462
- return (force = false) => {
100931
+ return (force) => {
100463
100932
  {
100464
100933
  return;
100465
100934
  }
100466
100935
  };
100467
100936
  })();
100468
- // Export registry for debugging
100469
- // (window as any).watchRegistry = registry;
100470
100937
 
100471
100938
  var ComponentType;
100472
100939
  (function (ComponentType) {