@antv/g 5.4.0 → 5.5.2

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.
Files changed (55) hide show
  1. package/dist/components/Transform.d.ts +5 -1
  2. package/dist/components/Transform.d.ts.map +1 -1
  3. package/dist/css/StyleValueRegistry.d.ts +1 -0
  4. package/dist/css/StyleValueRegistry.d.ts.map +1 -1
  5. package/dist/css/cssom/CSSNumericValue.d.ts +1 -1
  6. package/dist/css/cssom/CSSStyleValue.d.ts +2 -2
  7. package/dist/css/cssom/CSSStyleValue.d.ts.map +1 -1
  8. package/dist/css/interfaces.d.ts +1 -1
  9. package/dist/css/interfaces.d.ts.map +1 -1
  10. package/dist/css/layout/LayoutObject.d.ts +2 -2
  11. package/dist/css/layout/LayoutObject.d.ts.map +1 -1
  12. package/dist/css/parser/dimension.d.ts +1 -0
  13. package/dist/css/parser/dimension.d.ts.map +1 -1
  14. package/dist/css/parser/path.d.ts +2 -2
  15. package/dist/css/parser/path.d.ts.map +1 -1
  16. package/dist/css/parser/transform.d.ts +1 -0
  17. package/dist/css/parser/transform.d.ts.map +1 -1
  18. package/dist/css/properties/CSSPropertyClipPath.d.ts +1 -0
  19. package/dist/css/properties/CSSPropertyClipPath.d.ts.map +1 -1
  20. package/dist/css/properties/CSSPropertyLengthOrPercentage.d.ts.map +1 -1
  21. package/dist/css/properties/CSSPropertyNumber.d.ts +8 -0
  22. package/dist/css/properties/CSSPropertyNumber.d.ts.map +1 -0
  23. package/dist/css/properties/CSSPropertyTransform.d.ts.map +1 -1
  24. package/dist/css/properties/index.d.ts +1 -0
  25. package/dist/css/properties/index.d.ts.map +1 -1
  26. package/dist/display-objects/Circle.d.ts.map +1 -1
  27. package/dist/display-objects/DisplayObject.d.ts +3 -0
  28. package/dist/display-objects/DisplayObject.d.ts.map +1 -1
  29. package/dist/display-objects/Ellipse.d.ts.map +1 -1
  30. package/dist/display-objects/Line.d.ts.map +1 -1
  31. package/dist/display-objects/Path.d.ts +1 -1
  32. package/dist/display-objects/Path.d.ts.map +1 -1
  33. package/dist/display-objects/Polyline.d.ts.map +1 -1
  34. package/dist/dom/interfaces.d.ts +1 -1
  35. package/dist/dom/interfaces.d.ts.map +1 -1
  36. package/dist/global-module.d.ts.map +1 -1
  37. package/dist/index.esm.js +747 -292
  38. package/dist/index.js +707 -251
  39. package/dist/index.umd.js +1696 -680
  40. package/dist/index.umd.min.js +2 -2
  41. package/dist/plugins/DirtyCheckPlugin.d.ts +0 -1
  42. package/dist/plugins/DirtyCheckPlugin.d.ts.map +1 -1
  43. package/dist/plugins/PrepareRendererPlugin.d.ts +1 -0
  44. package/dist/plugins/PrepareRendererPlugin.d.ts.map +1 -1
  45. package/dist/services/RenderingService.d.ts +9 -1
  46. package/dist/services/RenderingService.d.ts.map +1 -1
  47. package/dist/services/SceneGraphSelector.d.ts.map +1 -1
  48. package/dist/services/SceneGraphService.d.ts +12 -3
  49. package/dist/services/SceneGraphService.d.ts.map +1 -1
  50. package/dist/types.d.ts +0 -5
  51. package/dist/types.d.ts.map +1 -1
  52. package/dist/utils/interpolation.d.ts.map +1 -1
  53. package/dist/utils/string.d.ts +4 -1
  54. package/dist/utils/string.d.ts.map +1 -1
  55. package/package.json +6 -5
package/dist/index.umd.js CHANGED
@@ -4723,6 +4723,17 @@
4723
4723
  PERFORMANCE OF THIS SOFTWARE.
4724
4724
  ***************************************************************************** */
4725
4725
 
4726
+ var __assign = function() {
4727
+ __assign = Object.assign || function __assign(t) {
4728
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4729
+ s = arguments[i];
4730
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
4731
+ }
4732
+ return t;
4733
+ };
4734
+ return __assign.apply(this, arguments);
4735
+ };
4736
+
4726
4737
  function __decorate(decorators, target, key, desc) {
4727
4738
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4728
4739
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -4736,6 +4747,16 @@
4736
4747
 
4737
4748
  function __metadata(metadataKey, metadataValue) {
4738
4749
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
4750
+ }
4751
+
4752
+ function __spreadArray(to, from, pack) {
4753
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4754
+ if (ar || !(i in from)) {
4755
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
4756
+ ar[i] = from[i];
4757
+ }
4758
+ }
4759
+ return to.concat(ar || Array.prototype.slice.call(from));
4739
4760
  }
4740
4761
 
4741
4762
  function _regeneratorRuntime() {
@@ -7567,6 +7588,33 @@
7567
7588
 
7568
7589
  return out;
7569
7590
  }
7591
+ /**
7592
+ * Creates a new vec2 initialized with the given values
7593
+ *
7594
+ * @param {Number} x X component
7595
+ * @param {Number} y Y component
7596
+ * @returns {vec2} a new 2D vector
7597
+ */
7598
+
7599
+ function fromValues$4(x, y) {
7600
+ var out = new ARRAY_TYPE(2);
7601
+ out[0] = x;
7602
+ out[1] = y;
7603
+ return out;
7604
+ }
7605
+ /**
7606
+ * Copy the values from one vec2 to another
7607
+ *
7608
+ * @param {vec2} out the receiving vector
7609
+ * @param {ReadonlyVec2} a the source vector
7610
+ * @returns {vec2} out
7611
+ */
7612
+
7613
+ function copy$4(out, a) {
7614
+ out[0] = a[0];
7615
+ out[1] = a[1];
7616
+ return out;
7617
+ }
7570
7618
  /**
7571
7619
  * Normalize a vec2
7572
7620
  *
@@ -7897,7 +7945,7 @@
7897
7945
  return "-" + letter.toLowerCase();
7898
7946
  }); // Remove first dash
7899
7947
 
7900
- return str.charAt(0) === '-' ? str.substr(1) : str;
7948
+ return str.charAt(0) === '-' ? str.substring(1) : str;
7901
7949
  };
7902
7950
  /**
7903
7951
  Easing Functions from anime.js, they are tried and true, so, its better to use them instead of other alternatives
@@ -8990,20 +9038,45 @@
8990
9038
  return timing.easingFunction(directedProgress);
8991
9039
  }
8992
9040
 
8993
- var cache = {};
8994
- function camelCase(str) {
8995
- if (str === void 0) {
8996
- str = '';
9041
+ /**
9042
+ * @see https://github.com/lodash/lodash/blob/master/memoize.js
9043
+ */
9044
+ function memoize(func, resolver) {
9045
+ if (typeof func !== 'function' || resolver != null && typeof resolver !== 'function') {
9046
+ throw new TypeError('Expected a function');
8997
9047
  }
8998
9048
 
8999
- if (!cache[str]) {
9000
- cache[str] = str.replace(/-([a-z])/g, function (g) {
9001
- return g[1].toUpperCase();
9002
- });
9003
- }
9049
+ var memoized = function memoized() {
9050
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
9051
+ args[_key] = arguments[_key];
9052
+ }
9053
+
9054
+ var key = resolver ? resolver.apply(this, args) : args[0];
9055
+ var cache = memoized.cache;
9056
+
9057
+ if (cache.has(key)) {
9058
+ return cache.get(key);
9059
+ }
9060
+
9061
+ var result = func.apply(this, args);
9062
+ memoized.cache = cache.set(key, result) || cache;
9063
+ return result;
9064
+ };
9004
9065
 
9005
- return cache[str];
9066
+ memoized.cache = new (memoize.Cache || Map)();
9067
+ return memoized;
9006
9068
  }
9069
+ memoize.Cache = Map;
9070
+
9071
+ var camelCase = memoize(function (str) {
9072
+ if (str === void 0) {
9073
+ str = '';
9074
+ }
9075
+
9076
+ return str.replace(/-([a-z])/g, function (g) {
9077
+ return g[1].toUpperCase();
9078
+ });
9079
+ });
9007
9080
  function isString(str) {
9008
9081
  if (!isNil(str) && typeof str === 'string') {
9009
9082
  return true;
@@ -9209,45 +9282,33 @@
9209
9282
  alias: 'img'
9210
9283
  }
9211
9284
  };
9212
- function formatAttribute(name, value) {
9213
- var _map$values;
9214
-
9285
+ var formatAttributeName = memoize(function (name) {
9215
9286
  var attributeName = camelCase(name);
9216
9287
  var map = FORMAT_ATTR_MAP[attributeName];
9217
9288
  attributeName = (map === null || map === void 0 ? void 0 : map.alias) || attributeName;
9218
- var attributeValue = (map === null || map === void 0 ? void 0 : (_map$values = map.values) === null || _map$values === void 0 ? void 0 : _map$values[value]) || value;
9219
- return [attributeName, attributeValue];
9220
- }
9221
-
9222
- /**
9223
- * @see https://github.com/lodash/lodash/blob/master/memoize.js
9224
- */
9225
- function memoize(func, resolver) {
9226
- if (typeof func !== 'function' || resolver != null && typeof resolver !== 'function') {
9227
- throw new TypeError('Expected a function');
9228
- }
9229
-
9230
- var memoized = function memoized() {
9231
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
9232
- args[_key] = arguments[_key];
9233
- }
9234
-
9235
- var key = resolver ? resolver.apply(this, args) : args[0];
9236
- var cache = memoized.cache;
9237
-
9238
- if (cache.has(key)) {
9239
- return cache.get(key);
9240
- }
9289
+ return [attributeName, map];
9290
+ });
9291
+ function formatAttribute(name, value) {
9292
+ var _map$values;
9241
9293
 
9242
- var result = func.apply(this, args);
9243
- memoized.cache = cache.set(key, result) || cache;
9244
- return result;
9245
- };
9294
+ var _formatAttributeName = formatAttributeName(name),
9295
+ attributeName = _formatAttributeName[0],
9296
+ map = _formatAttributeName[1];
9246
9297
 
9247
- memoized.cache = new (memoize.Cache || Map)();
9248
- return memoized;
9249
- }
9250
- memoize.Cache = Map;
9298
+ var attributeValue = isString(value) && (map === null || map === void 0 ? void 0 : (_map$values = map.values) === null || _map$values === void 0 ? void 0 : _map$values[value]) || value;
9299
+ return [attributeName, attributeValue];
9300
+ } // export const formatAttribute = memoize(
9301
+ // (name: string, value: any): [string, any] => {
9302
+ // let attributeName = camelCase(name);
9303
+ // const map = FORMAT_ATTR_MAP[attributeName];
9304
+ // attributeName = map?.alias || attributeName;
9305
+ // const attributeValue = map?.values?.[value] || value;
9306
+ // return [attributeName, attributeValue];
9307
+ // },
9308
+ // (name: string, value: any) => {
9309
+ // return `${name}${value}`;
9310
+ // },
9311
+ // );
9251
9312
 
9252
9313
  (function (Shape) {
9253
9314
  Shape["GROUP"] = "g";
@@ -12154,8 +12215,8 @@
12154
12215
  return exports.UnitType.kPixels;
12155
12216
 
12156
12217
  case exports.UnitCategory.kUPercent:
12157
- return exports.UnitType.kUnknown;
12158
- // Cannot convert between numbers and percent.
12218
+ return exports.UnitType.kPercentage;
12219
+ // return UnitType.kUnknown; // Cannot convert between numbers and percent.
12159
12220
 
12160
12221
  case exports.UnitCategory.kUTime:
12161
12222
  return exports.UnitType.kSeconds;
@@ -15376,6 +15437,10 @@
15376
15437
  */
15377
15438
 
15378
15439
  function parseLengthOrPercentage(css) {
15440
+ if (isNumber(css)) {
15441
+ return new CSSUnitValue(css, 'px');
15442
+ }
15443
+
15379
15444
  return parseDimension(new RegExp('px|%|em|rem', 'g'), css);
15380
15445
  }
15381
15446
  function parseAngle(css) {
@@ -15387,6 +15452,7 @@
15387
15452
  * @example
15388
15453
  * 10px + 20px = 30px
15389
15454
  * 10deg + 10rad
15455
+ * 10% + 20% = 30%
15390
15456
  */
15391
15457
 
15392
15458
  function mergeDimensions(left, right, target, nonNegative, index) {
@@ -15396,23 +15462,29 @@
15396
15462
 
15397
15463
  var unit = '';
15398
15464
  var leftValue = left.value || 0;
15399
- var rightValue = right.value || 0; // const canonicalUnit = CSSUnitValue.toCanonicalUnit(left.unit);
15400
- // const leftCanonicalUnitValue = left.convertTo(canonicalUnit);
15401
- // const rightCanonicalUnitValue = right.convertTo(canonicalUnit);
15402
- // format '%' to 'px'
15403
-
15404
- if (CSSUnitValue.isLength(left.unit) || CSSUnitValue.isLength(right.unit)) {
15405
- leftValue = convertPercentUnit(left, index, target);
15406
- rightValue = convertPercentUnit(right, index, target);
15407
- unit = 'px';
15408
- } // format 'rad' 'turn' to 'deg'
15409
-
15465
+ var rightValue = right.value || 0;
15466
+ var canonicalUnit = CSSUnitValue.toCanonicalUnit(left.unit);
15467
+ var leftCanonicalUnitValue = left.convertTo(canonicalUnit);
15468
+ var rightCanonicalUnitValue = right.convertTo(canonicalUnit);
15469
+
15470
+ if (leftCanonicalUnitValue && rightCanonicalUnitValue) {
15471
+ leftValue = leftCanonicalUnitValue.value;
15472
+ rightValue = rightCanonicalUnitValue.value;
15473
+ unit = CSSUnitValue.unitTypeToString(left.unit);
15474
+ } else {
15475
+ // format '%' to 'px'
15476
+ if (CSSUnitValue.isLength(left.unit) || CSSUnitValue.isLength(right.unit)) {
15477
+ leftValue = convertPercentUnit(left, index, target);
15478
+ rightValue = convertPercentUnit(right, index, target);
15479
+ unit = 'px';
15480
+ }
15481
+ } // // format 'rad' 'turn' to 'deg'
15482
+ // if (CSSUnitValue.isAngle(left.unit) || CSSUnitValue.isAngle(right.unit)) {
15483
+ // leftValue = convertAngleUnit(left);
15484
+ // rightValue = convertAngleUnit(right);
15485
+ // unit = 'deg';
15486
+ // }
15410
15487
 
15411
- if (CSSUnitValue.isAngle(left.unit) || CSSUnitValue.isAngle(right.unit)) {
15412
- leftValue = convertAngleUnit(left);
15413
- rightValue = convertAngleUnit(right);
15414
- unit = 'deg';
15415
- }
15416
15488
 
15417
15489
  return [leftValue, rightValue, function (value) {
15418
15490
  if (nonNegative) {
@@ -15543,10 +15615,40 @@
15543
15615
  }
15544
15616
 
15545
15617
  function clonePath(path) {
15546
- return path.map((x) => (Array.isArray(x) ? [...x] : x));
15618
+ return path.map(function (x) { return (Array.isArray(x) ? __spreadArray([], x, true) : x); });
15619
+ }
15620
+
15621
+ /**
15622
+ * Rounds the values of a `PathArray` instance to
15623
+ * a specified amount of decimals and returns it.
15624
+ */
15625
+ function roundPath(path, round) {
15626
+ if (round === 'off')
15627
+ return clonePath(path);
15628
+ // to round values to the power
15629
+ // the `round` value must be integer
15630
+ var pow = typeof round === 'number' && round >= 1 ? Math.pow(10, round) : 1;
15631
+ return path.map(function (pi) {
15632
+ var values = pi
15633
+ .slice(1)
15634
+ .map(Number)
15635
+ .map(function (n) { return (round ? Math.round(n * pow) / pow : Math.round(n)); });
15636
+ return __spreadArray([pi[0]], values, true);
15637
+ });
15638
+ }
15639
+
15640
+ /**
15641
+ * Returns a valid `d` attribute string value created
15642
+ * by rounding values and concatenating the `pathArray` segments.
15643
+ */
15644
+ function path2String(path, round) {
15645
+ if (round === void 0) { round = 'off'; }
15646
+ return roundPath(path, round)
15647
+ .map(function (x) { return x[0] + x.slice(1).join(' '); })
15648
+ .join('');
15547
15649
  }
15548
15650
 
15549
- const paramsParser = {
15651
+ var paramsParser = {
15550
15652
  x1: 0,
15551
15653
  y1: 0,
15552
15654
  x2: 0,
@@ -15560,9 +15662,9 @@
15560
15662
  function fixArc(pathArray, allPathCommands, i) {
15561
15663
  if (pathArray[i].length > 7) {
15562
15664
  pathArray[i].shift();
15563
- const pi = pathArray[i];
15665
+ var pi = pathArray[i];
15564
15666
  // const ni = i + 1;
15565
- let ni = i;
15667
+ var ni = i;
15566
15668
  while (pi.length) {
15567
15669
  // if created multiple C:s, their original seg is saved
15568
15670
  allPathCommands[i] = 'A';
@@ -15573,7 +15675,7 @@
15573
15675
  }
15574
15676
  }
15575
15677
 
15576
- const paramsCount = {
15678
+ var paramsCount = {
15577
15679
  a: 7,
15578
15680
  c: 6,
15579
15681
  h: 1,
@@ -15592,8 +15694,8 @@
15592
15694
  */
15593
15695
  function isPathArray(path) {
15594
15696
  return (Array.isArray(path) &&
15595
- path.every((seg) => {
15596
- const lk = seg[0].toLowerCase();
15697
+ path.every(function (seg) {
15698
+ var lk = seg[0].toLowerCase();
15597
15699
  return paramsCount[lk] === seg.length - 1 && 'achlmqstvz'.includes(lk);
15598
15700
  }));
15599
15701
  }
@@ -15605,7 +15707,10 @@
15605
15707
  function isAbsoluteArray(path) {
15606
15708
  return (isPathArray(path) &&
15607
15709
  // @ts-ignore -- `isPathArray` also checks if it's `Array`
15608
- path.every(([x]) => x === x.toUpperCase()));
15710
+ path.every(function (_a) {
15711
+ var x = _a[0];
15712
+ return x === x.toUpperCase();
15713
+ }));
15609
15714
  }
15610
15715
 
15611
15716
  /**
@@ -15614,28 +15719,31 @@
15614
15719
  * with absolute values.
15615
15720
  */
15616
15721
  function isNormalizedArray(path) {
15617
- return isAbsoluteArray(path) && path.every(([pc]) => 'ACLMQZ'.includes(pc));
15722
+ return isAbsoluteArray(path) && path.every(function (_a) {
15723
+ var pc = _a[0];
15724
+ return 'ACLMQZ'.includes(pc);
15725
+ });
15618
15726
  }
15619
15727
 
15620
15728
  /**
15621
15729
  * Breaks the parsing of a pathString once a segment is finalized.
15622
15730
  */
15623
15731
  function finalizeSegment(path) {
15624
- let pathCommand = path.pathValue[path.segmentStart];
15625
- let LK = pathCommand.toLowerCase();
15626
- const { data } = path;
15732
+ var pathCommand = path.pathValue[path.segmentStart];
15733
+ var LK = pathCommand.toLowerCase();
15734
+ var data = path.data;
15627
15735
  while (data.length >= paramsCount[LK]) {
15628
15736
  // overloaded `moveTo`
15629
15737
  // https://github.com/rveciana/svg-path-properties/blob/master/src/parse.ts
15630
15738
  if (LK === 'm' && data.length > 2) {
15631
15739
  // @ts-ignore
15632
- path.segments.push([pathCommand, ...data.splice(0, 2)]);
15740
+ path.segments.push(__spreadArray([pathCommand], data.splice(0, 2), true));
15633
15741
  LK = 'l';
15634
15742
  pathCommand = pathCommand === 'm' ? 'l' : 'L';
15635
15743
  }
15636
15744
  else {
15637
15745
  // @ts-ignore
15638
- path.segments.push([pathCommand, ...data.splice(0, paramsCount[LK])]);
15746
+ path.segments.push(__spreadArray([pathCommand], data.splice(0, paramsCount[LK]), true));
15639
15747
  }
15640
15748
  if (!paramsCount[LK]) {
15641
15749
  break;
@@ -15648,8 +15756,8 @@
15648
15756
  * Usually a `large-arc-flag` or `sweep-flag`.
15649
15757
  */
15650
15758
  function scanFlag(path) {
15651
- const { index, pathValue } = path;
15652
- const code = pathValue.charCodeAt(index);
15759
+ var index = path.index, pathValue = path.pathValue;
15760
+ var code = pathValue.charCodeAt(index);
15653
15761
  if (code === 0x30 /* 0 */) {
15654
15762
  path.param = 0;
15655
15763
  path.index += 1;
@@ -15660,7 +15768,7 @@
15660
15768
  path.index += 1;
15661
15769
  return;
15662
15770
  }
15663
- path.err = `[path-util]: invalid Arc flag "${pathValue[index]}", expecting 0 or 1 at index ${index}`;
15771
+ path.err = "[path-util]: invalid Arc flag \"" + pathValue[index] + "\", expecting 0 or 1 at index " + index;
15664
15772
  }
15665
15773
 
15666
15774
  /**
@@ -15679,16 +15787,16 @@
15679
15787
  * every path command, negative numbers or floating point numbers.
15680
15788
  */
15681
15789
  function scanParam(path) {
15682
- const { max, pathValue, index: start } = path;
15683
- let index = start;
15684
- let zeroFirst = false;
15685
- let hasCeiling = false;
15686
- let hasDecimal = false;
15687
- let hasDot = false;
15688
- let ch;
15790
+ var max = path.max, pathValue = path.pathValue, start = path.index;
15791
+ var index = start;
15792
+ var zeroFirst = false;
15793
+ var hasCeiling = false;
15794
+ var hasDecimal = false;
15795
+ var hasDot = false;
15796
+ var ch;
15689
15797
  if (index >= max) {
15690
15798
  // path.err = 'SvgPath: missed param (at pos ' + index + ')';
15691
- path.err = `[path-util]: Invalid path value at index ${index}, "pathValue" is missing param`;
15799
+ path.err = "[path-util]: Invalid path value at index " + index + ", \"pathValue\" is missing param";
15692
15800
  return;
15693
15801
  }
15694
15802
  ch = pathValue.charCodeAt(index);
@@ -15701,7 +15809,7 @@
15701
15809
  // https://github.com/ariya/esprimas
15702
15810
  if (!isDigit(ch) && ch !== 0x2e /* . */) {
15703
15811
  // path.err = 'SvgPath: param should start with 0..9 or `.` (at pos ' + index + ')';
15704
- path.err = `[path-util]: Invalid path value at index ${index}, "${pathValue[index]}" is not a number`;
15812
+ path.err = "[path-util]: Invalid path value at index " + index + ", \"" + pathValue[index] + "\" is not a number";
15705
15813
  return;
15706
15814
  }
15707
15815
  if (ch !== 0x2e /* . */) {
@@ -15713,7 +15821,7 @@
15713
15821
  if (ch && isDigit(ch)) {
15714
15822
  // path.err = 'SvgPath: numbers started with `0` such as `09`
15715
15823
  // are illegal (at pos ' + start + ')';
15716
- path.err = `[path-util]: Invalid path value at index ${start}, "${pathValue[start]}" illegal number`;
15824
+ path.err = "[path-util]: Invalid path value at index " + start + ", \"" + pathValue[start] + "\" illegal number";
15717
15825
  return;
15718
15826
  }
15719
15827
  }
@@ -15734,7 +15842,7 @@
15734
15842
  }
15735
15843
  if (ch === 0x65 /* e */ || ch === 0x45 /* E */) {
15736
15844
  if (hasDot && !hasCeiling && !hasDecimal) {
15737
- path.err = `[path-util]: Invalid path value at index ${index}, "${pathValue[index]}" invalid float exponent`;
15845
+ path.err = "[path-util]: Invalid path value at index " + index + ", \"" + pathValue[index] + "\" invalid float exponent";
15738
15846
  return;
15739
15847
  }
15740
15848
  index += 1;
@@ -15748,7 +15856,7 @@
15748
15856
  }
15749
15857
  }
15750
15858
  else {
15751
- path.err = `[path-util]: Invalid path value at index ${index}, "${pathValue[index]}" invalid integer exponent`;
15859
+ path.err = "[path-util]: Invalid path value at index " + index + ", \"" + pathValue[index] + "\" invalid integer exponent";
15752
15860
  return;
15753
15861
  }
15754
15862
  }
@@ -15760,7 +15868,7 @@
15760
15868
  * Checks if the character is a space.
15761
15869
  */
15762
15870
  function isSpace(ch) {
15763
- const specialSpaces = [
15871
+ var specialSpaces = [
15764
15872
  0x1680, 0x180e, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200a, 0x202f,
15765
15873
  0x205f, 0x3000, 0xfeff,
15766
15874
  ];
@@ -15784,7 +15892,7 @@
15784
15892
  * space character.
15785
15893
  */
15786
15894
  function skipSpaces(path) {
15787
- const { pathValue, max } = path;
15895
+ var pathValue = path.pathValue, max = path.max;
15788
15896
  while (path.index < max && isSpace(pathValue.charCodeAt(path.index))) {
15789
15897
  path.index += 1;
15790
15898
  }
@@ -15825,12 +15933,12 @@
15825
15933
  * where a segment starts and where it ends.
15826
15934
  */
15827
15935
  function scanSegment(path) {
15828
- const { max, pathValue, index } = path;
15829
- const cmdCode = pathValue.charCodeAt(index);
15830
- const reqParams = paramsCount[pathValue[index].toLowerCase()];
15936
+ var max = path.max, pathValue = path.pathValue, index = path.index;
15937
+ var cmdCode = pathValue.charCodeAt(index);
15938
+ var reqParams = paramsCount[pathValue[index].toLowerCase()];
15831
15939
  path.segmentStart = index;
15832
15940
  if (!isPathCommand(cmdCode)) {
15833
- path.err = `[path-util]: Invalid path value "${pathValue[index]}" is not a path command`;
15941
+ path.err = "[path-util]: Invalid path value \"" + pathValue[index] + "\" is not a path command";
15834
15942
  return;
15835
15943
  }
15836
15944
  path.index += 1;
@@ -15842,7 +15950,7 @@
15842
15950
  return;
15843
15951
  }
15844
15952
  for (;;) {
15845
- for (let i = reqParams; i > 0; i -= 1) {
15953
+ for (var i = reqParams; i > 0; i -= 1) {
15846
15954
  if (isArcCommand(cmdCode) && (i === 3 || i === 4))
15847
15955
  scanFlag(path);
15848
15956
  else
@@ -15873,8 +15981,8 @@
15873
15981
  * The `PathParser` is used by the `parsePathString` static method
15874
15982
  * to generate a `pathArray`.
15875
15983
  */
15876
- class PathParser {
15877
- constructor(pathString) {
15984
+ var PathParser = /** @class */ (function () {
15985
+ function PathParser(pathString) {
15878
15986
  this.pathValue = pathString;
15879
15987
  // @ts-ignore
15880
15988
  this.segments = [];
@@ -15885,7 +15993,8 @@
15885
15993
  this.data = [];
15886
15994
  this.err = '';
15887
15995
  }
15888
- }
15996
+ return PathParser;
15997
+ }());
15889
15998
 
15890
15999
  /**
15891
16000
  * Parses a path string value and returns an array
@@ -15895,7 +16004,7 @@
15895
16004
  if (isPathArray(pathInput)) {
15896
16005
  return clonePath(pathInput);
15897
16006
  }
15898
- const path = new PathParser(pathInput);
16007
+ var path = new PathParser(pathInput);
15899
16008
  skipSpaces(path);
15900
16009
  while (path.index < path.max && !path.err.length) {
15901
16010
  scanSegment(path);
@@ -15907,26 +16016,26 @@
15907
16016
  if (isAbsoluteArray(pathInput)) {
15908
16017
  return clonePath(pathInput);
15909
16018
  }
15910
- const path = parsePathString(pathInput);
16019
+ var path = parsePathString(pathInput);
15911
16020
  // if (!path || !path.length) {
15912
16021
  // return [['M', 0, 0]];
15913
16022
  // }
15914
- let x = 0;
15915
- let y = 0;
15916
- let mx = 0;
15917
- let my = 0;
16023
+ var x = 0;
16024
+ var y = 0;
16025
+ var mx = 0;
16026
+ var my = 0;
15918
16027
  // @ts-ignore
15919
- return path.map((segment) => {
15920
- const values = segment.slice(1).map(Number);
15921
- const [pathCommand] = segment;
15922
- const absCommand = pathCommand.toUpperCase();
16028
+ return path.map(function (segment) {
16029
+ var values = segment.slice(1).map(Number);
16030
+ var pathCommand = segment[0];
16031
+ var absCommand = pathCommand.toUpperCase();
15923
16032
  if (pathCommand === 'M') {
15924
- [x, y] = values;
16033
+ x = values[0], y = values[1];
15925
16034
  mx = x;
15926
16035
  my = y;
15927
16036
  return ['M', x, y];
15928
16037
  }
15929
- let absoluteSegment;
16038
+ var absoluteSegment;
15930
16039
  if (pathCommand !== absCommand) {
15931
16040
  switch (absCommand) {
15932
16041
  case 'A':
@@ -15950,26 +16059,26 @@
15950
16059
  default: {
15951
16060
  // use brakets for `eslint: no-case-declaration`
15952
16061
  // https://stackoverflow.com/a/50753272/803358
15953
- const absValues = values.map((n, j) => n + (j % 2 ? y : x));
16062
+ var absValues = values.map(function (n, j) { return n + (j % 2 ? y : x); });
15954
16063
  // for n, l, c, s, q, t
15955
- absoluteSegment = [absCommand, ...absValues];
16064
+ absoluteSegment = __spreadArray([absCommand], absValues, true);
15956
16065
  }
15957
16066
  }
15958
16067
  }
15959
16068
  else {
15960
- absoluteSegment = [absCommand, ...values];
16069
+ absoluteSegment = __spreadArray([absCommand], values, true);
15961
16070
  }
15962
- const segLength = absoluteSegment.length;
16071
+ var segLength = absoluteSegment.length;
15963
16072
  switch (absCommand) {
15964
16073
  case 'Z':
15965
16074
  x = mx;
15966
16075
  y = my;
15967
16076
  break;
15968
16077
  case 'H':
15969
- [, x] = absoluteSegment;
16078
+ x = absoluteSegment[1];
15970
16079
  break;
15971
16080
  case 'V':
15972
- [, y] = absoluteSegment;
16081
+ y = absoluteSegment[1];
15973
16082
  break;
15974
16083
  default:
15975
16084
  x = absoluteSegment[segLength - 2];
@@ -15988,10 +16097,10 @@
15988
16097
  * eg. H/V -> L, T -> Q
15989
16098
  */
15990
16099
  function normalizeSegment(segment, params) {
15991
- const [pathCommand] = segment;
15992
- const { x1: px1, y1: py1, x2: px2, y2: py2 } = params;
15993
- const values = segment.slice(1).map(Number);
15994
- let result = segment;
16100
+ var pathCommand = segment[0];
16101
+ var px1 = params.x1, py1 = params.y1, px2 = params.x2, py2 = params.y2;
16102
+ var values = segment.slice(1).map(Number);
16103
+ var result = segment;
15995
16104
  if (!'TQ'.includes(pathCommand)) {
15996
16105
  // optional but good to be cautious
15997
16106
  params.qx = null;
@@ -16004,21 +16113,21 @@
16004
16113
  result = ['L', px1, segment[1]];
16005
16114
  }
16006
16115
  else if (pathCommand === 'S') {
16007
- const x1 = px1 * 2 - px2;
16008
- const y1 = py1 * 2 - py2;
16116
+ var x1 = px1 * 2 - px2;
16117
+ var y1 = py1 * 2 - py2;
16009
16118
  params.x1 = x1;
16010
16119
  params.y1 = y1;
16011
- result = ['C', x1, y1, ...values];
16120
+ result = __spreadArray(['C', x1, y1], values, true);
16012
16121
  }
16013
16122
  else if (pathCommand === 'T') {
16014
- const qx = px1 * 2 - params.qx;
16015
- const qy = py1 * 2 - params.qy;
16123
+ var qx = px1 * 2 - params.qx;
16124
+ var qy = py1 * 2 - params.qy;
16016
16125
  params.qx = qx;
16017
16126
  params.qy = qy;
16018
- result = ['Q', qx, qy, ...values];
16127
+ result = __spreadArray(['Q', qx, qy], values, true);
16019
16128
  }
16020
16129
  else if (pathCommand === 'Q') {
16021
- const [nqx, nqy] = values;
16130
+ var nqx = values[0], nqy = values[1];
16022
16131
  params.qx = nqx;
16023
16132
  params.qy = nqy;
16024
16133
  }
@@ -16035,18 +16144,18 @@
16035
16144
  if (isNormalizedArray(pathInput)) {
16036
16145
  return clonePath(pathInput);
16037
16146
  }
16038
- const path = path2Absolute(pathInput);
16039
- const params = Object.assign({}, paramsParser);
16040
- const allPathCommands = [];
16041
- const ii = path.length;
16042
- let pathCommand = '';
16043
- for (let i = 0; i < ii; i += 1) {
16044
- [pathCommand] = path[i];
16147
+ var path = path2Absolute(pathInput);
16148
+ var params = __assign({}, paramsParser);
16149
+ var allPathCommands = [];
16150
+ var ii = path.length;
16151
+ var pathCommand = '';
16152
+ for (var i = 0; i < ii; i += 1) {
16153
+ pathCommand = path[i][0];
16045
16154
  // Save current path command
16046
16155
  allPathCommands[i] = pathCommand;
16047
16156
  path[i] = normalizeSegment(path[i], params);
16048
- const segment = path[i];
16049
- const seglen = segment.length;
16157
+ var segment = path[i];
16158
+ var seglen = segment.length;
16050
16159
  params.x1 = +segment[seglen - 2];
16051
16160
  params.y1 = +segment[seglen - 1];
16052
16161
  params.x2 = +segment[seglen - 4] || params.x1;
@@ -16063,12 +16172,15 @@
16063
16172
  * @returns {boolean} iteration result
16064
16173
  */
16065
16174
  function isCurveArray(path) {
16066
- return isNormalizedArray(path) && path.every(([pc]) => 'MC'.includes(pc));
16175
+ return isNormalizedArray(path) && path.every(function (_a) {
16176
+ var pc = _a[0];
16177
+ return 'MC'.includes(pc);
16178
+ });
16067
16179
  }
16068
16180
 
16069
16181
  function rotateVector(x, y, rad) {
16070
- const X = x * Math.cos(rad) - y * Math.sin(rad);
16071
- const Y = x * Math.sin(rad) + y * Math.cos(rad);
16182
+ var X = x * Math.cos(rad) - y * Math.sin(rad);
16183
+ var Y = x * Math.sin(rad) + y * Math.cos(rad);
16072
16184
  return { x: X, y: Y };
16073
16185
  }
16074
16186
 
@@ -16079,23 +16191,23 @@
16079
16191
  * http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
16080
16192
  */
16081
16193
  function arcToCubic(X1, Y1, RX, RY, angle, LAF, SF, X2, Y2, recursive) {
16082
- let x1 = X1;
16083
- let y1 = Y1;
16084
- let rx = RX;
16085
- let ry = RY;
16086
- let x2 = X2;
16087
- let y2 = Y2;
16194
+ var x1 = X1;
16195
+ var y1 = Y1;
16196
+ var rx = RX;
16197
+ var ry = RY;
16198
+ var x2 = X2;
16199
+ var y2 = Y2;
16088
16200
  // for more information of where this Math came from visit:
16089
16201
  // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
16090
- const d120 = (Math.PI * 120) / 180;
16091
- const rad = (Math.PI / 180) * (+angle || 0);
16202
+ var d120 = (Math.PI * 120) / 180;
16203
+ var rad = (Math.PI / 180) * (+angle || 0);
16092
16204
  /** @type {number[]} */
16093
- let res = [];
16094
- let xy;
16095
- let f1;
16096
- let f2;
16097
- let cx;
16098
- let cy;
16205
+ var res = [];
16206
+ var xy;
16207
+ var f1;
16208
+ var f2;
16209
+ var cx;
16210
+ var cy;
16099
16211
  if (!recursive) {
16100
16212
  xy = rotateVector(x1, y1, -rad);
16101
16213
  x1 = xy.x;
@@ -16103,17 +16215,17 @@
16103
16215
  xy = rotateVector(x2, y2, -rad);
16104
16216
  x2 = xy.x;
16105
16217
  y2 = xy.y;
16106
- const x = (x1 - x2) / 2;
16107
- const y = (y1 - y2) / 2;
16108
- let h = (x * x) / (rx * rx) + (y * y) / (ry * ry);
16218
+ var x = (x1 - x2) / 2;
16219
+ var y = (y1 - y2) / 2;
16220
+ var h = (x * x) / (rx * rx) + (y * y) / (ry * ry);
16109
16221
  if (h > 1) {
16110
16222
  h = Math.sqrt(h);
16111
16223
  rx *= h;
16112
16224
  ry *= h;
16113
16225
  }
16114
- const rx2 = rx * rx;
16115
- const ry2 = ry * ry;
16116
- const k = (LAF === SF ? -1 : 1) *
16226
+ var rx2 = rx * rx;
16227
+ var ry2 = ry * ry;
16228
+ var k = (LAF === SF ? -1 : 1) *
16117
16229
  Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x)));
16118
16230
  cx = (k * rx * y) / ry + (x1 + x2) / 2;
16119
16231
  cy = (k * -ry * x) / rx + (y1 + y2) / 2;
@@ -16135,38 +16247,38 @@
16135
16247
  }
16136
16248
  }
16137
16249
  else {
16138
- [f1, f2, cx, cy] = recursive;
16250
+ f1 = recursive[0], f2 = recursive[1], cx = recursive[2], cy = recursive[3];
16139
16251
  }
16140
- let df = f2 - f1;
16252
+ var df = f2 - f1;
16141
16253
  if (Math.abs(df) > d120) {
16142
- const f2old = f2;
16143
- const x2old = x2;
16144
- const y2old = y2;
16254
+ var f2old = f2;
16255
+ var x2old = x2;
16256
+ var y2old = y2;
16145
16257
  f2 = f1 + d120 * (SF && f2 > f1 ? 1 : -1);
16146
16258
  x2 = cx + rx * Math.cos(f2);
16147
16259
  y2 = cy + ry * Math.sin(f2);
16148
16260
  res = arcToCubic(x2, y2, rx, ry, angle, 0, SF, x2old, y2old, [f2, f2old, cx, cy]);
16149
16261
  }
16150
16262
  df = f2 - f1;
16151
- const c1 = Math.cos(f1);
16152
- const s1 = Math.sin(f1);
16153
- const c2 = Math.cos(f2);
16154
- const s2 = Math.sin(f2);
16155
- const t = Math.tan(df / 4);
16156
- const hx = (4 / 3) * rx * t;
16157
- const hy = (4 / 3) * ry * t;
16158
- const m1 = [x1, y1];
16159
- const m2 = [x1 + hx * s1, y1 - hy * c1];
16160
- const m3 = [x2 + hx * s2, y2 - hy * c2];
16161
- const m4 = [x2, y2];
16263
+ var c1 = Math.cos(f1);
16264
+ var s1 = Math.sin(f1);
16265
+ var c2 = Math.cos(f2);
16266
+ var s2 = Math.sin(f2);
16267
+ var t = Math.tan(df / 4);
16268
+ var hx = (4 / 3) * rx * t;
16269
+ var hy = (4 / 3) * ry * t;
16270
+ var m1 = [x1, y1];
16271
+ var m2 = [x1 + hx * s1, y1 - hy * c1];
16272
+ var m3 = [x2 + hx * s2, y2 - hy * c2];
16273
+ var m4 = [x2, y2];
16162
16274
  m2[0] = 2 * m1[0] - m2[0];
16163
16275
  m2[1] = 2 * m1[1] - m2[1];
16164
16276
  if (recursive) {
16165
- return [...m2, ...m3, ...m4, ...res];
16277
+ return __spreadArray(__spreadArray(__spreadArray(__spreadArray([], m2, true), m3, true), m4, true), res, true);
16166
16278
  }
16167
- res = [...m2, ...m3, ...m4, ...res];
16168
- const newres = [];
16169
- for (let i = 0, ii = res.length; i < ii; i += 1) {
16279
+ res = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], m2, true), m3, true), m4, true), res, true);
16280
+ var newres = [];
16281
+ for (var i = 0, ii = res.length; i < ii; i += 1) {
16170
16282
  newres[i] = i % 2 ? rotateVector(res[i - 1], res[i], rad).y : rotateVector(res[i], res[i + 1], rad).x;
16171
16283
  }
16172
16284
  return newres;
@@ -16355,8 +16467,8 @@
16355
16467
  // }
16356
16468
 
16357
16469
  function quadToCubic(x1, y1, qx, qy, x2, y2) {
16358
- const r13 = 1 / 3;
16359
- const r23 = 2 / 3;
16470
+ var r13 = 1 / 3;
16471
+ var r23 = 2 / 3;
16360
16472
  return [
16361
16473
  r13 * x1 + r23 * qx,
16362
16474
  r13 * y1 + r23 * qy,
@@ -16368,10 +16480,10 @@
16368
16480
  }
16369
16481
 
16370
16482
  function midPoint(a, b, t) {
16371
- const ax = a[0];
16372
- const ay = a[1];
16373
- const bx = b[0];
16374
- const by = b[1];
16483
+ var ax = a[0];
16484
+ var ay = a[1];
16485
+ var bx = b[0];
16486
+ var by = b[1];
16375
16487
  return [ax + (bx - ax) * t, ay + (by - ay) * t];
16376
16488
  }
16377
16489
 
@@ -16384,8 +16496,8 @@
16384
16496
  * the minimum and maximum {x,y} coordinates of a line (L,V,H,Z) segment.
16385
16497
  */
16386
16498
  function segmentLineFactory(x1, y1, x2, y2, distance) {
16387
- const length = distanceSquareRoot([x1, y1], [x2, y2]);
16388
- let point = { x: 0, y: 0 };
16499
+ var length = distanceSquareRoot([x1, y1], [x2, y2]);
16500
+ var point = { x: 0, y: 0 };
16389
16501
  if (typeof distance === 'number') {
16390
16502
  if (distance <= 0) {
16391
16503
  point = { x: x1, y: y1 };
@@ -16394,13 +16506,13 @@
16394
16506
  point = { x: x2, y: y2 };
16395
16507
  }
16396
16508
  else {
16397
- const [x, y] = midPoint([x1, y1], [x2, y2], distance / length);
16398
- point = { x, y };
16509
+ var _a = midPoint([x1, y1], [x2, y2], distance / length), x = _a[0], y = _a[1];
16510
+ point = { x: x, y: y };
16399
16511
  }
16400
16512
  }
16401
16513
  return {
16402
- length,
16403
- point,
16514
+ length: length,
16515
+ point: point,
16404
16516
  min: {
16405
16517
  x: Math.min(x1, x2),
16406
16518
  y: Math.min(y1, y2),
@@ -16413,29 +16525,29 @@
16413
16525
  }
16414
16526
 
16415
16527
  function lineToCubic(x1, y1, x2, y2) {
16416
- const t = 0.5;
16417
- const p0 = [x1, y1];
16418
- const p1 = [x2, y2];
16419
- const p2 = midPoint(p0, p1, t);
16420
- const p3 = midPoint(p1, p2, t);
16421
- const p4 = midPoint(p2, p3, t);
16422
- const p5 = midPoint(p3, p4, t);
16423
- const p6 = midPoint(p4, p5, t);
16424
- const seg1 = [...p0, ...p2, ...p4, ...p6, t];
16528
+ var t = 0.5;
16529
+ var p0 = [x1, y1];
16530
+ var p1 = [x2, y2];
16531
+ var p2 = midPoint(p0, p1, t);
16532
+ var p3 = midPoint(p1, p2, t);
16533
+ var p4 = midPoint(p2, p3, t);
16534
+ var p5 = midPoint(p3, p4, t);
16535
+ var p6 = midPoint(p4, p5, t);
16536
+ var seg1 = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], p0, true), p2, true), p4, true), p6, true), [t], false);
16425
16537
  // @ts-ignore
16426
- const cp1 = segmentLineFactory(...seg1).point;
16427
- const seg2 = [...p6, ...p5, ...p3, ...p1, 0];
16538
+ var cp1 = segmentLineFactory.apply(void 0, seg1).point;
16539
+ var seg2 = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], p6, true), p5, true), p3, true), p1, true), [0], false);
16428
16540
  // @ts-ignore
16429
- const cp2 = segmentLineFactory(...seg2).point;
16541
+ var cp2 = segmentLineFactory.apply(void 0, seg2).point;
16430
16542
  return [cp1.x, cp1.y, cp2.x, cp2.y, x2, y2];
16431
16543
  }
16432
16544
 
16433
16545
  function segmentToCubic(segment, params) {
16434
- const [pathCommand] = segment;
16435
- const values = segment.slice(1).map(Number);
16436
- const [x, y] = values;
16437
- let args;
16438
- const { x1: px1, y1: py1, x: px, y: py } = params;
16546
+ var pathCommand = segment[0];
16547
+ var values = segment.slice(1).map(Number);
16548
+ var x = values[0], y = values[1];
16549
+ var args;
16550
+ var px1 = params.x1, py1 = params.y1, px = params.x, py = params.y;
16439
16551
  if (!'TQ'.includes(pathCommand)) {
16440
16552
  params.qx = null;
16441
16553
  params.qy = null;
@@ -16446,31 +16558,32 @@
16446
16558
  params.y = y;
16447
16559
  return segment;
16448
16560
  case 'A':
16449
- args = [px1, py1, ...values];
16561
+ args = __spreadArray([px1, py1], values, true);
16450
16562
  // @ts-ignore
16451
- return ['C', ...arcToCubic(...args)];
16563
+ return __spreadArray(['C'], arcToCubic.apply(void 0, args), true);
16452
16564
  case 'Q':
16453
16565
  params.qx = x;
16454
16566
  params.qy = y;
16455
- args = [px1, py1, ...values];
16567
+ args = __spreadArray([px1, py1], values, true);
16456
16568
  // @ts-ignore
16457
- return ['C', ...quadToCubic(...args)];
16569
+ return __spreadArray(['C'], quadToCubic.apply(void 0, args), true);
16458
16570
  case 'L':
16459
- return ['C', ...lineToCubic(px1, py1, x, y)];
16571
+ return __spreadArray(['C'], lineToCubic(px1, py1, x, y), true);
16460
16572
  case 'Z':
16461
16573
  // prevent NaN from divide 0
16462
16574
  if (px1 === px && py1 === py) {
16463
16575
  return ['C', px1, py1, px, py, px, py];
16464
16576
  }
16465
- return ['C', ...lineToCubic(px1, py1, px, py)];
16577
+ return __spreadArray(['C'], lineToCubic(px1, py1, px, py), true);
16466
16578
  }
16467
16579
  return segment;
16468
16580
  }
16469
16581
 
16470
16582
  // import { fixPath } from '../process/fix-path';
16471
- function path2Curve(pathInput, needZCommandIndexes = false) {
16583
+ function path2Curve(pathInput, needZCommandIndexes) {
16584
+ if (needZCommandIndexes === void 0) { needZCommandIndexes = false; }
16472
16585
  if (isCurveArray(pathInput)) {
16473
- const cloned = clonePath(pathInput);
16586
+ var cloned = clonePath(pathInput);
16474
16587
  if (needZCommandIndexes) {
16475
16588
  return [cloned, []];
16476
16589
  }
@@ -16480,19 +16593,19 @@
16480
16593
  }
16481
16594
  // fixPath will remove 'Z' command
16482
16595
  // const path = fixPath(normalizePath(pathInput));
16483
- const path = normalizePath(pathInput);
16484
- const params = Object.assign({}, paramsParser);
16485
- const allPathCommands = [];
16486
- let pathCommand = '';
16487
- let ii = path.length;
16488
- let segment;
16489
- let seglen;
16490
- const zCommandIndexes = [];
16491
- for (let i = 0; i < ii; i += 1) {
16596
+ var path = normalizePath(pathInput);
16597
+ var params = __assign({}, paramsParser);
16598
+ var allPathCommands = [];
16599
+ var pathCommand = '';
16600
+ var ii = path.length;
16601
+ var segment;
16602
+ var seglen;
16603
+ var zCommandIndexes = [];
16604
+ for (var i = 0; i < ii; i += 1) {
16492
16605
  if (path[i])
16493
- [pathCommand] = path[i];
16606
+ pathCommand = path[i][0];
16494
16607
  allPathCommands[i] = pathCommand;
16495
- const curveSegment = segmentToCubic(path[i], params);
16608
+ var curveSegment = segmentToCubic(path[i], params);
16496
16609
  path[i] = curveSegment;
16497
16610
  fixArc(path, allPathCommands, i);
16498
16611
  ii = path.length; // solves curveArrays ending in Z
@@ -16519,24 +16632,25 @@
16519
16632
 
16520
16633
  // reverse CURVE based pathArray segments only
16521
16634
  function reverseCurve(pathArray) {
16522
- const rotatedCurve = pathArray
16635
+ var rotatedCurve = pathArray
16523
16636
  .slice(1)
16524
- .map((x, i, curveOnly) =>
16525
- // @ts-ignore
16526
- !i ? pathArray[0].slice(1).concat(x.slice(1)) : curveOnly[i - 1].slice(-2).concat(x.slice(1)))
16637
+ .map(function (x, i, curveOnly) {
16527
16638
  // @ts-ignore
16528
- .map((x) => x.map((y, i) => x[x.length - i - 2 * (1 - (i % 2))]))
16639
+ return !i ? pathArray[0].slice(1).concat(x.slice(1)) : curveOnly[i - 1].slice(-2).concat(x.slice(1));
16640
+ })
16641
+ // @ts-ignore
16642
+ .map(function (x) { return x.map(function (y, i) { return x[x.length - i - 2 * (1 - (i % 2))]; }); })
16529
16643
  .reverse();
16530
- return [['M'].concat(rotatedCurve[0].slice(0, 2))].concat(rotatedCurve.map((x) => ['C'].concat(x.slice(2))));
16644
+ return [['M'].concat(rotatedCurve[0].slice(0, 2))].concat(rotatedCurve.map(function (x) { return ['C'].concat(x.slice(2)); }));
16531
16645
  }
16532
16646
 
16533
16647
  function angleBetween(v0, v1) {
16534
- const { x: v0x, y: v0y } = v0;
16535
- const { x: v1x, y: v1y } = v1;
16536
- const p = v0x * v1x + v0y * v1y;
16537
- const n = Math.sqrt((Math.pow(v0x, 2) + Math.pow(v0y, 2)) * (Math.pow(v1x, 2) + Math.pow(v1y, 2)));
16538
- const sign = v0x * v1y - v0y * v1x < 0 ? -1 : 1;
16539
- const angle = sign * Math.acos(p / n);
16648
+ var v0x = v0.x, v0y = v0.y;
16649
+ var v1x = v1.x, v1y = v1.y;
16650
+ var p = v0x * v1x + v0y * v1y;
16651
+ var n = Math.sqrt((Math.pow(v0x, 2) + Math.pow(v0y, 2)) * (Math.pow(v1x, 2) + Math.pow(v1y, 2)));
16652
+ var sign = v0x * v1y - v0y * v1x < 0 ? -1 : 1;
16653
+ var angle = sign * Math.acos(p / n);
16540
16654
  return angle;
16541
16655
  }
16542
16656
  /**
@@ -16545,51 +16659,51 @@
16545
16659
  * @see https://github.com/MadLittleMods/svg-curve-lib/blob/master/src/js/svg-curve-lib.js
16546
16660
  */
16547
16661
  function getPointAtArcSegmentLength(x1, y1, RX, RY, angle, LAF, SF, x, y, t) {
16548
- const { abs, sin, cos, sqrt, PI } = Math;
16549
- let rx = abs(RX);
16550
- let ry = abs(RY);
16551
- const xRot = ((angle % 360) + 360) % 360;
16552
- const xRotRad = xRot * (PI / 180);
16662
+ var abs = Math.abs, sin = Math.sin, cos = Math.cos, sqrt = Math.sqrt, PI = Math.PI;
16663
+ var rx = abs(RX);
16664
+ var ry = abs(RY);
16665
+ var xRot = ((angle % 360) + 360) % 360;
16666
+ var xRotRad = xRot * (PI / 180);
16553
16667
  if (x1 === x && y1 === y) {
16554
16668
  return { x: x1, y: y1 };
16555
16669
  }
16556
16670
  if (rx === 0 || ry === 0) {
16557
16671
  return segmentLineFactory(x1, y1, x, y, t).point;
16558
16672
  }
16559
- const dx = (x1 - x) / 2;
16560
- const dy = (y1 - y) / 2;
16561
- const transformedPoint = {
16673
+ var dx = (x1 - x) / 2;
16674
+ var dy = (y1 - y) / 2;
16675
+ var transformedPoint = {
16562
16676
  x: cos(xRotRad) * dx + sin(xRotRad) * dy,
16563
16677
  y: -sin(xRotRad) * dx + cos(xRotRad) * dy,
16564
16678
  };
16565
- const radiiCheck = Math.pow(transformedPoint.x, 2) / Math.pow(rx, 2) + Math.pow(transformedPoint.y, 2) / Math.pow(ry, 2);
16679
+ var radiiCheck = Math.pow(transformedPoint.x, 2) / Math.pow(rx, 2) + Math.pow(transformedPoint.y, 2) / Math.pow(ry, 2);
16566
16680
  if (radiiCheck > 1) {
16567
16681
  rx *= sqrt(radiiCheck);
16568
16682
  ry *= sqrt(radiiCheck);
16569
16683
  }
16570
- const cSquareNumerator = Math.pow(rx, 2) * Math.pow(ry, 2) - Math.pow(rx, 2) * Math.pow(transformedPoint.y, 2) - Math.pow(ry, 2) * Math.pow(transformedPoint.x, 2);
16571
- const cSquareRootDenom = Math.pow(rx, 2) * Math.pow(transformedPoint.y, 2) + Math.pow(ry, 2) * Math.pow(transformedPoint.x, 2);
16572
- let cRadicand = cSquareNumerator / cSquareRootDenom;
16684
+ var cSquareNumerator = Math.pow(rx, 2) * Math.pow(ry, 2) - Math.pow(rx, 2) * Math.pow(transformedPoint.y, 2) - Math.pow(ry, 2) * Math.pow(transformedPoint.x, 2);
16685
+ var cSquareRootDenom = Math.pow(rx, 2) * Math.pow(transformedPoint.y, 2) + Math.pow(ry, 2) * Math.pow(transformedPoint.x, 2);
16686
+ var cRadicand = cSquareNumerator / cSquareRootDenom;
16573
16687
  cRadicand = cRadicand < 0 ? 0 : cRadicand;
16574
- const cCoef = (LAF !== SF ? 1 : -1) * sqrt(cRadicand);
16575
- const transformedCenter = {
16688
+ var cCoef = (LAF !== SF ? 1 : -1) * sqrt(cRadicand);
16689
+ var transformedCenter = {
16576
16690
  x: cCoef * ((rx * transformedPoint.y) / ry),
16577
16691
  y: cCoef * (-(ry * transformedPoint.x) / rx),
16578
16692
  };
16579
- const center = {
16693
+ var center = {
16580
16694
  x: cos(xRotRad) * transformedCenter.x - sin(xRotRad) * transformedCenter.y + (x1 + x) / 2,
16581
16695
  y: sin(xRotRad) * transformedCenter.x + cos(xRotRad) * transformedCenter.y + (y1 + y) / 2,
16582
16696
  };
16583
- const startVector = {
16697
+ var startVector = {
16584
16698
  x: (transformedPoint.x - transformedCenter.x) / rx,
16585
16699
  y: (transformedPoint.y - transformedCenter.y) / ry,
16586
16700
  };
16587
- const startAngle = angleBetween({ x: 1, y: 0 }, startVector);
16588
- const endVector = {
16701
+ var startAngle = angleBetween({ x: 1, y: 0 }, startVector);
16702
+ var endVector = {
16589
16703
  x: (-transformedPoint.x - transformedCenter.x) / rx,
16590
16704
  y: (-transformedPoint.y - transformedCenter.y) / ry,
16591
16705
  };
16592
- let sweepAngle = angleBetween(startVector, endVector);
16706
+ var sweepAngle = angleBetween(startVector, endVector);
16593
16707
  if (!SF && sweepAngle > 0) {
16594
16708
  sweepAngle -= 2 * PI;
16595
16709
  }
@@ -16597,10 +16711,10 @@
16597
16711
  sweepAngle += 2 * PI;
16598
16712
  }
16599
16713
  sweepAngle %= 2 * PI;
16600
- const alpha = startAngle + sweepAngle * t;
16601
- const ellipseComponentX = rx * cos(alpha);
16602
- const ellipseComponentY = ry * sin(alpha);
16603
- const point = {
16714
+ var alpha = startAngle + sweepAngle * t;
16715
+ var ellipseComponentX = rx * cos(alpha);
16716
+ var ellipseComponentY = ry * sin(alpha);
16717
+ var point = {
16604
16718
  x: cos(xRotRad) * ellipseComponentX - sin(xRotRad) * ellipseComponentY + center.x,
16605
16719
  y: sin(xRotRad) * ellipseComponentX + cos(xRotRad) * ellipseComponentY + center.y,
16606
16720
  };
@@ -16618,27 +16732,28 @@
16618
16732
  * the shape minimum and maximum {x,y} coordinates of an A (arc-to) segment.
16619
16733
  */
16620
16734
  function segmentArcFactory(X1, Y1, RX, RY, angle, LAF, SF, X2, Y2, distance) {
16621
- const distanceIsNumber = typeof distance === 'number';
16622
- let x = X1;
16623
- let y = Y1;
16624
- let LENGTH = 0;
16625
- let prev = [x, y, LENGTH];
16626
- let cur = [x, y];
16627
- let t = 0;
16628
- let POINT = { x: 0, y: 0 };
16629
- let POINTS = [{ x, y }];
16735
+ var _a;
16736
+ var distanceIsNumber = typeof distance === 'number';
16737
+ var x = X1;
16738
+ var y = Y1;
16739
+ var LENGTH = 0;
16740
+ var prev = [x, y, LENGTH];
16741
+ var cur = [x, y];
16742
+ var t = 0;
16743
+ var POINT = { x: 0, y: 0 };
16744
+ var POINTS = [{ x: x, y: y }];
16630
16745
  if (distanceIsNumber && distance <= 0) {
16631
- POINT = { x, y };
16746
+ POINT = { x: x, y: y };
16632
16747
  }
16633
- const sampleSize = 300;
16634
- for (let j = 0; j <= sampleSize; j += 1) {
16748
+ var sampleSize = 300;
16749
+ for (var j = 0; j <= sampleSize; j += 1) {
16635
16750
  t = j / sampleSize;
16636
- ({ x, y } = getPointAtArcSegmentLength(X1, Y1, RX, RY, angle, LAF, SF, X2, Y2, t));
16637
- POINTS = [...POINTS, { x, y }];
16751
+ (_a = getPointAtArcSegmentLength(X1, Y1, RX, RY, angle, LAF, SF, X2, Y2, t), x = _a.x, y = _a.y);
16752
+ POINTS = __spreadArray(__spreadArray([], POINTS, true), [{ x: x, y: y }], false);
16638
16753
  LENGTH += distanceSquareRoot(cur, [x, y]);
16639
16754
  cur = [x, y];
16640
16755
  if (distanceIsNumber && LENGTH > distance && distance > prev[2]) {
16641
- const dv = (LENGTH - distance) / (LENGTH - prev[2]);
16756
+ var dv = (LENGTH - distance) / (LENGTH - prev[2]);
16642
16757
  POINT = {
16643
16758
  x: cur[0] * (1 - dv) + prev[0] * dv,
16644
16759
  y: cur[1] * (1 - dv) + prev[1] * dv,
@@ -16653,12 +16768,12 @@
16653
16768
  length: LENGTH,
16654
16769
  point: POINT,
16655
16770
  min: {
16656
- x: Math.min(...POINTS.map((n) => n.x)),
16657
- y: Math.min(...POINTS.map((n) => n.y)),
16771
+ x: Math.min.apply(Math, POINTS.map(function (n) { return n.x; })),
16772
+ y: Math.min.apply(Math, POINTS.map(function (n) { return n.y; })),
16658
16773
  },
16659
16774
  max: {
16660
- x: Math.max(...POINTS.map((n) => n.x)),
16661
- y: Math.max(...POINTS.map((n) => n.y)),
16775
+ x: Math.max.apply(Math, POINTS.map(function (n) { return n.x; })),
16776
+ y: Math.max.apply(Math, POINTS.map(function (n) { return n.y; })),
16662
16777
  },
16663
16778
  };
16664
16779
  }
@@ -16668,7 +16783,7 @@
16668
16783
  * the minimum and maximum {x,y} coordinates of a C (cubic-bezier) segment.
16669
16784
  */
16670
16785
  function getPointAtCubicSegmentLength(x1, y1, c1x, c1y, c2x, c2y, x2, y2, t) {
16671
- const t1 = 1 - t;
16786
+ var t1 = 1 - t;
16672
16787
  return {
16673
16788
  x: Math.pow(t1, 3) * x1 + 3 * Math.pow(t1, 2) * t * c1x + 3 * t1 * Math.pow(t, 2) * c2x + Math.pow(t, 3) * x2,
16674
16789
  y: Math.pow(t1, 3) * y1 + 3 * Math.pow(t1, 2) * t * c1y + 3 * t1 * Math.pow(t, 2) * c2y + Math.pow(t, 3) * y2,
@@ -16679,28 +16794,29 @@
16679
16794
  * or an {x,y} point at a given length.
16680
16795
  */
16681
16796
  function segmentCubicFactory(x1, y1, c1x, c1y, c2x, c2y, x2, y2, distance) {
16682
- const distanceIsNumber = typeof distance === 'number';
16683
- let x = x1;
16684
- let y = y1;
16685
- let LENGTH = 0;
16686
- let prev = [x, y, LENGTH];
16687
- let cur = [x, y];
16688
- let t = 0;
16689
- let POINT = { x: 0, y: 0 };
16690
- let POINTS = [{ x, y }];
16797
+ var _a;
16798
+ var distanceIsNumber = typeof distance === 'number';
16799
+ var x = x1;
16800
+ var y = y1;
16801
+ var LENGTH = 0;
16802
+ var prev = [x, y, LENGTH];
16803
+ var cur = [x, y];
16804
+ var t = 0;
16805
+ var POINT = { x: 0, y: 0 };
16806
+ var POINTS = [{ x: x, y: y }];
16691
16807
  if (distanceIsNumber && distance <= 0) {
16692
- POINT = { x, y };
16808
+ POINT = { x: x, y: y };
16693
16809
  }
16694
16810
  // bad perf when size = 300
16695
- const sampleSize = 20;
16696
- for (let j = 0; j <= sampleSize; j += 1) {
16811
+ var sampleSize = 20;
16812
+ for (var j = 0; j <= sampleSize; j += 1) {
16697
16813
  t = j / sampleSize;
16698
- ({ x, y } = getPointAtCubicSegmentLength(x1, y1, c1x, c1y, c2x, c2y, x2, y2, t));
16699
- POINTS = [...POINTS, { x, y }];
16814
+ (_a = getPointAtCubicSegmentLength(x1, y1, c1x, c1y, c2x, c2y, x2, y2, t), x = _a.x, y = _a.y);
16815
+ POINTS = __spreadArray(__spreadArray([], POINTS, true), [{ x: x, y: y }], false);
16700
16816
  LENGTH += distanceSquareRoot(cur, [x, y]);
16701
16817
  cur = [x, y];
16702
16818
  if (distanceIsNumber && LENGTH > distance && distance > prev[2]) {
16703
- const dv = (LENGTH - distance) / (LENGTH - prev[2]);
16819
+ var dv = (LENGTH - distance) / (LENGTH - prev[2]);
16704
16820
  POINT = {
16705
16821
  x: cur[0] * (1 - dv) + prev[0] * dv,
16706
16822
  y: cur[1] * (1 - dv) + prev[1] * dv,
@@ -16715,12 +16831,12 @@
16715
16831
  length: LENGTH,
16716
16832
  point: POINT,
16717
16833
  min: {
16718
- x: Math.min(...POINTS.map((n) => n.x)),
16719
- y: Math.min(...POINTS.map((n) => n.y)),
16834
+ x: Math.min.apply(Math, POINTS.map(function (n) { return n.x; })),
16835
+ y: Math.min.apply(Math, POINTS.map(function (n) { return n.y; })),
16720
16836
  },
16721
16837
  max: {
16722
- x: Math.max(...POINTS.map((n) => n.x)),
16723
- y: Math.max(...POINTS.map((n) => n.y)),
16838
+ x: Math.max.apply(Math, POINTS.map(function (n) { return n.x; })),
16839
+ y: Math.max.apply(Math, POINTS.map(function (n) { return n.y; })),
16724
16840
  },
16725
16841
  };
16726
16842
  }
@@ -16732,7 +16848,7 @@
16732
16848
  * @see https://github.com/substack/point-at-length
16733
16849
  */
16734
16850
  function getPointAtQuadSegmentLength(x1, y1, cx, cy, x2, y2, t) {
16735
- const t1 = 1 - t;
16851
+ var t1 = 1 - t;
16736
16852
  return {
16737
16853
  x: Math.pow(t1, 2) * x1 + 2 * t1 * t * cx + Math.pow(t, 2) * x2,
16738
16854
  y: Math.pow(t1, 2) * y1 + 2 * t1 * t * cy + Math.pow(t, 2) * y2,
@@ -16743,27 +16859,28 @@
16743
16859
  * the minimum and maximum {x,y} coordinates of a Q (quadratic-bezier) segment.
16744
16860
  */
16745
16861
  function segmentQuadFactory(x1, y1, qx, qy, x2, y2, distance) {
16746
- const distanceIsNumber = typeof distance === 'number';
16747
- let x = x1;
16748
- let y = y1;
16749
- let LENGTH = 0;
16750
- let prev = [x, y, LENGTH];
16751
- let cur = [x, y];
16752
- let t = 0;
16753
- let POINT = { x: 0, y: 0 };
16754
- let POINTS = [{ x, y }];
16862
+ var _a;
16863
+ var distanceIsNumber = typeof distance === 'number';
16864
+ var x = x1;
16865
+ var y = y1;
16866
+ var LENGTH = 0;
16867
+ var prev = [x, y, LENGTH];
16868
+ var cur = [x, y];
16869
+ var t = 0;
16870
+ var POINT = { x: 0, y: 0 };
16871
+ var POINTS = [{ x: x, y: y }];
16755
16872
  if (distanceIsNumber && distance <= 0) {
16756
- POINT = { x, y };
16873
+ POINT = { x: x, y: y };
16757
16874
  }
16758
- const sampleSize = 300;
16759
- for (let j = 0; j <= sampleSize; j += 1) {
16875
+ var sampleSize = 300;
16876
+ for (var j = 0; j <= sampleSize; j += 1) {
16760
16877
  t = j / sampleSize;
16761
- ({ x, y } = getPointAtQuadSegmentLength(x1, y1, qx, qy, x2, y2, t));
16762
- POINTS = [...POINTS, { x, y }];
16878
+ (_a = getPointAtQuadSegmentLength(x1, y1, qx, qy, x2, y2, t), x = _a.x, y = _a.y);
16879
+ POINTS = __spreadArray(__spreadArray([], POINTS, true), [{ x: x, y: y }], false);
16763
16880
  LENGTH += distanceSquareRoot(cur, [x, y]);
16764
16881
  cur = [x, y];
16765
16882
  if (distanceIsNumber && LENGTH > distance && distance > prev[2]) {
16766
- const dv = (LENGTH - distance) / (LENGTH - prev[2]);
16883
+ var dv = (LENGTH - distance) / (LENGTH - prev[2]);
16767
16884
  POINT = {
16768
16885
  x: cur[0] * (1 - dv) + prev[0] * dv,
16769
16886
  y: cur[1] * (1 - dv) + prev[1] * dv,
@@ -16779,12 +16896,12 @@
16779
16896
  length: LENGTH,
16780
16897
  point: POINT,
16781
16898
  min: {
16782
- x: Math.min(...POINTS.map((n) => n.x)),
16783
- y: Math.min(...POINTS.map((n) => n.y)),
16899
+ x: Math.min.apply(Math, POINTS.map(function (n) { return n.x; })),
16900
+ y: Math.min.apply(Math, POINTS.map(function (n) { return n.y; })),
16784
16901
  },
16785
16902
  max: {
16786
- x: Math.max(...POINTS.map((n) => n.x)),
16787
- y: Math.max(...POINTS.map((n) => n.y)),
16903
+ x: Math.max.apply(Math, POINTS.map(function (n) { return n.x; })),
16904
+ y: Math.max.apply(Math, POINTS.map(function (n) { return n.y; })),
16788
16905
  },
16789
16906
  };
16790
16907
  }
@@ -16795,34 +16912,35 @@
16795
16912
  * the shape minimum and maximum {x,y} coordinates.
16796
16913
  */
16797
16914
  function pathLengthFactory(pathInput, distance) {
16798
- const path = normalizePath(pathInput);
16799
- const distanceIsNumber = typeof distance === 'number';
16800
- let isM;
16801
- let data = [];
16802
- let pathCommand;
16803
- let x = 0;
16804
- let y = 0;
16805
- let mx = 0;
16806
- let my = 0;
16807
- let seg;
16808
- let MIN = [];
16809
- let MAX = [];
16810
- let length = 0;
16811
- let min = { x: 0, y: 0 };
16812
- let max = min;
16813
- let point = min;
16814
- let POINT = min;
16815
- let LENGTH = 0;
16816
- for (let i = 0, ll = path.length; i < ll; i += 1) {
16915
+ var _a, _b, _c, _d, _e, _f;
16916
+ var path = normalizePath(pathInput);
16917
+ var distanceIsNumber = typeof distance === 'number';
16918
+ var isM;
16919
+ var data = [];
16920
+ var pathCommand;
16921
+ var x = 0;
16922
+ var y = 0;
16923
+ var mx = 0;
16924
+ var my = 0;
16925
+ var seg;
16926
+ var MIN = [];
16927
+ var MAX = [];
16928
+ var length = 0;
16929
+ var min = { x: 0, y: 0 };
16930
+ var max = min;
16931
+ var point = min;
16932
+ var POINT = min;
16933
+ var LENGTH = 0;
16934
+ for (var i = 0, ll = path.length; i < ll; i += 1) {
16817
16935
  seg = path[i];
16818
- [pathCommand] = seg;
16936
+ pathCommand = seg[0];
16819
16937
  isM = pathCommand === 'M';
16820
- data = !isM ? [x, y, ...seg.slice(1)] : data;
16938
+ data = !isM ? __spreadArray([x, y], seg.slice(1), true) : data;
16821
16939
  // this segment is always ZERO
16822
16940
  /* istanbul ignore else */
16823
16941
  if (isM) {
16824
16942
  // remember mx, my for Z
16825
- [, mx, my] = seg;
16943
+ mx = seg[1], my = seg[2];
16826
16944
  min = { x: mx, y: my };
16827
16945
  max = min;
16828
16946
  length = 0;
@@ -16832,48 +16950,48 @@
16832
16950
  }
16833
16951
  else if (pathCommand === 'L') {
16834
16952
  // @ts-ignore
16835
- ({ length, min, max, point } = segmentLineFactory(...data, (distance || 0) - LENGTH));
16953
+ (_a = segmentLineFactory.apply(void 0, __spreadArray(__spreadArray([], data, false), [(distance || 0) - LENGTH], false)), length = _a.length, min = _a.min, max = _a.max, point = _a.point);
16836
16954
  }
16837
16955
  else if (pathCommand === 'A') {
16838
16956
  // @ts-ignore
16839
- ({ length, min, max, point } = segmentArcFactory(...data, (distance || 0) - LENGTH));
16957
+ (_b = segmentArcFactory.apply(void 0, __spreadArray(__spreadArray([], data, false), [(distance || 0) - LENGTH], false)), length = _b.length, min = _b.min, max = _b.max, point = _b.point);
16840
16958
  }
16841
16959
  else if (pathCommand === 'C') {
16842
16960
  // @ts-ignore
16843
- ({ length, min, max, point } = segmentCubicFactory(...data, (distance || 0) - LENGTH));
16961
+ (_c = segmentCubicFactory.apply(void 0, __spreadArray(__spreadArray([], data, false), [(distance || 0) - LENGTH], false)), length = _c.length, min = _c.min, max = _c.max, point = _c.point);
16844
16962
  }
16845
16963
  else if (pathCommand === 'Q') {
16846
16964
  // @ts-ignore
16847
- ({ length, min, max, point } = segmentQuadFactory(...data, (distance || 0) - LENGTH));
16965
+ (_d = segmentQuadFactory.apply(void 0, __spreadArray(__spreadArray([], data, false), [(distance || 0) - LENGTH], false)), length = _d.length, min = _d.min, max = _d.max, point = _d.point);
16848
16966
  }
16849
16967
  else if (pathCommand === 'Z') {
16850
16968
  data = [x, y, mx, my];
16851
16969
  // @ts-ignore
16852
- ({ length, min, max, point } = segmentLineFactory(...data, (distance || 0) - LENGTH));
16970
+ (_e = segmentLineFactory.apply(void 0, __spreadArray(__spreadArray([], data, false), [(distance || 0) - LENGTH], false)), length = _e.length, min = _e.min, max = _e.max, point = _e.point);
16853
16971
  }
16854
16972
  if (distanceIsNumber && LENGTH < distance && LENGTH + length >= distance) {
16855
16973
  POINT = point;
16856
16974
  }
16857
- MAX = [...MAX, max];
16858
- MIN = [...MIN, min];
16975
+ MAX = __spreadArray(__spreadArray([], MAX, true), [max], false);
16976
+ MIN = __spreadArray(__spreadArray([], MIN, true), [min], false);
16859
16977
  LENGTH += length;
16860
- [x, y] = pathCommand !== 'Z' ? seg.slice(-2) : [mx, my];
16978
+ _f = pathCommand !== 'Z' ? seg.slice(-2) : [mx, my], x = _f[0], y = _f[1];
16861
16979
  }
16862
16980
  // native `getPointAtLength` behavior when the given distance
16863
16981
  // is higher than total length
16864
16982
  if (distanceIsNumber && distance >= LENGTH) {
16865
- POINT = { x, y };
16983
+ POINT = { x: x, y: y };
16866
16984
  }
16867
16985
  return {
16868
16986
  length: LENGTH,
16869
16987
  point: POINT,
16870
16988
  min: {
16871
- x: Math.min(...MIN.map((n) => n.x)),
16872
- y: Math.min(...MIN.map((n) => n.y)),
16989
+ x: Math.min.apply(Math, MIN.map(function (n) { return n.x; })),
16990
+ y: Math.min.apply(Math, MIN.map(function (n) { return n.y; })),
16873
16991
  },
16874
16992
  max: {
16875
- x: Math.max(...MAX.map((n) => n.x)),
16876
- y: Math.max(...MAX.map((n) => n.y)),
16993
+ x: Math.max.apply(Math, MAX.map(function (n) { return n.x; })),
16994
+ y: Math.max.apply(Math, MAX.map(function (n) { return n.y; })),
16877
16995
  },
16878
16996
  };
16879
16997
  }
@@ -16896,13 +17014,13 @@
16896
17014
  cz: 0,
16897
17015
  };
16898
17016
  }
16899
- const { length, min: { x: xMin, y: yMin }, max: { x: xMax, y: yMax }, } = pathLengthFactory(path);
16900
- const width = xMax - xMin;
16901
- const height = yMax - yMin;
17017
+ var _a = pathLengthFactory(path), length = _a.length, _b = _a.min, xMin = _b.x, yMin = _b.y, _c = _a.max, xMax = _c.x, yMax = _c.y;
17018
+ var width = xMax - xMin;
17019
+ var height = yMax - yMin;
16902
17020
  return {
16903
- length,
16904
- width,
16905
- height,
17021
+ length: length,
17022
+ width: width,
17023
+ height: height,
16906
17024
  x: xMin,
16907
17025
  y: yMin,
16908
17026
  x2: xMax,
@@ -16915,28 +17033,30 @@
16915
17033
  }
16916
17034
 
16917
17035
  function getRotations(a) {
16918
- const segCount = a.length;
16919
- const pointCount = segCount - 1;
16920
- return a.map((f, idx) => a.map((p, i) => {
16921
- let oldSegIdx = idx + i;
16922
- let seg;
16923
- if (i === 0 || (a[oldSegIdx] && a[oldSegIdx][0] === 'M')) {
16924
- seg = a[oldSegIdx];
16925
- return ['M'].concat(seg.slice(-2));
16926
- }
16927
- if (oldSegIdx >= segCount)
16928
- oldSegIdx -= pointCount;
16929
- return a[oldSegIdx];
16930
- }));
17036
+ var segCount = a.length;
17037
+ var pointCount = segCount - 1;
17038
+ return a.map(function (f, idx) {
17039
+ return a.map(function (p, i) {
17040
+ var oldSegIdx = idx + i;
17041
+ var seg;
17042
+ if (i === 0 || (a[oldSegIdx] && a[oldSegIdx][0] === 'M')) {
17043
+ seg = a[oldSegIdx];
17044
+ return ['M'].concat(seg.slice(-2));
17045
+ }
17046
+ if (oldSegIdx >= segCount)
17047
+ oldSegIdx -= pointCount;
17048
+ return a[oldSegIdx];
17049
+ });
17050
+ });
16931
17051
  }
16932
17052
  function getRotatedCurve(a, b) {
16933
- const segCount = a.length - 1;
16934
- const lineLengths = [];
16935
- let computedIndex = 0;
16936
- let sumLensSqrd = 0;
16937
- const rotations = getRotations(a);
16938
- rotations.forEach((r, i) => {
16939
- a.slice(1).forEach((s, j) => {
17053
+ var segCount = a.length - 1;
17054
+ var lineLengths = [];
17055
+ var computedIndex = 0;
17056
+ var sumLensSqrd = 0;
17057
+ var rotations = getRotations(a);
17058
+ rotations.forEach(function (r, i) {
17059
+ a.slice(1).forEach(function (s, j) {
16940
17060
  // @ts-ignore
16941
17061
  sumLensSqrd += distanceSquareRoot(a[(i + j) % segCount].slice(-2), b[j % segCount].slice(-2));
16942
17062
  });
@@ -16970,23 +17090,24 @@
16970
17090
  * @see https://github.com/paperjs/paper.js/blob/develop/src/path/Path.js
16971
17091
  */
16972
17092
  function getPathArea(path) {
16973
- let x = 0;
16974
- let y = 0;
16975
- let len = 0;
17093
+ var x = 0;
17094
+ var y = 0;
17095
+ var len = 0;
16976
17096
  return path2Curve(path)
16977
- .map((seg) => {
17097
+ .map(function (seg) {
17098
+ var _a;
16978
17099
  switch (seg[0]) {
16979
17100
  case 'M':
16980
- [, x, y] = seg;
17101
+ x = seg[1], y = seg[2];
16981
17102
  return 0;
16982
17103
  default:
16983
17104
  // @ts-ignore
16984
- len = getCubicSegArea(x, y, ...seg.slice(1));
16985
- [x, y] = seg.slice(-2);
17105
+ len = getCubicSegArea.apply(void 0, __spreadArray([x, y], seg.slice(1), false));
17106
+ _a = seg.slice(-2), x = _a[0], y = _a[1];
16986
17107
  return len;
16987
17108
  }
16988
17109
  })
16989
- .reduce((a, b) => a + b, 0);
17110
+ .reduce(function (a, b) { return a + b; }, 0);
16990
17111
  }
16991
17112
  // export function getPathArea(pathArray: AbsoluteArray) {
16992
17113
  // let x = 0;
@@ -17025,17 +17146,18 @@
17025
17146
  return pathLengthFactory(pathInput, distance).point;
17026
17147
  }
17027
17148
 
17028
- function splitCubic(pts, t = 0.5) {
17029
- const p0 = pts.slice(0, 2);
17030
- const p1 = pts.slice(2, 4);
17031
- const p2 = pts.slice(4, 6);
17032
- const p3 = pts.slice(6, 8);
17033
- const p4 = midPoint(p0, p1, t);
17034
- const p5 = midPoint(p1, p2, t);
17035
- const p6 = midPoint(p2, p3, t);
17036
- const p7 = midPoint(p4, p5, t);
17037
- const p8 = midPoint(p5, p6, t);
17038
- const p9 = midPoint(p7, p8, t);
17149
+ function splitCubic(pts, t) {
17150
+ if (t === void 0) { t = 0.5; }
17151
+ var p0 = pts.slice(0, 2);
17152
+ var p1 = pts.slice(2, 4);
17153
+ var p2 = pts.slice(4, 6);
17154
+ var p3 = pts.slice(6, 8);
17155
+ var p4 = midPoint(p0, p1, t);
17156
+ var p5 = midPoint(p1, p2, t);
17157
+ var p6 = midPoint(p2, p3, t);
17158
+ var p7 = midPoint(p4, p5, t);
17159
+ var p8 = midPoint(p5, p6, t);
17160
+ var p9 = midPoint(p7, p8, t);
17039
17161
  return [
17040
17162
  // @ts-ignore
17041
17163
  ['C'].concat(p4, p7, p9),
@@ -17044,12 +17166,12 @@
17044
17166
  ];
17045
17167
  }
17046
17168
  function getCurveArray(segments) {
17047
- return segments.map((segment, i, pathArray) => {
17169
+ return segments.map(function (segment, i, pathArray) {
17048
17170
  // @ts-ignore
17049
- const segmentData = i && pathArray[i - 1].slice(-2).concat(segment.slice(1));
17171
+ var segmentData = i && pathArray[i - 1].slice(-2).concat(segment.slice(1));
17050
17172
  // @ts-ignore
17051
- const curveLength = i ? segmentCubicFactory(...segmentData).length : 0;
17052
- let subsegs;
17173
+ var curveLength = i ? segmentCubicFactory.apply(void 0, segmentData).length : 0;
17174
+ var subsegs;
17053
17175
  if (i) {
17054
17176
  // must be [segment,segment]
17055
17177
  subsegs = curveLength ? splitCubic(segmentData) : [segment, segment];
@@ -17065,33 +17187,40 @@
17065
17187
  });
17066
17188
  }
17067
17189
  function equalizeSegments(path1, path2, TL) {
17068
- const c1 = getCurveArray(path1);
17069
- const c2 = getCurveArray(path2);
17070
- const L1 = c1.length;
17071
- const L2 = c2.length;
17072
- const l1 = c1.filter((x) => x.l).length;
17073
- const l2 = c2.filter((x) => x.l).length;
17074
- const m1 = c1.filter((x) => x.l).reduce((a, { l }) => a + l, 0) / l1 || 0;
17075
- const m2 = c2.filter((x) => x.l).reduce((a, { l }) => a + l, 0) / l2 || 0;
17076
- const tl = TL || Math.max(L1, L2);
17077
- const mm = [m1, m2];
17078
- const dif = [tl - L1, tl - L2];
17079
- let canSplit = 0;
17080
- const result = [c1, c2].map((x, i) =>
17081
- // @ts-ignore
17082
- x.l === tl
17083
- ? x.map((y) => y.s)
17084
- : x
17085
- .map((y, j) => {
17086
- canSplit = j && dif[i] && y.l >= mm[i];
17087
- dif[i] -= canSplit ? 1 : 0;
17088
- return canSplit ? y.ss : [y.s];
17089
- })
17090
- .flat());
17190
+ var c1 = getCurveArray(path1);
17191
+ var c2 = getCurveArray(path2);
17192
+ var L1 = c1.length;
17193
+ var L2 = c2.length;
17194
+ var l1 = c1.filter(function (x) { return x.l; }).length;
17195
+ var l2 = c2.filter(function (x) { return x.l; }).length;
17196
+ var m1 = c1.filter(function (x) { return x.l; }).reduce(function (a, _a) {
17197
+ var l = _a.l;
17198
+ return a + l;
17199
+ }, 0) / l1 || 0;
17200
+ var m2 = c2.filter(function (x) { return x.l; }).reduce(function (a, _a) {
17201
+ var l = _a.l;
17202
+ return a + l;
17203
+ }, 0) / l2 || 0;
17204
+ var tl = TL || Math.max(L1, L2);
17205
+ var mm = [m1, m2];
17206
+ var dif = [tl - L1, tl - L2];
17207
+ var canSplit = 0;
17208
+ var result = [c1, c2].map(function (x, i) {
17209
+ // @ts-ignore
17210
+ return x.l === tl
17211
+ ? x.map(function (y) { return y.s; })
17212
+ : x
17213
+ .map(function (y, j) {
17214
+ canSplit = j && dif[i] && y.l >= mm[i];
17215
+ dif[i] -= canSplit ? 1 : 0;
17216
+ return canSplit ? y.ss : [y.s];
17217
+ })
17218
+ .flat();
17219
+ });
17091
17220
  return result[0].length === result[1].length ? result : equalizeSegments(result[0], result[1], tl);
17092
17221
  }
17093
17222
 
17094
- function parsePath(path, object) {
17223
+ var memoizedParsePath = memoize(function (path) {
17095
17224
  var absolutePath;
17096
17225
 
17097
17226
  try {
@@ -17123,11 +17252,6 @@
17123
17252
  height = _getPathBBoxTotalLeng.height,
17124
17253
  length = _getPathBBoxTotalLeng.length;
17125
17254
 
17126
- if (object) {
17127
- object.parsedStyle.defX = x;
17128
- object.parsedStyle.defY = y;
17129
- }
17130
-
17131
17255
  return {
17132
17256
  absolutePath: absolutePath,
17133
17257
  hasArc: hasArc,
@@ -17139,6 +17263,18 @@
17139
17263
  zCommandIndexes: zCommandIndexes,
17140
17264
  rect: new Rectangle(x, y, width, height)
17141
17265
  };
17266
+ }, function (path) {
17267
+ return isString(path) ? path : path2String(path);
17268
+ });
17269
+ function parsePath(path, object) {
17270
+ var result = memoizedParsePath(path);
17271
+
17272
+ if (object) {
17273
+ object.parsedStyle.defX = result.rect.x;
17274
+ object.parsedStyle.defY = result.rect.y;
17275
+ }
17276
+
17277
+ return result;
17142
17278
  }
17143
17279
  function mergePaths(left, right, object) {
17144
17280
  var curve1 = left.curve;
@@ -17589,75 +17725,532 @@
17589
17725
  return [];
17590
17726
  }
17591
17727
 
17592
- /**
17593
- * holds useful CSS-related methods.
17594
- * @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
17595
- *
17596
- * * CSS Typed OM @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/factory_functions
17597
- * * register property @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
17598
- * * CSS Layout API
17728
+ var normalize$4 = function normalize(out, mat) {
17729
+ var m44 = mat[15];
17730
+ // Cannot normalize.
17731
+ if (m44 === 0)
17732
+ return false
17733
+ var scale = 1 / m44;
17734
+ for (var i=0; i<16; i++)
17735
+ out[i] = mat[i] * scale;
17736
+ return true
17737
+ };
17738
+
17739
+ var create_1 = create$6;
17740
+
17741
+ /**
17742
+ * Creates a new identity mat4
17743
+ *
17744
+ * @returns {mat4} a new 4x4 matrix
17599
17745
  */
17746
+ function create$6() {
17747
+ var out = new Float32Array(16);
17748
+ out[0] = 1;
17749
+ out[1] = 0;
17750
+ out[2] = 0;
17751
+ out[3] = 0;
17752
+ out[4] = 0;
17753
+ out[5] = 1;
17754
+ out[6] = 0;
17755
+ out[7] = 0;
17756
+ out[8] = 0;
17757
+ out[9] = 0;
17758
+ out[10] = 1;
17759
+ out[11] = 0;
17760
+ out[12] = 0;
17761
+ out[13] = 0;
17762
+ out[14] = 0;
17763
+ out[15] = 1;
17764
+ return out;
17765
+ }
17600
17766
 
17601
- var CSS = {
17602
- /**
17603
- * <number>
17604
- * @see https://drafts.csswg.org/css-values-4/#number-value
17605
- */
17606
- number: function number(n) {
17607
- return new CSSUnitValue(n);
17608
- },
17767
+ var clone_1 = clone$2;
17609
17768
 
17610
- /**
17611
- * <percentage>
17612
- * @see https://drafts.csswg.org/css-values-4/#percentage-value
17613
- */
17614
- percent: function percent(n) {
17615
- return new CSSUnitValue(n, '%');
17616
- },
17769
+ /**
17770
+ * Creates a new mat4 initialized with values from an existing matrix
17771
+ *
17772
+ * @param {mat4} a matrix to clone
17773
+ * @returns {mat4} a new 4x4 matrix
17774
+ */
17775
+ function clone$2(a) {
17776
+ var out = new Float32Array(16);
17777
+ out[0] = a[0];
17778
+ out[1] = a[1];
17779
+ out[2] = a[2];
17780
+ out[3] = a[3];
17781
+ out[4] = a[4];
17782
+ out[5] = a[5];
17783
+ out[6] = a[6];
17784
+ out[7] = a[7];
17785
+ out[8] = a[8];
17786
+ out[9] = a[9];
17787
+ out[10] = a[10];
17788
+ out[11] = a[11];
17789
+ out[12] = a[12];
17790
+ out[13] = a[13];
17791
+ out[14] = a[14];
17792
+ out[15] = a[15];
17793
+ return out;
17794
+ }
17617
17795
 
17618
- /**
17619
- * <length>
17620
- */
17621
- px: function px(n) {
17622
- return new CSSUnitValue(n, 'px');
17623
- },
17796
+ var determinant_1 = determinant;
17624
17797
 
17625
- /**
17626
- * <length>
17627
- */
17628
- em: function em(n) {
17629
- return new CSSUnitValue(n, 'em');
17630
- },
17631
- rem: function rem(n) {
17632
- return new CSSUnitValue(n, 'rem');
17633
- },
17798
+ /**
17799
+ * Calculates the determinant of a mat4
17800
+ *
17801
+ * @param {mat4} a the source matrix
17802
+ * @returns {Number} determinant of a
17803
+ */
17804
+ function determinant(a) {
17805
+ var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
17806
+ a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
17807
+ a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],
17808
+ a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],
17809
+
17810
+ b00 = a00 * a11 - a01 * a10,
17811
+ b01 = a00 * a12 - a02 * a10,
17812
+ b02 = a00 * a13 - a03 * a10,
17813
+ b03 = a01 * a12 - a02 * a11,
17814
+ b04 = a01 * a13 - a03 * a11,
17815
+ b05 = a02 * a13 - a03 * a12,
17816
+ b06 = a20 * a31 - a21 * a30,
17817
+ b07 = a20 * a32 - a22 * a30,
17818
+ b08 = a20 * a33 - a23 * a30,
17819
+ b09 = a21 * a32 - a22 * a31,
17820
+ b10 = a21 * a33 - a23 * a31,
17821
+ b11 = a22 * a33 - a23 * a32;
17822
+
17823
+ // Calculate the determinant
17824
+ return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
17825
+ }
17826
+
17827
+ var invert_1 = invert$2;
17634
17828
 
17635
- /**
17636
- * <angle>
17637
- */
17638
- deg: function deg(n) {
17639
- return new CSSUnitValue(n, 'deg');
17640
- },
17829
+ /**
17830
+ * Inverts a mat4
17831
+ *
17832
+ * @param {mat4} out the receiving matrix
17833
+ * @param {mat4} a the source matrix
17834
+ * @returns {mat4} out
17835
+ */
17836
+ function invert$2(out, a) {
17837
+ var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
17838
+ a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
17839
+ a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],
17840
+ a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],
17841
+
17842
+ b00 = a00 * a11 - a01 * a10,
17843
+ b01 = a00 * a12 - a02 * a10,
17844
+ b02 = a00 * a13 - a03 * a10,
17845
+ b03 = a01 * a12 - a02 * a11,
17846
+ b04 = a01 * a13 - a03 * a11,
17847
+ b05 = a02 * a13 - a03 * a12,
17848
+ b06 = a20 * a31 - a21 * a30,
17849
+ b07 = a20 * a32 - a22 * a30,
17850
+ b08 = a20 * a33 - a23 * a30,
17851
+ b09 = a21 * a32 - a22 * a31,
17852
+ b10 = a21 * a33 - a23 * a31,
17853
+ b11 = a22 * a33 - a23 * a32,
17854
+
17855
+ // Calculate the determinant
17856
+ det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
17857
+
17858
+ if (!det) {
17859
+ return null;
17860
+ }
17861
+ det = 1.0 / det;
17862
+
17863
+ out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
17864
+ out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
17865
+ out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
17866
+ out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;
17867
+ out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
17868
+ out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
17869
+ out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
17870
+ out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;
17871
+ out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
17872
+ out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
17873
+ out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
17874
+ out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;
17875
+ out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;
17876
+ out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;
17877
+ out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;
17878
+ out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;
17641
17879
 
17642
- /**
17643
- * <angle>
17644
- */
17645
- grad: function grad(n) {
17646
- return new CSSUnitValue(n, 'grad');
17647
- },
17880
+ return out;
17881
+ }
17648
17882
 
17649
- /**
17650
- * <angle>
17651
- */
17652
- rad: function rad(n) {
17653
- return new CSSUnitValue(n, 'rad');
17654
- },
17883
+ var transpose_1 = transpose;
17655
17884
 
17656
- /**
17657
- * <angle>
17658
- */
17659
- turn: function turn(n) {
17660
- return new CSSUnitValue(n, 'turn');
17885
+ /**
17886
+ * Transpose the values of a mat4
17887
+ *
17888
+ * @param {mat4} out the receiving matrix
17889
+ * @param {mat4} a the source matrix
17890
+ * @returns {mat4} out
17891
+ */
17892
+ function transpose(out, a) {
17893
+ // If we are transposing ourselves we can skip a few steps but have to cache some values
17894
+ if (out === a) {
17895
+ var a01 = a[1], a02 = a[2], a03 = a[3],
17896
+ a12 = a[6], a13 = a[7],
17897
+ a23 = a[11];
17898
+
17899
+ out[1] = a[4];
17900
+ out[2] = a[8];
17901
+ out[3] = a[12];
17902
+ out[4] = a01;
17903
+ out[6] = a[9];
17904
+ out[7] = a[13];
17905
+ out[8] = a02;
17906
+ out[9] = a12;
17907
+ out[11] = a[14];
17908
+ out[12] = a03;
17909
+ out[13] = a13;
17910
+ out[14] = a23;
17911
+ } else {
17912
+ out[0] = a[0];
17913
+ out[1] = a[4];
17914
+ out[2] = a[8];
17915
+ out[3] = a[12];
17916
+ out[4] = a[1];
17917
+ out[5] = a[5];
17918
+ out[6] = a[9];
17919
+ out[7] = a[13];
17920
+ out[8] = a[2];
17921
+ out[9] = a[6];
17922
+ out[10] = a[10];
17923
+ out[11] = a[14];
17924
+ out[12] = a[3];
17925
+ out[13] = a[7];
17926
+ out[14] = a[11];
17927
+ out[15] = a[15];
17928
+ }
17929
+
17930
+ return out;
17931
+ }
17932
+
17933
+ var length_1 = length$1;
17934
+
17935
+ /**
17936
+ * Calculates the length of a vec3
17937
+ *
17938
+ * @param {vec3} a vector to calculate length of
17939
+ * @returns {Number} length of a
17940
+ */
17941
+ function length$1(a) {
17942
+ var x = a[0],
17943
+ y = a[1],
17944
+ z = a[2];
17945
+ return Math.sqrt(x*x + y*y + z*z)
17946
+ }
17947
+
17948
+ var normalize_1 = normalize$5;
17949
+
17950
+ /**
17951
+ * Normalize a vec3
17952
+ *
17953
+ * @param {vec3} out the receiving vector
17954
+ * @param {vec3} a vector to normalize
17955
+ * @returns {vec3} out
17956
+ */
17957
+ function normalize$5(out, a) {
17958
+ var x = a[0],
17959
+ y = a[1],
17960
+ z = a[2];
17961
+ var len = x*x + y*y + z*z;
17962
+ if (len > 0) {
17963
+ //TODO: evaluate use of glm_invsqrt here?
17964
+ len = 1 / Math.sqrt(len);
17965
+ out[0] = a[0] * len;
17966
+ out[1] = a[1] * len;
17967
+ out[2] = a[2] * len;
17968
+ }
17969
+ return out
17970
+ }
17971
+
17972
+ var dot_1 = dot$2;
17973
+
17974
+ /**
17975
+ * Calculates the dot product of two vec3's
17976
+ *
17977
+ * @param {vec3} a the first operand
17978
+ * @param {vec3} b the second operand
17979
+ * @returns {Number} dot product of a and b
17980
+ */
17981
+ function dot$2(a, b) {
17982
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]
17983
+ }
17984
+
17985
+ var cross_1 = cross$1;
17986
+
17987
+ /**
17988
+ * Computes the cross product of two vec3's
17989
+ *
17990
+ * @param {vec3} out the receiving vector
17991
+ * @param {vec3} a the first operand
17992
+ * @param {vec3} b the second operand
17993
+ * @returns {vec3} out
17994
+ */
17995
+ function cross$1(out, a, b) {
17996
+ var ax = a[0], ay = a[1], az = a[2],
17997
+ bx = b[0], by = b[1], bz = b[2];
17998
+
17999
+ out[0] = ay * bz - az * by;
18000
+ out[1] = az * bx - ax * bz;
18001
+ out[2] = ax * by - ay * bx;
18002
+ return out
18003
+ }
18004
+
18005
+ /*jshint unused:true*/
18006
+ /*
18007
+ Input: matrix ; a 4x4 matrix
18008
+ Output: translation ; a 3 component vector
18009
+ scale ; a 3 component vector
18010
+ skew ; skew factors XY,XZ,YZ represented as a 3 component vector
18011
+ perspective ; a 4 component vector
18012
+ quaternion ; a 4 component vector
18013
+ Returns false if the matrix cannot be decomposed, true if it can
18014
+
18015
+
18016
+ References:
18017
+ https://github.com/kamicane/matrix3d/blob/master/lib/Matrix3d.js
18018
+ https://github.com/ChromiumWebApps/chromium/blob/master/ui/gfx/transform_util.cc
18019
+ http://www.w3.org/TR/css3-transforms/#decomposing-a-3d-matrix
18020
+ */
18021
+
18022
+
18023
+
18024
+
18025
+
18026
+
18027
+
18028
+
18029
+ var vec3 = {
18030
+ length: length_1,
18031
+ normalize: normalize_1,
18032
+ dot: dot_1,
18033
+ cross: cross_1
18034
+ };
18035
+
18036
+ var tmp = create_1();
18037
+ var perspectiveMatrix = create_1();
18038
+ var tmpVec4 = [0, 0, 0, 0];
18039
+ var row = [ [0,0,0], [0,0,0], [0,0,0] ];
18040
+ var pdum3 = [0,0,0];
18041
+
18042
+ var mat4Decompose = function decomposeMat4(matrix, translation, scale, skew, perspective, quaternion) {
18043
+ if (!translation) translation = [0,0,0];
18044
+ if (!scale) scale = [0,0,0];
18045
+ if (!skew) skew = [0,0,0];
18046
+ if (!perspective) perspective = [0,0,0,1];
18047
+ if (!quaternion) quaternion = [0,0,0,1];
18048
+
18049
+ //normalize, if not possible then bail out early
18050
+ if (!normalize$4(tmp, matrix))
18051
+ return false
18052
+
18053
+ // perspectiveMatrix is used to solve for perspective, but it also provides
18054
+ // an easy way to test for singularity of the upper 3x3 component.
18055
+ clone_1(perspectiveMatrix);
18056
+
18057
+ perspectiveMatrix[3] = 0;
18058
+ perspectiveMatrix[7] = 0;
18059
+ perspectiveMatrix[11] = 0;
18060
+ perspectiveMatrix[15] = 1;
18061
+
18062
+ // If the perspectiveMatrix is not invertible, we are also unable to
18063
+ // decompose, so we'll bail early. Constant taken from SkMatrix44::invert.
18064
+ if (Math.abs(determinant_1(perspectiveMatrix) < 1e-8))
18065
+ return false
18066
+
18067
+ var a03 = tmp[3], a13 = tmp[7], a23 = tmp[11],
18068
+ a30 = tmp[12], a31 = tmp[13], a32 = tmp[14], a33 = tmp[15];
18069
+
18070
+ // First, isolate perspective.
18071
+ if (a03 !== 0 || a13 !== 0 || a23 !== 0) {
18072
+ tmpVec4[0] = a03;
18073
+ tmpVec4[1] = a13;
18074
+ tmpVec4[2] = a23;
18075
+ tmpVec4[3] = a33;
18076
+
18077
+ // Solve the equation by inverting perspectiveMatrix and multiplying
18078
+ // rightHandSide by the inverse.
18079
+ // resuing the perspectiveMatrix here since it's no longer needed
18080
+ var ret = invert_1(perspectiveMatrix, perspectiveMatrix);
18081
+ if (!ret) return false
18082
+ transpose_1(perspectiveMatrix, perspectiveMatrix);
18083
+
18084
+ //multiply by transposed inverse perspective matrix, into perspective vec4
18085
+ vec4multMat4(perspective, tmpVec4, perspectiveMatrix);
18086
+ } else {
18087
+ //no perspective
18088
+ perspective[0] = perspective[1] = perspective[2] = 0;
18089
+ perspective[3] = 1;
18090
+ }
18091
+
18092
+ // Next take care of translation
18093
+ translation[0] = a30;
18094
+ translation[1] = a31;
18095
+ translation[2] = a32;
18096
+
18097
+ // Now get scale and shear. 'row' is a 3 element array of 3 component vectors
18098
+ mat3from4(row, tmp);
18099
+
18100
+ // Compute X scale factor and normalize first row.
18101
+ scale[0] = vec3.length(row[0]);
18102
+ vec3.normalize(row[0], row[0]);
18103
+
18104
+ // Compute XY shear factor and make 2nd row orthogonal to 1st.
18105
+ skew[0] = vec3.dot(row[0], row[1]);
18106
+ combine(row[1], row[1], row[0], 1.0, -skew[0]);
18107
+
18108
+ // Now, compute Y scale and normalize 2nd row.
18109
+ scale[1] = vec3.length(row[1]);
18110
+ vec3.normalize(row[1], row[1]);
18111
+ skew[0] /= scale[1];
18112
+
18113
+ // Compute XZ and YZ shears, orthogonalize 3rd row
18114
+ skew[1] = vec3.dot(row[0], row[2]);
18115
+ combine(row[2], row[2], row[0], 1.0, -skew[1]);
18116
+ skew[2] = vec3.dot(row[1], row[2]);
18117
+ combine(row[2], row[2], row[1], 1.0, -skew[2]);
18118
+
18119
+ // Next, get Z scale and normalize 3rd row.
18120
+ scale[2] = vec3.length(row[2]);
18121
+ vec3.normalize(row[2], row[2]);
18122
+ skew[1] /= scale[2];
18123
+ skew[2] /= scale[2];
18124
+
18125
+
18126
+ // At this point, the matrix (in rows) is orthonormal.
18127
+ // Check for a coordinate system flip. If the determinant
18128
+ // is -1, then negate the matrix and the scaling factors.
18129
+ vec3.cross(pdum3, row[1], row[2]);
18130
+ if (vec3.dot(row[0], pdum3) < 0) {
18131
+ for (var i = 0; i < 3; i++) {
18132
+ scale[i] *= -1;
18133
+ row[i][0] *= -1;
18134
+ row[i][1] *= -1;
18135
+ row[i][2] *= -1;
18136
+ }
18137
+ }
18138
+
18139
+ // Now, get the rotations out
18140
+ quaternion[0] = 0.5 * Math.sqrt(Math.max(1 + row[0][0] - row[1][1] - row[2][2], 0));
18141
+ quaternion[1] = 0.5 * Math.sqrt(Math.max(1 - row[0][0] + row[1][1] - row[2][2], 0));
18142
+ quaternion[2] = 0.5 * Math.sqrt(Math.max(1 - row[0][0] - row[1][1] + row[2][2], 0));
18143
+ quaternion[3] = 0.5 * Math.sqrt(Math.max(1 + row[0][0] + row[1][1] + row[2][2], 0));
18144
+
18145
+ if (row[2][1] > row[1][2])
18146
+ quaternion[0] = -quaternion[0];
18147
+ if (row[0][2] > row[2][0])
18148
+ quaternion[1] = -quaternion[1];
18149
+ if (row[1][0] > row[0][1])
18150
+ quaternion[2] = -quaternion[2];
18151
+ return true
18152
+ };
18153
+
18154
+ //will be replaced by gl-vec4 eventually
18155
+ function vec4multMat4(out, a, m) {
18156
+ var x = a[0], y = a[1], z = a[2], w = a[3];
18157
+ out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;
18158
+ out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;
18159
+ out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;
18160
+ out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;
18161
+ return out;
18162
+ }
18163
+
18164
+ //gets upper-left of a 4x4 matrix into a 3x3 of vectors
18165
+ function mat3from4(out, mat4x4) {
18166
+ out[0][0] = mat4x4[0];
18167
+ out[0][1] = mat4x4[1];
18168
+ out[0][2] = mat4x4[2];
18169
+
18170
+ out[1][0] = mat4x4[4];
18171
+ out[1][1] = mat4x4[5];
18172
+ out[1][2] = mat4x4[6];
18173
+
18174
+ out[2][0] = mat4x4[8];
18175
+ out[2][1] = mat4x4[9];
18176
+ out[2][2] = mat4x4[10];
18177
+ }
18178
+
18179
+ function combine(out, a, b, scale1, scale2) {
18180
+ out[0] = a[0] * scale1 + b[0] * scale2;
18181
+ out[1] = a[1] * scale1 + b[1] * scale2;
18182
+ out[2] = a[2] * scale1 + b[2] * scale2;
18183
+ }
18184
+
18185
+ /**
18186
+ * holds useful CSS-related methods.
18187
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
18188
+ *
18189
+ * * CSS Typed OM @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/factory_functions
18190
+ * * register property @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
18191
+ * * CSS Layout API
18192
+ */
18193
+
18194
+ var CSS = {
18195
+ /**
18196
+ * <number>
18197
+ * @see https://drafts.csswg.org/css-values-4/#number-value
18198
+ */
18199
+ number: function number(n) {
18200
+ return new CSSUnitValue(n);
18201
+ },
18202
+
18203
+ /**
18204
+ * <percentage>
18205
+ * @see https://drafts.csswg.org/css-values-4/#percentage-value
18206
+ */
18207
+ percent: function percent(n) {
18208
+ return new CSSUnitValue(n, '%');
18209
+ },
18210
+
18211
+ /**
18212
+ * <length>
18213
+ */
18214
+ px: function px(n) {
18215
+ return new CSSUnitValue(n, 'px');
18216
+ },
18217
+
18218
+ /**
18219
+ * <length>
18220
+ */
18221
+ em: function em(n) {
18222
+ return new CSSUnitValue(n, 'em');
18223
+ },
18224
+ rem: function rem(n) {
18225
+ return new CSSUnitValue(n, 'rem');
18226
+ },
18227
+
18228
+ /**
18229
+ * <angle>
18230
+ */
18231
+ deg: function deg(n) {
18232
+ return new CSSUnitValue(n, 'deg');
18233
+ },
18234
+
18235
+ /**
18236
+ * <angle>
18237
+ */
18238
+ grad: function grad(n) {
18239
+ return new CSSUnitValue(n, 'grad');
18240
+ },
18241
+
18242
+ /**
18243
+ * <angle>
18244
+ */
18245
+ rad: function rad(n) {
18246
+ return new CSSUnitValue(n, 'rad');
18247
+ },
18248
+
18249
+ /**
18250
+ * <angle>
18251
+ */
18252
+ turn: function turn(n) {
18253
+ return new CSSUnitValue(n, 'turn');
17661
18254
  },
17662
18255
 
17663
18256
  /**
@@ -17728,22 +18321,23 @@
17728
18321
 
17729
18322
 
17730
18323
  var transformFunctions = {
17731
- // matrix: ['NNNNNN', [_, _, 0, 0, _, _, 0, 0, 0, 0, 1, 0, _, _, 0, 1], id],
17732
- // matrix3d: ['NNNNNNNNNNNNNNNN', id],
18324
+ // @ts-ignore
18325
+ matrix: ['NNNNNN', [_, _, 0, 0, _, _, 0, 0, 0, 0, 1, 0, _, _, 0, 1], id$1],
18326
+ matrix3d: ['NNNNNNNNNNNNNNNN', id$1],
17733
18327
  rotate: ['A'],
17734
18328
  rotatex: ['A'],
17735
18329
  rotatey: ['A'],
17736
18330
  rotatez: ['A'],
17737
18331
  rotate3d: ['NNNA'],
17738
- // perspective: ['L'],
18332
+ perspective: ['L'],
17739
18333
  scale: ['Nn', cast([_, _, CSS.number(1)]), id$1],
17740
18334
  scalex: ['N', cast([_, CSS.number(1), CSS.number(1)]), cast([_, CSS.number(1)])],
17741
18335
  scaley: ['N', cast([CSS.number(1), _, CSS.number(1)]), cast([CSS.number(1), _])],
17742
18336
  scalez: ['N', cast([CSS.number(1), CSS.number(1), _])],
17743
18337
  scale3d: ['NNN', id$1],
17744
- // skew: ['Aa', null, id],
17745
- // skewx: ['A', null, cast([_, Odeg])],
17746
- // skewy: ['A', null, cast([Odeg, _])],
18338
+ skew: ['Aa', null, id$1],
18339
+ skewx: ['A', null, cast([_, Odeg])],
18340
+ skewy: ['A', null, cast([Odeg, _])],
17747
18341
  translate: ['Tt', cast([_, _, Opx]), id$1],
17748
18342
  translatex: ['T', cast([_, Opx, Opx]), cast([_, Opx])],
17749
18343
  translatey: ['T', cast([Opx, _, Opx]), cast([Opx, _])],
@@ -17836,33 +18430,289 @@
17836
18430
  }
17837
18431
 
17838
18432
  return [];
17839
- } // function mergeMatrices(left: number[][], right: number[][]): [
17840
- // number[][], number[][], () => string,
17841
- // ] {
17842
- // if (left.decompositionPair !== right) {
17843
- // left.decompositionPair = right;
17844
- // var leftArgs = makeMatrixDecomposition(left);
17845
- // }
17846
- // if (right.decompositionPair !== left) {
17847
- // right.decompositionPair = left;
17848
- // var rightArgs = makeMatrixDecomposition(right);
17849
- // }
17850
- // if (leftArgs[0] === null || rightArgs[0] === null)
17851
- // return [[false], [true], (x) => { return x ? right[0].d : left[0].d; }];
17852
- // leftArgs[0].push(0);
17853
- // rightArgs[0].push(1);
17854
- // return [
17855
- // leftArgs,
17856
- // rightArgs,
17857
- // (list) => {
17858
- // const q = quat(leftArgs[0][3], rightArgs[0][3], list[5]);
17859
- // const mat = composeMatrix(list[0], list[1], list[2], q, list[4]);
17860
- // const stringifiedArgs = mat.map(numberToLongString).join(',');
17861
- // return stringifiedArgs;
17862
- // }
17863
- // ];
17864
- // }
17865
- // scalex/y/z -> scale
18433
+ }
18434
+ function convertItemToMatrix(item) {
18435
+ var x;
18436
+ var y;
18437
+ var z;
18438
+ var angle;
18439
+
18440
+ switch (item.t) {
18441
+ case 'rotatex':
18442
+ angle = deg2rad(convertAngleUnit(item.d[0]));
18443
+ return [1, 0, 0, 0, 0, Math.cos(angle), Math.sin(angle), 0, 0, -Math.sin(angle), Math.cos(angle), 0, 0, 0, 0, 1];
18444
+
18445
+ case 'rotatey':
18446
+ angle = deg2rad(convertAngleUnit(item.d[0]));
18447
+ return [Math.cos(angle), 0, -Math.sin(angle), 0, 0, 1, 0, 0, Math.sin(angle), 0, Math.cos(angle), 0, 0, 0, 0, 1];
18448
+
18449
+ case 'rotate':
18450
+ case 'rotatez':
18451
+ angle = deg2rad(convertAngleUnit(item.d[0]));
18452
+ return [Math.cos(angle), Math.sin(angle), 0, 0, -Math.sin(angle), Math.cos(angle), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
18453
+
18454
+ case 'rotate3d':
18455
+ x = item.d[0].value;
18456
+ y = item.d[1].value;
18457
+ z = item.d[2].value;
18458
+ angle = deg2rad(convertAngleUnit(item.d[3]));
18459
+ var sqrLength = x * x + y * y + z * z;
18460
+
18461
+ if (sqrLength === 0) {
18462
+ x = 1;
18463
+ y = 0;
18464
+ z = 0;
18465
+ } else if (sqrLength !== 1) {
18466
+ var length = Math.sqrt(sqrLength);
18467
+ x /= length;
18468
+ y /= length;
18469
+ z /= length;
18470
+ }
18471
+
18472
+ var s = Math.sin(angle / 2);
18473
+ var sc = s * Math.cos(angle / 2);
18474
+ var sq = s * s;
18475
+ return [1 - 2 * (y * y + z * z) * sq, 2 * (x * y * sq + z * sc), 2 * (x * z * sq - y * sc), 0, 2 * (x * y * sq - z * sc), 1 - 2 * (x * x + z * z) * sq, 2 * (y * z * sq + x * sc), 0, 2 * (x * z * sq + y * sc), 2 * (y * z * sq - x * sc), 1 - 2 * (x * x + y * y) * sq, 0, 0, 0, 0, 1];
18476
+
18477
+ case 'scale':
18478
+ return [item.d[0].value, 0, 0, 0, 0, item.d[1].value, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
18479
+
18480
+ case 'scalex':
18481
+ return [item.d[0].value, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
18482
+
18483
+ case 'scaley':
18484
+ return [1, 0, 0, 0, 0, item.d[0].value, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
18485
+
18486
+ case 'scalez':
18487
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, item.d[0].value, 0, 0, 0, 0, 1];
18488
+
18489
+ case 'scale3d':
18490
+ return [item.d[0].value, 0, 0, 0, 0, item.d[1].value, 0, 0, 0, 0, item.d[2].value, 0, 0, 0, 0, 1];
18491
+
18492
+ case 'skew':
18493
+ var xAngle = deg2rad(convertAngleUnit(item.d[0]));
18494
+ var yAngle = deg2rad(convertAngleUnit(item.d[1]));
18495
+ return [1, Math.tan(yAngle), 0, 0, Math.tan(xAngle), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
18496
+
18497
+ case 'skewx':
18498
+ angle = deg2rad(convertAngleUnit(item.d[0]));
18499
+ return [1, 0, 0, 0, Math.tan(angle), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
18500
+
18501
+ case 'skewy':
18502
+ angle = deg2rad(convertAngleUnit(item.d[0]));
18503
+ return [1, Math.tan(angle), 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
18504
+
18505
+ case 'translate':
18506
+ // TODO: pass target
18507
+ x = convertPercentUnit(item.d[0], 0, null) || 0;
18508
+ y = convertPercentUnit(item.d[1], 0, null) || 0;
18509
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, 0, 1];
18510
+
18511
+ case 'translatex':
18512
+ x = convertPercentUnit(item.d[0], 0, null) || 0;
18513
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, 0, 0, 1];
18514
+
18515
+ case 'translatey':
18516
+ y = convertPercentUnit(item.d[0], 0, null) || 0;
18517
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, y, 0, 1];
18518
+
18519
+ case 'translatez':
18520
+ z = convertPercentUnit(item.d[0], 0, null) || 0;
18521
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, z, 1];
18522
+
18523
+ case 'translate3d':
18524
+ x = convertPercentUnit(item.d[0], 0, null) || 0;
18525
+ y = convertPercentUnit(item.d[1], 0, null) || 0;
18526
+ z = convertPercentUnit(item.d[2], 0, null) || 0;
18527
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1];
18528
+
18529
+ case 'perspective':
18530
+ var t = convertPercentUnit(item.d[0], 0, null) || 0;
18531
+ var p = t ? -1 / t : 0;
18532
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, p, 0, 0, 0, 1];
18533
+
18534
+ case 'matrix':
18535
+ return [item.d[0].value, item.d[1].value, 0, 0, item.d[2].value, item.d[3].value, 0, 0, 0, 0, 1, 0, item.d[4].value, item.d[5].value, 0, 1];
18536
+
18537
+ case 'matrix3d':
18538
+ return item.d.map(function (d) {
18539
+ return d.value;
18540
+ });
18541
+ }
18542
+ }
18543
+
18544
+ function multiplyMatrices(a, b) {
18545
+ return [a[0] * b[0] + a[4] * b[1] + a[8] * b[2] + a[12] * b[3], a[1] * b[0] + a[5] * b[1] + a[9] * b[2] + a[13] * b[3], a[2] * b[0] + a[6] * b[1] + a[10] * b[2] + a[14] * b[3], a[3] * b[0] + a[7] * b[1] + a[11] * b[2] + a[15] * b[3], a[0] * b[4] + a[4] * b[5] + a[8] * b[6] + a[12] * b[7], a[1] * b[4] + a[5] * b[5] + a[9] * b[6] + a[13] * b[7], a[2] * b[4] + a[6] * b[5] + a[10] * b[6] + a[14] * b[7], a[3] * b[4] + a[7] * b[5] + a[11] * b[6] + a[15] * b[7], a[0] * b[8] + a[4] * b[9] + a[8] * b[10] + a[12] * b[11], a[1] * b[8] + a[5] * b[9] + a[9] * b[10] + a[13] * b[11], a[2] * b[8] + a[6] * b[9] + a[10] * b[10] + a[14] * b[11], a[3] * b[8] + a[7] * b[9] + a[11] * b[10] + a[15] * b[11], a[0] * b[12] + a[4] * b[13] + a[8] * b[14] + a[12] * b[15], a[1] * b[12] + a[5] * b[13] + a[9] * b[14] + a[13] * b[15], a[2] * b[12] + a[6] * b[13] + a[10] * b[14] + a[14] * b[15], a[3] * b[12] + a[7] * b[13] + a[11] * b[14] + a[15] * b[15]];
18546
+ }
18547
+
18548
+ function convertToMatrix(transformList) {
18549
+ if (transformList.length === 0) {
18550
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
18551
+ }
18552
+
18553
+ return transformList.map(convertItemToMatrix).reduce(multiplyMatrices);
18554
+ }
18555
+
18556
+ function makeMatrixDecomposition(transformList) {
18557
+ var translate = [0, 0, 0];
18558
+ var scale = [0, 0, 0];
18559
+ var skew = [0, 0, 0];
18560
+ var perspective = [0, 0, 0, 1];
18561
+ var quaternion = [0, 0, 0, 1];
18562
+ mat4Decompose(convertToMatrix(transformList), translate, scale, skew, perspective, quaternion);
18563
+ return [translate, scale, skew, quaternion, perspective];
18564
+ }
18565
+
18566
+ var composeMatrix = function () {
18567
+ function multiply(a, b) {
18568
+ var result = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
18569
+
18570
+ for (var i = 0; i < 4; i++) {
18571
+ for (var j = 0; j < 4; j++) {
18572
+ for (var k = 0; k < 4; k++) {
18573
+ result[i][j] += b[i][k] * a[k][j];
18574
+ }
18575
+ }
18576
+ }
18577
+
18578
+ return result;
18579
+ }
18580
+
18581
+ function is2D(m) {
18582
+ return m[0][2] == 0 && m[0][3] == 0 && m[1][2] == 0 && m[1][3] == 0 && m[2][0] == 0 && m[2][1] == 0 && m[2][2] == 1 && m[2][3] == 0 && m[3][2] == 0 && m[3][3] == 1;
18583
+ }
18584
+
18585
+ function composeMatrix(translate, scale, skew, quat, perspective) {
18586
+ var matrix = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]];
18587
+
18588
+ for (var i = 0; i < 4; i++) {
18589
+ matrix[i][3] = perspective[i];
18590
+ }
18591
+
18592
+ for (var _i = 0; _i < 3; _i++) {
18593
+ for (var j = 0; j < 3; j++) {
18594
+ matrix[3][_i] += translate[j] * matrix[j][_i];
18595
+ }
18596
+ }
18597
+
18598
+ var x = quat[0],
18599
+ y = quat[1],
18600
+ z = quat[2],
18601
+ w = quat[3];
18602
+ var rotMatrix = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]];
18603
+ rotMatrix[0][0] = 1 - 2 * (y * y + z * z);
18604
+ rotMatrix[0][1] = 2 * (x * y - z * w);
18605
+ rotMatrix[0][2] = 2 * (x * z + y * w);
18606
+ rotMatrix[1][0] = 2 * (x * y + z * w);
18607
+ rotMatrix[1][1] = 1 - 2 * (x * x + z * z);
18608
+ rotMatrix[1][2] = 2 * (y * z - x * w);
18609
+ rotMatrix[2][0] = 2 * (x * z - y * w);
18610
+ rotMatrix[2][1] = 2 * (y * z + x * w);
18611
+ rotMatrix[2][2] = 1 - 2 * (x * x + y * y);
18612
+ matrix = multiply(matrix, rotMatrix);
18613
+ var temp = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]];
18614
+
18615
+ if (skew[2]) {
18616
+ temp[2][1] = skew[2];
18617
+ matrix = multiply(matrix, temp);
18618
+ }
18619
+
18620
+ if (skew[1]) {
18621
+ temp[2][1] = 0;
18622
+ temp[2][0] = skew[0];
18623
+ matrix = multiply(matrix, temp);
18624
+ }
18625
+
18626
+ if (skew[0]) {
18627
+ temp[2][0] = 0;
18628
+ temp[1][0] = skew[0];
18629
+ matrix = multiply(matrix, temp);
18630
+ }
18631
+
18632
+ for (var _i2 = 0; _i2 < 3; _i2++) {
18633
+ for (var _j = 0; _j < 3; _j++) {
18634
+ matrix[_i2][_j] *= scale[_i2];
18635
+ }
18636
+ }
18637
+
18638
+ if (is2D(matrix)) {
18639
+ return [matrix[0][0], matrix[0][1], matrix[1][0], matrix[1][1], matrix[3][0], matrix[3][1]];
18640
+ }
18641
+
18642
+ return matrix[0].concat(matrix[1], matrix[2], matrix[3]);
18643
+ }
18644
+
18645
+ return composeMatrix;
18646
+ }();
18647
+
18648
+ function numberToLongString(x) {
18649
+ return x.toFixed(6).replace('.000000', '');
18650
+ }
18651
+
18652
+ function mergeMatrices(left, right) {
18653
+ var leftArgs;
18654
+ var rightArgs; // @ts-ignore
18655
+
18656
+ if (left.decompositionPair !== right) {
18657
+ // @ts-ignore
18658
+ left.decompositionPair = right;
18659
+ leftArgs = makeMatrixDecomposition(left);
18660
+ } // @ts-ignore
18661
+
18662
+
18663
+ if (right.decompositionPair !== left) {
18664
+ // @ts-ignore
18665
+ right.decompositionPair = left;
18666
+ rightArgs = makeMatrixDecomposition(right);
18667
+ }
18668
+
18669
+ if (leftArgs[0] === null || rightArgs[0] === null) return [// @ts-ignore
18670
+ [false], // @ts-ignore
18671
+ [true], // @ts-ignore
18672
+ function (x) {
18673
+ return x ? right[0].d : left[0].d;
18674
+ }];
18675
+ leftArgs[0].push(0);
18676
+ rightArgs[0].push(1);
18677
+ return [leftArgs, rightArgs, // @ts-ignore
18678
+ function (list) {
18679
+ // @ts-ignore
18680
+ var q = quat(leftArgs[0][3], rightArgs[0][3], list[5]);
18681
+ var mat = composeMatrix(list[0], list[1], list[2], q, list[4]);
18682
+ var stringifiedArgs = mat.map(numberToLongString).join(',');
18683
+ return stringifiedArgs;
18684
+ }];
18685
+ }
18686
+
18687
+ function dot$3(v1, v2) {
18688
+ var result = 0;
18689
+
18690
+ for (var i = 0; i < v1.length; i++) {
18691
+ result += v1[i] * v2[i];
18692
+ }
18693
+
18694
+ return result;
18695
+ }
18696
+
18697
+ function quat(fromQ, toQ, f) {
18698
+ var product = dot$3(fromQ, toQ);
18699
+ product = clamp(product, -1.0, 1.0);
18700
+ var quat = [];
18701
+
18702
+ if (product === 1.0) {
18703
+ quat = fromQ;
18704
+ } else {
18705
+ var theta = Math.acos(product);
18706
+ var w = Math.sin(f * theta) * 1 / Math.sqrt(1 - product * product);
18707
+
18708
+ for (var i = 0; i < 4; i++) {
18709
+ quat.push(fromQ[i] * (Math.cos(f * theta) - product * w) + toQ[i] * w);
18710
+ }
18711
+ }
18712
+
18713
+ return quat;
18714
+ } // scalex/y/z -> scale
18715
+
17866
18716
 
17867
18717
  function typeTo2D(type) {
17868
18718
  return type.replace(/[xy]/, '');
@@ -17892,7 +18742,7 @@
17892
18742
  type = _left$i.t,
17893
18743
  args = _left$i.d; // none -> scale(1)/translateX(0)
17894
18744
 
17895
- var defaultValue = type.substr(0, 5) === 'scale' ? 1 : 0;
18745
+ var defaultValue = type.substring(0, 5) === 'scale' ? 1 : 0;
17896
18746
  right.push({
17897
18747
  t: type,
17898
18748
  d: args.map(function (arg) {
@@ -17917,21 +18767,31 @@
17917
18767
  var rightResult = [];
17918
18768
  var types = []; // merge matrix() with matrix3d()
17919
18769
 
17920
- if (left.length !== right.length) ; else {
17921
- for (var _i = 0; _i < left.length; _i++) {
17922
- var leftType = left[_i].t;
17923
- var rightType = right[_i].t;
17924
- var leftArgs = left[_i].d;
17925
- var rightArgs = right[_i].d;
18770
+ if (left.length !== right.length) {
18771
+ var merged = mergeMatrices(left, right); // @ts-ignore
18772
+
18773
+ leftResult = [merged[0]]; // @ts-ignore
18774
+
18775
+ rightResult = [merged[1]];
18776
+ types = [['matrix', [merged[2]]]];
18777
+ } else {
18778
+ for (var _i3 = 0; _i3 < left.length; _i3++) {
18779
+ var leftType = left[_i3].t;
18780
+ var rightType = right[_i3].t;
18781
+ var leftArgs = left[_i3].d;
18782
+ var rightArgs = right[_i3].d;
17926
18783
  var leftFunctionData = transformFunctions[leftType];
17927
18784
  var rightFunctionData = transformFunctions[rightType];
17928
18785
  var type = void 0;
17929
18786
 
17930
18787
  if (isMatrixOrPerspective(leftType, rightType)) {
17931
- // const merged = mergeMatrices([left[i]], [right[i]]);
17932
- // leftResult.push(merged[0]);
17933
- // rightResult.push(merged[1]);
17934
- // types.push(['matrix', [merged[2]]]);
18788
+ var _merged = mergeMatrices([left[_i3]], [right[_i3]]); // @ts-ignore
18789
+
18790
+
18791
+ leftResult.push(_merged[0]); // @ts-ignore
18792
+
18793
+ rightResult.push(_merged[1]);
18794
+ types.push(['matrix', [_merged[2]]]);
17935
18795
  continue;
17936
18796
  } else if (leftType === rightType) {
17937
18797
  type = leftType;
@@ -17948,10 +18808,13 @@
17948
18808
 
17949
18809
  rightArgs = rightFunctionData[1](rightArgs);
17950
18810
  } else {
17951
- // const merged = mergeMatrices(left, right);
17952
- // leftResult = [merged[0]];
17953
- // rightResult = [merged[1]];
17954
- // types = [['matrix', [merged[2]]]];
18811
+ var _merged2 = mergeMatrices(left, right); // @ts-ignore
18812
+
18813
+
18814
+ leftResult = [_merged2[0]]; // @ts-ignore
18815
+
18816
+ rightResult = [_merged2[1]];
18817
+ types = [['matrix', [_merged2[2]]]];
17955
18818
  break;
17956
18819
  }
17957
18820
 
@@ -17962,10 +18825,11 @@
17962
18825
  for (var j = 0; j < leftArgs.length; j++) {
17963
18826
  var merge = leftArgs[j].unit === exports.UnitType.kNumber ? mergeNumbers : mergeDimensions; // @ts-ignore
17964
18827
 
17965
- var merged = merge(leftArgs[j], rightArgs[j], target, false, j);
17966
- leftArgsCopy[j] = merged[0];
17967
- rightArgsCopy[j] = merged[1];
17968
- stringConversions.push(merged[2]);
18828
+ var _merged3 = merge(leftArgs[j], rightArgs[j], target, false, j);
18829
+
18830
+ leftArgsCopy[j] = _merged3[0];
18831
+ rightArgsCopy[j] = _merged3[1];
18832
+ stringConversions.push(_merged3[2]);
17969
18833
  }
17970
18834
 
17971
18835
  leftResult.push(leftArgsCopy);
@@ -18106,8 +18970,8 @@
18106
18970
  */
18107
18971
 
18108
18972
  ElementEvent["UNMOUNTED"] = "DOMNodeRemovedFromDocument";
18109
- ElementEvent["BOUNDS_CHANGED"] = "bounds-changed";
18110
- ElementEvent["GEOMETRY_BOUNDS_CHANGED"] = "geometry-bounds-changed";
18973
+ ElementEvent["BOUNDS_CHANGED"] = "bounds-changed"; // GEOMETRY_BOUNDS_CHANGED = 'geometry-bounds-changed',
18974
+
18111
18975
  /**
18112
18976
  * trigger when z-index changed
18113
18977
  */
@@ -18869,6 +19733,7 @@
18869
19733
  this.localRotation = fromValues$3(0, 0, 0, 1);
18870
19734
  this.localScale = fromValues$1(1, 1, 1);
18871
19735
  this.localTransform = create$1();
19736
+ this.localSkew = fromValues$4(0, 0);
18872
19737
  this.position = fromValues$1(0, 0, 0);
18873
19738
  this.rotation = fromValues$3(0, 0, 0, 1);
18874
19739
  this.scaling = fromValues$1(1, 1, 1);
@@ -20321,7 +21186,8 @@
20321
21186
  fontVariant: '',
20322
21187
  textAlign: '',
20323
21188
  textBaseline: '',
20324
- textTransform: ''
21189
+ textTransform: '',
21190
+ zIndex: ''
20325
21191
  };
20326
21192
  /**
20327
21193
  * prototype chains: DisplayObject -> Element -> Node -> EventTarget
@@ -20353,7 +21219,7 @@
20353
21219
  * push to active animations after calling `animate()`
20354
21220
  */
20355
21221
  function DisplayObject(config) {
20356
- var _this$config$capture, _this$config$zIndex, _this$config$interact;
21222
+ var _this$config$capture;
20357
21223
 
20358
21224
  var _this;
20359
21225
 
@@ -20364,6 +21230,7 @@
20364
21230
  _this.styleValueRegistry = GlobalContainer$1.get(StyleValueRegistry);
20365
21231
  _this.isCustomElement = false;
20366
21232
  _this.activeAnimations = [];
21233
+ _this.mutationEvent = new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, _assertThisInitialized(_this), null, null, null, MutationEvent.MODIFICATION, null, null);
20367
21234
  _this.config = config; // compatible with G 3.0
20368
21235
 
20369
21236
  _this.config.interactive = (_this$config$capture = _this.config.capture) !== null && _this$config$capture !== void 0 ? _this$config$capture : _this.config.interactive; // init scene graph node
@@ -20377,10 +21244,7 @@
20377
21244
 
20378
21245
  _this.nodeName = _this.config.type || exports.Shape.GROUP; // compatible with G 3.0
20379
21246
 
20380
- _this.config.style = _extends({}, DEFAULT_STYLE_PROPS, {
20381
- zIndex: (_this$config$zIndex = _this.config.zIndex) !== null && _this$config$zIndex !== void 0 ? _this$config$zIndex : 0,
20382
- interactive: (_this$config$interact = _this.config.interactive) !== null && _this$config$interact !== void 0 ? _this$config$interact : true
20383
- }, _this.config.style, _this.config.attrs);
21247
+ _this.config.style = _extends({}, DEFAULT_STYLE_PROPS, _this.config.style, _this.config.attrs);
20384
21248
 
20385
21249
  if (_this.config.visible != null) {
20386
21250
  _this.config.style.visibility = _this.config.visible === false ? 'hidden' : 'visible';
@@ -20511,9 +21375,10 @@
20511
21375
  var oldParsedValue = this.parsedStyle[name];
20512
21376
  this.styleValueRegistry.processProperties(this, (_this$styleValueRegis = {}, _this$styleValueRegis[name] = value, _this$styleValueRegis), parseOptions); // inform clip path targets
20513
21377
 
20514
- if (this.attributes.clipPathTargets && this.attributes.clipPathTargets.length) {
20515
- this.attributes.clipPathTargets.forEach(function (target) {
20516
- dirtifyToRoot(target);
21378
+ if (this.parsedStyle.clipPathTargets && this.parsedStyle.clipPathTargets.length) {
21379
+ this.parsedStyle.clipPathTargets.forEach(function (target) {
21380
+ _this2.sceneGraphService.dirtifyToRoot(target);
21381
+
20517
21382
  target.dispatchEvent(new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, target, _this2, _this2, 'clipPath', MutationEvent.MODIFICATION, _this2, _this2));
20518
21383
 
20519
21384
  if (target.isCustomElement && target.isConnected) {
@@ -20525,8 +21390,15 @@
20525
21390
  } // redraw at next frame
20526
21391
 
20527
21392
 
20528
- renderable.dirty = true;
20529
- this.dispatchEvent(new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, this, oldValue, value, name, MutationEvent.MODIFICATION, oldParsedValue, this.parsedStyle[name]));
21393
+ renderable.dirty = true; // trigger later
21394
+ // this.sceneGraphService.pendingEvents.push([ElementEvent.ATTR_MODIFIED, { affectChildren }]);
21395
+
21396
+ this.mutationEvent.prevValue = oldValue;
21397
+ this.mutationEvent.newValue = value;
21398
+ this.mutationEvent.attrName = name;
21399
+ this.mutationEvent.prevParsedValue = oldParsedValue;
21400
+ this.mutationEvent.newParsedValue = this.parsedStyle[name];
21401
+ this.dispatchEvent(this.mutationEvent);
20530
21402
 
20531
21403
  if (this.isCustomElement && this.isConnected) {
20532
21404
  if (this.attributeChangedCallback) {
@@ -20782,6 +21654,11 @@
20782
21654
  return this;
20783
21655
  };
20784
21656
 
21657
+ _proto.setLocalSkew = function setLocalSkew(skew, y) {
21658
+ this.sceneGraphService.setLocalSkew(this, skew, y);
21659
+ return this;
21660
+ };
21661
+
20785
21662
  _proto.getRotation = function getRotation() {
20786
21663
  return this.sceneGraphService.getRotation(this);
20787
21664
  };
@@ -20790,6 +21667,10 @@
20790
21667
  return this.sceneGraphService.getLocalRotation(this);
20791
21668
  };
20792
21669
 
21670
+ _proto.getLocalSkew = function getLocalSkew() {
21671
+ return this.sceneGraphService.getLocalSkew(this);
21672
+ };
21673
+
20793
21674
  _proto.getLocalTransform = function getLocalTransform() {
20794
21675
  return this.sceneGraphService.getLocalTransform(this);
20795
21676
  };
@@ -20828,10 +21709,10 @@
20828
21709
 
20829
21710
  var timeline = (_this$ownerDocument = this.ownerDocument) === null || _this$ownerDocument === void 0 ? void 0 : _this$ownerDocument.timeline; // account for clip path, use target's timeline
20830
21711
 
20831
- if (this.attributes.clipPathTargets && this.attributes.clipPathTargets.length) {
21712
+ if (this.parsedStyle.clipPathTargets && this.parsedStyle.clipPathTargets.length) {
20832
21713
  var _target$ownerDocument;
20833
21714
 
20834
- var target = this.attributes.clipPathTargets[0];
21715
+ var target = this.parsedStyle.clipPathTargets[0];
20835
21716
  timeline = (_target$ownerDocument = target.ownerDocument) === null || _target$ownerDocument === void 0 ? void 0 : _target$ownerDocument.timeline;
20836
21717
  } // clear old parsed transform
20837
21718
 
@@ -21237,9 +22118,7 @@
21237
22118
  style: _extends({
21238
22119
  cx: '',
21239
22120
  cy: '',
21240
- r: '',
21241
- anchor: '0.5 0.5',
21242
- transformOrigin: 'center'
22121
+ r: ''
21243
22122
  }, style)
21244
22123
  }, rest)) || this;
21245
22124
  }
@@ -21262,9 +22141,7 @@
21262
22141
  cx: '',
21263
22142
  cy: '',
21264
22143
  rx: '',
21265
- ry: '',
21266
- anchor: '0.5 0.5',
21267
- transformOrigin: 'center'
22144
+ ry: ''
21268
22145
  }, style)
21269
22146
  }, rest)) || this;
21270
22147
  }
@@ -21361,9 +22238,17 @@
21361
22238
  x1 = _this$parsedStyle.x1,
21362
22239
  y1 = _this$parsedStyle.y1,
21363
22240
  x2 = _this$parsedStyle.x2,
21364
- y2 = _this$parsedStyle.y2;
21365
- var point = line.pointAt(x1.value, y1.value, x2.value, y2.value, ratio);
21366
- return new Point(point.x, point.y);
22241
+ y2 = _this$parsedStyle.y2,
22242
+ defX = _this$parsedStyle.defX,
22243
+ defY = _this$parsedStyle.defY;
22244
+
22245
+ var _LineUtil$pointAt = line.pointAt(x1.value, y1.value, x2.value, y2.value, ratio),
22246
+ x = _LineUtil$pointAt.x,
22247
+ y = _LineUtil$pointAt.y;
22248
+
22249
+ var transformed = transformMat4(create$2(), fromValues$1(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
22250
+
22251
+ return new Point(transformed[0], transformed[1]);
21367
22252
  };
21368
22253
 
21369
22254
  _proto.getTotalLength = function getTotalLength() {
@@ -21408,7 +22293,10 @@
21408
22293
  ;
21409
22294
 
21410
22295
  _proto.getPoint = function getPoint(ratio) {
21411
- var _this$parsedStyle$pat = this.parsedStyle.path,
22296
+ var _this$parsedStyle = this.parsedStyle,
22297
+ defX = _this$parsedStyle.defX,
22298
+ defY = _this$parsedStyle.defY,
22299
+ _this$parsedStyle$pat = _this$parsedStyle.path,
21412
22300
  totalLength = _this$parsedStyle$pat.totalLength,
21413
22301
  absolutePath = _this$parsedStyle$pat.absolutePath;
21414
22302
 
@@ -21416,7 +22304,9 @@
21416
22304
  x = _getPointAtLength.x,
21417
22305
  y = _getPointAtLength.y;
21418
22306
 
21419
- return new Point(x, y);
22307
+ var transformed = transformMat4(create$2(), fromValues$1(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
22308
+
22309
+ return new Point(transformed[0], transformed[1]);
21420
22310
  }
21421
22311
  /**
21422
22312
  * Get start tangent vector
@@ -21521,7 +22411,10 @@
21521
22411
  };
21522
22412
 
21523
22413
  _proto.getPoint = function getPoint(ratio) {
21524
- var _this$parsedStyle$poi = this.parsedStyle.points,
22414
+ var _this$parsedStyle = this.parsedStyle,
22415
+ defX = _this$parsedStyle.defX,
22416
+ defY = _this$parsedStyle.defY,
22417
+ _this$parsedStyle$poi = _this$parsedStyle.points,
21525
22418
  points = _this$parsedStyle$poi.points,
21526
22419
  segments = _this$parsedStyle$poi.segments;
21527
22420
  var subt = 0;
@@ -21537,7 +22430,9 @@
21537
22430
  x = _LineUtil$pointAt.x,
21538
22431
  y = _LineUtil$pointAt.y;
21539
22432
 
21540
- return new Point(x, y);
22433
+ var transformed = transformMat4(create$2(), fromValues$1(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
22434
+
22435
+ return new Point(transformed[0], transformed[1]);
21541
22436
  };
21542
22437
 
21543
22438
  _proto.getStartTangent = function getStartTangent() {
@@ -23194,7 +24089,7 @@
23194
24089
  if (query.startsWith('.')) {
23195
24090
  return root.find(function (node) {
23196
24091
  // return !node.shadow && node.id === query.substring(1);
23197
- return node.className === _this.getIdOrClassname(query);
24092
+ return ((node === null || node === void 0 ? void 0 : node.classList) || []).indexOf(_this.getIdOrClassname(query)) > -1;
23198
24093
  });
23199
24094
  } else if (query.startsWith('#')) {
23200
24095
  // getElementById('id')
@@ -23231,7 +24126,7 @@
23231
24126
  // getElementsByClassName('className');
23232
24127
  // should not include itself
23233
24128
  return root.findAll(function (node) {
23234
- return root !== node && node.className === _this2.getIdOrClassname(query);
24129
+ return root !== node && ((node === null || node === void 0 ? void 0 : node.classList) || []).indexOf(_this2.getIdOrClassname(query)) > -1;
23235
24130
  });
23236
24131
  } else if (query.startsWith('#')) {
23237
24132
  return root.findAll(function (node) {
@@ -23337,29 +24232,6 @@
23337
24232
 
23338
24233
  return zIndex1 - zIndex2;
23339
24234
  }
23340
- function dirtifyToRoot(element, affectChildren) {
23341
- if (affectChildren === void 0) {
23342
- affectChildren = false;
23343
- }
23344
-
23345
- var p = element;
23346
-
23347
- while (p) {
23348
- var renderable = p.renderable;
23349
-
23350
- if (renderable) {
23351
- renderable.renderBoundsDirty = true;
23352
- renderable.boundsDirty = true;
23353
- renderable.dirty = true;
23354
- }
23355
-
23356
- p = p.parentNode;
23357
- }
23358
-
23359
- element.dispatchEvent(new CustomEvent(exports.ElementEvent.BOUNDS_CHANGED, {
23360
- affectChildren: affectChildren
23361
- }));
23362
- }
23363
24235
  var SceneGraphService = exports.Syringe.defineToken('SceneGraphService');
23364
24236
  /**
23365
24237
  * update transform in scene graph
@@ -23372,6 +24244,8 @@
23372
24244
  var _this = this;
23373
24245
 
23374
24246
  this.sceneGraphSelectorFactory = void 0;
24247
+ this.pendingEvents = [];
24248
+ this.boundsChangedEvent = new CustomEvent(exports.ElementEvent.BOUNDS_CHANGED);
23375
24249
 
23376
24250
  this.rotate = function () {
23377
24251
  var parentInvertRotation = create$4();
@@ -23779,6 +24653,16 @@
23779
24653
  this.dirtifyLocal(element, transform);
23780
24654
  };
23781
24655
 
24656
+ _proto.setLocalSkew = function setLocalSkew(element, skew, y) {
24657
+ if (typeof skew === 'number') {
24658
+ skew = fromValues$4(skew, y);
24659
+ }
24660
+
24661
+ var transform = element.transformable;
24662
+ copy$4(transform.localSkew, skew);
24663
+ this.dirtifyLocal(element, transform);
24664
+ };
24665
+
23782
24666
  _proto.dirtifyLocal = function dirtifyLocal(element, transform) {
23783
24667
  if (!transform.localDirtyFlag) {
23784
24668
  transform.localDirtyFlag = true;
@@ -23795,7 +24679,60 @@
23795
24679
  }
23796
24680
 
23797
24681
  this.dirtifyWorldInternal(element, transform);
23798
- dirtifyToRoot(element, true);
24682
+ this.dirtifyToRoot(element, true);
24683
+ };
24684
+
24685
+ _proto.triggerPendingEvents = function triggerPendingEvents() {
24686
+ var _this2 = this;
24687
+
24688
+ var set = new Set();
24689
+
24690
+ var trigger = function trigger(element, detail) {
24691
+ if (!set.has(element.entity)) {
24692
+ _this2.boundsChangedEvent.detail = detail;
24693
+ element.dispatchEvent(_this2.boundsChangedEvent);
24694
+ set.add(element.entity);
24695
+ }
24696
+ };
24697
+
24698
+ this.pendingEvents.forEach(function (_ref) {
24699
+ var element = _ref[0],
24700
+ detail = _ref[1];
24701
+
24702
+ if (detail.affectChildren) {
24703
+ element.forEach(function (e) {
24704
+ trigger(e, detail);
24705
+ });
24706
+ } else {
24707
+ trigger(element, detail);
24708
+ }
24709
+ });
24710
+ this.pendingEvents = [];
24711
+ };
24712
+
24713
+ _proto.dirtifyToRoot = function dirtifyToRoot(element, affectChildren) {
24714
+ if (affectChildren === void 0) {
24715
+ affectChildren = false;
24716
+ }
24717
+
24718
+ var p = element;
24719
+
24720
+ while (p) {
24721
+ var renderable = p.renderable;
24722
+
24723
+ if (renderable) {
24724
+ renderable.renderBoundsDirty = true;
24725
+ renderable.boundsDirty = true;
24726
+ renderable.dirty = true;
24727
+ }
24728
+
24729
+ p = p.parentNode;
24730
+ } // reuse the same custom event
24731
+
24732
+
24733
+ this.pendingEvents.push([element, {
24734
+ affectChildren: affectChildren
24735
+ }]);
23799
24736
  };
23800
24737
 
23801
24738
  _proto.getPosition = function getPosition(element) {
@@ -23842,11 +24779,37 @@
23842
24779
  return element.transformable.localScale;
23843
24780
  };
23844
24781
 
24782
+ _proto.getLocalSkew = function getLocalSkew(element) {
24783
+ return element.transformable.localSkew;
24784
+ };
24785
+
24786
+ _proto.calcLocalTransform = function calcLocalTransform(transform) {
24787
+ // @see https://github.com/mattdesl/css-mat4/blob/master/index.js
24788
+ // mat4.fromRotationTranslationScaleOrigin(
24789
+ // transform.localTransform,
24790
+ // transform.localRotation,
24791
+ // transform.localPosition,
24792
+ // transform.localScale,
24793
+ // transform.origin,
24794
+ // );
24795
+ fromRotationTranslationScaleOrigin(transform.localTransform, transform.localRotation, transform.localPosition, fromValues$1(1, 1, 1), transform.origin); // apply skew2D
24796
+
24797
+ if (transform.localSkew[0] !== 0 || transform.localSkew[1] !== 0) {
24798
+ var tmpMat4 = identity(create$1());
24799
+ tmpMat4[4] = Math.tan(transform.localSkew[0]);
24800
+ tmpMat4[1] = Math.tan(transform.localSkew[1]);
24801
+ multiply(transform.localTransform, transform.localTransform, tmpMat4);
24802
+ }
24803
+
24804
+ var scaling = fromRotationTranslationScaleOrigin(create$1(), fromValues$3(0, 0, 0, 1), create$2(), transform.localScale, transform.origin);
24805
+ multiply(transform.localTransform, transform.localTransform, scaling);
24806
+ };
24807
+
23845
24808
  _proto.getLocalTransform = function getLocalTransform(element) {
23846
24809
  var transform = element.transformable;
23847
24810
 
23848
24811
  if (transform.localDirtyFlag) {
23849
- fromRotationTranslationScaleOrigin(transform.localTransform, transform.localRotation, transform.localPosition, transform.localScale, transform.origin);
24812
+ this.calcLocalTransform(transform);
23850
24813
  transform.localDirtyFlag = false;
23851
24814
  }
23852
24815
 
@@ -23866,6 +24829,7 @@
23866
24829
  this.setLocalScale(element, [1, 1, 1]);
23867
24830
  this.setLocalPosition(element, [0, 0, 0]);
23868
24831
  this.setLocalEulerAngles(element, [0, 0, 0]);
24832
+ this.setLocalSkew(element, [0, 0]);
23869
24833
  };
23870
24834
 
23871
24835
  _proto.getTransformedGeometryBounds = function getTransformedGeometryBounds(element, render) {
@@ -23894,8 +24858,9 @@
23894
24858
  }
23895
24859
 
23896
24860
  var geometry = element.geometry;
23897
- var bounds = render ? geometry.renderBounds : geometry.contentBounds || null;
23898
- return bounds && new AABB(bounds.center, bounds.halfExtents) || new AABB();
24861
+ var bounds = render ? geometry.renderBounds : geometry.contentBounds || null; // return (bounds && new AABB(bounds.center, bounds.halfExtents)) || new AABB();
24862
+
24863
+ return bounds || new AABB();
23899
24864
  }
23900
24865
  /**
23901
24866
  * account for children in world space
@@ -23903,7 +24868,7 @@
23903
24868
  ;
23904
24869
 
23905
24870
  _proto.getBounds = function getBounds(element, render) {
23906
- var _this2 = this;
24871
+ var _this3 = this;
23907
24872
 
23908
24873
  if (render === void 0) {
23909
24874
  render = false;
@@ -23924,7 +24889,7 @@
23924
24889
 
23925
24890
  var children = element.childNodes;
23926
24891
  children.forEach(function (child) {
23927
- var childBounds = _this2.getBounds(child, render);
24892
+ var childBounds = _this3.getBounds(child, render);
23928
24893
 
23929
24894
  if (childBounds) {
23930
24895
  if (!aabb) {
@@ -23936,7 +24901,7 @@
23936
24901
  }
23937
24902
  }); // account for clip path
23938
24903
 
23939
- var clipPath = element.style.clipPath;
24904
+ var clipPath = element.parsedStyle.clipPath;
23940
24905
 
23941
24906
  if (clipPath) {
23942
24907
  var clipPathBounds = this.getTransformedGeometryBounds(clipPath, true);
@@ -24027,7 +24992,7 @@
24027
24992
  };
24028
24993
 
24029
24994
  _proto.dirtifyWorldInternal = function dirtifyWorldInternal(element, transform) {
24030
- var _this3 = this;
24995
+ var _this4 = this;
24031
24996
 
24032
24997
  if (!transform.dirtyFlag) {
24033
24998
  transform.dirtyFlag = true;
@@ -24036,7 +25001,7 @@
24036
25001
  var childTransform = child.transformable;
24037
25002
 
24038
25003
  if (!childTransform.dirtyFlag) {
24039
- _this3.dirtifyWorldInternal(child, childTransform);
25004
+ _this4.dirtifyWorldInternal(child, childTransform);
24040
25005
  }
24041
25006
  });
24042
25007
  var renderable = element.renderable;
@@ -24046,8 +25011,6 @@
24046
25011
  renderable.boundsDirty = true;
24047
25012
  renderable.dirty = true;
24048
25013
  }
24049
-
24050
- element.dispatchEvent(new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, element, null, null, 'modelMatrix', MutationEvent.MODIFICATION, null, null));
24051
25014
  }
24052
25015
  };
24053
25016
 
@@ -24073,7 +25036,7 @@
24073
25036
 
24074
25037
  _proto.sync = function sync(element, transform) {
24075
25038
  if (transform.localDirtyFlag) {
24076
- fromRotationTranslationScaleOrigin(transform.localTransform, transform.localRotation, transform.localPosition, transform.localScale, transform.origin);
25039
+ this.calcLocalTransform(transform);
24077
25040
  transform.localDirtyFlag = false;
24078
25041
  }
24079
25042
 
@@ -25285,6 +26248,7 @@
25285
26248
  exports.RenderingService = /*#__PURE__*/function () {
25286
26249
  function RenderingService() {
25287
26250
  this.renderingPluginProvider = void 0;
26251
+ this.canvasConfig = void 0;
25288
26252
  this.renderingContext = void 0;
25289
26253
  this.sceneGraphService = void 0;
25290
26254
  this.styleValueRegistry = void 0;
@@ -25398,6 +26362,21 @@
25398
26362
 
25399
26363
  _proto.getStats = function getStats() {
25400
26364
  return this.stats;
26365
+ }
26366
+ /**
26367
+ * Meet the following conditions:
26368
+ * * disable DirtyRectangleRendering
26369
+ * * camera changed
26370
+ */
26371
+ ;
26372
+
26373
+ _proto.disableDirtyRectangleRendering = function disableDirtyRectangleRendering() {
26374
+ var renderer = this.canvasConfig.renderer;
26375
+
26376
+ var _renderer$getConfig = renderer.getConfig(),
26377
+ enableDirtyRectangleRendering = _renderer$getConfig.enableDirtyRectangleRendering;
26378
+
26379
+ return !enableDirtyRectangleRendering || this.renderingContext.renderReasons.has(exports.RenderReason.CAMERA_CHANGED);
25401
26380
  };
25402
26381
 
25403
26382
  _proto.render = function render(canvasConfig) {
@@ -25407,6 +26386,7 @@
25407
26386
  this.stats.rendered = 0;
25408
26387
  this.zIndexCounter = 0;
25409
26388
  this.sceneGraphService.syncHierarchy(this.renderingContext.root);
26389
+ this.sceneGraphService.triggerPendingEvents();
25410
26390
 
25411
26391
  if (this.renderingContext.renderReasons.size && this.inited) {
25412
26392
  this.renderDisplayObject(this.renderingContext.root, canvasConfig);
@@ -25494,6 +26474,8 @@
25494
26474
 
25495
26475
  __decorate([contrib(RenderingPluginContribution), __metadata("design:type", Object)], exports.RenderingService.prototype, "renderingPluginProvider", void 0);
25496
26476
 
26477
+ __decorate([inject(CanvasConfig), __metadata("design:type", Object)], exports.RenderingService.prototype, "canvasConfig", void 0);
26478
+
25497
26479
  __decorate([inject(RenderingContext), __metadata("design:type", Object)], exports.RenderingService.prototype, "renderingContext", void 0);
25498
26480
 
25499
26481
  __decorate([inject(SceneGraphService), __metadata("design:type", Object)], exports.RenderingService.prototype, "sceneGraphService", void 0);
@@ -27487,7 +28469,9 @@
27487
28469
  */
27488
28470
 
27489
28471
  exports.CSSPropertyClipPath = /*#__PURE__*/function () {
27490
- function CSSPropertyClipPath() {}
28472
+ function CSSPropertyClipPath() {
28473
+ this.sceneGraphService = void 0;
28474
+ }
27491
28475
 
27492
28476
  var _proto = CSSPropertyClipPath.prototype;
27493
28477
 
@@ -27498,26 +28482,28 @@
27498
28482
  } // clear ref to old clip path
27499
28483
 
27500
28484
 
27501
- if (oldClipPath && oldClipPath !== newClipPath && oldClipPath.style.clipPathTargets) {
27502
- var index = oldClipPath.style.clipPathTargets.indexOf(object);
27503
- oldClipPath.style.clipPathTargets.splice(index, 1);
28485
+ if (oldClipPath && oldClipPath !== newClipPath && oldClipPath.parsedStyle.clipPathTargets) {
28486
+ var index = oldClipPath.parsedStyle.clipPathTargets.indexOf(object);
28487
+ oldClipPath.parsedStyle.clipPathTargets.splice(index, 1);
27504
28488
  }
27505
28489
 
27506
28490
  if (newClipPath) {
27507
- if (!newClipPath.style.clipPathTargets) {
27508
- newClipPath.style.clipPathTargets = [];
28491
+ if (!newClipPath.parsedStyle.clipPathTargets) {
28492
+ newClipPath.parsedStyle.clipPathTargets = [];
27509
28493
  }
27510
28494
 
27511
- newClipPath.style.clipPathTargets.push(object);
28495
+ newClipPath.parsedStyle.clipPathTargets.push(object);
27512
28496
  }
27513
28497
 
27514
- dirtifyToRoot(object);
28498
+ this.sceneGraphService.dirtifyToRoot(object);
27515
28499
  return newClipPath;
27516
28500
  };
27517
28501
 
27518
28502
  return CSSPropertyClipPath;
27519
28503
  }();
27520
28504
 
28505
+ __decorate([inject(SceneGraphService), __metadata("design:type", Object)], exports.CSSPropertyClipPath.prototype, "sceneGraphService", void 0);
28506
+
27521
28507
  exports.CSSPropertyClipPath = __decorate([singleton({
27522
28508
  token: {
27523
28509
  token: CSSProperty,
@@ -27597,21 +28583,6 @@
27597
28583
  _proto.calculator = function calculator(name, oldParsed, computed, object, registry) {
27598
28584
  if (CSSUnitValue.isRelativeUnit(computed.unit)) {
27599
28585
  if (computed.unit === exports.UnitType.kPercentage) {
27600
- // try to resolve according to parent's geometry bounds
27601
- // if (object.parentElement) {
27602
- // // registry.registerParentGeometryBoundsChangedHandler(object, name);
27603
- // return this.calculateUsedValueWithParentBounds(object, name);
27604
- // } else {
27605
- // registry.addUnresolveProperty(object, name);
27606
- // // defer calculation after mounted
27607
- // // object.addEventListener(
27608
- // // ElementEvent.MOUNTED,
27609
- // // () => {
27610
- // // registry.registerParentGeometryBoundsChangedHandler(object, name);
27611
- // // },
27612
- // // { once: true },
27613
- // // );
27614
- // }
27615
28586
  return new CSSUnitValue(0, 'px');
27616
28587
  } else if (computed.unit === exports.UnitType.kEms) {
27617
28588
  if (object.parentNode) {
@@ -27645,10 +28616,13 @@
27645
28616
  }();
27646
28617
 
27647
28618
  exports.CSSPropertyLengthOrPercentage = __decorate([singleton({
27648
- token: {
28619
+ token: [{
27649
28620
  token: CSSProperty,
27650
28621
  named: exports.PropertySyntax.LENGTH_PERCENTAGE
27651
- }
28622
+ }, {
28623
+ token: CSSProperty,
28624
+ named: exports.PropertySyntax.LENGTH
28625
+ }]
27652
28626
  })], exports.CSSPropertyLengthOrPercentage);
27653
28627
 
27654
28628
  /**
@@ -27817,6 +28791,18 @@
27817
28791
  }
27818
28792
  })], exports.CSSPropertyLocalPosition);
27819
28793
 
28794
+ exports.CSSPropertyNumber = function CSSPropertyNumber() {
28795
+ this.mixer = mergeNumbers;
28796
+ this.parser = parseNumber;
28797
+ };
28798
+
28799
+ exports.CSSPropertyNumber = __decorate([singleton({
28800
+ token: {
28801
+ token: CSSProperty,
28802
+ named: exports.PropertySyntax.NUMBER
28803
+ }
28804
+ })], exports.CSSPropertyNumber);
28805
+
27820
28806
  exports.CSSPropertyOffsetDistance = /*#__PURE__*/function () {
27821
28807
  function CSSPropertyOffsetDistance() {
27822
28808
  this.parser = parseNumber;
@@ -28125,9 +29111,9 @@
28125
29111
  // reset transform
28126
29112
  object.resetLocalTransform();
28127
29113
  object.setLocalPosition(defX, defY);
28128
- transform.forEach(function (_ref) {
28129
- var t = _ref.t,
28130
- d = _ref.d;
29114
+ transform.forEach(function (parsed) {
29115
+ var t = parsed.t,
29116
+ d = parsed.d;
28131
29117
 
28132
29118
  if (t === 'scale') {
28133
29119
  // scale(1) scale(1, 1)
@@ -28193,7 +29179,24 @@
28193
29179
  var _newAngles3 = d || [Odeg];
28194
29180
 
28195
29181
  object.rotateLocal(0, 0, _newAngles3[0].value);
28196
- } else ;
29182
+ } else if (t === 'rotate3d') ; else if (t === 'skew') {
29183
+ var newSkew = d.map(function (s) {
29184
+ return s.value;
29185
+ }) || [0, 0];
29186
+ object.setLocalSkew(deg2rad(newSkew[0]), deg2rad(newSkew[1]));
29187
+ } else if (t === 'skewx') {
29188
+ var _newSkew = d.map(function (s) {
29189
+ return s.value;
29190
+ }) || [0];
29191
+
29192
+ object.setLocalSkew(deg2rad(_newSkew[0]), object.getLocalSkew()[1]);
29193
+ } else if (t === 'skewy') {
29194
+ var _newSkew2 = d.map(function (s) {
29195
+ return s.value;
29196
+ }) || [0];
29197
+
29198
+ object.setLocalSkew(object.getLocalSkew()[0], deg2rad(_newSkew2[0]));
29199
+ }
28197
29200
  });
28198
29201
  }
28199
29202
  };
@@ -28448,13 +29451,25 @@
28448
29451
  name: 'transformOrigin',
28449
29452
  parsePriority: 100,
28450
29453
  // interpolable: true,
28451
- defaultValue: 'left top',
29454
+ defaultValue: function defaultValue(nodeName) {
29455
+ if (nodeName === exports.Shape.CIRCLE || nodeName === exports.Shape.ELLIPSE) {
29456
+ return 'center';
29457
+ }
29458
+
29459
+ return 'left top';
29460
+ },
28452
29461
  layoutDependent: true,
28453
29462
  syntax: exports.PropertySyntax.TRANSFORM_ORIGIN
28454
29463
  }, {
28455
29464
  name: 'anchor',
28456
29465
  parsePriority: 99,
28457
- defaultValue: '0 0',
29466
+ defaultValue: function defaultValue(nodeName) {
29467
+ if (nodeName === exports.Shape.CIRCLE || nodeName === exports.Shape.ELLIPSE) {
29468
+ return '0.5 0.5';
29469
+ }
29470
+
29471
+ return '0 0';
29472
+ },
28458
29473
  layoutDependent: true,
28459
29474
  syntax: exports.PropertySyntax.LENGTH_PERCENTAGE_12
28460
29475
  }, // <circle> & <ellipse>
@@ -28674,6 +29689,7 @@
28674
29689
  this.cache = {};
28675
29690
  this.unresolvedProperties = {};
28676
29691
  this.propertySyntaxFactory = void 0;
29692
+ this.sceneGraphService = void 0;
28677
29693
  this.cascadeProperties = {};
28678
29694
  }
28679
29695
 
@@ -28879,7 +29895,7 @@
28879
29895
  if (value === 'initial') {
28880
29896
  // @see https://developer.mozilla.org/en-US/docs/Web/CSS/initial
28881
29897
  if (!isNil(defaultValue)) {
28882
- computed = this.parseProperty(name, defaultValue, object);
29898
+ computed = this.parseProperty(name, isFunction(defaultValue) ? defaultValue(object.nodeName) : defaultValue, object);
28883
29899
  }
28884
29900
  } else if (value === 'inherit') {
28885
29901
  // @see https://developer.mozilla.org/en-US/docs/Web/CSS/inherit
@@ -29120,8 +30136,7 @@
29120
30136
  usedOriginXValue = usedOriginXValue - (flipY ? -1 : 1) * (anchor && anchor[0].value || 0) * geometry.contentBounds.halfExtents[0] * 2;
29121
30137
  usedOriginYValue = usedOriginYValue - (flipX ? -1 : 1) * (anchor && anchor[1].value || 0) * geometry.contentBounds.halfExtents[1] * 2;
29122
30138
  object.setOrigin(usedOriginXValue, usedOriginYValue);
29123
- object.dispatchEvent(new CustomEvent(exports.ElementEvent.GEOMETRY_BOUNDS_CHANGED));
29124
- dirtifyToRoot(object);
30139
+ this.sceneGraphService.dirtifyToRoot(object);
29125
30140
  }
29126
30141
  };
29127
30142
 
@@ -29140,6 +30155,8 @@
29140
30155
 
29141
30156
  __decorate([inject(CSSPropertySyntaxFactory), __metadata("design:type", Function)], exports.DefaultStyleValueRegistry.prototype, "propertySyntaxFactory", void 0);
29142
30157
 
30158
+ __decorate([inject(SceneGraphService), __metadata("design:type", Object)], exports.DefaultStyleValueRegistry.prototype, "sceneGraphService", void 0);
30159
+
29143
30160
  __decorate([inversify.postConstruct(), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0)], exports.DefaultStyleValueRegistry.prototype, "init", null);
29144
30161
 
29145
30162
  exports.DefaultStyleValueRegistry = __decorate([singleton({
@@ -29189,6 +30206,7 @@
29189
30206
  }
29190
30207
  }); // bind CSS property handlers
29191
30208
 
30209
+ register(exports.CSSPropertyNumber);
29192
30210
  register(exports.CSSPropertyAngle);
29193
30211
  register(exports.CSSPropertyClipPath);
29194
30212
  register(exports.CSSPropertyColor);
@@ -29320,7 +30338,7 @@
29320
30338
  * only dirty object will cause re-render
29321
30339
  */
29322
30340
  enableDirtyCheck: true,
29323
- enableCulling: true,
30341
+ enableCulling: false,
29324
30342
 
29325
30343
  /**
29326
30344
  * enable auto rendering by default
@@ -29394,26 +30412,29 @@
29394
30412
  _proto.apply = function apply(renderingService) {
29395
30413
  var _this = this;
29396
30414
 
29397
- // const strategies = this.strategyProvider.getContributions();
30415
+ var strategies = this.strategyProvider.getContributions();
29398
30416
  renderingService.hooks.cull.tap(CullingPlugin_1.tag, function (object) {
29399
30417
  if (object) {
29400
- var cullable = object.cullable;
29401
- cullable.visible = true; // // const renderBounds = object.getRenderBounds();
29402
- // // if (AABB.isEmpty(renderBounds)) {
29403
- // // cullable.visible = false;
29404
- // // } else {
29405
- // // const isShape2D = shape2D.indexOf(object.nodeName as Shape) > -1;
29406
- // // const [p0, p1, p2, p3] = camera.getFrustum().planes;
29407
- // // tmpAABB.setMinMax([-p1.distance, -p3.distance, 0], [p0.distance, p2.distance, 0]);
29408
- // // cullable.visible = isShape2D ? renderBounds.intersects(tmpAABB) : true;
29409
- // // }
29410
- // if (strategies.length === 0) {
29411
- // cullable.visible = this.renderingContext.unculledEntities.indexOf(object.entity) > -1;
30418
+ var cullable = object.cullable; // cullable.visible = true;
30419
+ // const renderBounds = object.getRenderBounds();
30420
+ // if (AABB.isEmpty(renderBounds)) {
30421
+ // cullable.visible = false;
29412
30422
  // } else {
29413
- // // eg. implemented by g-webgl(frustum culling)
29414
- // cullable.visible = strategies.every((strategy) => strategy.isVisible(object));
30423
+ // const isShape2D = shape2D.indexOf(object.nodeName as Shape) > -1;
30424
+ // const [p0, p1, p2, p3] = camera.getFrustum().planes;
30425
+ // tmpAABB.setMinMax([-p1.distance, -p3.distance, 0], [p0.distance, p2.distance, 0]);
30426
+ // cullable.visible = isShape2D ? renderBounds.intersects(tmpAABB) : true;
29415
30427
  // }
29416
30428
 
30429
+ if (strategies.length === 0) {
30430
+ cullable.visible = _this.renderingContext.unculledEntities.indexOf(object.entity) > -1;
30431
+ } else {
30432
+ // eg. implemented by g-webgl(frustum culling)
30433
+ cullable.visible = strategies.every(function (strategy) {
30434
+ return strategy.isVisible(object);
30435
+ });
30436
+ }
30437
+
29417
30438
  if (!cullable.isCulled() && object.isVisible()) {
29418
30439
  return object;
29419
30440
  } else {
@@ -29451,22 +30472,15 @@
29451
30472
  */
29452
30473
 
29453
30474
  var DirtyCheckPlugin = DirtyCheckPlugin_1 = (_class$2 = /*#__PURE__*/function () {
29454
- function DirtyCheckPlugin() {
29455
- this.renderingContext = void 0;
29456
- }
30475
+ function DirtyCheckPlugin() {}
29457
30476
 
29458
30477
  var _proto = DirtyCheckPlugin.prototype;
29459
30478
 
29460
30479
  _proto.apply = function apply(renderingService) {
29461
- var _this = this;
29462
-
29463
30480
  renderingService.hooks.dirtycheck.tap(DirtyCheckPlugin_1.tag, function (object) {
29464
30481
  if (object) {
29465
30482
  var renderable = object.renderable;
29466
-
29467
- var isCameraDirty = _this.renderingContext.renderReasons.has(exports.RenderReason.CAMERA_CHANGED);
29468
-
29469
- var isDirty = renderable.dirty || isCameraDirty;
30483
+ var isDirty = renderable.dirty || renderingService.disableDirtyRectangleRendering();
29470
30484
 
29471
30485
  if (isDirty) {
29472
30486
  return object;
@@ -29481,9 +30495,6 @@
29481
30495
 
29482
30496
  return DirtyCheckPlugin;
29483
30497
  }(), _class$2.tag = 'DirtyCheck', _class$2);
29484
-
29485
- __decorate([inject(RenderingContext), __metadata("design:type", Object)], DirtyCheckPlugin.prototype, "renderingContext", void 0);
29486
-
29487
30498
  DirtyCheckPlugin = DirtyCheckPlugin_1 = __decorate([singleton({
29488
30499
  contrib: RenderingPluginContribution
29489
30500
  })], DirtyCheckPlugin);
@@ -29908,6 +30919,7 @@
29908
30919
  function PrepareRendererPlugin() {
29909
30920
  this.renderingContext = void 0;
29910
30921
  this.styleValueRegistry = void 0;
30922
+ this.sceneGraphService = void 0;
29911
30923
  this.rBush = void 0;
29912
30924
  this.toSync = new Set();
29913
30925
  }
@@ -29954,7 +30966,8 @@
29954
30966
 
29955
30967
  _this2.styleValueRegistry.recalc(object);
29956
30968
 
29957
- dirtifyToRoot(object);
30969
+ _this2.sceneGraphService.dirtifyToRoot(object);
30970
+
29958
30971
  renderingService.dirtify();
29959
30972
  };
29960
30973
 
@@ -29968,7 +30981,8 @@
29968
30981
  _this2.toSync.delete(object);
29969
30982
  }
29970
30983
 
29971
- dirtifyToRoot(e.target);
30984
+ _this2.sceneGraphService.dirtifyToRoot(e.target);
30985
+
29972
30986
  renderingService.dirtify();
29973
30987
  };
29974
30988
 
@@ -30058,6 +31072,8 @@
30058
31072
 
30059
31073
  __decorate([inject(StyleValueRegistry), __metadata("design:type", Object)], PrepareRendererPlugin.prototype, "styleValueRegistry", void 0);
30060
31074
 
31075
+ __decorate([inject(SceneGraphService), __metadata("design:type", Object)], PrepareRendererPlugin.prototype, "sceneGraphService", void 0);
31076
+
30061
31077
  __decorate([inject(RBushRoot), __metadata("design:type", RBush)], PrepareRendererPlugin.prototype, "rBush", void 0);
30062
31078
 
30063
31079
  PrepareRendererPlugin = PrepareRendererPlugin_1 = __decorate([singleton({
@@ -30880,6 +31896,7 @@
30880
31896
  exports.contrib = contrib;
30881
31897
  exports.convertAngleUnit = convertAngleUnit;
30882
31898
  exports.convertEffectInput = convertEffectInput;
31899
+ exports.convertItemToMatrix = convertItemToMatrix;
30883
31900
  exports.convertPercentUnit = convertPercentUnit;
30884
31901
  exports.convertToDash = convertToDash;
30885
31902
  exports.convertToPath = convertToPath;
@@ -30888,7 +31905,6 @@
30888
31905
  exports.decorate = inversify.decorate;
30889
31906
  exports.deg2rad = deg2rad;
30890
31907
  exports.deg2turn = deg2turn;
30891
- exports.dirtifyToRoot = dirtifyToRoot;
30892
31908
  exports.equalSet = equalSet;
30893
31909
  exports.extractPolygons = extractPolygons;
30894
31910
  exports.formatAttribute = formatAttribute;