@uxbertlabs/reportly 1.0.4 → 1.0.5

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.
package/dist/reportly.js CHANGED
@@ -347,24 +347,26 @@ var Reportly = (function () {
347
347
  }
348
348
 
349
349
  class Toolbar {
350
+ // private currentTool: AnnotationTool;
351
+ // private currentColor: string;
350
352
  constructor(callbacks) {
351
353
  this.callbacks = callbacks;
352
354
  this.toolbar = null;
353
355
  this.toggleButton = null;
354
356
  this.isToolbarExpanded = false;
355
- this.currentTool = 'pen';
356
- this.currentColor = '#ef4444';
357
+ // this.currentTool = "pen";
358
+ // this.currentColor = "#ef4444";
357
359
  }
358
360
  create() {
359
361
  // Create toggle button
360
- this.toggleButton = document.createElement('button');
361
- this.toggleButton.className = 'uxbert-toolbar-toggle';
362
- this.toggleButton.innerHTML = '🛠️';
363
- this.toggleButton.title = 'Toggle Annotation Tools';
362
+ this.toggleButton = document.createElement("button");
363
+ this.toggleButton.className = "uxbert-toolbar-toggle";
364
+ this.toggleButton.innerHTML = "🛠️";
365
+ this.toggleButton.title = "Toggle Annotation Tools";
364
366
  document.body.appendChild(this.toggleButton);
365
367
  // Create toolbar
366
- this.toolbar = document.createElement('div');
367
- this.toolbar.className = 'uxbert-toolbar';
368
+ this.toolbar = document.createElement("div");
369
+ this.toolbar.className = "uxbert-toolbar";
368
370
  this.toolbar.innerHTML = `
369
371
  <div class="uxbert-toolbar-header">
370
372
  <div class="uxbert-toolbar-title">Annotation Tools</div>
@@ -404,19 +406,19 @@ var Reportly = (function () {
404
406
  if (!this.toolbar || !this.toggleButton)
405
407
  return;
406
408
  // Toggle button
407
- this.toggleButton.addEventListener('click', () => {
409
+ this.toggleButton.addEventListener("click", () => {
408
410
  this.toggleToolbar();
409
411
  });
410
412
  // Minimize button
411
- const minimizeBtn = this.toolbar.querySelector('#uxbert-minimize-btn');
412
- minimizeBtn.addEventListener('click', () => {
413
+ const minimizeBtn = this.toolbar.querySelector("#uxbert-minimize-btn");
414
+ minimizeBtn.addEventListener("click", () => {
413
415
  this.toggleToolbar();
414
416
  });
415
417
  // Tool buttons
416
- const toolBtns = this.toolbar.querySelectorAll('[data-tool]');
417
- toolBtns.forEach(btn => {
418
- btn.addEventListener('click', () => {
419
- const tool = btn.getAttribute('data-tool');
418
+ const toolBtns = this.toolbar.querySelectorAll("[data-tool]");
419
+ toolBtns.forEach((btn) => {
420
+ btn.addEventListener("click", () => {
421
+ const tool = btn.getAttribute("data-tool");
420
422
  this.setTool(tool);
421
423
  if (this.callbacks.onToolChange) {
422
424
  this.callbacks.onToolChange(tool);
@@ -424,10 +426,10 @@ var Reportly = (function () {
424
426
  });
425
427
  });
426
428
  // Color buttons
427
- const colorBtns = this.toolbar.querySelectorAll('[data-color]');
428
- colorBtns.forEach(btn => {
429
- btn.addEventListener('click', () => {
430
- const color = btn.getAttribute('data-color');
429
+ const colorBtns = this.toolbar.querySelectorAll("[data-color]");
430
+ colorBtns.forEach((btn) => {
431
+ btn.addEventListener("click", () => {
432
+ const color = btn.getAttribute("data-color");
431
433
  this.setColor(color);
432
434
  if (this.callbacks.onColorChange) {
433
435
  this.callbacks.onColorChange(color);
@@ -435,57 +437,57 @@ var Reportly = (function () {
435
437
  });
436
438
  });
437
439
  // Action buttons
438
- const undoBtn = this.toolbar.querySelector('#uxbert-undo-btn');
439
- undoBtn.addEventListener('click', () => {
440
+ const undoBtn = this.toolbar.querySelector("#uxbert-undo-btn");
441
+ undoBtn.addEventListener("click", () => {
440
442
  if (this.callbacks.onUndo) {
441
443
  this.callbacks.onUndo();
442
444
  }
443
445
  });
444
- const clearBtn = this.toolbar.querySelector('#uxbert-clear-btn');
445
- clearBtn.addEventListener('click', () => {
446
+ const clearBtn = this.toolbar.querySelector("#uxbert-clear-btn");
447
+ clearBtn.addEventListener("click", () => {
446
448
  if (this.callbacks.onClear) {
447
449
  this.callbacks.onClear();
448
450
  }
449
451
  });
450
- const doneBtn = this.toolbar.querySelector('#uxbert-done-btn');
451
- doneBtn.addEventListener('click', () => {
452
+ const doneBtn = this.toolbar.querySelector("#uxbert-done-btn");
453
+ doneBtn.addEventListener("click", () => {
452
454
  if (this.callbacks.onDone) {
453
455
  this.callbacks.onDone();
454
456
  }
455
457
  });
456
458
  // Exit button
457
- const exitBtn = this.toolbar.querySelector('#uxbert-exit-btn');
458
- exitBtn.addEventListener('click', () => {
459
+ const exitBtn = this.toolbar.querySelector("#uxbert-exit-btn");
460
+ exitBtn.addEventListener("click", () => {
459
461
  if (this.callbacks.onExit) {
460
462
  this.callbacks.onExit();
461
463
  }
462
464
  });
463
465
  }
464
466
  setTool(tool) {
465
- this.currentTool = tool;
467
+ // this.currentTool = tool;
466
468
  if (!this.toolbar)
467
469
  return;
468
- const toolBtns = this.toolbar.querySelectorAll('[data-tool]');
469
- toolBtns.forEach(btn => {
470
- if (btn.getAttribute('data-tool') === tool) {
471
- btn.classList.add('active');
470
+ const toolBtns = this.toolbar.querySelectorAll("[data-tool]");
471
+ toolBtns.forEach((btn) => {
472
+ if (btn.getAttribute("data-tool") === tool) {
473
+ btn.classList.add("active");
472
474
  }
473
475
  else {
474
- btn.classList.remove('active');
476
+ btn.classList.remove("active");
475
477
  }
476
478
  });
477
479
  }
478
480
  setColor(color) {
479
- this.currentColor = color;
481
+ // this.currentColor = color;
480
482
  if (!this.toolbar)
481
483
  return;
482
- const colorBtns = this.toolbar.querySelectorAll('[data-color]');
483
- colorBtns.forEach(btn => {
484
- if (btn.getAttribute('data-color') === color) {
485
- btn.classList.add('active');
484
+ const colorBtns = this.toolbar.querySelectorAll("[data-color]");
485
+ colorBtns.forEach((btn) => {
486
+ if (btn.getAttribute("data-color") === color) {
487
+ btn.classList.add("active");
486
488
  }
487
489
  else {
488
- btn.classList.remove('active');
490
+ btn.classList.remove("active");
489
491
  }
490
492
  });
491
493
  }
@@ -494,40 +496,40 @@ var Reportly = (function () {
494
496
  return;
495
497
  this.isToolbarExpanded = !this.isToolbarExpanded;
496
498
  if (this.isToolbarExpanded) {
497
- this.toolbar.classList.add('expanded');
498
- this.toggleButton.classList.add('hidden');
499
+ this.toolbar.classList.add("expanded");
500
+ this.toggleButton.classList.add("hidden");
499
501
  }
500
502
  else {
501
- this.toolbar.classList.remove('expanded');
502
- this.toggleButton.classList.remove('hidden');
503
+ this.toolbar.classList.remove("expanded");
504
+ this.toggleButton.classList.remove("hidden");
503
505
  }
504
506
  }
505
507
  show() {
506
508
  if (this.toolbar && this.toggleButton) {
507
- this.toolbar.classList.add('active');
508
- this.toggleButton.classList.add('active');
509
+ this.toolbar.classList.add("active");
510
+ this.toggleButton.classList.add("active");
509
511
  // Use setTimeout to ensure DOM is ready before checking width and applying classes
510
512
  setTimeout(() => {
511
513
  // Auto-expand on desktop, collapsed on mobile
512
514
  if (window.innerWidth > 768) {
513
515
  this.isToolbarExpanded = true;
514
- this.toolbar.classList.add('expanded');
515
- this.toggleButton.classList.add('hidden');
516
+ this.toolbar.classList.add("expanded");
517
+ this.toggleButton.classList.add("hidden");
516
518
  }
517
519
  else {
518
520
  this.isToolbarExpanded = false;
519
- this.toolbar.classList.remove('expanded');
520
- this.toggleButton.classList.remove('hidden');
521
+ this.toolbar.classList.remove("expanded");
522
+ this.toggleButton.classList.remove("hidden");
521
523
  }
522
524
  }, 50);
523
525
  }
524
526
  }
525
527
  hide() {
526
528
  if (this.toolbar && this.toggleButton) {
527
- this.toolbar.classList.remove('active');
528
- this.toolbar.classList.remove('expanded');
529
- this.toggleButton.classList.remove('active');
530
- this.toggleButton.classList.remove('hidden');
529
+ this.toolbar.classList.remove("active");
530
+ this.toolbar.classList.remove("expanded");
531
+ this.toggleButton.classList.remove("active");
532
+ this.toggleButton.classList.remove("hidden");
531
533
  this.isToolbarExpanded = false;
532
534
  }
533
535
  }
@@ -544,11 +546,11 @@ var Reportly = (function () {
544
546
  }
545
547
 
546
548
  /*!
547
- * html2canvas 1.4.1 <https://html2canvas.hertzen.com>
548
- * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
549
+ * html2canvas-pro 1.5.12 <https://yorickshan.github.io/html2canvas-pro/>
550
+ * Copyright (c) 2024-present yorickshan and html2canvas-pro contributors
549
551
  * Released under MIT License
550
552
  */
551
- /*! *****************************************************************************
553
+ /******************************************************************************
552
554
  Copyright (c) Microsoft Corporation.
553
555
 
554
556
  Permission to use, copy, modify, and/or distribute this software for any
@@ -562,7 +564,7 @@ var Reportly = (function () {
562
564
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
563
565
  PERFORMANCE OF THIS SOFTWARE.
564
566
  ***************************************************************************** */
565
- /* global Reflect, Promise */
567
+ /* global Reflect, Promise, SuppressedError, Symbol */
566
568
 
567
569
  var extendStatics = function(d, b) {
568
570
  extendStatics = Object.setPrototypeOf ||
@@ -606,7 +608,7 @@ var Reportly = (function () {
606
608
  function verb(n) { return function (v) { return step([n, v]); }; }
607
609
  function step(op) {
608
610
  if (f) throw new TypeError("Generator is already executing.");
609
- while (_) try {
611
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
610
612
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
611
613
  if (y = 0, t) op = [op[0] & 2, t.value];
612
614
  switch (op[0]) {
@@ -635,8 +637,13 @@ var Reportly = (function () {
635
637
  ar[i] = from[i];
636
638
  }
637
639
  }
638
- return to.concat(ar || from);
639
- }
640
+ return to.concat(ar || Array.prototype.slice.call(from));
641
+ }
642
+
643
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
644
+ var e = new Error(message);
645
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
646
+ };
640
647
 
641
648
  var Bounds = /** @class */ (function () {
642
649
  function Bounds(left, top, width, height) {
@@ -1531,38 +1538,38 @@ var Reportly = (function () {
1531
1538
  return sign * (int + frac * Math.pow(10, -fracd)) * Math.pow(10, expsign * exp);
1532
1539
  };
1533
1540
  var LEFT_PARENTHESIS_TOKEN = {
1534
- type: 2 /* LEFT_PARENTHESIS_TOKEN */
1541
+ type: 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */
1535
1542
  };
1536
1543
  var RIGHT_PARENTHESIS_TOKEN = {
1537
- type: 3 /* RIGHT_PARENTHESIS_TOKEN */
1538
- };
1539
- var COMMA_TOKEN = { type: 4 /* COMMA_TOKEN */ };
1540
- var SUFFIX_MATCH_TOKEN = { type: 13 /* SUFFIX_MATCH_TOKEN */ };
1541
- var PREFIX_MATCH_TOKEN = { type: 8 /* PREFIX_MATCH_TOKEN */ };
1542
- var COLUMN_TOKEN = { type: 21 /* COLUMN_TOKEN */ };
1543
- var DASH_MATCH_TOKEN = { type: 9 /* DASH_MATCH_TOKEN */ };
1544
- var INCLUDE_MATCH_TOKEN = { type: 10 /* INCLUDE_MATCH_TOKEN */ };
1544
+ type: 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */
1545
+ };
1546
+ var COMMA_TOKEN = { type: 4 /* TokenType.COMMA_TOKEN */ };
1547
+ var SUFFIX_MATCH_TOKEN = { type: 13 /* TokenType.SUFFIX_MATCH_TOKEN */ };
1548
+ var PREFIX_MATCH_TOKEN = { type: 8 /* TokenType.PREFIX_MATCH_TOKEN */ };
1549
+ var COLUMN_TOKEN = { type: 21 /* TokenType.COLUMN_TOKEN */ };
1550
+ var DASH_MATCH_TOKEN = { type: 9 /* TokenType.DASH_MATCH_TOKEN */ };
1551
+ var INCLUDE_MATCH_TOKEN = { type: 10 /* TokenType.INCLUDE_MATCH_TOKEN */ };
1545
1552
  var LEFT_CURLY_BRACKET_TOKEN = {
1546
- type: 11 /* LEFT_CURLY_BRACKET_TOKEN */
1553
+ type: 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */
1547
1554
  };
1548
1555
  var RIGHT_CURLY_BRACKET_TOKEN = {
1549
- type: 12 /* RIGHT_CURLY_BRACKET_TOKEN */
1550
- };
1551
- var SUBSTRING_MATCH_TOKEN = { type: 14 /* SUBSTRING_MATCH_TOKEN */ };
1552
- var BAD_URL_TOKEN = { type: 23 /* BAD_URL_TOKEN */ };
1553
- var BAD_STRING_TOKEN = { type: 1 /* BAD_STRING_TOKEN */ };
1554
- var CDO_TOKEN = { type: 25 /* CDO_TOKEN */ };
1555
- var CDC_TOKEN = { type: 24 /* CDC_TOKEN */ };
1556
- var COLON_TOKEN = { type: 26 /* COLON_TOKEN */ };
1557
- var SEMICOLON_TOKEN = { type: 27 /* SEMICOLON_TOKEN */ };
1556
+ type: 12 /* TokenType.RIGHT_CURLY_BRACKET_TOKEN */
1557
+ };
1558
+ var SUBSTRING_MATCH_TOKEN = { type: 14 /* TokenType.SUBSTRING_MATCH_TOKEN */ };
1559
+ var BAD_URL_TOKEN = { type: 23 /* TokenType.BAD_URL_TOKEN */ };
1560
+ var BAD_STRING_TOKEN = { type: 1 /* TokenType.BAD_STRING_TOKEN */ };
1561
+ var CDO_TOKEN = { type: 25 /* TokenType.CDO_TOKEN */ };
1562
+ var CDC_TOKEN = { type: 24 /* TokenType.CDC_TOKEN */ };
1563
+ var COLON_TOKEN = { type: 26 /* TokenType.COLON_TOKEN */ };
1564
+ var SEMICOLON_TOKEN = { type: 27 /* TokenType.SEMICOLON_TOKEN */ };
1558
1565
  var LEFT_SQUARE_BRACKET_TOKEN = {
1559
- type: 28 /* LEFT_SQUARE_BRACKET_TOKEN */
1566
+ type: 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */
1560
1567
  };
1561
1568
  var RIGHT_SQUARE_BRACKET_TOKEN = {
1562
- type: 29 /* RIGHT_SQUARE_BRACKET_TOKEN */
1569
+ type: 29 /* TokenType.RIGHT_SQUARE_BRACKET_TOKEN */
1563
1570
  };
1564
- var WHITESPACE_TOKEN = { type: 31 /* WHITESPACE_TOKEN */ };
1565
- var EOF_TOKEN = { type: 32 /* EOF_TOKEN */ };
1571
+ var WHITESPACE_TOKEN = { type: 31 /* TokenType.WHITESPACE_TOKEN */ };
1572
+ var EOF_TOKEN = { type: 32 /* TokenType.EOF_TOKEN */ };
1566
1573
  var Tokenizer = /** @class */ (function () {
1567
1574
  function Tokenizer() {
1568
1575
  this._value = [];
@@ -1591,7 +1598,7 @@ var Reportly = (function () {
1591
1598
  if (isNameCodePoint(c1) || isValidEscape(c2, c3)) {
1592
1599
  var flags = isIdentifierStart(c1, c2, c3) ? FLAG_ID : FLAG_UNRESTRICTED;
1593
1600
  var value = this.consumeName();
1594
- return { type: 5 /* HASH_TOKEN */, value: value, flags: flags };
1601
+ return { type: 5 /* TokenType.HASH_TOKEN */, value: value, flags: flags };
1595
1602
  }
1596
1603
  break;
1597
1604
  case DOLLAR_SIGN:
@@ -1680,7 +1687,7 @@ var Reportly = (function () {
1680
1687
  var a3 = this.peekCodePoint(2);
1681
1688
  if (isIdentifierStart(a1, a2, a3)) {
1682
1689
  var value = this.consumeName();
1683
- return { type: 7 /* AT_KEYWORD_TOKEN */, value: value };
1690
+ return { type: 7 /* TokenType.AT_KEYWORD_TOKEN */, value: value };
1684
1691
  }
1685
1692
  break;
1686
1693
  case LEFT_SQUARE_BRACKET:
@@ -1744,7 +1751,7 @@ var Reportly = (function () {
1744
1751
  this.reconsumeCodePoint(codePoint);
1745
1752
  return this.consumeIdentLikeToken();
1746
1753
  }
1747
- return { type: 6 /* DELIM_TOKEN */, value: fromCodePoint$1(codePoint) };
1754
+ return { type: 6 /* TokenType.DELIM_TOKEN */, value: fromCodePoint$1(codePoint) };
1748
1755
  };
1749
1756
  Tokenizer.prototype.consumeCodePoint = function () {
1750
1757
  var value = this._value.shift();
@@ -1775,7 +1782,7 @@ var Reportly = (function () {
1775
1782
  if (questionMarks) {
1776
1783
  var start_1 = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? ZERO : digit); })), 16);
1777
1784
  var end = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? F : digit); })), 16);
1778
- return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start_1, end: end };
1785
+ return { type: 30 /* TokenType.UNICODE_RANGE_TOKEN */, start: start_1, end: end };
1779
1786
  }
1780
1787
  var start = parseInt(fromCodePoint$1.apply(void 0, digits), 16);
1781
1788
  if (this.peekCodePoint(0) === HYPHEN_MINUS && isHex(this.peekCodePoint(1))) {
@@ -1787,10 +1794,10 @@ var Reportly = (function () {
1787
1794
  codePoint = this.consumeCodePoint();
1788
1795
  }
1789
1796
  var end = parseInt(fromCodePoint$1.apply(void 0, endDigits), 16);
1790
- return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: end };
1797
+ return { type: 30 /* TokenType.UNICODE_RANGE_TOKEN */, start: start, end: end };
1791
1798
  }
1792
1799
  else {
1793
- return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: start };
1800
+ return { type: 30 /* TokenType.UNICODE_RANGE_TOKEN */, start: start, end: start };
1794
1801
  }
1795
1802
  };
1796
1803
  Tokenizer.prototype.consumeIdentLikeToken = function () {
@@ -1801,24 +1808,24 @@ var Reportly = (function () {
1801
1808
  }
1802
1809
  else if (this.peekCodePoint(0) === LEFT_PARENTHESIS) {
1803
1810
  this.consumeCodePoint();
1804
- return { type: 19 /* FUNCTION_TOKEN */, value: value };
1811
+ return { type: 19 /* TokenType.FUNCTION_TOKEN */, value: value };
1805
1812
  }
1806
- return { type: 20 /* IDENT_TOKEN */, value: value };
1813
+ return { type: 20 /* TokenType.IDENT_TOKEN */, value: value };
1807
1814
  };
1808
1815
  Tokenizer.prototype.consumeUrlToken = function () {
1809
1816
  var value = [];
1810
1817
  this.consumeWhiteSpace();
1811
1818
  if (this.peekCodePoint(0) === EOF) {
1812
- return { type: 22 /* URL_TOKEN */, value: '' };
1819
+ return { type: 22 /* TokenType.URL_TOKEN */, value: '' };
1813
1820
  }
1814
1821
  var next = this.peekCodePoint(0);
1815
1822
  if (next === APOSTROPHE || next === QUOTATION_MARK) {
1816
1823
  var stringToken = this.consumeStringToken(this.consumeCodePoint());
1817
- if (stringToken.type === 0 /* STRING_TOKEN */) {
1824
+ if (stringToken.type === 0 /* TokenType.STRING_TOKEN */) {
1818
1825
  this.consumeWhiteSpace();
1819
1826
  if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
1820
1827
  this.consumeCodePoint();
1821
- return { type: 22 /* URL_TOKEN */, value: stringToken.value };
1828
+ return { type: 22 /* TokenType.URL_TOKEN */, value: stringToken.value };
1822
1829
  }
1823
1830
  }
1824
1831
  this.consumeBadUrlRemnants();
@@ -1827,13 +1834,13 @@ var Reportly = (function () {
1827
1834
  while (true) {
1828
1835
  var codePoint = this.consumeCodePoint();
1829
1836
  if (codePoint === EOF || codePoint === RIGHT_PARENTHESIS) {
1830
- return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
1837
+ return { type: 22 /* TokenType.URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
1831
1838
  }
1832
1839
  else if (isWhiteSpace(codePoint)) {
1833
1840
  this.consumeWhiteSpace();
1834
1841
  if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
1835
1842
  this.consumeCodePoint();
1836
- return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
1843
+ return { type: 22 /* TokenType.URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
1837
1844
  }
1838
1845
  this.consumeBadUrlRemnants();
1839
1846
  return BAD_URL_TOKEN;
@@ -1893,7 +1900,7 @@ var Reportly = (function () {
1893
1900
  var codePoint = this._value[i];
1894
1901
  if (codePoint === EOF || codePoint === undefined || codePoint === endingCodePoint) {
1895
1902
  value += this.consumeStringSlice(i);
1896
- return { type: 0 /* STRING_TOKEN */, value: value };
1903
+ return { type: 0 /* TokenType.STRING_TOKEN */, value: value };
1897
1904
  }
1898
1905
  if (codePoint === LINE_FEED) {
1899
1906
  this._value.splice(0, i);
@@ -1955,13 +1962,13 @@ var Reportly = (function () {
1955
1962
  var c3 = this.peekCodePoint(2);
1956
1963
  if (isIdentifierStart(c1, c2, c3)) {
1957
1964
  var unit = this.consumeName();
1958
- return { type: 15 /* DIMENSION_TOKEN */, number: number, flags: flags, unit: unit };
1965
+ return { type: 15 /* TokenType.DIMENSION_TOKEN */, number: number, flags: flags, unit: unit };
1959
1966
  }
1960
1967
  if (c1 === PERCENTAGE_SIGN) {
1961
1968
  this.consumeCodePoint();
1962
- return { type: 16 /* PERCENTAGE_TOKEN */, number: number, flags: flags };
1969
+ return { type: 16 /* TokenType.PERCENTAGE_TOKEN */, number: number, flags: flags };
1963
1970
  }
1964
- return { type: 17 /* NUMBER_TOKEN */, number: number, flags: flags };
1971
+ return { type: 17 /* TokenType.NUMBER_TOKEN */, number: number, flags: flags };
1965
1972
  };
1966
1973
  Tokenizer.prototype.consumeEscapedCodePoint = function () {
1967
1974
  var codePoint = this.consumeCodePoint();
@@ -2020,18 +2027,18 @@ var Reportly = (function () {
2020
2027
  };
2021
2028
  Parser.prototype.parseComponentValue = function () {
2022
2029
  var token = this.consumeToken();
2023
- while (token.type === 31 /* WHITESPACE_TOKEN */) {
2030
+ while (token.type === 31 /* TokenType.WHITESPACE_TOKEN */) {
2024
2031
  token = this.consumeToken();
2025
2032
  }
2026
- if (token.type === 32 /* EOF_TOKEN */) {
2033
+ if (token.type === 32 /* TokenType.EOF_TOKEN */) {
2027
2034
  throw new SyntaxError("Error parsing CSS component value, unexpected EOF");
2028
2035
  }
2029
2036
  this.reconsumeToken(token);
2030
2037
  var value = this.consumeComponentValue();
2031
2038
  do {
2032
2039
  token = this.consumeToken();
2033
- } while (token.type === 31 /* WHITESPACE_TOKEN */);
2034
- if (token.type === 32 /* EOF_TOKEN */) {
2040
+ } while (token.type === 31 /* TokenType.WHITESPACE_TOKEN */);
2041
+ if (token.type === 32 /* TokenType.EOF_TOKEN */) {
2035
2042
  return value;
2036
2043
  }
2037
2044
  throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one");
@@ -2040,7 +2047,7 @@ var Reportly = (function () {
2040
2047
  var values = [];
2041
2048
  while (true) {
2042
2049
  var value = this.consumeComponentValue();
2043
- if (value.type === 32 /* EOF_TOKEN */) {
2050
+ if (value.type === 32 /* TokenType.EOF_TOKEN */) {
2044
2051
  return values;
2045
2052
  }
2046
2053
  values.push(value);
@@ -2050,11 +2057,11 @@ var Reportly = (function () {
2050
2057
  Parser.prototype.consumeComponentValue = function () {
2051
2058
  var token = this.consumeToken();
2052
2059
  switch (token.type) {
2053
- case 11 /* LEFT_CURLY_BRACKET_TOKEN */:
2054
- case 28 /* LEFT_SQUARE_BRACKET_TOKEN */:
2055
- case 2 /* LEFT_PARENTHESIS_TOKEN */:
2060
+ case 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */:
2061
+ case 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */:
2062
+ case 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */:
2056
2063
  return this.consumeSimpleBlock(token.type);
2057
- case 19 /* FUNCTION_TOKEN */:
2064
+ case 19 /* TokenType.FUNCTION_TOKEN */:
2058
2065
  return this.consumeFunction(token);
2059
2066
  }
2060
2067
  return token;
@@ -2063,7 +2070,7 @@ var Reportly = (function () {
2063
2070
  var block = { type: type, values: [] };
2064
2071
  var token = this.consumeToken();
2065
2072
  while (true) {
2066
- if (token.type === 32 /* EOF_TOKEN */ || isEndingTokenFor(token, type)) {
2073
+ if (token.type === 32 /* TokenType.EOF_TOKEN */ || isEndingTokenFor(token, type)) {
2067
2074
  return block;
2068
2075
  }
2069
2076
  this.reconsumeToken(token);
@@ -2075,11 +2082,11 @@ var Reportly = (function () {
2075
2082
  var cssFunction = {
2076
2083
  name: functionToken.value,
2077
2084
  values: [],
2078
- type: 18 /* FUNCTION */
2085
+ type: 18 /* TokenType.FUNCTION */
2079
2086
  };
2080
2087
  while (true) {
2081
2088
  var token = this.consumeToken();
2082
- if (token.type === 32 /* EOF_TOKEN */ || token.type === 3 /* RIGHT_PARENTHESIS_TOKEN */) {
2089
+ if (token.type === 32 /* TokenType.EOF_TOKEN */ || token.type === 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */) {
2083
2090
  return cssFunction;
2084
2091
  }
2085
2092
  this.reconsumeToken(token);
@@ -2095,22 +2102,22 @@ var Reportly = (function () {
2095
2102
  };
2096
2103
  return Parser;
2097
2104
  }());
2098
- var isDimensionToken = function (token) { return token.type === 15 /* DIMENSION_TOKEN */; };
2099
- var isNumberToken = function (token) { return token.type === 17 /* NUMBER_TOKEN */; };
2100
- var isIdentToken = function (token) { return token.type === 20 /* IDENT_TOKEN */; };
2101
- var isStringToken = function (token) { return token.type === 0 /* STRING_TOKEN */; };
2105
+ var isDimensionToken = function (token) { return token.type === 15 /* TokenType.DIMENSION_TOKEN */; };
2106
+ var isNumberToken = function (token) { return token.type === 17 /* TokenType.NUMBER_TOKEN */; };
2107
+ var isIdentToken = function (token) { return token.type === 20 /* TokenType.IDENT_TOKEN */; };
2108
+ var isStringToken = function (token) { return token.type === 0 /* TokenType.STRING_TOKEN */; };
2102
2109
  var isIdentWithValue = function (token, value) {
2103
2110
  return isIdentToken(token) && token.value === value;
2104
2111
  };
2105
- var nonWhiteSpace = function (token) { return token.type !== 31 /* WHITESPACE_TOKEN */; };
2112
+ var nonWhiteSpace = function (token) { return token.type !== 31 /* TokenType.WHITESPACE_TOKEN */; };
2106
2113
  var nonFunctionArgSeparator = function (token) {
2107
- return token.type !== 31 /* WHITESPACE_TOKEN */ && token.type !== 4 /* COMMA_TOKEN */;
2114
+ return token.type !== 31 /* TokenType.WHITESPACE_TOKEN */ && token.type !== 4 /* TokenType.COMMA_TOKEN */;
2108
2115
  };
2109
2116
  var parseFunctionArgs = function (tokens) {
2110
2117
  var args = [];
2111
2118
  var arg = [];
2112
2119
  tokens.forEach(function (token) {
2113
- if (token.type === 4 /* COMMA_TOKEN */) {
2120
+ if (token.type === 4 /* TokenType.COMMA_TOKEN */) {
2114
2121
  if (arg.length === 0) {
2115
2122
  throw new Error("Error parsing function args, zero tokens for arg");
2116
2123
  }
@@ -2118,7 +2125,7 @@ var Reportly = (function () {
2118
2125
  arg = [];
2119
2126
  return;
2120
2127
  }
2121
- if (token.type !== 31 /* WHITESPACE_TOKEN */) {
2128
+ if (token.type !== 31 /* TokenType.WHITESPACE_TOKEN */) {
2122
2129
  arg.push(token);
2123
2130
  }
2124
2131
  });
@@ -2128,37 +2135,37 @@ var Reportly = (function () {
2128
2135
  return args;
2129
2136
  };
2130
2137
  var isEndingTokenFor = function (token, type) {
2131
- if (type === 11 /* LEFT_CURLY_BRACKET_TOKEN */ && token.type === 12 /* RIGHT_CURLY_BRACKET_TOKEN */) {
2138
+ if (type === 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */ && token.type === 12 /* TokenType.RIGHT_CURLY_BRACKET_TOKEN */) {
2132
2139
  return true;
2133
2140
  }
2134
- if (type === 28 /* LEFT_SQUARE_BRACKET_TOKEN */ && token.type === 29 /* RIGHT_SQUARE_BRACKET_TOKEN */) {
2141
+ if (type === 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */ && token.type === 29 /* TokenType.RIGHT_SQUARE_BRACKET_TOKEN */) {
2135
2142
  return true;
2136
2143
  }
2137
- return type === 2 /* LEFT_PARENTHESIS_TOKEN */ && token.type === 3 /* RIGHT_PARENTHESIS_TOKEN */;
2144
+ return type === 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */ && token.type === 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */;
2138
2145
  };
2139
2146
 
2140
2147
  var isLength = function (token) {
2141
- return token.type === 17 /* NUMBER_TOKEN */ || token.type === 15 /* DIMENSION_TOKEN */;
2148
+ return token.type === 17 /* TokenType.NUMBER_TOKEN */ || token.type === 15 /* TokenType.DIMENSION_TOKEN */;
2142
2149
  };
2143
2150
 
2144
2151
  var isLengthPercentage = function (token) {
2145
- return token.type === 16 /* PERCENTAGE_TOKEN */ || isLength(token);
2152
+ return token.type === 16 /* TokenType.PERCENTAGE_TOKEN */ || isLength(token);
2146
2153
  };
2147
2154
  var parseLengthPercentageTuple = function (tokens) {
2148
2155
  return tokens.length > 1 ? [tokens[0], tokens[1]] : [tokens[0]];
2149
2156
  };
2150
2157
  var ZERO_LENGTH = {
2151
- type: 17 /* NUMBER_TOKEN */,
2158
+ type: 17 /* TokenType.NUMBER_TOKEN */,
2152
2159
  number: 0,
2153
2160
  flags: FLAG_INTEGER
2154
2161
  };
2155
2162
  var FIFTY_PERCENT = {
2156
- type: 16 /* PERCENTAGE_TOKEN */,
2163
+ type: 16 /* TokenType.PERCENTAGE_TOKEN */,
2157
2164
  number: 50,
2158
2165
  flags: FLAG_INTEGER
2159
2166
  };
2160
2167
  var HUNDRED_PERCENT = {
2161
- type: 16 /* PERCENTAGE_TOKEN */,
2168
+ type: 16 /* TokenType.PERCENTAGE_TOKEN */,
2162
2169
  number: 100,
2163
2170
  flags: FLAG_INTEGER
2164
2171
  };
@@ -2167,7 +2174,7 @@ var Reportly = (function () {
2167
2174
  return [getAbsoluteValue(x, width), getAbsoluteValue(typeof y !== 'undefined' ? y : x, height)];
2168
2175
  };
2169
2176
  var getAbsoluteValue = function (token, parent) {
2170
- if (token.type === 16 /* PERCENTAGE_TOKEN */) {
2177
+ if (token.type === 16 /* TokenType.PERCENTAGE_TOKEN */) {
2171
2178
  return (token.number / 100) * parent;
2172
2179
  }
2173
2180
  if (isDimensionToken(token)) {
@@ -2190,7 +2197,7 @@ var Reportly = (function () {
2190
2197
  var angle = {
2191
2198
  name: 'angle',
2192
2199
  parse: function (_context, value) {
2193
- if (value.type === 15 /* DIMENSION_TOKEN */) {
2200
+ if (value.type === 15 /* TokenType.DIMENSION_TOKEN */) {
2194
2201
  switch (value.unit) {
2195
2202
  case DEG:
2196
2203
  return (Math.PI * value.number) / 180;
@@ -2206,7 +2213,7 @@ var Reportly = (function () {
2206
2213
  }
2207
2214
  };
2208
2215
  var isAngle = function (value) {
2209
- if (value.type === 15 /* DIMENSION_TOKEN */) {
2216
+ if (value.type === 15 /* TokenType.DIMENSION_TOKEN */) {
2210
2217
  if (value.unit === DEG || value.unit === GRAD || value.unit === RAD || value.unit === TURN) {
2211
2218
  return true;
2212
2219
  }
@@ -2256,87 +2263,154 @@ var Reportly = (function () {
2256
2263
  };
2257
2264
  var deg = function (deg) { return (Math.PI * deg) / 180; };
2258
2265
 
2259
- var color$1 = {
2260
- name: 'color',
2261
- parse: function (context, value) {
2262
- if (value.type === 18 /* FUNCTION */) {
2263
- var colorFunction = SUPPORTED_COLOR_FUNCTIONS[value.name];
2264
- if (typeof colorFunction === 'undefined') {
2265
- throw new Error("Attempting to parse an unsupported color function \"" + value.name + "\"");
2266
- }
2267
- return colorFunction(context, value.values);
2268
- }
2269
- if (value.type === 5 /* HASH_TOKEN */) {
2270
- if (value.value.length === 3) {
2271
- var r = value.value.substring(0, 1);
2272
- var g = value.value.substring(1, 2);
2273
- var b = value.value.substring(2, 3);
2274
- return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), 1);
2275
- }
2276
- if (value.value.length === 4) {
2277
- var r = value.value.substring(0, 1);
2278
- var g = value.value.substring(1, 2);
2279
- var b = value.value.substring(2, 3);
2280
- var a = value.value.substring(3, 4);
2281
- return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a + a, 16) / 255);
2282
- }
2283
- if (value.value.length === 6) {
2284
- var r = value.value.substring(0, 2);
2285
- var g = value.value.substring(2, 4);
2286
- var b = value.value.substring(4, 6);
2287
- return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1);
2288
- }
2289
- if (value.value.length === 8) {
2290
- var r = value.value.substring(0, 2);
2291
- var g = value.value.substring(2, 4);
2292
- var b = value.value.substring(4, 6);
2293
- var a = value.value.substring(6, 8);
2294
- return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a, 16) / 255);
2295
- }
2296
- }
2297
- if (value.type === 20 /* IDENT_TOKEN */) {
2298
- var namedColor = COLORS[value.value.toUpperCase()];
2299
- if (typeof namedColor !== 'undefined') {
2300
- return namedColor;
2301
- }
2302
- }
2303
- return COLORS.TRANSPARENT;
2304
- }
2305
- };
2306
2266
  var isTransparent = function (color) { return (0xff & color) === 0; };
2307
2267
  var asString = function (color) {
2308
2268
  var alpha = 0xff & color;
2309
2269
  var blue = 0xff & (color >> 8);
2310
2270
  var green = 0xff & (color >> 16);
2311
2271
  var red = 0xff & (color >> 24);
2312
- return alpha < 255 ? "rgba(" + red + "," + green + "," + blue + "," + alpha / 255 + ")" : "rgb(" + red + "," + green + "," + blue + ")";
2272
+ return alpha < 255 ? "rgba(".concat(red, ",").concat(green, ",").concat(blue, ",").concat(alpha / 255, ")") : "rgb(".concat(red, ",").concat(green, ",").concat(blue, ")");
2313
2273
  };
2314
2274
  var pack = function (r, g, b, a) {
2315
2275
  return ((r << 24) | (g << 16) | (b << 8) | (Math.round(a * 255) << 0)) >>> 0;
2316
2276
  };
2317
2277
  var getTokenColorValue = function (token, i) {
2318
- if (token.type === 17 /* NUMBER_TOKEN */) {
2278
+ if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
2319
2279
  return token.number;
2320
2280
  }
2321
- if (token.type === 16 /* PERCENTAGE_TOKEN */) {
2281
+ if (token.type === 16 /* TokenType.PERCENTAGE_TOKEN */) {
2322
2282
  var max = i === 3 ? 1 : 255;
2323
2283
  return i === 3 ? (token.number / 100) * max : Math.round((token.number / 100) * max);
2324
2284
  }
2325
2285
  return 0;
2326
2286
  };
2327
- var rgb = function (_context, args) {
2328
- var tokens = args.filter(nonFunctionArgSeparator);
2329
- if (tokens.length === 3) {
2330
- var _a = tokens.map(getTokenColorValue), r = _a[0], g = _a[1], b = _a[2];
2331
- return pack(r, g, b, 1);
2332
- }
2333
- if (tokens.length === 4) {
2334
- var _b = tokens.map(getTokenColorValue), r = _b[0], g = _b[1], b = _b[2], a = _b[3];
2335
- return pack(r, g, b, a);
2336
- }
2337
- return 0;
2287
+ var isRelativeTransform = function (tokens) {
2288
+ return (tokens[0].type === 20 /* TokenType.IDENT_TOKEN */ ? tokens[0].value : 'unknown') === 'from';
2289
+ };
2290
+ var clamp = function (value, min, max) {
2291
+ return Math.min(Math.max(value, min), max);
2292
+ };
2293
+ var multiplyMatrices = function (A, B) {
2294
+ return [
2295
+ A[0] * B[0] + A[1] * B[1] + A[2] * B[2],
2296
+ A[3] * B[0] + A[4] * B[1] + A[5] * B[2],
2297
+ A[6] * B[0] + A[7] * B[1] + A[8] * B[2]
2298
+ ];
2338
2299
  };
2339
- function hue2rgb(t1, t2, hue) {
2300
+ var packSrgb = function (args) {
2301
+ return pack(clamp(Math.round(args[0] * 255), 0, 255), clamp(Math.round(args[1] * 255), 0, 255), clamp(Math.round(args[2] * 255), 0, 255), clamp(args[3], 0, 1));
2302
+ };
2303
+ var packSrgbLinear = function (_a) {
2304
+ var r = _a[0], g = _a[1], b = _a[2], a = _a[3];
2305
+ var rgb = srgbLinear2rgb([r, g, b]);
2306
+ return pack(clamp(Math.round(rgb[0] * 255), 0, 255), clamp(Math.round(rgb[1] * 255), 0, 255), clamp(Math.round(rgb[2] * 255), 0, 255), a);
2307
+ };
2308
+ var packXYZ = function (args) {
2309
+ var srgb_linear = xyz2rgbLinear([args[0], args[1], args[2]]);
2310
+ return packSrgbLinear([srgb_linear[0], srgb_linear[1], srgb_linear[2], args[3]]);
2311
+ };
2312
+ var packLab = function (_context, args) {
2313
+ if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
2314
+ throw new Error('Relative color not supported for lab()');
2315
+ }
2316
+ var _a = extractLabComponents(args), l = _a[0], a = _a[1], b = _a[2], alpha = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(lab2xyz([l, a, b])));
2317
+ return pack(clamp(Math.round(rgb[0] * 255), 0, 255), clamp(Math.round(rgb[1] * 255), 0, 255), clamp(Math.round(rgb[2] * 255), 0, 255), alpha);
2318
+ };
2319
+ var packOkLab = function (_context, args) {
2320
+ if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
2321
+ throw new Error('Relative color not supported for oklab()');
2322
+ }
2323
+ var _a = extractLabComponents(args), l = _a[0], a = _a[1], b = _a[2], alpha = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(oklab2xyz([l, a, b])));
2324
+ return pack(clamp(Math.round(rgb[0] * 255), 0, 255), clamp(Math.round(rgb[1] * 255), 0, 255), clamp(Math.round(rgb[2] * 255), 0, 255), alpha);
2325
+ };
2326
+ var packOkLch = function (_context, args) {
2327
+ if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
2328
+ throw new Error('Relative color not supported for oklch()');
2329
+ }
2330
+ var _a = extractOkLchComponents(args), l = _a[0], c = _a[1], h = _a[2], alpha = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(oklab2xyz(lch2lab([l, c, h]))));
2331
+ return pack(clamp(Math.round(rgb[0] * 255), 0, 255), clamp(Math.round(rgb[1] * 255), 0, 255), clamp(Math.round(rgb[2] * 255), 0, 255), alpha);
2332
+ };
2333
+ var packLch = function (_context, args) {
2334
+ if (isRelativeTransform(args.filter(nonFunctionArgSeparator))) {
2335
+ throw new Error('Relative color not supported for lch()');
2336
+ }
2337
+ var _a = extractLchComponents(args), l = _a[0], c = _a[1], h = _a[2], a = _a[3], rgb = srgbLinear2rgb(xyz2rgbLinear(lab2xyz(lch2lab([l, c, h]))));
2338
+ return pack(clamp(Math.round(rgb[0] * 255), 0, 255), clamp(Math.round(rgb[1] * 255), 0, 255), clamp(Math.round(rgb[2] * 255), 0, 255), a);
2339
+ };
2340
+ var extractHslComponents = function (context, args) {
2341
+ var tokens = args.filter(nonFunctionArgSeparator), hue = tokens[0], saturation = tokens[1], lightness = tokens[2], alpha = tokens[3], h = (hue.type === 17 /* TokenType.NUMBER_TOKEN */ ? deg(hue.number) : angle.parse(context, hue)) / (Math.PI * 2), s = isLengthPercentage(saturation) ? saturation.number / 100 : 0, l = isLengthPercentage(lightness) ? lightness.number / 100 : 0, a = typeof alpha !== 'undefined' && isLengthPercentage(alpha) ? getAbsoluteValue(alpha, 1) : 1;
2342
+ return [h, s, l, a];
2343
+ };
2344
+ var packHSL = function (context, args) {
2345
+ if (isRelativeTransform(args)) {
2346
+ throw new Error('Relative color not supported for hsl()');
2347
+ }
2348
+ var _a = extractHslComponents(context, args), h = _a[0], s = _a[1], l = _a[2], a = _a[3], rgb = hsl2rgb([h, s, l]);
2349
+ return pack(rgb[0] * 255, rgb[1] * 255, rgb[2] * 255, s === 0 ? 1 : a);
2350
+ };
2351
+ var extractLchComponents = function (args) {
2352
+ var tokens = args.filter(nonFunctionArgSeparator), l = isLengthPercentage(tokens[0]) ? tokens[0].number : 0, c = isLengthPercentage(tokens[1]) ? tokens[1].number : 0, h = isNumberToken(tokens[2]) || isDimensionToken(tokens[2]) ? tokens[2].number : 0, a = typeof tokens[4] !== 'undefined' && isLengthPercentage(tokens[4]) ? getAbsoluteValue(tokens[4], 1) : 1;
2353
+ return [l, c, h, a];
2354
+ };
2355
+ var extractLabComponents = function (args) {
2356
+ var tokens = args.filter(nonFunctionArgSeparator),
2357
+ // eslint-disable-next-line prettier/prettier
2358
+ l = tokens[0].type === 16 /* TokenType.PERCENTAGE_TOKEN */
2359
+ ? tokens[0].number / 100
2360
+ : isNumberToken(tokens[0])
2361
+ ? tokens[0].number
2362
+ : 0,
2363
+ // eslint-disable-next-line prettier/prettier
2364
+ a = tokens[1].type === 16 /* TokenType.PERCENTAGE_TOKEN */
2365
+ ? tokens[1].number / 100
2366
+ : isNumberToken(tokens[1])
2367
+ ? tokens[1].number
2368
+ : 0, b = isNumberToken(tokens[2]) || isDimensionToken(tokens[2]) ? tokens[2].number : 0, alpha = typeof tokens[4] !== 'undefined' && isLengthPercentage(tokens[4]) ? getAbsoluteValue(tokens[4], 1) : 1;
2369
+ return [l, a, b, alpha];
2370
+ };
2371
+ var extractOkLchComponents = function (args) {
2372
+ var tokens = args.filter(nonFunctionArgSeparator),
2373
+ // eslint-disable-next-line prettier/prettier
2374
+ l = tokens[0].type === 16 /* TokenType.PERCENTAGE_TOKEN */
2375
+ ? tokens[0].number / 100
2376
+ : isNumberToken(tokens[0])
2377
+ ? tokens[0].number
2378
+ : 0,
2379
+ // eslint-disable-next-line prettier/prettier
2380
+ c = tokens[1].type === 16 /* TokenType.PERCENTAGE_TOKEN */
2381
+ ? tokens[1].number / 100
2382
+ : isNumberToken(tokens[1])
2383
+ ? tokens[1].number
2384
+ : 0, h = isNumberToken(tokens[2]) || isDimensionToken(tokens[2]) ? tokens[2].number : 0, a = typeof tokens[4] !== 'undefined' && isLengthPercentage(tokens[4]) ? getAbsoluteValue(tokens[4], 1) : 1;
2385
+ return [l, c, h, a];
2386
+ };
2387
+ /**
2388
+ * Convert D65 to D50
2389
+ *
2390
+ * @param xyz
2391
+ */
2392
+ var d65toD50 = function (xyz) {
2393
+ return multiplyMatrices(
2394
+ // eslint-disable-next-line prettier/prettier
2395
+ [
2396
+ 1.0479297925449969, 0.022946870601609652, -0.05019226628920524, 0.02962780877005599, 0.9904344267538799,
2397
+ -0.017073799063418826, -0.009243040646204504, 0.015055191490298152, 0.7518742814281371
2398
+ ], xyz);
2399
+ };
2400
+ /**
2401
+ * Convert D50 to D65
2402
+ *
2403
+ * @param xyz
2404
+ */
2405
+ var d50toD65 = function (xyz) {
2406
+ return multiplyMatrices(
2407
+ // eslint-disable-next-line prettier/prettier
2408
+ [
2409
+ 0.955473421488075, -0.02309845494876471, 0.06325924320057072, -0.0283697093338637, 1.0099953980813041,
2410
+ 0.021041441191917323, 0.012314014864481998, -0.020507649298898964, 1.330365926242124
2411
+ ], xyz);
2412
+ };
2413
+ var hue2rgb = function (t1, t2, hue) {
2340
2414
  if (hue < 0) {
2341
2415
  hue += 1;
2342
2416
  }
@@ -2355,29 +2429,783 @@ var Reportly = (function () {
2355
2429
  else {
2356
2430
  return t1;
2357
2431
  }
2358
- }
2359
- var hsl = function (context, args) {
2360
- var tokens = args.filter(nonFunctionArgSeparator);
2361
- var hue = tokens[0], saturation = tokens[1], lightness = tokens[2], alpha = tokens[3];
2362
- var h = (hue.type === 17 /* NUMBER_TOKEN */ ? deg(hue.number) : angle.parse(context, hue)) / (Math.PI * 2);
2363
- var s = isLengthPercentage(saturation) ? saturation.number / 100 : 0;
2364
- var l = isLengthPercentage(lightness) ? lightness.number / 100 : 0;
2365
- var a = typeof alpha !== 'undefined' && isLengthPercentage(alpha) ? getAbsoluteValue(alpha, 1) : 1;
2432
+ };
2433
+ var hsl2rgb = function (_a) {
2434
+ var h = _a[0], s = _a[1], l = _a[2];
2366
2435
  if (s === 0) {
2367
- return pack(l * 255, l * 255, l * 255, 1);
2436
+ return [l * 255, l * 255, l * 255];
2368
2437
  }
2369
- var t2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
2370
- var t1 = l * 2 - t2;
2371
- var r = hue2rgb(t1, t2, h + 1 / 3);
2372
- var g = hue2rgb(t1, t2, h);
2373
- var b = hue2rgb(t1, t2, h - 1 / 3);
2374
- return pack(r * 255, g * 255, b * 255, a);
2438
+ var t2 = l <= 0.5 ? l * (s + 1) : l + s - l * s, t1 = l * 2 - t2, r = hue2rgb(t1, t2, h + 1 / 3), g = hue2rgb(t1, t2, h), b = hue2rgb(t1, t2, h - 1 / 3);
2439
+ return [r, g, b];
2440
+ };
2441
+ /**
2442
+ * Convert lch to OKLab
2443
+ *
2444
+ * @param l
2445
+ * @param c
2446
+ * @param h
2447
+ */
2448
+ var lch2lab = function (_a) {
2449
+ var l = _a[0], c = _a[1], h = _a[2];
2450
+ if (c < 0) {
2451
+ c = 0;
2452
+ }
2453
+ if (isNaN(h)) {
2454
+ h = 0;
2455
+ }
2456
+ return [l, c * Math.cos((h * Math.PI) / 180), c * Math.sin((h * Math.PI) / 180)];
2457
+ };
2458
+ /**
2459
+ * Convert OKLab to XYZ relative to D65
2460
+ *
2461
+ * @param lab
2462
+ */
2463
+ var oklab2xyz = function (lab) {
2464
+ var LMSg = multiplyMatrices(
2465
+ // eslint-disable-next-line prettier/prettier
2466
+ [
2467
+ 1, 0.3963377773761749, 0.2158037573099136, 1, -0.1055613458156586, -0.0638541728258133, 1,
2468
+ -0.0894841775298119, -1.2914855480194092
2469
+ ], lab), LMS = LMSg.map(function (val) { return Math.pow(val, 3); });
2470
+ return multiplyMatrices(
2471
+ // eslint-disable-next-line prettier/prettier
2472
+ [
2473
+ 1.2268798758459243, -0.5578149944602171, 0.2813910456659647, -0.0405757452148008, 1.112286803280317,
2474
+ -0.0717110580655164, -0.0763729366746601, -0.4214933324022432, 1.5869240198367816
2475
+ ], LMS);
2476
+ };
2477
+ /**
2478
+ * Convert Lab to D50-adapted XYZ
2479
+ *
2480
+ * @param lab
2481
+ */
2482
+ var lab2xyz = function (lab) {
2483
+ var fy = (lab[0] + 16) / 116, fx = lab[1] / 500 + fy, fz = fy - lab[2] / 200, k = 24389 / 27, e = 24 / 116, xyz = [
2484
+ ((fx > e ? Math.pow(fx, 3) : (116 * fx - 16) / k) * 0.3457) / 0.3585,
2485
+ lab[0] > 8 ? Math.pow(fy, 3) : lab[0] / k,
2486
+ ((fz > e ? Math.pow(fz, 3) : (116 * fz - 16) / k) * (1.0 - 0.3457 - 0.3585)) / 0.3585
2487
+ ];
2488
+ return d50toD65([xyz[0], xyz[1], xyz[2]]);
2489
+ };
2490
+ /**
2491
+ * Convert RGB to XYZ
2492
+ *
2493
+ * @param _context
2494
+ * @param args
2495
+ */
2496
+ var rgbToXyz = function (_context, args) {
2497
+ var tokens = args.filter(nonFunctionArgSeparator);
2498
+ if (tokens.length === 3) {
2499
+ var _a = tokens.map(getTokenColorValue), r = _a[0], g = _a[1], b = _a[2], rgb_linear = rgb2rgbLinear([r / 255, g / 255, b / 255]), _b = rgbLinear2xyz([rgb_linear[0], rgb_linear[1], rgb_linear[2]]), x = _b[0], y = _b[1], z = _b[2];
2500
+ return [x, y, z, 1];
2501
+ }
2502
+ if (tokens.length === 4) {
2503
+ var _c = tokens.map(getTokenColorValue), r = _c[0], g = _c[1], b = _c[2], a = _c[3], rgb_linear = rgb2rgbLinear([r / 255, g / 255, b / 255]), _d = rgbLinear2xyz([rgb_linear[0], rgb_linear[1], rgb_linear[2]]), x = _d[0], y = _d[1], z = _d[2];
2504
+ return [x, y, z, a];
2505
+ }
2506
+ return [0, 0, 0, 1];
2507
+ };
2508
+ /**
2509
+ * HSL to XYZ
2510
+ *
2511
+ * @param context
2512
+ * @param args
2513
+ */
2514
+ var hslToXyz = function (context, args) {
2515
+ var _a = extractHslComponents(context, args), h = _a[0], s = _a[1], l = _a[2], a = _a[3], rgb_linear = rgb2rgbLinear(hsl2rgb([h, s, l])), _b = rgbLinear2xyz([rgb_linear[0], rgb_linear[1], rgb_linear[2]]), x = _b[0], y = _b[1], z = _b[2];
2516
+ return [x, y, z, a];
2517
+ };
2518
+ /**
2519
+ * LAB to XYZ
2520
+ *
2521
+ * @param _context
2522
+ * @param args
2523
+ */
2524
+ var labToXyz = function (_context, args) {
2525
+ var _a = extractLabComponents(args), l = _a[0], a = _a[1], b = _a[2], alpha = _a[3], _b = lab2xyz([l, a, b]), x = _b[0], y = _b[1], z = _b[2];
2526
+ return [x, y, z, alpha];
2527
+ };
2528
+ /**
2529
+ * LCH to XYZ
2530
+ *
2531
+ * @param _context
2532
+ * @param args
2533
+ */
2534
+ var lchToXyz = function (_context, args) {
2535
+ var _a = extractLchComponents(args), l = _a[0], c = _a[1], h = _a[2], alpha = _a[3], _b = lab2xyz(lch2lab([l, c, h])), x = _b[0], y = _b[1], z = _b[2];
2536
+ return [x, y, z, alpha];
2537
+ };
2538
+ /**
2539
+ * OKLch to XYZ
2540
+ *
2541
+ * @param _context
2542
+ * @param args
2543
+ */
2544
+ var oklchToXyz = function (_context, args) {
2545
+ var _a = extractOkLchComponents(args), l = _a[0], c = _a[1], h = _a[2], alpha = _a[3], _b = oklab2xyz(lch2lab([l, c, h])), x = _b[0], y = _b[1], z = _b[2];
2546
+ return [x, y, z, alpha];
2547
+ };
2548
+ /**
2549
+ * OKLab to XYZ
2550
+ *
2551
+ * @param _context
2552
+ * @param args
2553
+ */
2554
+ var oklabToXyz = function (_context, args) {
2555
+ var _a = extractLabComponents(args), l = _a[0], c = _a[1], h = _a[2], alpha = _a[3], _b = oklab2xyz([l, c, h]), x = _b[0], y = _b[1], z = _b[2];
2556
+ return [x, y, z, alpha];
2557
+ };
2558
+ /**
2559
+ * XYZ-50 to XYZ
2560
+ *
2561
+ * @param args
2562
+ */
2563
+ var xyz50ToXYZ = function (args) {
2564
+ return d50toD65([args[0], args[1], args[2]]);
2565
+ };
2566
+ /**
2567
+ * Does nothing, required for SUPPORTED_COLOR_SPACES_FROM_XYZ in the _color() function
2568
+ *
2569
+ * @param args
2570
+ */
2571
+ var xyzFromXYZ = function (args) {
2572
+ return args;
2573
+ };
2574
+ /**
2575
+ * XYZ-65 to XYZ-50
2576
+ *
2577
+ * @param args
2578
+ */
2579
+ var xyz50FromXYZ = function (args) {
2580
+ var _a = d65toD50([args[0], args[2], args[3]]), x = _a[0], y = _a[1], z = _a[2];
2581
+ return [x, y, z, args[3]];
2582
+ };
2583
+ /**
2584
+ * Convert XYZ to SRGB and Pack
2585
+ *
2586
+ * @param args
2587
+ */
2588
+ var convertXyz = function (args) {
2589
+ return packXYZ([args[0], args[1], args[2], args[3]]);
2590
+ };
2591
+ /**
2592
+ * Convert XYZ-50 to SRGB and Pack
2593
+ *
2594
+ * @param args
2595
+ */
2596
+ var convertXyz50 = function (args) {
2597
+ var xyz = xyz50ToXYZ([args[0], args[1], args[2]]);
2598
+ return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
2599
+ };
2600
+
2601
+ /**
2602
+ * SRGB related functions
2603
+ */
2604
+ /**
2605
+ * Convert XYZ to linear-light sRGB
2606
+ *
2607
+ * @param xyz
2608
+ */
2609
+ var xyz2rgbLinear = function (xyz) {
2610
+ return multiplyMatrices(
2611
+ // eslint-disable-next-line prettier/prettier
2612
+ [
2613
+ 3.2409699419045226, -1.537383177570094, -0.4986107602930034, -0.9692436362808796, 1.8759675015077202,
2614
+ 0.04155505740717559, 0.05563007969699366, -0.20397695888897652, 1.0569715142428786
2615
+ ], xyz);
2616
+ };
2617
+ /**
2618
+ * Convert XYZ to linear-light sRGB
2619
+ *
2620
+ * @param xyz
2621
+ */
2622
+ var rgbLinear2xyz = function (xyz) {
2623
+ return multiplyMatrices(
2624
+ // eslint-disable-next-line prettier/prettier
2625
+ [
2626
+ 0.41239079926595934, 0.357584339383878, 0.1804807884018343, 0.21263900587151027, 0.715168678767756,
2627
+ 0.07219231536073371, 0.01933081871559182, 0.11919477979462598, 0.9505321522496607
2628
+ ], xyz);
2629
+ };
2630
+ /**
2631
+ * Convert sRGB to RGB
2632
+ *
2633
+ * @param rgb
2634
+ */
2635
+ var srgbLinear2rgb = function (rgb) {
2636
+ return rgb.map(function (c) {
2637
+ var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
2638
+ // eslint-disable-next-line prettier/prettier
2639
+ return abs > 0.0031308 ? sign * (1.055 * Math.pow(abs, (1 / 2.4)) - 0.055) : 12.92 * c;
2640
+ });
2641
+ };
2642
+ /**
2643
+ * Convert RGB to sRGB
2644
+ *
2645
+ * @param rgb
2646
+ */
2647
+ var rgb2rgbLinear = function (rgb) {
2648
+ return rgb.map(function (c) {
2649
+ var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
2650
+ // eslint-disable-next-line prettier/prettier
2651
+ return abs <= 0.04045 ? c / 12.92 : sign * Math.pow(((abs + 0.055) / 1.055), 2.4);
2652
+ });
2653
+ };
2654
+ /**
2655
+ * XYZ to SRGB
2656
+ *
2657
+ * @param args
2658
+ */
2659
+ var srgbFromXYZ = function (args) {
2660
+ var _a = srgbLinear2rgb(xyz2rgbLinear([args[0], args[1], args[2]])), r = _a[0], g = _a[1], b = _a[2];
2661
+ return [r, g, b, args[3]];
2662
+ };
2663
+ /**
2664
+ * XYZ to SRGB-Linear
2665
+ * @param args
2666
+ */
2667
+ var srgbLinearFromXYZ = function (args) {
2668
+ var _a = xyz2rgbLinear([args[0], args[1], args[2]]), r = _a[0], g = _a[1], b = _a[2];
2669
+ return [
2670
+ clamp(Math.round(r * 255), 0, 255),
2671
+ clamp(Math.round(g * 255), 0, 255),
2672
+ clamp(Math.round(b * 255), 0, 255),
2673
+ args[3]
2674
+ ];
2675
+ };
2676
+
2677
+ /**
2678
+ * Display-P3 related functions
2679
+ */
2680
+ /**
2681
+ * Convert P3 Linear to xyz
2682
+ *
2683
+ * @param p3l
2684
+ */
2685
+ var p3LinearToXyz = function (p3l) {
2686
+ return multiplyMatrices(
2687
+ // eslint-disable-next-line prettier/prettier
2688
+ [
2689
+ 0.4865709486482162, 0.26566769316909306, 0.1982172852343625, 0.2289745640697488, 0.6917385218365064,
2690
+ 0.079286914093745, 0.0, 0.04511338185890264, 1.043944368900976
2691
+ ], p3l);
2692
+ };
2693
+ /**
2694
+ * Convert XYZ to P3 Linear
2695
+ *
2696
+ * @param xyz
2697
+ */
2698
+ var xyzToP3Linear = function (xyz) {
2699
+ return multiplyMatrices(
2700
+ // eslint-disable-next-line prettier/prettier
2701
+ [
2702
+ 2.493496911941425, -0.9313836179191239, -0.40271078445071684, -0.8294889695615747, 1.7626640603183463,
2703
+ 0.023624685841943577, 0.03584583024378447, -0.07617238926804182, 0.9568845240076872
2704
+ ], xyz);
2705
+ };
2706
+ /**
2707
+ * Convert P3 to P3 linear
2708
+ *
2709
+ * @param p3
2710
+ */
2711
+ var p32p3Linear = function (p3) {
2712
+ return p3.map(function (c) {
2713
+ var sign = c < 0 ? -1 : 1, abs = c * sign;
2714
+ if (abs <= 0.04045) {
2715
+ return c / 12.92;
2716
+ }
2717
+ // eslint-disable-next-line prettier/prettier
2718
+ return sign * Math.pow(((c + 0.055) / 1.055), 2.4) || 0;
2719
+ });
2720
+ };
2721
+ /**
2722
+ * Convert P3 Linear to P3
2723
+ *
2724
+ * @param p3l
2725
+ */
2726
+ var p3Linear2p3 = function (p3l) {
2727
+ return srgbLinear2rgb(p3l);
2728
+ };
2729
+ /**
2730
+ * Convert P3 to XYZ
2731
+ *
2732
+ * @param args
2733
+ */
2734
+ var p3ToXYZ = function (args) {
2735
+ var p3_linear = p32p3Linear([args[0], args[1], args[2]]);
2736
+ return p3LinearToXyz([p3_linear[0], p3_linear[1], p3_linear[2]]);
2737
+ };
2738
+ /**
2739
+ * Convert XYZ to P3
2740
+ *
2741
+ * @param args
2742
+ */
2743
+ var p3FromXYZ = function (args) {
2744
+ var _a = p3Linear2p3(xyzToP3Linear([args[0], args[1], args[2]])), r = _a[0], g = _a[1], b = _a[2];
2745
+ return [r, g, b, args[3]];
2746
+ };
2747
+ /**
2748
+ * Convert P3 to SRGB and Pack
2749
+ *
2750
+ * @param args
2751
+ */
2752
+ var convertP3 = function (args) {
2753
+ var xyz = p3ToXYZ([args[0], args[1], args[2]]);
2754
+ return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
2755
+ };
2756
+
2757
+ /**
2758
+ * A98-RGB related functions
2759
+ */
2760
+ /**
2761
+ * Convert XYZ to a98 linear
2762
+ *
2763
+ * @param xyz
2764
+ */
2765
+ var xyz2a98Linear = function (xyz) {
2766
+ return multiplyMatrices(
2767
+ // eslint-disable-next-line prettier/prettier
2768
+ [
2769
+ 2.0415879038107465, -0.5650069742788596, -0.34473135077832956, -0.9692436362808795, 1.8759675015077202,
2770
+ 0.04155505740717557, 0.013444280632031142, -0.11836239223101838, 1.0151749943912054
2771
+ ], xyz);
2772
+ };
2773
+ /**
2774
+ * Convert XYZ to a98 linear
2775
+ *
2776
+ * @param a98
2777
+ */
2778
+ var a98Linear2xyz = function (a98) {
2779
+ return multiplyMatrices(
2780
+ // eslint-disable-next-line prettier/prettier
2781
+ [
2782
+ 0.5766690429101305, 0.1855582379065463, 0.1882286462349947, 0.29734497525053605, 0.6273635662554661,
2783
+ 0.0752914584939978, 0.02703136138641234, 0.07068885253582723, 0.9913375368376388
2784
+ ], a98);
2785
+ };
2786
+ /**
2787
+ * Convert A98 RGB to rgb linear
2788
+ *
2789
+ * @param rgb
2790
+ */
2791
+ var a982a98Linear = function (rgb) {
2792
+ var mapped = rgb.map(function (c) {
2793
+ var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
2794
+ return sign * Math.pow(abs, (563 / 256));
2795
+ });
2796
+ return [mapped[0], mapped[1], mapped[2]];
2797
+ };
2798
+ /**
2799
+ * Convert A98 RGB Linear to A98
2800
+ *
2801
+ * @param rgb
2802
+ */
2803
+ var a98Linear2a98 = function (rgb) {
2804
+ var mapped = rgb.map(function (c) {
2805
+ var sign = c < 0 ? -1 : 1, abs = Math.abs(c);
2806
+ return sign * Math.pow(abs, (256 / 563));
2807
+ });
2808
+ return [mapped[0], mapped[1], mapped[2]];
2809
+ };
2810
+ /**
2811
+ * Convert XYZ to A98
2812
+ *
2813
+ * @param args
2814
+ */
2815
+ var a98FromXYZ = function (args) {
2816
+ var _a = a98Linear2a98(xyz2a98Linear([args[0], args[1], args[2]])), r = _a[0], g = _a[1], b = _a[2];
2817
+ return [r, g, b, args[3]];
2818
+ };
2819
+ /**
2820
+ * Convert A98 to XYZ and Pack
2821
+ *
2822
+ * @param args
2823
+ */
2824
+ var convertA98rgb = function (args) {
2825
+ var srgb_linear = xyz2rgbLinear(a98Linear2xyz(a982a98Linear([args[0], args[1], args[2]])));
2826
+ return packSrgbLinear([srgb_linear[0], srgb_linear[1], srgb_linear[2], args[3]]);
2827
+ };
2828
+
2829
+ /**
2830
+ * Pro Photo related functions
2831
+ */
2832
+ /**
2833
+ * Convert linear-light display-p3 to XYZ D65
2834
+ *
2835
+ * @param p3
2836
+ */
2837
+ var proPhotoLinearToXyz = function (p3) {
2838
+ return multiplyMatrices(
2839
+ // eslint-disable-next-line prettier/prettier
2840
+ [
2841
+ 0.7977666449006423, 0.13518129740053308, 0.0313477341283922, 0.2880748288194013, 0.711835234241873,
2842
+ 0.00008993693872564, 0.0, 0.0, 0.8251046025104602
2843
+ ], p3);
2844
+ };
2845
+ /**
2846
+ * Convert XYZ D65 to linear-light display-p3
2847
+ *
2848
+ * @param xyz
2849
+ */
2850
+ var xyzToProPhotoLinear = function (xyz) {
2851
+ return multiplyMatrices(
2852
+ // eslint-disable-next-line prettier/prettier
2853
+ [
2854
+ 1.3457868816471583, -0.25557208737979464, -0.05110186497554526, -0.5446307051249019, 1.5082477428451468,
2855
+ 0.02052744743642139, 0.0, 0.0, 1.2119675456389452
2856
+ ], xyz);
2857
+ };
2858
+ /**
2859
+ * Convert Pro-Photo to Pro-Photo Linear
2860
+ *
2861
+ * @param p3
2862
+ */
2863
+ var proPhotoToProPhotoLinear = function (p3) {
2864
+ return p3.map(function (c) {
2865
+ return c < 16 / 512 ? c / 16 : Math.pow(c, 1.8);
2866
+ });
2867
+ };
2868
+ /**
2869
+ * Convert Pro-Photo Linear to Pro-Photo
2870
+ *
2871
+ * @param p3
2872
+ */
2873
+ var proPhotoLinearToProPhoto = function (p3) {
2874
+ return p3.map(function (c) {
2875
+ return c > 1 / 512 ? Math.pow(c, (1 / 1.8)) : c * 16;
2876
+ });
2877
+ };
2878
+ /**
2879
+ * Convert Pro-Photo to XYZ
2880
+ *
2881
+ * @param args
2882
+ */
2883
+ var proPhotoToXYZ = function (args) {
2884
+ var prophoto_linear = proPhotoToProPhotoLinear([args[0], args[1], args[2]]);
2885
+ return d50toD65(proPhotoLinearToXyz([prophoto_linear[0], prophoto_linear[1], prophoto_linear[2]]));
2886
+ };
2887
+ /**
2888
+ * Convert XYZ to Pro-Photo
2889
+ *
2890
+ * @param args
2891
+ */
2892
+ var proPhotoFromXYZ = function (args) {
2893
+ var _a = proPhotoLinearToProPhoto(xyzToProPhotoLinear(d65toD50([args[0], args[1], args[2]]))), r = _a[0], g = _a[1], b = _a[2];
2894
+ return [r, g, b, args[3]];
2895
+ };
2896
+ /**
2897
+ * Convert Pro-Photo to XYZ and Pack
2898
+ *
2899
+ * @param args
2900
+ */
2901
+ var convertProPhoto = function (args) {
2902
+ var xyz = proPhotoToXYZ([args[0], args[1], args[2]]);
2903
+ return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
2904
+ };
2905
+
2906
+ /**
2907
+ * REC2020 related functions
2908
+ */
2909
+ var _a = 1.09929682680944;
2910
+ var _b = 0.018053968510807;
2911
+ /**
2912
+ * Convert rec2020 to rec2020 linear
2913
+ *
2914
+ * @param rgb
2915
+ */
2916
+ var rec20202rec2020Linear = function (rgb) {
2917
+ return rgb.map(function (c) {
2918
+ return c < _b * 4.5 ? c / 4.5 : Math.pow((c + _a - 1) / _a, 1 / 0.45);
2919
+ });
2920
+ };
2921
+ /**
2922
+ * Convert rec2020 linear to rec2020
2923
+ *
2924
+ * @param rgb
2925
+ */
2926
+ var rec2020Linear2rec2020 = function (rgb) {
2927
+ return rgb.map(function (c) {
2928
+ return c >= _b ? _a * Math.pow(c, 0.45) - (_a - 1) : 4.5 * c;
2929
+ });
2930
+ };
2931
+ /**
2932
+ * Convert rec2020 linear to XYZ D65
2933
+ *
2934
+ * @param rec
2935
+ */
2936
+ var rec2020LinearToXyz = function (rec) {
2937
+ return multiplyMatrices(
2938
+ // eslint-disable-next-line prettier/prettier
2939
+ [
2940
+ 0.6369580483012914, 0.14461690358620832, 0.1688809751641721, 0.2627002120112671, 0.6779980715188708,
2941
+ 0.05930171646986196, 0.0, 0.028072693049087428, 1.060985057710791
2942
+ ], rec);
2943
+ };
2944
+ /**
2945
+ * Convert XYZ D65 to rec2020 linear
2946
+ *
2947
+ * @param xyz
2948
+ */
2949
+ var xyzToRec2020Linear = function (xyz) {
2950
+ return multiplyMatrices(
2951
+ // eslint-disable-next-line prettier/prettier
2952
+ [
2953
+ 1.716651187971268, -0.355670783776392, -0.25336628137366, -0.666684351832489, 1.616481236634939,
2954
+ 0.0157685458139111, 0.017639857445311, -0.042770613257809, 0.942103121235474
2955
+ ], xyz);
2956
+ };
2957
+ /**
2958
+ * Convert Rec2020 to XYZ
2959
+ *
2960
+ * @param args
2961
+ */
2962
+ var rec2020ToXYZ = function (args) {
2963
+ var rec2020_linear = rec20202rec2020Linear([args[0], args[1], args[2]]);
2964
+ return rec2020LinearToXyz([rec2020_linear[0], rec2020_linear[1], rec2020_linear[2]]);
2965
+ };
2966
+ /**
2967
+ * Convert XYZ to Rec2020
2968
+ *
2969
+ * @param args
2970
+ */
2971
+ var rec2020FromXYZ = function (args) {
2972
+ var _c = rec2020Linear2rec2020(xyzToRec2020Linear([args[0], args[1], args[2]])), r = _c[0], g = _c[1], b = _c[2];
2973
+ return [r, g, b, args[3]];
2974
+ };
2975
+ /**
2976
+ * Convert Rec2020 to SRGB and Pack
2977
+ *
2978
+ * @param args
2979
+ */
2980
+ var convertRec2020 = function (args) {
2981
+ var xyz = rec2020ToXYZ([args[0], args[1], args[2]]);
2982
+ return packXYZ([xyz[0], xyz[1], xyz[2], args[3]]);
2983
+ };
2984
+
2985
+ var color$1 = {
2986
+ name: 'color',
2987
+ parse: function (context, value) {
2988
+ if (value.type === 18 /* TokenType.FUNCTION */) {
2989
+ var colorFunction = SUPPORTED_COLOR_FUNCTIONS[value.name];
2990
+ if (typeof colorFunction === 'undefined') {
2991
+ throw new Error("Attempting to parse an unsupported color function \"".concat(value.name, "\""));
2992
+ }
2993
+ return colorFunction(context, value.values);
2994
+ }
2995
+ if (value.type === 5 /* TokenType.HASH_TOKEN */) {
2996
+ var _a = hash2rgb(value), r = _a[0], g = _a[1], b = _a[2], a = _a[3];
2997
+ return pack(r, g, b, a);
2998
+ }
2999
+ if (value.type === 20 /* TokenType.IDENT_TOKEN */) {
3000
+ var namedColor = COLORS[value.value.toUpperCase()];
3001
+ if (typeof namedColor !== 'undefined') {
3002
+ return namedColor;
3003
+ }
3004
+ }
3005
+ return COLORS.TRANSPARENT;
3006
+ }
3007
+ };
3008
+ var hash2rgb = function (token) {
3009
+ if (token.value.length === 3) {
3010
+ var r = token.value.substring(0, 1);
3011
+ var g = token.value.substring(1, 2);
3012
+ var b = token.value.substring(2, 3);
3013
+ return [parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), 1];
3014
+ }
3015
+ if (token.value.length === 4) {
3016
+ var r = token.value.substring(0, 1);
3017
+ var g = token.value.substring(1, 2);
3018
+ var b = token.value.substring(2, 3);
3019
+ var a = token.value.substring(3, 4);
3020
+ return [parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a + a, 16) / 255];
3021
+ }
3022
+ if (token.value.length === 6) {
3023
+ var r = token.value.substring(0, 2);
3024
+ var g = token.value.substring(2, 4);
3025
+ var b = token.value.substring(4, 6);
3026
+ return [parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1];
3027
+ }
3028
+ if (token.value.length === 8) {
3029
+ var r = token.value.substring(0, 2);
3030
+ var g = token.value.substring(2, 4);
3031
+ var b = token.value.substring(4, 6);
3032
+ var a = token.value.substring(6, 8);
3033
+ return [parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a, 16) / 255];
3034
+ }
3035
+ return [0, 0, 0, 1];
3036
+ };
3037
+ var rgb = function (_context, args) {
3038
+ var tokens = args.filter(nonFunctionArgSeparator);
3039
+ if (isRelativeTransform(tokens)) {
3040
+ throw new Error('Relative color not supported for rgb()');
3041
+ }
3042
+ if (tokens.length === 3) {
3043
+ var _a = tokens.map(getTokenColorValue), r = _a[0], g = _a[1], b = _a[2];
3044
+ return pack(r, g, b, 1);
3045
+ }
3046
+ if (tokens.length === 4) {
3047
+ var _b = tokens.map(getTokenColorValue), r = _b[0], g = _b[1], b = _b[2], a = _b[3];
3048
+ return pack(r, g, b, a);
3049
+ }
3050
+ return 0;
3051
+ };
3052
+ /**
3053
+ * Handle the CSS color() function
3054
+ *
3055
+ * @param context
3056
+ * @param args
3057
+ */
3058
+ var _color = function (context, args) {
3059
+ var tokens = args.filter(nonFunctionArgSeparator), token_1_value = tokens[0].type === 20 /* TokenType.IDENT_TOKEN */ ? tokens[0].value : 'unknown', is_absolute = !isRelativeTransform(tokens);
3060
+ if (is_absolute) {
3061
+ var color_space = token_1_value, colorSpaceFunction = SUPPORTED_COLOR_SPACES_ABSOLUTE[color_space];
3062
+ if (typeof colorSpaceFunction === 'undefined') {
3063
+ throw new Error("Attempting to parse an unsupported color space \"".concat(color_space, "\" for color() function"));
3064
+ }
3065
+ var c1 = isNumberToken(tokens[1]) ? tokens[1].number : 0, c2 = isNumberToken(tokens[2]) ? tokens[2].number : 0, c3 = isNumberToken(tokens[3]) ? tokens[3].number : 0, a = tokens.length > 4 &&
3066
+ tokens[4].type === 6 /* TokenType.DELIM_TOKEN */ &&
3067
+ tokens[4].value === '/' &&
3068
+ isNumberToken(tokens[5])
3069
+ ? tokens[5].number
3070
+ : 1;
3071
+ return colorSpaceFunction([c1, c2, c3, a]);
3072
+ }
3073
+ else {
3074
+ var extractComponent = function (color, token) {
3075
+ if (isNumberToken(token)) {
3076
+ return token.number;
3077
+ }
3078
+ var posFromVal = function (value) {
3079
+ return value === 'r' || value === 'x' ? 0 : value === 'g' || value === 'y' ? 1 : 2;
3080
+ };
3081
+ if (isIdentToken(token)) {
3082
+ var position = posFromVal(token.value);
3083
+ return color[position];
3084
+ }
3085
+ var parseCalc = function (args) {
3086
+ var parts = args.filter(nonFunctionArgSeparator);
3087
+ var expression = '(';
3088
+ for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
3089
+ var part = parts_1[_i];
3090
+ expression +=
3091
+ part.type === 18 /* TokenType.FUNCTION */ && part.name === 'calc'
3092
+ ? parseCalc(part.values)
3093
+ : isNumberToken(part)
3094
+ ? part.number
3095
+ : part.type === 6 /* TokenType.DELIM_TOKEN */ || isIdentToken(part)
3096
+ ? part.value
3097
+ : '';
3098
+ }
3099
+ expression += ')';
3100
+ return expression;
3101
+ };
3102
+ if (token.type === 18 /* TokenType.FUNCTION */) {
3103
+ var args_1 = token.values.filter(nonFunctionArgSeparator);
3104
+ if (token.name === 'calc') {
3105
+ var expression = parseCalc(args_1)
3106
+ .replace(/r|x/, color[0].toString())
3107
+ .replace(/g|y/, color[1].toString())
3108
+ .replace(/b|z/, color[2].toString());
3109
+ return new Function('return ' + expression)();
3110
+ }
3111
+ }
3112
+ return null;
3113
+ };
3114
+ var from_colorspace = tokens[1].type === 18 /* TokenType.FUNCTION */
3115
+ ? tokens[1].name
3116
+ : isIdentToken(tokens[1]) || tokens[1].type === 5 /* TokenType.HASH_TOKEN */
3117
+ ? 'rgb'
3118
+ : 'unknown', to_colorspace = isIdentToken(tokens[2]) ? tokens[2].value : 'unknown';
3119
+ var from = tokens[1].type === 18 /* TokenType.FUNCTION */ ? tokens[1].values : isIdentToken(tokens[1]) ? [tokens[1]] : [];
3120
+ if (isIdentToken(tokens[1])) {
3121
+ var named_color = COLORS[tokens[1].value.toUpperCase()];
3122
+ if (typeof named_color === 'undefined') {
3123
+ throw new Error("Attempting to use unknown color in relative color 'from'");
3124
+ }
3125
+ else {
3126
+ var _c = parseColor(context, tokens[1].value), alpha = 0xff & _c, blue = 0xff & (_c >> 8), green = 0xff & (_c >> 16), red = 0xff & (_c >> 24);
3127
+ from = [
3128
+ { type: 17 /* TokenType.NUMBER_TOKEN */, number: red, flags: 1 },
3129
+ { type: 17 /* TokenType.NUMBER_TOKEN */, number: green, flags: 1 },
3130
+ { type: 17 /* TokenType.NUMBER_TOKEN */, number: blue, flags: 1 },
3131
+ { type: 17 /* TokenType.NUMBER_TOKEN */, number: alpha > 1 ? alpha / 255 : alpha, flags: 1 }
3132
+ ];
3133
+ }
3134
+ }
3135
+ else if (tokens[1].type === 5 /* TokenType.HASH_TOKEN */) {
3136
+ var _a = hash2rgb(tokens[1]), red = _a[0], green = _a[1], blue = _a[2], alpha = _a[3];
3137
+ from = [
3138
+ { type: 17 /* TokenType.NUMBER_TOKEN */, number: red, flags: 1 },
3139
+ { type: 17 /* TokenType.NUMBER_TOKEN */, number: green, flags: 1 },
3140
+ { type: 17 /* TokenType.NUMBER_TOKEN */, number: blue, flags: 1 },
3141
+ { type: 17 /* TokenType.NUMBER_TOKEN */, number: alpha > 1 ? alpha / 255 : alpha, flags: 1 }
3142
+ ];
3143
+ }
3144
+ if (from.length === 0) {
3145
+ throw new Error("Attempting to use unknown color in relative color 'from'");
3146
+ }
3147
+ if (to_colorspace === 'unknown') {
3148
+ throw new Error("Attempting to use unknown colorspace in relative color 'to'");
3149
+ }
3150
+ var fromColorToXyz = SUPPORTED_COLOR_SPACES_TO_XYZ[from_colorspace], toColorFromXyz = SUPPORTED_COLOR_SPACES_FROM_XYZ[to_colorspace], toColorPack = SUPPORTED_COLOR_SPACES_ABSOLUTE[to_colorspace];
3151
+ if (typeof fromColorToXyz === 'undefined') {
3152
+ throw new Error("Attempting to parse an unsupported color space \"".concat(from_colorspace, "\" for color() function"));
3153
+ }
3154
+ if (typeof toColorFromXyz === 'undefined') {
3155
+ throw new Error("Attempting to parse an unsupported color space \"".concat(to_colorspace, "\" for color() function"));
3156
+ }
3157
+ var from_color = fromColorToXyz(context, from), from_final_colorspace = toColorFromXyz(from_color), c1 = extractComponent(from_final_colorspace, tokens[3]), c2 = extractComponent(from_final_colorspace, tokens[4]), c3 = extractComponent(from_final_colorspace, tokens[5]), a = tokens.length > 6 &&
3158
+ tokens[6].type === 6 /* TokenType.DELIM_TOKEN */ &&
3159
+ tokens[6].value === '/' &&
3160
+ isNumberToken(tokens[7])
3161
+ ? tokens[7].number
3162
+ : 1;
3163
+ if (c1 === null || c2 === null || c3 === null) {
3164
+ throw new Error("Invalid relative color in color() function");
3165
+ }
3166
+ return toColorPack([c1, c2, c3, a]);
3167
+ }
3168
+ };
3169
+ var SUPPORTED_COLOR_SPACES_ABSOLUTE = {
3170
+ srgb: packSrgb,
3171
+ 'srgb-linear': packSrgbLinear,
3172
+ 'display-p3': convertP3,
3173
+ 'a98-rgb': convertA98rgb,
3174
+ 'prophoto-rgb': convertProPhoto,
3175
+ xyz: convertXyz,
3176
+ 'xyz-d50': convertXyz50,
3177
+ 'xyz-d65': convertXyz,
3178
+ rec2020: convertRec2020
3179
+ };
3180
+ var SUPPORTED_COLOR_SPACES_TO_XYZ = {
3181
+ rgb: rgbToXyz,
3182
+ hsl: hslToXyz,
3183
+ lab: labToXyz,
3184
+ lch: lchToXyz,
3185
+ oklab: oklabToXyz,
3186
+ oklch: oklchToXyz
3187
+ };
3188
+ var SUPPORTED_COLOR_SPACES_FROM_XYZ = {
3189
+ srgb: srgbFromXYZ,
3190
+ 'srgb-linear': srgbLinearFromXYZ,
3191
+ 'display-p3': p3FromXYZ,
3192
+ 'a98-rgb': a98FromXYZ,
3193
+ 'prophoto-rgb': proPhotoFromXYZ,
3194
+ xyz: xyzFromXYZ,
3195
+ 'xyz-d50': xyz50FromXYZ,
3196
+ 'xyz-d65': xyzFromXYZ,
3197
+ rec2020: rec2020FromXYZ
2375
3198
  };
2376
3199
  var SUPPORTED_COLOR_FUNCTIONS = {
2377
- hsl: hsl,
2378
- hsla: hsl,
3200
+ hsl: packHSL,
3201
+ hsla: packHSL,
2379
3202
  rgb: rgb,
2380
- rgba: rgb
3203
+ rgba: rgb,
3204
+ lch: packLch,
3205
+ oklch: packOkLch,
3206
+ oklab: packOkLab,
3207
+ lab: packLab,
3208
+ color: _color
2381
3209
  };
2382
3210
  var parseColor = function (context, value) {
2383
3211
  return color$1.parse(context, Parser.create(value).parseComponentValue());
@@ -2538,18 +3366,18 @@ var Reportly = (function () {
2538
3366
  name: 'background-clip',
2539
3367
  initialValue: 'border-box',
2540
3368
  prefix: false,
2541
- type: 1 /* LIST */,
3369
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
2542
3370
  parse: function (_context, tokens) {
2543
3371
  return tokens.map(function (token) {
2544
3372
  if (isIdentToken(token)) {
2545
3373
  switch (token.value) {
2546
3374
  case 'padding-box':
2547
- return 1 /* PADDING_BOX */;
3375
+ return 1 /* BACKGROUND_CLIP.PADDING_BOX */;
2548
3376
  case 'content-box':
2549
- return 2 /* CONTENT_BOX */;
3377
+ return 2 /* BACKGROUND_CLIP.CONTENT_BOX */;
2550
3378
  }
2551
3379
  }
2552
- return 0 /* BORDER_BOX */;
3380
+ return 0 /* BACKGROUND_CLIP.BORDER_BOX */;
2553
3381
  });
2554
3382
  }
2555
3383
  };
@@ -2558,7 +3386,7 @@ var Reportly = (function () {
2558
3386
  name: "background-color",
2559
3387
  initialValue: 'transparent',
2560
3388
  prefix: false,
2561
- type: 3 /* TYPE_VALUE */,
3389
+ type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
2562
3390
  format: 'color'
2563
3391
  };
2564
3392
 
@@ -2661,24 +3489,24 @@ var Reportly = (function () {
2661
3489
  var rx = 0;
2662
3490
  var ry = 0;
2663
3491
  switch (gradient.size) {
2664
- case 0 /* CLOSEST_SIDE */:
3492
+ case 0 /* CSSRadialExtent.CLOSEST_SIDE */:
2665
3493
  // The ending shape is sized so that that it exactly meets the side of the gradient box closest to the gradient’s center.
2666
3494
  // If the shape is an ellipse, it exactly meets the closest side in each dimension.
2667
- if (gradient.shape === 0 /* CIRCLE */) {
3495
+ if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
2668
3496
  rx = ry = Math.min(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
2669
3497
  }
2670
- else if (gradient.shape === 1 /* ELLIPSE */) {
3498
+ else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
2671
3499
  rx = Math.min(Math.abs(x), Math.abs(x - width));
2672
3500
  ry = Math.min(Math.abs(y), Math.abs(y - height));
2673
3501
  }
2674
3502
  break;
2675
- case 2 /* CLOSEST_CORNER */:
3503
+ case 2 /* CSSRadialExtent.CLOSEST_CORNER */:
2676
3504
  // The ending shape is sized so that that it passes through the corner of the gradient box closest to the gradient’s center.
2677
3505
  // If the shape is an ellipse, the ending shape is given the same aspect-ratio it would have if closest-side were specified.
2678
- if (gradient.shape === 0 /* CIRCLE */) {
3506
+ if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
2679
3507
  rx = ry = Math.min(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height));
2680
3508
  }
2681
- else if (gradient.shape === 1 /* ELLIPSE */) {
3509
+ else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
2682
3510
  // Compute the ratio ry/rx (which is to be the same as for "closest-side")
2683
3511
  var c = Math.min(Math.abs(y), Math.abs(y - height)) / Math.min(Math.abs(x), Math.abs(x - width));
2684
3512
  var _a = findCorner(width, height, x, y, true), cx = _a[0], cy = _a[1];
@@ -2686,23 +3514,23 @@ var Reportly = (function () {
2686
3514
  ry = c * rx;
2687
3515
  }
2688
3516
  break;
2689
- case 1 /* FARTHEST_SIDE */:
3517
+ case 1 /* CSSRadialExtent.FARTHEST_SIDE */:
2690
3518
  // Same as closest-side, except the ending shape is sized based on the farthest side(s)
2691
- if (gradient.shape === 0 /* CIRCLE */) {
3519
+ if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
2692
3520
  rx = ry = Math.max(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
2693
3521
  }
2694
- else if (gradient.shape === 1 /* ELLIPSE */) {
3522
+ else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
2695
3523
  rx = Math.max(Math.abs(x), Math.abs(x - width));
2696
3524
  ry = Math.max(Math.abs(y), Math.abs(y - height));
2697
3525
  }
2698
3526
  break;
2699
- case 3 /* FARTHEST_CORNER */:
3527
+ case 3 /* CSSRadialExtent.FARTHEST_CORNER */:
2700
3528
  // Same as closest-corner, except the ending shape is sized based on the farthest corner.
2701
3529
  // If the shape is an ellipse, the ending shape is given the same aspect ratio it would have if farthest-side were specified.
2702
- if (gradient.shape === 0 /* CIRCLE */) {
3530
+ if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
2703
3531
  rx = ry = Math.max(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height));
2704
3532
  }
2705
- else if (gradient.shape === 1 /* ELLIPSE */) {
3533
+ else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
2706
3534
  // Compute the ratio ry/rx (which is to be the same as for "farthest-side")
2707
3535
  var c = Math.max(Math.abs(y), Math.abs(y - height)) / Math.max(Math.abs(x), Math.abs(x - width));
2708
3536
  var _b = findCorner(width, height, x, y, false), cx = _b[0], cy = _b[1];
@@ -2724,7 +3552,7 @@ var Reportly = (function () {
2724
3552
  parseFunctionArgs(tokens).forEach(function (arg, i) {
2725
3553
  if (i === 0) {
2726
3554
  var firstToken = arg[0];
2727
- if (firstToken.type === 20 /* IDENT_TOKEN */ && firstToken.value === 'to') {
3555
+ if (firstToken.type === 20 /* TokenType.IDENT_TOKEN */ && firstToken.value === 'to') {
2728
3556
  angle$1 = parseNamedSide(arg);
2729
3557
  return;
2730
3558
  }
@@ -2736,7 +3564,7 @@ var Reportly = (function () {
2736
3564
  var colorStop = parseColorStop(context, arg);
2737
3565
  stops.push(colorStop);
2738
3566
  });
2739
- return { angle: angle$1, stops: stops, type: 1 /* LINEAR_GRADIENT */ };
3567
+ return { angle: angle$1, stops: stops, type: 1 /* CSSImageType.LINEAR_GRADIENT */ };
2740
3568
  };
2741
3569
 
2742
3570
  var prefixLinearGradient = function (context, tokens) {
@@ -2745,7 +3573,7 @@ var Reportly = (function () {
2745
3573
  parseFunctionArgs(tokens).forEach(function (arg, i) {
2746
3574
  if (i === 0) {
2747
3575
  var firstToken = arg[0];
2748
- if (firstToken.type === 20 /* IDENT_TOKEN */ &&
3576
+ if (firstToken.type === 20 /* TokenType.IDENT_TOKEN */ &&
2749
3577
  ['top', 'left', 'right', 'bottom'].indexOf(firstToken.value) !== -1) {
2750
3578
  angle$1 = parseNamedSide(arg);
2751
3579
  return;
@@ -2761,30 +3589,30 @@ var Reportly = (function () {
2761
3589
  return {
2762
3590
  angle: angle$1,
2763
3591
  stops: stops,
2764
- type: 1 /* LINEAR_GRADIENT */
3592
+ type: 1 /* CSSImageType.LINEAR_GRADIENT */
2765
3593
  };
2766
3594
  };
2767
3595
 
2768
3596
  var webkitGradient = function (context, tokens) {
2769
3597
  var angle = deg(180);
2770
3598
  var stops = [];
2771
- var type = 1 /* LINEAR_GRADIENT */;
2772
- var shape = 0 /* CIRCLE */;
2773
- var size = 3 /* FARTHEST_CORNER */;
3599
+ var type = 1 /* CSSImageType.LINEAR_GRADIENT */;
3600
+ var shape = 0 /* CSSRadialShape.CIRCLE */;
3601
+ var size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
2774
3602
  var position = [];
2775
3603
  parseFunctionArgs(tokens).forEach(function (arg, i) {
2776
3604
  var firstToken = arg[0];
2777
3605
  if (i === 0) {
2778
3606
  if (isIdentToken(firstToken) && firstToken.value === 'linear') {
2779
- type = 1 /* LINEAR_GRADIENT */;
3607
+ type = 1 /* CSSImageType.LINEAR_GRADIENT */;
2780
3608
  return;
2781
3609
  }
2782
3610
  else if (isIdentToken(firstToken) && firstToken.value === 'radial') {
2783
- type = 2 /* RADIAL_GRADIENT */;
3611
+ type = 2 /* CSSImageType.RADIAL_GRADIENT */;
2784
3612
  return;
2785
3613
  }
2786
3614
  }
2787
- if (firstToken.type === 18 /* FUNCTION */) {
3615
+ if (firstToken.type === 18 /* TokenType.FUNCTION */) {
2788
3616
  if (firstToken.name === 'from') {
2789
3617
  var color = color$1.parse(context, firstToken.values[0]);
2790
3618
  stops.push({ stop: ZERO_LENGTH, color: color });
@@ -2800,7 +3628,7 @@ var Reportly = (function () {
2800
3628
  var stop_1 = values[0];
2801
3629
  if (isNumberToken(stop_1)) {
2802
3630
  stops.push({
2803
- stop: { type: 16 /* PERCENTAGE_TOKEN */, number: stop_1.number * 100, flags: stop_1.flags },
3631
+ stop: { type: 16 /* TokenType.PERCENTAGE_TOKEN */, number: stop_1.number * 100, flags: stop_1.flags },
2804
3632
  color: color
2805
3633
  });
2806
3634
  }
@@ -2808,7 +3636,7 @@ var Reportly = (function () {
2808
3636
  }
2809
3637
  }
2810
3638
  });
2811
- return type === 1 /* LINEAR_GRADIENT */
3639
+ return type === 1 /* CSSImageType.LINEAR_GRADIENT */
2812
3640
  ? {
2813
3641
  angle: (angle + deg(180)) % deg(360),
2814
3642
  stops: stops,
@@ -2826,8 +3654,8 @@ var Reportly = (function () {
2826
3654
  var COVER = 'cover';
2827
3655
  var CONTAIN = 'contain';
2828
3656
  var radialGradient = function (context, tokens) {
2829
- var shape = 0 /* CIRCLE */;
2830
- var size = 3 /* FARTHEST_CORNER */;
3657
+ var shape = 0 /* CSSRadialShape.CIRCLE */;
3658
+ var size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
2831
3659
  var stops = [];
2832
3660
  var position = [];
2833
3661
  parseFunctionArgs(tokens).forEach(function (arg, i) {
@@ -2858,27 +3686,27 @@ var Reportly = (function () {
2858
3686
  else if (isIdentToken(token)) {
2859
3687
  switch (token.value) {
2860
3688
  case CIRCLE:
2861
- shape = 0 /* CIRCLE */;
3689
+ shape = 0 /* CSSRadialShape.CIRCLE */;
2862
3690
  return false;
2863
3691
  case ELLIPSE:
2864
- shape = 1 /* ELLIPSE */;
3692
+ shape = 1 /* CSSRadialShape.ELLIPSE */;
2865
3693
  return false;
2866
3694
  case 'at':
2867
3695
  isAtPosition_1 = true;
2868
3696
  return false;
2869
3697
  case CLOSEST_SIDE:
2870
- size = 0 /* CLOSEST_SIDE */;
3698
+ size = 0 /* CSSRadialExtent.CLOSEST_SIDE */;
2871
3699
  return false;
2872
3700
  case COVER:
2873
3701
  case FARTHEST_SIDE:
2874
- size = 1 /* FARTHEST_SIDE */;
3702
+ size = 1 /* CSSRadialExtent.FARTHEST_SIDE */;
2875
3703
  return false;
2876
3704
  case CONTAIN:
2877
3705
  case CLOSEST_CORNER:
2878
- size = 2 /* CLOSEST_CORNER */;
3706
+ size = 2 /* CSSRadialExtent.CLOSEST_CORNER */;
2879
3707
  return false;
2880
3708
  case FARTHEST_CORNER:
2881
- size = 3 /* FARTHEST_CORNER */;
3709
+ size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
2882
3710
  return false;
2883
3711
  }
2884
3712
  }
@@ -2897,12 +3725,12 @@ var Reportly = (function () {
2897
3725
  stops.push(colorStop);
2898
3726
  }
2899
3727
  });
2900
- return { size: size, shape: shape, stops: stops, position: position, type: 2 /* RADIAL_GRADIENT */ };
3728
+ return { size: size, shape: shape, stops: stops, position: position, type: 2 /* CSSImageType.RADIAL_GRADIENT */ };
2901
3729
  };
2902
3730
 
2903
3731
  var prefixRadialGradient = function (context, tokens) {
2904
- var shape = 0 /* CIRCLE */;
2905
- var size = 3 /* FARTHEST_CORNER */;
3732
+ var shape = 0 /* CSSRadialShape.CIRCLE */;
3733
+ var size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
2906
3734
  var stops = [];
2907
3735
  var position = [];
2908
3736
  parseFunctionArgs(tokens).forEach(function (arg, i) {
@@ -2936,24 +3764,24 @@ var Reportly = (function () {
2936
3764
  if (isIdentToken(token)) {
2937
3765
  switch (token.value) {
2938
3766
  case CIRCLE:
2939
- shape = 0 /* CIRCLE */;
3767
+ shape = 0 /* CSSRadialShape.CIRCLE */;
2940
3768
  return false;
2941
3769
  case ELLIPSE:
2942
- shape = 1 /* ELLIPSE */;
3770
+ shape = 1 /* CSSRadialShape.ELLIPSE */;
2943
3771
  return false;
2944
3772
  case CONTAIN:
2945
3773
  case CLOSEST_SIDE:
2946
- size = 0 /* CLOSEST_SIDE */;
3774
+ size = 0 /* CSSRadialExtent.CLOSEST_SIDE */;
2947
3775
  return false;
2948
3776
  case FARTHEST_SIDE:
2949
- size = 1 /* FARTHEST_SIDE */;
3777
+ size = 1 /* CSSRadialExtent.FARTHEST_SIDE */;
2950
3778
  return false;
2951
3779
  case CLOSEST_CORNER:
2952
- size = 2 /* CLOSEST_CORNER */;
3780
+ size = 2 /* CSSRadialExtent.CLOSEST_CORNER */;
2953
3781
  return false;
2954
3782
  case COVER:
2955
3783
  case FARTHEST_CORNER:
2956
- size = 3 /* FARTHEST_CORNER */;
3784
+ size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
2957
3785
  return false;
2958
3786
  }
2959
3787
  }
@@ -2972,36 +3800,36 @@ var Reportly = (function () {
2972
3800
  stops.push(colorStop);
2973
3801
  }
2974
3802
  });
2975
- return { size: size, shape: shape, stops: stops, position: position, type: 2 /* RADIAL_GRADIENT */ };
3803
+ return { size: size, shape: shape, stops: stops, position: position, type: 2 /* CSSImageType.RADIAL_GRADIENT */ };
2976
3804
  };
2977
3805
 
2978
3806
  var isLinearGradient = function (background) {
2979
- return background.type === 1 /* LINEAR_GRADIENT */;
3807
+ return background.type === 1 /* CSSImageType.LINEAR_GRADIENT */;
2980
3808
  };
2981
3809
  var isRadialGradient = function (background) {
2982
- return background.type === 2 /* RADIAL_GRADIENT */;
3810
+ return background.type === 2 /* CSSImageType.RADIAL_GRADIENT */;
2983
3811
  };
2984
3812
  var image = {
2985
3813
  name: 'image',
2986
3814
  parse: function (context, value) {
2987
- if (value.type === 22 /* URL_TOKEN */) {
2988
- var image_1 = { url: value.value, type: 0 /* URL */ };
3815
+ if (value.type === 22 /* TokenType.URL_TOKEN */) {
3816
+ var image_1 = { url: value.value, type: 0 /* CSSImageType.URL */ };
2989
3817
  context.cache.addImage(value.value);
2990
3818
  return image_1;
2991
3819
  }
2992
- if (value.type === 18 /* FUNCTION */) {
3820
+ if (value.type === 18 /* TokenType.FUNCTION */) {
2993
3821
  var imageFunction = SUPPORTED_IMAGE_FUNCTIONS[value.name];
2994
3822
  if (typeof imageFunction === 'undefined') {
2995
- throw new Error("Attempting to parse an unsupported image function \"" + value.name + "\"");
3823
+ throw new Error("Attempting to parse an unsupported image function \"".concat(value.name, "\""));
2996
3824
  }
2997
3825
  return imageFunction(context, value.values);
2998
3826
  }
2999
- throw new Error("Unsupported image type " + value.type);
3827
+ throw new Error("Unsupported image type ".concat(value.type));
3000
3828
  }
3001
3829
  };
3002
3830
  function isSupportedImage(value) {
3003
- return (!(value.type === 20 /* IDENT_TOKEN */ && value.value === 'none') &&
3004
- (value.type !== 18 /* FUNCTION */ || !!SUPPORTED_IMAGE_FUNCTIONS[value.name]));
3831
+ return (!(value.type === 20 /* TokenType.IDENT_TOKEN */ && value.value === 'none') &&
3832
+ (value.type !== 18 /* TokenType.FUNCTION */ || !!SUPPORTED_IMAGE_FUNCTIONS[value.name]));
3005
3833
  }
3006
3834
  var SUPPORTED_IMAGE_FUNCTIONS = {
3007
3835
  'linear-gradient': linearGradient,
@@ -3020,14 +3848,14 @@ var Reportly = (function () {
3020
3848
  var backgroundImage = {
3021
3849
  name: 'background-image',
3022
3850
  initialValue: 'none',
3023
- type: 1 /* LIST */,
3851
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3024
3852
  prefix: false,
3025
3853
  parse: function (context, tokens) {
3026
3854
  if (tokens.length === 0) {
3027
3855
  return [];
3028
3856
  }
3029
3857
  var first = tokens[0];
3030
- if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
3858
+ if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
3031
3859
  return [];
3032
3860
  }
3033
3861
  return tokens
@@ -3040,18 +3868,18 @@ var Reportly = (function () {
3040
3868
  name: 'background-origin',
3041
3869
  initialValue: 'border-box',
3042
3870
  prefix: false,
3043
- type: 1 /* LIST */,
3871
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3044
3872
  parse: function (_context, tokens) {
3045
3873
  return tokens.map(function (token) {
3046
3874
  if (isIdentToken(token)) {
3047
3875
  switch (token.value) {
3048
3876
  case 'padding-box':
3049
- return 1 /* PADDING_BOX */;
3877
+ return 1 /* BACKGROUND_ORIGIN.PADDING_BOX */;
3050
3878
  case 'content-box':
3051
- return 2 /* CONTENT_BOX */;
3879
+ return 2 /* BACKGROUND_ORIGIN.CONTENT_BOX */;
3052
3880
  }
3053
3881
  }
3054
- return 0 /* BORDER_BOX */;
3882
+ return 0 /* BACKGROUND_ORIGIN.BORDER_BOX */;
3055
3883
  });
3056
3884
  }
3057
3885
  };
@@ -3059,7 +3887,7 @@ var Reportly = (function () {
3059
3887
  var backgroundPosition = {
3060
3888
  name: 'background-position',
3061
3889
  initialValue: '0% 0%',
3062
- type: 1 /* LIST */,
3890
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3063
3891
  prefix: false,
3064
3892
  parse: function (_context, tokens) {
3065
3893
  return parseFunctionArgs(tokens)
@@ -3072,7 +3900,7 @@ var Reportly = (function () {
3072
3900
  name: 'background-repeat',
3073
3901
  initialValue: 'repeat',
3074
3902
  prefix: false,
3075
- type: 1 /* LIST */,
3903
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3076
3904
  parse: function (_context, tokens) {
3077
3905
  return parseFunctionArgs(tokens)
3078
3906
  .map(function (values) {
@@ -3087,16 +3915,16 @@ var Reportly = (function () {
3087
3915
  var parseBackgroundRepeat = function (value) {
3088
3916
  switch (value) {
3089
3917
  case 'no-repeat':
3090
- return 1 /* NO_REPEAT */;
3918
+ return 1 /* BACKGROUND_REPEAT.NO_REPEAT */;
3091
3919
  case 'repeat-x':
3092
3920
  case 'repeat no-repeat':
3093
- return 2 /* REPEAT_X */;
3921
+ return 2 /* BACKGROUND_REPEAT.REPEAT_X */;
3094
3922
  case 'repeat-y':
3095
3923
  case 'no-repeat repeat':
3096
- return 3 /* REPEAT_Y */;
3924
+ return 3 /* BACKGROUND_REPEAT.REPEAT_Y */;
3097
3925
  case 'repeat':
3098
3926
  default:
3099
- return 0 /* REPEAT */;
3927
+ return 0 /* BACKGROUND_REPEAT.REPEAT */;
3100
3928
  }
3101
3929
  };
3102
3930
 
@@ -3110,7 +3938,7 @@ var Reportly = (function () {
3110
3938
  name: 'background-size',
3111
3939
  initialValue: '0',
3112
3940
  prefix: false,
3113
- type: 1 /* LIST */,
3941
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3114
3942
  parse: function (_context, tokens) {
3115
3943
  return parseFunctionArgs(tokens).map(function (values) { return values.filter(isBackgroundSizeInfoToken); });
3116
3944
  }
@@ -3120,10 +3948,10 @@ var Reportly = (function () {
3120
3948
  };
3121
3949
 
3122
3950
  var borderColorForSide = function (side) { return ({
3123
- name: "border-" + side + "-color",
3951
+ name: "border-".concat(side, "-color"),
3124
3952
  initialValue: 'transparent',
3125
3953
  prefix: false,
3126
- type: 3 /* TYPE_VALUE */,
3954
+ type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
3127
3955
  format: 'color'
3128
3956
  }); };
3129
3957
  var borderTopColor = borderColorForSide('top');
@@ -3132,10 +3960,10 @@ var Reportly = (function () {
3132
3960
  var borderLeftColor = borderColorForSide('left');
3133
3961
 
3134
3962
  var borderRadiusForSide = function (side) { return ({
3135
- name: "border-radius-" + side,
3963
+ name: "border-radius-".concat(side),
3136
3964
  initialValue: '0 0',
3137
3965
  prefix: false,
3138
- type: 1 /* LIST */,
3966
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3139
3967
  parse: function (_context, tokens) {
3140
3968
  return parseLengthPercentageTuple(tokens.filter(isLengthPercentage));
3141
3969
  }
@@ -3146,22 +3974,22 @@ var Reportly = (function () {
3146
3974
  var borderBottomLeftRadius = borderRadiusForSide('bottom-left');
3147
3975
 
3148
3976
  var borderStyleForSide = function (side) { return ({
3149
- name: "border-" + side + "-style",
3977
+ name: "border-".concat(side, "-style"),
3150
3978
  initialValue: 'solid',
3151
3979
  prefix: false,
3152
- type: 2 /* IDENT_VALUE */,
3980
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3153
3981
  parse: function (_context, style) {
3154
3982
  switch (style) {
3155
3983
  case 'none':
3156
- return 0 /* NONE */;
3984
+ return 0 /* BORDER_STYLE.NONE */;
3157
3985
  case 'dashed':
3158
- return 2 /* DASHED */;
3986
+ return 2 /* BORDER_STYLE.DASHED */;
3159
3987
  case 'dotted':
3160
- return 3 /* DOTTED */;
3988
+ return 3 /* BORDER_STYLE.DOTTED */;
3161
3989
  case 'double':
3162
- return 4 /* DOUBLE */;
3990
+ return 4 /* BORDER_STYLE.DOUBLE */;
3163
3991
  }
3164
- return 1 /* SOLID */;
3992
+ return 1 /* BORDER_STYLE.SOLID */;
3165
3993
  }
3166
3994
  }); };
3167
3995
  var borderTopStyle = borderStyleForSide('top');
@@ -3170,9 +3998,9 @@ var Reportly = (function () {
3170
3998
  var borderLeftStyle = borderStyleForSide('left');
3171
3999
 
3172
4000
  var borderWidthForSide = function (side) { return ({
3173
- name: "border-" + side + "-width",
4001
+ name: "border-".concat(side, "-width"),
3174
4002
  initialValue: '0',
3175
- type: 0 /* VALUE */,
4003
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
3176
4004
  prefix: false,
3177
4005
  parse: function (_context, token) {
3178
4006
  if (isDimensionToken(token)) {
@@ -3190,7 +4018,7 @@ var Reportly = (function () {
3190
4018
  name: "color",
3191
4019
  initialValue: 'transparent',
3192
4020
  prefix: false,
3193
- type: 3 /* TYPE_VALUE */,
4021
+ type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
3194
4022
  format: 'color'
3195
4023
  };
3196
4024
 
@@ -3198,14 +4026,14 @@ var Reportly = (function () {
3198
4026
  name: 'direction',
3199
4027
  initialValue: 'ltr',
3200
4028
  prefix: false,
3201
- type: 2 /* IDENT_VALUE */,
4029
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3202
4030
  parse: function (_context, direction) {
3203
4031
  switch (direction) {
3204
4032
  case 'rtl':
3205
- return 1 /* RTL */;
4033
+ return 1 /* DIRECTION.RTL */;
3206
4034
  case 'ltr':
3207
4035
  default:
3208
- return 0 /* LTR */;
4036
+ return 0 /* DIRECTION.LTR */;
3209
4037
  }
3210
4038
  }
3211
4039
  };
@@ -3214,97 +4042,97 @@ var Reportly = (function () {
3214
4042
  name: 'display',
3215
4043
  initialValue: 'inline-block',
3216
4044
  prefix: false,
3217
- type: 1 /* LIST */,
4045
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3218
4046
  parse: function (_context, tokens) {
3219
4047
  return tokens.filter(isIdentToken).reduce(function (bit, token) {
3220
- return bit | parseDisplayValue(token.value);
3221
- }, 0 /* NONE */);
4048
+ return bit | parseDisplayValue$1(token.value);
4049
+ }, 0 /* DISPLAY.NONE */);
3222
4050
  }
3223
4051
  };
3224
- var parseDisplayValue = function (display) {
4052
+ var parseDisplayValue$1 = function (display) {
3225
4053
  switch (display) {
3226
4054
  case 'block':
3227
4055
  case '-webkit-box':
3228
- return 2 /* BLOCK */;
4056
+ return 2 /* DISPLAY.BLOCK */;
3229
4057
  case 'inline':
3230
- return 4 /* INLINE */;
4058
+ return 4 /* DISPLAY.INLINE */;
3231
4059
  case 'run-in':
3232
- return 8 /* RUN_IN */;
4060
+ return 8 /* DISPLAY.RUN_IN */;
3233
4061
  case 'flow':
3234
- return 16 /* FLOW */;
4062
+ return 16 /* DISPLAY.FLOW */;
3235
4063
  case 'flow-root':
3236
- return 32 /* FLOW_ROOT */;
4064
+ return 32 /* DISPLAY.FLOW_ROOT */;
3237
4065
  case 'table':
3238
- return 64 /* TABLE */;
4066
+ return 64 /* DISPLAY.TABLE */;
3239
4067
  case 'flex':
3240
4068
  case '-webkit-flex':
3241
- return 128 /* FLEX */;
4069
+ return 128 /* DISPLAY.FLEX */;
3242
4070
  case 'grid':
3243
4071
  case '-ms-grid':
3244
- return 256 /* GRID */;
4072
+ return 256 /* DISPLAY.GRID */;
3245
4073
  case 'ruby':
3246
- return 512 /* RUBY */;
4074
+ return 512 /* DISPLAY.RUBY */;
3247
4075
  case 'subgrid':
3248
- return 1024 /* SUBGRID */;
4076
+ return 1024 /* DISPLAY.SUBGRID */;
3249
4077
  case 'list-item':
3250
- return 2048 /* LIST_ITEM */;
4078
+ return 2048 /* DISPLAY.LIST_ITEM */;
3251
4079
  case 'table-row-group':
3252
- return 4096 /* TABLE_ROW_GROUP */;
4080
+ return 4096 /* DISPLAY.TABLE_ROW_GROUP */;
3253
4081
  case 'table-header-group':
3254
- return 8192 /* TABLE_HEADER_GROUP */;
4082
+ return 8192 /* DISPLAY.TABLE_HEADER_GROUP */;
3255
4083
  case 'table-footer-group':
3256
- return 16384 /* TABLE_FOOTER_GROUP */;
4084
+ return 16384 /* DISPLAY.TABLE_FOOTER_GROUP */;
3257
4085
  case 'table-row':
3258
- return 32768 /* TABLE_ROW */;
4086
+ return 32768 /* DISPLAY.TABLE_ROW */;
3259
4087
  case 'table-cell':
3260
- return 65536 /* TABLE_CELL */;
4088
+ return 65536 /* DISPLAY.TABLE_CELL */;
3261
4089
  case 'table-column-group':
3262
- return 131072 /* TABLE_COLUMN_GROUP */;
4090
+ return 131072 /* DISPLAY.TABLE_COLUMN_GROUP */;
3263
4091
  case 'table-column':
3264
- return 262144 /* TABLE_COLUMN */;
4092
+ return 262144 /* DISPLAY.TABLE_COLUMN */;
3265
4093
  case 'table-caption':
3266
- return 524288 /* TABLE_CAPTION */;
4094
+ return 524288 /* DISPLAY.TABLE_CAPTION */;
3267
4095
  case 'ruby-base':
3268
- return 1048576 /* RUBY_BASE */;
4096
+ return 1048576 /* DISPLAY.RUBY_BASE */;
3269
4097
  case 'ruby-text':
3270
- return 2097152 /* RUBY_TEXT */;
4098
+ return 2097152 /* DISPLAY.RUBY_TEXT */;
3271
4099
  case 'ruby-base-container':
3272
- return 4194304 /* RUBY_BASE_CONTAINER */;
4100
+ return 4194304 /* DISPLAY.RUBY_BASE_CONTAINER */;
3273
4101
  case 'ruby-text-container':
3274
- return 8388608 /* RUBY_TEXT_CONTAINER */;
4102
+ return 8388608 /* DISPLAY.RUBY_TEXT_CONTAINER */;
3275
4103
  case 'contents':
3276
- return 16777216 /* CONTENTS */;
4104
+ return 16777216 /* DISPLAY.CONTENTS */;
3277
4105
  case 'inline-block':
3278
- return 33554432 /* INLINE_BLOCK */;
4106
+ return 33554432 /* DISPLAY.INLINE_BLOCK */;
3279
4107
  case 'inline-list-item':
3280
- return 67108864 /* INLINE_LIST_ITEM */;
4108
+ return 67108864 /* DISPLAY.INLINE_LIST_ITEM */;
3281
4109
  case 'inline-table':
3282
- return 134217728 /* INLINE_TABLE */;
4110
+ return 134217728 /* DISPLAY.INLINE_TABLE */;
3283
4111
  case 'inline-flex':
3284
- return 268435456 /* INLINE_FLEX */;
4112
+ return 268435456 /* DISPLAY.INLINE_FLEX */;
3285
4113
  case 'inline-grid':
3286
- return 536870912 /* INLINE_GRID */;
4114
+ return 536870912 /* DISPLAY.INLINE_GRID */;
3287
4115
  }
3288
- return 0 /* NONE */;
4116
+ return 0 /* DISPLAY.NONE */;
3289
4117
  };
3290
4118
 
3291
4119
  var float = {
3292
4120
  name: 'float',
3293
4121
  initialValue: 'none',
3294
4122
  prefix: false,
3295
- type: 2 /* IDENT_VALUE */,
4123
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3296
4124
  parse: function (_context, float) {
3297
4125
  switch (float) {
3298
4126
  case 'left':
3299
- return 1 /* LEFT */;
4127
+ return 1 /* FLOAT.LEFT */;
3300
4128
  case 'right':
3301
- return 2 /* RIGHT */;
4129
+ return 2 /* FLOAT.RIGHT */;
3302
4130
  case 'inline-start':
3303
- return 3 /* INLINE_START */;
4131
+ return 3 /* FLOAT.INLINE_START */;
3304
4132
  case 'inline-end':
3305
- return 4 /* INLINE_END */;
4133
+ return 4 /* FLOAT.INLINE_END */;
3306
4134
  }
3307
- return 0 /* NONE */;
4135
+ return 0 /* FLOAT.NONE */;
3308
4136
  }
3309
4137
  };
3310
4138
 
@@ -3312,15 +4140,15 @@ var Reportly = (function () {
3312
4140
  name: 'letter-spacing',
3313
4141
  initialValue: '0',
3314
4142
  prefix: false,
3315
- type: 0 /* VALUE */,
4143
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
3316
4144
  parse: function (_context, token) {
3317
- if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'normal') {
4145
+ if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'normal') {
3318
4146
  return 0;
3319
4147
  }
3320
- if (token.type === 17 /* NUMBER_TOKEN */) {
4148
+ if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
3321
4149
  return token.number;
3322
4150
  }
3323
- if (token.type === 15 /* DIMENSION_TOKEN */) {
4151
+ if (token.type === 15 /* TokenType.DIMENSION_TOKEN */) {
3324
4152
  return token.number;
3325
4153
  }
3326
4154
  return 0;
@@ -3336,7 +4164,7 @@ var Reportly = (function () {
3336
4164
  name: 'line-break',
3337
4165
  initialValue: 'normal',
3338
4166
  prefix: false,
3339
- type: 2 /* IDENT_VALUE */,
4167
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3340
4168
  parse: function (_context, lineBreak) {
3341
4169
  switch (lineBreak) {
3342
4170
  case 'strict':
@@ -3352,13 +4180,13 @@ var Reportly = (function () {
3352
4180
  name: 'line-height',
3353
4181
  initialValue: 'normal',
3354
4182
  prefix: false,
3355
- type: 4 /* TOKEN_VALUE */
4183
+ type: 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */
3356
4184
  };
3357
4185
  var computeLineHeight = function (token, fontSize) {
3358
4186
  if (isIdentToken(token) && token.value === 'normal') {
3359
4187
  return 1.2 * fontSize;
3360
4188
  }
3361
- else if (token.type === 17 /* NUMBER_TOKEN */) {
4189
+ else if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
3362
4190
  return fontSize * token.number;
3363
4191
  }
3364
4192
  else if (isLengthPercentage(token)) {
@@ -3370,10 +4198,10 @@ var Reportly = (function () {
3370
4198
  var listStyleImage = {
3371
4199
  name: 'list-style-image',
3372
4200
  initialValue: 'none',
3373
- type: 0 /* VALUE */,
4201
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
3374
4202
  prefix: false,
3375
4203
  parse: function (context, token) {
3376
- if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') {
4204
+ if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
3377
4205
  return null;
3378
4206
  }
3379
4207
  return image.parse(context, token);
@@ -3384,14 +4212,14 @@ var Reportly = (function () {
3384
4212
  name: 'list-style-position',
3385
4213
  initialValue: 'outside',
3386
4214
  prefix: false,
3387
- type: 2 /* IDENT_VALUE */,
4215
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3388
4216
  parse: function (_context, position) {
3389
4217
  switch (position) {
3390
4218
  case 'inside':
3391
- return 0 /* INSIDE */;
4219
+ return 0 /* LIST_STYLE_POSITION.INSIDE */;
3392
4220
  case 'outside':
3393
4221
  default:
3394
- return 1 /* OUTSIDE */;
4222
+ return 1 /* LIST_STYLE_POSITION.OUTSIDE */;
3395
4223
  }
3396
4224
  }
3397
4225
  };
@@ -3400,127 +4228,127 @@ var Reportly = (function () {
3400
4228
  name: 'list-style-type',
3401
4229
  initialValue: 'none',
3402
4230
  prefix: false,
3403
- type: 2 /* IDENT_VALUE */,
4231
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3404
4232
  parse: function (_context, type) {
3405
4233
  switch (type) {
3406
4234
  case 'disc':
3407
- return 0 /* DISC */;
4235
+ return 0 /* LIST_STYLE_TYPE.DISC */;
3408
4236
  case 'circle':
3409
- return 1 /* CIRCLE */;
4237
+ return 1 /* LIST_STYLE_TYPE.CIRCLE */;
3410
4238
  case 'square':
3411
- return 2 /* SQUARE */;
4239
+ return 2 /* LIST_STYLE_TYPE.SQUARE */;
3412
4240
  case 'decimal':
3413
- return 3 /* DECIMAL */;
4241
+ return 3 /* LIST_STYLE_TYPE.DECIMAL */;
3414
4242
  case 'cjk-decimal':
3415
- return 4 /* CJK_DECIMAL */;
4243
+ return 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */;
3416
4244
  case 'decimal-leading-zero':
3417
- return 5 /* DECIMAL_LEADING_ZERO */;
4245
+ return 5 /* LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO */;
3418
4246
  case 'lower-roman':
3419
- return 6 /* LOWER_ROMAN */;
4247
+ return 6 /* LIST_STYLE_TYPE.LOWER_ROMAN */;
3420
4248
  case 'upper-roman':
3421
- return 7 /* UPPER_ROMAN */;
4249
+ return 7 /* LIST_STYLE_TYPE.UPPER_ROMAN */;
3422
4250
  case 'lower-greek':
3423
- return 8 /* LOWER_GREEK */;
4251
+ return 8 /* LIST_STYLE_TYPE.LOWER_GREEK */;
3424
4252
  case 'lower-alpha':
3425
- return 9 /* LOWER_ALPHA */;
4253
+ return 9 /* LIST_STYLE_TYPE.LOWER_ALPHA */;
3426
4254
  case 'upper-alpha':
3427
- return 10 /* UPPER_ALPHA */;
4255
+ return 10 /* LIST_STYLE_TYPE.UPPER_ALPHA */;
3428
4256
  case 'arabic-indic':
3429
- return 11 /* ARABIC_INDIC */;
4257
+ return 11 /* LIST_STYLE_TYPE.ARABIC_INDIC */;
3430
4258
  case 'armenian':
3431
- return 12 /* ARMENIAN */;
4259
+ return 12 /* LIST_STYLE_TYPE.ARMENIAN */;
3432
4260
  case 'bengali':
3433
- return 13 /* BENGALI */;
4261
+ return 13 /* LIST_STYLE_TYPE.BENGALI */;
3434
4262
  case 'cambodian':
3435
- return 14 /* CAMBODIAN */;
4263
+ return 14 /* LIST_STYLE_TYPE.CAMBODIAN */;
3436
4264
  case 'cjk-earthly-branch':
3437
- return 15 /* CJK_EARTHLY_BRANCH */;
4265
+ return 15 /* LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH */;
3438
4266
  case 'cjk-heavenly-stem':
3439
- return 16 /* CJK_HEAVENLY_STEM */;
4267
+ return 16 /* LIST_STYLE_TYPE.CJK_HEAVENLY_STEM */;
3440
4268
  case 'cjk-ideographic':
3441
- return 17 /* CJK_IDEOGRAPHIC */;
4269
+ return 17 /* LIST_STYLE_TYPE.CJK_IDEOGRAPHIC */;
3442
4270
  case 'devanagari':
3443
- return 18 /* DEVANAGARI */;
4271
+ return 18 /* LIST_STYLE_TYPE.DEVANAGARI */;
3444
4272
  case 'ethiopic-numeric':
3445
- return 19 /* ETHIOPIC_NUMERIC */;
4273
+ return 19 /* LIST_STYLE_TYPE.ETHIOPIC_NUMERIC */;
3446
4274
  case 'georgian':
3447
- return 20 /* GEORGIAN */;
4275
+ return 20 /* LIST_STYLE_TYPE.GEORGIAN */;
3448
4276
  case 'gujarati':
3449
- return 21 /* GUJARATI */;
4277
+ return 21 /* LIST_STYLE_TYPE.GUJARATI */;
3450
4278
  case 'gurmukhi':
3451
- return 22 /* GURMUKHI */;
4279
+ return 22 /* LIST_STYLE_TYPE.GURMUKHI */;
3452
4280
  case 'hebrew':
3453
- return 22 /* HEBREW */;
4281
+ return 52 /* LIST_STYLE_TYPE.HEBREW */;
3454
4282
  case 'hiragana':
3455
- return 23 /* HIRAGANA */;
4283
+ return 23 /* LIST_STYLE_TYPE.HIRAGANA */;
3456
4284
  case 'hiragana-iroha':
3457
- return 24 /* HIRAGANA_IROHA */;
4285
+ return 24 /* LIST_STYLE_TYPE.HIRAGANA_IROHA */;
3458
4286
  case 'japanese-formal':
3459
- return 25 /* JAPANESE_FORMAL */;
4287
+ return 25 /* LIST_STYLE_TYPE.JAPANESE_FORMAL */;
3460
4288
  case 'japanese-informal':
3461
- return 26 /* JAPANESE_INFORMAL */;
4289
+ return 26 /* LIST_STYLE_TYPE.JAPANESE_INFORMAL */;
3462
4290
  case 'kannada':
3463
- return 27 /* KANNADA */;
4291
+ return 27 /* LIST_STYLE_TYPE.KANNADA */;
3464
4292
  case 'katakana':
3465
- return 28 /* KATAKANA */;
4293
+ return 28 /* LIST_STYLE_TYPE.KATAKANA */;
3466
4294
  case 'katakana-iroha':
3467
- return 29 /* KATAKANA_IROHA */;
4295
+ return 29 /* LIST_STYLE_TYPE.KATAKANA_IROHA */;
3468
4296
  case 'khmer':
3469
- return 30 /* KHMER */;
4297
+ return 30 /* LIST_STYLE_TYPE.KHMER */;
3470
4298
  case 'korean-hangul-formal':
3471
- return 31 /* KOREAN_HANGUL_FORMAL */;
4299
+ return 31 /* LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL */;
3472
4300
  case 'korean-hanja-formal':
3473
- return 32 /* KOREAN_HANJA_FORMAL */;
4301
+ return 32 /* LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL */;
3474
4302
  case 'korean-hanja-informal':
3475
- return 33 /* KOREAN_HANJA_INFORMAL */;
4303
+ return 33 /* LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL */;
3476
4304
  case 'lao':
3477
- return 34 /* LAO */;
4305
+ return 34 /* LIST_STYLE_TYPE.LAO */;
3478
4306
  case 'lower-armenian':
3479
- return 35 /* LOWER_ARMENIAN */;
4307
+ return 35 /* LIST_STYLE_TYPE.LOWER_ARMENIAN */;
3480
4308
  case 'malayalam':
3481
- return 36 /* MALAYALAM */;
4309
+ return 36 /* LIST_STYLE_TYPE.MALAYALAM */;
3482
4310
  case 'mongolian':
3483
- return 37 /* MONGOLIAN */;
4311
+ return 37 /* LIST_STYLE_TYPE.MONGOLIAN */;
3484
4312
  case 'myanmar':
3485
- return 38 /* MYANMAR */;
4313
+ return 38 /* LIST_STYLE_TYPE.MYANMAR */;
3486
4314
  case 'oriya':
3487
- return 39 /* ORIYA */;
4315
+ return 39 /* LIST_STYLE_TYPE.ORIYA */;
3488
4316
  case 'persian':
3489
- return 40 /* PERSIAN */;
4317
+ return 40 /* LIST_STYLE_TYPE.PERSIAN */;
3490
4318
  case 'simp-chinese-formal':
3491
- return 41 /* SIMP_CHINESE_FORMAL */;
4319
+ return 41 /* LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL */;
3492
4320
  case 'simp-chinese-informal':
3493
- return 42 /* SIMP_CHINESE_INFORMAL */;
4321
+ return 42 /* LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL */;
3494
4322
  case 'tamil':
3495
- return 43 /* TAMIL */;
4323
+ return 43 /* LIST_STYLE_TYPE.TAMIL */;
3496
4324
  case 'telugu':
3497
- return 44 /* TELUGU */;
4325
+ return 44 /* LIST_STYLE_TYPE.TELUGU */;
3498
4326
  case 'thai':
3499
- return 45 /* THAI */;
4327
+ return 45 /* LIST_STYLE_TYPE.THAI */;
3500
4328
  case 'tibetan':
3501
- return 46 /* TIBETAN */;
4329
+ return 46 /* LIST_STYLE_TYPE.TIBETAN */;
3502
4330
  case 'trad-chinese-formal':
3503
- return 47 /* TRAD_CHINESE_FORMAL */;
4331
+ return 47 /* LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL */;
3504
4332
  case 'trad-chinese-informal':
3505
- return 48 /* TRAD_CHINESE_INFORMAL */;
4333
+ return 48 /* LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL */;
3506
4334
  case 'upper-armenian':
3507
- return 49 /* UPPER_ARMENIAN */;
4335
+ return 49 /* LIST_STYLE_TYPE.UPPER_ARMENIAN */;
3508
4336
  case 'disclosure-open':
3509
- return 50 /* DISCLOSURE_OPEN */;
4337
+ return 50 /* LIST_STYLE_TYPE.DISCLOSURE_OPEN */;
3510
4338
  case 'disclosure-closed':
3511
- return 51 /* DISCLOSURE_CLOSED */;
4339
+ return 51 /* LIST_STYLE_TYPE.DISCLOSURE_CLOSED */;
3512
4340
  case 'none':
3513
4341
  default:
3514
- return -1 /* NONE */;
4342
+ return -1 /* LIST_STYLE_TYPE.NONE */;
3515
4343
  }
3516
4344
  }
3517
4345
  };
3518
4346
 
3519
4347
  var marginForSide = function (side) { return ({
3520
- name: "margin-" + side,
4348
+ name: "margin-".concat(side),
3521
4349
  initialValue: '0',
3522
4350
  prefix: false,
3523
- type: 4 /* TOKEN_VALUE */
4351
+ type: 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */
3524
4352
  }); };
3525
4353
  var marginTop = marginForSide('top');
3526
4354
  var marginRight = marginForSide('right');
@@ -3531,21 +4359,21 @@ var Reportly = (function () {
3531
4359
  name: 'overflow',
3532
4360
  initialValue: 'visible',
3533
4361
  prefix: false,
3534
- type: 1 /* LIST */,
4362
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3535
4363
  parse: function (_context, tokens) {
3536
4364
  return tokens.filter(isIdentToken).map(function (overflow) {
3537
4365
  switch (overflow.value) {
3538
4366
  case 'hidden':
3539
- return 1 /* HIDDEN */;
4367
+ return 1 /* OVERFLOW.HIDDEN */;
3540
4368
  case 'scroll':
3541
- return 2 /* SCROLL */;
4369
+ return 2 /* OVERFLOW.SCROLL */;
3542
4370
  case 'clip':
3543
- return 3 /* CLIP */;
4371
+ return 3 /* OVERFLOW.CLIP */;
3544
4372
  case 'auto':
3545
- return 4 /* AUTO */;
4373
+ return 4 /* OVERFLOW.AUTO */;
3546
4374
  case 'visible':
3547
4375
  default:
3548
- return 0 /* VISIBLE */;
4376
+ return 0 /* OVERFLOW.VISIBLE */;
3549
4377
  }
3550
4378
  });
3551
4379
  }
@@ -3555,23 +4383,23 @@ var Reportly = (function () {
3555
4383
  name: 'overflow-wrap',
3556
4384
  initialValue: 'normal',
3557
4385
  prefix: false,
3558
- type: 2 /* IDENT_VALUE */,
4386
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3559
4387
  parse: function (_context, overflow) {
3560
4388
  switch (overflow) {
3561
4389
  case 'break-word':
3562
- return "break-word" /* BREAK_WORD */;
4390
+ return "break-word" /* OVERFLOW_WRAP.BREAK_WORD */;
3563
4391
  case 'normal':
3564
4392
  default:
3565
- return "normal" /* NORMAL */;
4393
+ return "normal" /* OVERFLOW_WRAP.NORMAL */;
3566
4394
  }
3567
4395
  }
3568
4396
  };
3569
4397
 
3570
4398
  var paddingForSide = function (side) { return ({
3571
- name: "padding-" + side,
4399
+ name: "padding-".concat(side),
3572
4400
  initialValue: '0',
3573
4401
  prefix: false,
3574
- type: 3 /* TYPE_VALUE */,
4402
+ type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
3575
4403
  format: 'length-percentage'
3576
4404
  }); };
3577
4405
  var paddingTop = paddingForSide('top');
@@ -3583,17 +4411,17 @@ var Reportly = (function () {
3583
4411
  name: 'text-align',
3584
4412
  initialValue: 'left',
3585
4413
  prefix: false,
3586
- type: 2 /* IDENT_VALUE */,
4414
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3587
4415
  parse: function (_context, textAlign) {
3588
4416
  switch (textAlign) {
3589
4417
  case 'right':
3590
- return 2 /* RIGHT */;
4418
+ return 2 /* TEXT_ALIGN.RIGHT */;
3591
4419
  case 'center':
3592
4420
  case 'justify':
3593
- return 1 /* CENTER */;
4421
+ return 1 /* TEXT_ALIGN.CENTER */;
3594
4422
  case 'left':
3595
4423
  default:
3596
- return 0 /* LEFT */;
4424
+ return 0 /* TEXT_ALIGN.LEFT */;
3597
4425
  }
3598
4426
  }
3599
4427
  };
@@ -3602,26 +4430,26 @@ var Reportly = (function () {
3602
4430
  name: 'position',
3603
4431
  initialValue: 'static',
3604
4432
  prefix: false,
3605
- type: 2 /* IDENT_VALUE */,
4433
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3606
4434
  parse: function (_context, position) {
3607
4435
  switch (position) {
3608
4436
  case 'relative':
3609
- return 1 /* RELATIVE */;
4437
+ return 1 /* POSITION.RELATIVE */;
3610
4438
  case 'absolute':
3611
- return 2 /* ABSOLUTE */;
4439
+ return 2 /* POSITION.ABSOLUTE */;
3612
4440
  case 'fixed':
3613
- return 3 /* FIXED */;
4441
+ return 3 /* POSITION.FIXED */;
3614
4442
  case 'sticky':
3615
- return 4 /* STICKY */;
4443
+ return 4 /* POSITION.STICKY */;
3616
4444
  }
3617
- return 0 /* STATIC */;
4445
+ return 0 /* POSITION.STATIC */;
3618
4446
  }
3619
4447
  };
3620
4448
 
3621
4449
  var textShadow = {
3622
4450
  name: 'text-shadow',
3623
4451
  initialValue: 'none',
3624
- type: 1 /* LIST */,
4452
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3625
4453
  prefix: false,
3626
4454
  parse: function (context, tokens) {
3627
4455
  if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) {
@@ -3662,17 +4490,17 @@ var Reportly = (function () {
3662
4490
  name: 'text-transform',
3663
4491
  initialValue: 'none',
3664
4492
  prefix: false,
3665
- type: 2 /* IDENT_VALUE */,
4493
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3666
4494
  parse: function (_context, textTransform) {
3667
4495
  switch (textTransform) {
3668
4496
  case 'uppercase':
3669
- return 2 /* UPPERCASE */;
4497
+ return 2 /* TEXT_TRANSFORM.UPPERCASE */;
3670
4498
  case 'lowercase':
3671
- return 1 /* LOWERCASE */;
4499
+ return 1 /* TEXT_TRANSFORM.LOWERCASE */;
3672
4500
  case 'capitalize':
3673
- return 3 /* CAPITALIZE */;
4501
+ return 3 /* TEXT_TRANSFORM.CAPITALIZE */;
3674
4502
  }
3675
- return 0 /* NONE */;
4503
+ return 0 /* TEXT_TRANSFORM.NONE */;
3676
4504
  }
3677
4505
  };
3678
4506
 
@@ -3680,38 +4508,58 @@ var Reportly = (function () {
3680
4508
  name: 'transform',
3681
4509
  initialValue: 'none',
3682
4510
  prefix: true,
3683
- type: 0 /* VALUE */,
4511
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
3684
4512
  parse: function (_context, token) {
3685
- if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') {
4513
+ if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
3686
4514
  return null;
3687
4515
  }
3688
- if (token.type === 18 /* FUNCTION */) {
4516
+ if (token.type === 18 /* TokenType.FUNCTION */) {
3689
4517
  var transformFunction = SUPPORTED_TRANSFORM_FUNCTIONS[token.name];
3690
4518
  if (typeof transformFunction === 'undefined') {
3691
- throw new Error("Attempting to parse an unsupported transform function \"" + token.name + "\"");
4519
+ throw new Error("Attempting to parse an unsupported transform function \"".concat(token.name, "\""));
3692
4520
  }
3693
- return transformFunction(token.values);
4521
+ return transformFunction(_context, token.values);
3694
4522
  }
3695
4523
  return null;
3696
4524
  }
3697
4525
  };
3698
- var matrix = function (args) {
3699
- var values = args.filter(function (arg) { return arg.type === 17 /* NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
4526
+ var matrix = function (_context, args) {
4527
+ var values = args.filter(function (arg) { return arg.type === 17 /* TokenType.NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
3700
4528
  return values.length === 6 ? values : null;
3701
4529
  };
3702
4530
  // doesn't support 3D transforms at the moment
3703
- var matrix3d = function (args) {
3704
- var values = args.filter(function (arg) { return arg.type === 17 /* NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
4531
+ var matrix3d = function (_context, args) {
4532
+ var values = args.filter(function (arg) { return arg.type === 17 /* TokenType.NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
3705
4533
  var a1 = values[0], b1 = values[1]; values[2]; values[3]; var a2 = values[4], b2 = values[5]; values[6]; values[7]; values[8]; values[9]; values[10]; values[11]; var a4 = values[12], b4 = values[13]; values[14]; values[15];
3706
4534
  return values.length === 16 ? [a1, b1, a2, b2, a4, b4] : null;
3707
4535
  };
4536
+ var rotate$1 = function (context, args) {
4537
+ if (args.length !== 1) {
4538
+ return null;
4539
+ }
4540
+ var arg = args[0];
4541
+ var radians = 0;
4542
+ if (arg.type === 17 /* TokenType.NUMBER_TOKEN */ && arg.number === 0) {
4543
+ radians = 0;
4544
+ }
4545
+ else if (arg.type === 15 /* TokenType.DIMENSION_TOKEN */) {
4546
+ radians = angle.parse(context, arg);
4547
+ }
4548
+ else {
4549
+ return null;
4550
+ }
4551
+ var cos = Math.cos(radians);
4552
+ var sin = Math.sin(radians);
4553
+ return [cos, sin, -sin, cos, 0, 0];
4554
+ };
3708
4555
  var SUPPORTED_TRANSFORM_FUNCTIONS = {
3709
4556
  matrix: matrix,
3710
- matrix3d: matrix3d
4557
+ matrix3d: matrix3d,
4558
+ rotate: rotate$1
3711
4559
  };
3712
4560
 
3713
4561
  var DEFAULT_VALUE = {
3714
- type: 16 /* PERCENTAGE_TOKEN */,
4562
+ type: 16 /* TokenType.PERCENTAGE_TOKEN */,
3715
4563
  number: 50,
3716
4564
  flags: FLAG_INTEGER
3717
4565
  };
@@ -3720,7 +4568,7 @@ var Reportly = (function () {
3720
4568
  name: 'transform-origin',
3721
4569
  initialValue: '50% 50%',
3722
4570
  prefix: true,
3723
- type: 1 /* LIST */,
4571
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3724
4572
  parse: function (_context, tokens) {
3725
4573
  var origins = tokens.filter(isLengthPercentage);
3726
4574
  if (origins.length !== 2) {
@@ -3730,20 +4578,44 @@ var Reportly = (function () {
3730
4578
  }
3731
4579
  };
3732
4580
 
4581
+ var rotate = {
4582
+ name: 'rotate',
4583
+ initialValue: 'none',
4584
+ prefix: false,
4585
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
4586
+ parse: function (_context, token) {
4587
+ if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
4588
+ return null;
4589
+ }
4590
+ if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
4591
+ if (token.number === 0) {
4592
+ return 0;
4593
+ }
4594
+ }
4595
+ if (token.type === 15 /* TokenType.DIMENSION_TOKEN */) {
4596
+ // Parse angle and convert to degrees for storage
4597
+ var radians = angle.parse(_context, token);
4598
+ // Store as degrees for consistency
4599
+ return (radians * 180) / Math.PI;
4600
+ }
4601
+ return null;
4602
+ }
4603
+ };
4604
+
3733
4605
  var visibility = {
3734
4606
  name: 'visible',
3735
4607
  initialValue: 'none',
3736
4608
  prefix: false,
3737
- type: 2 /* IDENT_VALUE */,
4609
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3738
4610
  parse: function (_context, visibility) {
3739
4611
  switch (visibility) {
3740
4612
  case 'hidden':
3741
- return 1 /* HIDDEN */;
4613
+ return 1 /* VISIBILITY.HIDDEN */;
3742
4614
  case 'collapse':
3743
- return 2 /* COLLAPSE */;
4615
+ return 2 /* VISIBILITY.COLLAPSE */;
3744
4616
  case 'visible':
3745
4617
  default:
3746
- return 0 /* VISIBLE */;
4618
+ return 0 /* VISIBILITY.VISIBLE */;
3747
4619
  }
3748
4620
  }
3749
4621
  };
@@ -3758,7 +4630,7 @@ var Reportly = (function () {
3758
4630
  name: 'word-break',
3759
4631
  initialValue: 'normal',
3760
4632
  prefix: false,
3761
- type: 2 /* IDENT_VALUE */,
4633
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3762
4634
  parse: function (_context, wordBreak) {
3763
4635
  switch (wordBreak) {
3764
4636
  case 'break-all':
@@ -3776,9 +4648,9 @@ var Reportly = (function () {
3776
4648
  name: 'z-index',
3777
4649
  initialValue: 'auto',
3778
4650
  prefix: false,
3779
- type: 0 /* VALUE */,
4651
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
3780
4652
  parse: function (_context, token) {
3781
- if (token.type === 20 /* IDENT_TOKEN */) {
4653
+ if (token.type === 20 /* TokenType.IDENT_TOKEN */) {
3782
4654
  return { auto: true, order: 0 };
3783
4655
  }
3784
4656
  if (isNumberToken(token)) {
@@ -3791,7 +4663,7 @@ var Reportly = (function () {
3791
4663
  var time = {
3792
4664
  name: 'time',
3793
4665
  parse: function (_context, value) {
3794
- if (value.type === 15 /* DIMENSION_TOKEN */) {
4666
+ if (value.type === 15 /* TokenType.DIMENSION_TOKEN */) {
3795
4667
  switch (value.unit.toLowerCase()) {
3796
4668
  case 's':
3797
4669
  return 1000 * value.number;
@@ -3806,7 +4678,7 @@ var Reportly = (function () {
3806
4678
  var opacity = {
3807
4679
  name: 'opacity',
3808
4680
  initialValue: '1',
3809
- type: 0 /* VALUE */,
4681
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
3810
4682
  prefix: false,
3811
4683
  parse: function (_context, token) {
3812
4684
  if (isNumberToken(token)) {
@@ -3820,7 +4692,7 @@ var Reportly = (function () {
3820
4692
  name: "text-decoration-color",
3821
4693
  initialValue: 'transparent',
3822
4694
  prefix: false,
3823
- type: 3 /* TYPE_VALUE */,
4695
+ type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
3824
4696
  format: 'color'
3825
4697
  };
3826
4698
 
@@ -3828,24 +4700,24 @@ var Reportly = (function () {
3828
4700
  name: 'text-decoration-line',
3829
4701
  initialValue: 'none',
3830
4702
  prefix: false,
3831
- type: 1 /* LIST */,
4703
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3832
4704
  parse: function (_context, tokens) {
3833
4705
  return tokens
3834
4706
  .filter(isIdentToken)
3835
4707
  .map(function (token) {
3836
4708
  switch (token.value) {
3837
4709
  case 'underline':
3838
- return 1 /* UNDERLINE */;
4710
+ return 1 /* TEXT_DECORATION_LINE.UNDERLINE */;
3839
4711
  case 'overline':
3840
- return 2 /* OVERLINE */;
4712
+ return 2 /* TEXT_DECORATION_LINE.OVERLINE */;
3841
4713
  case 'line-through':
3842
- return 3 /* LINE_THROUGH */;
4714
+ return 3 /* TEXT_DECORATION_LINE.LINE_THROUGH */;
3843
4715
  case 'none':
3844
- return 4 /* BLINK */;
4716
+ return 4 /* TEXT_DECORATION_LINE.BLINK */;
3845
4717
  }
3846
- return 0 /* NONE */;
4718
+ return 0 /* TEXT_DECORATION_LINE.NONE */;
3847
4719
  })
3848
- .filter(function (line) { return line !== 0 /* NONE */; });
4720
+ .filter(function (line) { return line !== 0 /* TEXT_DECORATION_LINE.NONE */; });
3849
4721
  }
3850
4722
  };
3851
4723
 
@@ -3853,20 +4725,20 @@ var Reportly = (function () {
3853
4725
  name: "font-family",
3854
4726
  initialValue: '',
3855
4727
  prefix: false,
3856
- type: 1 /* LIST */,
4728
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3857
4729
  parse: function (_context, tokens) {
3858
4730
  var accumulator = [];
3859
4731
  var results = [];
3860
4732
  tokens.forEach(function (token) {
3861
4733
  switch (token.type) {
3862
- case 20 /* IDENT_TOKEN */:
3863
- case 0 /* STRING_TOKEN */:
4734
+ case 20 /* TokenType.IDENT_TOKEN */:
4735
+ case 0 /* TokenType.STRING_TOKEN */:
3864
4736
  accumulator.push(token.value);
3865
4737
  break;
3866
- case 17 /* NUMBER_TOKEN */:
4738
+ case 17 /* TokenType.NUMBER_TOKEN */:
3867
4739
  accumulator.push(token.number.toString());
3868
4740
  break;
3869
- case 4 /* COMMA_TOKEN */:
4741
+ case 4 /* TokenType.COMMA_TOKEN */:
3870
4742
  results.push(accumulator.join(' '));
3871
4743
  accumulator.length = 0;
3872
4744
  break;
@@ -3875,7 +4747,7 @@ var Reportly = (function () {
3875
4747
  if (accumulator.length) {
3876
4748
  results.push(accumulator.join(' '));
3877
4749
  }
3878
- return results.map(function (result) { return (result.indexOf(' ') === -1 ? result : "'" + result + "'"); });
4750
+ return results.map(function (result) { return (result.indexOf(' ') === -1 ? result : "'".concat(result, "'")); });
3879
4751
  }
3880
4752
  };
3881
4753
 
@@ -3883,14 +4755,14 @@ var Reportly = (function () {
3883
4755
  name: "font-size",
3884
4756
  initialValue: '0',
3885
4757
  prefix: false,
3886
- type: 3 /* TYPE_VALUE */,
4758
+ type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
3887
4759
  format: 'length'
3888
4760
  };
3889
4761
 
3890
4762
  var fontWeight = {
3891
4763
  name: 'font-weight',
3892
4764
  initialValue: 'normal',
3893
- type: 0 /* VALUE */,
4765
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
3894
4766
  prefix: false,
3895
4767
  parse: function (_context, token) {
3896
4768
  if (isNumberToken(token)) {
@@ -3912,7 +4784,7 @@ var Reportly = (function () {
3912
4784
  var fontVariant = {
3913
4785
  name: 'font-variant',
3914
4786
  initialValue: 'none',
3915
- type: 1 /* LIST */,
4787
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3916
4788
  prefix: false,
3917
4789
  parse: function (_context, tokens) {
3918
4790
  return tokens.filter(isIdentToken).map(function (token) { return token.value; });
@@ -3923,16 +4795,16 @@ var Reportly = (function () {
3923
4795
  name: 'font-style',
3924
4796
  initialValue: 'normal',
3925
4797
  prefix: false,
3926
- type: 2 /* IDENT_VALUE */,
4798
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3927
4799
  parse: function (_context, overflow) {
3928
4800
  switch (overflow) {
3929
4801
  case 'oblique':
3930
- return "oblique" /* OBLIQUE */;
4802
+ return "oblique" /* FONT_STYLE.OBLIQUE */;
3931
4803
  case 'italic':
3932
- return "italic" /* ITALIC */;
4804
+ return "italic" /* FONT_STYLE.ITALIC */;
3933
4805
  case 'normal':
3934
4806
  default:
3935
- return "normal" /* NORMAL */;
4807
+ return "normal" /* FONT_STYLE.NORMAL */;
3936
4808
  }
3937
4809
  }
3938
4810
  };
@@ -3942,14 +4814,14 @@ var Reportly = (function () {
3942
4814
  var content = {
3943
4815
  name: 'content',
3944
4816
  initialValue: 'none',
3945
- type: 1 /* LIST */,
4817
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3946
4818
  prefix: false,
3947
4819
  parse: function (_context, tokens) {
3948
4820
  if (tokens.length === 0) {
3949
4821
  return [];
3950
4822
  }
3951
4823
  var first = tokens[0];
3952
- if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
4824
+ if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
3953
4825
  return [];
3954
4826
  }
3955
4827
  return tokens;
@@ -3960,13 +4832,13 @@ var Reportly = (function () {
3960
4832
  name: 'counter-increment',
3961
4833
  initialValue: 'none',
3962
4834
  prefix: true,
3963
- type: 1 /* LIST */,
4835
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3964
4836
  parse: function (_context, tokens) {
3965
4837
  if (tokens.length === 0) {
3966
4838
  return null;
3967
4839
  }
3968
4840
  var first = tokens[0];
3969
- if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
4841
+ if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
3970
4842
  return null;
3971
4843
  }
3972
4844
  var increments = [];
@@ -3974,7 +4846,7 @@ var Reportly = (function () {
3974
4846
  for (var i = 0; i < filtered.length; i++) {
3975
4847
  var counter = filtered[i];
3976
4848
  var next = filtered[i + 1];
3977
- if (counter.type === 20 /* IDENT_TOKEN */) {
4849
+ if (counter.type === 20 /* TokenType.IDENT_TOKEN */) {
3978
4850
  var increment = next && isNumberToken(next) ? next.number : 1;
3979
4851
  increments.push({ counter: counter.value, increment: increment });
3980
4852
  }
@@ -3987,7 +4859,7 @@ var Reportly = (function () {
3987
4859
  name: 'counter-reset',
3988
4860
  initialValue: 'none',
3989
4861
  prefix: true,
3990
- type: 1 /* LIST */,
4862
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3991
4863
  parse: function (_context, tokens) {
3992
4864
  if (tokens.length === 0) {
3993
4865
  return [];
@@ -4010,7 +4882,7 @@ var Reportly = (function () {
4010
4882
  name: 'duration',
4011
4883
  initialValue: '0s',
4012
4884
  prefix: false,
4013
- type: 1 /* LIST */,
4885
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
4014
4886
  parse: function (context, tokens) {
4015
4887
  return tokens.filter(isDimensionToken).map(function (token) { return time.parse(context, token); });
4016
4888
  }
@@ -4020,13 +4892,13 @@ var Reportly = (function () {
4020
4892
  name: 'quotes',
4021
4893
  initialValue: 'none',
4022
4894
  prefix: true,
4023
- type: 1 /* LIST */,
4895
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
4024
4896
  parse: function (_context, tokens) {
4025
4897
  if (tokens.length === 0) {
4026
4898
  return null;
4027
4899
  }
4028
4900
  var first = tokens[0];
4029
- if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
4901
+ if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
4030
4902
  return null;
4031
4903
  }
4032
4904
  var quotes = [];
@@ -4056,7 +4928,7 @@ var Reportly = (function () {
4056
4928
  var boxShadow = {
4057
4929
  name: 'box-shadow',
4058
4930
  initialValue: 'none',
4059
- type: 1 /* LIST */,
4931
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
4060
4932
  prefix: false,
4061
4933
  parse: function (context, tokens) {
4062
4934
  if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) {
@@ -4105,20 +4977,20 @@ var Reportly = (function () {
4105
4977
  name: 'paint-order',
4106
4978
  initialValue: 'normal',
4107
4979
  prefix: false,
4108
- type: 1 /* LIST */,
4980
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
4109
4981
  parse: function (_context, tokens) {
4110
- var DEFAULT_VALUE = [0 /* FILL */, 1 /* STROKE */, 2 /* MARKERS */];
4982
+ var DEFAULT_VALUE = [0 /* PAINT_ORDER_LAYER.FILL */, 1 /* PAINT_ORDER_LAYER.STROKE */, 2 /* PAINT_ORDER_LAYER.MARKERS */];
4111
4983
  var layers = [];
4112
4984
  tokens.filter(isIdentToken).forEach(function (token) {
4113
4985
  switch (token.value) {
4114
4986
  case 'stroke':
4115
- layers.push(1 /* STROKE */);
4987
+ layers.push(1 /* PAINT_ORDER_LAYER.STROKE */);
4116
4988
  break;
4117
4989
  case 'fill':
4118
- layers.push(0 /* FILL */);
4990
+ layers.push(0 /* PAINT_ORDER_LAYER.FILL */);
4119
4991
  break;
4120
4992
  case 'markers':
4121
- layers.push(2 /* MARKERS */);
4993
+ layers.push(2 /* PAINT_ORDER_LAYER.MARKERS */);
4122
4994
  break;
4123
4995
  }
4124
4996
  });
@@ -4135,14 +5007,14 @@ var Reportly = (function () {
4135
5007
  name: "-webkit-text-stroke-color",
4136
5008
  initialValue: 'currentcolor',
4137
5009
  prefix: false,
4138
- type: 3 /* TYPE_VALUE */,
5010
+ type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
4139
5011
  format: 'color'
4140
5012
  };
4141
5013
 
4142
5014
  var webkitTextStrokeWidth = {
4143
5015
  name: "-webkit-text-stroke-width",
4144
5016
  initialValue: '0',
4145
- type: 0 /* VALUE */,
5017
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
4146
5018
  prefix: false,
4147
5019
  parse: function (_context, token) {
4148
5020
  if (isDimensionToken(token)) {
@@ -4152,6 +5024,31 @@ var Reportly = (function () {
4152
5024
  }
4153
5025
  };
4154
5026
 
5027
+ var objectFit = {
5028
+ name: 'objectFit',
5029
+ initialValue: 'fill',
5030
+ prefix: false,
5031
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
5032
+ parse: function (_context, tokens) {
5033
+ return tokens.filter(isIdentToken).reduce(function (bit, token) {
5034
+ return bit | parseDisplayValue(token.value);
5035
+ }, 0 /* OBJECT_FIT.FILL */);
5036
+ }
5037
+ };
5038
+ var parseDisplayValue = function (display) {
5039
+ switch (display) {
5040
+ case 'contain':
5041
+ return 2 /* OBJECT_FIT.CONTAIN */;
5042
+ case 'cover':
5043
+ return 4 /* OBJECT_FIT.COVER */;
5044
+ case 'none':
5045
+ return 8 /* OBJECT_FIT.NONE */;
5046
+ case 'scale-down':
5047
+ return 16 /* OBJECT_FIT.SCALE_DOWN */;
5048
+ }
5049
+ return 0 /* OBJECT_FIT.FILL */;
5050
+ };
5051
+
4155
5052
  var CSSParsedDeclaration = /** @class */ (function () {
4156
5053
  function CSSParsedDeclaration(context, declaration) {
4157
5054
  var _a, _b;
@@ -4217,37 +5114,39 @@ var Reportly = (function () {
4217
5114
  this.textTransform = parse(context, textTransform, declaration.textTransform);
4218
5115
  this.transform = parse(context, transform$1, declaration.transform);
4219
5116
  this.transformOrigin = parse(context, transformOrigin, declaration.transformOrigin);
5117
+ this.rotate = parse(context, rotate, declaration.rotate);
4220
5118
  this.visibility = parse(context, visibility, declaration.visibility);
4221
5119
  this.webkitTextStrokeColor = parse(context, webkitTextStrokeColor, declaration.webkitTextStrokeColor);
4222
5120
  this.webkitTextStrokeWidth = parse(context, webkitTextStrokeWidth, declaration.webkitTextStrokeWidth);
4223
5121
  this.wordBreak = parse(context, wordBreak, declaration.wordBreak);
4224
5122
  this.zIndex = parse(context, zIndex, declaration.zIndex);
5123
+ this.objectFit = parse(context, objectFit, declaration.objectFit);
4225
5124
  }
4226
5125
  CSSParsedDeclaration.prototype.isVisible = function () {
4227
- return this.display > 0 && this.opacity > 0 && this.visibility === 0 /* VISIBLE */;
5126
+ return this.display > 0 && this.opacity > 0 && this.visibility === 0 /* VISIBILITY.VISIBLE */;
4228
5127
  };
4229
5128
  CSSParsedDeclaration.prototype.isTransparent = function () {
4230
5129
  return isTransparent(this.backgroundColor);
4231
5130
  };
4232
5131
  CSSParsedDeclaration.prototype.isTransformed = function () {
4233
- return this.transform !== null;
5132
+ return this.transform !== null || this.rotate !== null;
4234
5133
  };
4235
5134
  CSSParsedDeclaration.prototype.isPositioned = function () {
4236
- return this.position !== 0 /* STATIC */;
5135
+ return this.position !== 0 /* POSITION.STATIC */;
4237
5136
  };
4238
5137
  CSSParsedDeclaration.prototype.isPositionedWithZIndex = function () {
4239
5138
  return this.isPositioned() && !this.zIndex.auto;
4240
5139
  };
4241
5140
  CSSParsedDeclaration.prototype.isFloating = function () {
4242
- return this.float !== 0 /* NONE */;
5141
+ return this.float !== 0 /* FLOAT.NONE */;
4243
5142
  };
4244
5143
  CSSParsedDeclaration.prototype.isInlineLevel = function () {
4245
- return (contains(this.display, 4 /* INLINE */) ||
4246
- contains(this.display, 33554432 /* INLINE_BLOCK */) ||
4247
- contains(this.display, 268435456 /* INLINE_FLEX */) ||
4248
- contains(this.display, 536870912 /* INLINE_GRID */) ||
4249
- contains(this.display, 67108864 /* INLINE_LIST_ITEM */) ||
4250
- contains(this.display, 134217728 /* INLINE_TABLE */));
5144
+ return (contains(this.display, 4 /* DISPLAY.INLINE */) ||
5145
+ contains(this.display, 33554432 /* DISPLAY.INLINE_BLOCK */) ||
5146
+ contains(this.display, 268435456 /* DISPLAY.INLINE_FLEX */) ||
5147
+ contains(this.display, 536870912 /* DISPLAY.INLINE_GRID */) ||
5148
+ contains(this.display, 67108864 /* DISPLAY.INLINE_LIST_ITEM */) ||
5149
+ contains(this.display, 134217728 /* DISPLAY.INLINE_TABLE */));
4251
5150
  };
4252
5151
  return CSSParsedDeclaration;
4253
5152
  }());
@@ -4272,16 +5171,16 @@ var Reportly = (function () {
4272
5171
  tokenizer.write(value);
4273
5172
  var parser = new Parser(tokenizer.read());
4274
5173
  switch (descriptor.type) {
4275
- case 2 /* IDENT_VALUE */:
5174
+ case 2 /* PropertyDescriptorParsingType.IDENT_VALUE */:
4276
5175
  var token = parser.parseComponentValue();
4277
5176
  return descriptor.parse(context, isIdentToken(token) ? token.value : descriptor.initialValue);
4278
- case 0 /* VALUE */:
5177
+ case 0 /* PropertyDescriptorParsingType.VALUE */:
4279
5178
  return descriptor.parse(context, parser.parseComponentValue());
4280
- case 1 /* LIST */:
5179
+ case 1 /* PropertyDescriptorParsingType.LIST */:
4281
5180
  return descriptor.parse(context, parser.parseComponentValues());
4282
- case 4 /* TOKEN_VALUE */:
5181
+ case 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */:
4283
5182
  return parser.parseComponentValue();
4284
- case 3 /* TYPE_VALUE */:
5183
+ case 3 /* PropertyDescriptorParsingType.TYPE_VALUE */:
4285
5184
  switch (descriptor.format) {
4286
5185
  case 'angle':
4287
5186
  return angle.parse(context, parser.parseComponentValue());
@@ -4307,20 +5206,20 @@ var Reportly = (function () {
4307
5206
  var attribute = element.getAttribute(elementDebuggerAttribute);
4308
5207
  switch (attribute) {
4309
5208
  case 'all':
4310
- return 1 /* ALL */;
5209
+ return 1 /* DebuggerType.ALL */;
4311
5210
  case 'clone':
4312
- return 2 /* CLONE */;
5211
+ return 2 /* DebuggerType.CLONE */;
4313
5212
  case 'parse':
4314
- return 3 /* PARSE */;
5213
+ return 3 /* DebuggerType.PARSE */;
4315
5214
  case 'render':
4316
- return 4 /* RENDER */;
5215
+ return 4 /* DebuggerType.RENDER */;
4317
5216
  default:
4318
- return 0 /* NONE */;
5217
+ return 0 /* DebuggerType.NONE */;
4319
5218
  }
4320
5219
  };
4321
5220
  var isDebugging = function (element, type) {
4322
5221
  var elementType = getElementDebugType(element);
4323
- return elementType === 1 /* ALL */ || type === elementType;
5222
+ return elementType === 1 /* DebuggerType.ALL */ || type === elementType;
4324
5223
  };
4325
5224
 
4326
5225
  var ElementContainer = /** @class */ (function () {
@@ -4329,7 +5228,7 @@ var Reportly = (function () {
4329
5228
  this.textNodes = [];
4330
5229
  this.elements = [];
4331
5230
  this.flags = 0;
4332
- if (isDebugging(element, 3 /* PARSE */)) {
5231
+ if (isDebugging(element, 3 /* DebuggerType.PARSE */)) {
4333
5232
  debugger;
4334
5233
  }
4335
5234
  this.styles = new CSSParsedDeclaration(context, window.getComputedStyle(element, null));
@@ -4341,10 +5240,14 @@ var Reportly = (function () {
4341
5240
  // getBoundingClientRect takes transforms into account
4342
5241
  element.style.transform = 'none';
4343
5242
  }
5243
+ if (this.styles.rotate !== null) {
5244
+ // Handle rotate property similarly to transform
5245
+ element.style.rotate = 'none';
5246
+ }
4344
5247
  }
4345
5248
  this.bounds = parseBounds(this.context, element);
4346
- if (isDebugging(element, 4 /* RENDER */)) {
4347
- this.flags |= 16 /* DEBUG_RENDER */;
5249
+ if (isDebugging(element, 4 /* DebuggerType.RENDER */)) {
5250
+ this.flags |= 16 /* FLAGS.DEBUG_RENDER */;
4348
5251
  }
4349
5252
  }
4350
5253
  return ElementContainer;
@@ -4738,7 +5641,7 @@ var Reportly = (function () {
4738
5641
  var range = document.createRange();
4739
5642
  if (range.getBoundingClientRect) {
4740
5643
  var testElement = document.createElement('boundtest');
4741
- testElement.style.height = TEST_HEIGHT + "px";
5644
+ testElement.style.height = "".concat(TEST_HEIGHT, "px");
4742
5645
  testElement.style.display = 'block';
4743
5646
  document.body.appendChild(testElement);
4744
5647
  range.selectNode(testElement);
@@ -4828,8 +5731,8 @@ var Reportly = (function () {
4828
5731
  ctx.fillStyle = 'red';
4829
5732
  ctx.fillRect(0, 0, size, size);
4830
5733
  var node = document.createElement('div');
4831
- node.style.backgroundImage = "url(" + greenImageSrc + ")";
4832
- node.style.height = size + "px";
5734
+ node.style.backgroundImage = "url(".concat(greenImageSrc, ")");
5735
+ node.style.height = "".concat(size, "px");
4833
5736
  // Firefox 55 does not render inline <img /> tags
4834
5737
  return isGreenPixel(data)
4835
5738
  ? loadSerializedSVG$1(createForeignObjectSVG(size, size, 0, 0, node))
@@ -4862,7 +5765,7 @@ var Reportly = (function () {
4862
5765
  var img = new Image();
4863
5766
  img.onload = function () { return resolve(img); };
4864
5767
  img.onerror = reject;
4865
- img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(svg));
5768
+ img.src = "data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(svg)));
4866
5769
  });
4867
5770
  };
4868
5771
  var FEATURES = {
@@ -5006,7 +5909,7 @@ var Reportly = (function () {
5006
5909
  var breakWords = function (str, styles) {
5007
5910
  var breaker = LineBreaker(str, {
5008
5911
  lineBreak: styles.lineBreak,
5009
- wordBreak: styles.overflowWrap === "break-word" /* BREAK_WORD */ ? 'break-word' : styles.wordBreak
5912
+ wordBreak: styles.overflowWrap === "break-word" /* OVERFLOW_WRAP.BREAK_WORD */ ? 'break-word' : styles.wordBreak
5010
5913
  });
5011
5914
  var words = [];
5012
5915
  var bk;
@@ -5047,11 +5950,11 @@ var Reportly = (function () {
5047
5950
  }());
5048
5951
  var transform = function (text, transform) {
5049
5952
  switch (transform) {
5050
- case 1 /* LOWERCASE */:
5953
+ case 1 /* TEXT_TRANSFORM.LOWERCASE */:
5051
5954
  return text.toLowerCase();
5052
- case 3 /* CAPITALIZE */:
5955
+ case 3 /* TEXT_TRANSFORM.CAPITALIZE */:
5053
5956
  return text.replace(CAPITALIZE, capitalize);
5054
- case 2 /* UPPERCASE */:
5957
+ case 2 /* TEXT_TRANSFORM.UPPERCASE */:
5055
5958
  return text.toUpperCase();
5056
5959
  default:
5057
5960
  return text;
@@ -5096,9 +5999,9 @@ var Reportly = (function () {
5096
5999
  var _this = _super.call(this, context, img) || this;
5097
6000
  var s = new XMLSerializer();
5098
6001
  var bounds = parseBounds(context, img);
5099
- img.setAttribute('width', bounds.width + "px");
5100
- img.setAttribute('height', bounds.height + "px");
5101
- _this.svg = "data:image/svg+xml," + encodeURIComponent(s.serializeToString(img));
6002
+ img.setAttribute('width', "".concat(bounds.width, "px"));
6003
+ img.setAttribute('height', "".concat(bounds.height, "px"));
6004
+ _this.svg = "data:image/svg+xml,".concat(encodeURIComponent(s.serializeToString(img)));
5102
6005
  _this.intrinsicWidth = img.width.baseVal.value;
5103
6006
  _this.intrinsicHeight = img.height.baseVal.value;
5104
6007
  _this.context.cache.addImage(_this.svg);
@@ -5130,7 +6033,7 @@ var Reportly = (function () {
5130
6033
 
5131
6034
  var CHECKBOX_BORDER_RADIUS = [
5132
6035
  {
5133
- type: 15 /* DIMENSION_TOKEN */,
6036
+ type: 15 /* TokenType.DIMENSION_TOKEN */,
5134
6037
  flags: 0,
5135
6038
  unit: 'px',
5136
6039
  number: 3
@@ -5138,7 +6041,7 @@ var Reportly = (function () {
5138
6041
  ];
5139
6042
  var RADIO_BORDER_RADIUS = [
5140
6043
  {
5141
- type: 16 /* PERCENTAGE_TOKEN */,
6044
+ type: 16 /* TokenType.PERCENTAGE_TOKEN */,
5142
6045
  flags: 0,
5143
6046
  number: 50
5144
6047
  }
@@ -5183,9 +6086,9 @@ var Reportly = (function () {
5183
6086
  _this.styles.borderRightStyle =
5184
6087
  _this.styles.borderBottomStyle =
5185
6088
  _this.styles.borderLeftStyle =
5186
- 1 /* SOLID */;
5187
- _this.styles.backgroundClip = [0 /* BORDER_BOX */];
5188
- _this.styles.backgroundOrigin = [0 /* BORDER_BOX */];
6089
+ 1 /* BORDER_STYLE.SOLID */;
6090
+ _this.styles.backgroundClip = [0 /* BACKGROUND_CLIP.BORDER_BOX */];
6091
+ _this.styles.backgroundOrigin = [0 /* BACKGROUND_ORIGIN.BORDER_BOX */];
5189
6092
  _this.bounds = reformatInputBounds(_this.bounds);
5190
6093
  }
5191
6094
  switch (_this.type) {
@@ -5267,7 +6170,8 @@ var Reportly = (function () {
5267
6170
  var parseNodeTree = function (context, node, parent, root) {
5268
6171
  for (var childNode = node.firstChild, nextNode = void 0; childNode; childNode = nextNode) {
5269
6172
  nextNode = childNode.nextSibling;
5270
- if (isTextNode(childNode) && childNode.data.trim().length > 0) {
6173
+ // Fixes #2238 #1624 - Fix the issue of TextNode content being overlooked in rendering due to being perceived as blank by trim().
6174
+ if (isTextNode(childNode) && childNode.data.length > 0) {
5271
6175
  parent.textNodes.push(new TextContainer(context, childNode, parent.styles));
5272
6176
  }
5273
6177
  else if (isElementNode(childNode)) {
@@ -5278,13 +6182,13 @@ var Reportly = (function () {
5278
6182
  var container = createContainer(context, childNode);
5279
6183
  if (container.styles.isVisible()) {
5280
6184
  if (createsRealStackingContext(childNode, container, root)) {
5281
- container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */;
6185
+ container.flags |= 4 /* FLAGS.CREATES_REAL_STACKING_CONTEXT */;
5282
6186
  }
5283
6187
  else if (createsStackingContext(container.styles)) {
5284
- container.flags |= 2 /* CREATES_STACKING_CONTEXT */;
6188
+ container.flags |= 2 /* FLAGS.CREATES_STACKING_CONTEXT */;
5285
6189
  }
5286
6190
  if (LIST_OWNERS.indexOf(childNode.tagName) !== -1) {
5287
- container.flags |= 8 /* IS_LIST_OWNER */;
6191
+ container.flags |= 8 /* FLAGS.IS_LIST_OWNER */;
5288
6192
  }
5289
6193
  parent.elements.push(container);
5290
6194
  childNode.slot;
@@ -5333,7 +6237,7 @@ var Reportly = (function () {
5333
6237
  };
5334
6238
  var parseTree = function (context, element) {
5335
6239
  var container = createContainer(context, element);
5336
- container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */;
6240
+ container.flags |= 4 /* FLAGS.CREATES_REAL_STACKING_CONTEXT */;
5337
6241
  parseNodeTree(context, element, container, container);
5338
6242
  return container;
5339
6243
  };
@@ -5601,7 +6505,7 @@ var Reportly = (function () {
5601
6505
  var CJK_HUNDRED_COEFFICIENTS = 1 << 3;
5602
6506
  var createCJKCounter = function (value, numbers, multipliers, negativeSign, suffix, flags) {
5603
6507
  if (value < -9999 || value > 9999) {
5604
- return createCounterText(value, 4 /* CJK_DECIMAL */, suffix.length > 0);
6508
+ return createCounterText(value, 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */, suffix.length > 0);
5605
6509
  }
5606
6510
  var tmp = Math.abs(value);
5607
6511
  var string = suffix;
@@ -5637,101 +6541,101 @@ var Reportly = (function () {
5637
6541
  var koreanSuffix = appendSuffix ? ', ' : '';
5638
6542
  var spaceSuffix = appendSuffix ? ' ' : '';
5639
6543
  switch (type) {
5640
- case 0 /* DISC */:
6544
+ case 0 /* LIST_STYLE_TYPE.DISC */:
5641
6545
  return '•' + spaceSuffix;
5642
- case 1 /* CIRCLE */:
6546
+ case 1 /* LIST_STYLE_TYPE.CIRCLE */:
5643
6547
  return '◦' + spaceSuffix;
5644
- case 2 /* SQUARE */:
6548
+ case 2 /* LIST_STYLE_TYPE.SQUARE */:
5645
6549
  return '◾' + spaceSuffix;
5646
- case 5 /* DECIMAL_LEADING_ZERO */:
6550
+ case 5 /* LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO */:
5647
6551
  var string = createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
5648
- return string.length < 4 ? "0" + string : string;
5649
- case 4 /* CJK_DECIMAL */:
6552
+ return string.length < 4 ? "0".concat(string) : string;
6553
+ case 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */:
5650
6554
  return createCounterStyleFromSymbols(value, '〇一二三四五六七八九', cjkSuffix);
5651
- case 6 /* LOWER_ROMAN */:
5652
- return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix).toLowerCase();
5653
- case 7 /* UPPER_ROMAN */:
5654
- return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix);
5655
- case 8 /* LOWER_GREEK */:
6555
+ case 6 /* LIST_STYLE_TYPE.LOWER_ROMAN */:
6556
+ return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix).toLowerCase();
6557
+ case 7 /* LIST_STYLE_TYPE.UPPER_ROMAN */:
6558
+ return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
6559
+ case 8 /* LIST_STYLE_TYPE.LOWER_GREEK */:
5656
6560
  return createCounterStyleFromRange(value, 945, 969, false, defaultSuffix);
5657
- case 9 /* LOWER_ALPHA */:
6561
+ case 9 /* LIST_STYLE_TYPE.LOWER_ALPHA */:
5658
6562
  return createCounterStyleFromRange(value, 97, 122, false, defaultSuffix);
5659
- case 10 /* UPPER_ALPHA */:
6563
+ case 10 /* LIST_STYLE_TYPE.UPPER_ALPHA */:
5660
6564
  return createCounterStyleFromRange(value, 65, 90, false, defaultSuffix);
5661
- case 11 /* ARABIC_INDIC */:
6565
+ case 11 /* LIST_STYLE_TYPE.ARABIC_INDIC */:
5662
6566
  return createCounterStyleFromRange(value, 1632, 1641, true, defaultSuffix);
5663
- case 12 /* ARMENIAN */:
5664
- case 49 /* UPPER_ARMENIAN */:
5665
- return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix);
5666
- case 35 /* LOWER_ARMENIAN */:
5667
- return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix).toLowerCase();
5668
- case 13 /* BENGALI */:
6567
+ case 12 /* LIST_STYLE_TYPE.ARMENIAN */:
6568
+ case 49 /* LIST_STYLE_TYPE.UPPER_ARMENIAN */:
6569
+ return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
6570
+ case 35 /* LIST_STYLE_TYPE.LOWER_ARMENIAN */:
6571
+ return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix).toLowerCase();
6572
+ case 13 /* LIST_STYLE_TYPE.BENGALI */:
5669
6573
  return createCounterStyleFromRange(value, 2534, 2543, true, defaultSuffix);
5670
- case 14 /* CAMBODIAN */:
5671
- case 30 /* KHMER */:
6574
+ case 14 /* LIST_STYLE_TYPE.CAMBODIAN */:
6575
+ case 30 /* LIST_STYLE_TYPE.KHMER */:
5672
6576
  return createCounterStyleFromRange(value, 6112, 6121, true, defaultSuffix);
5673
- case 15 /* CJK_EARTHLY_BRANCH */:
6577
+ case 15 /* LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH */:
5674
6578
  return createCounterStyleFromSymbols(value, '子丑寅卯辰巳午未申酉戌亥', cjkSuffix);
5675
- case 16 /* CJK_HEAVENLY_STEM */:
6579
+ case 16 /* LIST_STYLE_TYPE.CJK_HEAVENLY_STEM */:
5676
6580
  return createCounterStyleFromSymbols(value, '甲乙丙丁戊己庚辛壬癸', cjkSuffix);
5677
- case 17 /* CJK_IDEOGRAPHIC */:
5678
- case 48 /* TRAD_CHINESE_INFORMAL */:
6581
+ case 17 /* LIST_STYLE_TYPE.CJK_IDEOGRAPHIC */:
6582
+ case 48 /* LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL */:
5679
6583
  return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
5680
- case 47 /* TRAD_CHINESE_FORMAL */:
6584
+ case 47 /* LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL */:
5681
6585
  return createCJKCounter(value, '零壹貳參肆伍陸柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
5682
- case 42 /* SIMP_CHINESE_INFORMAL */:
6586
+ case 42 /* LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL */:
5683
6587
  return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
5684
- case 41 /* SIMP_CHINESE_FORMAL */:
6588
+ case 41 /* LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL */:
5685
6589
  return createCJKCounter(value, '零壹贰叁肆伍陆柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
5686
- case 26 /* JAPANESE_INFORMAL */:
6590
+ case 26 /* LIST_STYLE_TYPE.JAPANESE_INFORMAL */:
5687
6591
  return createCJKCounter(value, '〇一二三四五六七八九', '十百千万', JAPANESE_NEGATIVE, cjkSuffix, 0);
5688
- case 25 /* JAPANESE_FORMAL */:
6592
+ case 25 /* LIST_STYLE_TYPE.JAPANESE_FORMAL */:
5689
6593
  return createCJKCounter(value, '零壱弐参四伍六七八九', '拾百千万', JAPANESE_NEGATIVE, cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
5690
- case 31 /* KOREAN_HANGUL_FORMAL */:
6594
+ case 31 /* LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL */:
5691
6595
  return createCJKCounter(value, '영일이삼사오육칠팔구', '십백천만', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
5692
- case 33 /* KOREAN_HANJA_INFORMAL */:
6596
+ case 33 /* LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL */:
5693
6597
  return createCJKCounter(value, '零一二三四五六七八九', '十百千萬', KOREAN_NEGATIVE, koreanSuffix, 0);
5694
- case 32 /* KOREAN_HANJA_FORMAL */:
6598
+ case 32 /* LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL */:
5695
6599
  return createCJKCounter(value, '零壹貳參四五六七八九', '拾百千', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
5696
- case 18 /* DEVANAGARI */:
6600
+ case 18 /* LIST_STYLE_TYPE.DEVANAGARI */:
5697
6601
  return createCounterStyleFromRange(value, 0x966, 0x96f, true, defaultSuffix);
5698
- case 20 /* GEORGIAN */:
5699
- return createAdditiveCounter(value, 1, 19999, GEORGIAN, 3 /* DECIMAL */, defaultSuffix);
5700
- case 21 /* GUJARATI */:
6602
+ case 20 /* LIST_STYLE_TYPE.GEORGIAN */:
6603
+ return createAdditiveCounter(value, 1, 19999, GEORGIAN, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
6604
+ case 21 /* LIST_STYLE_TYPE.GUJARATI */:
5701
6605
  return createCounterStyleFromRange(value, 0xae6, 0xaef, true, defaultSuffix);
5702
- case 22 /* GURMUKHI */:
6606
+ case 22 /* LIST_STYLE_TYPE.GURMUKHI */:
5703
6607
  return createCounterStyleFromRange(value, 0xa66, 0xa6f, true, defaultSuffix);
5704
- case 22 /* HEBREW */:
5705
- return createAdditiveCounter(value, 1, 10999, HEBREW, 3 /* DECIMAL */, defaultSuffix);
5706
- case 23 /* HIRAGANA */:
6608
+ case 52 /* LIST_STYLE_TYPE.HEBREW */:
6609
+ return createAdditiveCounter(value, 1, 10999, HEBREW, 3 /* LIST_STYLE_TYPE.DECIMAL */, defaultSuffix);
6610
+ case 23 /* LIST_STYLE_TYPE.HIRAGANA */:
5707
6611
  return createCounterStyleFromSymbols(value, 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん');
5708
- case 24 /* HIRAGANA_IROHA */:
6612
+ case 24 /* LIST_STYLE_TYPE.HIRAGANA_IROHA */:
5709
6613
  return createCounterStyleFromSymbols(value, 'いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす');
5710
- case 27 /* KANNADA */:
6614
+ case 27 /* LIST_STYLE_TYPE.KANNADA */:
5711
6615
  return createCounterStyleFromRange(value, 0xce6, 0xcef, true, defaultSuffix);
5712
- case 28 /* KATAKANA */:
6616
+ case 28 /* LIST_STYLE_TYPE.KATAKANA */:
5713
6617
  return createCounterStyleFromSymbols(value, 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン', cjkSuffix);
5714
- case 29 /* KATAKANA_IROHA */:
6618
+ case 29 /* LIST_STYLE_TYPE.KATAKANA_IROHA */:
5715
6619
  return createCounterStyleFromSymbols(value, 'イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス', cjkSuffix);
5716
- case 34 /* LAO */:
6620
+ case 34 /* LIST_STYLE_TYPE.LAO */:
5717
6621
  return createCounterStyleFromRange(value, 0xed0, 0xed9, true, defaultSuffix);
5718
- case 37 /* MONGOLIAN */:
6622
+ case 37 /* LIST_STYLE_TYPE.MONGOLIAN */:
5719
6623
  return createCounterStyleFromRange(value, 0x1810, 0x1819, true, defaultSuffix);
5720
- case 38 /* MYANMAR */:
6624
+ case 38 /* LIST_STYLE_TYPE.MYANMAR */:
5721
6625
  return createCounterStyleFromRange(value, 0x1040, 0x1049, true, defaultSuffix);
5722
- case 39 /* ORIYA */:
6626
+ case 39 /* LIST_STYLE_TYPE.ORIYA */:
5723
6627
  return createCounterStyleFromRange(value, 0xb66, 0xb6f, true, defaultSuffix);
5724
- case 40 /* PERSIAN */:
6628
+ case 40 /* LIST_STYLE_TYPE.PERSIAN */:
5725
6629
  return createCounterStyleFromRange(value, 0x6f0, 0x6f9, true, defaultSuffix);
5726
- case 43 /* TAMIL */:
6630
+ case 43 /* LIST_STYLE_TYPE.TAMIL */:
5727
6631
  return createCounterStyleFromRange(value, 0xbe6, 0xbef, true, defaultSuffix);
5728
- case 44 /* TELUGU */:
6632
+ case 44 /* LIST_STYLE_TYPE.TELUGU */:
5729
6633
  return createCounterStyleFromRange(value, 0xc66, 0xc6f, true, defaultSuffix);
5730
- case 45 /* THAI */:
6634
+ case 45 /* LIST_STYLE_TYPE.THAI */:
5731
6635
  return createCounterStyleFromRange(value, 0xe50, 0xe59, true, defaultSuffix);
5732
- case 46 /* TIBETAN */:
6636
+ case 46 /* LIST_STYLE_TYPE.TIBETAN */:
5733
6637
  return createCounterStyleFromRange(value, 0xf20, 0xf29, true, defaultSuffix);
5734
- case 3 /* DECIMAL */:
6638
+ case 3 /* LIST_STYLE_TYPE.DECIMAL */:
5735
6639
  default:
5736
6640
  return createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
5737
6641
  }
@@ -5781,7 +6685,7 @@ var Reportly = (function () {
5781
6685
  onclone = this.options.onclone;
5782
6686
  referenceElement = this.clonedReferenceElement;
5783
6687
  if (typeof referenceElement === 'undefined') {
5784
- return [2 /*return*/, Promise.reject("Error finding the " + this.referenceElement.nodeName + " in the cloned document")];
6688
+ return [2 /*return*/, Promise.reject("Error finding the ".concat(this.referenceElement.nodeName, " in the cloned document"))];
5785
6689
  }
5786
6690
  if (!(documentClone.fonts && documentClone.fonts.ready)) return [3 /*break*/, 2];
5787
6691
  return [4 /*yield*/, documentClone.fonts.ready];
@@ -5804,16 +6708,33 @@ var Reportly = (function () {
5804
6708
  }
5805
6709
  });
5806
6710
  }); });
6711
+ /**
6712
+ * The baseURI of the document will be lost after documentClone.open().
6713
+ * We save it before open() to preserve the original base URI for resource resolution.
6714
+ * */
6715
+ var baseUri = documentClone.baseURI;
5807
6716
  documentClone.open();
5808
- documentClone.write(serializeDoctype(document.doctype) + "<html></html>");
6717
+ documentClone.write("".concat(serializeDoctype(document.doctype), "<html></html>"));
5809
6718
  // Chrome scrolls the parent document for some reason after the write to the cloned window???
5810
6719
  restoreOwnerScroll(this.referenceElement.ownerDocument, scrollX, scrollY);
5811
- documentClone.replaceChild(documentClone.adoptNode(this.documentElement), documentClone.documentElement);
6720
+ /**
6721
+ * Note: adoptNode() should be called AFTER documentClone.open() and close()
6722
+ *
6723
+ * In Chrome, calling adoptNode() before or during open/write may cause
6724
+ * styles with uppercase characters in class names (e.g. ".MyClass") to not apply correctly.
6725
+ *
6726
+ * Fix:
6727
+ * - Make sure adoptNode() is called after documentClone.open() and close()
6728
+ * - This allows Chrome to properly match and apply all CSS rules including mixed-case class selectors.
6729
+ * */
6730
+ var adoptedNode = documentClone.adoptNode(this.documentElement);
6731
+ addBase(adoptedNode, baseUri);
6732
+ documentClone.replaceChild(adoptedNode, documentClone.documentElement);
5812
6733
  documentClone.close();
5813
6734
  return iframeLoad;
5814
6735
  };
5815
6736
  DocumentCloner.prototype.createElementClone = function (node) {
5816
- if (isDebugging(node, 2 /* CLONE */)) {
6737
+ if (isDebugging(node, 2 /* DebuggerType.CLONE */)) {
5817
6738
  debugger;
5818
6739
  }
5819
6740
  if (isCanvasElement(node)) {
@@ -5886,7 +6807,7 @@ var Reportly = (function () {
5886
6807
  clonedCanvas.width = canvas.width;
5887
6808
  clonedCanvas.height = canvas.height;
5888
6809
  var ctx = canvas.getContext('2d');
5889
- var clonedCtx = clonedCanvas.getContext('2d');
6810
+ var clonedCtx = clonedCanvas.getContext('2d', { willReadFrequently: true });
5890
6811
  if (clonedCtx) {
5891
6812
  if (!this.options.allowTaint && ctx) {
5892
6813
  clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0);
@@ -6021,16 +6942,16 @@ var Reportly = (function () {
6021
6942
  var anonymousReplacedElement = document.createElement('html2canvaspseudoelement');
6022
6943
  copyCSSStyles(style, anonymousReplacedElement);
6023
6944
  declaration.content.forEach(function (token) {
6024
- if (token.type === 0 /* STRING_TOKEN */) {
6945
+ if (token.type === 0 /* TokenType.STRING_TOKEN */) {
6025
6946
  anonymousReplacedElement.appendChild(document.createTextNode(token.value));
6026
6947
  }
6027
- else if (token.type === 22 /* URL_TOKEN */) {
6948
+ else if (token.type === 22 /* TokenType.URL_TOKEN */) {
6028
6949
  var img = document.createElement('img');
6029
6950
  img.src = token.value;
6030
6951
  img.style.opacity = '1';
6031
6952
  anonymousReplacedElement.appendChild(img);
6032
6953
  }
6033
- else if (token.type === 18 /* FUNCTION */) {
6954
+ else if (token.type === 18 /* TokenType.FUNCTION */) {
6034
6955
  if (token.name === 'attr') {
6035
6956
  var attr = token.values.filter(isIdentToken);
6036
6957
  if (attr.length) {
@@ -6043,7 +6964,7 @@ var Reportly = (function () {
6043
6964
  var counterState = _this.counters.getCounterValue(counter.value);
6044
6965
  var counterType = counterStyle && isIdentToken(counterStyle)
6045
6966
  ? listStyleType.parse(_this.context, counterStyle.value)
6046
- : 3 /* DECIMAL */;
6967
+ : 3 /* LIST_STYLE_TYPE.DECIMAL */;
6047
6968
  anonymousReplacedElement.appendChild(document.createTextNode(createCounterText(counterState, counterType, false)));
6048
6969
  }
6049
6970
  }
@@ -6053,8 +6974,8 @@ var Reportly = (function () {
6053
6974
  var counterStates = _this.counters.getCounterValues(counter.value);
6054
6975
  var counterType_1 = counterStyle && isIdentToken(counterStyle)
6055
6976
  ? listStyleType.parse(_this.context, counterStyle.value)
6056
- : 3 /* DECIMAL */;
6057
- var separator = delim && delim.type === 0 /* STRING_TOKEN */ ? delim.value : '';
6977
+ : 3 /* LIST_STYLE_TYPE.DECIMAL */;
6978
+ var separator = delim && delim.type === 0 /* TokenType.STRING_TOKEN */ ? delim.value : '';
6058
6979
  var text = counterStates
6059
6980
  .map(function (value) { return createCounterText(value, counterType_1, false); })
6060
6981
  .join(separator);
@@ -6063,7 +6984,7 @@ var Reportly = (function () {
6063
6984
  }
6064
6985
  else ;
6065
6986
  }
6066
- else if (token.type === 20 /* IDENT_TOKEN */) {
6987
+ else if (token.type === 20 /* TokenType.IDENT_TOKEN */) {
6067
6988
  switch (token.value) {
6068
6989
  case 'open-quote':
6069
6990
  anonymousReplacedElement.appendChild(document.createTextNode(getQuote(declaration.quotes, _this.quoteDepth++, true)));
@@ -6077,10 +6998,10 @@ var Reportly = (function () {
6077
6998
  }
6078
6999
  }
6079
7000
  });
6080
- anonymousReplacedElement.className = PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + " " + PSEUDO_HIDE_ELEMENT_CLASS_AFTER;
7001
+ anonymousReplacedElement.className = "".concat(PSEUDO_HIDE_ELEMENT_CLASS_BEFORE, " ").concat(PSEUDO_HIDE_ELEMENT_CLASS_AFTER);
6081
7002
  var newClassName = pseudoElt === PseudoElementType.BEFORE
6082
- ? " " + PSEUDO_HIDE_ELEMENT_CLASS_BEFORE
6083
- : " " + PSEUDO_HIDE_ELEMENT_CLASS_AFTER;
7003
+ ? " ".concat(PSEUDO_HIDE_ELEMENT_CLASS_BEFORE)
7004
+ : " ".concat(PSEUDO_HIDE_ELEMENT_CLASS_AFTER);
6084
7005
  if (isSVGElementNode(clone)) {
6085
7006
  clone.className.baseValue += newClassName;
6086
7007
  }
@@ -6154,8 +7075,8 @@ var Reportly = (function () {
6154
7075
  });
6155
7076
  };
6156
7077
  var ignoredStyleProperties = [
6157
- 'all',
6158
- 'd',
7078
+ 'all', // #2476
7079
+ 'd', // #2483
6159
7080
  'content' // Safari shows pseudoelements if content is set
6160
7081
  ];
6161
7082
  var copyCSSStyles = function (style, target) {
@@ -6179,10 +7100,10 @@ var Reportly = (function () {
6179
7100
  str += doctype.internalSubset;
6180
7101
  }
6181
7102
  if (doctype.publicId) {
6182
- str += "\"" + doctype.publicId + "\"";
7103
+ str += "\"".concat(doctype.publicId, "\"");
6183
7104
  }
6184
7105
  if (doctype.systemId) {
6185
- str += "\"" + doctype.systemId + "\"";
7106
+ str += "\"".concat(doctype.systemId, "\"");
6186
7107
  }
6187
7108
  str += '>';
6188
7109
  }
@@ -6206,7 +7127,7 @@ var Reportly = (function () {
6206
7127
  var PSEUDO_HIDE_ELEMENT_CLASS_AFTER = '___html2canvas___pseudoelement_after';
6207
7128
  var PSEUDO_HIDE_ELEMENT_STYLE = "{\n content: \"\" !important;\n display: none !important;\n}";
6208
7129
  var createPseudoHideStyles = function (body) {
6209
- createStyles(body, "." + PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + PSEUDO_BEFORE + PSEUDO_HIDE_ELEMENT_STYLE + "\n ." + PSEUDO_HIDE_ELEMENT_CLASS_AFTER + PSEUDO_AFTER + PSEUDO_HIDE_ELEMENT_STYLE);
7130
+ createStyles(body, ".".concat(PSEUDO_HIDE_ELEMENT_CLASS_BEFORE).concat(PSEUDO_BEFORE).concat(PSEUDO_HIDE_ELEMENT_STYLE, "\n .").concat(PSEUDO_HIDE_ELEMENT_CLASS_AFTER).concat(PSEUDO_AFTER).concat(PSEUDO_HIDE_ELEMENT_STYLE));
6210
7131
  };
6211
7132
  var createStyles = function (body, styles) {
6212
7133
  var document = body.ownerDocument;
@@ -6216,6 +7137,13 @@ var Reportly = (function () {
6216
7137
  body.appendChild(style);
6217
7138
  }
6218
7139
  };
7140
+ var addBase = function (targetELement, baseUri) {
7141
+ var _a;
7142
+ var baseNode = targetELement.ownerDocument.createElement('base');
7143
+ baseNode.href = baseUri;
7144
+ var headEle = targetELement.getElementsByTagName('head').item(0);
7145
+ headEle === null || headEle === void 0 ? void 0 : headEle.insertBefore(baseNode, (_a = headEle === null || headEle === void 0 ? void 0 : headEle.firstChild) !== null && _a !== void 0 ? _a : null);
7146
+ };
6219
7147
 
6220
7148
  var CacheStorage = /** @class */ (function () {
6221
7149
  function CacheStorage() {
@@ -6265,12 +7193,21 @@ var Reportly = (function () {
6265
7193
  };
6266
7194
  Cache.prototype.loadImage = function (key) {
6267
7195
  return __awaiter(this, void 0, void 0, function () {
6268
- var isSameOrigin, useCORS, useProxy, src;
7196
+ var isSameOrigin, _a, useCORS, useProxy, src;
6269
7197
  var _this = this;
6270
- return __generator(this, function (_a) {
6271
- switch (_a.label) {
7198
+ return __generator(this, function (_b) {
7199
+ switch (_b.label) {
6272
7200
  case 0:
6273
- isSameOrigin = CacheStorage.isSameOrigin(key);
7201
+ if (!(typeof this._options.customIsSameOrigin === 'function')) return [3 /*break*/, 2];
7202
+ return [4 /*yield*/, this._options.customIsSameOrigin(key, CacheStorage.isSameOrigin)];
7203
+ case 1:
7204
+ _a = _b.sent();
7205
+ return [3 /*break*/, 3];
7206
+ case 2:
7207
+ _a = CacheStorage.isSameOrigin(key);
7208
+ _b.label = 3;
7209
+ case 3:
7210
+ isSameOrigin = _a;
6274
7211
  useCORS = !isInlineImage(key) && this._options.useCORS === true && FEATURES.SUPPORT_CORS_IMAGES && !isSameOrigin;
6275
7212
  useProxy = !isInlineImage(key) &&
6276
7213
  !isSameOrigin &&
@@ -6287,13 +7224,13 @@ var Reportly = (function () {
6287
7224
  return [2 /*return*/];
6288
7225
  }
6289
7226
  src = key;
6290
- if (!useProxy) return [3 /*break*/, 2];
7227
+ if (!useProxy) return [3 /*break*/, 5];
6291
7228
  return [4 /*yield*/, this.proxy(src)];
6292
- case 1:
6293
- src = _a.sent();
6294
- _a.label = 2;
6295
- case 2:
6296
- this.context.logger.debug("Added image " + key.substring(0, 256));
7229
+ case 4:
7230
+ src = _b.sent();
7231
+ _b.label = 5;
7232
+ case 5:
7233
+ this.context.logger.debug("Added image ".concat(key.substring(0, 256)));
6297
7234
  return [4 /*yield*/, new Promise(function (resolve, reject) {
6298
7235
  var img = new Image();
6299
7236
  img.onload = function () { return resolve(img); };
@@ -6308,10 +7245,10 @@ var Reportly = (function () {
6308
7245
  setTimeout(function () { return resolve(img); }, 500);
6309
7246
  }
6310
7247
  if (_this._options.imageTimeout > 0) {
6311
- setTimeout(function () { return reject("Timed out (" + _this._options.imageTimeout + "ms) loading image"); }, _this._options.imageTimeout);
7248
+ setTimeout(function () { return reject("Timed out (".concat(_this._options.imageTimeout, "ms) loading image")); }, _this._options.imageTimeout);
6312
7249
  }
6313
7250
  })];
6314
- case 3: return [2 /*return*/, _a.sent()];
7251
+ case 6: return [2 /*return*/, _b.sent()];
6315
7252
  }
6316
7253
  });
6317
7254
  });
@@ -6345,19 +7282,19 @@ var Reportly = (function () {
6345
7282
  }
6346
7283
  }
6347
7284
  else {
6348
- reject("Failed to proxy resource " + key + " with status code " + xhr.status);
7285
+ reject("Failed to proxy resource ".concat(key, " with status code ").concat(xhr.status));
6349
7286
  }
6350
7287
  };
6351
7288
  xhr.onerror = reject;
6352
7289
  var queryString = proxy.indexOf('?') > -1 ? '&' : '?';
6353
- xhr.open('GET', "" + proxy + queryString + "url=" + encodeURIComponent(src) + "&responseType=" + responseType);
7290
+ xhr.open('GET', "".concat(proxy).concat(queryString, "url=").concat(encodeURIComponent(src), "&responseType=").concat(responseType));
6354
7291
  if (responseType !== 'text' && xhr instanceof XMLHttpRequest) {
6355
7292
  xhr.responseType = responseType;
6356
7293
  }
6357
7294
  if (_this._options.imageTimeout) {
6358
7295
  var timeout_1 = _this._options.imageTimeout;
6359
7296
  xhr.timeout = timeout_1;
6360
- xhr.ontimeout = function () { return reject("Timed out (" + timeout_1 + "ms) proxying " + key); };
7297
+ xhr.ontimeout = function () { return reject("Timed out (".concat(timeout_1, "ms) proxying ").concat(key)); };
6361
7298
  }
6362
7299
  xhr.send();
6363
7300
  });
@@ -6375,7 +7312,7 @@ var Reportly = (function () {
6375
7312
 
6376
7313
  var Vector = /** @class */ (function () {
6377
7314
  function Vector(x, y) {
6378
- this.type = 0 /* VECTOR */;
7315
+ this.type = 0 /* PathType.VECTOR */;
6379
7316
  this.x = x;
6380
7317
  this.y = y;
6381
7318
  }
@@ -6390,7 +7327,7 @@ var Reportly = (function () {
6390
7327
  };
6391
7328
  var BezierCurve = /** @class */ (function () {
6392
7329
  function BezierCurve(start, startControl, endControl, end) {
6393
- this.type = 1 /* BEZIER_CURVE */;
7330
+ this.type = 1 /* PathType.BEZIER_CURVE */;
6394
7331
  this.start = start;
6395
7332
  this.startControl = startControl;
6396
7333
  this.endControl = endControl;
@@ -6413,7 +7350,7 @@ var Reportly = (function () {
6413
7350
  };
6414
7351
  return BezierCurve;
6415
7352
  }());
6416
- var isBezierCurve = function (path) { return path.type === 1 /* BEZIER_CURVE */; };
7353
+ var isBezierCurve = function (path) { return path.type === 1 /* PathType.BEZIER_CURVE */; };
6417
7354
 
6418
7355
  var BoundCurves = /** @class */ (function () {
6419
7356
  function BoundCurves(element) {
@@ -6600,8 +7537,8 @@ var Reportly = (function () {
6600
7537
  this.offsetX = offsetX;
6601
7538
  this.offsetY = offsetY;
6602
7539
  this.matrix = matrix;
6603
- this.type = 0 /* TRANSFORM */;
6604
- this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
7540
+ this.type = 0 /* EffectType.TRANSFORM */;
7541
+ this.target = 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */;
6605
7542
  }
6606
7543
  return TransformEffect;
6607
7544
  }());
@@ -6609,23 +7546,23 @@ var Reportly = (function () {
6609
7546
  function ClipEffect(path, target) {
6610
7547
  this.path = path;
6611
7548
  this.target = target;
6612
- this.type = 1 /* CLIP */;
7549
+ this.type = 1 /* EffectType.CLIP */;
6613
7550
  }
6614
7551
  return ClipEffect;
6615
7552
  }());
6616
7553
  var OpacityEffect = /** @class */ (function () {
6617
7554
  function OpacityEffect(opacity) {
6618
7555
  this.opacity = opacity;
6619
- this.type = 2 /* OPACITY */;
6620
- this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
7556
+ this.type = 2 /* EffectType.OPACITY */;
7557
+ this.target = 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */;
6621
7558
  }
6622
7559
  return OpacityEffect;
6623
7560
  }());
6624
7561
  var isTransformEffect = function (effect) {
6625
- return effect.type === 0 /* TRANSFORM */;
7562
+ return effect.type === 0 /* EffectType.TRANSFORM */;
6626
7563
  };
6627
- var isClipEffect = function (effect) { return effect.type === 1 /* CLIP */; };
6628
- var isOpacityEffect = function (effect) { return effect.type === 2 /* OPACITY */; };
7564
+ var isClipEffect = function (effect) { return effect.type === 1 /* EffectType.CLIP */; };
7565
+ var isOpacityEffect = function (effect) { return effect.type === 2 /* EffectType.OPACITY */; };
6629
7566
 
6630
7567
  var equalPath = function (a, b) {
6631
7568
  if (a.length === b.length) {
@@ -6671,40 +7608,51 @@ var Reportly = (function () {
6671
7608
  if (this.container.styles.opacity < 1) {
6672
7609
  this.effects.push(new OpacityEffect(this.container.styles.opacity));
6673
7610
  }
7611
+ if (this.container.styles.rotate !== null) {
7612
+ var offsetX = this.container.bounds.left + this.container.styles.transformOrigin[0].number;
7613
+ var offsetY = this.container.bounds.top + this.container.styles.transformOrigin[1].number;
7614
+ // Apply rotate property if present
7615
+ var angle = this.container.styles.rotate;
7616
+ var rad = (angle * Math.PI) / 180;
7617
+ var cos = Math.cos(rad);
7618
+ var sin = Math.sin(rad);
7619
+ var rotateMatrix = [cos, sin, -sin, cos, 0, 0];
7620
+ this.effects.push(new TransformEffect(offsetX, offsetY, rotateMatrix));
7621
+ }
6674
7622
  if (this.container.styles.transform !== null) {
6675
7623
  var offsetX = this.container.bounds.left + this.container.styles.transformOrigin[0].number;
6676
7624
  var offsetY = this.container.bounds.top + this.container.styles.transformOrigin[1].number;
6677
7625
  var matrix = this.container.styles.transform;
6678
7626
  this.effects.push(new TransformEffect(offsetX, offsetY, matrix));
6679
7627
  }
6680
- if (this.container.styles.overflowX !== 0 /* VISIBLE */) {
7628
+ if (this.container.styles.overflowX !== 0 /* OVERFLOW.VISIBLE */) {
6681
7629
  var borderBox = calculateBorderBoxPath(this.curves);
6682
7630
  var paddingBox = calculatePaddingBoxPath(this.curves);
6683
7631
  if (equalPath(borderBox, paddingBox)) {
6684
- this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
7632
+ this.effects.push(new ClipEffect(borderBox, 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */));
6685
7633
  }
6686
7634
  else {
6687
- this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */));
6688
- this.effects.push(new ClipEffect(paddingBox, 4 /* CONTENT */));
7635
+ this.effects.push(new ClipEffect(borderBox, 2 /* EffectTarget.BACKGROUND_BORDERS */));
7636
+ this.effects.push(new ClipEffect(paddingBox, 4 /* EffectTarget.CONTENT */));
6689
7637
  }
6690
7638
  }
6691
7639
  }
6692
7640
  ElementPaint.prototype.getEffects = function (target) {
6693
- var inFlow = [2 /* ABSOLUTE */, 3 /* FIXED */].indexOf(this.container.styles.position) === -1;
7641
+ var inFlow = [2 /* POSITION.ABSOLUTE */, 3 /* POSITION.FIXED */].indexOf(this.container.styles.position) === -1;
6694
7642
  var parent = this.parent;
6695
7643
  var effects = this.effects.slice(0);
6696
7644
  while (parent) {
6697
7645
  var croplessEffects = parent.effects.filter(function (effect) { return !isClipEffect(effect); });
6698
- if (inFlow || parent.container.styles.position !== 0 /* STATIC */ || !parent.parent) {
6699
- effects.unshift.apply(effects, croplessEffects);
6700
- inFlow = [2 /* ABSOLUTE */, 3 /* FIXED */].indexOf(parent.container.styles.position) === -1;
6701
- if (parent.container.styles.overflowX !== 0 /* VISIBLE */) {
7646
+ if (inFlow || parent.container.styles.position !== 0 /* POSITION.STATIC */ || !parent.parent) {
7647
+ inFlow = [2 /* POSITION.ABSOLUTE */, 3 /* POSITION.FIXED */].indexOf(parent.container.styles.position) === -1;
7648
+ if (parent.container.styles.overflowX !== 0 /* OVERFLOW.VISIBLE */) {
6702
7649
  var borderBox = calculateBorderBoxPath(parent.curves);
6703
7650
  var paddingBox = calculatePaddingBoxPath(parent.curves);
6704
7651
  if (!equalPath(borderBox, paddingBox)) {
6705
- effects.unshift(new ClipEffect(paddingBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
7652
+ effects.unshift(new ClipEffect(paddingBox, 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */));
6706
7653
  }
6707
7654
  }
7655
+ effects.unshift.apply(effects, croplessEffects);
6708
7656
  }
6709
7657
  else {
6710
7658
  effects.unshift.apply(effects, croplessEffects);
@@ -6717,13 +7665,13 @@ var Reportly = (function () {
6717
7665
  }());
6718
7666
  var parseStackTree = function (parent, stackingContext, realStackingContext, listItems) {
6719
7667
  parent.container.elements.forEach(function (child) {
6720
- var treatAsRealStackingContext = contains(child.flags, 4 /* CREATES_REAL_STACKING_CONTEXT */);
6721
- var createsStackingContext = contains(child.flags, 2 /* CREATES_STACKING_CONTEXT */);
7668
+ var treatAsRealStackingContext = contains(child.flags, 4 /* FLAGS.CREATES_REAL_STACKING_CONTEXT */);
7669
+ var createsStackingContext = contains(child.flags, 2 /* FLAGS.CREATES_STACKING_CONTEXT */);
6722
7670
  var paintContainer = new ElementPaint(child, parent);
6723
- if (contains(child.styles.display, 2048 /* LIST_ITEM */)) {
7671
+ if (contains(child.styles.display, 2048 /* DISPLAY.LIST_ITEM */)) {
6724
7672
  listItems.push(paintContainer);
6725
7673
  }
6726
- var listOwnerItems = contains(child.flags, 8 /* IS_LIST_OWNER */) ? [] : listItems;
7674
+ var listOwnerItems = contains(child.flags, 8 /* FLAGS.IS_LIST_OWNER */) ? [] : listItems;
6727
7675
  if (treatAsRealStackingContext || createsStackingContext) {
6728
7676
  var parentStack = treatAsRealStackingContext || child.styles.isPositioned() ? realStackingContext : stackingContext;
6729
7677
  var stack = new StackingContext(paintContainer);
@@ -6780,7 +7728,7 @@ var Reportly = (function () {
6780
7728
  }
6781
7729
  parseStackTree(paintContainer, stackingContext, realStackingContext, listOwnerItems);
6782
7730
  }
6783
- if (contains(child.flags, 8 /* IS_LIST_OWNER */)) {
7731
+ if (contains(child.flags, 8 /* FLAGS.IS_LIST_OWNER */)) {
6784
7732
  processListItems(child, listOwnerItems);
6785
7733
  }
6786
7734
  });
@@ -6921,19 +7869,19 @@ var Reportly = (function () {
6921
7869
  };
6922
7870
 
6923
7871
  var calculateBackgroundPositioningArea = function (backgroundOrigin, element) {
6924
- if (backgroundOrigin === 0 /* BORDER_BOX */) {
7872
+ if (backgroundOrigin === 0 /* BACKGROUND_ORIGIN.BORDER_BOX */) {
6925
7873
  return element.bounds;
6926
7874
  }
6927
- if (backgroundOrigin === 2 /* CONTENT_BOX */) {
7875
+ if (backgroundOrigin === 2 /* BACKGROUND_ORIGIN.CONTENT_BOX */) {
6928
7876
  return contentBox(element);
6929
7877
  }
6930
7878
  return paddingBox(element);
6931
7879
  };
6932
7880
  var calculateBackgroundPaintingArea = function (backgroundClip, element) {
6933
- if (backgroundClip === 0 /* BORDER_BOX */) {
7881
+ if (backgroundClip === 0 /* BACKGROUND_CLIP.BORDER_BOX */) {
6934
7882
  return element.bounds;
6935
7883
  }
6936
- if (backgroundClip === 2 /* CONTENT_BOX */) {
7884
+ if (backgroundClip === 2 /* BACKGROUND_CLIP.CONTENT_BOX */) {
6937
7885
  return contentBox(element);
6938
7886
  }
6939
7887
  return paddingBox(element);
@@ -6947,6 +7895,8 @@ var Reportly = (function () {
6947
7895
  var path = calculateBackgroundRepeatPath(getBackgroundValueForIndex(container.styles.backgroundRepeat, index), position, backgroundImageSize, backgroundPositioningArea, backgroundPaintingArea);
6948
7896
  var offsetX = Math.round(backgroundPositioningArea.left + position[0]);
6949
7897
  var offsetY = Math.round(backgroundPositioningArea.top + position[1]);
7898
+ sizeWidth = Math.max(1, sizeWidth);
7899
+ sizeHeight = Math.max(1, sizeHeight);
6950
7900
  return [path, offsetX, offsetY, sizeWidth, sizeHeight];
6951
7901
  };
6952
7902
  var isAuto = function (token) { return isIdentToken(token) && token.value === BACKGROUND_SIZE.AUTO; };
@@ -7061,21 +8011,21 @@ var Reportly = (function () {
7061
8011
  var x = _a[0], y = _a[1];
7062
8012
  var width = _b[0], height = _b[1];
7063
8013
  switch (repeat) {
7064
- case 2 /* REPEAT_X */:
8014
+ case 2 /* BACKGROUND_REPEAT.REPEAT_X */:
7065
8015
  return [
7066
8016
  new Vector(Math.round(backgroundPositioningArea.left), Math.round(backgroundPositioningArea.top + y)),
7067
8017
  new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(backgroundPositioningArea.top + y)),
7068
8018
  new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(height + backgroundPositioningArea.top + y)),
7069
8019
  new Vector(Math.round(backgroundPositioningArea.left), Math.round(height + backgroundPositioningArea.top + y))
7070
8020
  ];
7071
- case 3 /* REPEAT_Y */:
8021
+ case 3 /* BACKGROUND_REPEAT.REPEAT_Y */:
7072
8022
  return [
7073
8023
  new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top)),
7074
8024
  new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top)),
7075
8025
  new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top)),
7076
8026
  new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top))
7077
8027
  ];
7078
- case 1 /* NO_REPEAT */:
8028
+ case 1 /* BACKGROUND_REPEAT.NO_REPEAT */:
7079
8029
  return [
7080
8030
  new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top + y)),
7081
8031
  new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top + y)),
@@ -7135,7 +8085,7 @@ var Reportly = (function () {
7135
8085
  return { baseline: baseline, middle: middle };
7136
8086
  };
7137
8087
  FontMetrics.prototype.getMetrics = function (fontFamily, fontSize) {
7138
- var key = fontFamily + " " + fontSize;
8088
+ var key = "".concat(fontFamily, " ").concat(fontSize);
7139
8089
  if (typeof this._data[key] === 'undefined') {
7140
8090
  this._data[key] = this.parseMetrics(fontFamily, fontSize);
7141
8091
  }
@@ -7163,15 +8113,15 @@ var Reportly = (function () {
7163
8113
  if (!options.canvas) {
7164
8114
  _this.canvas.width = Math.floor(options.width * options.scale);
7165
8115
  _this.canvas.height = Math.floor(options.height * options.scale);
7166
- _this.canvas.style.width = options.width + "px";
7167
- _this.canvas.style.height = options.height + "px";
8116
+ _this.canvas.style.width = "".concat(options.width, "px");
8117
+ _this.canvas.style.height = "".concat(options.height, "px");
7168
8118
  }
7169
8119
  _this.fontMetrics = new FontMetrics(document);
7170
8120
  _this.ctx.scale(_this.options.scale, _this.options.scale);
7171
8121
  _this.ctx.translate(-options.x, -options.y);
7172
8122
  _this.ctx.textBaseline = 'bottom';
7173
8123
  _this._activeEffects = [];
7174
- _this.context.logger.debug("Canvas renderer initialized (" + options.width + "x" + options.height + ") with scale " + options.scale);
8124
+ _this.context.logger.debug("Canvas renderer initialized (".concat(options.width, "x").concat(options.height, ") with scale ").concat(options.scale));
7175
8125
  return _this;
7176
8126
  }
7177
8127
  CanvasRenderer.prototype.applyEffects = function (effects) {
@@ -7223,7 +8173,7 @@ var Reportly = (function () {
7223
8173
  return __generator(this, function (_a) {
7224
8174
  switch (_a.label) {
7225
8175
  case 0:
7226
- if (contains(paint.container.flags, 16 /* DEBUG_RENDER */)) {
8176
+ if (contains(paint.container.flags, 16 /* FLAGS.DEBUG_RENDER */)) {
7227
8177
  debugger;
7228
8178
  }
7229
8179
  if (!paint.container.styles.isVisible()) return [3 /*break*/, 3];
@@ -7242,7 +8192,15 @@ var Reportly = (function () {
7242
8192
  CanvasRenderer.prototype.renderTextWithLetterSpacing = function (text, letterSpacing, baseline) {
7243
8193
  var _this = this;
7244
8194
  if (letterSpacing === 0) {
7245
- this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + baseline);
8195
+ // Fixed an issue with characters moving up in non-Firefox.
8196
+ // https://github.com/niklasvh/html2canvas/issues/2107#issuecomment-692462900
8197
+ if (navigator.userAgent.indexOf('Firefox') === -1) {
8198
+ this.ctx.textBaseline = 'ideographic';
8199
+ this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height);
8200
+ }
8201
+ else {
8202
+ this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + baseline);
8203
+ }
7246
8204
  }
7247
8205
  else {
7248
8206
  var letters = segmentGraphemes(text.text);
@@ -7258,8 +8216,8 @@ var Reportly = (function () {
7258
8216
  .join('');
7259
8217
  var fontFamily = fixIOSSystemFonts(styles.fontFamily).join(', ');
7260
8218
  var fontSize = isDimensionToken(styles.fontSize)
7261
- ? "" + styles.fontSize.number + styles.fontSize.unit
7262
- : styles.fontSize.number + "px";
8219
+ ? "".concat(styles.fontSize.number).concat(styles.fontSize.unit)
8220
+ : "".concat(styles.fontSize.number, "px");
7263
8221
  return [
7264
8222
  [styles.fontStyle, fontVariant, styles.fontWeight, fontSize, fontFamily].join(' '),
7265
8223
  fontFamily,
@@ -7268,22 +8226,21 @@ var Reportly = (function () {
7268
8226
  };
7269
8227
  CanvasRenderer.prototype.renderTextNode = function (text, styles) {
7270
8228
  return __awaiter(this, void 0, void 0, function () {
7271
- var _a, font, fontFamily, fontSize, _b, baseline, middle, paintOrder;
8229
+ var font, paintOrder;
7272
8230
  var _this = this;
7273
- return __generator(this, function (_c) {
7274
- _a = this.createFontStyle(styles), font = _a[0], fontFamily = _a[1], fontSize = _a[2];
8231
+ return __generator(this, function (_a) {
8232
+ font = this.createFontStyle(styles)[0];
7275
8233
  this.ctx.font = font;
7276
- this.ctx.direction = styles.direction === 1 /* RTL */ ? 'rtl' : 'ltr';
8234
+ this.ctx.direction = styles.direction === 1 /* DIRECTION.RTL */ ? 'rtl' : 'ltr';
7277
8235
  this.ctx.textAlign = 'left';
7278
8236
  this.ctx.textBaseline = 'alphabetic';
7279
- _b = this.fontMetrics.getMetrics(fontFamily, fontSize), baseline = _b.baseline, middle = _b.middle;
7280
8237
  paintOrder = styles.paintOrder;
7281
8238
  text.textBounds.forEach(function (text) {
7282
8239
  paintOrder.forEach(function (paintOrderLayer) {
7283
8240
  switch (paintOrderLayer) {
7284
- case 0 /* FILL */:
8241
+ case 0 /* PAINT_ORDER_LAYER.FILL */:
7285
8242
  _this.ctx.fillStyle = asString(styles.color);
7286
- _this.renderTextWithLetterSpacing(text, styles.letterSpacing, baseline);
8243
+ _this.renderTextWithLetterSpacing(text, styles.letterSpacing, styles.fontSize.number);
7287
8244
  var textShadows = styles.textShadow;
7288
8245
  if (textShadows.length && text.text.trim().length) {
7289
8246
  textShadows
@@ -7294,7 +8251,7 @@ var Reportly = (function () {
7294
8251
  _this.ctx.shadowOffsetX = textShadow.offsetX.number * _this.options.scale;
7295
8252
  _this.ctx.shadowOffsetY = textShadow.offsetY.number * _this.options.scale;
7296
8253
  _this.ctx.shadowBlur = textShadow.blur.number;
7297
- _this.renderTextWithLetterSpacing(text, styles.letterSpacing, baseline);
8254
+ _this.renderTextWithLetterSpacing(text, styles.letterSpacing, styles.fontSize.number);
7298
8255
  });
7299
8256
  _this.ctx.shadowColor = '';
7300
8257
  _this.ctx.shadowOffsetX = 0;
@@ -7303,32 +8260,30 @@ var Reportly = (function () {
7303
8260
  }
7304
8261
  if (styles.textDecorationLine.length) {
7305
8262
  _this.ctx.fillStyle = asString(styles.textDecorationColor || styles.color);
8263
+ var decorationLineHeight_1 = 1;
7306
8264
  styles.textDecorationLine.forEach(function (textDecorationLine) {
8265
+ // Fix the issue where textDecorationLine exhibits x-axis positioning errors on high-resolution devices due to varying devicePixelRatio, corrected by using relative values of element heights.
7307
8266
  switch (textDecorationLine) {
7308
- case 1 /* UNDERLINE */:
7309
- // Draws a line at the baseline of the font
7310
- // TODO As some browsers display the line as more than 1px if the font-size is big,
7311
- // need to take that into account both in position and size
7312
- _this.ctx.fillRect(text.bounds.left, Math.round(text.bounds.top + baseline), text.bounds.width, 1);
8267
+ case 1 /* TEXT_DECORATION_LINE.UNDERLINE */:
8268
+ _this.ctx.fillRect(text.bounds.left, text.bounds.top + text.bounds.height - decorationLineHeight_1, text.bounds.width, decorationLineHeight_1);
7313
8269
  break;
7314
- case 2 /* OVERLINE */:
7315
- _this.ctx.fillRect(text.bounds.left, Math.round(text.bounds.top), text.bounds.width, 1);
8270
+ case 2 /* TEXT_DECORATION_LINE.OVERLINE */:
8271
+ _this.ctx.fillRect(text.bounds.left, text.bounds.top, text.bounds.width, decorationLineHeight_1);
7316
8272
  break;
7317
- case 3 /* LINE_THROUGH */:
7318
- // TODO try and find exact position for line-through
7319
- _this.ctx.fillRect(text.bounds.left, Math.ceil(text.bounds.top + middle), text.bounds.width, 1);
8273
+ case 3 /* TEXT_DECORATION_LINE.LINE_THROUGH */:
8274
+ _this.ctx.fillRect(text.bounds.left, text.bounds.top + (text.bounds.height / 2 - decorationLineHeight_1 / 2), text.bounds.width, decorationLineHeight_1);
7320
8275
  break;
7321
8276
  }
7322
8277
  });
7323
8278
  }
7324
8279
  break;
7325
- case 1 /* STROKE */:
8280
+ case 1 /* PAINT_ORDER_LAYER.STROKE */:
7326
8281
  if (styles.webkitTextStrokeWidth && text.text.trim().length) {
7327
8282
  _this.ctx.strokeStyle = asString(styles.webkitTextStrokeColor);
7328
8283
  _this.ctx.lineWidth = styles.webkitTextStrokeWidth;
7329
8284
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7330
8285
  _this.ctx.lineJoin = !!window.chrome ? 'miter' : 'round';
7331
- _this.ctx.strokeText(text.text, text.bounds.left, text.bounds.top + baseline);
8286
+ _this.ctx.strokeText(text.text, text.bounds.left, text.bounds.top + text.bounds.height);
7332
8287
  }
7333
8288
  _this.ctx.strokeStyle = '';
7334
8289
  _this.ctx.lineWidth = 0;
@@ -7342,23 +8297,99 @@ var Reportly = (function () {
7342
8297
  });
7343
8298
  };
7344
8299
  CanvasRenderer.prototype.renderReplacedElement = function (container, curves, image) {
7345
- if (image && container.intrinsicWidth > 0 && container.intrinsicHeight > 0) {
8300
+ var intrinsicWidth = image.naturalWidth || container.intrinsicWidth;
8301
+ var intrinsicHeight = image.naturalHeight || container.intrinsicHeight;
8302
+ if (image && intrinsicWidth > 0 && intrinsicHeight > 0) {
7346
8303
  var box = contentBox(container);
7347
8304
  var path = calculatePaddingBoxPath(curves);
7348
8305
  this.path(path);
7349
8306
  this.ctx.save();
7350
8307
  this.ctx.clip();
7351
- this.ctx.drawImage(image, 0, 0, container.intrinsicWidth, container.intrinsicHeight, box.left, box.top, box.width, box.height);
8308
+ var sx = 0, sy = 0, sw = intrinsicWidth, sh = intrinsicHeight, dx = box.left, dy = box.top, dw = box.width, dh = box.height;
8309
+ var objectFit = container.styles.objectFit;
8310
+ var boxRatio = dw / dh;
8311
+ var imgRatio = sw / sh;
8312
+ if (objectFit === 2 /* OBJECT_FIT.CONTAIN */) {
8313
+ if (imgRatio > boxRatio) {
8314
+ dh = dw / imgRatio;
8315
+ dy += (box.height - dh) / 2;
8316
+ }
8317
+ else {
8318
+ dw = dh * imgRatio;
8319
+ dx += (box.width - dw) / 2;
8320
+ }
8321
+ }
8322
+ else if (objectFit === 4 /* OBJECT_FIT.COVER */) {
8323
+ if (imgRatio > boxRatio) {
8324
+ sw = sh * boxRatio;
8325
+ sx += (intrinsicWidth - sw) / 2;
8326
+ }
8327
+ else {
8328
+ sh = sw / boxRatio;
8329
+ sy += (intrinsicHeight - sh) / 2;
8330
+ }
8331
+ }
8332
+ else if (objectFit === 8 /* OBJECT_FIT.NONE */) {
8333
+ if (sw > dw) {
8334
+ sx += (sw - dw) / 2;
8335
+ sw = dw;
8336
+ }
8337
+ else {
8338
+ dx += (dw - sw) / 2;
8339
+ dw = sw;
8340
+ }
8341
+ if (sh > dh) {
8342
+ sy += (sh - dh) / 2;
8343
+ sh = dh;
8344
+ }
8345
+ else {
8346
+ dy += (dh - sh) / 2;
8347
+ dh = sh;
8348
+ }
8349
+ }
8350
+ else if (objectFit === 16 /* OBJECT_FIT.SCALE_DOWN */) {
8351
+ var containW = imgRatio > boxRatio ? dw : dh * imgRatio;
8352
+ var noneW = sw > dw ? sw : dw;
8353
+ if (containW < noneW) {
8354
+ if (imgRatio > boxRatio) {
8355
+ dh = dw / imgRatio;
8356
+ dy += (box.height - dh) / 2;
8357
+ }
8358
+ else {
8359
+ dw = dh * imgRatio;
8360
+ dx += (box.width - dw) / 2;
8361
+ }
8362
+ }
8363
+ else {
8364
+ if (sw > dw) {
8365
+ sx += (sw - dw) / 2;
8366
+ sw = dw;
8367
+ }
8368
+ else {
8369
+ dx += (dw - sw) / 2;
8370
+ dw = sw;
8371
+ }
8372
+ if (sh > dh) {
8373
+ sy += (sh - dh) / 2;
8374
+ sh = dh;
8375
+ }
8376
+ else {
8377
+ dy += (dh - sh) / 2;
8378
+ dh = sh;
8379
+ }
8380
+ }
8381
+ }
8382
+ this.ctx.drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh);
7352
8383
  this.ctx.restore();
7353
8384
  }
7354
8385
  };
7355
8386
  CanvasRenderer.prototype.renderNodeContent = function (paint) {
7356
8387
  return __awaiter(this, void 0, void 0, function () {
7357
- var container, curves, styles, _i, _a, child, image, image, iframeRenderer, canvas, size, _b, fontFamily, fontSize, baseline, bounds, x, textBounds, img, image, url, fontFamily, bounds;
8388
+ var container, curves, styles, _i, _a, child, image, image, iframeRenderer, canvas, size, _b, font, fontFamily, fontSize, baseline, bounds, x, textBounds, img, image, url, font, bounds;
7358
8389
  return __generator(this, function (_c) {
7359
8390
  switch (_c.label) {
7360
8391
  case 0:
7361
- this.applyEffects(paint.getEffects(4 /* CONTENT */));
8392
+ this.applyEffects(paint.getEffects(4 /* EffectTarget.CONTENT */));
7362
8393
  container = paint.container;
7363
8394
  curves = paint.curves;
7364
8395
  styles = container.styles;
@@ -7386,7 +8417,7 @@ var Reportly = (function () {
7386
8417
  return [3 /*break*/, 8];
7387
8418
  case 7:
7388
8419
  _c.sent();
7389
- this.context.logger.error("Error loading image " + container.src);
8420
+ this.context.logger.error("Error loading image ".concat(container.src));
7390
8421
  return [3 /*break*/, 8];
7391
8422
  case 8:
7392
8423
  if (container instanceof CanvasElementContainer) {
@@ -7403,7 +8434,7 @@ var Reportly = (function () {
7403
8434
  return [3 /*break*/, 12];
7404
8435
  case 11:
7405
8436
  _c.sent();
7406
- this.context.logger.error("Error loading svg " + container.svg.substring(0, 255));
8437
+ this.context.logger.error("Error loading svg ".concat(container.svg.substring(0, 255)));
7407
8438
  return [3 /*break*/, 12];
7408
8439
  case 12:
7409
8440
  if (!(container instanceof IFrameElementContainer && container.tree)) return [3 /*break*/, 14];
@@ -7454,19 +8485,19 @@ var Reportly = (function () {
7454
8485
  }
7455
8486
  }
7456
8487
  if (isTextInputElement(container) && container.value.length) {
7457
- _b = this.createFontStyle(styles), fontFamily = _b[0], fontSize = _b[1];
8488
+ _b = this.createFontStyle(styles), font = _b[0], fontFamily = _b[1], fontSize = _b[2];
7458
8489
  baseline = this.fontMetrics.getMetrics(fontFamily, fontSize).baseline;
7459
- this.ctx.font = fontFamily;
8490
+ this.ctx.font = font;
7460
8491
  this.ctx.fillStyle = asString(styles.color);
7461
8492
  this.ctx.textBaseline = 'alphabetic';
7462
8493
  this.ctx.textAlign = canvasTextAlign(container.styles.textAlign);
7463
8494
  bounds = contentBox(container);
7464
8495
  x = 0;
7465
8496
  switch (container.styles.textAlign) {
7466
- case 1 /* CENTER */:
8497
+ case 1 /* TEXT_ALIGN.CENTER */:
7467
8498
  x += bounds.width / 2;
7468
8499
  break;
7469
- case 2 /* RIGHT */:
8500
+ case 2 /* TEXT_ALIGN.RIGHT */:
7470
8501
  x += bounds.width;
7471
8502
  break;
7472
8503
  }
@@ -7484,10 +8515,10 @@ var Reportly = (function () {
7484
8515
  this.ctx.textBaseline = 'alphabetic';
7485
8516
  this.ctx.textAlign = 'left';
7486
8517
  }
7487
- if (!contains(container.styles.display, 2048 /* LIST_ITEM */)) return [3 /*break*/, 20];
8518
+ if (!contains(container.styles.display, 2048 /* DISPLAY.LIST_ITEM */)) return [3 /*break*/, 20];
7488
8519
  if (!(container.styles.listStyleImage !== null)) return [3 /*break*/, 19];
7489
8520
  img = container.styles.listStyleImage;
7490
- if (!(img.type === 0 /* URL */)) return [3 /*break*/, 18];
8521
+ if (!(img.type === 0 /* CSSImageType.URL */)) return [3 /*break*/, 18];
7491
8522
  image = void 0;
7492
8523
  url = img.url;
7493
8524
  _c.label = 15;
@@ -7500,13 +8531,13 @@ var Reportly = (function () {
7500
8531
  return [3 /*break*/, 18];
7501
8532
  case 17:
7502
8533
  _c.sent();
7503
- this.context.logger.error("Error loading list-style-image " + url);
8534
+ this.context.logger.error("Error loading list-style-image ".concat(url));
7504
8535
  return [3 /*break*/, 18];
7505
8536
  case 18: return [3 /*break*/, 20];
7506
8537
  case 19:
7507
- if (paint.listValue && container.styles.listStyleType !== -1 /* NONE */) {
7508
- fontFamily = this.createFontStyle(styles)[0];
7509
- this.ctx.font = fontFamily;
8538
+ if (paint.listValue && container.styles.listStyleType !== -1 /* LIST_STYLE_TYPE.NONE */) {
8539
+ font = this.createFontStyle(styles)[0];
8540
+ this.ctx.font = font;
7510
8541
  this.ctx.fillStyle = asString(styles.color);
7511
8542
  this.ctx.textBaseline = 'middle';
7512
8543
  this.ctx.textAlign = 'right';
@@ -7527,7 +8558,7 @@ var Reportly = (function () {
7527
8558
  return __generator(this, function (_p) {
7528
8559
  switch (_p.label) {
7529
8560
  case 0:
7530
- if (contains(stack.element.container.flags, 16 /* DEBUG_RENDER */)) {
8561
+ if (contains(stack.element.container.flags, 16 /* FLAGS.DEBUG_RENDER */)) {
7531
8562
  debugger;
7532
8563
  }
7533
8564
  // https://www.w3.org/TR/css-position-3/#painting-order
@@ -7675,10 +8706,11 @@ var Reportly = (function () {
7675
8706
  this.ctx.translate(-offsetX, -offsetY);
7676
8707
  };
7677
8708
  CanvasRenderer.prototype.resizeImage = function (image, width, height) {
8709
+ // https://github.com/niklasvh/html2canvas/pull/2911
8710
+ // if (image.width === width && image.height === height) {
8711
+ // return image;
8712
+ // }
7678
8713
  var _a;
7679
- if (image.width === width && image.height === height) {
7680
- return image;
7681
- }
7682
8714
  var ownerDocument = (_a = this.canvas.ownerDocument) !== null && _a !== void 0 ? _a : document;
7683
8715
  var canvas = ownerDocument.createElement('canvas');
7684
8716
  canvas.width = Math.max(1, width);
@@ -7695,11 +8727,11 @@ var Reportly = (function () {
7695
8727
  case 0:
7696
8728
  index = container.styles.backgroundImage.length - 1;
7697
8729
  _loop_1 = function (backgroundImage) {
7698
- var image, url, _c, path, x, y, width, height, pattern, _d, path, x, y, width, height, _e, lineLength, x0, x1, y0, y1, canvas, ctx, gradient_1, pattern, _f, path, left, top_1, width, height, position, x, y, _g, rx, ry, radialGradient_1, midX, midY, f, invF;
8730
+ var image, url, imageWidth, imageHeight, _c, path, x, y, width, height, pattern, _d, path, x, y, width, height, _e, lineLength, x0, x1, y0, y1, canvas, ctx, gradient_1, pattern, _f, path, left, top_1, width, height, position, x, y, _g, rx, ry, radialGradient_1, midX, midY, f, invF;
7699
8731
  return __generator(this, function (_h) {
7700
8732
  switch (_h.label) {
7701
8733
  case 0:
7702
- if (!(backgroundImage.type === 0 /* URL */)) return [3 /*break*/, 5];
8734
+ if (!(backgroundImage.type === 0 /* CSSImageType.URL */)) return [3 /*break*/, 5];
7703
8735
  image = void 0;
7704
8736
  url = backgroundImage.url;
7705
8737
  _h.label = 1;
@@ -7711,14 +8743,16 @@ var Reportly = (function () {
7711
8743
  return [3 /*break*/, 4];
7712
8744
  case 3:
7713
8745
  _h.sent();
7714
- this_1.context.logger.error("Error loading background-image " + url);
8746
+ this_1.context.logger.error("Error loading background-image ".concat(url));
7715
8747
  return [3 /*break*/, 4];
7716
8748
  case 4:
7717
8749
  if (image) {
8750
+ imageWidth = isNaN(image.width) || image.width === 0 ? 1 : image.width;
8751
+ imageHeight = isNaN(image.height) || image.height === 0 ? 1 : image.height;
7718
8752
  _c = calculateBackgroundRendering(container, index, [
7719
- image.width,
7720
- image.height,
7721
- image.width / image.height
8753
+ imageWidth,
8754
+ imageHeight,
8755
+ imageWidth / imageHeight
7722
8756
  ]), path = _c[0], x = _c[1], y = _c[2], width = _c[3], height = _c[4];
7723
8757
  pattern = this_1.ctx.createPattern(this_1.resizeImage(image, width, height), 'repeat');
7724
8758
  this_1.renderRepeat(path, pattern, x, y);
@@ -7733,7 +8767,7 @@ var Reportly = (function () {
7733
8767
  canvas.height = height;
7734
8768
  ctx = canvas.getContext('2d');
7735
8769
  gradient_1 = ctx.createLinearGradient(x0, y0, x1, y1);
7736
- processColorStops(backgroundImage.stops, lineLength).forEach(function (colorStop) {
8770
+ processColorStops(backgroundImage.stops, lineLength || 1).forEach(function (colorStop) {
7737
8771
  return gradient_1.addColorStop(colorStop.stop, asString(colorStop.color));
7738
8772
  });
7739
8773
  ctx.fillStyle = gradient_1;
@@ -7843,7 +8877,7 @@ var Reportly = (function () {
7843
8877
  return __generator(this, function (_a) {
7844
8878
  switch (_a.label) {
7845
8879
  case 0:
7846
- this.applyEffects(paint.getEffects(2 /* BACKGROUND_BORDERS */));
8880
+ this.applyEffects(paint.getEffects(2 /* EffectTarget.BACKGROUND_BORDERS */));
7847
8881
  styles = paint.container.styles;
7848
8882
  hasBackground = !isTransparent(styles.backgroundColor) || styles.backgroundImage.length;
7849
8883
  borders = [
@@ -7899,20 +8933,20 @@ var Reportly = (function () {
7899
8933
  case 3:
7900
8934
  if (!(_i < borders_1.length)) return [3 /*break*/, 13];
7901
8935
  border = borders_1[_i];
7902
- if (!(border.style !== 0 /* NONE */ && !isTransparent(border.color) && border.width > 0)) return [3 /*break*/, 11];
7903
- if (!(border.style === 2 /* DASHED */)) return [3 /*break*/, 5];
7904
- return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 2 /* DASHED */)];
8936
+ if (!(border.style !== 0 /* BORDER_STYLE.NONE */ && !isTransparent(border.color) && border.width > 0)) return [3 /*break*/, 11];
8937
+ if (!(border.style === 2 /* BORDER_STYLE.DASHED */)) return [3 /*break*/, 5];
8938
+ return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 2 /* BORDER_STYLE.DASHED */)];
7905
8939
  case 4:
7906
8940
  _a.sent();
7907
8941
  return [3 /*break*/, 11];
7908
8942
  case 5:
7909
- if (!(border.style === 3 /* DOTTED */)) return [3 /*break*/, 7];
7910
- return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 3 /* DOTTED */)];
8943
+ if (!(border.style === 3 /* BORDER_STYLE.DOTTED */)) return [3 /*break*/, 7];
8944
+ return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 3 /* BORDER_STYLE.DOTTED */)];
7911
8945
  case 6:
7912
8946
  _a.sent();
7913
8947
  return [3 /*break*/, 11];
7914
8948
  case 7:
7915
- if (!(border.style === 4 /* DOUBLE */)) return [3 /*break*/, 9];
8949
+ if (!(border.style === 4 /* BORDER_STYLE.DOUBLE */)) return [3 /*break*/, 9];
7916
8950
  return [4 /*yield*/, this.renderDoubleBorder(border.color, border.width, side, paint.curves)];
7917
8951
  case 8:
7918
8952
  _a.sent();
@@ -7939,7 +8973,7 @@ var Reportly = (function () {
7939
8973
  this.ctx.save();
7940
8974
  strokePaths = parsePathForBorderStroke(curvePoints, side);
7941
8975
  boxPaths = parsePathForBorder(curvePoints, side);
7942
- if (style === 2 /* DASHED */) {
8976
+ if (style === 2 /* BORDER_STYLE.DASHED */) {
7943
8977
  this.path(boxPaths);
7944
8978
  this.ctx.clip();
7945
8979
  }
@@ -7966,7 +9000,7 @@ var Reportly = (function () {
7966
9000
  length = Math.abs(startY - endY);
7967
9001
  }
7968
9002
  this.ctx.beginPath();
7969
- if (style === 3 /* DOTTED */) {
9003
+ if (style === 3 /* BORDER_STYLE.DOTTED */) {
7970
9004
  this.formatPath(strokePaths);
7971
9005
  }
7972
9006
  else {
@@ -7974,7 +9008,7 @@ var Reportly = (function () {
7974
9008
  }
7975
9009
  dashLength = width < 3 ? width * 3 : width * 2;
7976
9010
  spaceLength = width < 3 ? width * 2 : width;
7977
- if (style === 3 /* DOTTED */) {
9011
+ if (style === 3 /* BORDER_STYLE.DOTTED */) {
7978
9012
  dashLength = width;
7979
9013
  spaceLength = width;
7980
9014
  }
@@ -7997,14 +9031,14 @@ var Reportly = (function () {
7997
9031
  : maxSpace;
7998
9032
  }
7999
9033
  if (useLineDash) {
8000
- if (style === 3 /* DOTTED */) {
9034
+ if (style === 3 /* BORDER_STYLE.DOTTED */) {
8001
9035
  this.ctx.setLineDash([0, dashLength + spaceLength]);
8002
9036
  }
8003
9037
  else {
8004
9038
  this.ctx.setLineDash([dashLength, spaceLength]);
8005
9039
  }
8006
9040
  }
8007
- if (style === 3 /* DOTTED */) {
9041
+ if (style === 3 /* BORDER_STYLE.DOTTED */) {
8008
9042
  this.ctx.lineCap = 'round';
8009
9043
  this.ctx.lineWidth = width;
8010
9044
  }
@@ -8015,7 +9049,7 @@ var Reportly = (function () {
8015
9049
  this.ctx.stroke();
8016
9050
  this.ctx.setLineDash([]);
8017
9051
  // dashed round edge gap
8018
- if (style === 2 /* DASHED */) {
9052
+ if (style === 2 /* BORDER_STYLE.DASHED */) {
8019
9053
  if (isBezierCurve(boxPaths[0])) {
8020
9054
  path1 = boxPaths[3];
8021
9055
  path2 = boxPaths[0];
@@ -8072,22 +9106,22 @@ var Reportly = (function () {
8072
9106
  };
8073
9107
  var calculateBackgroundCurvedPaintingArea = function (clip, curves) {
8074
9108
  switch (clip) {
8075
- case 0 /* BORDER_BOX */:
9109
+ case 0 /* BACKGROUND_CLIP.BORDER_BOX */:
8076
9110
  return calculateBorderBoxPath(curves);
8077
- case 2 /* CONTENT_BOX */:
9111
+ case 2 /* BACKGROUND_CLIP.CONTENT_BOX */:
8078
9112
  return calculateContentBoxPath(curves);
8079
- case 1 /* PADDING_BOX */:
9113
+ case 1 /* BACKGROUND_CLIP.PADDING_BOX */:
8080
9114
  default:
8081
9115
  return calculatePaddingBoxPath(curves);
8082
9116
  }
8083
9117
  };
8084
9118
  var canvasTextAlign = function (textAlign) {
8085
9119
  switch (textAlign) {
8086
- case 1 /* CENTER */:
9120
+ case 1 /* TEXT_ALIGN.CENTER */:
8087
9121
  return 'center';
8088
- case 2 /* RIGHT */:
9122
+ case 2 /* TEXT_ALIGN.RIGHT */:
8089
9123
  return 'right';
8090
- case 0 /* LEFT */:
9124
+ case 0 /* TEXT_ALIGN.LEFT */:
8091
9125
  default:
8092
9126
  return 'left';
8093
9127
  }
@@ -8109,11 +9143,11 @@ var Reportly = (function () {
8109
9143
  _this.options = options;
8110
9144
  _this.canvas.width = Math.floor(options.width * options.scale);
8111
9145
  _this.canvas.height = Math.floor(options.height * options.scale);
8112
- _this.canvas.style.width = options.width + "px";
8113
- _this.canvas.style.height = options.height + "px";
9146
+ _this.canvas.style.width = "".concat(options.width, "px");
9147
+ _this.canvas.style.height = "".concat(options.height, "px");
8114
9148
  _this.ctx.scale(_this.options.scale, _this.options.scale);
8115
9149
  _this.ctx.translate(-options.x, -options.y);
8116
- _this.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized (" + options.width + "x" + options.height + " at " + options.x + "," + options.y + ") with scale " + options.scale);
9150
+ _this.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized (".concat(options.width, "x").concat(options.height, " at ").concat(options.x, ",").concat(options.y, ") with scale ").concat(options.scale));
8117
9151
  return _this;
8118
9152
  }
8119
9153
  ForeignObjectRenderer.prototype.render = function (element) {
@@ -8145,7 +9179,7 @@ var Reportly = (function () {
8145
9179
  resolve(img);
8146
9180
  };
8147
9181
  img.onerror = reject;
8148
- img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(svg));
9182
+ img.src = "data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(svg)));
8149
9183
  });
8150
9184
  };
8151
9185
 
@@ -8166,7 +9200,7 @@ var Reportly = (function () {
8166
9200
  // eslint-disable-next-line no-console
8167
9201
  if (typeof window !== 'undefined' && window.console && typeof console.debug === 'function') {
8168
9202
  // eslint-disable-next-line no-console
8169
- console.debug.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
9203
+ console.debug.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
8170
9204
  }
8171
9205
  else {
8172
9206
  this.info.apply(this, args);
@@ -8186,7 +9220,7 @@ var Reportly = (function () {
8186
9220
  // eslint-disable-next-line no-console
8187
9221
  if (typeof window !== 'undefined' && window.console && typeof console.info === 'function') {
8188
9222
  // eslint-disable-next-line no-console
8189
- console.info.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
9223
+ console.info.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
8190
9224
  }
8191
9225
  }
8192
9226
  };
@@ -8200,7 +9234,7 @@ var Reportly = (function () {
8200
9234
  // eslint-disable-next-line no-console
8201
9235
  if (typeof window !== 'undefined' && window.console && typeof console.warn === 'function') {
8202
9236
  // eslint-disable-next-line no-console
8203
- console.warn.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
9237
+ console.warn.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
8204
9238
  }
8205
9239
  else {
8206
9240
  this.info.apply(this, args);
@@ -8217,7 +9251,7 @@ var Reportly = (function () {
8217
9251
  // eslint-disable-next-line no-console
8218
9252
  if (typeof window !== 'undefined' && window.console && typeof console.error === 'function') {
8219
9253
  // eslint-disable-next-line no-console
8220
- console.error.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
9254
+ console.error.apply(console, __spreadArray([this.id, "".concat(this.getTime(), "ms")], args, false));
8221
9255
  }
8222
9256
  else {
8223
9257
  this.info.apply(this, args);
@@ -8232,7 +9266,7 @@ var Reportly = (function () {
8232
9266
  function Context(options, windowBounds) {
8233
9267
  var _a;
8234
9268
  this.windowBounds = windowBounds;
8235
- this.instanceName = "#" + Context.instanceCount++;
9269
+ this.instanceName = "#".concat(Context.instanceCount++);
8236
9270
  this.logger = new Logger({ id: this.instanceName, enabled: options.logging });
8237
9271
  this.cache = (_a = options.cache) !== null && _a !== void 0 ? _a : new Cache(this, options);
8238
9272
  }
@@ -8268,7 +9302,8 @@ var Reportly = (function () {
8268
9302
  allowTaint: (_b = opts.allowTaint) !== null && _b !== void 0 ? _b : false,
8269
9303
  imageTimeout: (_c = opts.imageTimeout) !== null && _c !== void 0 ? _c : 15000,
8270
9304
  proxy: opts.proxy,
8271
- useCORS: (_d = opts.useCORS) !== null && _d !== void 0 ? _d : false
9305
+ useCORS: (_d = opts.useCORS) !== null && _d !== void 0 ? _d : false,
9306
+ customIsSameOrigin: opts.customIsSameOrigin
8272
9307
  };
8273
9308
  contextOptions = __assign({ logging: (_e = opts.logging) !== null && _e !== void 0 ? _e : true, cache: opts.cache }, resourceOptions);
8274
9309
  windowOptions = {
@@ -8287,7 +9322,7 @@ var Reportly = (function () {
8287
9322
  inlineImages: foreignObjectRendering,
8288
9323
  copyStyles: foreignObjectRendering
8289
9324
  };
8290
- context.logger.debug("Starting document clone with size " + windowBounds.width + "x" + windowBounds.height + " scrolled to " + -windowBounds.left + "," + -windowBounds.top);
9325
+ context.logger.debug("Starting document clone with size ".concat(windowBounds.width, "x").concat(windowBounds.height, " scrolled to ").concat(-windowBounds.left, ",").concat(-windowBounds.top));
8291
9326
  documentCloner = new DocumentCloner(context, element, cloneOptions);
8292
9327
  clonedElement = documentCloner.clonedReferenceElement;
8293
9328
  if (!clonedElement) {
@@ -8317,13 +9352,13 @@ var Reportly = (function () {
8317
9352
  canvas = _u.sent();
8318
9353
  return [3 /*break*/, 5];
8319
9354
  case 3:
8320
- context.logger.debug("Document cloned, element located at " + left + "," + top + " with size " + width + "x" + height + " using computed rendering");
9355
+ context.logger.debug("Document cloned, element located at ".concat(left, ",").concat(top, " with size ").concat(width, "x").concat(height, " using computed rendering"));
8321
9356
  context.logger.debug("Starting DOM parsing");
8322
9357
  root = parseTree(context, clonedElement);
8323
9358
  if (backgroundColor === root.styles.backgroundColor) {
8324
9359
  root.styles.backgroundColor = COLORS.TRANSPARENT;
8325
9360
  }
8326
- context.logger.debug("Starting renderer for element at " + renderOptions.x + "," + renderOptions.y + " with size " + renderOptions.width + "x" + renderOptions.height);
9361
+ context.logger.debug("Starting renderer for element at ".concat(renderOptions.x, ",").concat(renderOptions.y, " with size ").concat(renderOptions.width, "x").concat(renderOptions.height));
8327
9362
  renderer = new CanvasRenderer(context, renderOptions);
8328
9363
  return [4 /*yield*/, renderer.render(root)];
8329
9364
  case 4:
@@ -8384,38 +9419,38 @@ var Reportly = (function () {
8384
9419
  useCORS: true,
8385
9420
  logging: false,
8386
9421
  width: fullPageWidth,
8387
- height: fullPageHeight
9422
+ height: fullPageHeight,
8388
9423
  });
8389
9424
  // Restore scroll position
8390
9425
  window.scrollTo(0, originalScrollY);
8391
9426
  // Show UXbert UI elements again
8392
9427
  this.showUXbertElements();
8393
9428
  // Convert to base64
8394
- this.currentScreenshot = canvas.toDataURL('image/png');
9429
+ this.currentScreenshot = canvas.toDataURL("image/png");
8395
9430
  return this.currentScreenshot;
8396
9431
  }
8397
9432
  catch (error) {
8398
- console.error('Screenshot capture failed:', error);
9433
+ console.error("Screenshot capture failed:", error);
8399
9434
  this.showUXbertElements();
8400
9435
  throw error;
8401
9436
  }
8402
9437
  }
8403
9438
  hideUXbertElements() {
8404
9439
  const elements = document.querySelectorAll('[class*="uxbert-"]');
8405
- elements.forEach(el => {
9440
+ elements.forEach((el) => {
8406
9441
  const element = el;
8407
- element.setAttribute('data-uxbert-display', element.style.display || '');
8408
- element.style.display = 'none';
9442
+ element.setAttribute("data-uxbert-display", element.style.display || "");
9443
+ element.style.display = "none";
8409
9444
  });
8410
9445
  }
8411
9446
  showUXbertElements() {
8412
9447
  const elements = document.querySelectorAll('[class*="uxbert-"]');
8413
- elements.forEach(el => {
9448
+ elements.forEach((el) => {
8414
9449
  const element = el;
8415
- const originalDisplay = element.getAttribute('data-uxbert-display');
9450
+ const originalDisplay = element.getAttribute("data-uxbert-display");
8416
9451
  if (originalDisplay !== null) {
8417
9452
  element.style.display = originalDisplay;
8418
- element.removeAttribute('data-uxbert-display');
9453
+ element.removeAttribute("data-uxbert-display");
8419
9454
  }
8420
9455
  });
8421
9456
  }